Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add words_img #19

Merged
merged 3 commits into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions configs/rec/rec_icdar15_reader.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions configs/rec/rec_icdar15_train.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand Down
Binary file added doc/imgs_words/word_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/imgs_words/word_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/imgs_words/word_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/imgs_words/word_4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/imgs_words/word_5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 21 additions & 18 deletions doc/recognition.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
| ...
```

- 评估集
Expand All @@ -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
| ...
```

- 字典
Expand Down Expand Up @@ -120,16 +122,17 @@ 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
```
预测图片:

![](./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 : 韩国小馆
```

1 change: 0 additions & 1 deletion tools/infer_rec.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def set_paddle_flags(**kwargs):
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
Expand Down