You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fanpt 34c5ad4044 paddleocr 8 months ago
..
CMakeLists.txt paddleocr 8 months ago
README.md paddleocr 8 months ago
infer.cc paddleocr 8 months ago

README.md

English | 简体中文

PP-OCRv3 Ascend C++部署示例

本目录下提供infer.cc, 供用户完成PP-OCRv3在华为昇腾AI处理器上的部署.

1. 部署环境准备

在部署前,需确认以下两个步骤

2.部署模型准备

在部署前, 请准备好您所需要运行的推理模型, 您可以在FastDeploy支持的PaddleOCR模型列表中下载所需模型.

3.运行部署示例

# 下载部署示例代码
git clone https://github.com/PaddlePaddle/FastDeploy.git
cd  FastDeploy/examples/vision/ocr/PP-OCR/ascend/cpp

# 如果您希望从PaddleOCR下载示例代码请运行
git clone https://github.com/PaddlePaddle/PaddleOCR.git
# 注意如果当前分支找不到下面的fastdeploy测试代码请切换到dygraph分支
git checkout dygraph
cd PaddleOCR/deploy/fastdeploy/ascend/cpp

mkdir build
cd build
# 使用编译完成的FastDeploy库编译infer_demo
cmake .. -DFASTDEPLOY_INSTALL_DIR=${PWD}/fastdeploy-ascend
make -j

# 下载PP-OCRv3文字检测模型
wget https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_det_infer.tar
tar -xvf ch_PP-OCRv3_det_infer.tar
# 下载文字方向分类器模型
wget https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_cls_infer.tar
tar -xvf ch_ppocr_mobile_v2.0_cls_infer.tar
# 下载PP-OCRv3文字识别模型
wget https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_rec_infer.tar
tar -xvf ch_PP-OCRv3_rec_infer.tar

# 下载预测图片与字典文件
wget https://gitee.com/paddlepaddle/PaddleOCR/raw/release/2.6/doc/imgs/12.jpg
wget https://gitee.com/paddlepaddle/PaddleOCR/raw/release/2.6/ppocr/utils/ppocr_keys_v1.txt

# 按照上文提供的文档完成环境初始化, 并执行以下命令
./infer_demo ./ch_PP-OCRv3_det_infer ./ch_ppocr_mobile_v2.0_cls_infer ./ch_PP-OCRv3_rec_infer ./ppocr_keys_v1.txt ./12.jpg

# NOTE:若用户需要连续地预测图片, 输入图片尺寸需要准备为统一尺寸, 例如 N 张, 尺寸为 A * B 的图片.

运行完成可视化结果如下图所示

4. 更多指南