You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used the following command to convert my detectron2 model to onnx (I replaced the path names, but they are correct when I run the command): python "...\export_model.py" --sample-image "...\00D61B56-086-nc-T_i.pgm" --config-file "...\config.yaml" --export-method tracing --format onnx --output "...\export_model_test_NC_v1" MODEL.WEIGHTS "...\model_final.pth"
For some reason the only way I can get this python code to work is to use those dimensions. I didn't set those anywhere. What is going on? It then results in the following output: [array([], shape=(0, 4), dtype=float32), array([], dtype=int64), array([], shape=(0, 1, 28, 28), dtype=float32), array([], dtype=float32), array([1333, 332], dtype=int64)]
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I used the following command to convert my detectron2 model to onnx (I replaced the path names, but they are correct when I run the command):
python "...\export_model.py" --sample-image "...\00D61B56-086-nc-T_i.pgm" --config-file "...\config.yaml" --export-method tracing --format onnx --output "...\export_model_test_NC_v1" MODEL.WEIGHTS "...\model_final.pth"
This creates the onnx model No problems yet.
I then run the following python code:
`
Load your ONNX model globally on server start
model_path = r'...\model.onnx'
ort_session = ort.InferenceSession(model_path)
Create a dummy input tensor
dummy_input = torch.randn(3, 1333, 332) <---- THIS IS MY ISSUE
Load the ONNX model
ort_session = ort.InferenceSession(model_path)
Run inference
outputs = ort_session.run(None, {"x.1": dummy_input.numpy()})
Print the outputs
print(outputs)
`
For some reason the only way I can get this python code to work is to use those dimensions. I didn't set those anywhere. What is going on? It then results in the following output:
[array([], shape=(0, 4), dtype=float32), array([], dtype=int64), array([], shape=(0, 1, 28, 28), dtype=float32), array([], dtype=float32), array([1333, 332], dtype=int64)]
Beta Was this translation helpful? Give feedback.
All reactions