Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
MissPenguin committed Aug 10, 2021
1 parent c8aa6d0 commit 39b7263
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 30 deletions.
44 changes: 29 additions & 15 deletions deploy/cpp_infer/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,54 +184,68 @@ CUDNN_LIB_DIR=/your_cudnn_lib_dir
直接运行编译好的可执行文件:```./build/ocr_***```,可获得参数信息提示。
##### 1. 检测demo运行方式:
```shell
./build/ocr_det
--det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer
./build/ocr_det \
--det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer \
--image_dir=../../doc/imgs/12.jpg
```
##### 2. 识别demo运行方式:
```shell
./build/ocr_rec
--rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer
./build/ocr_rec \
--rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer \
--image_dir=../../doc/imgs_words/ch/
```
##### 3. 串联demo运行方式:
```shell
# 不使用方向分类器
./build/ocr_rec
--det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer
--rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer
./build/ocr_system \
--det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer \
--rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer \
--image_dir=../../doc/imgs/12.jpg
# 使用方向分类器
./build/ocr_rec
--det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer
--use_angle_cls=true
--cls_model_dir=inference/ch_ppocr_mobile_v2.0_cls_infer
--rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer
./build/ocr_system \
--det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer \
--use_angle_cls=true \
--cls_model_dir=inference/ch_ppocr_mobile_v2.0_cls_infer \
--rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer \
--image_dir=../../doc/imgs/12.jpg
```

更多参数如下:

- 通用参数

|参数名称|类型|默认参数|意义|
| --- | --- | --- | --- |
|use_gpu|bool|false|是否使用GPU|
|gpu_id|int|0|GPU id,使用GPU时有效|
|gpu_mem|int|4000|申请的GPU内存|
|cpu_math_library_num_threads|int|10|CPU预测时的线程数,在机器核数充足的情况下,该值越大,预测速度越快|
|use_mkldnn|bool|true|是否使用mkldnn库|
|**检测模型相关**|

- 检测模型相关

|参数名称|类型|默认参数|意义|
| --- | --- | --- | --- |
|det_model_dir|string|-|检测模型inference model地址|
|max_side_len|int|960|输入图像长宽大于960时,等比例缩放图像,使得图像最长边为960|
|det_db_thresh|float|0.3|用于过滤DB预测的二值化图像,设置为0.-0.3对结果影响不明显|
|det_db_box_thresh|float|0.5|DB后处理过滤box的阈值,如果检测存在漏框情况,可酌情减小|
|det_db_unclip_ratio|float|1.6|表示文本框的紧致程度,越小则文本框更靠近文本|
|use_polygon_score|bool|false|是否使用多边形框计算bbox score,false表示使用矩形框计算。矩形框计算速度更快,多边形框对弯曲文本区域计算更准确。|
|visualize|bool|true|是否对结果进行可视化,为1时,会在当前文件夹下保存文件名为`ocr_vis.png`的预测结果。|
|**方向分类器相关**|

- 方向分类器相关

|参数名称|类型|默认参数|意义|
| --- | --- | --- | --- |
|use_angle_cls|bool|false|是否使用方向分类器|
|cls_model_dir|string|-|方向分类器inference model地址|
|cls_thresh|float|0.9|方向分类器的得分阈值|
|**识别模型相关**|

- 识别模型相关

|参数名称|类型|默认参数|意义|
| --- | --- | --- | --- |
|rec_model_dir|string|-|识别模型inference model地址|
|char_list_file|string|../../ppocr/utils/ppocr_keys_v1.txt|字典文件|

Expand Down
44 changes: 29 additions & 15 deletions deploy/cpp_infer/readme_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,54 +189,68 @@ or the generated Paddle inference library path (`build/paddle_inference_install_
* Execute the built executable file by ```./build/ocr_***```. You'll get some command line parameter information.
##### 1. run ocr_det demo:
```shell
./build/ocr_det
--det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer
./build/ocr_det \
--det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer \
--image_dir=../../doc/imgs/12.jpg
```
##### 2. run ocr_rec demo:
```shell
./build/ocr_rec
--rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer
./build/ocr_rec \
--rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer \
--image_dir=../../doc/imgs_words/ch/
```
##### 3. run ocr_system demo:
```shell
# without text direction classifier
./build/ocr_rec
--det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer
--rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer
./build/ocr_system \
--det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer \
--rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer \
--image_dir=../../doc/imgs/12.jpg
# with text direction classifier
./build/ocr_rec
--det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer
--use_angle_cls=true
--cls_model_dir=inference/ch_ppocr_mobile_v2.0_cls_infer
--rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer
./build/ocr_system \
--det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer \
--use_angle_cls=true \
--cls_model_dir=inference/ch_ppocr_mobile_v2.0_cls_infer \
--rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer \
--image_dir=../../doc/imgs/12.jpg
```

More parameters are as follows,

- common parameters

|parameter|data type|default|meaning|
| --- | --- | --- | --- |
|use_gpu|bool|false|Whether to use GPU|
|gpu_id|int|0|GPU id when use_gpu is true|
|gpu_mem|int|4000|GPU memory requested|
|cpu_math_library_num_threads|int|10|Number of threads when using CPU inference. When machine cores is enough, the large the value, the faster the inference speed|
|use_mkldnn|bool|true|Whether to use mkdlnn library|
|**detection related**|

- detection related parameters

|parameter|data type|default|meaning|
| --- | --- | --- | --- |
|det_model_dir|string|-|Address of detection inference model|
|max_side_len|int|960|Limit the maximum image height and width to 960|
|det_db_thresh|float|0.3|Used to filter the binarized image of DB prediction, setting 0.-0.3 has no obvious effect on the result|
|det_db_box_thresh|float|0.5|DB post-processing filter box threshold, if there is a missing box detected, it can be reduced as appropriate|
|det_db_unclip_ratio|float|1.6|Indicates the compactness of the text box, the smaller the value, the closer the text box to the text|
|use_polygon_score|bool|false|Whether to use polygon box to calculate bbox score, false means to use rectangle box to calculate. Use rectangular box to calculate faster, and polygonal box more accurate for curved text area.|
|visualize|bool|true|Whether to visualize the results,when it is set as true, The prediction result will be save in the image file `./ocr_vis.png`.|
|**recogniton related**|

- classifier related parameters

|parameter|data type|default|meaning|
| --- | --- | --- | --- |
|use_angle_cls|bool|false|Whether to use the direction classifier|
|cls_model_dir|string|-|Address of direction classifier inference model|
|cls_thresh|float|0.9|Score threshold of the direction classifier|
|**classification related**|

- recogniton related parameters

|parameter|data type|default|meaning|
| --- | --- | --- | --- |
|rec_model_dir|string|-|Address of recognition inference model|
|char_list_file|string|../../ppocr/utils/ppocr_keys_v1.txt|dictionary file|

Expand Down

0 comments on commit 39b7263

Please sign in to comment.