Loading Dataset
%load_ext autoreload
%autoreload 2
%matplotlib inline
get_actions('all')
train_h36 = Human36Dataset(get_actions('Greeting'), data_path, is_train=True)
test_h36 = Human36Dataset(get_actions('Greeting'), data_path, is_train=False)
len(train_h36), len(test_h36)
rcams = torch.load(data_path/'rcams.pt')
stat_2d = torch.load(data_path/'stat_2d.pt')
mean_2d = stat_2d['mean']
std_2d = stat_2d['std']
dim_use_2d = stat_2d['dim_use']
dim_ignore_2d = stat_2d['dim_ignore']
stat_3d = torch.load(data_path/'stat_3d.pt')
mean_3d = stat_3d['mean']
std_3d = stat_3d['std']
dim_use_3d = stat_3d['dim_use']
dim_ignore_3d = stat_3d['dim_ignore']
idx = 2000
train_2d = train_h36[idx][0].reshape(1, -1)
train_3d = train_h36[idx][1].reshape(1, -1)
train_key = train_h36.get_key(idx)
test_2d = test_h36[idx][0].reshape(1, -1)
test_3d = test_h36[idx][1].reshape(1, -1)
test_key = test_h36.get_key(idx)
ts_2d = unnormalize_data(train_2d, mean_2d, std_2d, dim_ignore_2d)
ts_3d = unnormalize_data(train_3d, mean_3d, std_3d, dim_ignore_3d)
ts_3d = cam_to_world_centered(ts_3d, train_key, rcams)
train_2d
plt.figure(figsize=(16,6))
gs2 = GridSpec(1,2)
ax1 = plt.subplot(gs2[0])
ax2 = plt.subplot(gs2[1], projection='3d')
show_2d_pose(ts_2d, ax1)
ax1.invert_yaxis()
show_3d_pose(ts_3d, ax2)
plt.show()
plt.figure(figsize=(16,6))
gs2 = GridSpec(1,2)
ax1 = plt.subplot(gs2[0])
ax2 = plt.subplot(gs2[1], projection='3d')
ts_2d = unnormalize_data(test_2d, mean_2d, std_2d, dim_ignore_2d)
ts_3d = unnormalize_data(test_3d, mean_3d, std_3d, dim_ignore_3d)
ts_3d = cam_to_world_centered(ts_3d, test_key, rcams)
show_2d_pose(ts_2d, ax1)
ax1.invert_yaxis()
show_3d_pose(ts_3d, ax2)
plt.show()