Skip to content
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

Fix spelling, spacing, and unused variables #236

Merged
merged 5 commits into from
Feb 29, 2024

Conversation

ryan1288
Copy link
Contributor

Minor PR fixing spelling mistakes, spacing, and removed unused variables. Issue partially mentioned in #135 (comment).

@ryan1288
Copy link
Contributor Author

Additional note: While I did not implement this change, I observed that the following was declared but unused in the C++ demos.

void setBackendAndTarget(dnn::Backend bId, dnn::Target tId)
{
    this->backendId = bId;
    this->targetId = tId;
    this->net.setPreferableBackend(this->backendId);
    this->net.setPreferableTarget(this->targetId);
}

@@ -237,10 +237,9 @@ int main(int argc, char** argv)
backendTargetPairs[backendTargetid].first, backendTargetPairs[backendTargetid].second);
//! [Open a video file or an image file or a camera stream]
if (!cap.isOpened())
CV_Error(Error::StsError, "Cannot opend video or file");
CV_Error(Error::StsError, "Cannot video or file");
Copy link
Member

Choose a reason for hiding this comment

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

open

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed! Also updated several more typos.

@fengyuentau
Copy link
Member

Additional note: While I did not implement this change, I observed that the following was declared but unused in the C++ demos.

void setBackendAndTarget(dnn::Backend bId, dnn::Target tId)
{
    this->backendId = bId;
    this->targetId = tId;
    this->net.setPreferableBackend(this->backendId);
    this->net.setPreferableTarget(this->targetId);
}

Which particular demo?

@ryan1288
Copy link
Contributor Author

ryan1288 commented Feb 27, 2024

Models with that unused function:

  • face_detection_yunet/demo.cpp
  • object_detection_yolox/demo.cpp
  • person_detection_mediapipe/demo.cpp
  • 2x in pose_estimation_mediapipe/demo.cpp for each class

Most of them define it in the class, but end up using the following in the constructor:

this->net.setPreferableBackend(this->backendId);
this->net.setPreferableTarget(this->targetId);

In the Python equivalent classes and benchmark.py, it is used for benchmarking. However, currently, they are unused in the C++ versions. Do we plan to keep them for future evaluation?

@fengyuentau
Copy link
Member

In the Python equivalent classes and benchmark.py, it is used for benchmarking. However, currently, they are unused in the C++ versions. Do we plan to keep them for future evaluation?

Well, you are right. They are used for benchmark in Python scripts but we don't need them in C++ demos. It's okay to remove them then.

@ryan1288
Copy link
Contributor Author

@fengyuentau I've removed all such instances of unused setBackendAndTarget from C++ demos. I also reran all the C++ demos to ensure functionality was not affected.

@fengyuentau fengyuentau merged commit a45b893 into opencv:main Feb 29, 2024
@fengyuentau
Copy link
Member

Thank you for your contritbution 👍

@fengyuentau fengyuentau self-assigned this Feb 29, 2024
@fengyuentau fengyuentau added the demo anything related to demo in Python / C++ label Feb 29, 2024
@fengyuentau fengyuentau added this to the 4.10.0 milestone Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
demo anything related to demo in Python / C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants