PaddleOCR Windows installation and deployment

Environment introduction

Windows 10 64 bit

Anaconda3(python3.7)

PaddleOCR (CPU版)

Create a virtual environment

conda create -n paddle python=3.7  # paddle为虚拟环境名
conda activate paddle  # 进入虚拟环境

Install PaddlePaddle

pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple  # 这里安装的CPU版本

Reference link https://www.paddlepaddle.org.cn/install/quick

Before running, you need to confirm whether the pip version meets the requirements, and the pip version is required to be 9.0.1+. You can run the following command by upgrading pip in advance:

pip install --upgrade pip

Download PaddleOCR source code

https://github.com/PaddlePaddle/PaddleOCR/tree/develop

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

Or download .zip to decompress by yourself

Install project dependencies

cd paddleocr
pip install -r requirments.txt -i https://mirror.baidu.com/pypi/simple

download model

https://paddleocr.bj.bcebos.com/inference.tar

Unzip inference.tar and copy the inference directory to the /paddleocr/ directory. This is an ultra-lightweight Chinese OCR model detection model and decompression. For more models and usage methods, please refer to the official website

Running experience

python tools/infer/predict_det.py --image_dir="./doc/imgs/2.jpg" --det_model_dir="./inference/det/" --use_gpu=False

Note: Because the gpu version is not used, the running parameter --use_gpu=False needs to be added

operation result:

View in \PaddleOCR\inferenc_results\det_res_2.jpg picture
insert image description here
insert image description here

The following error occurs when running the above command

(sys.prefix, 'Library', 'bin', 'geos_c.dll') OSError: [WinError 126] The specified module cannot be found" solution

The main reason is that the installation of the shapely library is not complete.

solution:

Download shapely manually

https://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely

Select the download package of the corresponding Python version and operating system version to download

pip uninstall Shapely # 卸载shapely
pip install D:\Chromedowload\Shapely-1.7.1-cp37-cp37m-win_amd64.whl

If the same error is still reported, it is because the corresponding geos_c.dll has not been added to the environment.

solution:

Rename Shapely-1.7.1-cp37-cp37m-win_amd64.whl to Shapely-1.7.1-cp37-cp37m-win_amd64.zip

Unzip and find geos_c.dll

Copy to the Python virtual environment paddle

D:\anaconda3\envs\paddle\Library\bin folder. problem solved

Guess you like

Origin blog.csdn.net/allexw/article/details/112188697