From 0cc083f6a4bf099d19b4d02091fd0b0054cac930 Mon Sep 17 00:00:00 2001 From: tink2123 Date: Thu, 4 Jun 2020 20:29:32 +0800 Subject: [PATCH] mv drop last in det model --- configs/det/det_mv3_db.yml | 1 - configs/det/det_mv3_east.yml | 1 - configs/det/det_r50_vd_db.yml | 1 - configs/det/det_r50_vd_east.yml | 1 - configs/rec/rec_benchmark_reader.yml | 2 +- configs/rec/rec_icdar15_train.yml | 8 ++++---- configs/rec/rec_mv3_tps_bilstm_attn.yml | 6 +++--- ppocr/data/det/dataset_traversal.py | 4 ---- ppocr/modeling/architectures/rec_model.py | 4 ++-- 9 files changed, 10 insertions(+), 18 deletions(-) diff --git a/configs/det/det_mv3_db.yml b/configs/det/det_mv3_db.yml index 75500f9e..8efa66a9 100755 --- a/configs/det/det_mv3_db.yml +++ b/configs/det/det_mv3_db.yml @@ -9,7 +9,6 @@ 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/ diff --git a/configs/det/det_mv3_east.yml b/configs/det/det_mv3_east.yml index efb32d49..b6f37256 100755 --- a/configs/det/det_mv3_east.yml +++ b/configs/det/det_mv3_east.yml @@ -9,7 +9,6 @@ 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/ diff --git a/configs/det/det_r50_vd_db.yml b/configs/det/det_r50_vd_db.yml index eaad7fbd..6e3b3b9e 100755 --- a/configs/det/det_r50_vd_db.yml +++ b/configs/det/det_r50_vd_db.yml @@ -10,7 +10,6 @@ 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 diff --git a/configs/det/det_r50_vd_east.yml b/configs/det/det_r50_vd_east.yml index e05bce3f..bb16f9fa 100755 --- a/configs/det/det_r50_vd_east.yml +++ b/configs/det/det_r50_vd_east.yml @@ -10,7 +10,6 @@ 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 diff --git a/configs/rec/rec_benchmark_reader.yml b/configs/rec/rec_benchmark_reader.yml index 524f2f68..ef4dd909 100755 --- a/configs/rec/rec_benchmark_reader.yml +++ b/configs/rec/rec_benchmark_reader.yml @@ -1,7 +1,7 @@ TrainReader: reader_function: ppocr.data.rec.dataset_traversal,LMDBReader num_workers: 8 - lmdb_sets_dir: ./train_data/data_lmdb_release/training/ + lmdb_sets_dir: ./train_data/data_lmdb_release/evaluation/ EvalReader: reader_function: ppocr.data.rec.dataset_traversal,LMDBReader diff --git a/configs/rec/rec_icdar15_train.yml b/configs/rec/rec_icdar15_train.yml index 934a9410..b3b22985 100755 --- a/configs/rec/rec_icdar15_train.yml +++ b/configs/rec/rec_icdar15_train.yml @@ -1,20 +1,20 @@ Global: algorithm: CRNN - use_gpu: true + use_gpu: false epoch_num: 1000 log_smooth_window: 20 print_batch_step: 10 save_model_dir: ./output/rec_CRNN save_epoch_step: 300 eval_batch_step: 500 - train_batch_size_per_card: 256 - test_batch_size_per_card: 256 + train_batch_size_per_card: 2 + test_batch_size_per_card: 2 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: diff --git a/configs/rec/rec_mv3_tps_bilstm_attn.yml b/configs/rec/rec_mv3_tps_bilstm_attn.yml index 7fc4f679..a9dbce6a 100755 --- a/configs/rec/rec_mv3_tps_bilstm_attn.yml +++ b/configs/rec/rec_mv3_tps_bilstm_attn.yml @@ -1,14 +1,14 @@ Global: algorithm: RARE - use_gpu: true + use_gpu: false epoch_num: 72 log_smooth_window: 20 print_batch_step: 10 save_model_dir: output/rec_RARE save_epoch_step: 3 eval_batch_step: 2000 - train_batch_size_per_card: 256 - test_batch_size_per_card: 256 + train_batch_size_per_card: 2 + test_batch_size_per_card: 2 image_shape: [3, 32, 100] max_text_length: 25 character_type: en diff --git a/ppocr/data/det/dataset_traversal.py b/ppocr/data/det/dataset_traversal.py index 76fa6408..ab635de3 100644 --- a/ppocr/data/det/dataset_traversal.py +++ b/ppocr/data/det/dataset_traversal.py @@ -32,7 +32,6 @@ 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) @@ -62,9 +61,6 @@ class TrainReader(object): if len(batch_outs) == self.batch_size: yield batch_outs batch_outs = [] - if not self.drop_last: - if len(batch_outs) != 0: - yield batch_outs return batch_iter_reader diff --git a/ppocr/modeling/architectures/rec_model.py b/ppocr/modeling/architectures/rec_model.py index af651e9a..e80a50ab 100755 --- a/ppocr/modeling/architectures/rec_model.py +++ b/ppocr/modeling/architectures/rec_model.py @@ -94,9 +94,9 @@ class RecModel(object): logger.info( "WARNRNG!!!\n" "TPS does not support variable shape in chinese!" - "We set default shape=[3,32,320], it may affect the inference effect" + "We set img_shape to be the same , it may affect the inference effect" ) - image_shape[-1] = 320 + image_shape = deepcopy(self.image_shape) image = fluid.data(name='image', shape=image_shape, dtype='float32') labels = None loader = None -- GitLab