Spaces:
Sleeping
Sleeping
votuongquan2004@gmail.com
commited on
Commit
•
6a50ac1
1
Parent(s):
aaa2ffd
update data.py
Browse files- utils/data.py +8 -8
utils/data.py
CHANGED
@@ -162,20 +162,20 @@ def preprocess(
|
|
162 |
inputs = extract_joints(source=source, keypoints_detector=keypoints_detector)
|
163 |
|
164 |
T = inputs.shape[1]
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
|
170 |
if random_choose:
|
171 |
inputs = random_sample_np(inputs, window_size)
|
172 |
else:
|
173 |
inputs = uniform_sample_np(inputs, window_size)
|
174 |
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
|
180 |
return np.squeeze(inputs).transpose(1, 2, 0).astype(np.float32)
|
181 |
|
|
|
162 |
inputs = extract_joints(source=source, keypoints_detector=keypoints_detector)
|
163 |
|
164 |
T = inputs.shape[1]
|
165 |
+
ori_data = inputs
|
166 |
+
for t in range(T - 1):
|
167 |
+
inputs[:, t, :, :] = ori_data[:, t + 1, :, :] - ori_data[:, t, :, :]
|
168 |
+
inputs[:, T - 1, :, :] = 0
|
169 |
|
170 |
if random_choose:
|
171 |
inputs = random_sample_np(inputs, window_size)
|
172 |
else:
|
173 |
inputs = uniform_sample_np(inputs, window_size)
|
174 |
|
175 |
+
if normalization:
|
176 |
+
assert inputs.shape[0] == 3
|
177 |
+
inputs[0, :, :, :] = inputs[0, :, :, :] - inputs[0, :, 0, 0].mean(axis=0)
|
178 |
+
inputs[1, :, :, :] = inputs[1, :, :, :] - inputs[1, :, 0, 0].mean(axis=0)
|
179 |
|
180 |
return np.squeeze(inputs).transpose(1, 2, 0).astype(np.float32)
|
181 |
|