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
Disabled conversion to float of model's input #25555
Conversation
@@ -4116,7 +4116,7 @@ Mat readTensorFromONNX(const String& path) | |||
{ | |||
CV_Error(Error::StsUnsupportedFormat, cv::format("Failed to parse ONNX data: %s", path.c_str())); | |||
} | |||
Mat mat = getMatFromTensor(tensor_proto); | |||
Mat mat = getMatFromTensor(tensor_proto, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If conversion is set to off by default for all cases, why not just remove the conversion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getMatFromTensor is used in several places in onnx_importer.cpp and onnx_graph_simplifier.cpp. Removing the conversion breaks several tests.
CUDA failures:
|
f838f30
to
abbf87f
Compare
…s with uint8 to float input conversion, disabled test_mul_uint8 comformance test
@dkurt do you have any comments? |
@dkurt We need the patch merged to continue with boolean type support. Please provide comments after the PR merge, Alexander will fix remarks with the next PR. |
In dnn 4.x usually any model's input is converted to float32 or float16 (except quantized models). Also mean and scale can be applied. In current dnn 5.x there is the same conversion except int32 and int64 types. I removed this conversion.
Here is how the pipeline works now:
There was a conflict in protobuf parser between ONNX importer and tests. In ONNX importer any uint8 weight was handled as quantized weight and x = int8(x_uint8 - 128) conversion was used inside the protobuf parser. ONNX conformance tests used the same protobuf reader, so tests with uint8 inputs couldn't read the input values properly. I've made this conversion optional.
These ONNX conformance tests are enabled:
These tests were removed:
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.