Is there a way to reorder the shape of the tensor? Here’s a code sandbox, its in predictWebcam function
I’m getting this error:
Uncaught Error: The shape of dict[‘images’] provided in model.execute(dict) must be [1,3,640,640], but was [1,640,640,3]
Thank you, greatly appreciate the help!
Hi @Bass_Guitarist ,
Could you please try below code and see if it works.
You can use the
To use the
tf.transpose() function, you need to pass in a list of integers that represent the new order of the dimensions. For example, to reorder the dimensions of the tensor from
[1,3,640,640], you would pass in the list
# Reorder the shape of the tensor to match the model's input shape.
image = tf.transpose(image, [0, 3, 1, 2])
For more detailes refer this TensorFlow Documentation.
I hope this will help you!
Thanks Laxma_Reddy_Patlolla. That worked. I used tf.transpose(tensorShape.expandDims(), [0, 3, 1, 2]);