pytorch-segmentation icon indicating copy to clipboard operation
pytorch-segmentation copied to clipboard

Deeplab V3+ model doesn't support ResNet-50 as backbone?

Open panovr opened this issue 11 months ago • 0 comments

When reading the Deeplab V3+ code, I found it seems that current Deeplab V3+ model doesn't support ResNet-50 as backbone, and it only support ResNet-101 as backbone.

class DeepLab(BaseModel):
    def __init__(self, num_classes, in_channels=3, backbone='xception', pretrained=True, 
                output_stride=16, freeze_bn=False, freeze_backbone=False, **_):
                
        super(DeepLab, self).__init__()
        assert ('xception' or 'resnet' in backbone)
        if 'resnet' in backbone:
            self.backbone = ResNet(in_channels=in_channels, output_stride=output_stride, pretrained=pretrained)
            low_level_channels = 256
class ResNet(nn.Module):
    def __init__(self, in_channels=3, output_stride=16, backbone='resnet101', pretrained=True):
        super(ResNet, self).__init__()
        model = getattr(models, backbone)(pretrained)

You can see when DeepLab class create ResNet as backbone, it doesn't pass backbone parameter.

panovr avatar Mar 20 '24 08:03 panovr