📄 Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.
C++项目修改Readme 测试脚本添加mobile rec模型支持
benjaminwan57948bfb320b
diff --git a/cpp/BaiPiaoOcrOnnx/README.md b/cpp/BaiPiaoOcrOnnx/README.mdold mode 100755new mode 100644index 97a1318..90e7f30--- a/cpp/BaiPiaoOcrOnnx/README.md+++ b/cpp/BaiPiaoOcrOnnx/README.md@@ -15,7 +15,7 @@ onnxruntime框架[https://github.com/microsoft/onnxruntime](https://github.com/m### 关于模型:* det模型用于分割文字块,有两种模型(server和mobile),其中server体积大且较慢但效果好,mobile体积小且较快但效果差点。* cls模型用于检测文字方向,只有一种模型-* rec模型用于文字识别,虽然有两种模型(server和mobile),但mobile由于转换失败,目前只有server模型。未来转换工具成熟后可以直接支持mobile模型。+* rec模型用于文字识别,有两种模型(server和mobile),其中server体积大且较慢但效果好,mobile体积小且较快但效果差点。### 模型下载[模型下载地址](https://github.com/znsoftm/BaiPiaoOCR/tree/main/models)@@ -26,6 +26,7 @@ BaiPiaoOcrOnnx/models├── ch_ppocr_mobile_v2.0_det_infer.onnx├── ch_ppocr_server_v2.0_det_infer.onnx├── ch_ppocr_server_v2.0_rec_infer.onnx+ ├── ch_ppocr_mobile_v2.0_rec_infer.onnx└── ppocr_keys_v1.txt```diff --git a/cpp/BaiPiaoOcrOnnx/run-benchmark.bat b/cpp/BaiPiaoOcrOnnx/run-benchmark.batindex d7a63ad..e3bc8fe 100755--- a/cpp/BaiPiaoOcrOnnx/run-benchmark.bat+++ b/cpp/BaiPiaoOcrOnnx/run-benchmark.bat@@ -11,6 +11,12 @@ if %flag% == 1 (set DET_MODEL=ch_ppocr_server_v2.0_det_infer.onnx)^else if %flag% == 2 (set DET_MODEL=ch_ppocr_mobile_v2.0_det_infer.onnx)^else (echo 输入错误!Input Error!)+echo "请选择rec模型: 1)server, 2)mobile"+set /p flag=+if %flag% == 1 (set REC_MODEL=ch_ppocr_server_v2.0_rec_infer.onnx)^+else if %flag% == 2 (set REC_MODEL=ch_ppocr_mobile_v2.0_rec_infer.onnx)^+else (echo 输入错误!Input Error!)+echo "请输入循环次数:"set /p LOOP_COUNT=@@ -26,7 +32,7 @@ build\benchmark.exe --versionbuild\benchmark.exe --models models ^--det %DET_MODEL% ^--cls ch_ppocr_mobile_v2.0_cls_infer.onnx ^---rec ch_ppocr_server_v2.0_rec_infer.onnx ^+--rec %REC_MODEL% ^--keys ppocr_keys_v1.txt ^--image %TARGET_IMG% ^--numThread %NUMBER_OF_PROCESSORS% ^diff --git a/cpp/BaiPiaoOcrOnnx/run-benchmark.sh b/cpp/BaiPiaoOcrOnnx/run-benchmark.shindex 88df0c7..fcfda35 100755--- a/cpp/BaiPiaoOcrOnnx/run-benchmark.sh+++ b/cpp/BaiPiaoOcrOnnx/run-benchmark.sh@@ -25,6 +25,16 @@ elseecho -e "Input Error!"fi+echo "请选择rec模型: 1)server, 2)mobile"+read -p "" REC_MODEL+if [ $REC_MODEL == 1 ]; then+ REC_MODEL="ch_ppocr_server_v2.0_rec_infer.onnx"+elif [ $REC_MODEL == 2 ]; then+ REC_MODEL="ch_ppocr_mobile_v2.0_rec_infer.onnx"+else+ echo -e "Input Error!"+fi+echo "请输入循环次数:"read -p "" LOOP_COUNT@@ -39,7 +49,7 @@ fi./build/benchmark --models models \--det $DET_MODEL \--cls ch_ppocr_mobile_v2.0_cls_infer.onnx \---rec ch_ppocr_server_v2.0_rec_infer.onnx \+--rec $REC_MODEL \--keys ppocr_keys_v1.txt \--image $TARGET_IMG \--numThread $NUM_THREADS \diff --git a/cpp/BaiPiaoOcrOnnx/run-test.bat b/cpp/BaiPiaoOcrOnnx/run-test.batindex 09ba746..757f201 100755--- a/cpp/BaiPiaoOcrOnnx/run-test.bat+++ b/cpp/BaiPiaoOcrOnnx/run-test.bat@@ -11,6 +11,12 @@ if %flag% == 1 (set DET_MODEL=ch_ppocr_server_v2.0_det_infer.onnx)^else if %flag% == 2 (set DET_MODEL=ch_ppocr_mobile_v2.0_det_infer.onnx)^else (echo 输入错误!Input Error!)+echo "请选择rec模型: 1)server, 2)mobile"+set /p flag=+if %flag% == 1 (set REC_MODEL=ch_ppocr_server_v2.0_rec_infer.onnx)^+else if %flag% == 2 (set REC_MODEL=ch_ppocr_mobile_v2.0_rec_infer.onnx)^+else (echo 输入错误!Input Error!)+SET TARGET_IMG=images/1.jpgif not exist %TARGET_IMG% (echo "找不到待识别的目标图片:%TARGET_IMG%,请打开本文件并编辑TARGET_IMG"@@ -23,7 +29,7 @@ build\BaiPiaoOcrOnnx.exe --versionbuild\BaiPiaoOcrOnnx.exe --models models ^--det %DET_MODEL% ^--cls ch_ppocr_mobile_v2.0_cls_infer.onnx ^---rec ch_ppocr_server_v2.0_rec_infer.onnx ^+--rec %REC_MODEL% ^--keys ppocr_keys_v1.txt ^--image %TARGET_IMG% ^--numThread %NUMBER_OF_PROCESSORS% ^diff --git a/cpp/BaiPiaoOcrOnnx/run-test.sh b/cpp/BaiPiaoOcrOnnx/run-test.shindex d978457..1b14d4e 100755--- a/cpp/BaiPiaoOcrOnnx/run-test.sh+++ b/cpp/BaiPiaoOcrOnnx/run-test.sh@@ -25,6 +25,16 @@ elseecho -e "Input Error!"fi+echo "请选择rec模型: 1)server, 2)mobile"+read -p "" REC_MODEL+if [ $REC_MODEL == 1 ]; then+ REC_MODEL="ch_ppocr_server_v2.0_rec_infer.onnx"+elif [ $REC_MODEL == 2 ]; then+ REC_MODEL="ch_ppocr_mobile_v2.0_rec_infer.onnx"+else+ echo -e "Input Error!"+fi+TARGET_IMG=images/1.jpgif [ ! -f "$TARGET_IMG" ]; thenecho "找不到待识别的目标图片:${TARGET_IMG},请打开本文件并编辑TARGET_IMG"@@ -36,7 +46,7 @@ fi./build/BaiPiaoOcrOnnx --models models \--det $DET_MODEL \--cls ch_ppocr_mobile_v2.0_cls_infer.onnx \---rec ch_ppocr_server_v2.0_rec_infer.onnx \+--rec $REC_MODEL \--keys ppocr_keys_v1.txt \--image $TARGET_IMG \--numThread $NUM_THREADS \diff --git a/cpp/BaiPiaoOcrOnnx/valgrind-memcheck.sh b/cpp/BaiPiaoOcrOnnx/valgrind-memcheck.shindex ad0325c..2ae5f3b 100755--- a/cpp/BaiPiaoOcrOnnx/valgrind-memcheck.sh+++ b/cpp/BaiPiaoOcrOnnx/valgrind-memcheck.sh@@ -12,7 +12,7 @@ NUM_THREADS=1set OMP_NUM_THREADS=$NUM_THREADS-TARGET_IMG=../../images/1.jpg+TARGET_IMG=images/1.jpgif [ ! -f "$TARGET_IMG" ]; thenecho "找不到待识别的目标图片:${TARGET_IMG},请打开本文件并编辑TARGET_IMG"exit