未验证 提交 18c897df 编写于 作者: D dyning 提交者: GitHub

Merge pull request #19 from tink2123/add_words_img

add words_img
...@@ -2,12 +2,12 @@ TrainReader: ...@@ -2,12 +2,12 @@ TrainReader:
reader_function: ppocr.data.rec.dataset_traversal,SimpleReader reader_function: ppocr.data.rec.dataset_traversal,SimpleReader
num_workers: 8 num_workers: 8
img_set_dir: ./train_data 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: EvalReader:
reader_function: ppocr.data.rec.dataset_traversal,SimpleReader reader_function: ppocr.data.rec.dataset_traversal,SimpleReader
img_set_dir: ./train_data 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: TestReader:
reader_function: ppocr.data.rec.dataset_traversal,SimpleReader reader_function: ppocr.data.rec.dataset_traversal,SimpleReader
......
Global: Global:
algorithm: CRNN algorithm: CRNN
use_gpu: true use_gpu: true
epoch_num: 3000 epoch_num: 1000
log_smooth_window: 20 log_smooth_window: 20
print_batch_step: 10 print_batch_step: 10
save_model_dir: ./output/rec_CRNN save_model_dir: ./output/rec_CRNN
...@@ -14,7 +14,7 @@ Global: ...@@ -14,7 +14,7 @@ Global:
character_type: en character_type: en
loss_type: ctc loss_type: ctc
reader_yml: ./configs/rec/rec_icdar15_reader.yml 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: checkpoints:
save_inference_dir: save_inference_dir:
Architecture: Architecture:
......
...@@ -39,12 +39,13 @@ train_data/train_0002.jpg 用科技让复杂的世界更简单 ...@@ -39,12 +39,13 @@ train_data/train_0002.jpg 用科技让复杂的世界更简单
``` ```
|-train_data |-train_data
|- rec_gt_train.txt |-ic15_data
|- train_imags |- rec_gt_train.txt
|- train_001.jpg |- train_imags
|- train_002.jpg |- train_001.jpg
|- train_003.jpg |- train_002.jpg
| ... |- train_003.jpg
| ...
``` ```
- 评估集 - 评估集
...@@ -53,12 +54,13 @@ train_data/train_0002.jpg 用科技让复杂的世界更简单 ...@@ -53,12 +54,13 @@ train_data/train_0002.jpg 用科技让复杂的世界更简单
``` ```
|-train_data |-train_data
|- rec_gt_eval.txt |-ic15_data
|- eval_imags |- rec_gt_eval.txt
|- eval_001.jpg |- eval_imags
|- eval_002.jpg |- eval_001.jpg
|- eval_003.jpg |- eval_002.jpg
| ... |- eval_003.jpg
| ...
``` ```
- 字典 - 字典
...@@ -120,16 +122,17 @@ PaddleOCR 提供了训练好的中文模型,可以[下载](todo: add)进行快 ...@@ -120,16 +122,17 @@ PaddleOCR 提供了训练好的中文模型,可以[下载](todo: add)进行快
默认预测图片存储在 `infer_img` 里,通过 `-o Global.checkpoints` 指定权重: 默认预测图片存储在 `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
``` ```
预测图片:
![](./imgs_words/word_1.jpg)
得到输入图像的预测结果: 得到输入图像的预测结果:
``` ```
infer_img: infer_img/328_4.jpg infer_img: doc/imgs_words/word_1.jpg
# 字符在字典中的索引 index: [2092 177 312 2503]
[1863 921 55 155 1863 4209 3344 486 914 1863 4918] word : 韩国小馆
# 预测结果
冷库专用冷冻液/载冷剂
``` ```
...@@ -37,7 +37,6 @@ set_paddle_flags( ...@@ -37,7 +37,6 @@ set_paddle_flags(
from paddle import fluid from paddle import fluid
# from ppocr.utils.utility import load_config, merge_config # from ppocr.utils.utility import load_config, merge_config
from ppocr.data.reader_main import test_reader
import program import program
from paddle import fluid from paddle import fluid
from ppocr.utils.utility import initial_logger from ppocr.utils.utility import initial_logger
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册