def __init__(self, backbone='resnet', output_stride=16, num_classes=21, sync_bn=False, freeze_bn=False, mc_dropout=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, mc_dropout=mc_dropout) self.aspp = build_aspp(backbone, output_stride, BatchNorm) self.decoder = build_decoder(num_classes, backbone, BatchNorm) self.return_features = False if freeze_bn: self.freeze_bn()
def __init__(self, args, cfg=None, net='resnet', output_stride=32, num_classes=21, img_size=512, pretrained=True, freeze_bn=False): super(DSSD, self).__init__() self.args = args self.cfg = cfg self.net = net self.num_classes = num_classes self.image_size = img_size self.priorbox = PriorBox(cfg, net, output_stride) self.priors = self.priorbox().to(args.device) self.backbone = build_backbone(net, output_stride, pretrained) self.aspp = build_aspp(net, output_stride) self.decoder = build_decoder(net) self.head = build_head(inplances=self.decoder.plances, num_classes=num_classes, num_anchor=cfg.anchor_number) if freeze_bn: self.freeze_bn # For detect self.softmax = nn.Softmax(dim=-1) self.detect = Detect(self.args, self.cfg, self.num_classes)
def __init__(self, output_stride=16, num_classes=21): super(DeepLab, self).__init__() BatchNorm = nn.BatchNorm2d self.backbone = build_resnet(output_stride, pretrained=True) self.aspp = build_aspp(output_stride) self.decoder = build_decoder(num_classes)
def __init__(self, output_stride=16, num_classes=21, freeze_bn=False): super(DeepLab, self).__init__() BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(output_stride, BatchNorm) self.aspp = build_aspp(output_stride, BatchNorm) self.decoder = build_decoder(num_classes, BatchNorm) if freeze_bn: self.freeze_bn()
def __init__(self, args): super(DeepLab, self).__init__() if args.backbone == 'drn': output_stride = 8 else: output_stride = args.output_stride if args.sync_bn == True: BatchNorm = SynchronizedBatchNorm2d else: BatchNorm = nn.BatchNorm2d self.backbone = build_backbone(args.backbone, output_stride, BatchNorm) self.aspp = build_aspp(args.backbone, output_stride, BatchNorm) self.decoder = build_decoder(args.num_classes, args.backbone, BatchNorm) self.freeze_bn = args.freeze_bn