-
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
[Enchance] support infererence with padding #1607
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1607 +/- ##
==========================================
- Coverage 90.40% 90.26% -0.15%
==========================================
Files 141 142 +1
Lines 8443 8485 +42
Branches 1423 1431 +8
==========================================
+ Hits 7633 7659 +26
- Misses 572 586 +14
- Partials 238 240 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
It may effect pytorch2onnx and i will refactor the code later |
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.
@FreyWang have you compared the model performance before and after this modification? Would you like to share the results with us? Thank you
|
the performance is same after this commit if pad is not add to config |
would you like to present the TTA result with pad and without pad of deeplabv3+? |
|
I got what you said and I will find time to commit the test code😂 |
@MeowZheng after pad |
* [Enchance] support infererence with padding * limite pad after flip when inference * add test code
Motivation
I use mmseg to train my model and found the mask has a left offset to the image. Finally I found that it is caused by inference input without padding. For example, A input with origin shape (1920, 1080) and
img_scale=(2048, 512)
will be resized to(910 , 512)
. When infer it with resnet50-d8,the final feature map is 114 * 64 and then resize it to 910*512. Attention that 114x8=912. So it is same with pad the input to (912, 512) and resize feature to (910, 512). With 2-pixel left offsetBC-breaking (Optional)
Attention that when
dict(type='Pad', size_divisor=32),
is add, the model performance will intend to be improved, I have test several mIoU riseconfigs/deeplabv3plus/deeplabv3plus_r50-d8_512x512_80k_ade20k.py
from 42.72 to 42.78
configs/ocrnet/ocrnet_hr18s_512x512_80k_ade20k.py
from 35.06 to 35.53
configs/knet/knet_s3_upernet_swin-l_8x2_512x512_adamw_80k_ade20k.py
from 52.05 to 52.61
Use cases (Optional)
Add
Pad
when inference to make sure that input can be divide to model stride.[Update]
Attention that
Pad
must behindeRandomFlip
when flip is True