sophgo / tpu-mlir

Machine learning compiler based on MLIR for Sophgo TPU.
Other
613 stars 154 forks source link

cvimodel检测出错 #181

Closed sanzhang3 closed 3 months ago

sanzhang3 commented 3 months ago

在将yolov5s.onnx转换为f16精度之后,运行detect时报错。 root@2c84df3bc13a:/workspace/yolov5/yolov5s_onnx/workspace# detect_yolov5.py \

--input ../image/dog.jpg \ --model yolov5s_cv181x_f16.cvimodel \ --output dog_f16.jpg setenv:cv181x Start TPU Simulator for cv181x device[0] opened, 4294967296 version: 1.4.0 yolov5s Build at 2024-07-29 14:46:27 For platform cv181x Cmodel: bm_load_cmdbuf Max SharedMem size:13107200 Cmodel: bm_run_cmdbuf device[0] closed Traceback (most recent call last): File "/workspace/yolov5/tpu-mlir/python/samples/detect_yolov5.py", line 365, in main() File "/workspace/yolov5/tpu-mlir/python/samples/detect_yolov5.py", line 341, in main scores, boxes_xyxy = postproc(output, input_shape, top, left) File "/workspace/yolov5/tpu-mlir/python/samples/detect_yolov5.py", line 285, in postproc pred = np.concatenate(z, axis=0) File "<__array_function__ internals>", line 6, in concatenate ValueError: need at least one array to concatenate

fadiaburaid commented 3 months ago

@sanzhang3 Did you find a solution for the error? I am getting the same error.

sanzhang3 commented 3 months ago

@sanzhang3 Did you find a solution for the error? I am getting the same error.

Yes,you can try add args --fused_preprocess --quant_input when you run the model_deploy.py. Read TPU-MLIR_Technical_Reference_Manual.pdf 3.2.4 for detail.

fadiaburaid commented 3 months ago

@sanzhang3 Thank you. I will give it a try.

HarmonyHu commented 3 months ago

cv181x not support f16, but support bf16 and int8. you can test it by:

cd /workspace/tpu-mlir/regression/
./run_model.py yolov5s --chip cv181x --mode bf16
detect_yolov5.py --model yolov5s_cv181x_bf16.cvimodel --input /workspace/tpu-mlir/regression/image/dog.jpg --output yolov5s_bf16.jpg