Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@zihaomu
Copy link
Member

@zihaomu zihaomu commented Aug 15, 2023

Fix issue: #24041
relates #22401

Handling when the operation of the Elemtwise layer is missing.
nextData->params.get<String>("operation") will fail when the operation is missing. This patch adds default value for such case.

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

String operation_text = toLowerCase(nextData->params.get<String>("operation", "sum"));
CV_LOG_DEBUG(NULL, "DNN/CPU: fusion with NaryEltwise or Eltwise Layer operation is not supported: "
<< nextData->params.get<String>("operation"));
<< operation_text);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some compilation modes may ignore CV_LOG_DEBUG statement completely (empty macro).
We should NOT create orphaned variables which are not used (and we don't want to evaluate unused expressions and call functions).


if (!nextData->params.has("operation") || toLowerCase(nextData->params.get<String>("operation")) != "add")
{
String operation_text = toLowerCase(nextData->params.get<String>("operation", "sum"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"sum"

Why is sum?
<empty> should be more appropriate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@opencv-pushbot opencv-pushbot merged commit 8d1c73a into opencv:4.x Aug 16, 2023
@asmorkalov asmorkalov mentioned this pull request Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open CV will not infere more than 2 models when cv::utils::logging::setLogLevel(cv::utils::logging::LOG_LEVEL_VERBOSE); is set

4 participants