• DepthAI-v2
  • Retrieve results for model inference with OakD-lite

Hi,
I am using a basic example from the DepthAI SKD. I am using a YOLO model that I made in Roboflow to perform inference with the OakD-Lite.
My question is, how to retrieve the output from the model? I would like to access the predicted label, confidence, and everything else. I have taken a look at packets but its very complex.
This is my code:

from depthai_sdk import OakCamera

with OakCamera() as oak:

color = oak.create_camera('color')

model_config = {

'source': 'roboflow', # Specify that we are downloading the model from Roboflow

'model':'my model',

'key': 'mykey'

}

nn = oak.create_nn(model_config, color)

#retrive here somehow the output from the inference

print(oak.device.getUsbSpeed())

oak.visualize(nn, fps=True)

oak.start(blocking=True)


Thanks in advance

jakaskerl
HI,
The turorials use an old documentation, I modified the example according to the new one and it should be:

from depthai_sdk import OakCamera

import cv2

from depthai_sdk.classes import DetectionPacket

with OakCamera() as oak:

color = oak.create_camera('color')

model_config = {

'source': 'roboflow', # Specify that we are downloading the model from Roboflow

'model':'bumpy-2/1',

'key': 'mykey'

}

nn = oak.create_nn(model_config, color)

print(oak.device.getUsbSpeed())

# Callback

def cb(packet: DetectionPacket):

print(packet.img_detections)

cv2.imshow(packet.name, packet.frame)

#print somehow the detected class and accuracy

oak.visualize(nn, fps=True, callback=cb)

oak.callback(nn.out.main, callback=cb, main_thread=True)

oak.start(blocking=True)

I am using a yolo model. Ans my question is still, where or in which packet do the predicted class and accuracy come in? Thanks in advance

    Danka def cb(packet: DetectionPacket):

    The detection packet should have a property called detections which should store the labels, confidence, class_id, etc..

    Thanks,
    Jaka