tar -zxvf infer_project.tar.gz
cd infer_project/ && dos2unix `find .`
若提示命令dos2unix not found,请使用apt install dos2unix命令安装。
python3 onnx2om.py
模型转换成功回显如下:
bash common/onnx2om.sh --model=yolov5s --bs=1 --calib_bs=1 --soc=Ascend310B4 --type=fp16 === onnx2om args === version: 7.0 model: yolov5s bs: 1 type: fp16 output_dir: output soc: Ascend310B4 Starting onnx导出om模型(无后处理) ATC start working now, please wait for a moment. .................................ATC run success, welcome to the next use. onnx导出om模型 Success
python3 om_infer.py --model=output/yolov5s_bs1.om --eval --visible
推理成功回显如下:
[INFO] acl init success [INFO] open device 0 success [INFO] load model output/yolov5s_bs1.om success [INFO] create model description success 100%|█████████████████████████████████████████████| 5/5 [00:02<00:00, 2.18it/s] Average infer time: 116.717 ms / 1 image ... get 5 images Running per image evaluation... Evaluate annotation type *bbox* DONE (t=0.06s). Accumulating evaluation results... DONE (t=0.02s). Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.579 ... Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.652 {'bbox_mAP': 0.579, 'bbox_mAP_50': 0.94, 'bbox_mAP_75': 0.71, 'bbox_mAP_s': -1.0, 'bbox_mAP_m': 0.6, 'bbox_mAP_l': 0.583, 'bbox_mAP_copypaste': '0.579 0.940 0.710 -1.000 0.600 0.583'} [INFO] unload model success, model Id is 1 [INFO] end to destroy context [INFO] end to reset device is 0 [INFO] end to finalize acl