PaddleOCR预测方法

一、cpp预测

1、编译:

文档地址:https://github.com/PaddlePaddle/PaddleOCR/blob/develop/deploy/cpp_infer/readme.md

编译脚本:deploy/cpp_infer/tools/build.sh

OPENCV_DIR=~/install/opencv/opencv3
LIB_DIR=~/dowonload/paddle_inference_185/manylinux_cpu_avx_mkl_gcc8.2/fluid_inference
CUDA_LIB_DIR=/usr/local/cuda/lib64
CUDNN_LIB_DIR=/usr/local/cuda/lib64

BUILD_DIR=build
rm -rf ${BUILD_DIR}
mkdir ${BUILD_DIR}
cd ${BUILD_DIR}
cmake .. \
    -DPADDLE_LIB=${LIB_DIR} \
    -DWITH_MKL=ON \
    -DWITH_GPU=OFF \
    -DWITH_STATIC_LIB=OFF \
    -DUSE_TENSORRT=OFF \
    -DOPENCV_DIR=${OPENCV_DIR} \
    -DCUDNN_LIB=${CUDNN_LIB_DIR} \
    -DCUDA_LIB=${CUDA_LIB_DIR} \

make -j8

编译命令:

在PaddleOCR/deploy/cpp_infer目录下运行

sh tools/build.sh

产出地址:build/ppocr

2、调用:

./bin/ppocr system \
    --det_model_dir=ocr_det_model \
    --rec_model_dir=ocr_rec_model \
    --char_list_file=ppocr_keys_v1.txt \
    --image_dir=imgs/1.jpg

 

posted @ 2021-10-13 19:47  鸭子船长  阅读(260)  评论(0编辑  收藏  举报