diff --git a/configs/rec/rec_icdar15_reader.yml b/configs/rec/rec_icdar15_reader.yml index f09a1ea72e6d929d0446fbbf51ca218e52ae5b3e..fd6227d5942636180946486308d4dcba93dfd7d9 100755 --- a/configs/rec/rec_icdar15_reader.yml +++ b/configs/rec/rec_icdar15_reader.yml @@ -2,12 +2,12 @@ TrainReader: reader_function: ppocr.data.rec.dataset_traversal,SimpleReader num_workers: 8 img_set_dir: ./train_data - label_file_path: ./train_data/rec_gt_train.txt + label_file_path: ./train_data/ic15_data/rec_gt_train.txt EvalReader: reader_function: ppocr.data.rec.dataset_traversal,SimpleReader img_set_dir: ./train_data - label_file_path: ./train_data/rec_gt_test.txt + label_file_path: ./train_data/ic15_data/rec_gt_test.txt TestReader: reader_function: ppocr.data.rec.dataset_traversal,SimpleReader diff --git a/configs/rec/rec_icdar15_train.yml b/configs/rec/rec_icdar15_train.yml index 9f94566971ea485af6b0c7e9524d1baf8aa80388..6596fc339398af20a9c9ce74a264e24c0a0bdd35 100755 --- a/configs/rec/rec_icdar15_train.yml +++ b/configs/rec/rec_icdar15_train.yml @@ -1,7 +1,7 @@ Global: algorithm: CRNN use_gpu: true - epoch_num: 3000 + epoch_num: 1000 log_smooth_window: 20 print_batch_step: 10 save_model_dir: ./output/rec_CRNN @@ -14,7 +14,7 @@ Global: character_type: en loss_type: ctc reader_yml: ./configs/rec/rec_icdar15_reader.yml - pretrain_weights: ./pretrain_models/CRNN/best_accuracy + pretrain_weights: ./pretrain_models/rec_mv3_none_bilstm_ctc/best_accuracy checkpoints: save_inference_dir: Architecture: diff --git a/doc/imgs_words/word_1.jpg b/doc/imgs_words/word_1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..cb5451e15a5689663c9618ffc3432948777c087d Binary files /dev/null and b/doc/imgs_words/word_1.jpg differ diff --git a/doc/imgs_words/word_2.jpg b/doc/imgs_words/word_2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..26ca6e59d489050c24e0f000ebab417a1596c565 Binary files /dev/null and b/doc/imgs_words/word_2.jpg differ diff --git a/doc/imgs_words/word_3.jpg b/doc/imgs_words/word_3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..22031ba501c7337bf99e5f0c5a687196d7d27f63 Binary files /dev/null and b/doc/imgs_words/word_3.jpg differ diff --git a/doc/imgs_words/word_4.jpg b/doc/imgs_words/word_4.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2c34cd33eac5766a072fde041fa6c9b1d612f1db Binary files /dev/null and b/doc/imgs_words/word_4.jpg differ diff --git a/doc/imgs_words/word_5.jpg b/doc/imgs_words/word_5.jpg new file mode 100644 index 0000000000000000000000000000000000000000..463f643581051586fab3a333e21dc6d6d4abcb1d Binary files /dev/null and b/doc/imgs_words/word_5.jpg differ diff --git a/doc/recognition.md b/doc/recognition.md index e733ba94d3d88f37cee79e7df670d113895590c2..a715fa1ad78ad9101eb03a18c946cf2f60cf896b 100644 --- a/doc/recognition.md +++ b/doc/recognition.md @@ -39,12 +39,13 @@ train_data/train_0002.jpg 用科技让复杂的世界更简单 ``` |-train_data - |- rec_gt_train.txt - |- train_imags - |- train_001.jpg - |- train_002.jpg - |- train_003.jpg - | ... + |-ic15_data + |- rec_gt_train.txt + |- train_imags + |- train_001.jpg + |- train_002.jpg + |- train_003.jpg + | ... ``` - 评估集 @@ -53,12 +54,13 @@ train_data/train_0002.jpg 用科技让复杂的世界更简单 ``` |-train_data - |- rec_gt_eval.txt - |- eval_imags - |- eval_001.jpg - |- eval_002.jpg - |- eval_003.jpg - | ... + |-ic15_data + |- rec_gt_eval.txt + |- eval_imags + |- eval_001.jpg + |- eval_002.jpg + |- eval_003.jpg + | ... ``` - 字典 @@ -120,16 +122,16 @@ PaddleOCR 提供了训练好的中文模型,可以[下载](todo: add)进行快 默认预测图片存储在 `infer_img` 里,通过 `-o Global.checkpoints` 指定权重: ``` -python tools/infer_rec.py -c configs/rec/rec_chinese_lite_train.yml -o Global.checkpoints={path/to/weights}/best_accuracy +python tools/infer_rec.py -c configs/rec/rec_chinese_lite_train.yml -o Global.checkpoints={path/to/weights}/best_accuracy TestReader.infer_img=doc/imgs_word/word_1.jpg ``` +预测图片: +![](./doc/imgs_words/word_1.jpg) 得到输入图像的预测结果: ``` -infer_img: infer_img/328_4.jpg -# 字符在字典中的索引 -[1863 921 55 155 1863 4209 3344 486 914 1863 4918] -# 预测结果 -冷库专用冷冻液/载冷剂 +infer_img: doc/imgs_words/word_1.jpg + index: [2092 177 312 2503] + word : 韩国小馆 ``` diff --git a/tools/infer_rec.py b/tools/infer_rec.py index de7799d021ec4838ff04012deb5ed4943421a7df..25bae1ca6c3034833c83975d9f47ab30388ca56e 100755 --- a/tools/infer_rec.py +++ b/tools/infer_rec.py @@ -37,7 +37,6 @@ set_paddle_flags( from paddle import fluid # from ppocr.utils.utility import load_config, merge_config -from ppocr.data.reader_main import test_reader import program from paddle import fluid from ppocr.utils.utility import initial_logger