def __init__(self, cfg=None, phase='train'): """ :param cfg: Network related settings. :param phase: train or test. """ super(RetinaFace, self).__init__() self.phase = phase backbone = models.mobilenet_v2(pretrained=cfg['pretrain'], width_mult=cfg['width_mult']).features self.body = _utils.IntermediateLayerGetter(backbone, cfg['return_layers']) in_channels_list = [ cfg['in_channel'][0], cfg['in_channel'][1], cfg['in_channel'][2], ] out_channels = cfg['out_channel'] self.fpn = FPN(in_channels_list, out_channels) self.ssh1 = SSH(out_channels, out_channels) self.ssh2 = SSH(out_channels, out_channels) self.ssh3 = SSH(out_channels, out_channels) self.ClassHead = self._make_class_head(fpn_num=3, inchannels=cfg['out_channel']) self.BboxHead = self._make_bbox_head(fpn_num=3, inchannels=cfg['out_channel']) self.LandmarkHead = self._make_landmark_head(fpn_num=3, inchannels=cfg['out_channel'])
def __init__(self, cfg=None, phase='train'): """ :param cfg: Network related settings. :param phase: train or test. """ super(Retina, self).__init__() self.phase = phase backbone = None if cfg['name'] == 'mobilenet0.25': backbone = MobileNetV1() self.body = _utils.IntermediateLayerGetter(backbone, cfg['return_layers']) in_channels_stage2 = cfg['in_channel'] in_channels_list = [ in_channels_stage2 * 2, in_channels_stage2 * 4, in_channels_stage2 * 8, ] out_channels = cfg['out_channel'] self.fpn = FPN(in_channels_list, out_channels) self.ssh1 = SSH(out_channels, out_channels) self.ssh2 = SSH(out_channels, out_channels) self.ssh3 = SSH(out_channels, out_channels) self.ClassHead = self._make_class_head(fpn_num=3, inchannels=cfg['out_channel']) self.BboxHead = self._make_bbox_head(fpn_num=3, inchannels=cfg['out_channel']) self.LandmarkHead = self._make_landmark_head(fpn_num=3, inchannels=cfg['out_channel'])
def __init__(self, cfg=None, phase='train'): """ :param cfg: Network related settings. :param phase: train or test. """ super(RetinaFace, self).__init__() self.cfg = cfg self.phase = phase backbone = None if cfg['name'] == 'mobilenet0.25': backbone = MobileNetV1() if cfg['pretrain']: checkpoint = torch.load( "./weights/mobilenetV1X0.25_pretrain.tar", map_location=torch.device('cpu')) from collections import OrderedDict new_state_dict = OrderedDict() for k, v in checkpoint['state_dict'].items(): name = k[7:] # remove module. new_state_dict[name] = v # load params backbone.load_state_dict(new_state_dict) elif cfg['name'] == 'Resnet50': import torchvision.models as models backbone = models.resnet50(pretrained=cfg['pretrain']) elif cfg['name'] == 'effnet': self.body = load_effnetm() elif cfg['name'] == 'Res2Net': from .res2net import res2net101_26w_4s model = res2net101_26w_4s(pretrained=True) self.body = _utils.IntermediateLayerGetter(model, cfg['return_layers']) if cfg['name'] == 'mobilenet0.25' or cfg['name'] == 'Resnet50': self.body = _utils.IntermediateLayerGetter(backbone, cfg['return_layers']) in_channels_stage2 = cfg['in_channel'] in_channels_list = [ in_channels_stage2 * 2, in_channels_stage2 * 4, in_channels_stage2 * 8, ] if cfg['name'] == 'effnet': in_channels_list = [64, 176, 512] out_channels = cfg['out_channel'] self.fpn = FPN(in_channels_list, out_channels, cfg) self.ssh1 = SSH(out_channels, out_channels) self.ssh2 = SSH(out_channels, out_channels) self.ssh3 = SSH(out_channels, out_channels) self.ClassHead = self._make_class_head(fpn_num=3, inchannels=cfg['out_channel']) self.BboxHead = self._make_bbox_head(fpn_num=3, inchannels=cfg['out_channel']) self.LandmarkHead = self._make_landmark_head( fpn_num=3, inchannels=cfg['out_channel'])
def __init__( self, cfg=None, phase='train', calculate_prior_boxes=False, backbone=None, ): """ :param cfg: Network related settings. :param phase: train or test. """ super(RetinaFace, self).__init__() self.phase = phase # backbone = None # if cfg['name'] == 'mobilenet0.25': # backbone = MobileNetV1() # if cfg['pretrain']: # checkpoint = torch.load("./weights/mobilenetV1X0.25_pretrain.tar", map_location=torch.device('cpu')) # from collections import OrderedDict # new_state_dict = OrderedDict() # for k, v in checkpoint['state_dict'].items(): # name = k[7:] # remove module. # new_state_dict[name] = v # # load params # backbone.load_state_dict(new_state_dict) # elif cfg['name'] == 'Resnet50': # import torchvision.models as models # backbone = models.resnet50(pretrained=cfg['pretrain']) self.cfg = cfg self.calculate_prior_boxes = calculate_prior_boxes self.body = _utils.IntermediateLayerGetter(backbone, cfg['return_layers']) in_channels_stage2 = cfg['in_channel'] in_channels_list = [ in_channels_stage2 * 2, in_channels_stage2 * 4, in_channels_stage2 * 8, ] out_channels = cfg['out_channel'] self.fpn = FPN(in_channels_list, out_channels) self.ssh1 = SSH(out_channels, out_channels) self.ssh2 = SSH(out_channels, out_channels) self.ssh3 = SSH(out_channels, out_channels) self.ClassHead = self._make_class_head(fpn_num=3, inchannels=cfg['out_channel']) self.BboxHead = self._make_bbox_head(fpn_num=3, inchannels=cfg['out_channel']) self.LandmarkHead = self._make_landmark_head( fpn_num=3, inchannels=cfg['out_channel'])
def __init__(self, cfg = None, phase = 'train'): """ :param cfg: Network related settings. :param phase: train or test. """ super(RetinaFace,self).__init__() self.phase = phase backbone = None if cfg['name'] == 'mobilenet0.25': backbone = MobileNetV1() if cfg['pretrain']: checkpoint = torch.load("./weights/mobilenetV1X0.25_pretrain.tar", map_location=torch.device('cpu')) from collections import OrderedDict new_state_dict = OrderedDict() for k, v in checkpoint['state_dict'].items(): name = k[7:] # remove module. new_state_dict[name] = v # load params backbone.load_state_dict(new_state_dict) elif cfg['name'] == 'Resnet50': import torchvision.models as models backbone = models.resnet50(pretrained=cfg['pretrain']) elif cfg['name'] == 'detnas': print('You were using DetNas as backbone, this is exprimental, may not work.') self.backbone = ShuffleNetV2DetNAS(model_size='VOC_RetinaNet_300M') detnas_pretrained = 'pretrained/VOC_RetinaNet_300M.pkl' if os.path.exists(detnas_pretrained): checkpoint = torch.load("VOC_RetinaNet_300M.pkl", map_location=torch.device('cpu')) else: print('{} does not exist, pls download it so that DetNas can be used. see readme under pretrained/') exit(0) self.backbone.load_state_dict(checkpoint) self.backbone = self.backbone.features return_layers = {'6': 1, '9': 2, '16': 3} in_channels_stage2 = 80 self.body = _utils.IntermediateLayerGetter(backbone, cfg['return_layers']) in_channels_stage2 = cfg['in_channel'] in_channels_list = [ in_channels_stage2 * 2, in_channels_stage2 * 4, in_channels_stage2 * 8, ] out_channels = cfg['out_channel'] self.fpn = FPN(in_channels_list,out_channels) self.ssh1 = SSH(out_channels, out_channels) self.ssh2 = SSH(out_channels, out_channels) self.ssh3 = SSH(out_channels, out_channels) self.ClassHead = self._make_class_head(fpn_num=3, inchannels=cfg['out_channel']) self.BboxHead = self._make_bbox_head(fpn_num=3, inchannels=cfg['out_channel']) self.LandmarkHead = self._make_landmark_head(fpn_num=3, inchannels=cfg['out_channel'])
def __init__(self, cfg=None, phase='train'): """ :param cfg: Network related settings. :param phase: train or test. """ super(RetinaFace, self).__init__() self.phase = phase backbone = None if cfg['name'] == 'mobilenet0.25': backbone = MobileNetV1() if cfg['pretrain']: # 改成绝对路径 checkpoint = torch.load(os.path.join( base_config.root_dir, r"core\weights\retinaface\mobilenetV1X0.25_pretrain.tar"), map_location=torch.device('cpu')) from collections import OrderedDict new_state_dict = OrderedDict() for k, v in checkpoint['state_dict'].items(): name = k[7:] # remove module. new_state_dict[name] = v # load params backbone.load_state_dict(new_state_dict) elif cfg['name'] == 'Resnet50': import torchvision.models as models backbone = models.resnet50(pretrained=cfg['pretrain']) self.body = _utils.IntermediateLayerGetter(backbone, cfg['return_layers']) in_channels_stage2 = cfg['in_channel'] in_channels_list = [ in_channels_stage2 * 2, in_channels_stage2 * 4, in_channels_stage2 * 8, ] out_channels = cfg['out_channel'] self.fpn = FPN(in_channels_list, out_channels) self.ssh1 = SSH(out_channels, out_channels) self.ssh2 = SSH(out_channels, out_channels) self.ssh3 = SSH(out_channels, out_channels) self.ClassHead = self._make_class_head(fpn_num=3, inchannels=cfg['out_channel']) self.BboxHead = self._make_bbox_head(fpn_num=3, inchannels=cfg['out_channel']) self.LandmarkHead = self._make_landmark_head( fpn_num=3, inchannels=cfg['out_channel'])
def __init__(self, cfg=None, phase="train"): """ :param cfg: Network related settings. :param phase: train or test. """ super(RetinaFace, self).__init__() self.phase = phase backbone = None if cfg["name"] == "mobilenet0.25": backbone = MobileNetV1() if cfg["pretrain"]: checkpoint = torch.load( "./weights/mobilenetV1X0.25_pretrain.tar", map_location=torch.device("cpu"), ) from collections import OrderedDict new_state_dict = OrderedDict() for k, v in checkpoint["state_dict"].items(): name = k[7:] # remove module. new_state_dict[name] = v # load params backbone.load_state_dict(new_state_dict) elif cfg["name"] == "Resnet50": import torchvision.models as models backbone = models.resnet50(pretrained=cfg["pretrain"]) self.body = _utils.IntermediateLayerGetter(backbone, cfg["return_layers"]) in_channels_stage2 = cfg["in_channel"] in_channels_list = [ in_channels_stage2 * 2, in_channels_stage2 * 4, in_channels_stage2 * 8, ] out_channels = cfg["out_channel"] self.fpn = FPN(in_channels_list, out_channels) self.ssh1 = SSH(out_channels, out_channels) self.ssh2 = SSH(out_channels, out_channels) self.ssh3 = SSH(out_channels, out_channels) self.ClassHead = self._make_class_head(fpn_num=3, inchannels=cfg["out_channel"]) self.BboxHead = self._make_bbox_head(fpn_num=3, inchannels=cfg["out_channel"]) self.LandmarkHead = self._make_landmark_head( fpn_num=3, inchannels=cfg["out_channel"] )
def __init__(self, cfg=None, phase='train'): """ :param cfg: Network related settings. :param phase: train or test. """ super(RetinaFace, self).__init__() self.phase = phase in_channels_list = self._make_body(cfg) out_channels = cfg['out_channel'] self.fpn = FPN(in_channels_list, out_channels) self.ssh1 = SSH(out_channels, out_channels) self.ssh2 = SSH(out_channels, out_channels) self.ssh3 = SSH(out_channels, out_channels) self.ClassHead = self._make_class_head(fpn_num=3, inchannels=cfg['out_channel']) self.BboxHead = self._make_bbox_head(fpn_num=3, inchannels=cfg['out_channel']) self.LandmarkHead = self._make_landmark_head( fpn_num=3, inchannels=cfg['out_channel'])
def __init__(self, cfg=None, phase='train'): """ :param cfg: Network related settings. :param phase: train or test. """ super(RetinaFace, self).__init__() self.phase = phase backbone = None if cfg['name'] == 'mobilenet0.25': backbone = MobileNetV1() if cfg['pretrain']: checkpoint = torch.load( "./weights/mobilenetV1X0.25_pretrain.tar", map_location=torch.device('cpu')) from collections import OrderedDict new_state_dict = OrderedDict() for k, v in checkpoint['state_dict'].items(): name = k[7:] # remove module. new_state_dict[name] = v # load params backbone.load_state_dict(new_state_dict) elif cfg['name'] == 'Resnet50': import torchvision.models as models backbone = models.resnet50(pretrained=cfg['pretrain']) # 获取中间层输出 self.body = _utils.IntermediateLayerGetter(backbone, cfg['return_layers']) in_channels_stage2 = cfg['in_channel'] in_channels_list = [ in_channels_stage2 * 2, in_channels_stage2 * 4, in_channels_stage2 * 8, ] out_channels = cfg['out_channel'] self.fpn = FPN(in_channels_list, out_channels) self.ssh1 = SSH(out_channels, out_channels) self.ssh2 = SSH(out_channels, out_channels) self.ssh3 = SSH(out_channels, out_channels) # 参考口罩分支,ssh单独新建 self.ssh1_pose = SSH(out_channels, out_channels) self.ssh2_pose = SSH(out_channels, out_channels) self.ssh3_pose = SSH(out_channels, out_channels) # 对应ssh 的 框-关键点-2分类 self.ClassHead = self._make_class_head(fpn_num=3, inchannels=cfg['out_channel']) self.BboxHead = self._make_bbox_head(fpn_num=3, inchannels=cfg['out_channel']) self.LandmarkHead = self._make_landmark_head( fpn_num=3, inchannels=cfg['out_channel']) # 对应ssh_pose 的 yaw-pitch-roll 的 3个66分类 self.Pose_yaw_Head = self._make_pose_yaw_pitch_roll_head( fpn_num=3, inchannels=cfg['out_channel']) self.Pose_pitch_Head = self._make_pose_yaw_pitch_roll_head( fpn_num=3, inchannels=cfg['out_channel']) self.Pose_roll_Head = self._make_pose_yaw_pitch_roll_head( fpn_num=3, inchannels=cfg['out_channel'])
def __init__( self, # cfg = None, phase='train', decode_boxes: bool = False, backbone=None, # Network Configuration return_layers: Dict[str, int] = { 'stage1': '1', 'stage2': '2', 'stage3': '3' }, in_channel: int = 32, out_channel: int = 64, min_sizes_list: List[Tuple[int, int]] = [(16, 32), (64, 128), (256, 512)], steps: List[int] = [8, 16, 32], clip: bool = False, image_size: Optional[Tuple[int, int]] = None, # Decoding Configuration variances: List[float] = [0.1, 0.2], resize: int = 1, confidence_threshold: float = 0.02, nms_threshold: float = 0.4, ): """ :param cfg: Network related settings. :param phase: train or test. """ super(RetinaFaceModified, self).__init__() self.phase = phase # self.cfg = cfg # Set config self.decode_boxes = decode_boxes self.min_sizes_list = min_sizes_list self.steps = steps self.clip = clip self.image_size = image_size self.variances = variances self.resize = resize self.confidence_threshold = confidence_threshold self.nms_threshold = nms_threshold if self.image_size is not None: self.prior_boxes = prior_box( torch.tensor(self.image_size).float(), self.min_sizes_list, self.steps, self.clip) else: self.prior_boxes = None self.body = _utils.IntermediateLayerGetter(backbone, return_layers) in_channels_stage2 = in_channel in_channels_list = [ in_channels_stage2 * 2, in_channels_stage2 * 4, in_channels_stage2 * 8, ] out_channels = out_channel self.fpn = FPN(in_channels_list, out_channels) self.ssh1 = SSH(out_channels, out_channels) self.ssh2 = SSH(out_channels, out_channels) self.ssh3 = SSH(out_channels, out_channels) self.ClassHead = self._make_class_head(fpn_num=3, inchannels=out_channel) self.BboxHead = self._make_bbox_head(fpn_num=3, inchannels=out_channel) self.LandmarkHead = self._make_landmark_head(fpn_num=3, inchannels=out_channel)
def __init__(self, cfg=None, phase='train'): """ :param cfg: Network related settings. :param phase: train or test. """ super(RetinaFace, self).__init__() self.phase = phase backbone = None if cfg['name'] == 'mobilenet0.25': backbone = MobileNetV1() if cfg['pretrain']: checkpoint = torch.load( "./weights/mobilenetV1X0.25_pretrain.tar", map_location=torch.device('cpu')) from collections import OrderedDict new_state_dict = OrderedDict() for k, v in checkpoint['state_dict'].items(): name = k[7:] # remove module. new_state_dict[name] = v # load params backbone.load_state_dict(new_state_dict) self.body = _utils.IntermediateLayerGetter(backbone, cfg['return_layers']) in_channels_stage2 = cfg['in_channel'] in_channels_list = [ in_channels_stage2 * 2, in_channels_stage2 * 4, in_channels_stage2 * 8, ] elif cfg['name'] == 'Resnet50': import torchvision.models as models backbone = models.resnet50(pretrained=cfg['pretrain']) self.body = _utils.IntermediateLayerGetter(backbone, cfg['return_layers']) in_channels_stage2 = cfg['in_channel'] in_channels_list = [ in_channels_stage2 * 2, in_channels_stage2 * 4, in_channels_stage2 * 8, ] elif cfg['name'] == 'selecsls60': self.body = timm.create_model('selecsls60', features_only=True, out_indices=(cfg['return_layers']), pretrained=cfg['pretrain']) in_channels_list = self.body.feature_info.channels() elif cfg['name'] == 'mobilenetv3_large_100': self.body = timm.create_model('mobilenetv3_large_100', features_only=True, out_indices=(cfg['return_layers']), pretrained=cfg['pretrain']) in_channels_list = self.body.feature_info.channels() out_channels = cfg['out_channel'] self.fpn = FPN(in_channels_list, out_channels) self.ssh1 = SSH(out_channels, out_channels) self.ssh2 = SSH(out_channels, out_channels) self.ssh3 = SSH(out_channels, out_channels) self.ClassHead = self._make_class_head(fpn_num=3, inchannels=cfg['out_channel']) self.BboxHead = self._make_bbox_head(fpn_num=3, inchannels=cfg['out_channel']) self.LandmarkHead = self._make_landmark_head( fpn_num=3, inchannels=cfg['out_channel'])
def __init__(self, cfg=None, phase='train'): """ :param cfg: Network related settings. :param phase: train or test. """ super(RetinaFace, self).__init__() self.phase = phase backbone = None if cfg['name'] == 'mobilenet0.25': backbone = MobileNetV1() if cfg['pretrain']: checkpoint = torch.load( "./weights/mobilenetV1X0.25_pretrain.tar", map_location=torch.device('cpu')) from collections import OrderedDict new_state_dict = OrderedDict() for k, v in checkpoint['state_dict'].items(): name = k[7:] # remove module. new_state_dict[name] = v # load params backbone.load_state_dict(new_state_dict) elif cfg['name'] == 'Resnet50': import torchvision.models as models backbone = models.resnet50(pretrained=cfg['pretrain']) elif cfg['name'] == 'mobilenetv3': backbone = MobileNetV3() # bbweight = backbone.state_dict() # layername = [] # oldln = [] # for i,key in enumerate(bbweight): # print("Layer {} : {}; Size : {}".format(i,key,bbweight[key].size())) # layername.append(key) # cpk = torch.load("/home/hwits/Documents/ImageRetrieval/mobilenetv3/mbv3_small.pth.tar")['state_dict'] # # print(cpk.keys()) # print(cpk['epoch']) # print("="*200) # for i,key in enumerate(cpk): # print("Old Layer {} : {}; Size : {}".format(i,key,cpk[key].size())) # if i < len(layername): # oldln.append(key) # print(bbweight.keys()) # print(oldln) # # import collections # mbv3_cpk = collections.OrderedDict() # for i in range(len(layername)): # mbv3_cpk[layername[i]] = cpk[oldln[i]] # # torch.save(mbv3_cpk,"mobilenetv3_truck.pth") if cfg['pretrain']: checkpoint = torch.load("./weights/mobilenetv3_truck.pth", map_location=torch.device('cpu')) print("Loading Pretrained Weights ...") backbone.load_state_dict(checkpoint) elif cfg['name'] == 'mobilenetv2_0.1': backbone = MobileNetV2() if cfg['pretrain']: checkpoint = torch.load("./weights/mobilenetv2_0.1_face.pth", map_location=torch.device('cpu')) model_dict = backbone.state_dict() pretrained_dict = { k: v for k, v in checkpoint.items() if k in model_dict } # 用于过滤掉修改结构处的权重 model_dict.update(pretrained_dict) # print("Pre-Trained:",pretrained_dict.keys()) backbone.load_state_dict(model_dict) elif cfg['name'] == 'efficientnetb0': backbone = EfficientNet.from_name("efficientnet-b0") if cfg['pretrain']: checkpoint = torch.load("./weights/efficientnetb0_face.pth", map_location=torch.device('cpu')) backbone.load_state_dict(checkpoint) print("succeed loaded weights...") self.body = _utils.IntermediateLayerGetter(backbone, cfg['return_layers']) if cfg['name'] == 'mobilenet0.25': in_channels_stage2 = cfg['in_channel'] in_channels_list = [ # in_channels_stage2 * 2, in_channels_stage2 * 4, in_channels_stage2 * 8, ] elif cfg['name'] == 'mobilenetv2_0.1': in_channels_stage3 = cfg['in_channel3'] in_channels_stage4 = cfg['in_channel4'] in_channels_list = [in_channels_stage3, in_channels_stage4] elif cfg['name'] == 'mobilenetv3': in_channels_stage1 = cfg['in_channel0'] in_channels_stage2 = cfg['in_channel1'] in_channels_stage3 = cfg['in_channel2'] in_channels_list = [ in_channels_stage1, in_channels_stage2, in_channels_stage3, ] elif cfg['name'] == 'efficientnetb0': # in_channels_stage2 = cfg['in_channel1'] in_channels_stage3 = cfg['in_channel2'] in_channels_list = [ # in_channels_stage2 * 2, # in_channels_stage2, in_channels_stage3, ] out_channels = cfg['out_channel'] self.pan = PAN(in_channels_list, out_channels) self.ssh1 = SSH(out_channels, out_channels) self.ssh2 = SSH(out_channels, out_channels) self.ssh3 = SSH(out_channels, out_channels) self.ClassHead = self._make_class_head(fpn_num=3, inchannels=cfg['out_channel']) self.BboxHead = self._make_bbox_head(fpn_num=3, inchannels=cfg['out_channel']) self.LandmarkHead = self._make_landmark_head( fpn_num=3, inchannels=cfg['out_channel'])
def __init__(self, cfg = None, phase = 'train'): """ :param cfg: Network related settings. :param phase: train or test. """ super(RetinaFace,self).__init__() self.phase = phase backbone = None if cfg['name'] == 'mobilenet0.25': backbone = MobileNetV1() if cfg['pretrain']: checkpoint = torch.load("./weights/mobilenetV1X0.25_pretrain.tar", map_location=torch.device('cpu')) from collections import OrderedDict new_state_dict = OrderedDict() for k, v in checkpoint['state_dict'].items(): name = k[7:] # remove module. new_state_dict[name] = v # load params backbone.load_state_dict(new_state_dict) elif cfg['name'] == 'Resnet50': import torchvision.models as models backbone = models.resnet50(pretrained=cfg['pretrain']) elif cfg['name'] == 'mobilenetv3': backbone = MobileNetV3() # print(backbone) if cfg['pretrain']: checkpoint = torch.load("./weights/mobilenetv3.pth", map_location=torch.device('cpu')) print("Pretrained Weights : ",type(checkpoint)) backbone.load_state_dict(checkpoint) elif cfg['name'] == 'mobilenetv2_0.1': backbone = MobileNetV2() if cfg['pretrain']: checkpoint = torch.load("./weights/mobilenetv2_0.1_face.pth", map_location=torch.device('cpu')) backbone.load_state_dict(checkpoint) elif cfg['name'] == 'efficientnetb0': backbone = EfficientNet.from_name("efficientnet-b0") if cfg['pretrain']: checkpoint = torch.load("./weights/efficientnetb0_face.pth", map_location=torch.device('cpu')) backbone.load_state_dict(checkpoint) print("succeed loaded weights...") self.body = _utils.IntermediateLayerGetter(backbone, cfg['return_layers']) if cfg['name'] == 'mobilenet0.25': in_channels_stage2 = cfg['in_channel'] in_channels_list = [ # in_channels_stage2 * 2, in_channels_stage2*4, in_channels_stage2*8, ] elif cfg['name'] == 'mobilenetv2_0.1': in_channels_stage2 = cfg['in_channel1'] in_channels_stage3 = cfg['in_channel2'] in_channels_list = [ # in_channels_stage2 * 2, in_channels_stage2, in_channels_stage3, ] elif cfg['name'] == 'mobilenetv3': in_channels_stage2 = cfg['in_channel1'] in_channels_stage3 = cfg['in_channel2'] in_channels_list = [ # in_channels_stage2 * 2, in_channels_stage2, in_channels_stage3, ] elif cfg['name'] == 'efficientnetb0': in_channels_stage2 = cfg['in_channel1'] in_channels_stage3 = cfg['in_channel2'] in_channels_list = [ # in_channels_stage2 * 2, in_channels_stage2, in_channels_stage3, ] out_channels = cfg['out_channel'] self.fpn = FPN(in_channels_list,out_channels) # self.ssh1 = SSH(out_channels, out_channels) self.ssh2 = SSH(out_channels, out_channels) self.ssh3 = SSH(out_channels, out_channels) self.ClassHead = self._make_class_head(fpn_num=2, inchannels=cfg['out_channel']) self.BboxHead = self._make_bbox_head(fpn_num=2, inchannels=cfg['out_channel']) self.LandmarkHead = self._make_landmark_head(fpn_num=2, inchannels=cfg['out_channel'])