Hi I am having a little trouble trying to run YoloDetectionNetwork. When I was running this code on a NeuralNetwork, it worked fine, but there is something wrong with how I am setting it up for the Yolo model.
This is how I am setting up my pipeline
$$
def create_pipeline_camera():
print('[INFO] Pipeline started')
pipeline = dai.Pipeline()
#Configuring the classifier
print("[INFO] Initialising detector")
detector = pipeline.create(dai.node.YoloDetectionNetwork)
detector.setBlobPath(
str(Path(config.cont_clss_blob).resolve().absolute())
)
detector.setConfidenceThreshold(0.5)
detector.setNumClasses(2)
detector.setCoordinateSize(4)
detector.setIouThreshold(0.5)
detector.input.setBlocking(False)
detector.setAnchorMasks({
"side7": [6, 7, 8] # Anchors for detecting large objects
})
detector.setAnchors([
142, 110, 192, 243, 459, 401 # Anchors for side7 (large)
])
print("[INFO] Camera created")
#Creating the colour camera
cam = pipeline.create(dai.node.ColorCamera)
cam.setPreviewSize(config.cam_dim)
cam.setInterleaved(False)
cam.setResolution(
dai.ColorCameraProperties.SensorResolution.THE_1080_P
)
cam.setBoardSocket(dai.CameraBoardSocket.RGB)
cam.setColorOrder(dai.ColorCameraProperties.ColorOrder.RGB)
# Creating and linking the XLinkout node for display and linking to camera
cam_xout = pipeline.create(dai.node.XLinkOut)
cam_xout.setStreamName('rgb')
cam.preview.link(cam_xout.input)
# Resizing the camera frames to expected inputs
print("[INFO] Creating Image Manipulator")
manip = pipeline.create(dai.node.ImageManip)
manip.initialConfig.setResize(config.img_dims)
manip.setMaxOutputFrameSize(1244160)
cam.preview.link(manip.inputImage)
manip.out.link(detector.input)
#Configuring the output for depth ai pipeline
xout_nn = pipeline.create(dai.node.XLinkOut)
xout_nn.setStreamName("nn")
detector.out.link(xout_nn.input)
return pipeline
$$
And this is my main running loop
$$
#Setting up the pipeline
print("[INFO] Creating pipeline...")
pipeline = utils.create_pipeline_camera()
frame = None
fps = FPS().start()
def stream():
Setting up the device
with dai.Device(pipeline) as device:
q_rgb = device.getOutputQueue(name='rgb', maxSize=1, blocking=False)
q_nn = device.getOutputQueue(name='nn', maxSize=1, blocking=False)
# While loop for stream
print("[INFO] Stream started")
while 1:
# Fetch the frame from queue
ret, frame = get_frame(q_rgb)
if not ret:
print("[INFO] Could not return stream")
break
# Fetch the object from the detector queue
#frame = detector(frame, q_nn)
# Display the image
fps.update()
cv.imshow("rgb",frame)
if cv.waitKey(1) & 0xFF == ord('q'):
break
print("[INFO] Closing Stream")
fps.stop()
cv.destroyAllWindows()
def get_frame(q_rgb):
#Fetchs the frame from oak and returns the frame
new_frame = q_rgb.get().getCvFrame()
return True, new_frame
$$
So It is getting stuck on qrgb. It runs a few loops then gets struck on q_rgb.get(), and I am not sure why. Any help would be awesome
Thanks