pip install -r requirement.txt
参考:Lite环境配置
注意:MindSpore Lite适配的python环境为3.7,请在安装Lite前准备好python3.7的环境
- 根据环境,下载配套的tar.gz包和whl包
- 解压tar.gz包并安装对应版本的whl包
tar -zxvf mindspore_lite-2.0.0a0-cp37-cp37m-{os}_{platform}_64.tar.gz
pip install mindspore_lite-2.0.0a0-cp37-cp37m-{os}_{platform}_64.whl
- 配置Lite的环境变量 LITE_HOME为tar.gz解压出的文件夹路径,推荐使用绝对路径
export LITE_HOME=/path/to/mindspore-lite-{version}-{os}-{platform}
export LD_LIBRARY_PATH=$LITE_HOME/runtime/lib:$LITE_HOME/tools/converter/lib:$LD_LIBRARY_PATH
export PATH=$LITE_HOME/tools/converter/converter:$LITE_HOME/tools/benchmark:$PATH
ckpt模型转为mindir模型,此步骤可在CPU/Ascend910上运行
python ./deploy/export.py --config ./path_to_config/model.yaml --weight ./path_to_ckpt/weight.ckpt --per_batch_size 1 --file_format MINDIR --device_target [CPU/Ascend]
e.g.
# 在CPU上运行
python ./deploy/export.py --config ./configs/yolov5/yolov5n.yaml --weight yolov5n_300e_mAP273-9b16bd7b.ckpt --per_batch_size 1 --file_format MINDIR --device_target CPU
# 在Ascend上运行
python ./deploy/export.py --config ./configs/yolov5/yolov5n.yaml --weight yolov5n_300e_mAP273-9b16bd7b.ckpt --per_batch_size 1 --file_format MINDIR --device_target Ascend
python deploy/test.py --model_type Lite --model_path ./path_to_mindir/weight.mindir --config ./path_to_config/yolo.yaml
e.g.
python deploy/test.py --model_type Lite --model_path ./yolov5n.mindir --config ./configs/yolov5/yolov5n.yaml
python ./deploy/predict.py --model_type Lite --model_path ./path_to_mindir/weight.mindir --config ./path_to_conifg/yolo.yaml --image_path ./path_to_image/image.jpg
e.g.
python deploy/predict.py --model_type Lite --model_path ./yolov5n.mindir --config ./configs/yolov5/yolov5n.yaml --image_path ./coco/image/val2017/image.jpg
- predict.py 支持单张图片推理
- test.py 支持COCO数据集推理
- 注意:当前只支持在Ascend 310上推理
查看 MINDX
查看 MINDIR
注意: 仅部分模型支持导出ONNX并使用ONNXRuntime进行部署
查看 ONNX
Name | Scale | Context | ImageSize | Dataset | Box mAP (%) | Params | FLOPs | Recipe | Download |
---|---|---|---|---|---|---|---|---|---|
YOLOv8 | N | D310x1-G | 640 | MS COCO 2017 | 37.2 | 3.2M | 8.7G | yaml | ckpt mindir |
YOLOv8 | S | D310x1-G | 640 | MS COCO 2017 | 44.6 | 11.2M | 28.6G | yaml | ckpt mindir |
YOLOv8 | M | D310x1-G | 640 | MS COCO 2017 | 50.5 | 25.9M | 78.9G | yaml | ckpt mindir |
YOLOv8 | L | D310x1-G | 640 | MS COCO 2017 | 52.8 | 43.7M | 165.2G | yaml | ckpt mindir |
YOLOv8 | X | D310x1-G | 640 | MS COCO 2017 | 53.7 | 68.2M | 257.8G | yaml | ckpt mindir |
YOLOv7 | Tiny | D310x1-G | 640 | MS COCO 2017 | 37.5 | 6.2M | 13.8G | yaml | ckpt mindir |
YOLOv7 | L | D310x1-G | 640 | MS COCO 2017 | 50.8 | 36.9M | 104.7G | yaml | ckpt mindir |
YOLOv7 | X | D310x1-G | 640 | MS COCO 2017 | 52.4 | 71.3M | 189.9G | yaml | ckpt mindir |
YOLOv5 | N | D310x1-G | 640 | MS COCO 2017 | 27.3 | 1.9M | 4.5G | yaml | ckpt mindir |
YOLOv5 | S | D310x1-G | 640 | MS COCO 2017 | 37.6 | 7.2M | 16.5G | yaml | ckpt mindir |
YOLOv5 | M | D310x1-G | 640 | MS COCO 2017 | 44.9 | 21.2M | 49.0G | yaml | ckpt mindir |
YOLOv5 | L | D310x1-G | 640 | MS COCO 2017 | 48.5 | 46.5M | 109.1G | yaml | ckpt mindir |
YOLOv5 | X | D310x1-G | 640 | MS COCO 2017 | 50.5 | 86.7M | 205.7G | yaml | ckpt mindir |
YOLOv4 | CSPDarknet53 | D310x1-G | 608 | MS COCO 2017 | 45.4 | 27.6M | 52G | yaml | ckpt mindir |
YOLOv4 | CSPDarknet53(silu) | D310x1-G | 640 | MS COCO 2017 | 45.8 | 27.6M | 52G | yaml | ckpt mindir |
YOLOv3 | Darknet53 | D310x1-G | 640 | MS COCO 2017 | 45.5 | 61.9M | 156.4G | yaml | ckpt mindir |
YOLOX | N | D310x1-G | 416 | MS COCO 2017 | 24.1 | 0.9M | 1.1G | yaml | ckpt mindir |
YOLOX | Tiny | D310x1-G | 416 | MS COCO 2017 | 33.3 | 5.1M | 6.5G | yaml | ckpt mindir |
YOLOX | S | D310x1-G | 640 | MS COCO 2017 | 40.7 | 9.0M | 26.8G | yaml | ckpt mindir |
YOLOX | M | D310x1-G | 640 | MS COCO 2017 | 46.7 | 25.3M | 73.8G | yaml | ckpt mindir |
YOLOX | L | D310x1-G | 640 | MS COCO 2017 | 49.2 | 54.2M | 155.6G | yaml | ckpt mindir |
YOLOX | X | D310x1-G | 640 | MS COCO 2017 | 51.6 | 99.1M | 281.9G | yaml | ckpt mindir |
YOLOX | Darknet53 | D310x1-G | 640 | MS COCO 2017 | 47.7 | 63.7M | 185.3G | yaml | ckpt mindir |