Search Unity

Question Odd Input Shape for ONNX model

Discussion in 'Barracuda' started by altonAtMedivis, Oct 10, 2022.

  1. altonAtMedivis

    altonAtMedivis

    Joined:
    Aug 23, 2022
    Posts:
    1
    I'm using Barracuda to use a pretrained tensorflow model that was trained in a python notebook. In the python notebook the shape of the input is (None, 512, 512, 1), which is in NHWC format and None is an arbitrary batch size. I'm saving the model using tensorflow's save method and exporting it to an onnx format using tf2onnx. Then when I open the model in Unity the input shape is (0, 512, 1, 512).

    It is my understanding that the input shape should either be (0, 512, 512, 1) or (0, 1, 512, 512) depending on whether it's in NHWC or NCHW format, so I'm not sure why it's ending up with the channel between height and weight. The model is also not behaving as expected, so I figured the issue could have something to do with the change in input format.

    Versions of everything are as follows:
    tensorflow 2.9.1
    tf2onnx 1.12.1
    Unity 2019.3.12f1
    Barracuda 1.0.4
     
    mailuong123123 likes this.
  2. mailuong123123

    mailuong123123

    Joined:
    Sep 6, 2022
    Posts:
    1
    ok, thankyou