Hi I am having a little trouble getting the oak 1 camera working using yolo. I have just followed off the documentations but still can't seem to get it to work.
Here is where I am making the pipeline:
def create_yolo_pipeline():
# Create pipeline
pipeline = dai.Pipeline()
# Define sources and outputs
cam = pipeline.create(dai.node.ColorCamera)
nn = pipeline.create(dai.node.YoloDetectionNetwork)
xOut = pipeline.create(dai.node.XLinkOut)
nnOut = pipeline.create(dai.node.XLinkOut)
xOut.setStreamName("rgb")
nnOut.setStreamName("nn")
# Properties
cam.setPreviewSize(640,640)
cam.setResolution(dai.ColorCameraProperties.SensorResolution.THE_720_P)
cam.setInterleaved(False)
cam.setColorOrder(dai.ColorCameraProperties.ColorOrder.BGR)
cam.setFps(40)
# Netork settings
nn.setConfidenceThreshold(0.5)
nn.setNumClasses(80)
nn.setCoordinateSize(4)
nn.setAnchorMasks({
"side7": [6, 7, 8] # Anchors for detecting large objects
})
nn.setAnchors([
142, 110, 192, 243, 459, 401 # Anchors for side7 (large)
])
nn.setIouThreshold(0.5)
nn.setBlobPath(str(Path(config.cont_clss_blob).resolve().absolute()))
nn.setNumInferenceThreads(2)
nn.input.setBlocking(False)
# Linking the streams
cam.preview.link(nn.input)
cam.preview.link(xOut.input)
#nn.passthrough.link(xOut.input)
nn.out.link(nnOut.input)
return pipeline
And here us the loop I am running
with dai.Device(pipeline) as device:
q_rgb = device.getOutputQueue(name="rgb", maxSize=30, blocking=False)
q_nn = device.getOutputQueue(name="nn", maxSize=30, blocking=False)
# Preset
frame = None
detections = []
# While loop for stream
print("[INFO] Stream started")
while 1:
inRgb = q_rgb.tryGet()
inDet = q_nn.tryGet()
if inDet is not None:
detections = inDet.detections
if inRgb is not None:
print('here')
frame = inRgb.getCvFrame()
if frame is not None:
display("rgb", frame, detections)
if cv.waitKey(1) & 0xFF == ord('q'):
break
print("[INFO] Closing Stream")
cv.destroyAllWindows()
I always goes into the line "if inRGB is not None" about 4 times, no matter what I set the queue size to. I am not sure what I have done wrong
Any help would be great
Thanks