diff --git a/deploy/Jetson/readme.md b/deploy/Jetson/readme.md index 1eb0ea44f77b522567100fc6b38a23dab68613af..14c88c3c3c8aa8e4bbfe6ce04cb51c58af762351 100644 --- a/deploy/Jetson/readme.md +++ b/deploy/Jetson/readme.md @@ -1,46 +1,45 @@ +English | [简体中文](readme_ch.md) -# Jetson部署PaddleOCR模型 +# Jetson Deployment for PaddleOCR -本节介绍PaddleOCR在Jetson NX、TX2、nano、AGX等系列硬件的部署。 +This section introduces the deployment of PaddleOCR on Jetson NX, TX2, nano, AGX and other series of hardware. -## 1. 环境准备 +## 1. Prepare Environment -需要准备一台Jetson开发板,如果需要TensorRT预测,需准备好TensorRT环境,建议使用7.1.3版本的TensorRT; +You need to prepare a Jetson development hardware. If you need TensorRT, you need to prepare the TensorRT environment. It is recommended to use TensorRT version 7.1.3; -1. Jetson安装PaddlePaddle +1. Install PaddlePaddle in Jetson -PaddlePaddle下载[链接](https://www.paddlepaddle.org.cn/inference/user_guides/download_lib.html#python) -请选择适合的您Jetpack版本、cuda版本、trt版本的安装包。 +The PaddlePaddle download [link](https://www.paddlepaddle.org.cn/inference/user_guides/download_lib.html#python) +Please select the appropriate installation package for your Jetpack version, cuda version, and trt version. Here, we download paddlepaddle_gpu-2.3.0rc0-cp36-cp36m-linux_aarch64.whl. -安装命令: +Install PaddlePaddle: ```shell -# 安装paddle,以paddlepaddle_gpu-2.3.0rc0-cp36-cp36m-linux_aarch64.whl 为例 pip3 install -U paddlepaddle_gpu-2.3.0rc0-cp36-cp36m-linux_aarch64.whl ``` -2. 下载PaddleOCR代码并安装依赖 +2. Download PaddleOCR code and install dependencies -首先 clone PaddleOCR 代码: +Clone the PaddleOCR code: ``` git clone https://github.com/PaddlePaddle/PaddleOCR ``` -然后,安装依赖: +and install dependencies: ``` cd PaddleOCR pip3 install -r requirements.txt ``` -*注:jetson硬件CPU较差,依赖安装较慢,请耐心等待* +*Note: Jetson hardware CPU is poor, dependency installation is slow, please wait patiently* +## 2. Perform prediction -## 2. 执行预测 +Obtain the PPOCR model from the [document](https://github.com/PaddlePaddle/PaddleOCR/blob/dygraph/doc/doc_en/ppocr_introduction_en.md#6-model-zoo) model library. The following takes the PP-OCRv3 model as an example to introduce the use of the PPOCR model on Jetson: -从[文档](https://github.com/PaddlePaddle/PaddleOCR/blob/dygraph/doc/doc_ch/ppocr_introduction.md#6-%E6%A8%A1%E5%9E%8B%E5%BA%93) 模型库中获取PPOCR模型,下面以PP-OCRv3模型为例,介绍在PPOCR模型在jetson上的使用方式: - -下载并解压PP-OCRv3模型 +Download and unzip the PP-OCRv3 models. ``` wget https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_det_infer.tar wget https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_rec_infer.tar @@ -48,38 +47,38 @@ tar xf ch_PP-OCRv3_det_infer.tar tar xf ch_PP-OCRv3_rec_infer.tar ``` -执行文本检测预测: +The text detection inference: ``` cd PaddleOCR python3 tools/infer/predict_det.py --det_model_dir=./inference/ch_PP-OCRv2_det_infer/ --image_dir=./doc/imgs/french_0.jpg --use_gpu=True ``` -执行命令后在终端会打印出预测的信息,并在 `./inference_results/` 下保存可视化结果。 +After executing the command, the predicted information will be printed out in the terminal, and the visualization results will be saved in the `./inference_results/` directory. ![](./images/det_res_french_0.jpg) -执行文本识别预测: +The text recognition inference: ``` python3 tools/infer/predict_det.py --rec_model_dir=./inference/ch_PP-OCRv2_rec_infer/ --image_dir=./doc/imgs_words/en/word_2.png --use_gpu=True --rec_image_shape="3,48,320" ``` -执行命令后在终端会打印出预测的信息,输出如下: +After executing the command, the predicted information will be printed on the terminal, and the output is as follows: ``` [2022/04/28 15:41:45] root INFO: Predicts of ./doc/imgs_words/en/word_2.png:('yourself', 0.98084533) ``` -执行文本检测+文本识别串联预测: +The text detection and text recognition inference: ``` -python3 tools/infer/predict_system.py --det_model_dir=./inference/ch_PP-OCRv2_det_infer/ --rec_model_dir=./inference/ch_PP-OCRv2_rec_infer/ --image_dir=./doc/imgs/ --use_gpu=True --rec_image_shape="3,48,320" +python3 tools/infer/predict_system.py --det_model_dir=./inference/ch_PP-OCRv2_det_infer/ --rec_model_dir=./inference/ch_PP-OCRv2_rec_infer/ --image_dir=./doc/imgs/00057937.jpg --use_gpu=True --rec_image_shape="3,48,320" ``` -执行命令后在终端会打印出预测的信息,并在 `./inference_results/` 下保存可视化结果。 +After executing the command, the predicted information will be printed out in the terminal, and the visualization results will be saved in the `./inference_results/` directory. ![](./images/00057937.jpg) -开启TRT预测只需要在以上命令基础上设置`--use_tensorrt=True`即可: +To enable TRT prediction, you only need to set `--use_tensorrt=True` on the basis of the above command: ``` -python3 tools/infer/predict_system.py --det_model_dir=./inference/ch_PP-OCRv2_det_infer/ --rec_model_dir=./inference/ch_PP-OCRv2_rec_infer/ --image_dir=./doc/imgs/00057937.jpg --use_gpu=True --use_tensorrt=True --rec_image_shape="3,48,320" +python3 tools/infer/predict_system.py --det_model_dir=./inference/ch_PP-OCRv2_det_infer/ --rec_model_dir=./inference/ch_PP-OCRv2_rec_infer/ --image_dir=./doc/imgs/ --rec_image_shape="3,48,320" --use_gpu=True --use_tensorrt=True ``` -更多ppocr模型预测请参考[文档](../../doc/doc_ch/models_list.md) +For more ppocr model predictions, please refer to[document](../../doc/doc_en/models_list_en.md) diff --git a/deploy/Jetson/readme_ch.md b/deploy/Jetson/readme_ch.md new file mode 100644 index 0000000000000000000000000000000000000000..7b0a344ffe3b4c0abefc78e50371b5c92aa25001 --- /dev/null +++ b/deploy/Jetson/readme_ch.md @@ -0,0 +1,86 @@ +[English](readme.md) | 简体中文 + +# Jetson部署PaddleOCR模型 + +本节介绍PaddleOCR在Jetson NX、TX2、nano、AGX等系列硬件的部署。 + + +## 1. 环境准备 + +需要准备一台Jetson开发板,如果需要TensorRT预测,需准备好TensorRT环境,建议使用7.1.3版本的TensorRT; + +1. Jetson安装PaddlePaddle + +PaddlePaddle下载[链接](https://www.paddlepaddle.org.cn/inference/user_guides/download_lib.html#python) +请选择适合的您Jetpack版本、cuda版本、trt版本的安装包。 + +安装命令: +```shell +# 安装paddle,以paddlepaddle_gpu-2.3.0rc0-cp36-cp36m-linux_aarch64.whl 为例 +pip3 install -U paddlepaddle_gpu-2.3.0rc0-cp36-cp36m-linux_aarch64.whl +``` + + +2. 下载PaddleOCR代码并安装依赖 + +首先 clone PaddleOCR 代码: +``` +git clone https://github.com/PaddlePaddle/PaddleOCR +``` + +然后,安装依赖: +``` +cd PaddleOCR +pip3 install -r requirements.txt +``` + +*注:jetson硬件CPU较差,依赖安装较慢,请耐心等待* + + +## 2. 执行预测 + +从[文档](https://github.com/PaddlePaddle/PaddleOCR/blob/dygraph/doc/doc_ch/ppocr_introduction.md#6-%E6%A8%A1%E5%9E%8B%E5%BA%93) 模型库中获取PPOCR模型,下面以PP-OCRv3模型为例,介绍在PPOCR模型在jetson上的使用方式: + +下载并解压PP-OCRv3模型 +``` +wget https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_det_infer.tar +wget https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_rec_infer.tar +tar xf ch_PP-OCRv3_det_infer.tar +tar xf ch_PP-OCRv3_rec_infer.tar +``` + +执行文本检测预测: +``` +cd PaddleOCR +python3 tools/infer/predict_det.py --det_model_dir=./inference/ch_PP-OCRv2_det_infer/ --image_dir=./doc/imgs/french_0.jpg --use_gpu=True +``` + +执行命令后在终端会打印出预测的信息,并在 `./inference_results/` 下保存可视化结果。 +![](./images/det_res_french_0.jpg) + + +执行文本识别预测: +``` +python3 tools/infer/predict_det.py --rec_model_dir=./inference/ch_PP-OCRv2_rec_infer/ --image_dir=./doc/imgs_words/en/word_2.png --use_gpu=True --rec_image_shape="3,48,320" +``` + +执行命令后在终端会打印出预测的信息,输出如下: +``` +[2022/04/28 15:41:45] root INFO: Predicts of ./doc/imgs_words/en/word_2.png:('yourself', 0.98084533) +``` + +执行文本检测+文本识别串联预测: + +``` +python3 tools/infer/predict_system.py --det_model_dir=./inference/ch_PP-OCRv2_det_infer/ --rec_model_dir=./inference/ch_PP-OCRv2_rec_infer/ --image_dir=./doc/imgs/ --use_gpu=True --rec_image_shape="3,48,320" +``` + +执行命令后在终端会打印出预测的信息,并在 `./inference_results/` 下保存可视化结果。 +![](./images/00057937.jpg) + +开启TRT预测只需要在以上命令基础上设置`--use_tensorrt=True`即可: +``` +python3 tools/infer/predict_system.py --det_model_dir=./inference/ch_PP-OCRv2_det_infer/ --rec_model_dir=./inference/ch_PP-OCRv2_rec_infer/ --image_dir=./doc/imgs/00057937.jpg --use_gpu=True --use_tensorrt=True --rec_image_shape="3,48,320" +``` + +更多ppocr模型预测请参考[文档](../../doc/doc_ch/models_list.md) diff --git a/deploy/Jetson/readme_en.md b/deploy/Jetson/readme_en.md deleted file mode 100644 index d499989160e13d6dd6bf1092c890e8ec11681ce4..0000000000000000000000000000000000000000 --- a/deploy/Jetson/readme_en.md +++ /dev/null @@ -1,83 +0,0 @@ - -# Jetson Deployment for PaddleOCR - -This section introduces the deployment of PaddleOCR on Jetson NX, TX2, nano, AGX and other series of hardware. - - -## 1. Prepare Environment - -You need to prepare a Jetson development hardware. If you need TensorRT, you need to prepare the TensorRT environment. It is recommended to use TensorRT version 7.1.3; - -1. Install PaddlePaddle in Jetson - -The PaddlePaddle download [link](https://www.paddlepaddle.org.cn/inference/user_guides/download_lib.html#python) -Please select the appropriate installation package for your Jetpack version, cuda version, and trt version. Here, we download paddlepaddle_gpu-2.3.0rc0-cp36-cp36m-linux_aarch64.whl. - -Install PaddlePaddle: -```shell -pip3 install -U paddlepaddle_gpu-2.3.0rc0-cp36-cp36m-linux_aarch64.whl -``` - - -2. Download PaddleOCR code and install dependencies - -Clone the PaddleOCR code: -``` -git clone https://github.com/PaddlePaddle/PaddleOCR -``` - -and install dependencies: -``` -cd PaddleOCR -pip3 install -r requirements.txt -``` - -*Note: Jetson hardware CPU is poor, dependency installation is slow, please wait patiently* - -## 2. Perform prediction - -Obtain the PPOCR model from the [document](https://github.com/PaddlePaddle/PaddleOCR/blob/dygraph/doc/doc_en/ppocr_introduction_en.md#6-model-zoo) model library. The following takes the PP-OCRv3 model as an example to introduce the use of the PPOCR model on Jetson: - -Download and unzip the PP-OCRv3 models. -``` -wget https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_det_infer.tar -wget https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_rec_infer.tar -tar xf ch_PP-OCRv3_det_infer.tar -tar xf ch_PP-OCRv3_rec_infer.tar -``` - -The text detection inference: -``` -cd PaddleOCR -python3 tools/infer/predict_det.py --det_model_dir=./inference/ch_PP-OCRv2_det_infer/ --image_dir=./doc/imgs/french_0.jpg --use_gpu=True -``` - -After executing the command, the predicted information will be printed out in the terminal, and the visualization results will be saved in the `./inference_results/` directory. -![](./images/det_res_french_0.jpg) - - -The text recognition inference: -``` -python3 tools/infer/predict_det.py --rec_model_dir=./inference/ch_PP-OCRv2_rec_infer/ --image_dir=./doc/imgs_words/en/word_2.png --use_gpu=True --rec_image_shape="3,48,320" -``` - -After executing the command, the predicted information will be printed on the terminal, and the output is as follows: -``` -[2022/04/28 15:41:45] root INFO: Predicts of ./doc/imgs_words/en/word_2.png:('yourself', 0.98084533) -``` - -The text detection and text recognition inference: - -``` -python3 tools/infer/predict_system.py --det_model_dir=./inference/ch_PP-OCRv2_det_infer/ --rec_model_dir=./inference/ch_PP-OCRv2_rec_infer/ --image_dir=./doc/imgs/00057937.jpg --use_gpu=True --rec_image_shape="3,48,320" -``` - -After executing the command, the predicted information will be printed out in the terminal, and the visualization results will be saved in the `./inference_results/` directory. -![](./images/00057937.jpg) - -To enable TRT prediction, you only need to set `--use_tensorrt=True` on the basis of the above command: -``` -python3 tools/infer/predict_system.py --det_model_dir=./inference/ch_PP-OCRv2_det_infer/ --rec_model_dir=./inference/ch_PP-OCRv2_rec_infer/ --image_dir=./doc/imgs/ --rec_image_shape="3,48,320" --use_gpu=True --use_tensorrt=True -``` - -For more ppocr model predictions, please refer to[document](../../doc/doc_en/models_list_en.md) diff --git a/deploy/README.md b/deploy/README.md index 3a77ff22a15b624ace56027f606eff61e9efb66c..0cfb793f92547de1215277f5e2348bc157ec8503 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -25,7 +25,7 @@ PP-OCR has supported muti deployment schemes. Click the link to get the specific - [Serving (Python/C++)](./pdserving/README.md) - [Paddle-Lite (ARM CPU/OpenCL ARM GPU)](./lite/readme.md) - [Paddle.js](./paddlejs/README.md) -- [Jetson Inference]() +- [Jetson Inference](https://github.com/PaddlePaddle/PaddleOCR/blob/dygraph/deploy/Jetson/readme.md) - [Paddle2ONNX](./paddle2onnx/readme.md) If you need the deployment tutorial of academic algorithm models other than PP-OCR, please directly enter the main page of corresponding algorithms, [entrance](../doc/doc_en/algorithm_overview_en.md)。 diff --git a/deploy/README_ch.md b/deploy/README_ch.md index 9ec90bd36a05a53ae0f27386f6d2eba798e40842..a8202ff46721fe6a2a36e7c73aeea4b6b9b15895 100644 --- a/deploy/README_ch.md +++ b/deploy/README_ch.md @@ -23,9 +23,9 @@ PP-OCR模型已打通多种场景部署方案,点击链接获取具体的使 - [Python 推理](../doc/doc_ch/inference_ppocr.md) - [C++ 推理](./cpp_infer/readme_ch.md) - [Serving 服务化部署(Python/C++)](./pdserving/README_CN.md) -- [Paddle-Lite 端侧部署(ARM CPU/OpenCL ARM GPU)](./lite/readme_ch.md) +- [Paddle-Lite 端侧部署(ARM CPU/OpenCL ARM GPU/Metal ARM GPU)](./lite/readme_ch.md) - [Paddle.js 部署](./paddlejs/README_ch.md) -- [Jetson 推理]() +- [Jetson 推理](https://github.com/PaddlePaddle/PaddleOCR/blob/dygraph/deploy/Jetson/readme_ch.md) - [Paddle2ONNX 推理](./paddle2onnx/readme_ch.md) -需要PP-OCR以外的学术算法模型的推理部署,请直接进入相应算法主页面,[入口](../doc/doc_ch/algorithm_overview.md)。 +需要PP-OCR以外的学术算法模型的推理部署,请直接进入相应算法主页面,[入口](../doc/doc_ch/algorithm_overview.md)。 \ No newline at end of file diff --git a/doc/doc_ch/PP-OCRv3_introduction.md b/doc/doc_ch/PP-OCRv3_introduction.md index f65ee7ccf9cf813d20d9419cf3b8e62c22eeabf0..d93f386dac95e5bfad7140107a1f5fecb8f9e885 100644 --- a/doc/doc_ch/PP-OCRv3_introduction.md +++ b/doc/doc_ch/PP-OCRv3_introduction.md @@ -1,38 +1,27 @@ [English](../doc_en/PP-OCRv3_introduction_en.md) | 简体中文 -# PP-OCR +# PP-OCRv3 - [1. 简介](#1) -- [2. 特性](#2) -- [3. benchmark](#3) +- [2. 检测优化](#2) +- [3. 识别优化](#3) +- [4. 端到端评估](#4) ## 1. 简介 -PP-OCR是PaddleOCR自研的实用的超轻量OCR系统。在实现[前沿算法](algorithm.md)的基础上,考虑精度与速度的平衡,进行**模型瘦身**和**深度优化**,使其尽可能满足产业落地需求。 +PP-OCRv3在PP-OCRv2的基础上进一步升级。检测模型仍然基于DB算法,优化策略采用了带残差注意力机制的FPN结构RSEFPN、增大感受野的PAN结构LKPAN、基于DML训练的更优的教师模型;识别模型将base模型从CRNN替换成了IJCAI 2022论文[SVTR](),并采用SVTR轻量化、带指导训练CTC、数据增广策略RecConAug、自监督训练的更好的预训练模型、无标签数据的使用进行模型加速和效果提升。更多细节请参考PP-OCRv3[技术报告](./PP-OCRv3_introduction.md)。 -#### PP-OCR - -PP-OCR是一个两阶段的OCR系统,其中文本检测算法选用[DB](algorithm_det_db.md),文本识别算法选用[CRNN](algorithm_rec_crnn.md),并在检测和识别模块之间添加[文本方向分类器](angle_class.md),以应对不同方向的文本识别。 - -PP-OCRv2系统pipeline如下: +PP-OCRv3系统pipeline如下: