votuongquan2004@gmail.com commited on
Commit
9340af3
1 Parent(s): 0817cbf

update data.py

Browse files
VSL_SAM_SLR_V2.onnx → VSL_SAM_SLR_V2_bone.onnx RENAMED
File without changes
utils/data.py CHANGED
@@ -13,6 +13,7 @@ SELECTED_JOINTS = {
13
  }
14
 
15
 
 
16
  def pad(joints: np.ndarray, num_frames: int = 150) -> np.ndarray:
17
  '''
18
  Add padding to the joints.
@@ -161,21 +162,21 @@ def preprocess(
161
  '''
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 inputs[np.newaxis, :].astype(np.float32)
181
 
 
13
  }
14
 
15
 
16
+
17
  def pad(joints: np.ndarray, num_frames: int = 150) -> np.ndarray:
18
  '''
19
  Add padding to the joints.
 
162
  '''
163
  inputs = extract_joints(source=source, keypoints_detector=keypoints_detector)
164
 
165
+ # T = inputs.shape[1]
166
+ # ori_data = inputs
167
+ # for t in range(T - 1):
168
+ # inputs[:, t, :, :] = ori_data[:, t + 1, :, :] - ori_data[:, t, :, :]
169
+ # inputs[:, T - 1, :, :] = 0
170
 
171
  if random_choose:
172
  inputs = random_sample_np(inputs, window_size)
173
  else:
174
  inputs = uniform_sample_np(inputs, window_size)
175
 
176
+ # if normalization:
177
+ # assert inputs.shape[0] == 3
178
+ # inputs[0, :, :, :] = inputs[0, :, :, :] - inputs[0, :, 0, 0].mean(axis=0)
179
+ # inputs[1, :, :, :] = inputs[1, :, :, :] - inputs[1, :, 0, 0].mean(axis=0)
180
 
181
  return inputs[np.newaxis, :].astype(np.float32)
182