AlexeyAB / darknet

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

darknet_video.py #8056

Open the-cat-crying opened 2 years ago

the-cat-crying commented 2 years ago
darknet_width = darknet.network_width(network)
darknet_height = darknet.network_height(network)
input_path = str2int(args.input)
cap = cv2.VideoCapture(input_path)
video_width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
video_height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
t1 = Thread(target=video_capture, args=(frame_queue, darknet_image_queue))
t2 = Thread(target=inference, args=(darknet_image_queue, detections_queue, fps_queue))
t3 = Thread(target=drawing, args=(frame_queue, detections_queue, fps_queue))

t1.start()
t2.start()
t3.start()

t1.join()
t2.join()
t3.join()

darknet_video.py Change to this

0_airplane: 99.84% 0_airplane: 99.86% 0_airplane: 99.86% 0_airplane: 99.87% 0_airplane: 99.87% 0_airplane: 99.87% 0_airplane: 99.87% 0_airplane: 99.87% Traceback (most recent call last): File "/home/gy/mount_sdc/work_zp/Train/darknet-210902/darknet_video.py", line 190, in t2.join() File "/home/gy/Applications/anaconda3/envs/pycharm/lib/python3.8/threading.py", line 1011, in join self._wait_for_tstate_lock() File "/home/gy/Applications/anaconda3/envs/pycharm/lib/python3.8/threading.py", line 1027, in _wait_for_tstate_lock elif lock.acquire(block, timeout): KeyboardInterrupt

darknet_video.py The thread cannot exit after running

haviduck commented 2 years ago

no idea where that code comes from, but think join waits for a graceful shutdown, and i dont see where that would apply in the code you shared. starting videocapture requires a bit more. check out the original darknet_video for some pointers