Spaces:
Runtime error
Runtime error
File size: 5,279 Bytes
00074b2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
FOCAL_LENGTH = 5000.0
IMG_RES = 224
# Mean and standard deviation for normalizing input image
IMG_NORM_MEAN = [0.485, 0.456, 0.406]
IMG_NORM_STD = [0.229, 0.224, 0.225]
"""
We create a superset of joints containing the OpenPose joints together with the ones that each dataset provides.
We keep a superset of 24 joints such that we include all joints from every dataset.
If a dataset doesn't provide annotations for a specific joint, we simply ignore it.
The joints used here are the following:
"""
JOINT_NAMES = (
"Hips",
"Left Upper Leg",
"Right Upper Leg",
"Spine",
"Left Leg",
"Right Leg",
"Spine1",
"Left Foot",
"Right Foot",
"Thorax",
"Left Toe",
"Right Toe",
"Neck",
"Left Shoulder",
"Right Shoulder",
"Head",
"Left ForeArm",
"Right ForeArm",
"Left Arm",
"Right Arm",
"Left Hand",
"Right Hand",
# 25 OpenPose joints (in the order provided by OpenPose)
# "OP Nose",
# "OP Neck",
# "OP RShoulder",
# "OP RElbow",
# "OP RWrist",
# "OP LShoulder",
# "OP LElbow",
# "OP LWrist",
# "OP MidHip",
# "OP RHip",
# "OP RKnee",
# "OP RAnkle",
# "OP LHip",
# "OP LKnee",
# "OP LAnkle",
# "OP REye",
# "OP LEye",
# "OP REar",
# "OP LEar",
# "OP LBigToe",
# "OP LSmallToe",
# "OP LHeel",
# "OP RBigToe",
# "OP RSmallToe",
# "OP RHeel",
## 24 Ground Truth joints (superset of joints from different datasets)
# "Right Ankle",
# "Right Knee",
# "Right Hip",
# "Left Hip",
# "Left Knee",
# "Left Ankle",
# "Right Wrist",
# "Right Elbow",
# "Right Shoulder",
# "Left Shoulder",
# "Left Elbow",
# "Left Wrist",
# "Neck (LSP)",
# "Top of Head (LSP)",
# "Pelvis (MPII)",
# "Thorax (MPII)",
# "Spine (H36M)",
# "Jaw (H36M)",
# "Head (H36M)",
# "Nose",
# "Left Eye",
# "Right Eye",
# "Left Ear",
# "Right Ear",
# "OP MidHip",
# "Spine1",
# "Spine2",
# "Spine3",
# "OP Neck",
# "Head",
)
# Dict containing the joints in numerical order
JOINT_IDS = {JOINT_NAMES[i]: i for i in range(len(JOINT_NAMES))}
# Map joints to SMPL joints
JOINT_MAP = {
"Hips": 0,
"Left Upper Leg": 1,
"Right Upper Leg": 2,
"Spine": 3,
"Left Leg": 4,
"Right Leg": 5,
"Spine1": 6,
"Left Foot": 7,
"Right Foot": 8,
"Thorax": 9,
"Left Toe": 10,
"Right Toe": 11,
"Neck": 12,
"Left Shoulder": 13,
"Right Shoulder": 14,
"Head": 15,
"Left ForeArm": 16,
"Right ForeArm": 17,
"Left Arm": 18,
"Right Arm": 19,
"Left Hand": 20,
"Right Hand": 21,
# "OP Nose": 24,
# "OP Neck": 12,
# "OP RShoulder": 17,
# "OP RElbow": 19,
# "OP RWrist": 21,
# "OP LShoulder": 16,
# "OP LElbow": 18,
# "OP LWrist": 20,
# "OP MidHip": 0,
# "OP RHip": 2,
# "OP RKnee": 5,
# "OP RAnkle": 8,
# "OP LHip": 1,
# "OP LKnee": 4,
# "OP LAnkle": 7,
# "OP REye": 25,
# "OP LEye": 26,
# "OP REar": 27,
# "OP LEar": 28,
# "OP LBigToe": 29,
# "OP LSmallToe": 30,
# "OP LHeel": 31,
# "OP RBigToe": 32,
# "OP RSmallToe": 33,
# "OP RHeel": 34,
# "Right Ankle": 8,
# "Right Knee": 5,
# "Right Hip": 45,
# "Left Hip": 46,
# "Left Knee": 4,
# "Left Ankle": 7,
# "Right Wrist": 21,
# "Right Elbow": 19,
# "Right Shoulder": 17,
# "Left Shoulder": 16,
# "Left Elbow": 18,
# "Left Wrist": 20,
# "Neck (LSP)": 47,
# "Top of Head (LSP)": 15, # 48,
# "Pelvis (MPII)": 49,
# "Thorax (MPII)": 50,
# "Spine (H36M)": 51,
# "Jaw (H36M)": 52,
# "Head (H36M)": 15, # 53,
# "Nose": 24,
# "Left Eye": 26,
# "Right Eye": 25,
# "Left Ear": 28,
# "Right Ear": 27,
# "Spine1": 3,
# "Spine2": 6,
# "Spine3": 9,
# "Head": 15,
}
# Joint selectors
# Indices to get the 14 LSP joints from the 17 H36M joints
H36M_TO_J17 = [6, 5, 4, 1, 2, 3, 16, 15, 14, 11, 12, 13, 8, 10, 0, 7, 9]
H36M_TO_J14 = H36M_TO_J17[:14]
# Indices to get the 14 LSP joints from the ground truth joints
J24_TO_J17 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 18, 14, 16, 17]
J24_TO_J14 = J24_TO_J17[:14]
# Permutation of SMPL pose parameters when flipping the shape
SMPL_JOINTS_FLIP_PERM = [
0,
2,
1,
3,
5,
4,
6,
8,
7,
9,
11,
10,
12,
14,
13,
15,
17,
16,
19,
18,
21,
20,
23,
22,
]
SMPL_POSE_FLIP_PERM = []
for i in SMPL_JOINTS_FLIP_PERM:
SMPL_POSE_FLIP_PERM.append(3 * i)
SMPL_POSE_FLIP_PERM.append(3 * i + 1)
SMPL_POSE_FLIP_PERM.append(3 * i + 2)
# Permutation indices for the 24 ground truth joints
J24_FLIP_PERM = [
5,
4,
3,
2,
1,
0,
11,
10,
9,
8,
7,
6,
12,
13,
14,
15,
16,
17,
18,
19,
21,
20,
23,
22,
]
# Permutation indices for the full set of 49 joints
J49_FLIP_PERM = [
0,
1,
5,
6,
7,
2,
3,
4,
8,
12,
13,
14,
9,
10,
11,
16,
15,
18,
17,
22,
23,
24,
19,
20,
21,
] + [25 + i for i in J24_FLIP_PERM]
|