Skip to content

Conversation

christian-rauch
Copy link

@christian-rauch christian-rauch commented Apr 17, 2020

enables dilation for ResNet

@codecov-io
Copy link

codecov-io commented Apr 17, 2020

Codecov Report

Merging #2115 into master will increase coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #2115   +/-   ##
======================================
  Coverage    0.48%   0.48%           
======================================
  Files          92      92           
  Lines        7409    7407    -2     
  Branches     1128    1127    -1     
======================================
  Hits           36      36           
+ Misses       7360    7358    -2     
  Partials       13      13           
Impacted Files Coverage Δ
torchvision/models/resnet.py 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7b60f4d...e0f24f5. Read the comment docs.

@WaterKnight1998
Copy link

@christian-rauch With this change, could resnet34 work as deeplabv3 backbone?

Will the pretrained weights work?

@christian-rauch
Copy link
Author

This doesn't change the default settings (dilation=1) and dilation>1 would throw. I think you should be able to load and use pretrained weights, but I haven't verified that.

@WaterKnight1998
Copy link

WaterKnight1998 commented Apr 20, 2020

Hope to see your pull completed! @fmassa

@christian-rauch
Copy link
Author

christian-rauch commented Apr 21, 2020

I noticed that setting replace_stride_with_dilation dramatically increases the inference time by more than 10x (on CPU).

@WaterKnight1998
Copy link

I noticed that setting replace_stride_with_dilation dramatically increases the inference time by more than 10x (on CPU).

Is this the fcn_resnet50??

@fmassa
Copy link
Member

fmassa commented Apr 21, 2020

Hi,

Thanks for the PR!

There are a few subtleties with BasicBlock that makes it not support right away dilation. Indeed, you would need to keep some more information for it to be correctly propagated, so this PR isn't enough.

Let me know if you would have bandwidth to work on this until completion (might require some thought, I'm not sure it will be easy to do in a clean way), and I can give you some pointers.

@christian-rauch
Copy link
Author

I noticed that setting replace_stride_with_dilation dramatically increases the inference time by more than 10x (on CPU).

Is this the fcn_resnet50??

No, the resnet34.

@WaterKnight1998
Copy link

I noticed that setting replace_stride_with_dilation dramatically increases the inference time by more than 10x (on CPU).

Is this the fcn_resnet50??

No, the resnet34.

Do you think that this change will allow to use as deeplabv3 backbone?

@fmassa
Copy link
Member

fmassa commented Apr 30, 2020

@WaterKnight1998 if a variant of this PR gets merged, it would allow to use ResNet34 as a backbone for DeepLabV3, although we don't provide pre-trained weights for this configuration.

@rwightman
Copy link
Contributor

@WaterKnight1998 FYI, I have a ResNet which has evolved from the one here that does support dilation in the BasicBlock... as you can see, it requires a bit more effort as @fmassa mentioned. I also got dilation working in the avgpool downsample variants ('D') which was a bit of fun :)
https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/resnet.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants