3

Trying to do inference with Onnx and getting the following:

The model expects input shape:  ['unk__215', 180, 180, 3]
The shape of the Image is:  (1, 180, 180, 3)

The code I'm running is:

import onnxruntime as nxrun
import numpy as np
from skimage.transform import resize
from skimage import io


img = io.imread("test2.jpg")
img = np.rollaxis(img, 2, 0) 
img224 = resize(img / 255, (180,180,3), anti_aliasing=True)
ximg = img224[np.newaxis, :, :, :]
ximg = ximg.astype(np.float32)

# ximg = np.random.rand(1, 3, 224, 224).astype(np.float32)
sess = nxrun.InferenceSession("model.onnx")

print("The model expects input shape: ", sess.get_inputs()[0].shape)
print("The shape of the Image is: ", ximg.shape)

input_name = sess.get_inputs()[0].name
label_name = sess.get_outputs()[0].name
result = sess.run(None, {input_name: ximg})
prob = result[0]
print(prob.ravel()[:10])

What is the meaning of unk_215 and why would there be a disparity in input shapes?

NominalSystems
  • 175
  • 1
  • 4
  • 13

0 Answers0