nexusbert commited on
Commit
3d2acee
·
1 Parent(s): d502a81

push natural pose

Browse files
Files changed (1) hide show
  1. smpl_generator.py +32 -32
smpl_generator.py CHANGED
@@ -158,54 +158,54 @@ class SMPLGenerator:
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
 
 
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
  elif isinstance(global_orient, np.ndarray):
162
  global_orient = torch.FloatTensor(global_orient).to(self.device)
163
 
164
  if body_pose is None:
165
  body_pose = torch.zeros([batch_size, 69], device=self.device)
166
 
167
+ shoulder_down = np.radians(-12.5)
168
+ shoulder_forward = np.radians(7.5)
169
+ upper_arm_adduction = np.radians(12.5)
170
+ upper_arm_forward = np.radians(7.5)
171
+ elbow_bend = np.radians(12.5)
172
+ palm_inward = np.radians(15)
173
+ hip_forward_tilt = np.radians(2)
174
+ hip_outward = np.radians(7.5)
175
+ hip_flex = np.radians(3.5)
176
+ knee_bend = np.radians(4)
177
+ foot_outward = np.radians(11.5)
 
178
 
179
+ body_pose[0, 6:9] = torch.tensor([shoulder_down, 0, shoulder_forward], device=self.device)
180
+ body_pose[0, 9:12] = torch.tensor([shoulder_down, 0, -shoulder_forward], device=self.device)
181
 
182
+ body_pose[0, 12:15] = torch.tensor([upper_arm_adduction, upper_arm_forward, 0], device=self.device)
183
+ body_pose[0, 15:18] = torch.tensor([-upper_arm_adduction, upper_arm_forward, 0], device=self.device)
184
 
185
+ body_pose[0, 18:21] = torch.tensor([0, elbow_bend, 0], device=self.device)
186
+ body_pose[0, 21:24] = torch.tensor([0, elbow_bend, 0], device=self.device)
187
 
188
+ body_pose[0, 24:27] = torch.tensor([0, 0, palm_inward], device=self.device)
189
+ body_pose[0, 27:30] = torch.tensor([0, 0, -palm_inward], device=self.device)
 
190
 
191
+ body_pose[0, 30:33] = torch.tensor([np.radians(5), 0, 0], device=self.device)
192
  body_pose[0, 33:36] = torch.tensor([np.radians(3), 0, 0], device=self.device)
193
+ body_pose[0, 36:39] = torch.tensor([0, 0, 0], device=self.device)
194
 
195
+ body_pose[0, 39:42] = torch.tensor([np.radians(2), 0, 0], device=self.device)
196
+ body_pose[0, 42:45] = torch.tensor([0, 0, 0], device=self.device)
197
 
198
+ body_pose[0, 45:48] = torch.tensor([hip_flex, hip_outward, 0], device=self.device)
199
+ body_pose[0, 48:51] = torch.tensor([hip_flex, -hip_outward, 0], device=self.device)
200
 
201
+ body_pose[0, 51:54] = torch.tensor([0, knee_bend, 0], device=self.device)
202
+ body_pose[0, 54:57] = torch.tensor([0, knee_bend, 0], device=self.device)
203
 
204
+ body_pose[0, 57:60] = torch.tensor([0, foot_outward, 0], device=self.device)
205
+ body_pose[0, 60:63] = torch.tensor([0, -foot_outward, 0], device=self.device)
206
+
207
+ body_pose[0, 63:66] = torch.tensor([0, 0, 0], device=self.device)
208
+ body_pose[0, 66:69] = torch.tensor([0, 0, 0], device=self.device)
209
  elif isinstance(body_pose, np.ndarray):
210
  body_pose = torch.FloatTensor(body_pose).to(self.device)
211