set drop_last=false

This commit is contained in:
tink2123 2020-06-03 20:07:58 +08:00
parent 9023a5c57a
commit 8d9324cab1
16 changed files with 27 additions and 15 deletions

View File

@ -9,6 +9,7 @@ Global:
eval_batch_step: 5000
train_batch_size_per_card: 16
test_batch_size_per_card: 16
drop_last: false
image_shape: [3, 640, 640]
reader_yml: ./configs/det/det_db_icdar15_reader.yml
pretrain_weights: ./pretrain_models/MobileNetV3_large_x0_5_pretrained/

View File

@ -9,6 +9,7 @@ Global:
eval_batch_step: 5000
train_batch_size_per_card: 16
test_batch_size_per_card: 16
drop_last: false
image_shape: [3, 512, 512]
reader_yml: ./configs/det/det_east_icdar15_reader.yml
pretrain_weights: ./pretrain_models/MobileNetV3_large_x0_5_pretrained/

View File

@ -10,6 +10,7 @@ Global:
train_batch_size_per_card: 8
test_batch_size_per_card: 16
image_shape: [3, 640, 640]
drop_last: false
reader_yml: ./configs/det/det_db_icdar15_reader.yml
pretrain_weights: ./pretrain_models/ResNet50_vd_ssld_pretrained/
save_res_path: ./output/det_db/predicts_db.txt

View File

@ -10,6 +10,7 @@ Global:
train_batch_size_per_card: 8
test_batch_size_per_card: 16
image_shape: [3, 512, 512]
drop_last: false
reader_yml: ./configs/det/det_east_icdar15_reader.yml
pretrain_weights: ./pretrain_models/ResNet50_vd_ssld_pretrained/
save_res_path: ./output/det_east/predicts_east.txt

View File

@ -8,8 +8,8 @@ Global:
save_epoch_step: 3
eval_batch_step: 2000
train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 320]
max_text_length: 25
character_type: ch

View File

@ -8,14 +8,14 @@ Global:
save_epoch_step: 300
eval_batch_step: 500
train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 100]
max_text_length: 25
character_type: en
loss_type: ctc
reader_yml: ./configs/rec/rec_icdar15_reader.yml
pretrain_weights: ./pretrain_models/rec_mv3_none_bilstm_ctc/best_accuracy
pretrain_weights:
checkpoints:
save_inference_dir:
infer_img:

View File

@ -8,8 +8,8 @@ Global:
save_epoch_step: 3
eval_batch_step: 2000
train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 100]
max_text_length: 25
character_type: en

View File

@ -8,8 +8,8 @@ Global:
save_epoch_step: 3
eval_batch_step: 2000
train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 100]
max_text_length: 25
character_type: en

View File

@ -8,8 +8,8 @@ Global:
save_epoch_step: 3
eval_batch_step: 2000
train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 100]
max_text_length: 25
character_type: en

View File

@ -8,8 +8,8 @@ Global:
save_epoch_step: 3
eval_batch_step: 2000
train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 100]
max_text_length: 25
character_type: en

View File

@ -8,8 +8,8 @@ Global:
save_epoch_step: 3
eval_batch_step: 2000
train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 100]
max_text_length: 25
character_type: en

View File

@ -8,8 +8,8 @@ Global:
save_epoch_step: 3
eval_batch_step: 2000
train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 100]
max_text_length: 25
character_type: en

View File

@ -8,8 +8,8 @@ Global:
save_epoch_step: 3
eval_batch_step: 2000
train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 100]
max_text_length: 25
character_type: en

View File

@ -8,8 +8,8 @@ Global:
save_epoch_step: 3
eval_batch_step: 2000
train_batch_size_per_card: 256
drop_last: true
test_batch_size_per_card: 256
drop_last: false
image_shape: [3, 32, 100]
max_text_length: 25
character_type: en

View File

@ -32,6 +32,7 @@ class TrainReader(object):
self.num_workers = params['num_workers']
self.label_file_path = params['label_file_path']
self.batch_size = params['train_batch_size_per_card']
self.drop_last = params['drop_last']
assert 'process_function' in params,\
"absence process_function in Reader"
self.process = create_module(params['process_function'])(params)
@ -61,8 +62,9 @@ class TrainReader(object):
if len(batch_outs) == self.batch_size:
yield batch_outs
batch_outs = []
if len(batch_outs) != 0:
yield batch_outs
if not self.drop_last:
if len(batch_outs) != 0:
yield batch_outs
return batch_iter_reader

View File

@ -42,6 +42,7 @@ class LMDBReader(object):
self.max_text_length = params['max_text_length']
self.mode = params['mode']
self.drop_last = False
self.tps = False
if "tps" in params:
self.tps = True
if params['mode'] == 'train':
@ -180,6 +181,9 @@ class SimpleReader(object):
self.max_text_length = params['max_text_length']
self.mode = params['mode']
self.infer_img = params['infer_img']
self.tps = False
if "tps" in params:
self.tps = True
self.drop_last = False
if params['mode'] == 'train':
self.batch_size = params['train_batch_size_per_card']
@ -192,7 +196,7 @@ class SimpleReader(object):
process_id = 0
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)
for single_img in image_file_list:
img = cv2.imread(single_img)
@ -201,7 +205,9 @@ class SimpleReader(object):
norm_img = process_image(
img=img,
image_shape=self.image_shape,
char_ops=self.char_ops)
char_ops=self.char_ops,
tps=self.tps,
infer_mode=True)
yield norm_img
else:
with open(self.label_file_path, "rb") as fin: