-
Notifications
You must be signed in to change notification settings - Fork 233
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
Stuck in "with dai.Device(self.pipeline) as device:" when using multiprocessing #697
Comments
Will need @Erol444 help here. |
First thing that comes to mind is that both processes started by the |
Hello @themarpe |
I have also tried only running the process with the oak camera, but with no luck |
Additional update: |
@Embeddediot Make sure you are using the latest depthai library, >=2.15 introduced some fixes WRT requiring to power cycle the device |
Yes of course, this is the log when i try to run both cameras so the program wont end but just stop after 50 pictures from the genicam. As far as i can see there are no obvious errors in the log Thank you for your time it is much appreciated. |
Hello, Wondering it anyone has a fix for this yet? I'm running into the same issue right now. |
Hi @spgt902 , are you running multi-cam setup? If that's the case, you would likely need a ~1 sec delay between initializing cameras, otherwise xlink could crash. |
Hi @Erol444 I'm only using one camera but I want to run it in a different process separate from another process and only send measured data from the camera to the other process. Attached is the device before making the connection but at "with dai.Device(pipeline) as device; --> it gives the error |
Hi @spgt902 , you can only run one pipeline on the device - so you can't connect to it twice. I would suggest adding the measurement data to the original pipeline. |
Gotcha, thank you. |
Is there a resolution for this issue ? I cannot run the pipeline in the main thread and it has to run in separate process. The module we have build is working fine for several camera devices such as RTSP cam, webcam, picam etc. However when we try to add oak-cam as a separate process it gets stuck here.
Unfortunately our code has several other downstream process which are all running in a different process and will be difficult to change at this moment. Happy to provide more information if needed. |
@alexovai how about just connecting to the device in main thread, then using separate process for getting messages (via callbacks/queues) from the device - would that work? |
Yes, that is what we are thinking as a workaround now. Although the design pattern have to change for oak vs other camera we might go with it if that is the only alternative. My concern is that in python thread is still under GIL and runs on the same core as the main thread. We wanted camera to have a separate core hence multiprocessing. Out of curiosity why is there such limitation ? This is for my understanding purposes. |
@alexovai it's a known issue, I believe it has something to do with XLink limitation, but my understanding is not deep enough to know the actual culprit. |
@alexovai current workaround is using subprocess & spinning up new interpreter. Reason for limitation is that some shared library things are shared and remain "intiailized" while the new multiprocess spinoff, isn't aware of it, causing it to get stuck there. - more details to be ironed out later |
Hi everyone! I found that importing depthai inside of the function that is going to be used to create the xlinks solved the problem for me! (I've only worked with the one oak d camera at a time though) So in this instance I'd be running
|
Hello
I have been trying to implement multiprocessing in order to receive images from a OAK-D camera and a genicam simultaneously. My program is however not able to run the line "with dai.Device(self.pipeline) as device:" that i have from the rgb_preview example. The program runs fine when the oak camera is run on the main thread, and works fine when multithreading is implemented.
The real mysterious part is that multiprocessing works fine when used in the debugger.
Have you experiences anything similar or been able to use multiprocessing with the depthai sdk?
Best Regarads
The main module
The oak.py module:
The text was updated successfully, but these errors were encountered: