Ejemplo n.º 1
0
  def forward(self, x):
    #x = self.dropout1(self.relu1(self.fc1(x)))
    #x = self.dropout2(self.relu2(self.fc2(x)))
    x = self.relu1(self.fc1(x))
    x = self.relu2(self.fc2(x))
    x = self.fc3(x)
    return x

# if __name__ == '__main__':
    config = get_config()
    template_mesh = Mesh(filename='./flame_model/FLAME_sample.ply')
    renderer = vis_util.SMPLRenderer(faces=template_mesh.f)

    if not os.path.exists(config.out_folder):
        os.makedirs(config.out_folder)

    if not os.path.exists(config.out_folder + '/images'):
        os.mkdir(config.out_folder + '/images')

    main(config, template_mesh)
Ejemplo n.º 2
0
        id_txt='subjects_id.txt',
        R=6,
        transform=composed_transforms)

    if need_evaluate:
        resnet50 = torch.load("./resnet50.pkl")
    else:
        resnet50 = models.resnet50(pretrained=True)
    resnet50.cuda()
    resnet50.fc = Identity()
    if need_evaluate:
        regression = torch.load("./model.pkl")
    else:
        regression = Regression()
    regression.cuda()
    config = get_config()
    flamelayer = FLAME(config)
    flamelayer.requires_grad_ = False
    flamelayer.cuda()

    # ringnet = SingleRingnet(resnet50, regression, flamelayer)
    # ringnet.apply(weight_init)
    # ringnet.cuda()

    optimizer_reg = torch.optim.Adam(regression.parameters(), lr=learning_rate)
    optimizer_res = torch.optim.Adam(resnet50.parameters(), lr=learning_rate)
    scheduler_reg = torch.optim.lr_scheduler.StepLR(optimizer_reg, step_size=5)
    scheduler_res = torch.optim.lr_scheduler.StepLR(optimizer_res, step_size=5)

    # img = dataset[0]['images'][0].permute(1,2,0).numpy()
    # img = dataset[0]['images'][0].permute(1,2,0)