Skip to content

Commit

Permalink
[Fix] #1428: remove max_seq_len inconsistency (#1433)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniolanza1996 authored Oct 9, 2022
1 parent b422ded commit 5fc9204
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 25 deletions.
2 changes: 1 addition & 1 deletion configs/_base_/recog_models/abinet.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
with_unknown=False,
with_padding=False,
lower=True,
)
max_seq_len=max_seq_len)

model = dict(
type='ABINet',
Expand Down
9 changes: 7 additions & 2 deletions configs/_base_/recog_models/master.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
max_seq_len = 30

label_convertor = dict(
type='AttnConvertor', dict_type='DICT90', with_unknown=True)
type='AttnConvertor',
dict_type='DICT90',
with_unknown=True,
max_seq_len=max_seq_len)

model = dict(
type='MASTER',
Expand Down Expand Up @@ -58,4 +63,4 @@
feat_size=6 * 40),
loss=dict(type='TFLoss', reduction='mean'),
label_convertor=label_convertor,
max_seq_len=30)
max_seq_len=max_seq_len)
10 changes: 8 additions & 2 deletions configs/_base_/recog_models/nrtr_modality_transform.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
max_seq_len = 40

label_convertor = dict(
type='AttnConvertor', dict_type='DICT36', with_unknown=True, lower=True)
type='AttnConvertor',
dict_type='DICT36',
with_unknown=True,
lower=True,
max_seq_len=max_seq_len)

model = dict(
type='NRTR',
Expand All @@ -8,4 +14,4 @@
decoder=dict(type='NRTRDecoder'),
loss=dict(type='TFLoss'),
label_convertor=label_convertor,
max_seq_len=40)
max_seq_len=max_seq_len)
9 changes: 7 additions & 2 deletions configs/_base_/recog_models/robust_scanner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
max_seq_len = 30

label_convertor = dict(
type='AttnConvertor', dict_type='DICT90', with_unknown=True)
type='AttnConvertor',
dict_type='DICT90',
with_unknown=True,
max_seq_len=max_seq_len)

hybrid_decoder = dict(type='SequenceAttentionDecoder')

Expand All @@ -21,4 +26,4 @@
position_decoder=position_decoder),
loss=dict(type='SARLoss'),
label_convertor=label_convertor,
max_seq_len=30)
max_seq_len=max_seq_len)
9 changes: 7 additions & 2 deletions configs/_base_/recog_models/sar.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
max_seq_len = 30

label_convertor = dict(
type='AttnConvertor', dict_type='DICT90', with_unknown=True)
type='AttnConvertor',
dict_type='DICT90',
with_unknown=True,
max_seq_len=max_seq_len)

model = dict(
type='SARNet',
Expand All @@ -21,4 +26,4 @@
pred_concat=True),
loss=dict(type='SARLoss'),
label_convertor=label_convertor,
max_seq_len=30)
max_seq_len=max_seq_len)
10 changes: 8 additions & 2 deletions configs/_base_/recog_models/satrn.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
max_seq_len = 40

label_convertor = dict(
type='AttnConvertor', dict_type='DICT36', with_unknown=True, lower=True)
type='AttnConvertor',
dict_type='DICT36',
with_unknown=True,
lower=True,
max_seq_len=max_seq_len)

model = dict(
type='SATRN',
Expand All @@ -8,4 +14,4 @@
decoder=dict(type='TFDecoder'),
loss=dict(type='TFLoss'),
label_convertor=label_convertor,
max_seq_len=40)
max_seq_len=max_seq_len)
2 changes: 1 addition & 1 deletion configs/textrecog/abinet/abinet_vision_only_academic.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
with_unknown=False,
with_padding=False,
lower=True,
)
max_seq_len=max_seq_len)

model = dict(
type='ABINet',
Expand Down
9 changes: 7 additions & 2 deletions configs/textrecog/nrtr/nrtr_r31_1by16_1by8_academic.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@
train_pipeline = {{_base_.train_pipeline}}
test_pipeline = {{_base_.test_pipeline}}

max_seq_len = 40

label_convertor = dict(
type='AttnConvertor', dict_type='DICT90', with_unknown=True)
type='AttnConvertor',
dict_type='DICT90',
with_unknown=True,
max_seq_len=max_seq_len)

model = dict(
type='NRTR',
Expand All @@ -27,7 +32,7 @@
decoder=dict(type='NRTRDecoder'),
loss=dict(type='TFLoss'),
label_convertor=label_convertor,
max_seq_len=40)
max_seq_len=max_seq_len)

data = dict(
samples_per_gpu=128,
Expand Down
9 changes: 7 additions & 2 deletions configs/textrecog/nrtr/nrtr_r31_1by8_1by4_academic.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@
train_pipeline = {{_base_.train_pipeline}}
test_pipeline = {{_base_.test_pipeline}}

max_seq_len = 40

label_convertor = dict(
type='AttnConvertor', dict_type='DICT90', with_unknown=True)
type='AttnConvertor',
dict_type='DICT90',
with_unknown=True,
max_seq_len=max_seq_len)

model = dict(
type='NRTR',
Expand All @@ -27,7 +32,7 @@
decoder=dict(type='NRTRDecoder'),
loss=dict(type='TFLoss'),
label_convertor=label_convertor,
max_seq_len=40)
max_seq_len=max_seq_len)

data = dict(
samples_per_gpu=64,
Expand Down
9 changes: 6 additions & 3 deletions configs/textrecog/sar/sar_r31_parallel_decoder_chinese.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
'../../_base_/default_runtime.py',
'../../_base_/schedules/schedule_adam_step_5e.py'
]

max_seq_len = 30
dict_file = 'data/chineseocr/labels/dict_printed_chinese_english_digits.txt'
label_convertor = dict(
type='AttnConvertor', dict_file=dict_file, with_unknown=True)
type='AttnConvertor',
dict_file=dict_file,
with_unknown=True,
max_seq_len=max_seq_len)

model = dict(
type='SARNet',
Expand All @@ -27,7 +30,7 @@
pred_concat=True),
loss=dict(type='SARLoss'),
label_convertor=label_convertor,
max_seq_len=30)
max_seq_len=max_seq_len)

img_norm_cfg = dict(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])
train_pipeline = [
Expand Down
9 changes: 7 additions & 2 deletions configs/textrecog/sar/sar_r31_sequential_decoder_academic.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@
train_pipeline = {{_base_.train_pipeline}}
test_pipeline = {{_base_.test_pipeline}}

max_seq_len = 30

label_convertor = dict(
type='AttnConvertor', dict_type='DICT90', with_unknown=True)
type='AttnConvertor',
dict_type='DICT90',
with_unknown=True,
max_seq_len=max_seq_len)

model = dict(
type='SARNet',
Expand All @@ -35,7 +40,7 @@
pred_concat=True),
loss=dict(type='SARLoss'),
label_convertor=label_convertor,
max_seq_len=30)
max_seq_len=max_seq_len)

data = dict(
samples_per_gpu=64,
Expand Down
9 changes: 7 additions & 2 deletions configs/textrecog/satrn/satrn_academic.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@
train_pipeline = {{_base_.train_pipeline}}
test_pipeline = {{_base_.test_pipeline}}

max_seq_len = 25

label_convertor = dict(
type='AttnConvertor', dict_type='DICT90', with_unknown=True)
type='AttnConvertor',
dict_type='DICT90',
with_unknown=True,
max_seq_len=max_seq_len)

model = dict(
type='SATRN',
Expand All @@ -39,7 +44,7 @@
d_v=512 // 8),
loss=dict(type='TFLoss'),
label_convertor=label_convertor,
max_seq_len=25)
max_seq_len=max_seq_len)

# optimizer
optimizer = dict(type='Adam', lr=3e-4)
Expand Down
9 changes: 7 additions & 2 deletions configs/textrecog/satrn/satrn_small.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@
train_pipeline = {{_base_.train_pipeline}}
test_pipeline = {{_base_.test_pipeline}}

max_seq_len = 25

label_convertor = dict(
type='AttnConvertor', dict_type='DICT90', with_unknown=True)
type='AttnConvertor',
dict_type='DICT90',
with_unknown=True,
max_seq_len=max_seq_len)

model = dict(
type='SATRN',
Expand All @@ -39,7 +44,7 @@
d_v=256 // 8),
loss=dict(type='TFLoss'),
label_convertor=label_convertor,
max_seq_len=25)
max_seq_len=max_seq_len)

# optimizer
optimizer = dict(type='Adam', lr=3e-4)
Expand Down

0 comments on commit 5fc9204

Please sign in to comment.