Page 1 of 1

Yolov5 convert to RKNN

Posted: 2024-03-20 19:41
by Yurii
I trained the yolov5s.pt model with two classes and tested it.
Then converted yolov5s.pt to yolov5s.onnx "python export.py --rknpu --weight yolov5s.pt".
I then converted yolov5s.onnx using the convert.py script "rknn_model_zoo\examples\yolov5\python" to yolov5.rknn. But when running the model on RV1106 I get an error for some reason.
When configuring the standard yolov5s.pt model, everything works fine.
Maybe it's because of the change in the number of classes?
xxx.png

Re: Yolov5 convert to RKNN

Posted: 2024-03-21 1:37
by Crocodile
Yurii wrote: 2024-03-20 19:41 I trained the yolov5s.pt model with two classes and tested it.
Then converted yolov5s.pt to yolov5s.onnx "python export.py --rknpu --weight yolov5s.pt".
I then converted yolov5s.onnx using the convert.py script "rknn_model_zoo\examples\yolov5\python" to yolov5.rknn. But when running the model on RV1106 I get an error for some reason.
When configuring the standard yolov5s.pt model, everything works fine.
Maybe it's because of the change in the number of classes?
xxx.png
Hi,
The trained models may vary in the number of categories and their structures. Parameters need to be adjusted at runtime. You need to set the OBJ_CLASS_NUM parameter in the postprocess.h file and modify the coco_80_labels_list file in the model folder to change the names of the categories.
yolov5_objs_num_conf.jpg
yolov5_objs_num_conf01.jpg