From 21524b8c49c48eee3db98f7052796a729ea0f24b Mon Sep 17 00:00:00 2001 From: ChaoII <849453582@qq.com> Date: Wed, 8 Dec 2021 16:39:50 +0800 Subject: [PATCH 1/3] modify CMakeLists.txt description --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a8faae5..f72b7e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ set(CMAKE_C_FLAGS_RELEASE "/MT") set(CMAKE_CXX_FLAGS_DEBUG "/MTd") set(CMAKE_C_FLAGS_DEBUG "/MTd") +# 用的MSVC有该死的乱码情况,只能用该挫方法处理 add_compile_options("$<$:/utf-8>") add_compile_options("$<$:/utf-8>") From e7e26b05bd04e57dcfd4501a0b125f81ab62b1f4 Mon Sep 17 00:00:00 2001 From: ChaoII <849453582@qq.com> Date: Thu, 9 Dec 2021 17:06:38 +0800 Subject: [PATCH 2/3] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index d61d860..79cd90f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ # OCRDLL base on paddleocr dll + +- base on paddleocr dll +- 在paddleocr的基础上进行了简单的封装,实现基本的逻辑功能,将输出转为C类型的结构体,并且提供了python语言ctypes的调用实现 paddleocr地址,paddle_inference 高性能预测库 +CMakelist.txt 参考paddleocr部署cmakelist文件进行了大幅度的简化(其实复杂的不会),本预测仅采用CPU的mkldnn进行加速,如果是要使用cuda,trt等预测加速,请参考paddleocrgithub地址 +- 这仅仅是demo能够生成供外部调用的dll,其中dll输入输出接口,请按需调整。 From a47ff535056a3fac546e9d9290f3fde9fa1688d3 Mon Sep 17 00:00:00 2001 From: ChaoII <849453582@qq.com> Date: Sat, 11 Dec 2021 13:56:31 +0800 Subject: [PATCH 3/3] modify CMakeLists.txt description --- src/ocr_rec.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/ocr_rec.cpp b/src/ocr_rec.cpp index f448108..f0358ba 100644 --- a/src/ocr_rec.cpp +++ b/src/ocr_rec.cpp @@ -3,13 +3,13 @@ namespace PaddleOCR { void CRNNRecognizer::Run(cv::Mat& img, std::vector* times, std::string& rec_strs,double& rec_scores) { - cv::Mat srcimg; - img.copyTo(srcimg); + cv::Mat src_img; + img.copyTo(src_img); cv::Mat resize_img; - float wh_ratio = float(srcimg.cols) / float(srcimg.rows); + float wh_ratio = float(src_img.cols) / float(src_img.rows); auto preprocess_start = std::chrono::steady_clock::now(); - this->resize_op_.Run(srcimg, resize_img, wh_ratio, this->use_tensorrt_); + this->resize_op_.Run(src_img, resize_img, wh_ratio, this->use_tensorrt_); this->normalize_op_.Run(&resize_img, this->mean_, this->scale_, this->is_scale_); @@ -121,16 +121,12 @@ namespace PaddleOCR { } config.SetCpuMathLibraryNumThreads(this->cpu_math_library_num_threads_); } - config.SwitchUseFeedFetchOps(false); // true for multiple input config.SwitchSpecifyInputNames(true); - config.SwitchIrOptim(true); - config.EnableMemoryOptim(); config.DisableGlogInfo(); - this->predictor_ = CreatePredictor(config); }