Hello,
How can I create a custom NN model which can operate on the depth image as an input? More specifically, what types do I assign to the NN model (uint16 or float32 or float16) and how?
Here's where I got to:
I've created a basic neural network using onnx and converted it to blob. I used id on depth_node.disparity
and everything seemed to work as I expected. However when I pass the depth_node.depth
input to it I get incorrect data, which seems like it's trying to read an array of uint16's as an array of uint8's.
Here's how I try to pass it in:
depth = pipeline.create(dai.node.StereoDepth)
nn = pipeline.create(dai.node.NeuralNetwork)
nn.setBlobPath(...)
depth.depth.link(nn.input)
As a test I made a neural network that just copies the input and returns it. I printed the outputs of the NN and the depth image and go the following:
NN result: [122.0, 19.0, 122.0, 19.0, 122.0, 19.0, 122.0, 19.0, 122.0, 19.0, ...]
Depth image: [4986 4986 4986 4986 4986 4986 4986 4986 4986 4986, ....]
It seems that the network is being fed the the depth image as uint8's instead of unit16s: 4986 = 19 * 256 + 122.
How do I get the input correctly? Onnx supports uint16 as an input type, however when I tried it I wasn't able to convert the network to a blob using blobconverter.from_onnx
. The data_type of the method can only be FP32 or FP16. If I try U16 or UINT16 or UI16 it gives me this error: Unknown precisions specified: U16.
. If I try FP32 or FP16 and the onnx model has uint16 type then it throws a different error. If I try FP32 or FP16 on the onnx model the input doesn't get properly formatted.