Skip to content

Added Clip layer to new DNN engine #27624

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

Merged
merged 1 commit into from
Aug 8, 2025

Conversation

abhishek-gola
Copy link
Contributor

Pull Request Readiness Checklist

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

  • I agree to contribute to the project under Apache 2 License.
  • 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
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@asmorkalov
Copy link
Contributor

We already have a patch for Clip layer: #27570 What it difference?

@abhishek-gola
Copy link
Contributor Author

abhishek-gola commented Aug 4, 2025

@asmorkalov

[ RUN      ] Test_ONNX_conformance.Layer_Test/test_clip_default_int8_max_OCV_OCL_FP16, where GetParam() = (test_clip_default_int8_max, OCV/OCL_FP16)
[ WARN:0@0.243] global net_impl_backend.cpp:229 setPreferableTarget Targets are not supported by the new graph engine for now
Exception during net.forward() call!
unknown file: Failure
C++ exception with description "OpenCV(5.0.0-pre) /media/abhishek/hugedrive1/opencv_abhishek/intern_PR_test/clip/opencv/modules/dnn/src/layer.cpp:274: error: (-2:Unspecified error) in function 'virtual void cv::dnn::dnn5_v20250619::Layer::getTypes(const std::vector<int>&, int, int, std::vector<int>&, std::vector<int>&) const'
> :
>     'input == CV_32F || input == CV_8S'
> where
>     'input' is 0 (CV_8UC1)
" thrown in the test body.
[  FAILED  ] Test_ONNX_conformance.Layer_Test/test_clip_default_int8_max_OCV_OCL_FP16, where GetParam() = (test_clip_default_int8_max, OCV/OCL_FP16) (1 ms)

The mentioned PR is lacking datatypes support other than CV_32F.

I didn't know clip layer related PR is already raised. If support for additional data types can be added to this PR #27570 and all ONNX tests pass, I’ll close my PR.

@asmorkalov
Copy link
Contributor

@nklskyoy FYI. I propose to push this implementation, if it has better coverage.

@asmorkalov asmorkalov added feature category: dnn category: dnn (onnx) ONNX suport issues in DNN module labels Aug 4, 2025
@asmorkalov asmorkalov merged commit 0559a76 into opencv:5.x Aug 8, 2025
68 of 101 checks passed
@asmorkalov asmorkalov mentioned this pull request Aug 8, 2025
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: dnn (onnx) ONNX suport issues in DNN module category: dnn feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants