-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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] Support MMSegInferencer #2413
Conversation
Codecov ReportBase: 83.29% // Head: 83.52% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## dev-1.x #2413 +/- ##
===========================================
+ Coverage 83.29% 83.52% +0.23%
===========================================
Files 146 147 +1
Lines 8522 8620 +98
Branches 1275 1293 +18
===========================================
+ Hits 7098 7200 +102
+ Misses 1212 1195 -17
- Partials 212 225 +13
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. |
4c28e1e
to
115552d
Compare
d974015
to
00546a5
Compare
00546a5
to
fd79dcd
Compare
mmseg/apis/mmseg_inferencer.py
Outdated
wait_time: int = 0, | ||
draw_pred: bool = True, | ||
out_dir: str = '', | ||
print_result: bool = False, |
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.
print_result
might be not suit for segmentation task?
mmseg/apis/mmseg_inferencer.py
Outdated
def visualize(self, | ||
inputs: list, | ||
preds: List[dict], | ||
return_vis: bool = False, | ||
show: bool = False, | ||
wait_time: int = 0, | ||
draw_pred: bool = True, | ||
img_out_dir: str = '', | ||
opacity: float = 0.8) -> List[np.ndarray]: | ||
"""Visualize predictions. | ||
|
||
Args: | ||
inputs (list): Inputs preprocessed by :meth:`_inputs_to_list`. | ||
preds (Any): Predictions of the model. | ||
show (bool): Whether to display the image in a popup window. | ||
Defaults to False. | ||
|
||
Returns: | ||
List[np.ndarray]: Visualization results. | ||
""" |
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.
please add docstring for this kwargs
mmseg/apis/mmseg_inferencer.py
Outdated
def visualize(self, | ||
inputs: list, | ||
preds: List[dict], | ||
return_vis: bool = False, |
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 think return_vis
might not work?
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.
please modify mmcv version in requirement/mminstall.txt
tests/test_apis/test_inferencer.py
Outdated
infer = MMSegInferencer(cfg, ckpt_filename) | ||
|
||
# test forward | ||
img = np.random.randint(0, 256, (4, 4, 3)).astype(np.float32) |
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.
why the input data type is np.float32?
mmseg/apis/mmseg_inferencer.py
Outdated
"""MMSegInferencer. | ||
|
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.
might add MMSegInferencer needs mmengine>=0.5.0 in docstring
## Motivation Support `MMSegInferencer` for providing an easy and clean interface for single or multiple images inferencing. Ref: open-mmlab/mmengine#773 open-mmlab/mmocr#1608 ## Modification - mmseg/apis/mmseg_inferencer.py - mmseg/visualization/local_visualizer.py - demo/image_demo_with_inferencer.py ## Use cases (Optional) Based on https://github.com/open-mmlab/mmengine/tree/inference Add a new image inference demo with `MMSegInferencer` - demo/image_demo_with_inferencer.py ```shell python demo/image_demo_with_inferencer.py demo/demo.png fcn_r50-d8_4xb2-40k_cityscapes-512x1024 ``` --------- Co-authored-by: MeowZheng <meowzheng@outlook.com>
Motivation
Support
MMSegInferencer
for providing an easy and clean interface for single or multiple images inferencing.Ref: open-mmlab/mmengine#773 open-mmlab/mmocr#1608
Modification
Use cases (Optional)
Based on https://github.com/open-mmlab/mmengine/tree/inference
Add a new image inference demo with
MMSegInferencer