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

handle reading threaded frames from the Imagezmq #80

Open
mikahoy045 opened this issue Jan 5, 2023 · 1 comment
Open

handle reading threaded frames from the Imagezmq #80

mikahoy045 opened this issue Jan 5, 2023 · 1 comment

Comments

@mikahoy045
Copy link

Hi Jeff, I want to stream from camera to PC using imagezmq(camera stream to PC using normal open cv is okay). I plan to added custom yolov7 object detection. After digging the source it seems that yolov7 using loadstream function that runs the frames received using threads ( loadstream function line 266) that works basically like in here.

Is there any example codes or suggestion so that I can consume the imagezmq frame while keep the processing of the frame in threading (so that it still speeds up the fps even using CPU)?

@jeffbass
Copy link
Owner

I think you are asking about consuming the imageZMQ frames on the image receiving end (rather than threading the camera-image-sending end).

I use a receive frame loop in the main program with a thread to consume / process the frames in my imagehub repository.

The main program receiving frames in a forever loop is here.
The thread processing the frames is here at line 75. It is a simple process that writes the frames to disk, which is IO bound and makes if a good candidate for threading.

The frames are passed from the main image capture loop to the image thread using a deque from collections.deque. I use this because deque's are thread-safe. If you use some other way to pass frames from main to thread, you need to make sure your method is thread safe.

A thread to feed frames to a yolo7 consumer could work in the same way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants