diff --git a/deploy/paddle2onnx/readme_en.md b/deploy/paddle2onnx/readme_en.md new file mode 100644 index 0000000000000000000000000000000000000000..6df13e5fe31805d642432dea8526661e82b6e95b --- /dev/null +++ b/deploy/paddle2onnx/readme_en.md @@ -0,0 +1,59 @@ +# Paddle2ONNX: Converting To ONNX and Deployment + +This section introduce that how to convert the Paddle Inference Model ResNet50_vd to ONNX model and deployment based on ONNX engine. + +## 1. Installation + +First, you need to install Paddle2ONNX and onnxruntime. Paddle2ONNX is a toolkit to convert Paddle Inference Model to ONNX model. Please refer to [Paddle2ONNX](https://github.com/PaddlePaddle/Paddle2ONNX/blob/develop/README_en.md) for more information. + +- Paddle2ONNX Installation +``` +python3.7 -m pip install paddle2onnx +``` + +- ONNX Installation +``` +python3.7 -m pip install onnxruntime +``` + +## 2. Converting to ONNX + +Download the Paddle Inference Model ResNet50_vd: + +``` +cd deploy +mkdir models && cd models +wget -nc https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/inference/ResNet50_vd_infer.tar && tar xf ResNet50_vd_infer.tar +cd .. +``` + +Converting to ONNX model: + +``` +paddle2onnx --model_dir=./models/ResNet50_vd_infer/ \ +--model_filename=inference.pdmodel \ +--params_filename=inference.pdiparams \ +--save_file=./models/ResNet50_vd_infer/inference.onnx \ +--opset_version=10 \ +--enable_onnx_checker=True +``` + +After running the above command, the ONNX model file converted would be save in `./models/ResNet50_vd_infer/`. + +## 3. Deployment + +Deployment with ONNX model, command is as shown below. + +``` +python3.7 python/predict_cls.py \ +-c configs/inference_cls.yaml \ +-o Global.use_onnx=True \ +-o Global.use_gpu=False \ +-o Global.inference_model_dir=./models/ResNet50_vd_infer +``` + +The prediction results: + +``` +ILSVRC2012_val_00000010.jpeg: class id(s): [153, 204, 229, 332, 155], score(s): [0.69, 0.10, 0.02, 0.01, 0.01], label_name(s): ['Maltese dog, Maltese terrier, Maltese', 'Lhasa, Lhasa apso', 'Old English sheepdog, bobtail', 'Angora, Angora rabbit', 'Shih-Tzu'] +``` diff --git a/docs/en/PULC/PULC_person_exists_en.md b/docs/en/PULC/PULC_person_exists_en.md index d169ab2f445a635138fc4d72e19d6be592118701..a1e709cefb497b394a00bec9da01ca1903cedbc1 100644 --- a/docs/en/PULC/PULC_person_exists_en.md +++ b/docs/en/PULC/PULC_person_exists_en.md @@ -32,7 +32,7 @@ - [6.3 Deployment with C++](#6.3) - [6.4 Deployment as Service](#6.4) - [6.5 Deployment on Mobile](#6.5) - - [6.6 To ONNX and Deployment](#6.6) + - [6.6 Converting To ONNX and Deployment](#6.6) @@ -274,7 +274,7 @@ The results: ### 4.1 SKL-UGI Knowledge Distillation -SKL-UGI is a simple but effective knowledge distillation algrithem proposed by PaddleClas. Please refer to [SKL-UGI 知识蒸馏](../advanced_tutorials/ssld_en.md) for more details. +SKL-UGI is a simple but effective knowledge distillation algrithem proposed by PaddleClas. Please refer to [SKL-UGI 知识蒸馏](../advanced_tutorials/distillation/distillation_en.md) for more details. @@ -450,7 +450,7 @@ PaddleClas provides an example of how to deploy on mobile by Paddle-Lite. Please -### 6.6 To ONNX and Deployment +### 6.6 Converting To ONNX and Deployment Paddle2ONNX support convert Paddle Inference model to ONNX model. And you can deploy with ONNX model on different inference engine, such as TensorRT, OpenVINO, MNN/TNN, NCNN and so on. About Paddle2ONNX details, please refer to [Paddle2ONNX](https://github.com/PaddlePaddle/Paddle2ONNX).