-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
Updated TopK Handling in ONNX Importer #27063
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
Conversation
@asmorkalov Sir, can you please assign me some issue? It would be really helpful. |
Related fix for 5.x and dynamic shapes support: #26731 |
@asmorkalov Sir, how to fix this error? |
I converted our top_k.onnx model to oppset 11 to get the layer with two inputs and get the following error for the patch:
|
Conversion script: import sys
|
It is not possible to fix this issue in 4.x as 4.x does not support dynamic input shape. You need to do it in 5.x along with corresponding changes in |
Fixed the issue with the ONNX TopK operator in OpenCV.
The TopK operator needs a value k to work. Before, OpenCV expected k to always be set as a constant value.
If k was provided as an input (instead of a constant), OpenCV would fail with an error saying k was missing.
The fix allows OpenCV to read k from the input if it’s available.
If k is still missing after checking the inputs, OpenCV will now give a clear error message.