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

add mobilenet c++ sample #171

Merged
merged 9 commits into from
Jun 15, 2023
Merged

Conversation

LaurentBerger
Copy link
Contributor

Copy link
Member

@fengyuentau fengyuentau left a comment

Choose a reason for hiding this comment

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

Thank you for contribution! Please take a look at my comments below.

models/image_classification_mobilenet/mobilenet.cpp Outdated Show resolved Hide resolved
models/image_classification_mobilenet/mobilenet.cpp Outdated Show resolved Hide resolved
models/image_classification_mobilenet/mobilenet.cpp Outdated Show resolved Hide resolved
models/image_classification_mobilenet/mobilenet.cpp Outdated Show resolved Hide resolved
models/image_classification_mobilenet/mobilenet.cpp Outdated Show resolved Hide resolved
models/image_classification_mobilenet/mobilenet.cpp Outdated Show resolved Hide resolved
models/image_classification_mobilenet/mobilenet.cpp Outdated Show resolved Hide resolved
int rszHeight = parser.get<int>("initial_height");
bool swapRB = parser.get<bool>("rgb");
bool crop = parser.get<bool>("crop");
String model = samples::findFile(parser.get<String>("model"));
Copy link
Member

Choose a reason for hiding this comment

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

Do not use samples::findFile. People may build OpenCV without samples. Just do String model = parser.get<String>("model").

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't understand findfiles is in Core functionality » Utility and system functions and macros

Copy link
Member

Choose a reason for hiding this comment

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

AFAIK, samples::findfiles is only used in $opencv/samples. We should avoid using it outside of its scope.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not agree because
demo --input=opencv-logo.png is easyer than demo --input=/opencv/samples/data/opencv-logo.png
and you can call findFiles from python too
but I remove it 👍

Copy link
Member

Choose a reason for hiding this comment

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

Frankly speaking, I thought samples::findFile was from $opencv/samples but it was defined and declared in the core module. Then I tried to search it in opencv source code, found that this API is only used in $opencv/samples.

Now my thought is these kinds of demos are meant to show beginers how to use models with opencv in the most simple way. In most of the cases, they would not even know OPENCV_SAMPLES_DATA_PATH but would find and input an absolute path of an image. I have to say it can be convenient for people who know it, but for other people it may cause confusion. We can use it if we want to promote it.

models/image_classification_mobilenet/CMakeLists.txt Outdated Show resolved Hide resolved
models/image_classification_mobilenet/CMakeLists.txt Outdated Show resolved Hide resolved
models/image_classification_mobilenet/mobilenet.cpp Outdated Show resolved Hide resolved
models/image_classification_mobilenet/mobilenet.cpp Outdated Show resolved Hide resolved
models/image_classification_mobilenet/mobilenet.cpp Outdated Show resolved Hide resolved
@fengyuentau
Copy link
Member

Could you also add a section in readme about how to build and use the c++ demo just like https://github.com/opencv/opencv_zoo/tree/main/models/face_detection_yunet#c does?

Copy link
Member

@WanliZhong WanliZhong left a comment

Choose a reason for hiding this comment

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

👍LGTM!

@fengyuentau fengyuentau merged commit 4913c64 into opencv:main Jun 15, 2023
@fengyuentau fengyuentau self-assigned this Nov 7, 2023
@fengyuentau fengyuentau added the demo anything related to demo in Python / C++ label Nov 7, 2023
@WanliZhong WanliZhong added this to the 4.9.0 (first release) milestone Dec 28, 2023
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.

None yet

4 participants