78 lines
4.0 KiB
Plaintext

(1)yolov5_app.py for ploting moldel inference results
cd kneron_hw_models
python -m applications.yolov5_app
(2)mAP of yolov5s(input640x640) @ coco val2017
/mnt/models/Object_models/YOLOv5/101620_yolov5/yolov5s_v2_op9_sig_batch1_input05_640x640_nearest_convert.onnx
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.356
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.549
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.383
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.208
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.403
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.458
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.299
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.503
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.559
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.367
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.621
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.702
(3)mAP of yolov5m(input640x640) @ coco val2017
/mnt/models/Object_models/YOLOv5/122220_yolov5/yolov5m_v2_op9_sig_batch1_input05_640x640_nearest_convert.onnx
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.426
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.619
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.462
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.258
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.478
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.548
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.338
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.563
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.617
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.426
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.676
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.763
(5)the parameters setting
(5.1)In order to get high mAP in coco val2017, please use
{
"model_path": "/mnt/models/Object_models/YOLOv5/122220_yolov5/yolov5m_v2_op9_sig_batch1_input05_640x640_nearest_convert.onnx",
"grid20_path": "/mnt/models/Object_models/YOLOv5/122220_yolov5/20_640x640.npy",
"grid40_path": "/mnt/models/Object_models/YOLOv5/122220_yolov5/40_640x640.npy",
"grid80_path": "/mnt/models/Object_models/YOLOv5/122220_yolov5/80_640x640.npy",
"num_classes": 80,
"imgsz_h": 640,
"imgsz_w": 640,
"conf_thres": 0.001,
"iou_thres": 0.65,
"top_k_num": 3000
}
(5.2)For video usage scenarios, please use
{
"model_path": "/mnt/models/Object_models/YOLOv5/122220_yolov5/yolov5m_v2_op9_sig_batch1_input05_640x640_nearest_convert.onnx",
"grid20_path": "/mnt/models/Object_models/YOLOv5/122220_yolov5/20_640x640.npy",
"grid40_path": "/mnt/models/Object_models/YOLOv5/122220_yolov5/40_640x640.npy",
"grid80_path": "/mnt/models/Object_models/YOLOv5/122220_yolov5/80_640x640.npy",
"num_classes": 80,
"imgsz_h": 640,
"imgsz_w": 640,
"conf_thres": 0.3,
"iou_thres": 0.5,
"top_k_num": 3000
}
(5.3)The differences of above setting are
(5.3.1) Video uses input (640w*352h) to run faster.
Coco has high or flat wide images, so it is better to use input (640w*640h)
(5.3.2) Using the yolov5 official website setting test coco val2017, the confidence setting is low "conf_thres": 0.001, and the iou setting of NMS is high "iou_thres": 0.65, which gets a better mAP.
But running video needs to be set to "conf_thres": 0.3, so that there are not too many false positives, and the iou setting of NMS "iou_thres": 0.5 is more friendly to close objects
(6) To generate the npy:
python yolov5_generate_npy