(video_path, output_dir)
| 95 | |
| 96 | |
| 97 | def get_pose2D(video_path, output_dir): |
| 98 | cap = cv2.VideoCapture(video_path) |
| 99 | width = cap.get(cv2.CAP_PROP_FRAME_WIDTH) |
| 100 | height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT) |
| 101 | |
| 102 | print('\nGenerating 2D pose...') |
| 103 | with torch.no_grad(): |
| 104 | # the first frame of the video should be detected a person |
| 105 | keypoints, scores = hrnet_pose(video_path, det_dim=416, num_peroson=1, gen_output=True) |
| 106 | keypoints, scores, valid_frames = h36m_coco_format(keypoints, scores) |
| 107 | re_kpts = revise_kpts(keypoints, scores, valid_frames) |
| 108 | print('Generating 2D pose successfully!') |
| 109 | |
| 110 | output_dir += 'input_2D/' |
| 111 | os.makedirs(output_dir, exist_ok=True) |
| 112 | |
| 113 | output_npz = output_dir + 'input_keypoints_2d.npz' |
| 114 | np.savez_compressed(output_npz, reconstruction=keypoints) |
| 115 | |
| 116 | |
| 117 | def img2video(video_path, output_dir): |
no test coverage detected