提交 8d9324ca 编写于 作者: T tink2123

set drop_last=false

上级 9023a5c5
...@@ -9,6 +9,7 @@ Global: ...@@ -9,6 +9,7 @@ Global:
eval_batch_step: 5000 eval_batch_step: 5000
train_batch_size_per_card: 16 train_batch_size_per_card: 16
test_batch_size_per_card: 16 test_batch_size_per_card: 16
drop_last: false
image_shape: [3, 640, 640] image_shape: [3, 640, 640]
reader_yml: ./configs/det/det_db_icdar15_reader.yml reader_yml: ./configs/det/det_db_icdar15_reader.yml
pretrain_weights: ./pretrain_models/MobileNetV3_large_x0_5_pretrained/ pretrain_weights: ./pretrain_models/MobileNetV3_large_x0_5_pretrained/
......
...@@ -9,6 +9,7 @@ Global: ...@@ -9,6 +9,7 @@ Global:
eval_batch_step: 5000 eval_batch_step: 5000
train_batch_size_per_card: 16 train_batch_size_per_card: 16
test_batch_size_per_card: 16 test_batch_size_per_card: 16
drop_last: false
image_shape: [3, 512, 512] image_shape: [3, 512, 512]
reader_yml: ./configs/det/det_east_icdar15_reader.yml reader_yml: ./configs/det/det_east_icdar15_reader.yml
pretrain_weights: ./pretrain_models/MobileNetV3_large_x0_5_pretrained/ pretrain_weights: ./pretrain_models/MobileNetV3_large_x0_5_pretrained/
......
...@@ -10,6 +10,7 @@ Global: ...@@ -10,6 +10,7 @@ Global:
train_batch_size_per_card: 8 train_batch_size_per_card: 8
test_batch_size_per_card: 16 test_batch_size_per_card: 16
image_shape: [3, 640, 640] image_shape: [3, 640, 640]
drop_last: false
reader_yml: ./configs/det/det_db_icdar15_reader.yml reader_yml: ./configs/det/det_db_icdar15_reader.yml
pretrain_weights: ./pretrain_models/ResNet50_vd_ssld_pretrained/ pretrain_weights: ./pretrain_models/ResNet50_vd_ssld_pretrained/
save_res_path: ./output/det_db/predicts_db.txt save_res_path: ./output/det_db/predicts_db.txt
......
...@@ -10,6 +10,7 @@ Global: ...@@ -10,6 +10,7 @@ Global:
train_batch_size_per_card: 8 train_batch_size_per_card: 8
test_batch_size_per_card: 16 test_batch_size_per_card: 16
image_shape: [3, 512, 512] image_shape: [3, 512, 512]
drop_last: false
reader_yml: ./configs/det/det_east_icdar15_reader.yml reader_yml: ./configs/det/det_east_icdar15_reader.yml
pretrain_weights: ./pretrain_models/ResNet50_vd_ssld_pretrained/ pretrain_weights: ./pretrain_models/ResNet50_vd_ssld_pretrained/
save_res_path: ./output/det_east/predicts_east.txt save_res_path: ./output/det_east/predicts_east.txt
......
...@@ -8,8 +8,8 @@ Global: ...@@ -8,8 +8,8 @@ Global:
save_epoch_step: 3 save_epoch_step: 3
eval_batch_step: 2000 eval_batch_step: 2000
train_batch_size_per_card: 256 train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256 test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 320] image_shape: [3, 32, 320]
max_text_length: 25 max_text_length: 25
character_type: ch character_type: ch
......
...@@ -8,14 +8,14 @@ Global: ...@@ -8,14 +8,14 @@ Global:
save_epoch_step: 300 save_epoch_step: 300
eval_batch_step: 500 eval_batch_step: 500
train_batch_size_per_card: 256 train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256 test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 100] image_shape: [3, 32, 100]
max_text_length: 25 max_text_length: 25
character_type: en character_type: en
loss_type: ctc loss_type: ctc
reader_yml: ./configs/rec/rec_icdar15_reader.yml reader_yml: ./configs/rec/rec_icdar15_reader.yml
pretrain_weights: ./pretrain_models/rec_mv3_none_bilstm_ctc/best_accuracy pretrain_weights:
checkpoints: checkpoints:
save_inference_dir: save_inference_dir:
infer_img: infer_img:
......
...@@ -8,8 +8,8 @@ Global: ...@@ -8,8 +8,8 @@ Global:
save_epoch_step: 3 save_epoch_step: 3
eval_batch_step: 2000 eval_batch_step: 2000
train_batch_size_per_card: 256 train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256 test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 100] image_shape: [3, 32, 100]
max_text_length: 25 max_text_length: 25
character_type: en character_type: en
......
...@@ -8,8 +8,8 @@ Global: ...@@ -8,8 +8,8 @@ Global:
save_epoch_step: 3 save_epoch_step: 3
eval_batch_step: 2000 eval_batch_step: 2000
train_batch_size_per_card: 256 train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256 test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 100] image_shape: [3, 32, 100]
max_text_length: 25 max_text_length: 25
character_type: en character_type: en
......
...@@ -8,8 +8,8 @@ Global: ...@@ -8,8 +8,8 @@ Global:
save_epoch_step: 3 save_epoch_step: 3
eval_batch_step: 2000 eval_batch_step: 2000
train_batch_size_per_card: 256 train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256 test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 100] image_shape: [3, 32, 100]
max_text_length: 25 max_text_length: 25
character_type: en character_type: en
......
...@@ -8,8 +8,8 @@ Global: ...@@ -8,8 +8,8 @@ Global:
save_epoch_step: 3 save_epoch_step: 3
eval_batch_step: 2000 eval_batch_step: 2000
train_batch_size_per_card: 256 train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256 test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 100] image_shape: [3, 32, 100]
max_text_length: 25 max_text_length: 25
character_type: en character_type: en
......
...@@ -8,8 +8,8 @@ Global: ...@@ -8,8 +8,8 @@ Global:
save_epoch_step: 3 save_epoch_step: 3
eval_batch_step: 2000 eval_batch_step: 2000
train_batch_size_per_card: 256 train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256 test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 100] image_shape: [3, 32, 100]
max_text_length: 25 max_text_length: 25
character_type: en character_type: en
......
...@@ -8,8 +8,8 @@ Global: ...@@ -8,8 +8,8 @@ Global:
save_epoch_step: 3 save_epoch_step: 3
eval_batch_step: 2000 eval_batch_step: 2000
train_batch_size_per_card: 256 train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256 test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 100] image_shape: [3, 32, 100]
max_text_length: 25 max_text_length: 25
character_type: en character_type: en
......
...@@ -8,8 +8,8 @@ Global: ...@@ -8,8 +8,8 @@ Global:
save_epoch_step: 3 save_epoch_step: 3
eval_batch_step: 2000 eval_batch_step: 2000
train_batch_size_per_card: 256 train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256 test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 100] image_shape: [3, 32, 100]
max_text_length: 25 max_text_length: 25
character_type: en character_type: en
......
...@@ -8,8 +8,8 @@ Global: ...@@ -8,8 +8,8 @@ Global:
save_epoch_step: 3 save_epoch_step: 3
eval_batch_step: 2000 eval_batch_step: 2000
train_batch_size_per_card: 256 train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256 test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 100] image_shape: [3, 32, 100]
max_text_length: 25 max_text_length: 25
character_type: en character_type: en
......
...@@ -32,6 +32,7 @@ class TrainReader(object): ...@@ -32,6 +32,7 @@ class TrainReader(object):
self.num_workers = params['num_workers'] self.num_workers = params['num_workers']
self.label_file_path = params['label_file_path'] self.label_file_path = params['label_file_path']
self.batch_size = params['train_batch_size_per_card'] self.batch_size = params['train_batch_size_per_card']
self.drop_last = params['drop_last']
assert 'process_function' in params,\ assert 'process_function' in params,\
"absence process_function in Reader" "absence process_function in Reader"
self.process = create_module(params['process_function'])(params) self.process = create_module(params['process_function'])(params)
...@@ -61,8 +62,9 @@ class TrainReader(object): ...@@ -61,8 +62,9 @@ class TrainReader(object):
if len(batch_outs) == self.batch_size: if len(batch_outs) == self.batch_size:
yield batch_outs yield batch_outs
batch_outs = [] batch_outs = []
if len(batch_outs) != 0: if not self.drop_last:
yield batch_outs if len(batch_outs) != 0:
yield batch_outs
return batch_iter_reader return batch_iter_reader
......
...@@ -42,6 +42,7 @@ class LMDBReader(object): ...@@ -42,6 +42,7 @@ class LMDBReader(object):
self.max_text_length = params['max_text_length'] self.max_text_length = params['max_text_length']
self.mode = params['mode'] self.mode = params['mode']
self.drop_last = False self.drop_last = False
self.tps = False
if "tps" in params: if "tps" in params:
self.tps = True self.tps = True
if params['mode'] == 'train': if params['mode'] == 'train':
...@@ -180,6 +181,9 @@ class SimpleReader(object): ...@@ -180,6 +181,9 @@ class SimpleReader(object):
self.max_text_length = params['max_text_length'] self.max_text_length = params['max_text_length']
self.mode = params['mode'] self.mode = params['mode']
self.infer_img = params['infer_img'] self.infer_img = params['infer_img']
self.tps = False
if "tps" in params:
self.tps = True
self.drop_last = False self.drop_last = False
if params['mode'] == 'train': if params['mode'] == 'train':
self.batch_size = params['train_batch_size_per_card'] self.batch_size = params['train_batch_size_per_card']
...@@ -192,7 +196,7 @@ class SimpleReader(object): ...@@ -192,7 +196,7 @@ class SimpleReader(object):
process_id = 0 process_id = 0
def sample_iter_reader(): def sample_iter_reader():
if self.infer_img is not None: if self.mode != 'train' and self.infer_img is not None:
image_file_list = get_image_file_list(self.infer_img) image_file_list = get_image_file_list(self.infer_img)
for single_img in image_file_list: for single_img in image_file_list:
img = cv2.imread(single_img) img = cv2.imread(single_img)
...@@ -201,7 +205,9 @@ class SimpleReader(object): ...@@ -201,7 +205,9 @@ class SimpleReader(object):
norm_img = process_image( norm_img = process_image(
img=img, img=img,
image_shape=self.image_shape, image_shape=self.image_shape,
char_ops=self.char_ops) char_ops=self.char_ops,
tps=self.tps,
infer_mode=True)
yield norm_img yield norm_img
else: else:
with open(self.label_file_path, "rb") as fin: with open(self.label_file_path, "rb") as fin:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册