mirror of
https://github.com/opencv/opencv.git
synced 2026-12-02 13:16:32 -06:00
81cf43c1d8bc06e7fdf1e37a6552db76c1549ead
* dnn: handle min > max in Clip layer and enable ONNX conformance test Under the ONNX specification, the Clip operator is defined mathematically as y = min(max(x, min), max). When min > max, the operation clamps identically to max for all input values. Previously, ClipLayerImpl asserted minValue <= maxValue in its constructor and actualMin <= actualMax in forward, causing assertion failures on valid ONNX models with min > max. Additionally, the adjacency graph fusion interpreter checked a < min first, returning min instead of max. This commit: 1. Removes the min <= max assertions in ClipLayerImpl constructor and forward, allowing ONNX-conforming evaluation where min > max clamps to max. 2. Updates FusionEltwiseOp::CLAMP in AdjacencyGraph interpreter to use std::min(std::max(a, n.scalar), n.scalar2), matching the ONNX evaluation order. 3. Removes test_clip_min_greater_than_max from the layer parser denylist. 4. Adds unit tests covering static and dynamic min > max clipping. * dnn: filter test_clip_min_greater_than_max for OpenVINO backend * dnn(test): address review comments on Clip min > max tests and fusion coverage
OpenCV: Open Source Computer Vision Library
Resources
- Homepage: https://opencv.org
- Courses: https://opencv.org/courses
- Docs: https://docs.opencv.org/5.x/
- Q&A forum: https://forum.opencv.org
- previous forum (read only): http://answers.opencv.org
- Issue tracking: https://github.com/opencv/opencv/issues
- Additional OpenCV functionality: https://github.com/opencv/opencv_contrib
- Donate to OpenCV: https://opencv.org/support/
Contributing
Please read the contribution guidelines before starting work on a pull request.
Summary of the guidelines:
- One pull request per issue;
- Choose the right base branch;
- Include tests and documentation;
- Clean up "oops" commits before submitting;
- Follow the coding style guide.
Additional Resources
- Submit your OpenCV-based project for inclusion in Community Friday on opencv.org
- Subscribe to the OpenCV YouTube Channel featuring OpenCV Live, an hour-long streaming show
- Follow OpenCV on LinkedIn for daily posts showing the state-of-the-art in computer vision & AI
- Apply to be an OpenCV Volunteer to help organize events and online campaigns as well as amplify them
- Follow OpenCV on Mastodon in the Fediverse
- Follow OpenCV on X
- OpenCV.ai: Computer Vision and AI development services from the OpenCV team.
Description
Languages
C++
87.7%
C
3.1%
Python
2.9%
CMake
2%
Java
1.5%
Other
2.6%