add words_img

This commit is contained in:
tink2123 2020-05-14 14:33:15 +08:00
parent d94cde77e2
commit 2e9468b763
9 changed files with 24 additions and 23 deletions

View File

@ -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

View File

@ -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:

BIN
doc/imgs_words/word_1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
doc/imgs_words/word_2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

BIN
doc/imgs_words/word_3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
doc/imgs_words/word_4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
doc/imgs_words/word_5.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -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 : 韩国小馆
```

View File

@ -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