From e1239409b806c65b99960bbc6dc3fe5b673f33de Mon Sep 17 00:00:00 2001 From: tink2123 Date: Tue, 19 May 2020 10:50:42 +0800 Subject: [PATCH 1/4] fix pretrain model path --- configs/det/det_mv3_east.yml | 4 ++-- configs/det/det_r50_vd_db.yml | 4 ++-- configs/det/det_r50_vd_east.yml | 4 ++-- doc/installation.md | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/configs/det/det_mv3_east.yml b/configs/det/det_mv3_east.yml index b1129ce99..b6f372562 100755 --- a/configs/det/det_mv3_east.yml +++ b/configs/det/det_mv3_east.yml @@ -11,7 +11,7 @@ Global: test_batch_size_per_card: 16 image_shape: [3, 512, 512] reader_yml: ./configs/det/det_east_icdar15_reader.yml - pretrain_weights: ./pretrain_models/MobileNetV3_pretrained/MobileNetV3_large_x0_5_pretrained/ + pretrain_weights: ./pretrain_models/MobileNetV3_large_x0_5_pretrained/ checkpoints: save_res_path: ./output/det_east/predicts_east.txt save_inference_dir: @@ -42,4 +42,4 @@ PostProcess: score_thresh: 0.8 cover_thresh: 0.1 nms_thresh: 0.2 - \ No newline at end of file + diff --git a/configs/det/det_r50_vd_db.yml b/configs/det/det_r50_vd_db.yml index 78550411a..6e3b3b9e2 100755 --- a/configs/det/det_r50_vd_db.yml +++ b/configs/det/det_r50_vd_db.yml @@ -11,7 +11,7 @@ Global: test_batch_size_per_card: 16 image_shape: [3, 640, 640] reader_yml: ./configs/det/det_db_icdar15_reader.yml - pretrain_weights: ./pretrain_models/ResNet50_vd_pretrained/ + pretrain_weights: ./pretrain_models/ResNet50_vd_ssld_pretrained/ save_res_path: ./output/det_db/predicts_db.txt checkpoints: save_inference_dir: @@ -50,4 +50,4 @@ PostProcess: box_thresh: 0.7 max_candidates: 1000 unclip_ratio: 1.5 - \ No newline at end of file + diff --git a/configs/det/det_r50_vd_east.yml b/configs/det/det_r50_vd_east.yml index f0f6e4a47..bb16f9fa1 100755 --- a/configs/det/det_r50_vd_east.yml +++ b/configs/det/det_r50_vd_east.yml @@ -11,7 +11,7 @@ Global: test_batch_size_per_card: 16 image_shape: [3, 512, 512] reader_yml: ./configs/det/det_east_icdar15_reader.yml - pretrain_weights: ./pretrain_models/ResNet50_vd_pretrained/ + pretrain_weights: ./pretrain_models/ResNet50_vd_ssld_pretrained/ save_res_path: ./output/det_east/predicts_east.txt checkpoints: save_inference_dir: @@ -41,4 +41,4 @@ PostProcess: score_thresh: 0.8 cover_thresh: 0.1 nms_thresh: 0.2 - \ No newline at end of file + diff --git a/doc/installation.md b/doc/installation.md index 8f4f3c375..1c6fead80 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -20,7 +20,7 @@ sudo nvidia-docker run --name ppocr -v $PWD:/paddle --network=host -it hub.baidu sudo nvidia-docker container exec -it ppocr /bin/bash ``` -2. 安装PaddlePaddle Fluid v1.7或更高版本 +2. 安装PaddlePaddle Fluid v1.7(暂不支持更高版本,适配工作进行中) ``` pip3 install --upgrade pip From 3ffb3879c669f2a852fd50008a1ae4657f4df450 Mon Sep 17 00:00:00 2001 From: tink2123 Date: Tue, 19 May 2020 11:15:51 +0800 Subject: [PATCH 2/4] save weights at epoch_0 --- doc/detection.md | 6 +++--- tools/program.py | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/detection.md b/doc/detection.md index 71034876b..fce534d1b 100644 --- a/doc/detection.md +++ b/doc/detection.md @@ -16,7 +16,7 @@ wget -P ./train_data/ https://paddleocr.bj.bcebos.com/dataset/test_icdar2015_la 解压数据集和下载标注文件后,PaddleOCR/train_data/ 有两个文件夹和两个文件,分别是: ``` -/PaddleOCR/train_data/ +/PaddleOCR/train_data/icdar2015/text_localization/ └─ icdar_c4_train_imgs/ icdar数据集的训练数据 └─ ch4_test_images/ icdar数据集的测试数据 └─ train_icdar2015_label.txt icdar数据集的训练标注 @@ -79,10 +79,10 @@ python3 tools/eval.py -c configs/det/det_mv3_db.yml -o Global.checkpoints="./ou 测试单张图像的检测效果 ``` -python3 tools/infer_det.py -c config/det/det_mv3_db.yml -o TestReader.single_img_path="./doc/imgs_en/img_10.jpg" Global.checkpoints="./output/det_db/best_accuracy" +python3 tools/infer_det.py -c configs/det/det_mv3_db.yml -o TestReader.single_img_path="./doc/imgs_en/img_10.jpg" Global.checkpoints="./output/det_db/best_accuracy" ``` 测试文件夹下所有图像的检测效果 ``` -python3 tools/infer_det.py -c config/det/det_mv3_db.yml -o TestReader.single_img_path="./doc/imgs_en/" Global.checkpoints="./output/det_db/best_accuracy" +python3 tools/infer_det.py -c configs/det/det_mv3_db.yml -o TestReader.single_img_path="./doc/imgs_en/" Global.checkpoints="./output/det_db/best_accuracy" ``` diff --git a/tools/program.py b/tools/program.py index a114b1cbf..f55720731 100755 --- a/tools/program.py +++ b/tools/program.py @@ -269,7 +269,9 @@ def train_eval_det_run(config, exe, train_info_dict, eval_info_dict): except fluid.core.EOFException: train_loader.reset() - + if save_epoch_step == 1: + save_path = save_model_dir + "/iter_epoch_0" + save_model(train_info_dict['train_program'],save_path) if epoch > 0 and epoch % save_epoch_step == 0: save_path = save_model_dir + "/iter_epoch_%d" % (epoch) save_model(train_info_dict['train_program'], save_path) @@ -346,7 +348,9 @@ def train_eval_rec_run(config, exe, train_info_dict, eval_info_dict): except fluid.core.EOFException: train_loader.reset() - + if save_epoch_step == 1: + save_path = save_model_dir + "/iter_epoch_0" + save_model(train_info_dict['train_program'],save_path) if epoch > 0 and epoch % save_epoch_step == 0: save_path = save_model_dir + "/iter_epoch_%d" % (epoch) save_model(train_info_dict['train_program'], save_path) From d9757c7ec29305da41b7ded8ee139c3b6cb12042 Mon Sep 17 00:00:00 2001 From: tink2123 Date: Tue, 19 May 2020 11:29:52 +0800 Subject: [PATCH 3/4] fix program --- tools/program.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/program.py b/tools/program.py index f55720731..a12e33608 100755 --- a/tools/program.py +++ b/tools/program.py @@ -269,7 +269,7 @@ def train_eval_det_run(config, exe, train_info_dict, eval_info_dict): except fluid.core.EOFException: train_loader.reset() - if save_epoch_step == 1: + if epoch == 0 and save_epoch_step == 1: save_path = save_model_dir + "/iter_epoch_0" save_model(train_info_dict['train_program'],save_path) if epoch > 0 and epoch % save_epoch_step == 0: @@ -348,7 +348,7 @@ def train_eval_rec_run(config, exe, train_info_dict, eval_info_dict): except fluid.core.EOFException: train_loader.reset() - if save_epoch_step == 1: + if epoch ==0 and save_epoch_step == 1: save_path = save_model_dir + "/iter_epoch_0" save_model(train_info_dict['train_program'],save_path) if epoch > 0 and epoch % save_epoch_step == 0: From f806d8d8723a52e2b9ec64bbd589da57a5bb2fbb Mon Sep 17 00:00:00 2001 From: tink2123 Date: Tue, 19 May 2020 11:32:40 +0800 Subject: [PATCH 4/4] format code --- tools/program.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/program.py b/tools/program.py index a12e33608..67cef9bc2 100755 --- a/tools/program.py +++ b/tools/program.py @@ -348,7 +348,7 @@ def train_eval_rec_run(config, exe, train_info_dict, eval_info_dict): except fluid.core.EOFException: train_loader.reset() - if epoch ==0 and save_epoch_step == 1: + if epoch == 0 and save_epoch_step == 1: save_path = save_model_dir + "/iter_epoch_0" save_model(train_info_dict['train_program'],save_path) if epoch > 0 and epoch % save_epoch_step == 0: