Skip to content

Latest commit

 

History

History
executable file
·
44 lines (35 loc) · 1.86 KB

File metadata and controls

executable file
·
44 lines (35 loc) · 1.86 KB

PaddleClas Graphcore IPU Python部署示例

本目录下提供infer.py快速完成PaddleClas在Graphcore IPU上部署的示例.

1. 部署环境准备

在部署前,需自行编译基于Graphcore IPU的FastDeploy python wheel包并安装,参考文档,参考文档Graphcore IPU部署环境编译

2. 部署模型准备

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

3. 运行部署示例

# 安装FastDpeloy Graphcore IPU预测库 python包(详细文档请参考`部署环境准备`)

# 下载部署示例代码
git clone https://github.com/PaddlePaddle/FastDeploy.git
cd  FastDeploy/examples/vision/classification/paddleclas/graphcore/python

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

# 下载ResNet50_vd模型文件和测试图片
wget https://bj.bcebos.com/paddlehub/fastdeploy/ResNet50_vd_infer.tgz
tar -xvf ResNet50_vd_infer.tgz
wget https://gitee.com/paddlepaddle/PaddleClas/raw/release/2.4/deploy/images/ImageNet/ILSVRC2012_val_00000010.jpeg

# 在Graphcore AI 处理器上推理
python infer.py --model ResNet50_vd_infer --image ILSVRC2012_val_00000010.jpeg --topk 1

运行完成后返回结果如下所示

ClassifyResult(
label_ids: 153,
scores: 0.686229,
)

4. 更多指南