• DepthAI-v2
  • No camera found on user-specified socket when using NN

Using a OAK PoE, I am getting an inconsistent behaviour between using a NN or not.

Without NN

The following code works (opens a window with the video feed):

from depthai_sdk import OakCamera

with OakCamera('192.168.2.33') as oak:
    color = oak.create_camera('color')

    oak.visualize(color)
    oak.start(blocking=True)

With NN

But this one does not (copied from the device-decoding example and simplified little bit):

with OakCamera('192.168.2.33') as oak:
    color = oak.create_camera('color')

    nn = oak.create_nn('best_nano.json', color, nn_type='yolo', spatial=True)
    oak.visualize(nn, fps=True, scale=2/3)

    oak.visualize(nn.out.passthrough, fps=True)
    oak.start(blocking=True)

I am getting this error:

[2023-09-29 15:11:25] INFO [root.close:456] Closing OAK camera
Traceback (most recent call last):
  File "/Users/x/Documents/depthai-experiments/gen2-yolo/device-decoding/main.py", line 12, in <module>
    nn = oak.create_nn('best_nano.json', color, nn_type='yolo', spatial=True)
  File "/Users/x/Library/Python/3.9/lib/python/site-packages/depthai_sdk/oak_camera.py", line 320, in create_nn
    spatial = self.stereo()
  File "/Users/x/Library/Python/3.9/lib/python/site-packages/depthai_sdk/oak_camera.py", line 353, in stereo
    left = self.camera(source="left", resolution=resolution, fps=fps)
  File "/Users/x/Library/Python/3.9/lib/python/site-packages/depthai_sdk/oak_camera.py", line 183, in camera
    comp = CameraComponent(self.device,
  File "/Users/x/Library/Python/3.9/lib/python/site-packages/depthai_sdk/components/camera_component.py", line 112, in __init__
    raise Exception(f"No camera found on user-specified socket {source}")
Exception: No camera found on user-specified socket CameraBoardSocket.???
Sentry is attempting to send 2 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit

Is this OAK POE, OAK-1 POE? I see that you are using a spatial flag when creating the neural network. This will use left and right cameras, which your device doesn't have. Just set the spatial to False and it should work, albeit without the spatial detection.

Thanks,
Jaka

Hi. Thanks for the quick reply.

I am using the OAK-1 PoE and as you guessed, toggling the spacial to False prevented the crash.

I am getting this output now and nothing happens. I let it run for at least 5 minutes just to make sure

➜  device-decoding git:(master) ✗ python3 main.py 
Downloading /Users/alain/.cache/blobconverter/best_nano_openvino_2022.1_6shave.blob...
[==================================================]
Done

I know the camera is working because it is still working with the simplified script above.

    Hi Alain
    Are you running this on the Apple silicone Mac? Try updating depthai to the latest version, I believe this issue was patched a week or two ago.

    Thanks,
    Jaka

    Yes, I am on a Macbook pro.

    pip list

    returns:

    depthai                    2.22.0.0
    depthai-pipeline-graph     0.0.5
    depthai-sdk                1.13.1

    which seems to be the latest, based on the result I am getting with

    pip install depthai --upgrade

    Hm, might be a different issue then. Did you check the code with a different model (eg. yolo-v3-tf). Maybe try visualizing just the color.out.main. There might be a problem with the model -- perhaps it's not detecting anything.

    Thanks,
    Jaka

    I will try to run the same code on a RasberryPi and a Linux box once I get to the office + running the visualization only on the color. Will report back on it. Thx.

    We tried with a Yolov6 model and it didnt work either. We couldnt try on the RaspPi for technical reasons.

    What did work was to use this code instead:

    with OakCamera() as oak:
        color = oak.create_camera('color', resolution='720p')
        yolo = oak.create_nn('best_nano.json', input=color)
    
        oak.visualize(yolo, fps=True)
        oak.start(blocking=True)

    As seen in the SDK doc here. So we will go from there.

    But going back to our original code sample with the debugger in DEBUG mode, we noticed the scripts goes thru all the lines and it just seem to stall at the last line oak.start(blocking=True). We saw the memory details of the camera, but the preview window never showed up.

      Hi Alain
      Thanks for the feedback. I'll check tomorrow if I can find a solution by running it locally.

        Hi jakaskerl
        Could you try installing the version from develop branch of depthai: https://github.com/luxonis/depthai/tree/develop
        Though, I was able to run the same code (with stock yolov6) and depthai_sdk 1.13.1 (main branch). I am running the scripts on M1 MBP.

        Not sure why it's not working for you, but the exact same was happening to me before we patched the main version (develop has been working for quite some time). Perhaps the python env is not the same when showing pip packages and when running the scripts.

        Thanks,
        Jaka