feinanshan / FANet

MIT License
51 stars 5 forks source link

Resnet block feature map size #6

Open Pelursos opened 3 years ago

Pelursos commented 3 years ago

Hi, Thanks for your great work. I have a question regarding the feature map size of resnet blocks. In your paper you say that the first res-block produces a feature map of h/4 x w/4 resolution. But in the code the resolution of the feature map is h/8 x w/8

Is this an error ? Or the implementation doesn't fully reproduce the paper description ?

Thank you

xiaojianzhong commented 3 years ago

In the section IV-C of the original paper, they applied extra down-sampling to the first block of ResNet-18/34 (which is called the "Extra Spatial Reduction Strategy"):

Based on these observations and with an aim of real-time semantic segmentation, we choose to apply extra down-sampling to “Res-1” and denote the model as FANet-18/34 based on the ResNet encoder used.

Accordingly, in Testing/models/fanet/resnet.py they applied 2-strided conv instead of 1-strided conv for the first ResBlock:

def Resnet18(pretrained=True, norm_layer=None, **kwargs):
    model = ResNet(BasicBlock, [2, 2, 2, 2],[2, 2, 2, 2], norm_layer=norm_layer)
    if pretrained:
        model.init_weight(model_zoo.load_url(model_urls['resnet18']))
    return model