diff --git a/configs/det/ch_PP-OCRv4/ch_PP-OCRv4_det_student.yml b/configs/det/ch_PP-OCRv4/ch_PP-OCRv4_det_student.yml index 04caf85088a8b3169a5cbea58b425185ca4666cb..39b260cf3ad0a0bb9664a5165f3262962bba072e 100644 --- a/configs/det/ch_PP-OCRv4/ch_PP-OCRv4_det_student.yml +++ b/configs/det/ch_PP-OCRv4/ch_PP-OCRv4_det_student.yml @@ -1,10 +1,10 @@ Global: debug: false use_gpu: true - epoch_num: 500 + epoch_num: &epoch_num 500 log_smooth_window: 20 print_batch_step: 100 - save_model_dir: ./output/ch_PP-OCRv3_mv3_cbnlocal_shrink/ + save_model_dir: ./output/ch_PP-OCRv4 save_epoch_step: 10 eval_batch_step: - 0 @@ -31,9 +31,8 @@ Architecture: out_channels: 96 shortcut: True Head: - name: PFHeadLocal + name: DBHead k: 50 - mode: "small" Loss: name: DBLoss @@ -96,19 +95,19 @@ Train: - 3 - EastRandomCropData: size: - - 960 - - 960 + - 640 + - 640 max_tries: 50 keep_ratio: true - MakeBorderMap: shrink_ratio: 0.4 thresh_min: 0.3 thresh_max: 0.7 - total_epoch: 500 + total_epoch: *epoch_num - MakeShrinkMap: shrink_ratio: 0.4 min_text_size: 8 - total_epoch: 500 + total_epoch: *epoch_num - NormalizeImage: scale: 1./255. mean: diff --git a/configs/det/ch_PP-OCRv4/ch_PP-OCRv4_det_teacher.yml b/configs/det/ch_PP-OCRv4/ch_PP-OCRv4_det_teacher.yml index 5109f490c89304fb0c7b1b344a16f7c578754c3b..b58af1cc9be9c20372caa1fc94d233c7e14c0773 100644 --- a/configs/det/ch_PP-OCRv4/ch_PP-OCRv4_det_teacher.yml +++ b/configs/det/ch_PP-OCRv4/ch_PP-OCRv4_det_teacher.yml @@ -1,10 +1,10 @@ Global: debug: false use_gpu: true - epoch_num: 500 + epoch_num: &epoch_num 500 log_smooth_window: 20 print_batch_step: 100 - save_model_dir: ./output/ch_PP-OCRv3_mv3_cbnlocal_shrink/ + save_model_dir: ./output/ch_PP-OCRv4 save_epoch_step: 10 eval_batch_step: - 0 @@ -96,19 +96,19 @@ Train: - 3 - EastRandomCropData: size: - - 960 - - 960 + - 640 + - 640 max_tries: 50 keep_ratio: true - MakeBorderMap: shrink_ratio: 0.4 thresh_min: 0.3 thresh_max: 0.7 - total_epoch: 500 + total_epoch: *epoch_num - MakeShrinkMap: shrink_ratio: 0.4 min_text_size: 8 - total_epoch: 500 + total_epoch: *epoch_num - NormalizeImage: scale: 1./255. mean: diff --git a/ppocr/data/simple_dataset.py b/ppocr/data/simple_dataset.py index 333ca67f58918c39c792067bf9b0bd4167cd074a..044eafe10ebc381ee623500a2207491e1c51f08a 100644 --- a/ppocr/data/simple_dataset.py +++ b/ppocr/data/simple_dataset.py @@ -51,22 +51,22 @@ class SimpleDataSet(Dataset): if self.mode == "train" and self.do_shuffle: self.shuffle_data_random() - self.set_epoch_as_seed(self.seed) + self.set_epoch_as_seed(self.seed, dataset_config) self.ops = create_operators(dataset_config['transforms'], global_config) self.ext_op_transform_idx = dataset_config.get("ext_op_transform_idx", 2) self.need_reset = True in [x < 1 for x in ratio_list] - def set_epoch_as_seed(self, seed): - if self.mode is 'train': + def set_epoch_as_seed(self, seed, dataset_config): + if self.mode == 'train': try: dataset_config['transforms'][5]['MakeBorderMap'][ 'epoch'] = seed if seed is not None else 0 dataset_config['transforms'][6]['MakeShrinkMap'][ 'epoch'] = seed if seed is not None else 0 except Exception as E: - logger.info(E) + print(E) return def get_image_info_list(self, file_list, ratio_list):