• Hardware
  • Lot of warning w/social distance example but oak w d pro cam

Hi there,

I'm running a py coded z years ago and based on social distancing code.

Seems to work very fine.

But I got a lot of warning on the console terminal.

I also noticed that the small gui viewer shows a not so wide area. So I guess this is because size/dimensions hard-coded in the code relates to a not wide cam and maybe a not pro one?

I'm afraid of these warnings crash the computer at some point. So I'd like to fix it, not just by… disabling warning logging of course.

The permanent messages are :

[184430108132890E00] [1.1] [1.858] [SpatialDetectionNetwork(1)] [warning] Neural network inference was performed on socket 'RGB', depth frame is aligned to socket 'RIGHT'. Bounding box mapping will not be correct, and will lead to erroneus spatial values. Align depth map to socket 'RGB' using 'setDepthAlign'.

I don't think you are going to get much help without at least telling people what code you are trying to run.

    vital This is this one: https://github.com/OAKChina/depthai-examples/blob/master/social-distancing/README.md

    Basically, I "just" added routines for sending the mean of all distances over osc over udp.

    Removing this specific custom part gives same results.

    I think this is related to the fact this code is not for OAK D Pro W.

    The part of the code I was looking at, in depthai_utils.py is in the class DeptAI 🇦

    def create_pipeline(self, model_name):

    log.info("Creating DepthAI pipeline...")

    pipeline = dai.Pipeline()

    #pipeline.setOpenVINOVersion(dai.OpenVINO.Version.VERSION_2021_2)

    # Define sources and outputs

    camRgb = pipeline.createColorCamera()

    spatialDetectionNetwork = pipeline.createMobileNetSpatialDetectionNetwork()

    monoLeft = pipeline.createMonoCamera()

    monoRight = pipeline.createMonoCamera()

    stereo = pipeline.createStereoDepth()

    xoutRgb = pipeline.createXLinkOut()

    camRgb.preview.link(xoutRgb.input)

    xoutNN = pipeline.createXLinkOut()

    xoutRgb.setStreamName("rgb")

    xoutNN.setStreamName("detections")

    # Properties

    camRgb.setPreviewSize(544, 320)

    camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)

    camRgb.setInterleaved(False)

    camRgb.setColorOrder(dai.ColorCameraProperties.ColorOrder.BGR)

    monoLeft.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)

    monoLeft.setBoardSocket(dai.CameraBoardSocket.LEFT)

    monoRight.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)

    monoRight.setBoardSocket(dai.CameraBoardSocket.RIGHT)

    # Setting node configs

    stereo.setConfidenceThreshold(255)

    spatialDetectionNetwork.setBlobPath(blobconverter.from_zoo(name=model_name, shaves=6))

    spatialDetectionNetwork.setConfidenceThreshold(0.5)

    spatialDetectionNetwork.input.setBlocking(False)

    spatialDetectionNetwork.setBoundingBoxScaleFactor(0.5)

    spatialDetectionNetwork.setDepthLowerThreshold(100)

    spatialDetectionNetwork.setDepthUpperThreshold(5000)

    # Linking

    monoLeft.out.link(stereo.left)

    monoRight.out.link(stereo.right)

    camRgb.preview.link(spatialDetectionNetwork.input)

    spatialDetectionNetwork.out.link(xoutNN.input)

    stereo.depth.link(spatialDetectionNetwork.inputDepth)

    log.info("Pipeline created.")

    return pipeline

    I guess I have something to do there. But maybe not.

    The code was perfectly working with a OAK-D cam (no warning or error), but it gives what I described with OAK-D Pro W

    Warning advising : "Align depth map to socket 'RGB' using 'setDepthAlign'."

    But I don't know how to do that.

    julienbayle
    See line 74;

    stereo.setDepthAlign(dai.CameraBoardSocket.RGB)

    This will align depth from RIGHT to RGB, which should resolve the warnings you are seeing.