• DepthAI-v2
  • How to discover inputs and outputs names in a custom NN model

Hi @erik

I have a custom NN model with multiple inputs. I use "try-and-error" to find out the input names are 'left' and 'right' as below:

manipLeft.out.link(nn.inputs['left'])
manipRight.out.link(nn.inputs['right'])

I wonder if there is a better way to find them such as nn.inputs.getNames() or other way? Likewise, for outputs, is there a similar way to get their names? Thank you very much for your help.

  • erik replied to this.

    Hi erik

    Very nice! It works!

    Question related to vec.dims: I run my model and got the following names and dimensions:

    Inputs
    Name: right, Type: DataType.FP16, Shape: [160, 120, 3, 1]
    Name: left, Type: DataType.FP16, Shape: [160, 120, 3, 1]
    Outputs
    Name: output, Type: DataType.FP16, Shape: [160, 120, 2, 1]

    It looks like the shape is [WHCN] and not [NCHW]. Is this because my model or the vec.dims uses different convention to report [NCHW]?

    The reason I ask this question is because in my pipeline:

    #only show left input to nn for brevity
    manipLeft = pipeline.create(dai.node.ImageManip)
    manipLeft.initialConfig.setResize(160,120)
    manipLeft.initialConfig.setFrameType(dai.RawImgFrame.Type.RGB888p)
    manipLeft.out.link(nn.inputs['left'])

    Would manipLeft.out as [3,120,160] or [160,120,3]? and would this pipeline automatically add the extra dimension as [160,120,3,1] before feed in the nn? or I need to manually "unsqueeze" it? and how? And it seems the nn looking for FP16 as input, should I use:

    manipLeft.initialConfig.setFrameType(dai.RawImgFrame.Type.RGBF16F16F16p)

    instead? (I did try, but it failed to connect ; (

    Please advise. Thanks a lot for your help again.

    • erik replied to this.

      Hi ynjiun ,
      Sorry I have just updated the script so it will also print the order. I believe your model is in the correct model, so it needs planar input (camRgb.setInterleaved(False)). And usually your model will require bgr not FP16, you can convert that with compile_tool, some additional info here (plus the Myriad X compile parameters paragraph). I hope this helps!
      Thanks, Erik