-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[Enhancement] Support padding in testing #2290
Conversation
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.
add ut for the new function
mmseg/models/data_preprocessor.py
Outdated
train_cfg (dict, optional): The padding size config in training, if | ||
not specify, will use `size` and `size_divisor` params as default. | ||
Defaults to None, only supports keys `size` or `size_divisor`. | ||
test_cfg (dict, optional): The padding size config in testing, if not | ||
specify, will use `size` and `size_divisor` params as default. | ||
Defaults to None, only supports keys `size` or `size_divisor`. |
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 an example in PR description for train_cfg
and test_cfg
as a padding config for input data.
Codecov ReportBase: 83.57% // Head: 83.65% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## dev-1.x #2290 +/- ##
===========================================
+ Coverage 83.57% 83.65% +0.08%
===========================================
Files 141 141
Lines 7970 7974 +4
Branches 1192 1193 +1
===========================================
+ Hits 6661 6671 +10
+ Misses 1119 1114 -5
+ Partials 190 189 -1
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.
please try to use Pad
in test pipeline
If use |
mmseg/models/data_preprocessor.py
Outdated
inputs, data_samples = stack_batch( | ||
inputs=inputs, | ||
data_samples=data_samples, | ||
size=self.test_cfg.get('size', None), | ||
size_divisor=self.test_cfg.get('size_divisor', None), | ||
pad_val=self.pad_val, | ||
seg_pad_val=self.seg_pad_val) |
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.
inputs, data_samples = stack_batch( | |
inputs=inputs, | |
data_samples=data_samples, | |
size=self.test_cfg.get('size', None), | |
size_divisor=self.test_cfg.get('size_divisor', None), | |
pad_val=self.pad_val, | |
seg_pad_val=self.seg_pad_val) | |
inputs, data_samples = stack_batch( | |
inputs=inputs, | |
size=self.test_cfg.get('size', None), | |
size_divisor=self.test_cfg.get('size_divisor', None), | |
pad_val=self.pad_val, | |
seg_pad_val=self.seg_pad_val) |
I think it would be better to keep gt as original when model testing or validation.
mmseg/models/segmentors/base.py
Outdated
i_gt_sem_seg = data_samples[i].gt_sem_seg.data[:, | ||
padding_top:H - | ||
padding_bottom, | ||
padding_left:W - | ||
padding_right] | ||
|
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_gt_sem_seg = data_samples[i].gt_sem_seg.data[:, | |
padding_top:H - | |
padding_bottom, | |
padding_left:W - | |
padding_right] |
mmseg/models/segmentors/base.py
Outdated
'gt_sem_seg': | ||
PixelData() if only_prediction else PixelData( |
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.
Is it necessary to add an empty PixelData for gt_sem_seg
when only predict?
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
* support padding in test and fix remove gt padding at post_process * fix get gt data * fix ut * add data_preprocessor ut * remove gt padding * fix data sample is None
[Enhancement] Support padding in testing
Motivation
Modification
BC-breaking (Optional)
None
Use cases
In a case that uses
size
in training and usingsize_divisor
in testing, we might set thetest_cfg
param to data_preprocessor.