diff --git a/README.md b/README.md index b0b21ed495c6d5457e60cced488656c400fca9f4..0a54f960bd7054e37c4925e266766feaf90f62ac 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ python3 tools/infer/predict_system.py --image_dir="./doc/imgs_en/img_12.jpg" --d - [文本检测模型训练/评估/预测](./doc/doc_ch/detection.md) - [文本识别模型训练/评估/预测](./doc/doc_ch/recognition.md) - [基于预测引擎推理](./doc/doc_ch/inference.md) +- [yml配置文件参数介绍](./doc/doc_ch/config_ch.md) - [数据集](./doc/doc_ch/datasets.md) - [FAQ](#FAQ) - [联系我们](#欢迎加入PaddleOCR技术交流群) diff --git a/configs/det/det_mv3_db.yml b/configs/det/det_mv3_db.yml index 8efa66a92d6e8c031efef48d738d9690bcc5554c..caa7bd4fa09752cff8b4d596e80b5729cce175bf 100755 --- a/configs/det/det_mv3_db.yml +++ b/configs/det/det_mv3_db.yml @@ -6,7 +6,8 @@ Global: print_batch_step: 2 save_model_dir: ./output/det_db/ save_epoch_step: 200 - eval_batch_step: 5000 + # evaluation is run every 5000 iterations after the 4000th iteration + eval_batch_step: [4000, 5000] train_batch_size_per_card: 16 test_batch_size_per_card: 16 image_shape: [3, 640, 640] @@ -50,4 +51,4 @@ PostProcess: thresh: 0.3 box_thresh: 0.7 max_candidates: 1000 - unclip_ratio: 2.0 \ No newline at end of file + unclip_ratio: 2.0 diff --git a/configs/det/det_mv3_east.yml b/configs/det/det_mv3_east.yml index b6f37256291912757cd1d5b98d1f745d08452fd6..67b82fffff8c47e5ee5866ad22f238ece3822776 100755 --- a/configs/det/det_mv3_east.yml +++ b/configs/det/det_mv3_east.yml @@ -6,7 +6,7 @@ Global: print_batch_step: 5 save_model_dir: ./output/det_east/ save_epoch_step: 200 - eval_batch_step: 5000 + eval_batch_step: [5000, 5000] train_batch_size_per_card: 16 test_batch_size_per_card: 16 image_shape: [3, 512, 512] diff --git a/configs/det/det_r50_vd_db.yml b/configs/det/det_r50_vd_db.yml index 6e3b3b9e264b29fcac2b2b9b20ee2f88d5c975f3..9a3b77e7cebce99f669d0b1be89ee56c84f41034 100755 --- a/configs/det/det_r50_vd_db.yml +++ b/configs/det/det_r50_vd_db.yml @@ -6,7 +6,7 @@ Global: print_batch_step: 2 save_model_dir: ./output/det_db/ save_epoch_step: 200 - eval_batch_step: 5000 + eval_batch_step: [5000, 5000] train_batch_size_per_card: 8 test_batch_size_per_card: 16 image_shape: [3, 640, 640] diff --git a/configs/det/det_r50_vd_east.yml b/configs/det/det_r50_vd_east.yml index bb16f9fa12424db293ba498e78b00f279f1a7ff6..8d86819937c902e47dded38ae0238fb8254d8ff0 100755 --- a/configs/det/det_r50_vd_east.yml +++ b/configs/det/det_r50_vd_east.yml @@ -6,7 +6,7 @@ Global: print_batch_step: 5 save_model_dir: ./output/det_east/ save_epoch_step: 200 - eval_batch_step: 5000 + eval_batch_step: [5000, 5000] train_batch_size_per_card: 8 test_batch_size_per_card: 16 image_shape: [3, 512, 512] diff --git a/doc/doc_ch/config.md b/doc/doc_ch/config.md index 6a57b5154cc70507f7791e5262fa3b28976a12a7..bee2637094b1386210677788f0944d232f7ff82c 100644 --- a/doc/doc_ch/config.md +++ b/doc/doc_ch/config.md @@ -22,7 +22,7 @@ | print_batch_step | 设置打印log间隔 | 10 | \ | | save_model_dir | 设置模型保存路径 | output/{算法名称} | \ | | save_epoch_step | 设置模型保存间隔 | 3 | \ | -| eval_batch_step | 设置模型评估间隔 | 2000 | \ | +| eval_batch_step | 设置模型评估间隔 | 2000 或 [1000, 2000] | 2000 表示每2000次迭代评估一次,[1000, 2000]表示从1000次迭代开始,每2000次评估一次 | |train_batch_size_per_card | 设置训练时单卡batch size | 256 | \ | | test_batch_size_per_card | 设置评估时单卡batch size | 256 | \ | | image_shape | 设置输入图片尺寸 | [3, 32, 100] | \ | diff --git a/doc/doc_en/config_en.md b/doc/doc_en/config_en.md index 4ff968e0e2fe3b52eb9bd347564e51e590be86cf..ffead1ee335a3d2f10491792a23a69e0f22a1755 100644 --- a/doc/doc_en/config_en.md +++ b/doc/doc_en/config_en.md @@ -22,7 +22,7 @@ Take `rec_chinese_lite_train.yml` as an example | print_batch_step | Set print log interval | 10 | \ | | save_model_dir | Set model save path | output/{model_name} | \ | | save_epoch_step | Set model save interval | 3 | \ | -| eval_batch_step | Set the model evaluation interval | 2000 | \ | +| eval_batch_step | Set the model evaluation interval |2000 or [1000, 2000] |runing evaluation every 2000 iters or evaluation is run every 2000 iterations after the 1000th iteration | |train_batch_size_per_card | Set the batch size during training | 256 | \ | | test_batch_size_per_card | Set the batch size during testing | 256 | \ | | image_shape | Set input image size | [3, 32, 100] | \ | diff --git a/tools/program.py b/tools/program.py index 3c71065a167fa18fc9d00535dace97737904b74d..870d27002f36bbed4b7a665f4ff9bc9cc420f0c1 100755 --- a/tools/program.py +++ b/tools/program.py @@ -219,6 +219,13 @@ def train_eval_det_run(config, exe, train_info_dict, eval_info_dict): epoch_num = config['Global']['epoch_num'] print_batch_step = config['Global']['print_batch_step'] eval_batch_step = config['Global']['eval_batch_step'] + start_eval_step = 0 + if type(eval_batch_step) == list and len(eval_batch_step) >= 2: + start_eval_step = eval_batch_step[0] + eval_batch_step = eval_batch_step[1] + logger.info( + "During the training process, after the {}th iteration, an evaluation is run every {} iterations". + format(start_eval_step, eval_batch_step)) save_epoch_step = config['Global']['save_epoch_step'] save_model_dir = config['Global']['save_model_dir'] if not os.path.exists(save_model_dir): @@ -246,7 +253,7 @@ def train_eval_det_run(config, exe, train_info_dict, eval_info_dict): t2 = time.time() train_batch_elapse = t2 - t1 train_stats.update(stats) - if train_batch_id > 0 and train_batch_id \ + if train_batch_id > start_eval_step and (train_batch_id -start_eval_step) \ % print_batch_step == 0: logs = train_stats.log() strs = 'epoch: {}, iter: {}, {}, time: {:.3f}'.format( @@ -286,6 +293,13 @@ def train_eval_rec_run(config, exe, train_info_dict, eval_info_dict): epoch_num = config['Global']['epoch_num'] print_batch_step = config['Global']['print_batch_step'] eval_batch_step = config['Global']['eval_batch_step'] + start_eval_step = 0 + if type(eval_batch_step) == list and len(eval_batch_step) >= 2: + start_eval_step = eval_batch_step[0] + eval_batch_step = eval_batch_step[1] + logger.info( + "During the training process, after the {}th iteration, an evaluation is run every {} iterations". + format(start_eval_step, eval_batch_step)) save_epoch_step = config['Global']['save_epoch_step'] save_model_dir = config['Global']['save_model_dir'] if not os.path.exists(save_model_dir): @@ -324,7 +338,7 @@ def train_eval_rec_run(config, exe, train_info_dict, eval_info_dict): train_batch_elapse = t2 - t1 stats = {'loss': loss, 'acc': acc} train_stats.update(stats) - if train_batch_id > 0 and train_batch_id \ + if train_batch_id > start_eval_step and (train_batch_id - start_eval_step) \ % print_batch_step == 0: logs = train_stats.log() strs = 'epoch: {}, iter: {}, lr: {:.6f}, {}, time: {:.3f}'.format(