From 3ffb3879c669f2a852fd50008a1ae4657f4df450 Mon Sep 17 00:00:00 2001 From: tink2123 Date: Tue, 19 May 2020 11:15:51 +0800 Subject: [PATCH] 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 71034876..fce534d1 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 a114b1cb..f5572073 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)