提交 39b7263e 编写于 作者: M MissPenguin

update readme

上级 c8aa6d03
...@@ -184,34 +184,36 @@ CUDNN_LIB_DIR=/your_cudnn_lib_dir ...@@ -184,34 +184,36 @@ CUDNN_LIB_DIR=/your_cudnn_lib_dir
直接运行编译好的可执行文件:```./build/ocr_***```,可获得参数信息提示。 直接运行编译好的可执行文件:```./build/ocr_***```,可获得参数信息提示。
##### 1. 检测demo运行方式: ##### 1. 检测demo运行方式:
```shell ```shell
./build/ocr_det ./build/ocr_det \
--det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer --det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer \
--image_dir=../../doc/imgs/12.jpg --image_dir=../../doc/imgs/12.jpg
``` ```
##### 2. 识别demo运行方式: ##### 2. 识别demo运行方式:
```shell ```shell
./build/ocr_rec ./build/ocr_rec \
--rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer --rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer \
--image_dir=../../doc/imgs_words/ch/ --image_dir=../../doc/imgs_words/ch/
``` ```
##### 3. 串联demo运行方式: ##### 3. 串联demo运行方式:
```shell ```shell
# 不使用方向分类器 # 不使用方向分类器
./build/ocr_rec ./build/ocr_system \
--det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer --det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer \
--rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer --rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer \
--image_dir=../../doc/imgs/12.jpg --image_dir=../../doc/imgs/12.jpg
# 使用方向分类器 # 使用方向分类器
./build/ocr_rec ./build/ocr_system \
--det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer --det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer \
--use_angle_cls=true --use_angle_cls=true \
--cls_model_dir=inference/ch_ppocr_mobile_v2.0_cls_infer --cls_model_dir=inference/ch_ppocr_mobile_v2.0_cls_infer \
--rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer --rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer \
--image_dir=../../doc/imgs/12.jpg --image_dir=../../doc/imgs/12.jpg
``` ```
更多参数如下: 更多参数如下:
- 通用参数
|参数名称|类型|默认参数|意义| |参数名称|类型|默认参数|意义|
| --- | --- | --- | --- | | --- | --- | --- | --- |
|use_gpu|bool|false|是否使用GPU| |use_gpu|bool|false|是否使用GPU|
...@@ -219,7 +221,11 @@ CUDNN_LIB_DIR=/your_cudnn_lib_dir ...@@ -219,7 +221,11 @@ CUDNN_LIB_DIR=/your_cudnn_lib_dir
|gpu_mem|int|4000|申请的GPU内存| |gpu_mem|int|4000|申请的GPU内存|
|cpu_math_library_num_threads|int|10|CPU预测时的线程数,在机器核数充足的情况下,该值越大,预测速度越快| |cpu_math_library_num_threads|int|10|CPU预测时的线程数,在机器核数充足的情况下,该值越大,预测速度越快|
|use_mkldnn|bool|true|是否使用mkldnn库| |use_mkldnn|bool|true|是否使用mkldnn库|
|**检测模型相关**|
- 检测模型相关
|参数名称|类型|默认参数|意义|
| --- | --- | --- | --- |
|det_model_dir|string|-|检测模型inference model地址| |det_model_dir|string|-|检测模型inference model地址|
|max_side_len|int|960|输入图像长宽大于960时,等比例缩放图像,使得图像最长边为960| |max_side_len|int|960|输入图像长宽大于960时,等比例缩放图像,使得图像最长边为960|
|det_db_thresh|float|0.3|用于过滤DB预测的二值化图像,设置为0.-0.3对结果影响不明显| |det_db_thresh|float|0.3|用于过滤DB预测的二值化图像,设置为0.-0.3对结果影响不明显|
...@@ -227,11 +233,19 @@ CUDNN_LIB_DIR=/your_cudnn_lib_dir ...@@ -227,11 +233,19 @@ CUDNN_LIB_DIR=/your_cudnn_lib_dir
|det_db_unclip_ratio|float|1.6|表示文本框的紧致程度,越小则文本框更靠近文本| |det_db_unclip_ratio|float|1.6|表示文本框的紧致程度,越小则文本框更靠近文本|
|use_polygon_score|bool|false|是否使用多边形框计算bbox score,false表示使用矩形框计算。矩形框计算速度更快,多边形框对弯曲文本区域计算更准确。| |use_polygon_score|bool|false|是否使用多边形框计算bbox score,false表示使用矩形框计算。矩形框计算速度更快,多边形框对弯曲文本区域计算更准确。|
|visualize|bool|true|是否对结果进行可视化,为1时,会在当前文件夹下保存文件名为`ocr_vis.png`的预测结果。| |visualize|bool|true|是否对结果进行可视化,为1时,会在当前文件夹下保存文件名为`ocr_vis.png`的预测结果。|
|**方向分类器相关**|
- 方向分类器相关
|参数名称|类型|默认参数|意义|
| --- | --- | --- | --- |
|use_angle_cls|bool|false|是否使用方向分类器| |use_angle_cls|bool|false|是否使用方向分类器|
|cls_model_dir|string|-|方向分类器inference model地址| |cls_model_dir|string|-|方向分类器inference model地址|
|cls_thresh|float|0.9|方向分类器的得分阈值| |cls_thresh|float|0.9|方向分类器的得分阈值|
|**识别模型相关**|
- 识别模型相关
|参数名称|类型|默认参数|意义|
| --- | --- | --- | --- |
|rec_model_dir|string|-|识别模型inference model地址| |rec_model_dir|string|-|识别模型inference model地址|
|char_list_file|string|../../ppocr/utils/ppocr_keys_v1.txt|字典文件| |char_list_file|string|../../ppocr/utils/ppocr_keys_v1.txt|字典文件|
......
...@@ -189,34 +189,36 @@ or the generated Paddle inference library path (`build/paddle_inference_install_ ...@@ -189,34 +189,36 @@ 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. * Execute the built executable file by ```./build/ocr_***```. You'll get some command line parameter information.
##### 1. run ocr_det demo: ##### 1. run ocr_det demo:
```shell ```shell
./build/ocr_det ./build/ocr_det \
--det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer --det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer \
--image_dir=../../doc/imgs/12.jpg --image_dir=../../doc/imgs/12.jpg
``` ```
##### 2. run ocr_rec demo: ##### 2. run ocr_rec demo:
```shell ```shell
./build/ocr_rec ./build/ocr_rec \
--rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer --rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer \
--image_dir=../../doc/imgs_words/ch/ --image_dir=../../doc/imgs_words/ch/
``` ```
##### 3. run ocr_system demo: ##### 3. run ocr_system demo:
```shell ```shell
# without text direction classifier # without text direction classifier
./build/ocr_rec ./build/ocr_system \
--det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer --det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer \
--rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer --rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer \
--image_dir=../../doc/imgs/12.jpg --image_dir=../../doc/imgs/12.jpg
# with text direction classifier # with text direction classifier
./build/ocr_rec ./build/ocr_system \
--det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer --det_model_dir=inference/ch_ppocr_mobile_v2.0_det_infer \
--use_angle_cls=true --use_angle_cls=true \
--cls_model_dir=inference/ch_ppocr_mobile_v2.0_cls_infer --cls_model_dir=inference/ch_ppocr_mobile_v2.0_cls_infer \
--rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer --rec_model_dir=inference/ch_ppocr_mobile_v2.0_rec_infer \
--image_dir=../../doc/imgs/12.jpg --image_dir=../../doc/imgs/12.jpg
``` ```
More parameters are as follows, More parameters are as follows,
- common parameters
|parameter|data type|default|meaning| |parameter|data type|default|meaning|
| --- | --- | --- | --- | | --- | --- | --- | --- |
|use_gpu|bool|false|Whether to use GPU| |use_gpu|bool|false|Whether to use GPU|
...@@ -224,7 +226,11 @@ More parameters are as follows, ...@@ -224,7 +226,11 @@ More parameters are as follows,
|gpu_mem|int|4000|GPU memory requested| |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| |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| |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| |det_model_dir|string|-|Address of detection inference model|
|max_side_len|int|960|Limit the maximum image height and width to 960| |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_thresh|float|0.3|Used to filter the binarized image of DB prediction, setting 0.-0.3 has no obvious effect on the result|
...@@ -232,11 +238,19 @@ More parameters are as follows, ...@@ -232,11 +238,19 @@ More parameters are as follows,
|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| |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.| |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`.| |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| |use_angle_cls|bool|false|Whether to use the direction classifier|
|cls_model_dir|string|-|Address of direction classifier inference model| |cls_model_dir|string|-|Address of direction classifier inference model|
|cls_thresh|float|0.9|Score threshold of the direction classifier| |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| |rec_model_dir|string|-|Address of recognition inference model|
|char_list_file|string|../../ppocr/utils/ppocr_keys_v1.txt|dictionary file| |char_list_file|string|../../ppocr/utils/ppocr_keys_v1.txt|dictionary file|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册