YvanYin / Metric3D

The repo for "Metric3D: Towards Zero-shot Metric 3D Prediction from A Single Image" and "Metric3Dv2: A Versatile Monocular Geometric Foundation Model..."
https://jugghm.github.io/Metric3Dv2/
BSD 2-Clause "Simplified" License
1.3k stars 94 forks source link

Expected onnx model input mismatch with name in test_onnx.py #143

Open norbertlink opened 1 month ago

norbertlink commented 1 month ago

When trying test_onnx.py with the model from https://huggingface.co/onnx-community/metric3d-vit-large I got the following error: ValueError: Required inputs (['pixel_values']) are missing from input feed (['image']) due to mismatch between the onnx_input dictionary used in the script and the input dictionary expected by the model. Changing the key name from "image" to "pixel_values" in the code below will solve the issue. onnx_input = { "image": np.ascontiguousarray( np.transpose(rgb, (2, 0, 1))[None], dtype=np.float32 ), # 1, 3, H, W } to onnx_input = { "pixel_values": np.ascontiguousarray( np.transpose(rgb, (2, 0, 1))[None], dtype=np.float32 ), # 1, 3, H, W }

JUGGHM commented 4 weeks ago

Thanks for your sincere report and I will update this in ReadMe.