Reputation: 1
I have implemented YOLOv4 object detection using darknet. After the training, I started testing the model on videos using this command :
!./darknet detector demo cfg/coco.data cfg/yolov4.cfg yolov4.weights -dont_show test.mp4 -i 0 -out_filename results.avi
Sometimes, there are multiple bounding boxes drawn on the same object. For example, in this image example_image I have two bounding boxes.
How can I display only one bounding box with the highest probability.
I tried implementing IOU but failed especially that darknet contains multiple files, I didn't know which one to modify. I tried modifying darknet_video.py but with no success.
PS : I tried changing the threshold but this problem persisits.
Does anyone have a solution for this problem.
Upvotes: 0
Views: 2815
Reputation: 101
Yes, it is normal. More accurately, YOLOv4 should give multiple bounding boxes per image as there multiple anchors and multi scales. For this YOLO uses Greedy-NMS(or hard-nms). It drops out boxes with less confidence and multiple boxes on one object as their IOU will be high. You should increase conf_treshold and iou_treshold, e.g. 0.5 by including the thresh flag in your command.
!./darknet detector demo cfg/coco.data cfg/yolov4.cfg yolov4.weights -dont_show test.mp4 -i 0 -out_filename results.avi -thresh 0.5
Upvotes: 2