1.yolov3.pt转onnx
python3.7 models/export.py --weights ./yolov3.pt --img 416 --batch 1
转yolov3_bs1.om:
source env.sh atc --model=yolov3.onnx --framework=5 --output=yolov3_bs1 --input_format=NCHW --log=info --soc_version=Ascend310 --input_shape="images:1,3,416,416" --out_nodes="Reshape_319:0;Reshape_285:0;Reshape_270:0;Reshape_236:0;Reshape_221:0;Reshape_187:0"
3.数据预处理
运行脚本preprocess_yolov3_pytorch.py处理数据集
python3.7 preprocess_yolov3_pytorch.py coco_2014.info yolov3-tiny_bin
4.benchmark推理
运行get_coco_info.py生成info文件
python3.7 get_coco_info.py yolov3-tiny_bin coco_2014.info yolov3.info
5.执行benchmark命令,结果保存在同级目录 result/dumpOutput_device1/
./benchmark.x86_64 -model_type=vision -device_id=1 -batch_size=1 -om_path=yolov3_bs1.om -input_text_path=yolov3.info -input_width=416 -input_height=416 -output_binary=True -useDvpp=False
陈松师姐:
./benchmark.x86_64 -model_type=vision -batch_size=1 -device_id=3 -input_text_path=./bin_pad.info -input_width=416 -input_height=416 -useDvpp=False -output_binary=False -om_path=yolov3tiny_416.om
查看设备状态:
310上执行,执行时使npu-smi info查看设备状态,确保device空闲