Пример #1
0
    def __init__(self,
                 nclass,
                 backbone='resnet101',
                 aux=True,
                 dilated=True,
                 jpu=False,
                 pretrained_base=True,
                 base_size=520,
                 crop_size=480,
                 **kwargs):
        super(DeepLabV3, self).__init__(nclass,
                                        aux,
                                        backbone,
                                        base_size=base_size,
                                        crop_size=crop_size,
                                        dilated=dilated,
                                        jpu=jpu,
                                        pretrained_base=pretrained_base,
                                        **kwargs)
        self.head = _DeepLabHead(nclass,
                                 height=self._up_kwargs[0] // 8,
                                 width=self._up_kwargs[1] // 8,
                                 **kwargs)
        if self.aux:
            self.auxlayer = _FCNHead(1024, nclass, **kwargs)

        self.__setattr__('others',
                         ['head', 'auxlayer'] if self.aux else ['head'])
Пример #2
0
    def __init__(self,
                 nclass,
                 backbone='resnet50',
                 aux=True,
                 dilated=True,
                 jpu=False,
                 pretrained_base=True,
                 base_size=520,
                 crop_size=480,
                 **kwargs):
        super(PSPNet, self).__init__(nclass,
                                     aux,
                                     backbone,
                                     base_size=base_size,
                                     dilated=dilated,
                                     jpu=jpu,
                                     crop_size=crop_size,
                                     pretrained_base=pretrained_base,
                                     **kwargs)
        self.head = _PSPHead(nclass, **kwargs)
        if self.aux:
            self.auxlayer = _FCNHead(1024, nclass, **kwargs)

        self.__setattr__('others',
                         ['head', 'auxlayer'] if self.aux else ['head'])
Пример #3
0
    def __init__(self, nclass, oc='base', backbone='resnet101', aux=False, dilated=True, jpu=False,
                 pretrained_base=True, base_size=520, crop_size=480, **kwargs):
        super(OCNet, self).__init__(nclass, aux, backbone, dilated=dilated, jpu=jpu, base_size=base_size,
                                    crop_size=crop_size, pretrained_base=pretrained_base, **kwargs)
        self.context = self.get_oc(oc)
        self.cls = nn.Conv2d(512, nclass, kernel_size=1, stride=1, padding=0, bias=True)
        if self.aux:
            self.auxlayer = _FCNHead(1024, nclass)

        self.__setattr__('others', ['cls', 'context', 'auxlayer'] if aux else ['cls', 'context'])