MCPcopy Create free account
hub / github.com/Vegetebird/GraphMLP / get_pose2D

Function get_pose2D

demo/vis.py:97–114  ·  view source on GitHub ↗
(video_path, output_dir)

Source from the content-addressed store, hash-verified

95
96
97def 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
117def img2video(video_path, output_dir):

Callers 1

vis.pyFile · 0.85

Calls 2

h36m_coco_formatFunction · 0.90
revise_kptsFunction · 0.90

Tested by

no test coverage detected