def __init__(self): super(IDLoss, self).__init__() print('Loading ResNet ArcFace') self.facenet = Backbone(input_size=112, num_layers=50, drop_ratio=0.6, mode='ir_se') self.facenet.load_state_dict(torch.load(model_paths['ir_se50'])) self.face_pool = torch.nn.AdaptiveAvgPool2d((112, 112)) self.facenet.eval()
def __init__(self): super(IDLoss, self).__init__() print('Loading ResNet ArcFace') self.facenet = Backbone(input_size=112, num_layers=50, drop_ratio=0.6, mode='ir_se') self.facenet.load_state_dict(torch.load(model_paths['ir_se50'])) self.face_pool = torch.nn.AdaptiveAvgPool2d((112, 112)) self.facenet.eval() for module in [self.facenet, self.face_pool]: for param in module.parameters(): param.requires_grad = False