Skip to content

Instantly share code, notes, and snippets.

@xmfbit
Created September 28, 2016 02:00
Show Gist options
  • Save xmfbit/bc5b1e83dc4ea06323599b6013d5ff3c to your computer and use it in GitHub Desktop.
Save xmfbit/bc5b1e83dc4ea06323599b6013d5ff3c to your computer and use it in GitHub Desktop.
3 lstm for ocr task
# has 3 lstm layer
name: "ocr"
layer {
name: "data"
type: "OCRData"
top: "data"
top: "label"
image_data_param {
is_color: false
source: "/home/[email protected]/exp/ocr/train_hard_list.txt"
batch_size: 50
}
transform_param {
force_gray: true
scale: 0.00390625
}
ocr_data_param {
split_flag_file: "|"
split_flag_number: ","
label_size: 4
}
}
layer {
name: "permute_data"
type: "Permute"
bottom: "data"
top: "permute_data"
permute_param {
order: 3
order: 0
order: 2
order: 1
}
}
layer {
name: "indicator_generator"
type: "TimeIndicator"
top: "indicator"
time_indicator_param {
batch_size: 50
time_step: 80
}
}
layer {
name: "lstm1"
type: "LSTM"
bottom: "permute_data"
bottom: "indicator"
top: "lstm1"
recurrent_param {
num_output: 100
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0.0
}
debug_info: false
}
}
layer {
name: "lstm2"
type: "LSTM"
bottom: "lstm1"
bottom: "indicator"
top: "lstm2"
recurrent_param {
num_output: 100
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0.0
}
debug_info: false
}
}
layer {
name: "lstm3"
type: "LSTM"
bottom: "lstm2"
bottom: "indicator"
top: "lstm3"
recurrent_param {
num_output: 100
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0.0
}
debug_info: false
}
}
layer {
name: "fc"
type: "InnerProduct"
bottom: "lstm3"
top: "fc"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output: 11
axis: 2
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "ctc_loss"
type: "CtcLoss"
bottom: "fc"
bottom: "label"
top: "ctc_loss"
loss_weight: 1.0
ctc_loss_param {
blank: 0
label_length: 4
alphabet_size: 11
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment