Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

Resolved Confused about input shape

Discussion in 'Barracuda' started by ADNCG, Apr 2, 2021.

  1. ADNCG

    ADNCG

    Joined:
    Jun 9, 2014
    Posts:
    877
    Hi all,

    I have a model that analyzes strokes data from users drawings. The input shape is formatted like the following [batchSize, numberOfPoints(varies between batches), 3] where the channels are the x and the y and a binary value that says wether or not the point is the last one in the stroke.

    In unity, the model says the expected input shape is [n:*, h:1, w:3, c:*] while the original keras model is expecting [*, *, 3]

    I'm having a hard time understanding how I should format my tensor.

    Any ideas?

    EDIT : Tried defining the keras input shape as [batchSize, numberOfPoints, 1, 3] and then squeezing it in the model to see if that'd help unity conversion process but it still expects [*, 1, 3, *], instead of [*, *, 1, 3]

    EDIT2 : If I try to feed the model inputs in the way it expects [batchSize(1), 1, 3, numberOfPoints], I get the error
    along with the warning
    EDIT3 : I tried permuting my datasets and then permuting inside the model back to the original shape, but the shape unity expects changed along with the permutation

    It's becoming clear that I will not make any progress without understanding more about barracuda's inner workings. Investigating... Will report if I make progress.

    EDIT4 [SOLVED] : Realized I misread the barracuda docs. When converting your model from keras to onnx, the following flag is mentioned in the docs :
    I read it as "none of the inputs should be transposed". I was able to get the proper input shape in unity after adding my input to the flag.
     
    Last edited: Apr 4, 2021
    amirebrahimi_unity likes this.
unityunity