mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-04 16:22:57 +08:00

* 第一次提交 * 补充一处漏翻译 * deleted: docs/en/quantize.md * Update one translation * Update en version * Update one translation in code * Standardize one writing * Standardize one writing * Update some en version * Fix a grammer problem * Update en version for api/vision result * Merge branch 'develop' of https://github.com/charl-u/FastDeploy into develop * Checkout the link in README in vision_results/ to the en documents * Modify a title * Add link to serving/docs/ * Finish translation of demo.md * Update english version of serving/docs/ * Update title of readme * Update some links * Modify a title * Update some links * Update en version of java android README * Modify some titles * Modify some titles * Modify some titles * modify article to document * update some english version of documents in examples * Add english version of documents in examples/visions * Sync to current branch * Add english version of documents in examples * Add english version of documents in examples * Add english version of documents in examples * Update some documents in examples * Update some documents in examples * Update some documents in examples * Update some documents in examples * Update some documents in examples * Update some documents in examples * Update some documents in examples * Update some documents in examples * Update some documents in examples
1.7 KiB
1.7 KiB
English | 简体中文
YOLOv5s量化模型 Python部署示例
本目录下提供的infer.py
,可以帮助用户快速完成YOLOv5量化模型在CPU/GPU上的部署推理加速.
部署准备
FastDeploy环境准备
-
- 软硬件环境满足要求,参考FastDeploy环境要求
-
- FastDeploy Python whl包安装,参考FastDeploy Python安装
量化模型准备
-
- 用户可以直接使用由FastDeploy提供的量化模型进行部署.
-
- 用户可以使用FastDeploy提供的一键模型自动化压缩工具,自行进行模型量化, 并使用产出的量化模型进行部署.
以量化后的YOLOv5s模型为例, 进行部署
#下载部署示例代码
git clone https://github.com/PaddlePaddle/FastDeploy.git
cd examples/vision/detection/yolov5/quantize/python
#下载FastDeloy提供的yolov5s量化模型文件和测试图片
wget https://bj.bcebos.com/paddlehub/fastdeploy/yolov5s_quant.tar
tar -xvf yolov5s_quant.tar
wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg
# 在CPU上使用ONNX Runtime推理量化模型
python infer.py --model yolov5s_quant --image 000000014439.jpg --device cpu --backend ort
# 在GPU上使用TensorRT推理量化模型
python infer.py --model yolov5s_quant --image 000000014439.jpg --device gpu --backend trt
# 在GPU上使用Paddle-TensorRT推理量化模型
python infer.py --model yolov5s_quant --image 000000014439.jpg --device gpu --backend pptrt