Whenever I run a script Luxonis tries to download a blob file from somewhere. Now the device I have might not have Internet connection, is there a way to download the yolov8ncoco640352 blob file. Then I can mention the path of the file when I create the nn in oak.create_nn() method

jakaskerl I used the following settings to convert the yolov8n model, is it correct for the luxonis oak-d pro SOM,

Step 1 Select the versions:

Step2: Select the model and no. of shaves and convert

Hi @DarshitDesai
Should be ok. The shave count depends on your pipeline. DepthAI will notify you if a different shave count could benefit you.

Thanks,
Jaka

3 months later

@jakaskerl when I try to run this with my own model it throws this error

pi@luxonis:~/Roving-Comforter $ python3 testrun.py

Switch ON Detected

[2024-04-22 21:33:43] INFO [root.init:147] Setting IR laser dot projector brightness to 800mA

[2024-04-22 21:33:43] INFO [root.exit:408] Closing OAK camera

Traceback (most recent call last):

File "/home/pi/Roving-Comforter/testrun.py", line 132, in <module>

nn = oak.create_nn('/home/pi/Roving-Comforter/yolov8n_coco_640x352.blob', color, tracker=True, spatial=True)

File "/home/pi/.local/lib/python3.9/site-packages/depthai_sdk/oak_camera.py", line 253, in create_nn

comp = NNComponent(self._oak.device,

File "/home/pi/.local/lib/python3.9/site-packages/depthai_sdk/components/nn_component.py", line 215, in init

self._spatial.depth.link(self.node.inputDepth)

AttributeError: 'depthai.node.NeuralNetwork' object has no attribute 'inputDepth'

Sentry is attempting to send 2 pending error messages

Waiting up to 2 seconds

Press Ctrl-C to quit

Hi @DarshitDesai
For some reason the SDK forces NeuralNetwork node instead of yolo. I think you should be able to explicitly set the type when using create_nn.

Thanks,
Jaka

    jakaskerl So I would need to specify nn_type=yolo and in the documentation it says "on-device NN result decoding" What does that mean?

    Hi @DarshitDesai
    This means the pipeline will use YoloDetectionNetwork node for runnning the model. This means the results will automatically be decoded (yolo detections models are always decoded in a similar way) to output detections bbox, confidence, class, etc..

    Thanks,
    Jaka

      jakaskerl Actually specifying the nn_type doesn't work, here are screenshots and the code I wrote to include my model

      The first example here is when I include my json file and the oak downloads the model:

      		nn = oak.create_nn('/home/pi/.local/lib/python3.9/site-packages/depthai_sdk/nn_models/yolov8n_coco_640x352/config.json', color, tracker=True, spatial=True)

      See how the network is able to get the messages:

      This example below is when I included the line to include my blob file, I tried including both my own 5 shave compiled file and the one that was downloaded by the oak api (which was 6 shave by default), it printed nothing in the message:

      		#nn = oak.create_nn('/home/pi/Roving-Comforter/yolov8n_coco_640x352_openvino_2022.1_6shave.blob', color, nn_type='yolo', tracker=True, spatial=True)

      Here as you can see it prints an empty message and hence any code further than that isnt executed

        DarshitDesai
        Tested with stock yolov8n available through depthai repo and it works for me.
        Make sure to keep your model in depthai/depthai_sdk/src/depthai_sdk/nn_models/ since the library looks for it there. Make sure to add the .json as well, so sdk knows how to decode it.

        If you've correctly created your model (yolo based) this should work since the architecture is no different:

        from depthai_sdk import OakCamera
        
        with OakCamera() as oak:
            color = oak.create_camera('color')
            nn = oak.create_nn('yolov8n_coco_640x352', color, tracker=True, spatial=True)
            oak.visualize([nn, color], scale=2 / 3, fps=True)  # 1080P -> 720P
            # oak.show_graph()
            oak.start(blocking=True)

        This was tested on 1.12.1

        Thanks,
        Jaka