-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Feature] Add ImageClassificationInferencer
.
#1261
Conversation
mmcls/apis/inference.py
Outdated
for input_ in inputs: | ||
if isinstance(input_, str): | ||
data_info = loader({'img_path': input_, 'to_rgb': True}) | ||
elif isinstance(input_, np.ndarray): |
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.
Do we need to add the shape check of the numpy array?
mmcls/apis/inference.py
Outdated
to find a pre-defined weight from the model you specified | ||
(only work if the ``model`` is a model name). Defaults to None. | ||
device (str, optional): Device to run inference. If None, use CPU. | ||
Defaults to None. |
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 add some usage cases in doc-string?
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.
As inline comments
22f4728
to
e1ae0c7
Compare
Codecov ReportBase: 0.02% // Head: 86.85% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## dev-1.x #1261 +/- ##
============================================
+ Coverage 0.02% 86.85% +86.82%
============================================
Files 121 166 +45
Lines 8217 13510 +5293
Branches 1368 2148 +780
============================================
+ Hits 2 11734 +11732
+ Misses 8215 1420 -6795
- Partials 0 356 +356
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
As inline comments
Motivation
See open-mmlab/mmengine#773 for more details about the inferencer design in MMEngine. And this PR is also depend on the
inference
branch of MMEngine.In a word, the inferencer is a enhanced
inference_model
but split the whole process intopreprocess
,forward
,visualize
andpostprocess
four methods.Modification
Implement
ImageClassificationInferencer
, refactorinference_model
and our demo.BC-breaking (Optional)
Almost not, but the
demo/image_demo.py
is modified and we need to also change our documentation later.Use cases (Optional)
To use the
ImageClassificationInferencer
To inference multiple images by batch on CUDA
The original
demo/image_demo.py
also supports model name by nowOutput:
Checklist
Before PR:
After PR: