Hi, I am working with oak-ffc-4p. When I execute the following program, it does not reach the script node and the device just closes.
from pathlib import Path
import cv2
import depthai as dai
import numpy as np
import time
picWidth = 1280
picHeight = 800
yolo_v5_path = str((Path(file).parent / Path('/Users/annikaschmidt/Documents/vsCode/yolo7_20epoch_openvino_2022.1_6shave.blob')).resolve().absolute())
GPIO = dai.BoardConfig.GPIO
uartNum = 0
uarts = {
0: {
'txPin' : 15,
'rxPin' : 16,
'txPinMode' : GPIO.ALT_MODE_2,
'rxPinMode' : GPIO.ALT_MODE_2,
}
}
pipeline = dai.Pipeline()
def cam(p, socket):
colorCam = p.createColorCamera()
colorCam.setBoardSocket(socket)
colorCam.setPreviewSize(picWidth, picHeight)
colorCam.setInterleaved(False)
colorCam.setFps(9)
colorCam.setResolution(dai.ColorCameraProperties.SensorResolution.THE_800_P)
colorCam.initialControl.setManualFocus(255)
manip = pipeline.create(dai.node.ImageManip)
manip.initialConfig.setResizeThumbnail(416,416,0,0,0)
colorCam.preview.link(manip.inputImage)
return manip.out
detectionNetwork = pipeline.createYoloDetectionNetwork()
detectionNetwork.setConfidenceThreshold(0.5) v
detectionNetwork.setIouThreshold(0.5)
detectionNetwork.setNumClasses(3)
detectionNetwork.setCoordinateSize(4)
anchors = np.array([10, 13, 16, 30, 33, 23, 30, 61, 62, 45, 59, 119, 116, 90, 156, 198, 373, 326])
detectionNetwork.setAnchors(anchors)
anchorMasks52 = np.array([0, 1, 2])
anchorMasks26 = np.array([3, 4, 5])
anchorMasks13 = np.array([6, 7, 8])
anchorMasks = {
"side52": anchorMasks52,
"side26": anchorMasks26,
"side13": anchorMasks13
}
detectionNetwork.setAnchorMasks(anchorMasks)
detectionNetwork.setBlobPath(yolo_v5_path)
detectionNetwork.setNumNCEPerInferenceThread(1)
detectionNetwork.setNumInferenceThreads(2)
detectionNetwork.input.setBlocking(False)
pyserial = """
node.io['detections'].get()
node.warn("hello")
"""
script = pipeline.create(dai.node.Script)
script.setProcessor(dai.ProcessorType.LEON_CSS)
script.setScript(pyserial)
cam(pipeline, dai.CameraBoardSocket.CAM_A).link(detectionNetwork.input)
cam(pipeline, dai.CameraBoardSocket.CAM_B).link(detectionNetwork.input)
detectionNetwork.out.link(script.inputs["detections"])
config = dai.Device.Config()
config.board.gpio[uarts[uartNum]['txPin']] = GPIO(GPIO.OUTPUT, uarts[uartNum]['txPinMode'])
config.board.gpio[uarts[uartNum]['rxPin']] = GPIO(GPIO.INPUT, uarts[uartNum]['rxPinMode'])
config.board.uart[uartNum] = dai.BoardConfig.UART()
config.version = config.version.VERSION_2021_4
with dai.Device(config) as device:
device.startPipeline(pipeline)
while not device.isClosed():
time.sleep(1)
This behavior seems to be caused by this line detectionNetwork.out.link(script.inputs["detections“]). Do you know what the issue could be?
Thank you for your help