Before we get to know PaddleOCR, let's first understand PaddlePaddle. Based on Baidu's years of deep learning technology research and business applications, PaddlePaddle is China's first open source, technologically leading, and fully functional industrial-grade deep learning platform, integrating deep learning core training and inference frameworks, basic model libraries, end-to-end development kits, and rich tool components. At present, Flying Paddle has gathered more than 2.65 million developers, served 100,000 enterprises, and generated 340,000 models based on the Flying Paddle open source deep learning platform. Flying Paddle helps developers quickly realize AI ideas and quickly launch AI services. Help more and more industries complete AI empowerment and realize industrial intelligent upgrading.
Official Website:The hyperlink login is visible.
PaddleOCR aims to create a rich, leading, and practical OCR tool library to help users train better models and implement them.
First look at the renderings:
(Original picture)
(After identification,The labeled border is drawn by itself based on the returned result)
Baidu Flying Paddle requires Windows environment
Windows 7/8/10 Pro/Enterprise (64bit) The GPU version supports CUDA 9.0/10.0/10.1/10.2/11.0, and only supports a single card Python version 2.7.15+/3.5.1+/3.6+/3.7+/3.8+ (64 bit) pip version 20.2.2+ (64 bit)
Note: If you are using a higher version of Python, such as Python 3.9, you will get the following error:
ERROR: Could not find a version that satisfies the requirement paddlepaddle (from versions: none)
ERROR: No matching distribution found for paddlepaddle Solution:
Download a supported version, for example: version 3.8.8, download address:The hyperlink login is visible.
You need to confirm that Python and pip are 64-bit, and the processor architecture is x86_64 (or x64, Intel 64, AMD64) architecture, and currently PaddlePaddle does not support arm64 architecture. The first line below outputs "64bit", and the second line outputs "x86_64", "x64" or "AMD64".
D:\itsvse>python --version Python 3.8.8
D:\itsvse>pip --version pip 20.2.3 from c:\program files\python38\lib\site-packages\pip (python 3.8)
D:\itsvse>python -c "import platform;print(platform.architecture()[0]);print(platform.machine())" 64bit AMD64 Windows 10 installs the PaddlePaddle CPU version
Command:
Verify the installation
After the installation is complete, you can use python or python3 to enter the python interpreter, enter import paddle, and then type paddle.utils.run_check()
if it appearsPaddlePaddle is installed successfully!, indicating that you have successfully installed. As shown below:
(Do not execute) uninstall command:
Install PaddleHub
Command:
Download Clone PaddleOCR
Use the git clone command to download conditionally, and unconditionally download it directly into a compressed package and then unzip it, address:The hyperlink login is visible.
I downloaded it directly and unzipped it to the folder :D:\itsvse\PaddleOCR-release-2.0.
Download the inference model
Before installing the service module, you need to prepare the inference model and put it in the correct path.
Detection Model:The hyperlink login is visible. Direction Classifier:The hyperlink login is visible. Identify the model:The hyperlink login is visible.
After downloading it, I placed it under the D:\itsvse\PaddleOCR-release-2.0\deploy\model folder, as shown below:
Install the detection + identification series service module
Modify the "D:\itsvse\PaddleOCR-release-2.0\deploy\hubserving\ocr_system\params.py" configuration as follows:
Use the cmd window to execute the following command under the D:\itsvse\PaddleOCR-release-2.0 folder:
Remark:To modify the python file under \hubserving\ocr_system, you need to reinstall the deployment or execute the above command。
Errors may be reported as follows:
ModuleNotFoundError: No module named 'imgaug'
ModuleNotFoundError: No module named 'pyclipper'
ModuleNotFoundError: No module named 'lmdb' Just use pip to install, for example: pip install imgaug
The installation is as follows:
[2021-03-15 15:59:37,549] [ INFO] - Successfully uninstalled ocr_system [2021-03-15 15:59:38,237] [ INFO] - Successfully installed ocr_system-1.0.0
Start the ocr_system service
Here the configuration parameters use the configuration file, first modify the "D:\itsvse\PaddleOCR-release-2.0\deploy\hubserving\ocr_system\config.json" configuration, as follows:
Start the service with the following command:
Test the picture with the python client
Put the image you want to test into the "D:\itsvse\PaddleOCR-release-2.0\doc\imgs1" folder, and run the following command in D:\itsvse\PaddleOCR-release-2.0:
test_hubserving.py The source code is as follows:
Test the picture using the .NET Core client
Directly upload the code, as follows:
{"msg":"","results":[[{"confidence":0.9994004964828491,"text":"Blog Statistics","text_region":[[23,18],[85,18],[85,33],[23,32]]},{"confidence":0.9951881170272827,"text":"Hello everyone, I am a little scumbag, and I started a blog on April 5, 2015","text_region":[[22,74],[471,74],[471,93],[22,93]]},{"confidence":0.9985174536705017,"text":"As of this time2021-03-1516:19:52","text_region":[[23,111],[ 217,111],[217,126],[23,126]]},{"confidence":0.9762932062149048,"text":"Cumulative about. .NET 1184 articles, 6844154 times in total, 10505 comments in total","text_region":[[24,153],[448,153],[448,165],[24,165]]},{"confidence":0.9847920536994934,"text":"Total of 2807 articles, cumulative reading 14210224 times, 19074 reviews","text_region":[[24,177],[414,177],[414,188],[24,189]]}]],"status":"000"}
Since I am using the server side of virtual machine deployment, sometimes memory errors are reported:
Fail to alloc memory of 268418688 size. Temporary solution, restart the server.
Resources:
The hyperlink login is visible.
The hyperlink login is visible.
(End)
|