nexusbert commited on
Commit
d502a81
·
1 Parent(s): 22ff065
Files changed (1) hide show
  1. smpl_generator.py +39 -30
smpl_generator.py CHANGED
@@ -155,51 +155,60 @@ class SMPLGenerator:
155
 
156
  batch_size = betas.shape[0]
157
 
 
 
 
 
 
 
 
 
158
  if body_pose is None:
159
  body_pose = torch.zeros([batch_size, 69], device=self.device)
160
 
161
- left_shoulder_adduction = 0.25
162
- right_shoulder_adduction = -0.25
163
-
164
- left_shoulder_extension = -0.10
165
- right_shoulder_extension = -0.10
 
 
 
 
 
 
 
166
 
167
- left_shoulder_twist = 0.05
168
- right_shoulder_twist = -0.05
169
 
170
- left_elbow_flexion = 0.18
171
- right_elbow_flexion = 0.18
172
 
173
- left_foot_outward = 0.18
174
- right_foot_outward = -0.18
175
 
176
- left_ankle_dorsiflex = 0.05
177
- right_ankle_dorsiflex = 0.05
 
178
 
179
- body_pose[0, 16] = left_shoulder_adduction
180
- body_pose[0, 17] = left_shoulder_extension
181
- body_pose[0, 22] = left_shoulder_twist
182
 
183
- body_pose[0, 18] = right_shoulder_adduction
184
- body_pose[0, 19] = right_shoulder_extension
185
- body_pose[0, 23] = right_shoulder_twist
186
 
187
- body_pose[0, 20] = left_elbow_flexion
188
- body_pose[0, 21] = right_elbow_flexion
189
 
190
- body_pose[0, 26] = left_ankle_dorsiflex
191
- body_pose[0, 27] = left_foot_outward
192
 
193
- body_pose[0, 24] = right_ankle_dorsiflex
194
- body_pose[0, 25] = right_foot_outward
195
  elif isinstance(body_pose, np.ndarray):
196
  body_pose = torch.FloatTensor(body_pose).to(self.device)
197
 
198
- if global_orient is None:
199
- global_orient = torch.zeros([batch_size, 3], device=self.device)
200
- elif isinstance(global_orient, np.ndarray):
201
- global_orient = torch.FloatTensor(global_orient).to(self.device)
202
-
203
  if transl is None:
204
  transl = torch.zeros([batch_size, 3], device=self.device)
205
  elif isinstance(transl, np.ndarray):
 
155
 
156
  batch_size = betas.shape[0]
157
 
158
+ if global_orient is None:
159
+ global_orient = torch.zeros([batch_size, 3], device=self.device)
160
+ global_orient[0, 0] = np.radians(2)
161
+ global_orient[0, 1] = np.radians(-2)
162
+ global_orient[0, 2] = 0.0
163
+ elif isinstance(global_orient, np.ndarray):
164
+ global_orient = torch.FloatTensor(global_orient).to(self.device)
165
+
166
  if body_pose is None:
167
  body_pose = torch.zeros([batch_size, 69], device=self.device)
168
 
169
+ shoulder_down = np.radians(-18)
170
+ shoulder_forward = np.radians(4)
171
+ shoulder_out = np.radians(6)
172
+ elbow_bend = np.radians(10)
173
+ wrist_rot = np.radians(5)
174
+ hip_external = np.radians(5)
175
+ hip_flex = np.radians(2)
176
+ hip_drop = np.radians(-1)
177
+ knee_bend = np.radians(3)
178
+ ankle_dorsi = np.radians(3)
179
+ ankle_roll = np.radians(1)
180
+ toe_up = np.radians(2)
181
 
182
+ body_pose[0, 6:9] = torch.tensor([shoulder_down, shoulder_out, shoulder_forward], device=self.device)
183
+ body_pose[0, 9:12] = torch.tensor([shoulder_down, -shoulder_out, -shoulder_forward], device=self.device)
184
 
185
+ body_pose[0, 12:15] = torch.tensor([0, elbow_bend, 0], device=self.device)
186
+ body_pose[0, 15:18] = torch.tensor([0, elbow_bend, 0], device=self.device)
187
 
188
+ body_pose[0, 18:21] = torch.tensor([0, 0, wrist_rot], device=self.device)
189
+ body_pose[0, 21:24] = torch.tensor([0, 0, -wrist_rot], device=self.device)
190
 
191
+ body_pose[0, 24:27] = torch.tensor([np.radians(-3), np.radians(1), 0], device=self.device)
192
+ body_pose[0, 27:30] = torch.tensor([np.radians(2), 0, 0], device=self.device)
193
+ body_pose[0, 30:33] = torch.tensor([np.radians(-1), 0, 0], device=self.device)
194
 
195
+ body_pose[0, 33:36] = torch.tensor([np.radians(3), 0, 0], device=self.device)
196
+ body_pose[0, 36:39] = torch.tensor([np.radians(-2), 0, 0], device=self.device)
 
197
 
198
+ body_pose[0, 39:42] = torch.tensor([hip_flex, hip_external, hip_drop], device=self.device)
199
+ body_pose[0, 42:45] = torch.tensor([hip_flex, -hip_external, -hip_drop], device=self.device)
 
200
 
201
+ body_pose[0, 45:48] = torch.tensor([0, knee_bend, 0], device=self.device)
202
+ body_pose[0, 48:51] = torch.tensor([0, knee_bend, 0], device=self.device)
203
 
204
+ body_pose[0, 51:54] = torch.tensor([ankle_dorsi, ankle_roll, 0], device=self.device)
205
+ body_pose[0, 54:57] = torch.tensor([ankle_dorsi, -ankle_roll, 0], device=self.device)
206
 
207
+ body_pose[0, 57:60] = torch.tensor([toe_up, 0, 0], device=self.device)
208
+ body_pose[0, 60:63] = torch.tensor([toe_up, 0, 0], device=self.device)
209
  elif isinstance(body_pose, np.ndarray):
210
  body_pose = torch.FloatTensor(body_pose).to(self.device)
211
 
 
 
 
 
 
212
  if transl is None:
213
  transl = torch.zeros([batch_size, 3], device=self.device)
214
  elif isinstance(transl, np.ndarray):