PaddleOCR server-side deployment_C++

1. Environmental preparation

1.1 Build the docker environment of PaddleOCR

First, build the docket environment of PaddleOCR as follows

https://blog.csdn.net/u013171226/article/details/115125137

1.2 Compile opencv library

First, you need to download the package compiled in the Linux environment from the opencv official website. Take opencv 3.4.7 as an example. The download command is as follows.

wget https://github.com/opencv/opencv/archive/3.4.7.tar.gz
tar -xf 3.4.7.tar.gz
cd opencv-3.4.7

Compile opencv, set the opencv source code path ( root_path) and installation path ( install_path), and then use the following command to compile to generate opencv header files and library files.

mkdir install
root_path=/paddle/opencv-3.4.7
install_path=/paddle/opencv-3.4.7/install
rm -rf build
mkdir build
cd build
cmake .. \
    -DCMAKE_INSTALL_PREFIX=${install_path} \
    -DCMAKE_BUILD_TYPE=Release \
    -DBUILD_SHARED_LIBS=OFF \
    -DWITH_IPP=OFF \
    -DBUILD_IPP_IW=OFF \
    -DWITH_LAPACK=OFF \
    -DWITH_EIGEN=OFF \
    -DCMAKE_INSTALL_LIBDIR=lib64 \
    -DWITH_ZLIB=ON \
    -DBUILD_ZLIB=ON \
    -DWITH_JPEG=ON \
    -DBUILD_JPEG=ON \
    -DWITH_PNG=ON \
    -DBUILD_PNG=ON \
    -DWITH_TIFF=ON \
    -DBUILD_TIFF=ON
make -j8
make install

1.3 Compile Paddle prediction library

First download the code from github:

git clone https://github.com/PaddlePaddle/Paddle.git

Then make cmake configuration,

rm -rf build
mkdir build
cd build
cmake  .. \
    -DWITH_CONTRIB=OFF \
    -DWITH_MKL=ON \
    -DWITH_MKLDNN=ON  \
    -DWITH_TESTING=OFF \
    -DCMAKE_BUILD_TYPE=Release \
    -DWITH_INFERENCE_API_TEST=OFF \
    -DON_INFER=ON \
    -DWITH_PYTHON=ON
make -j8
make install

The following error occurred when executing make:

fatal: unable to access 'https://gitlab.com/libeigen/eigen.git/': gnutls_handshake() failed: Error in the pull function.
fatal: unable to access 'https://github.com/pybind/pybind11.git/': gnutls_handshake() failed: The TLS connection was non-properly terminated.
fatal: unable to access 'https://github.com/sandyhouse/gloo.git/': Failed to connect to github.com port 443: Connection timed out

Searching for a method online did not solve it, and finally found that it would be better to execute the same command a few more times. It should be a network problem on my computer. Don't make clean when trying, just repeat make -j8.

 

 

 

Guess you like

Origin blog.csdn.net/u013171226/article/details/115294137