Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Image size ONNX conversion #2091

Open
YCAyca opened this issue Oct 26, 2024 · 0 comments
Open

Dynamic Image size ONNX conversion #2091

YCAyca opened this issue Oct 26, 2024 · 0 comments

Comments

@YCAyca
Copy link

YCAyca commented Oct 26, 2024

Hello, I am converting my model to onnx using
python export.py --weights runs/train/haribo_v32/weights/best.pt --img-size 416 416 --grid --dynamic
code and then I get the output layer names as output_names ['output', '540', '562'] where predictions=model_output[0] which refers to the "output" layer gives me predictions shape (3, 52, 40, 124) which I see in neutron.app a shape of float32[batch,3,y,x,124]. I understand the batch=1, and I reshape this output to predictions = predictions.reshape(-1, 124)

Then I process the output as well as I was doing for static onnx converted model.
obj_conf = predictions[:, 4]
scores = np.max(predictions[:, 5:], axis=1)
boxes=predictions[:, :4]

But when I print, I see that the boxes are wrong:

static onnx model boxes: (one box example)
[ 45.47592, 239.41583, 86.19278, 290.94891]
dynamic onnx model boxes: (one box example)
[ -0.55995 -0.72869 2.397 2.0979]

therefore when I rescale and draw the boxes, they are not correctly places since before rescaling coordinates are already wrong. What should I do? Anyone has any idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant