Open aditya-AI opened 3 years ago
What I understood from this error is that since we have 3 threads running, as soon as the VideoCapture reads all the frames it calls cap.release() because of which the drawing function exits from the while loop. The code is stuck in the inference function at detections_queue.put(detections) it is not able to put more detections since queue size is 1 and the drawing function was not able to execute detections = detections_queue.get(). Hence, the detections_queue is not empty and apparently, the inference function keeps waiting for this queue to get empty.
I have noticed this would cause some frames lost in the final output video.
I have added few flags to take care of this issue such that the drawing function exits while loop only when the inference function is finished.
How did you solve the issue? Could you provide the code that has been fixed?
Hi @AlexeyAB kindly help.
When I run the
darknet_video.py
aspython darknet_video.py --input /darknet/Sample.mp4 --weights yolov1.weights --config_file cfg/yolov1/yolo.cfg --data_file ./cfg/voc.data --dont_show --out_filename res.mp4
the script keeps running.Please find attached the screenshots:
The below screenshot shows the output when I hit ctrl+c:
What I understood from this error is that since we have 3 threads running, as soon as the VideoCapture reads all the frames it calls
cap.release()
because of which the drawing function exits from the while loop. The code is stuck in the inference function at detections_queue.put(detections) it is not able to put more detections since queue size is 1 and the drawing function was not able to execute detections = detections_queue.get(). Hence, the detections_queue is not empty and apparently, the inference function keeps waiting for this queue to get empty.I have added few flags to take care of this issue such that the drawing function exits while loop only when the inference function is finished.
There needs to be some mechanism to create a sync between all three threads.