Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiprocessing in darknet_video.py (NOT final!) #8567

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Better thread objects handling
  • Loading branch information
CristiFati committed Jul 7, 2022
commit b6b86c44376f3a2c8428b62ebb7b553c2c72a6e8
15 changes: 12 additions & 3 deletions darknet_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,15 @@ def drawing(raw_frame_queue, detections_queue, fps_queue):
video_width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
video_height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))

threading.Thread(target=video_capture, args=(raw_frame_queue, preprocessed_frame_queue)).start()
threading.Thread(target=inference, args=(preprocessed_frame_queue, detections_queue, fps_queue)).start()
threading.Thread(target=drawing, args=(raw_frame_queue, detections_queue, fps_queue)).start()
exec_units = (
threading.Thread(target=video_capture, args=(raw_frame_queue, preprocessed_frame_queue)),
threading.Thread(target=inference, args=(preprocessed_frame_queue, detections_queue, fps_queue)),
threading.Thread(target=drawing, args=(raw_frame_queue, detections_queue, fps_queue)),
)
for exec_unit in exec_units:
exec_unit.start()
for exec_unit in exec_units:
exec_unit.join()

print("\nDone.")