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 input shape #12

Closed
emanef13 opened this issue Mar 16, 2022 · 2 comments
Closed

Dynamic input shape #12

emanef13 opened this issue Mar 16, 2022 · 2 comments

Comments

@emanef13
Copy link

There seem to be an issue handling an input other than 640x640. When I try to feed a 320x1296 input it throws an error:
Got invalid dimensions for input: images for the following indices index: 2 Got: 1296 Expected: 640 index: 3 Got: 320 Expected: 640

I think it has to do with the dynamic input shape checking of the code, which I think it is not doing its job correctly.
Can someone point me where should I look at, to make it able to excecute multiple input shape images?
Thanks!

@emanef13
Copy link
Author

emanef13 commented Mar 16, 2022

Issue solved.
I had to export the model again through ultralitics with the --dynamic option.

@itsnine
Copy link
Owner

itsnine commented Mar 16, 2022

@emanef13 I'm glad you found the solution, also it has to print about dynamic shape in the terminal if it is detected in the onnx model, here is the code doing that

if (inputTensorShape[2] == -1 && inputTensorShape[3] == -1)
{
std::cout << "Dynamic input shape" << std::endl;
this->isDynamicInputShape = true;
}

@itsnine itsnine closed this as completed Mar 16, 2022
@itsnine itsnine reopened this Mar 16, 2022
@itsnine itsnine closed this as completed Mar 17, 2022
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

2 participants