push in
Browse files- 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 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
|
| 167 |
-
|
| 168 |
-
|
| 169 |
|
| 170 |
-
|
| 171 |
-
|
| 172 |
|
| 173 |
-
|
| 174 |
-
|
| 175 |
|
| 176 |
-
|
| 177 |
-
|
|
|
|
| 178 |
|
| 179 |
-
body_pose[0,
|
| 180 |
-
body_pose[0,
|
| 181 |
-
body_pose[0, 22] = left_shoulder_twist
|
| 182 |
|
| 183 |
-
body_pose[0,
|
| 184 |
-
body_pose[0,
|
| 185 |
-
body_pose[0, 23] = right_shoulder_twist
|
| 186 |
|
| 187 |
-
body_pose[0,
|
| 188 |
-
body_pose[0,
|
| 189 |
|
| 190 |
-
body_pose[0,
|
| 191 |
-
body_pose[0,
|
| 192 |
|
| 193 |
-
body_pose[0,
|
| 194 |
-
body_pose[0,
|
| 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):
|