Esempio n. 1
0
                                                     self.normalize)).float(),
            'kp_2d':
            torch.tensor(kps).float(),
            'image_name':
            self.images[index],
            'data_set':
            'lsp'
        }


if __name__ == '__main__':
    lsp = LspLoader(
        data_set_path='/home/ubuntu/anaconda3/envs/hmr/pytorch_HMR/data/lsp/',
        use_crop=True,
        scale_range=[1.05, 1.2],
        use_flip=True,
        flip_prob=1.0)
    l = lsp.__len__()
    data_loader = DataLoader(lsp, batch_size=10, shuffle=True)
    for _ in range(l):
        r = lsp.__getitem__(_)
        image = r['image'].cpu().numpy().astype(np.uint8)
        kps = r['kp_2d'].cpu().numpy()
        kps[:, :2] = (kps[:, :2] + 1) * args.crop_size / 2.0
        base_name = os.path.basename(r['image_name'])
        draw_lsp_14kp__bone(image, kps)
        cv2.imshow(
            base_name,
            cv2.resize(image, (512, 512), interpolation=cv2.INTER_CUBIC))
        cv2.waitKey(0)
                                                     self.normalize)).float(),
            'kp_2d':
            torch.from_numpy(kps).float(),
            'kp_3d':
            torch.from_numpy(kp_3d).float(),
            'theta':
            torch.zeros(85).float(),
            'image_name':
            self.images[index],
            'w_smpl':
            0.0,
            'w_3d':
            1.0,
            'data_set':
            'mpi inf 3dhp'
        }


if __name__ == '__main__':
    mpi = mpi_inf_3dhp_dataloader('E:/HMR/data/mpii_inf_3dhp', True,
                                  [1.1, 2.0], False, 5)
    l = len(mpi)
    for _ in range(l):
        r = mpi.__getitem__(_)
        base_name = os.path.basename(r['image_name'])
        draw_lsp_14kp__bone(r['image'], r['kp_2d'])
        cv2.imshow(
            base_name,
            cv2.resize(r['image'], (512, 512), interpolation=cv2.INTER_CUBIC))
        cv2.waitKey(0)