-
Notifications
You must be signed in to change notification settings - Fork 191
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
C++ Demo - Image Classification (PPResNet) #241
Conversation
… variable in the demo.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge this file with demo.cpp
and revert the changes in ppresnet.py
. We made a decision long time ago that demo should be portable and convenient as much as possible with less files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated! I've reverted the changes to ppresnet.py
and merged the labels with demo.cpp
. Agree with the portability 😄 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need example input as it demonstrates nothing and it increase repo size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed example 👍
return 0; | ||
} | ||
|
||
string LABELS_IMAGENET_1K = "tench\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using std::vector<std::string>
? In this case we do not need to duplicate \n
for each class and we do not need to re-load this in loadLabels
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fengyuentau That's a great idea. Not sure why I didn't think of that 😅 I've updated it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution! 👍
This PR adds the C++ demo for the Image Classification PPResNet model, as part of a request from #135.
demo.cpp
: Added to have matching functionality todemo.py
. All 1,000 classes included as a string to be parsed.demo.py
: Printout was adjusted be cleaner and matches the C++ version.CMakeLists.txt
: Created to build with OpenCV 4.9.0 and enforces C++11 standards upon building.README.md
: Updated with C++ instructions.The interface matches other C++ demos within the set of ML models.
The predictions visualizations were adjusted for both C++ and Python demos for clarity.
Before (Python)
After (Python & C++)
Testing
A number of images were tested with top-k = 20 and all had matching output classes, with one example provided below.