opencv/modules
alexlyulkov 9238eb2ab2
Merge pull request #25555 from alexlyulkov:al/int8-uint8-dnn-input
Disabled conversion to float of model's input #25555

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:
- if input Mat type is float32, the pipeline applies mean and scale and may convert it to float16.
- if input Mat type is not float32, the pipeline preserves the input type and doesn't apply mean and scale

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:
- test_add_uint8
- test_div_uint8
- test_mul_uint8
- test_sub_uint8
- test_max_int8
- test_max_uint8
- test_min_int8
- test_min_uint8
- test_mod_mixed_sign_int8
- test_mod_uint8

These tests were removed:
- Test_two_inputs.basic (when input is uint8)
- setInput.normalization (when input is uint8)

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2024-05-16 15:54:00 +03:00
..
3d Merge pull request #25428 from asmorkalov:as/win32_arm_ci_5.x 2024-04-22 15:56:08 +03:00
calib Merge branch 4.x 2024-04-16 17:28:18 +03:00
core Merge pull request #25487 from Abdurrahheem:ash/01D-additional-fixes 2024-05-15 10:50:03 +03:00
dnn Merge pull request #25555 from alexlyulkov:al/int8-uint8-dnn-input 2024-05-16 15:54:00 +03:00
features2d Merge branch 4.x 2024-04-22 11:08:39 +03:00
flann Merge pull request #25024 from vrabaud:neon 2024-02-20 11:29:23 +03:00
gapi Merge branch 4.x 2024-04-10 11:27:47 +03:00
highgui Merge branch 4.x 2024-04-22 11:08:39 +03:00
imgcodecs Merge branch 4.x 2024-04-22 11:08:39 +03:00
imgproc Merge branch 4.x 2024-04-22 11:08:39 +03:00
java Merge branch 4.x 2024-04-02 16:39:54 +03:00
js Merge pull request #25324 from kaingwade:clean_haarcascades_jsbindings 2024-04-27 14:37:40 +03:00
objc Merge branch 4.x 2024-01-19 17:32:22 +03:00
objdetect Merge branch 4.x 2024-04-16 17:28:18 +03:00
photo Merge branch 4.x 2024-04-22 11:08:39 +03:00
python Merge branch 4.x 2024-04-16 17:28:18 +03:00
stereo Merge pull request #25161 from mshabunin:doc-upgrade-5.x 2024-03-06 08:50:31 +03:00
stitching Merge pull request #25075 from mshabunin:cleanup-imgproc-1 2024-03-05 12:18:31 +03:00
ts Merge branch 4.x 2024-04-02 16:39:54 +03:00
video Merge pull request #25503 from WanliZhong:remove_goturn 2024-05-06 11:57:30 +03:00
videoio Merge branch 4.x 2024-04-22 11:08:39 +03:00
world cmake: use /INCREMENTAL:NO with MSVS 2015 2023-12-07 19:46:27 +00:00
CMakeLists.txt Merge pull request #25017 from kaingwade:ml_to_contrib 2024-02-27 15:54:08 +03:00