Esempio n. 1
0
 def __init__(self, num_classes, trunk='hrnetv2', criterion=None):
     super(Basic, self).__init__()
     self.criterion = criterion
     self.backbone, _, _, high_level_ch = get_trunk(trunk_name=trunk,
                                                    output_stride=8)
     self.seg_head = make_seg_head(in_ch=high_level_ch, out_ch=num_classes)
     initialize_weights(self.seg_head)
    def __init__(self,
                 num_classes,
                 trunk='resnet-50',
                 criterion=None,
                 use_dpc=False,
                 init_all=False,
                 output_stride=8):
        super(DeepV3ATTN, self).__init__()
        self.criterion = criterion

        self.backbone, _s2_ch, _s4_ch, high_level_ch = \
            get_trunk(trunk, output_stride=output_stride)
        #self.aspp, aspp_out_ch = get_aspp(high_level_ch,
        #                                  bottleneck_ch=256,
        #                                  output_stride=output_stride,
        #                                  dpc=use_dpc)
        #self.attn = APNB(in_channels=high_level_ch, out_channels=high_level_ch, key_channels=256, value_channels=256, dropout=0.5, sizes=([1]), norm_type='batchnorm', psp_size=(1,3,6,8))
        self.attn = AFNB(low_in_channels=2048,
                         high_in_channels=4096,
                         out_channels=2048,
                         key_channels=1024,
                         value_channels=2048,
                         dropout=0.5,
                         sizes=([1]),
                         norm_type='batchnorm',
                         psp_size=(1, 3, 6, 8))
        self.final = make_seg_head(in_ch=high_level_ch, out_ch=num_classes)

        initialize_weights(self.attn)
        initialize_weights(self.final)
Esempio n. 3
0
    def __init__(self, num_classes, trunk='hrnetv2', criterion=None):
        super(MscaleBasic, self).__init__()
        self.criterion = criterion
        self.backbone, _, _, high_level_ch = get_trunk(trunk_name=trunk,
                                                       output_stride=8)

        self.cls_head = make_seg_head(in_ch=high_level_ch, out_ch=num_classes)
        self.scale_attn = make_attn_head(in_ch=high_level_ch, out_ch=1)
Esempio n. 4
0
    def __init__(self, num_classes, trunk='hrnetv2', criterion=None):
        super(ASPP, self).__init__()
        self.criterion = criterion
        self.backbone, _, _, high_level_ch = get_trunk(trunk)
        self.aspp, aspp_out_ch = get_aspp(high_level_ch,
                                          bottleneck_ch=cfg.MODEL.ASPP_BOT_CH,
                                          output_stride=8)
        self.bot_aspp = nn.Conv2d(aspp_out_ch, 256, kernel_size=1, bias=False)
        self.final = make_seg_head(in_ch=256, out_ch=num_classes)

        initialize_weights(self.final, self.bot_aspp, self.aspp)
Esempio n. 5
0
    def __init__(self, num_classes, trunk='resnet-50', criterion=None,
                 use_dpc=False, init_all=False, output_stride=8):
        super(DeepV3, self).__init__()
        self.criterion = criterion

        self.backbone, _s2_ch, _s4_ch, high_level_ch = \
            get_trunk(trunk, output_stride=output_stride)
        self.aspp, aspp_out_ch = get_aspp(high_level_ch,
                                          bottleneck_ch=256,
                                          output_stride=output_stride,
                                          dpc=use_dpc)
        self.final = make_seg_head(in_ch=aspp_out_ch, out_ch=num_classes)

        initialize_weights(self.aspp)
        initialize_weights(self.final)