def __init__(self, backbone='resnet', output_stride=16, num_classes=19, sync_bn=True, freeze_bn=False, args=None, separate=False): super(DeepLab, self).__init__() if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(backbone, output_stride, BatchNorm, args) self.aspp = build_aspp(backbone, output_stride, BatchNorm, args, separate) self.decoder = build_decoder(num_classes, backbone, BatchNorm, args, separate) if freeze_bn: self.freeze_bn()
def __init__(self, backbone='resnet', output_stride=16, num_classes=21, sync_bn=False, freeze_bn=False): super(DeepLab, self).__init__() if backbone == 'drn': output_stride = 8 if backbone == 'resnet': link_in = 1024 link_out = 1024 elif backbone == 'mobilenet': link_in = 64 link_out = 64 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(backbone, output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.link_conv = nn.Sequential(nn.Conv2d(link_in, link_out, kernel_size=1, stride=1, padding=0, bias=False)) self.last_conv = nn.Sequential(nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1, bias=False), BatchNorm(64), nn.ReLU(), nn.Dropout(0.1), nn.Conv2d(64, num_classes, kernel_size=1, stride=1)) self._init_weight() if freeze_bn: self.freeze_bn()
def __init__(self, args, backbone='resnet', output_stride=16, num_classes=21, sync_bn=True, freeze_bn=False): super(DeepLab, self).__init__() self.args = args if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(backbone, output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) if self.args.use_kinematic == False: self.decoder = build_decoder(num_classes, backbone, BatchNorm) else: self.decoder = build_decoder_kinematic(backbone, BatchNorm) self.kinematic_layer = build_kinematic_graph(BatchNorm) self.freeze_bn = freeze_bn
def __init__(self, backbone='resnet101', output_stride=16, num_classes=21, sync_bn=True, freeze_bn=False, enable_interpolation=True, pretrained_path=None, norm_layer=nn.BatchNorm2d, enable_aspp=True): super(DeepLab, self).__init__() self.enable_aspp = enable_aspp if backbone == 'drn': output_stride = 8 BatchNorm = norm_layer self.backbone = build_backbone(backbone, output_stride, BatchNorm, pretrained_path=pretrained_path) self.aspp = build_aspp(backbone, output_stride, BatchNorm, enable_aspp=self.enable_aspp) self.decoder = build_decoder(num_classes, backbone, BatchNorm) self.enable_interpolation = enable_interpolation
def __init__(self, backbone='resnet', output_stride=16, num_classes=19, use_ABN=True, freeze_bn=False, args=None, separate=False): super(DeepLab, self).__init__() if backbone == 'drn': output_stride = 8 if use_ABN: BatchNorm = ABN else: BatchNorm = NaiveBN self.backbone = build_backbone(backbone, output_stride, BatchNorm, args) self.aspp = build_aspp(backbone, output_stride, BatchNorm, args, separate) self.decoder = build_decoder(num_classes, backbone, BatchNorm, args, separate) if freeze_bn: self.freeze_bn()
def __init__(self, backbone='resnet', output_stride=16, num_classes=21, sync_bn=True, freeze_bn=False): super(DeepLab, self).__init__() if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(backbone, output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.decoder = build_decoder(num_classes, backbone, BatchNorm) # self.last_conv = nn.Sequential(nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1, bias=False), # BatchNorm(256), # nn.ReLU(), # nn.Dropout(0.5), # nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1, bias=False), # BatchNorm(256), # nn.ReLU(), # nn.Dropout(0.1), # nn.Conv2d(256, 2, kernel_size=1, stride=1)) self._init_weight() if freeze_bn: self.freeze_bn()
def __init__(self, backbone='seresnext101', output_stride=16, num_classes=5, sync_bn=True, freeze_bn=False): super(DeepLab, self).__init__() if backbone == 'drn': output_stride = 8 if sync_bn: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(backbone, output_stride, BatchNorm) #print('bacbone') self.aspp = build_aspp(backbone, output_stride, BatchNorm) #print('aspp') self.decoder = build_decoder(num_classes, backbone, BatchNorm) #print('decoder') #self.up = DeconvBlock(304,256,BatchNorm=BatchNorm,n_iter=2) #self.last_conv = nn.Conv2d(256, num_classes, kernel_size=1, stride=1) if freeze_bn: self.freeze_bn()
def __init__(self, backbone='resnet', output_stride=16, num_classes=21, sync_bn=True, freeze_bn=False, cp_path=None): super(DeepLab, self).__init__() if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(backbone, output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.decoder = build_decoder(21, backbone, BatchNorm) if (cp_path is not None): cp = torch.load(cp_path, map_location='cpu') self.load_state_dict(cp['state_dict']) if freeze_bn: self.freeze_bn() # predict two classes (background / foreground) self.decoder.last_conv[-1] = nn.Conv2d(256, 2, kernel_size=1, stride=1)
def __init__(self, backbone='resnet', output_stride=16, num_classes=21, sync_bn=True, freeze_bn=False): super(DeepLab, self).__init__() if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(backbone, output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.decoder = build_decoder(num_classes, backbone, BatchNorm) self.sr_decoder = build_sr_decoder(num_classes, backbone, BatchNorm) self.pointwise = torch.nn.Sequential( torch.nn.Conv2d(num_classes, 3, 1), torch.nn.BatchNorm2d(3), #添加了BN层 torch.nn.ReLU(inplace=True)) self.up_sr_1 = nn.ConvTranspose2d(64, 64, 2, stride=2) self.up_edsr_1 = EDSRConv(64, 64) self.up_sr_2 = nn.ConvTranspose2d(64, 32, 2, stride=2) self.up_edsr_2 = EDSRConv(32, 32) self.up_sr_3 = nn.ConvTranspose2d(32, 16, 2, stride=2) self.up_edsr_3 = EDSRConv(16, 16) self.up_conv_last = nn.Conv2d(16, 3, 1) self.freeze_bn = freeze_bn
def __init__( self, Norm, backbone="resnet", output_stride=16, num_classes=3, freeze_bn=False, abn=False, ): super(DeepLabv3, self).__init__() self.abn = abn if backbone == "drn": output_stride = 8 if Norm == "gn": norm = gn elif Norm == "bn": norm = bn elif Norm == "syncbn": norm = syncbn self.backbone = build_backbone(backbone, output_stride, Norm, dec=False, abn=abn) self.aspp = build_aspp(backbone, output_stride, norm, dec=False) if freeze_bn: self.freeze_bn()
def __init__(self, backbone='resnet', output_stride=16, num_classes=21, sync_bn=True, freeze_bn=False, pretrain=True): super(DeepLabX, self).__init__() self.num_classes = num_classes if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(backbone, output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) # self.aspp = build_psp() # self.aspp = build_naiveGCE() self.decoder = build_decoder(num_classes, backbone, BatchNorm) if freeze_bn: self.freeze_bn() if pretrain: self._load_pretrain() # change the last inference layer for binary segmentation mask last_conv = list(self.decoder.last_conv.children()) self.decoder.last_conv = nn.Sequential(*last_conv[:-1]) self.decoder.last_conv.add_module('8', nn.Conv2d(256, 2, 1, 1))
def __init__(self, backbone='resnet_multiscale', output_stride=16, num_classes=21, sync_bn=True, freeze_bn=False): super(DeepLabCA, self).__init__() if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(backbone, output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.decoder = build_decoder(num_classes, backbone, BatchNorm) self.avg_pool = nn.AdaptiveAvgPool2d(32) # self.se=RCAB(2048+1024+512+256+256,1,16) self.ca = CAM_Module() in_channels = 2048 + 1024 + 512 + 256 + 256 inter_channels = in_channels // 4 # self.conv5c = nn.Sequential(nn.Conv2d(in_channels, inter_channels, 3, padding=1, bias=False), # BatchNorm(inter_channels), # nn.ReLU()) # self.conv5 = nn.Sequential(nn.Conv2d(inter_channels, inter_channels, 3, padding=1, bias=False), # BatchNorm(inter_channels), # nn.ReLU()) # self.conv6 = nn.Sequential(nn.Dropout2d(0.1, False), nn.Conv2d(inter_channels, num_classes, 1)) if freeze_bn: self.freeze_bn()
def __init__(self, args, num_classes=21): super(DeepLab, self).__init__() self.args = args output_stride = args.out_stride if args.backbone == 'drn': output_stride = 8 if args.backbone.split('-')[0] == 'efficientnet': output_stride = 32 if args.norm == 'gn': norm = gn elif args.norm == 'bn': norm = bn elif args.norm == 'syncbn': norm = syncbn else: print(args.norm, "normalization is not implemented") raise NotImplementedError self.backbone = build_backbone(args) self.aspp = build_aspp(args.backbone, args.out_stride, norm) self.decoder = build_decoder(num_classes, args.backbone, norm) self.classifier = nn.Linear(300, num_classes) if self.args.freeze_bn: self.freeze_bn()
def __init__(self, args, num_classes=21, freeze_bn=False, abn=False, deep_dec=True): super(DeepLab, self).__init__() self.args = args self.abn = abn self.deep_dec = deep_dec # if True, it deeplabv3+, otherwise, deeplabv3 output_stride = args.out_stride if args.backbone == "drn": output_stride = 8 if args.backbone.split("-")[0] == "efficientnet": output_stride = 32 if args.norm == "gn": norm = gn elif args.norm == "bn": norm = bn elif args.norm == "syncbn": norm = syncbn else: print(args.norm, "normalization is not implemented") raise NotImplementedError self.backbone = build_backbone(args) self.aspp = build_aspp(args.backbone, args.out_stride, norm) if self.deep_dec: self.decoder = build_decoder(num_classes, args.backbone, norm) if freeze_bn: self.freeze_bn()
def __init__(self, backbone='resnet', output_stride=16, num_classes=21, sync_bn=True, freeze_bn=False, use_iou=True): super(DeepLab, self).__init__() self.use_iou = use_iou if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(backbone, output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.decoder = build_decoder(num_classes, backbone, BatchNorm) if self.use_iou: self.maskiou = build_maskiou(num_classes, BatchNorm) if freeze_bn: self.freeze_bn()
def __init__(self, low_level_inplanes): super(Deeplab, self).__init__() #aspp self.aspp = build_aspp('', 16, BatchNorm) #decoder self.conv1 = nn.Conv2d(low_level_inplanes, 48, 1, bias=False, groups=cfg.RESNETS.NUM_GROUPS) self.bn1 = BatchNorm(48) self.relu = nn.ReLU() self.last_conv = nn.Sequential( nn.Conv2d(304, 256, kernel_size=3, stride=1, padding=1, bias=False, groups=cfg.RESNETS.NUM_GROUPS), BatchNorm(256), nn.ReLU(), nn.Dropout(0.5), nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1, bias=False, groups=cfg.RESNETS.NUM_GROUPS), BatchNorm(256), nn.ReLU(), nn.Dropout(0.1), nn.Conv2d(256, cfg.MODEL.NUM_CLASSES, kernel_size=1, stride=1)) self._init_weight()
def __init__(self, args, backbone='resnet', output_stride=16, num_classes=4, sync_bn=False, freeze_bn=False, depth=50): super(DeepLab, self).__init__() if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.args = args if self.args.oly_s1 and not self.args.oly_s2: in_channel = 2 pretrn=False elif not self.args.oly_s1 and self.args.oly_s2 and not self.args.rgb: in_channel = 10 pretrn = False elif not self.args.oly_s1 and self.args.oly_s2 and self.args.rgb: in_channel = 3 pretrn = True elif not self.args.oly_s1 and not self.args.oly_s2 and not self.args.rgb: in_channel = 12 pretrn = False elif not self.args.oly_s1 and not self.args.oly_s2 and self.args.rgb: in_channel = 5 pretrn = False else: raise NotImplementedError self.backbone = build_backbone(backbone, in_channel, output_stride, BatchNorm, depth, pretrn) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.decoder = build_decoder(num_classes, backbone, BatchNorm) if freeze_bn: self.freeze_bn()
def __init__(self, backbone='resnet', output_stride=16, num_classes=21, freeze_bn=False): super(DeepLab, self).__init__() BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(backbone, output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.decoder = build_decoder(num_classes, backbone, BatchNorm) self.freeze_bn = freeze_bn
def __init__(self, backbone='resnet', output_stride=16, num_classes=21, freeze_bn=False): super(DeepLab, self).__init__() if backbone == 'drn': output_stride = 8 BatchNorm = nn.BatchNorm2d self.backbone = ResNet101(output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.decoder = build_decoder(num_classes, backbone, BatchNorm) if freeze_bn: self.freeze_bn()
def __init__(self, backbone='resnet', output_stride=16, num_classes=21, sync_bn=True, freeze_bn=False): super(Deeplabv3, self).__init__() if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(backbone, output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.decoder = build_decoder(num_classes, backbone, BatchNorm) self.freeze_bn = freeze_bn
def __init__(self, backbone='resnet', output_stride=16, num_classes=21, sync_bn=True, freeze_bn=False): super(DeepLab, self).__init__() if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(backbone, output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.decoder = build_decoder(num_classes, backbone, BatchNorm) if freeze_bn: self.freeze_bn()
def __init__(self, backbone='resnet', output_stride=16, num_classes=21, sync_bn=True, freeze_bn=False): super(DeepLab, self).__init__() if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d #self.deconv1 = nn.ConvTranspose2d(21, 21, 1, 4, 0, 0, bias=True) self.backbone = build_backbone(backbone, output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.decoder = build_decoder(num_classes, backbone, BatchNorm) if freeze_bn: self.freeze_bn()
def __init__(self, backbone='resnet', output_stride=16, sync_bn=True, freeze_bn=False): super().__init__() if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(backbone, output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.decoder = build_decoder(5, backbone, BatchNorm) if freeze_bn: self.freeze_bn()
def __init__(self, backbone='resnet', output_stride=16, num_classes=2, sync_bn=True, freeze_bn=False): super(DeepLab, self).__init__() if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.cls1 = nn.Sequential( nn.Conv2d(512, 512, kernel_size=3, padding=1), # fc6 ) self.cls2 = nn.Sequential( nn.Conv2d(1024, 512, kernel_size=3, padding=1), # fc6 ) self.backbone = build_backbone(backbone, output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.decoder = build_decoder(num_classes, backbone, BatchNorm) self.freeze_bn = freeze_bn self.multi_graph_conv = build_graph_conv(backbone, BatchNorm) # self.classifier_6 = nn.Sequential( # nn.Conv2d(128, 128, kernel_size=3, dilation=1, padding=1), # fc6 # nn.ReLU(inplace=True) # ) # self.exit_layer = nn.Conv2d(128, 2, kernel_size=1, padding=1) # self.cos_similarity_func = nn.CosineSimilarity() ############################################################ bins = [6, 13, 26, 52] self.features = [] for bin in bins: # [1,2,3,6] self.features.append( nn.Sequential( nn.AdaptiveAvgPool2d(bin), # 括号里面的大小是多少,输出来的大小就是多少 ))
def __init__(self, concat_channels=64, gcn_dim=514): super(DeepLabResnet, self).__init__() self.cnn_feature_grids = [112, 56, 28, 28] self.normalizer = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) self.concat_channels = concat_channels self.feat_size = 28 self.gcn_dim = gcn_dim self.image_feature_dim = 256 # self.resnet = build_backbone("resnet", 8, SynchronizedBatchNorm2d) self.resnet = build_backbone("resnet", 8, BatchNorm2d) self.conv1_concat = _conv_up(64, concat_channels, upflag=False) self.res1_concat, self.res1_concat_up = _conv_up( 256, concat_channels, 2) self.res2_concat, self.res2_concat_up = _conv_up( 512, concat_channels, 4) self.res4_concat, self.res4_concat_up = _conv_up( 2048, concat_channels, 4) # self.res5_concat = _conv_up(512, concat_channels, upflag=False) self.edge_annotation_concat = _make_edge_annotation_concat( self.gcn_dim) self.edge_annotation_channels = 64 * 5 self.conv_final = _make_conv_final(concat_channels) # self.final_PSP = build_aspp("resnet", 8, SynchronizedBatchNorm2d) self.final_PSP = build_aspp("resnet", 8, BatchNorm2d) self.conv_final_cat = _make_conv_final_cat() self.prob_conv = nn.Sequential( nn.Conv2d(512, 256, kernel_size=3, padding=1, bias=False), nn.BatchNorm2d(256), nn.LeakyReLU(), nn.Conv2d(256, 128, kernel_size=3, padding=1, bias=False), nn.BatchNorm2d(128), nn.LeakyReLU(), nn.Conv2d(128, 64, kernel_size=3, padding=1, bias=False), nn.BatchNorm2d(64), nn.LeakyReLU(), nn.Conv2d(64, 2, kernel_size=3, padding=1, bias=False))
def __init__(self, backbone='resnet', output_stride=16, num_classes=15, sync_bn=True, freeze_bn=False): super(DeepLab, self).__init__() if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.backbone = xception.AlignedXception(output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.decoder = build_decoder(num_classes, backbone, BatchNorm) if freeze_bn: self.freeze_bn()
def __init__(self, backbone='resnet', output_stride=16, num_classes=21, sync_bn=True, freeze_bn=False, model_path=os.getcwd()): super(DeepLab, self).__init__() self.model_path = model_path if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(backbone, output_stride, BatchNorm, model_path) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.decoder = build_decoder(num_classes, backbone, BatchNorm) self.freeze_bn = freeze_bn
def __init__(self, backbone='resnet', output_stride=16, num_classes=21, sync_bn=True, freeze_bn=False): super(DeepLab, self).__init__() if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SyncBatchNorm else: BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(backbone, output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.encoding = build_encoding(backbone, num_classes, BatchNorm) self.decoder = build_decoder(num_classes, backbone, BatchNorm) if freeze_bn: self.freeze_bn()
def __init__(self, backbone='resnet', output_stride=16, num_classes=21, sync_bn=True, freeze_bn=False): super(DeepLab, self).__init__() if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.CSG = nn.Linear(CODE_SIZE, np.prod(SLICE_SHAPE), bias=False) self.backbone = build_backbone(backbone, output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm, self.CSG) self.decoder = build_decoder(num_classes, backbone, BatchNorm) if freeze_bn: self.freeze_bn()
def __init__(self, backbone='resnet', output_stride=16, num_classes=2, sync_bn=True, freeze_bn=False): super(DeepLab, self).__init__() if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(backbone, output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) # for k in self.backbone.children(): # for param in k.parameters(): # param.requires_grad = False # for k in self.aspp.children(): # for param in k.parameters(): # param.requires_grad = False self.decoder = build_decoder(num_classes, backbone, BatchNorm) self._load_pretrained_model(backbone) if freeze_bn: self.freeze_bn()
def __init__(self, num_classes, backbone='resnet', output_stride=16, sync_bn=True, freeze_bn=False): super(DeepLab, self).__init__() self.num_classes = num_classes if backbone == 'drn': output_stride = 8 if sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(backbone, output_stride, BatchNorm) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.decoder_seg = build_decoder(num_classes + 1, backbone, BatchNorm) self.decoder_box = build_decoder(6, backbone, BatchNorm) self.pos = None if freeze_bn: self.freeze_bn()