Skip to content

[BugFix] dnn (ONNX): Foce dropping constant inputs in parseClip if they are shared#25319

Merged
asmorkalov merged 2 commits intoopencv:4.xfrom
fengyuentau:gold_yolo
Apr 3, 2024
Merged

[BugFix] dnn (ONNX): Foce dropping constant inputs in parseClip if they are shared#25319
asmorkalov merged 2 commits intoopencv:4.xfrom
fengyuentau:gold_yolo

Conversation

@fengyuentau
Copy link
Copy Markdown
Member

Resolves #25278

Merge with opencv/opencv_extra#1165

In Gold-YOLO ,Div has a constant input B=6 which is then parsed into a Const layer in the ONNX importer, but Clip also has the shared constant input max=6 which is already a Const layer and then connected to Elementwise layer. This should not happen because in the forward() of Elementwise layer, the legacy code goes through and apply activation to each input. More details on #25278 (comment).

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

@fengyuentau fengyuentau added category: dnn category: dnn (onnx) ONNX suport issues in DNN module labels Apr 3, 2024
@fengyuentau fengyuentau added this to the 4.10.0 milestone Apr 3, 2024
@fengyuentau fengyuentau requested a review from dkurt April 3, 2024 04:31
@fengyuentau fengyuentau self-assigned this Apr 3, 2024
@fengyuentau
Copy link
Copy Markdown
Member Author

Should we add Gold-YOLO in the integrated YOLO API? @Abdurrahheem

@asmorkalov asmorkalov assigned dkurt and unassigned fengyuentau Apr 3, 2024
@asmorkalov asmorkalov merged commit 55d7e3f into opencv:4.x Apr 3, 2024
@fengyuentau fengyuentau deleted the gold_yolo branch April 3, 2024 13:21
@asmorkalov asmorkalov mentioned this pull request Apr 10, 2024
klatism pushed a commit to klatism/opencv that referenced this pull request May 17, 2024
[BugFix] dnn (ONNX): Foce dropping constant inputs in parseClip if they are shared opencv#25319

Resolves opencv#25278
Merge with opencv/opencv_extra#1165

In Gold-YOLO ,`Div` has a constant input `B=6` which is then parsed into a `Const` layer in the ONNX importer, but `Clip` also has the shared constant input `max=6` which is already a `Const` layer and then connected to `Elementwise` layer. This should not happen because in the `forward()` of `Elementwise` layer, the legacy code goes through and apply activation to each input. More details on opencv#25278 (comment).

### 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
- [x] 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
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gold-YOLO Inference Error in Clip Operator

3 participants