Hello, i am working on a code that gets the depth of an object. im using mobilenet-ssd.blob as the neural network. i want the size to be 640x400, however when i run it with that configuration i get this warning:

[warning] Input image (640x400) does not match NN (300x300)

how can i resize the NN to match the 640x400? i have tried with:

spatialDetectionNetwork.initialConfig.setResize(640, 400)

but its not working

this is the part of the code with the configuration i have:

imageManip.initialConfig.setResize(640, 400)

imageManip.initialConfig.setFrameType(dai.ImgFrame.Type.BGR888p)

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

monoLeft.setCamera("left")

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

monoRight.setCamera("right")

stereo.setDefaultProfilePreset(dai.node.StereoDepth.PresetMode.HIGH_DENSITY)

stereo.setSubpixel(True)

camera_resolution = monoLeft.getResolution()

spatialDetectionNetwork.setConfidenceThreshold(0.5)

spatialDetectionNetwork.setBlobPath(nnPath)

spatialDetectionNetwork.input.setBlocking(False)

spatialDetectionNetwork.setBoundingBoxScaleFactor(0.5)

spatialDetectionNetwork.setDepthLowerThreshold(100)

spatialDetectionNetwork.setDepthUpperThreshold(5000)

monoLeft.out.link(stereo.left)

monoRight.out.link(stereo.right)

imageManip.out.link(spatialDetectionNetwork.input)

thanks!!

Hi @anapaulaSb
The NN input shape depends on the model. Unless you change the model itself, this size is unchangeable.

  • You can downscale your camera ouput to from 640x400 to 300x300 using something like setPreviewSize() or an ImageManip node.
  • Choose a different model that has 640x400 input shape and convert it to .blob.

Thanks,
Jaka