AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.58k stars 7.95k forks source link

Urgent: Bounding Boxes are offset by 1 frame! #6780

Open srishkee opened 3 years ago

srishkee commented 3 years ago
./darknet detector test cfg/coco.data cfg/yolov4.cfg yolov4.weights data/dog.jpg
 CUDA-version: 10000 (10000), cuDNN: 7.4.2, CUDNN_HALF=1, GPU count: 1
 CUDNN_HALF=1
 OpenCV version: 4.2.0
 0 : compute_capability = 750, cudnn_half = 1, GPU: GeForce RTX 2070
net.optimized_memory = 0
mini_batch = 1, batch = 8, time_steps = 1, train = 0
   layer   filters  size/strd(dil)      input                output

Description: I was testing the Yolov4 model on a video and discovered a bug. The bounding boxes are offset from the images by 1 frame. The video I am testing on has a very slow fps (~1 FPS) so it is very noticeable.

Command: ./darknet detector demo cfg/coco.data cfg/yolov4.cfg yolov4.weights test.mp4 -out_filename res.avi (Just the regular command to test the pretrained network on a video.)

Platform: Linux

Cases: This bug occurs in all cases. I suspect it was not discovered earlier because most videos use a much higher FPS.

What I have tried: Tinkering with demo.c. But the code is highly interwoven with threads, and it is not clear what is causing the issue.

@AlexeyAB If you are unable to commit the change, please tell me know how to modify the code so I can fix this. Thank you in advance.

srishkee commented 3 years ago

One possible workaround for anyone experiencing this issue: Convert the Yolo model to Tensorflow using this Github https://github.com/hunglc007/tensorflow-yolov4-tflite and use their scripts for image/video inference. Bounding boxes are displayed correctly.