Ejemplo n.º 1
0
def lift_2d_to_3d(records, model, stats, template, cuda=True):
    """
    Foward-pass of the lifter model.
    """
    for path in records.keys():
        data = np.concatenate(records[path]['kpts_2d_pred'], axis=0)
        data = nop.normalize_1d(data, stats['mean_in'], stats['std_in'])
        data = data.astype(np.float32)
        data = torch.from_numpy(data)
        if cuda:
            data = data.cuda()
        prediction = model(data)
        prediction = nop.unnormalize_1d(prediction.data.cpu().numpy(),
                                        stats['mean_out'], stats['std_out'])
        records[path]['kpts_3d_pred'] = prediction.reshape(
            len(prediction), -1, 3)
    return records
Ejemplo n.º 2
0
 def unnormalize(self, data, mean, std):
     return nop.unnormalize_1d(data, mean, std)