update py310

This commit is contained in:
haiyang
2025-06-25 00:18:13 +09:00
parent 6a0939cde5
commit 1e7472470b
377 changed files with 128070 additions and 50396 deletions
+24 -5
View File
@@ -8,6 +8,8 @@
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.lz4 filter=lfs diff=lfs merge=lfs -text
*.mds filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
@@ -33,10 +35,27 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text
*.avi filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
# Audio files - uncompressed
*.pcm filter=lfs diff=lfs merge=lfs -text
*.sam filter=lfs diff=lfs merge=lfs -text
*.raw filter=lfs diff=lfs merge=lfs -text
# Audio files - compressed
*.aac filter=lfs diff=lfs merge=lfs -text
*.flac filter=lfs diff=lfs merge=lfs -text
*.mp3 filter=lfs diff=lfs merge=lfs -text
*.ogg filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
*.json filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
# Image files - uncompressed
*.bmp filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.tiff filter=lfs diff=lfs merge=lfs -text
# Image files - compressed
*.jpg filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.webp filter=lfs diff=lfs merge=lfs -text
# Video files - compressed
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.webm filter=lfs diff=lfs merge=lfs -text
datasets/data_json/show-oliver-s40_w128.json filter=lfs diff=lfs merge=lfs -text
datasets/data_json/show-oliver-s40_w64.json filter=lfs diff=lfs merge=lfs -text
+181 -19
View File
@@ -1,22 +1,184 @@
# Ignore any file with '_local' in its name
*_local.*
*_watermarked.mp4*
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# Ignore specific files and directories
datasets/cached_data/
datasets/outputs/
saved_audio.wav
result.avi
test.mp4
video_only.mp4
**/.ipynb_checkpoints/
**/__pycache__/
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# watermarked videos will be saved at root directory, but we don't want to track them
demo*watermarked.mp4
outputs/
SMPLer-X/common/utils/human_model_files/
SMPLer-X/pretrained_models/
Wav2Lip/checkpoints/
datasets/cached_ckpts/
datasets/cached_graph/
emage/smplx_models/
frame-interpolation-pytorch/*.pt
emage/
datasets/cached_audio/
.DS_Store
.vscode/
.gradio/
# Ignore specific files in youtube_test folder
datasets/cached_graph/youtube_test/speaker0.pkl
datasets/cached_graph/youtube_test/speaker2.pkl
datasets/cached_graph/youtube_test/speaker3.pkl
datasets/cached_graph/youtube_test/speaker4.pkl
datasets/cached_graph/youtube_test/speaker5.pkl
datasets/cached_graph/youtube_test/speaker6.pkl
# submodules
Wav2Lip/
frame-interpolation-pytorch/
SMPLer-X/
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
+2 -2
View File
@@ -4,8 +4,8 @@ emoji: 🐠
colorFrom: blue
colorTo: gray
sdk: gradio
sdk_version: 4.44.1
python_version: 3.9.20
sdk_version: 5.20.1
python_version: 3.10.16
app_file: app.py
pinned: false
short_description: Co-Speech Gesture Video Generation
-13
View File
@@ -1,13 +0,0 @@
---
title: SMPLer X
emoji: ⚡
colorFrom: blue
colorTo: indigo
sdk: gradio
python_version: 3.9
sdk_version: 4.38.1
app_file: app.py
pinned: false
---
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
-135
View File
@@ -1,135 +0,0 @@
import os
import shutil
import argparse
import sys
import re
import json
import numpy as np
import os.path as osp
from pathlib import Path
import cv2
import torch
import math
from tqdm import tqdm
from huggingface_hub import hf_hub_download
try:
import mmpose
except:
os.system('pip install ./main/transformer_utils')
# hf_hub_download(repo_id="caizhongang/SMPLer-X", filename="smpler_x_h32.pth.tar", local_dir="/home/user/app/pretrained_models")
# /home/user/.pyenv/versions/3.9.19/lib/python3.9/site-packages/torchgeometry/core/conversions.py
os.system('cp -rf ./assets/conversions.py /home/user/.pyenv/versions/3.9.20/lib/python3.9/site-packages/torchgeometry/core/conversions.py')
def extract_frame_number(file_name):
match = re.search(r'(\d{5})', file_name)
if match:
return int(match.group(1))
return None
def merge_npz_files(npz_files, output_file):
npz_files = sorted(npz_files, key=lambda x: extract_frame_number(os.path.basename(x)))
merged_data = {}
for file in npz_files:
data = np.load(file)
for key in data.files:
if key not in merged_data:
merged_data[key] = []
merged_data[key].append(data[key])
for key in merged_data:
merged_data[key] = np.stack(merged_data[key], axis=0)
np.savez(output_file, **merged_data)
def npz_to_npz(pkl_path, npz_path):
# Load the pickle file
pkl_example = np.load(pkl_path, allow_pickle=True)
n = pkl_example["expression"].shape[0] # Assuming this is the batch size
full_pose = np.concatenate([pkl_example["global_orient"], pkl_example["body_pose"], pkl_example["jaw_pose"], pkl_example["leye_pose"], pkl_example["reye_pose"], pkl_example["left_hand_pose"], pkl_example["right_hand_pose"]], axis=1)
# print(full_pose.shape)
np.savez(npz_path,
betas=np.zeros(300),
poses=full_pose.reshape(n, -1),
expressions=np.zeros((n, 100)),
trans=pkl_example["transl"].reshape(n, -1),
model='smplx2020',
gender='neutral',
mocap_frame_rate=30,
)
def get_json(root_dir, output_dir):
clips = []
dirs = os.listdir(root_dir)
all_length = 0
for dir in dirs:
if not dir.endswith(".mp4"): continue
video_id = dir[:-4]
root = root_dir
try:
length = np.load(os.path.join(root, video_id+".npz"), allow_pickle=True)["poses"].shape[0]
all_length += length
except:
print("cant open ", dir)
continue
clip = {
"video_id": video_id,
"video_path": root[1:],
# "audio_path": root,
"motion_path": root[1:],
"mode": "test",
"start_idx": 0,
"end_idx": length
}
clips.append(clip)
if all_length < 1:
print(f"skip due to total frames is less than 1500 for {root_dir}")
return 0
else:
with open(output_dir, 'w') as f:
json.dump(clips, f, indent=4)
return all_length
def infer(video_input, in_threshold, num_people, render_mesh, inferer, OUT_FOLDER):
os.system(f'rm -rf {OUT_FOLDER}/smplx/*')
multi_person = num_people
cap = cv2.VideoCapture(video_input)
video_name = video_input.split("/")[-1]
success = 1
frame = 0
while success:
success, original_img = cap.read()
if not success:
break
frame += 1
_, _, _ = inferer.infer(original_img, in_threshold, frame, multi_person, not(render_mesh))
cap.release()
npz_files = [os.path.join(OUT_FOLDER, 'smplx', x) for x in os.listdir(os.path.join(OUT_FOLDER, 'smplx'))]
merge_npz_files(npz_files, os.path.join(OUT_FOLDER, video_name.replace(".mp4", ".npz")))
os.system(f'rm -r {OUT_FOLDER}/smplx')
npz_to_npz(os.path.join(OUT_FOLDER, video_name.replace(".mp4", ".npz")), os.path.join(OUT_FOLDER, video_name.replace(".mp4", ".npz")))
source = video_input
destination = os.path.join(OUT_FOLDER, video_name.replace('.mp4', '.npz')).replace('.npz', '.mp4')
shutil.copy(source, destination)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--video_folder_path", type=str, default="")
parser.add_argument("--data_save_path", type=str, default="")
parser.add_argument("--json_save_path", type=str, default="")
args = parser.parse_args()
video_folder = args.video_folder_path
DEFAULT_MODEL='smpler_x_s32'
OUT_FOLDER = args.data_save_path
os.makedirs(OUT_FOLDER, exist_ok=True)
num_gpus = 1 if torch.cuda.is_available() else -1
index = torch.cuda.current_device()
from main.inference import Inferer
inferer = Inferer(DEFAULT_MODEL, num_gpus, OUT_FOLDER)
for video_input in tqdm(os.listdir(video_folder)):
if not video_input.endswith(".mp4"):
continue
infer(os.path.join(video_folder, video_input), 0.5, False, False, inferer, OUT_FOLDER)
get_json(OUT_FOLDER, args.json_save_path)
-523
View File
@@ -1,523 +0,0 @@
import torch
import torch.nn as nn
import torchgeometry as tgm
__all__ = [
# functional api
"pi",
"rad2deg",
"deg2rad",
"convert_points_from_homogeneous",
"convert_points_to_homogeneous",
"angle_axis_to_rotation_matrix",
"rotation_matrix_to_angle_axis",
"rotation_matrix_to_quaternion",
"quaternion_to_angle_axis",
"angle_axis_to_quaternion",
"rtvec_to_pose",
# layer api
"RadToDeg",
"DegToRad",
"ConvertPointsFromHomogeneous",
"ConvertPointsToHomogeneous",
]
"""Constant with number pi
"""
pi = torch.Tensor([3.14159265358979323846])
def rad2deg(tensor):
r"""Function that converts angles from radians to degrees.
See :class:`~torchgeometry.RadToDeg` for details.
Args:
tensor (Tensor): Tensor of arbitrary shape.
Returns:
Tensor: Tensor with same shape as input.
Example:
>>> input = tgm.pi * torch.rand(1, 3, 3)
>>> output = tgm.rad2deg(input)
"""
if not torch.is_tensor(tensor):
raise TypeError("Input type is not a torch.Tensor. Got {}"
.format(type(tensor)))
return 180. * tensor / pi.to(tensor.device).type(tensor.dtype)
def deg2rad(tensor):
r"""Function that converts angles from degrees to radians.
See :class:`~torchgeometry.DegToRad` for details.
Args:
tensor (Tensor): Tensor of arbitrary shape.
Returns:
Tensor: Tensor with same shape as input.
Examples::
>>> input = 360. * torch.rand(1, 3, 3)
>>> output = tgm.deg2rad(input)
"""
if not torch.is_tensor(tensor):
raise TypeError("Input type is not a torch.Tensor. Got {}"
.format(type(tensor)))
return tensor * pi.to(tensor.device).type(tensor.dtype) / 180.
def convert_points_from_homogeneous(points):
r"""Function that converts points from homogeneous to Euclidean space.
See :class:`~torchgeometry.ConvertPointsFromHomogeneous` for details.
Examples::
>>> input = torch.rand(2, 4, 3) # BxNx3
>>> output = tgm.convert_points_from_homogeneous(input) # BxNx2
"""
if not torch.is_tensor(points):
raise TypeError("Input type is not a torch.Tensor. Got {}".format(
type(points)))
if len(points.shape) < 2:
raise ValueError("Input must be at least a 2D tensor. Got {}".format(
points.shape))
return points[..., :-1] / points[..., -1:]
def convert_points_to_homogeneous(points):
r"""Function that converts points from Euclidean to homogeneous space.
See :class:`~torchgeometry.ConvertPointsToHomogeneous` for details.
Examples::
>>> input = torch.rand(2, 4, 3) # BxNx3
>>> output = tgm.convert_points_to_homogeneous(input) # BxNx4
"""
if not torch.is_tensor(points):
raise TypeError("Input type is not a torch.Tensor. Got {}".format(
type(points)))
if len(points.shape) < 2:
raise ValueError("Input must be at least a 2D tensor. Got {}".format(
points.shape))
return nn.functional.pad(points, (0, 1), "constant", 1.0)
def angle_axis_to_rotation_matrix(angle_axis):
"""Convert 3d vector of axis-angle rotation to 4x4 rotation matrix
Args:
angle_axis (Tensor): tensor of 3d vector of axis-angle rotations.
Returns:
Tensor: tensor of 4x4 rotation matrices.
Shape:
- Input: :math:`(N, 3)`
- Output: :math:`(N, 4, 4)`
Example:
>>> input = torch.rand(1, 3) # Nx3
>>> output = tgm.angle_axis_to_rotation_matrix(input) # Nx4x4
"""
def _compute_rotation_matrix(angle_axis, theta2, eps=1e-6):
# We want to be careful to only evaluate the square root if the
# norm of the angle_axis vector is greater than zero. Otherwise
# we get a division by zero.
k_one = 1.0
theta = torch.sqrt(theta2)
wxyz = angle_axis / (theta + eps)
wx, wy, wz = torch.chunk(wxyz, 3, dim=1)
cos_theta = torch.cos(theta)
sin_theta = torch.sin(theta)
r00 = cos_theta + wx * wx * (k_one - cos_theta)
r10 = wz * sin_theta + wx * wy * (k_one - cos_theta)
r20 = -wy * sin_theta + wx * wz * (k_one - cos_theta)
r01 = wx * wy * (k_one - cos_theta) - wz * sin_theta
r11 = cos_theta + wy * wy * (k_one - cos_theta)
r21 = wx * sin_theta + wy * wz * (k_one - cos_theta)
r02 = wy * sin_theta + wx * wz * (k_one - cos_theta)
r12 = -wx * sin_theta + wy * wz * (k_one - cos_theta)
r22 = cos_theta + wz * wz * (k_one - cos_theta)
rotation_matrix = torch.cat(
[r00, r01, r02, r10, r11, r12, r20, r21, r22], dim=1)
return rotation_matrix.view(-1, 3, 3)
def _compute_rotation_matrix_taylor(angle_axis):
rx, ry, rz = torch.chunk(angle_axis, 3, dim=1)
k_one = torch.ones_like(rx)
rotation_matrix = torch.cat(
[k_one, -rz, ry, rz, k_one, -rx, -ry, rx, k_one], dim=1)
return rotation_matrix.view(-1, 3, 3)
# stolen from ceres/rotation.h
_angle_axis = torch.unsqueeze(angle_axis, dim=1)
theta2 = torch.matmul(_angle_axis, _angle_axis.transpose(1, 2))
theta2 = torch.squeeze(theta2, dim=1)
# compute rotation matrices
rotation_matrix_normal = _compute_rotation_matrix(angle_axis, theta2)
rotation_matrix_taylor = _compute_rotation_matrix_taylor(angle_axis)
# create mask to handle both cases
eps = 1e-6
mask = (theta2 > eps).view(-1, 1, 1).to(theta2.device)
mask_pos = (mask).type_as(theta2)
mask_neg = (mask == False).type_as(theta2) # noqa
# create output pose matrix
batch_size = angle_axis.shape[0]
rotation_matrix = torch.eye(4).to(angle_axis.device).type_as(angle_axis)
rotation_matrix = rotation_matrix.view(1, 4, 4).repeat(batch_size, 1, 1)
# fill output matrix with masked values
rotation_matrix[..., :3, :3] = \
mask_pos * rotation_matrix_normal + mask_neg * rotation_matrix_taylor
return rotation_matrix # Nx4x4
def rtvec_to_pose(rtvec):
"""
Convert axis-angle rotation and translation vector to 4x4 pose matrix
Args:
rtvec (Tensor): Rodrigues vector transformations
Returns:
Tensor: transformation matrices
Shape:
- Input: :math:`(N, 6)`
- Output: :math:`(N, 4, 4)`
Example:
>>> input = torch.rand(3, 6) # Nx6
>>> output = tgm.rtvec_to_pose(input) # Nx4x4
"""
assert rtvec.shape[-1] == 6, 'rtvec=[rx, ry, rz, tx, ty, tz]'
pose = angle_axis_to_rotation_matrix(rtvec[..., :3])
pose[..., :3, 3] = rtvec[..., 3:]
return pose
def rotation_matrix_to_angle_axis(rotation_matrix):
"""Convert 3x4 rotation matrix to Rodrigues vector
Args:
rotation_matrix (Tensor): rotation matrix.
Returns:
Tensor: Rodrigues vector transformation.
Shape:
- Input: :math:`(N, 3, 4)`
- Output: :math:`(N, 3)`
Example:
>>> input = torch.rand(2, 3, 4) # Nx4x4
>>> output = tgm.rotation_matrix_to_angle_axis(input) # Nx3
"""
# todo add check that matrix is a valid rotation matrix
quaternion = rotation_matrix_to_quaternion(rotation_matrix)
return quaternion_to_angle_axis(quaternion)
def rotation_matrix_to_quaternion(rotation_matrix, eps=1e-6):
"""Convert 3x4 rotation matrix to 4d quaternion vector
This algorithm is based on algorithm described in
https://github.com/KieranWynn/pyquaternion/blob/master/pyquaternion/quaternion.py#L201
Args:
rotation_matrix (Tensor): the rotation matrix to convert.
Return:
Tensor: the rotation in quaternion
Shape:
- Input: :math:`(N, 3, 4)`
- Output: :math:`(N, 4)`
Example:
>>> input = torch.rand(4, 3, 4) # Nx3x4
>>> output = tgm.rotation_matrix_to_quaternion(input) # Nx4
"""
if not torch.is_tensor(rotation_matrix):
raise TypeError("Input type is not a torch.Tensor. Got {}".format(
type(rotation_matrix)))
if len(rotation_matrix.shape) > 3:
raise ValueError(
"Input size must be a three dimensional tensor. Got {}".format(
rotation_matrix.shape))
if not rotation_matrix.shape[-2:] == (3, 4):
raise ValueError(
"Input size must be a N x 3 x 4 tensor. Got {}".format(
rotation_matrix.shape))
rmat_t = torch.transpose(rotation_matrix, 1, 2)
mask_d2 = rmat_t[:, 2, 2] < eps
mask_d0_d1 = rmat_t[:, 0, 0] > rmat_t[:, 1, 1]
mask_d0_nd1 = rmat_t[:, 0, 0] < -rmat_t[:, 1, 1]
t0 = 1 + rmat_t[:, 0, 0] - rmat_t[:, 1, 1] - rmat_t[:, 2, 2]
q0 = torch.stack([rmat_t[:, 1, 2] - rmat_t[:, 2, 1],
t0, rmat_t[:, 0, 1] + rmat_t[:, 1, 0],
rmat_t[:, 2, 0] + rmat_t[:, 0, 2]], -1)
t0_rep = t0.repeat(4, 1).t()
t1 = 1 - rmat_t[:, 0, 0] + rmat_t[:, 1, 1] - rmat_t[:, 2, 2]
q1 = torch.stack([rmat_t[:, 2, 0] - rmat_t[:, 0, 2],
rmat_t[:, 0, 1] + rmat_t[:, 1, 0],
t1, rmat_t[:, 1, 2] + rmat_t[:, 2, 1]], -1)
t1_rep = t1.repeat(4, 1).t()
t2 = 1 - rmat_t[:, 0, 0] - rmat_t[:, 1, 1] + rmat_t[:, 2, 2]
q2 = torch.stack([rmat_t[:, 0, 1] - rmat_t[:, 1, 0],
rmat_t[:, 2, 0] + rmat_t[:, 0, 2],
rmat_t[:, 1, 2] + rmat_t[:, 2, 1], t2], -1)
t2_rep = t2.repeat(4, 1).t()
t3 = 1 + rmat_t[:, 0, 0] + rmat_t[:, 1, 1] + rmat_t[:, 2, 2]
q3 = torch.stack([t3, rmat_t[:, 1, 2] - rmat_t[:, 2, 1],
rmat_t[:, 2, 0] - rmat_t[:, 0, 2],
rmat_t[:, 0, 1] - rmat_t[:, 1, 0]], -1)
t3_rep = t3.repeat(4, 1).t()
mask_c0 = mask_d2 * mask_d0_d1
mask_c1 = mask_d2 * ~(mask_d0_d1)
mask_c2 = ~(mask_d2) * mask_d0_nd1
mask_c3 = ~(mask_d2) * ~(mask_d0_nd1)
mask_c0 = mask_c0.view(-1, 1).type_as(q0)
mask_c1 = mask_c1.view(-1, 1).type_as(q1)
mask_c2 = mask_c2.view(-1, 1).type_as(q2)
mask_c3 = mask_c3.view(-1, 1).type_as(q3)
q = q0 * mask_c0 + q1 * mask_c1 + q2 * mask_c2 + q3 * mask_c3
q /= torch.sqrt(t0_rep * mask_c0 + t1_rep * mask_c1 + # noqa
t2_rep * mask_c2 + t3_rep * mask_c3) # noqa
q *= 0.5
return q
def quaternion_to_angle_axis(quaternion: torch.Tensor) -> torch.Tensor:
"""Convert quaternion vector to angle axis of rotation.
Adapted from ceres C++ library: ceres-solver/include/ceres/rotation.h
Args:
quaternion (torch.Tensor): tensor with quaternions.
Return:
torch.Tensor: tensor with angle axis of rotation.
Shape:
- Input: :math:`(*, 4)` where `*` means, any number of dimensions
- Output: :math:`(*, 3)`
Example:
>>> quaternion = torch.rand(2, 4) # Nx4
>>> angle_axis = tgm.quaternion_to_angle_axis(quaternion) # Nx3
"""
if not torch.is_tensor(quaternion):
raise TypeError("Input type is not a torch.Tensor. Got {}".format(
type(quaternion)))
if not quaternion.shape[-1] == 4:
raise ValueError("Input must be a tensor of shape Nx4 or 4. Got {}"
.format(quaternion.shape))
# unpack input and compute conversion
q1: torch.Tensor = quaternion[..., 1]
q2: torch.Tensor = quaternion[..., 2]
q3: torch.Tensor = quaternion[..., 3]
sin_squared_theta: torch.Tensor = q1 * q1 + q2 * q2 + q3 * q3
sin_theta: torch.Tensor = torch.sqrt(sin_squared_theta)
cos_theta: torch.Tensor = quaternion[..., 0]
two_theta: torch.Tensor = 2.0 * torch.where(
cos_theta < 0.0,
torch.atan2(-sin_theta, -cos_theta),
torch.atan2(sin_theta, cos_theta))
k_pos: torch.Tensor = two_theta / sin_theta
k_neg: torch.Tensor = 2.0 * torch.ones_like(sin_theta)
k: torch.Tensor = torch.where(sin_squared_theta > 0.0, k_pos, k_neg)
angle_axis: torch.Tensor = torch.zeros_like(quaternion)[..., :3]
angle_axis[..., 0] += q1 * k
angle_axis[..., 1] += q2 * k
angle_axis[..., 2] += q3 * k
return angle_axis
# based on:
# https://github.com/facebookresearch/QuaterNet/blob/master/common/quaternion.py#L138
def angle_axis_to_quaternion(angle_axis: torch.Tensor) -> torch.Tensor:
"""Convert an angle axis to a quaternion.
Adapted from ceres C++ library: ceres-solver/include/ceres/rotation.h
Args:
angle_axis (torch.Tensor): tensor with angle axis.
Return:
torch.Tensor: tensor with quaternion.
Shape:
- Input: :math:`(*, 3)` where `*` means, any number of dimensions
- Output: :math:`(*, 4)`
Example:
>>> angle_axis = torch.rand(2, 4) # Nx4
>>> quaternion = tgm.angle_axis_to_quaternion(angle_axis) # Nx3
"""
if not torch.is_tensor(angle_axis):
raise TypeError("Input type is not a torch.Tensor. Got {}".format(
type(angle_axis)))
if not angle_axis.shape[-1] == 3:
raise ValueError("Input must be a tensor of shape Nx3 or 3. Got {}"
.format(angle_axis.shape))
# unpack input and compute conversion
a0: torch.Tensor = angle_axis[..., 0:1]
a1: torch.Tensor = angle_axis[..., 1:2]
a2: torch.Tensor = angle_axis[..., 2:3]
theta_squared: torch.Tensor = a0 * a0 + a1 * a1 + a2 * a2
theta: torch.Tensor = torch.sqrt(theta_squared)
half_theta: torch.Tensor = theta * 0.5
mask: torch.Tensor = theta_squared > 0.0
ones: torch.Tensor = torch.ones_like(half_theta)
k_neg: torch.Tensor = 0.5 * ones
k_pos: torch.Tensor = torch.sin(half_theta) / theta
k: torch.Tensor = torch.where(mask, k_pos, k_neg)
w: torch.Tensor = torch.where(mask, torch.cos(half_theta), ones)
quaternion: torch.Tensor = torch.zeros_like(angle_axis)
quaternion[..., 0:1] += a0 * k
quaternion[..., 1:2] += a1 * k
quaternion[..., 2:3] += a2 * k
return torch.cat([w, quaternion], dim=-1)
# TODO: add below funtionalities
# - pose_to_rtvec
# layer api
class RadToDeg(nn.Module):
r"""Creates an object that converts angles from radians to degrees.
Args:
tensor (Tensor): Tensor of arbitrary shape.
Returns:
Tensor: Tensor with same shape as input.
Examples::
>>> input = tgm.pi * torch.rand(1, 3, 3)
>>> output = tgm.RadToDeg()(input)
"""
def __init__(self):
super(RadToDeg, self).__init__()
def forward(self, input):
return rad2deg(input)
class DegToRad(nn.Module):
r"""Function that converts angles from degrees to radians.
Args:
tensor (Tensor): Tensor of arbitrary shape.
Returns:
Tensor: Tensor with same shape as input.
Examples::
>>> input = 360. * torch.rand(1, 3, 3)
>>> output = tgm.DegToRad()(input)
"""
def __init__(self):
super(DegToRad, self).__init__()
def forward(self, input):
return deg2rad(input)
class ConvertPointsFromHomogeneous(nn.Module):
r"""Creates a transformation that converts points from homogeneous to
Euclidean space.
Args:
points (Tensor): tensor of N-dimensional points.
Returns:
Tensor: tensor of N-1-dimensional points.
Shape:
- Input: :math:`(B, D, N)` or :math:`(D, N)`
- Output: :math:`(B, D, N + 1)` or :math:`(D, N + 1)`
Examples::
>>> input = torch.rand(2, 4, 3) # BxNx3
>>> transform = tgm.ConvertPointsFromHomogeneous()
>>> output = transform(input) # BxNx2
"""
def __init__(self):
super(ConvertPointsFromHomogeneous, self).__init__()
def forward(self, input):
return convert_points_from_homogeneous(input)
class ConvertPointsToHomogeneous(nn.Module):
r"""Creates a transformation to convert points from Euclidean to
homogeneous space.
Args:
points (Tensor): tensor of N-dimensional points.
Returns:
Tensor: tensor of N+1-dimensional points.
Shape:
- Input: :math:`(B, D, N)` or :math:`(D, N)`
- Output: :math:`(B, D, N + 1)` or :math:`(D, N + 1)`
Examples::
>>> input = torch.rand(2, 4, 3) # BxNx3
>>> transform = tgm.ConvertPointsToHomogeneous()
>>> output = transform(input) # BxNx4
"""
def __init__(self):
super(ConvertPointsToHomogeneous, self).__init__()
def forward(self, input):
return convert_points_to_homogeneous(input)
-86
View File
@@ -1,86 +0,0 @@
import os.path as osp
import math
import abc
from torch.utils.data import DataLoader
import torch.optim
import torchvision.transforms as transforms
from timer import Timer
from logger import colorlogger
from torch.nn.parallel.data_parallel import DataParallel
from config import cfg
from SMPLer_X import get_model
# ddp
import torch.distributed as dist
from torch.utils.data import DistributedSampler
import torch.utils.data.distributed
from utils.distribute_utils import (
get_rank, is_main_process, time_synchronized, get_group_idx, get_process_groups
)
class Base(object):
__metaclass__ = abc.ABCMeta
def __init__(self, log_name='logs.txt'):
self.cur_epoch = 0
# timer
self.tot_timer = Timer()
self.gpu_timer = Timer()
self.read_timer = Timer()
# logger
self.logger = colorlogger(cfg.log_dir, log_name=log_name)
@abc.abstractmethod
def _make_batch_generator(self):
return
@abc.abstractmethod
def _make_model(self):
return
class Demoer(Base):
def __init__(self, test_epoch=None):
if test_epoch is not None:
self.test_epoch = int(test_epoch)
super(Demoer, self).__init__(log_name='test_logs.txt')
def _make_batch_generator(self, demo_scene):
# data load and construct batch generator
self.logger.info("Creating dataset...")
from data.UBody.UBody import UBody
testset_loader = UBody(transforms.ToTensor(), "demo", demo_scene) # eval(demoset)(transforms.ToTensor(), "demo")
batch_generator = DataLoader(dataset=testset_loader, batch_size=cfg.num_gpus * cfg.test_batch_size,
shuffle=False, num_workers=cfg.num_thread, pin_memory=True)
self.testset = testset_loader
self.batch_generator = batch_generator
def _make_model(self):
self.logger.info('Load checkpoint from {}'.format(cfg.pretrained_model_path))
# prepare network
self.logger.info("Creating graph...")
model = get_model('test')
model = DataParallel(model).to(cfg.device)
ckpt = torch.load(cfg.pretrained_model_path, map_location=cfg.device)
from collections import OrderedDict
new_state_dict = OrderedDict()
for k, v in ckpt['network'].items():
if 'module' not in k:
k = 'module.' + k
k = k.replace('module.backbone', 'module.encoder').replace('body_rotation_net', 'body_regressor').replace(
'hand_rotation_net', 'hand_regressor')
new_state_dict[k] = v
model.load_state_dict(new_state_dict, strict=False)
model.eval()
self.model = model
def _evaluate(self, outs, cur_sample_idx):
eval_result = self.testset.evaluate(outs, cur_sample_idx)
return eval_result
-50
View File
@@ -1,50 +0,0 @@
import logging
import os
OK = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
END = '\033[0m'
PINK = '\033[95m'
BLUE = '\033[94m'
GREEN = OK
RED = FAIL
WHITE = END
YELLOW = WARNING
class colorlogger():
def __init__(self, log_dir, log_name='train_logs.txt'):
# set log
self._logger = logging.getLogger(log_name)
self._logger.setLevel(logging.INFO)
log_file = os.path.join(log_dir, log_name)
if not os.path.exists(log_dir):
os.makedirs(log_dir)
file_log = logging.FileHandler(log_file, mode='a')
file_log.setLevel(logging.INFO)
console_log = logging.StreamHandler()
console_log.setLevel(logging.INFO)
formatter = logging.Formatter(
"{}%(asctime)s{} %(message)s".format(GREEN, END),
"%m-%d %H:%M:%S")
file_log.setFormatter(formatter)
console_log.setFormatter(formatter)
self._logger.addHandler(file_log)
self._logger.addHandler(console_log)
def debug(self, msg):
self._logger.debug(str(msg))
def info(self, msg):
self._logger.info(str(msg))
def warning(self, msg):
self._logger.warning(WARNING + 'WRN: ' + str(msg) + END)
def critical(self, msg):
self._logger.critical(RED + 'CRI: ' + str(msg) + END)
def error(self, msg):
self._logger.error(RED + 'ERR: ' + str(msg) + END)
-53
View File
@@ -1,53 +0,0 @@
import torch.nn as nn
def make_linear_layers(feat_dims, relu_final=True, use_bn=False):
layers = []
for i in range(len(feat_dims)-1):
layers.append(nn.Linear(feat_dims[i], feat_dims[i+1]))
# Do not use ReLU for final estimation
if i < len(feat_dims)-2 or (i == len(feat_dims)-2 and relu_final):
if use_bn:
layers.append(nn.BatchNorm1d(feat_dims[i+1]))
layers.append(nn.ReLU(inplace=True))
return nn.Sequential(*layers)
def make_conv_layers(feat_dims, kernel=3, stride=1, padding=1, bnrelu_final=True):
layers = []
for i in range(len(feat_dims)-1):
layers.append(
nn.Conv2d(
in_channels=feat_dims[i],
out_channels=feat_dims[i+1],
kernel_size=kernel,
stride=stride,
padding=padding
))
# Do not use BN and ReLU for final estimation
if i < len(feat_dims)-2 or (i == len(feat_dims)-2 and bnrelu_final):
layers.append(nn.BatchNorm2d(feat_dims[i+1]))
layers.append(nn.ReLU(inplace=True))
return nn.Sequential(*layers)
def make_deconv_layers(feat_dims, bnrelu_final=True):
layers = []
for i in range(len(feat_dims)-1):
layers.append(
nn.ConvTranspose2d(
in_channels=feat_dims[i],
out_channels=feat_dims[i+1],
kernel_size=4,
stride=2,
padding=1,
output_padding=0,
bias=False))
# Do not use BN and ReLU for final estimation
if i < len(feat_dims)-2 or (i == len(feat_dims)-2 and bnrelu_final):
layers.append(nn.BatchNorm2d(feat_dims[i+1]))
layers.append(nn.ReLU(inplace=True))
return nn.Sequential(*layers)
-30
View File
@@ -1,30 +0,0 @@
import torch
import torch.nn as nn
class CoordLoss(nn.Module):
def __init__(self):
super(CoordLoss, self).__init__()
def forward(self, coord_out, coord_gt, valid, is_3D=None):
loss = torch.abs(coord_out - coord_gt) * valid
if is_3D is not None:
loss_z = loss[:,:,2:] * is_3D[:,None,None].float()
loss = torch.cat((loss[:,:,:2], loss_z),2)
return loss
class ParamLoss(nn.Module):
def __init__(self):
super(ParamLoss, self).__init__()
def forward(self, param_out, param_gt, valid):
loss = torch.abs(param_out - param_gt) * valid
return loss
class CELoss(nn.Module):
def __init__(self):
super(CELoss, self).__init__()
self.ce_loss = nn.CrossEntropyLoss(reduction='none')
def forward(self, out, gt_index):
loss = self.ce_loss(out, gt_index)
return loss
-172
View File
@@ -1,172 +0,0 @@
import torch
import torch.nn as nn
from torch.nn import functional as F
from nets.layer import make_conv_layers, make_linear_layers, make_deconv_layers
from utils.transforms import sample_joint_features, soft_argmax_2d, soft_argmax_3d
from utils.human_models import smpl_x
from config import cfg
from mmcv.ops.roi_align import roi_align
class PositionNet(nn.Module):
def __init__(self, part, feat_dim=768):
super(PositionNet, self).__init__()
if part == 'body':
self.joint_num = len(smpl_x.pos_joint_part['body'])
self.hm_shape = cfg.output_hm_shape
elif part == 'hand':
self.joint_num = len(smpl_x.pos_joint_part['rhand'])
self.hm_shape = cfg.output_hand_hm_shape
self.conv = make_conv_layers([feat_dim, self.joint_num * self.hm_shape[0]], kernel=1, stride=1, padding=0, bnrelu_final=False)
def forward(self, img_feat):
joint_hm = self.conv(img_feat).view(-1, self.joint_num, self.hm_shape[0], self.hm_shape[1], self.hm_shape[2])
joint_coord = soft_argmax_3d(joint_hm)
joint_hm = F.softmax(joint_hm.view(-1, self.joint_num, self.hm_shape[0] * self.hm_shape[1] * self.hm_shape[2]), 2)
joint_hm = joint_hm.view(-1, self.joint_num, self.hm_shape[0], self.hm_shape[1], self.hm_shape[2])
return joint_hm, joint_coord
class HandRotationNet(nn.Module):
def __init__(self, part, feat_dim = 768):
super(HandRotationNet, self).__init__()
self.part = part
self.joint_num = len(smpl_x.pos_joint_part['rhand'])
self.hand_conv = make_conv_layers([feat_dim, 512], kernel=1, stride=1, padding=0)
self.hand_pose_out = make_linear_layers([self.joint_num * 515, len(smpl_x.orig_joint_part['rhand']) * 6], relu_final=False)
self.feat_dim = feat_dim
def forward(self, img_feat, joint_coord_img):
batch_size = img_feat.shape[0]
img_feat = self.hand_conv(img_feat)
img_feat_joints = sample_joint_features(img_feat, joint_coord_img[:, :, :2])
feat = torch.cat((img_feat_joints, joint_coord_img), 2) # batch_size, joint_num, 512+3
hand_pose = self.hand_pose_out(feat.view(batch_size, -1))
return hand_pose
class BodyRotationNet(nn.Module):
def __init__(self, feat_dim = 768):
super(BodyRotationNet, self).__init__()
self.joint_num = len(smpl_x.pos_joint_part['body'])
self.body_conv = make_linear_layers([feat_dim, 512], relu_final=False)
self.root_pose_out = make_linear_layers([self.joint_num * (512+3), 6], relu_final=False)
self.body_pose_out = make_linear_layers(
[self.joint_num * (512+3), (len(smpl_x.orig_joint_part['body']) - 1) * 6], relu_final=False) # without root
self.shape_out = make_linear_layers([feat_dim, smpl_x.shape_param_dim], relu_final=False)
self.cam_out = make_linear_layers([feat_dim, 3], relu_final=False)
self.feat_dim = feat_dim
def forward(self, body_pose_token, shape_token, cam_token, body_joint_img):
batch_size = body_pose_token.shape[0]
# shape parameter
shape_param = self.shape_out(shape_token)
# camera parameter
cam_param = self.cam_out(cam_token)
# body pose parameter
body_pose_token = self.body_conv(body_pose_token)
body_pose_token = torch.cat((body_pose_token, body_joint_img), 2)
root_pose = self.root_pose_out(body_pose_token.view(batch_size, -1))
body_pose = self.body_pose_out(body_pose_token.view(batch_size, -1))
return root_pose, body_pose, shape_param, cam_param
class FaceRegressor(nn.Module):
def __init__(self, feat_dim=768):
super(FaceRegressor, self).__init__()
self.expr_out = make_linear_layers([feat_dim, smpl_x.expr_code_dim], relu_final=False)
self.jaw_pose_out = make_linear_layers([feat_dim, 6], relu_final=False)
def forward(self, expr_token, jaw_pose_token):
expr_param = self.expr_out(expr_token) # expression parameter
jaw_pose = self.jaw_pose_out(jaw_pose_token) # jaw pose parameter
return expr_param, jaw_pose
class BoxNet(nn.Module):
def __init__(self, feat_dim=768):
super(BoxNet, self).__init__()
self.joint_num = len(smpl_x.pos_joint_part['body'])
self.deconv = make_deconv_layers([feat_dim + self.joint_num * cfg.output_hm_shape[0], 256, 256, 256])
self.bbox_center = make_conv_layers([256, 3], kernel=1, stride=1, padding=0, bnrelu_final=False)
self.lhand_size = make_linear_layers([256, 256, 2], relu_final=False)
self.rhand_size = make_linear_layers([256, 256, 2], relu_final=False)
self.face_size = make_linear_layers([256, 256, 2], relu_final=False)
def forward(self, img_feat, joint_hm):
joint_hm = joint_hm.view(joint_hm.shape[0], joint_hm.shape[1] * cfg.output_hm_shape[0], cfg.output_hm_shape[1], cfg.output_hm_shape[2])
img_feat = torch.cat((img_feat, joint_hm), 1)
img_feat = self.deconv(img_feat)
# bbox center
bbox_center_hm = self.bbox_center(img_feat)
bbox_center = soft_argmax_2d(bbox_center_hm)
lhand_center, rhand_center, face_center = bbox_center[:, 0, :], bbox_center[:, 1, :], bbox_center[:, 2, :]
# bbox size
lhand_feat = sample_joint_features(img_feat, lhand_center[:, None, :].detach())[:, 0, :]
lhand_size = self.lhand_size(lhand_feat)
rhand_feat = sample_joint_features(img_feat, rhand_center[:, None, :].detach())[:, 0, :]
rhand_size = self.rhand_size(rhand_feat)
face_feat = sample_joint_features(img_feat, face_center[:, None, :].detach())[:, 0, :]
face_size = self.face_size(face_feat)
lhand_center = lhand_center / 8
rhand_center = rhand_center / 8
face_center = face_center / 8
return lhand_center, lhand_size, rhand_center, rhand_size, face_center, face_size
class BoxSizeNet(nn.Module):
def __init__(self):
super(BoxSizeNet, self).__init__()
self.lhand_size = make_linear_layers([256, 256, 2], relu_final=False)
self.rhand_size = make_linear_layers([256, 256, 2], relu_final=False)
self.face_size = make_linear_layers([256, 256, 2], relu_final=False)
def forward(self, box_fea):
# box_fea: [bs, 3, C]
lhand_size = self.lhand_size(box_fea[:, 0])
rhand_size = self.rhand_size(box_fea[:, 1])
face_size = self.face_size(box_fea[:, 2])
return lhand_size, rhand_size, face_size
class HandRoI(nn.Module):
def __init__(self, feat_dim=768, upscale=4):
super(HandRoI, self).__init__()
self.upscale = upscale
if upscale==1:
self.deconv = make_conv_layers([feat_dim, feat_dim], kernel=1, stride=1, padding=0, bnrelu_final=False)
self.conv = make_conv_layers([feat_dim, feat_dim], kernel=1, stride=1, padding=0, bnrelu_final=False)
elif upscale==2:
self.deconv = make_deconv_layers([feat_dim, feat_dim//2])
self.conv = make_conv_layers([feat_dim//2, feat_dim], kernel=1, stride=1, padding=0, bnrelu_final=False)
elif upscale==4:
self.deconv = make_deconv_layers([feat_dim, feat_dim//2, feat_dim//4])
self.conv = make_conv_layers([feat_dim//4, feat_dim], kernel=1, stride=1, padding=0, bnrelu_final=False)
elif upscale==8:
self.deconv = make_deconv_layers([feat_dim, feat_dim//2, feat_dim//4, feat_dim//8])
self.conv = make_conv_layers([feat_dim//8, feat_dim], kernel=1, stride=1, padding=0, bnrelu_final=False)
def forward(self, img_feat, lhand_bbox, rhand_bbox):
lhand_bbox = torch.cat((torch.arange(lhand_bbox.shape[0]).float().to(cfg.device)[:, None], lhand_bbox),
1) # batch_idx, xmin, ymin, xmax, ymax
rhand_bbox = torch.cat((torch.arange(rhand_bbox.shape[0]).float().to(cfg.device)[:, None], rhand_bbox),
1) # batch_idx, xmin, ymin, xmax, ymax
img_feat = self.deconv(img_feat)
lhand_bbox_roi = lhand_bbox.clone()
lhand_bbox_roi[:, 1] = lhand_bbox_roi[:, 1] / cfg.input_body_shape[1] * cfg.output_hm_shape[2] * self.upscale
lhand_bbox_roi[:, 2] = lhand_bbox_roi[:, 2] / cfg.input_body_shape[0] * cfg.output_hm_shape[1] * self.upscale
lhand_bbox_roi[:, 3] = lhand_bbox_roi[:, 3] / cfg.input_body_shape[1] * cfg.output_hm_shape[2] * self.upscale
lhand_bbox_roi[:, 4] = lhand_bbox_roi[:, 4] / cfg.input_body_shape[0] * cfg.output_hm_shape[1] * self.upscale
assert (cfg.output_hm_shape[1]*self.upscale, cfg.output_hm_shape[2]*self.upscale) == (img_feat.shape[2], img_feat.shape[3])
lhand_img_feat = roi_align(img_feat, lhand_bbox_roi, (cfg.output_hand_hm_shape[1], cfg.output_hand_hm_shape[2]), 1.0, 0, 'avg', False)
lhand_img_feat = torch.flip(lhand_img_feat, [3]) # flip to the right hand
rhand_bbox_roi = rhand_bbox.clone()
rhand_bbox_roi[:, 1] = rhand_bbox_roi[:, 1] / cfg.input_body_shape[1] * cfg.output_hm_shape[2] * self.upscale
rhand_bbox_roi[:, 2] = rhand_bbox_roi[:, 2] / cfg.input_body_shape[0] * cfg.output_hm_shape[1] * self.upscale
rhand_bbox_roi[:, 3] = rhand_bbox_roi[:, 3] / cfg.input_body_shape[1] * cfg.output_hm_shape[2] * self.upscale
rhand_bbox_roi[:, 4] = rhand_bbox_roi[:, 4] / cfg.input_body_shape[0] * cfg.output_hm_shape[1] * self.upscale
rhand_img_feat = roi_align(img_feat, rhand_bbox_roi, (cfg.output_hand_hm_shape[1], cfg.output_hand_hm_shape[2]), 1.0, 0, 'avg', False)
hand_img_feat = torch.cat((lhand_img_feat, rhand_img_feat)) # [bs, c, cfg.output_hand_hm_shape[2]*scale, cfg.output_hand_hm_shape[1]*scale]
hand_img_feat = self.conv(hand_img_feat)
return hand_img_feat
-38
View File
@@ -1,38 +0,0 @@
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import time
class Timer(object):
"""A simple timer."""
def __init__(self):
self.total_time = 0.
self.calls = 0
self.start_time = 0.
self.diff = 0.
self.average_time = 0.
self.warm_up = 0
def tic(self):
# using time.time instead of time.clock because time time.clock
# does not normalize for multithreading
self.start_time = time.time()
def toc(self, average=True):
self.diff = time.time() - self.start_time
if self.warm_up < 10:
self.warm_up += 1
return self.diff
else:
self.total_time += self.diff
self.calls += 1
self.average_time = self.total_time / self.calls
if average:
return self.average_time
else:
return self.diff
View File
-10
View File
@@ -1,10 +0,0 @@
import os
import sys
def make_folder(folder_name):
os.makedirs(folder_name, exist_ok=True)
def add_pypath(path):
if path not in sys.path:
sys.path.insert(0, path)
-217
View File
@@ -1,217 +0,0 @@
import mmcv
import os
import os.path as osp
import pickle
import shutil
import tempfile
import time
import torch
import torch.distributed as dist
from mmengine.dist import get_dist_info
import random
import numpy as np
import subprocess
def set_seed(seed):
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
# torch.set_deterministic(True)
def time_synchronized():
torch.cuda.synchronize() if torch.cuda.is_available() else None
return time.time()
def setup_for_distributed(is_master):
"""This function disables printing when not in master process."""
import builtins as __builtin__
builtin_print = __builtin__.print
def print(*args, **kwargs):
force = kwargs.pop('force', False)
if is_master or force:
builtin_print(*args, **kwargs)
__builtin__.print = print
def init_distributed_mode(port = None, master_port=29500):
"""Initialize slurm distributed training environment.
If argument ``port`` is not specified, then the master port will be system
environment variable ``MASTER_PORT``. If ``MASTER_PORT`` is not in system
environment variable, then a default port ``29500`` will be used.
Args:
backend (str): Backend of torch.distributed.
port (int, optional): Master port. Defaults to None.
"""
dist_backend = 'nccl'
proc_id = int(os.environ['SLURM_PROCID'])
ntasks = int(os.environ['SLURM_NTASKS'])
node_list = os.environ['SLURM_NODELIST']
num_gpus = torch.cuda.device_count()
torch.cuda.set_device(proc_id % num_gpus)
addr = subprocess.getoutput(
f'scontrol show hostname {node_list} | head -n1')
# specify master port
if port is not None:
os.environ['MASTER_PORT'] = str(port)
elif 'MASTER_PORT' in os.environ:
pass # use MASTER_PORT in the environment variable
else:
# 29500 is torch.distributed default port
os.environ['MASTER_PORT'] = str(master_port)
# use MASTER_ADDR in the environment variable if it already exists
if 'MASTER_ADDR' not in os.environ:
os.environ['MASTER_ADDR'] = addr
os.environ['WORLD_SIZE'] = str(ntasks)
os.environ['LOCAL_RANK'] = str(proc_id % num_gpus)
os.environ['RANK'] = str(proc_id)
dist.init_process_group(backend=dist_backend)
distributed = True
gpu_idx = proc_id % num_gpus
return distributed, gpu_idx
def is_dist_avail_and_initialized():
if not dist.is_available():
return False
if not dist.is_initialized():
return False
return True
def get_world_size():
if not is_dist_avail_and_initialized():
return 1
return dist.get_world_size()
def get_rank():
if not is_dist_avail_and_initialized():
return 0
return dist.get_rank()
def get_process_groups():
world_size = int(os.environ['WORLD_SIZE'])
ranks = list(range(world_size))
num_gpus = torch.cuda.device_count()
num_nodes = world_size // num_gpus
if world_size % num_gpus != 0:
raise NotImplementedError('Not implemented for node not fully used.')
groups = []
for node_idx in range(num_nodes):
groups.append(ranks[node_idx*num_gpus : (node_idx+1)*num_gpus])
process_groups = [torch.distributed.new_group(group) for group in groups]
return process_groups
def get_group_idx():
num_gpus = torch.cuda.device_count()
proc_id = get_rank()
group_idx = proc_id // num_gpus
return group_idx
def is_main_process():
return get_rank() == 0
def cleanup():
dist.destroy_process_group()
def collect_results(result_part, size, tmpdir=None):
rank, world_size = get_dist_info()
# create a tmp dir if it is not specified
if tmpdir is None:
MAX_LEN = 512
# 32 is whitespace
dir_tensor = torch.full((MAX_LEN, ),
32,
dtype=torch.uint8,
device='cuda')
if rank == 0:
tmpdir = tempfile.mkdtemp()
tmpdir = torch.tensor(
bytearray(tmpdir.encode()), dtype=torch.uint8, device='cuda')
dir_tensor[:len(tmpdir)] = tmpdir
dist.broadcast(dir_tensor, 0)
tmpdir = dir_tensor.cpu().numpy().tobytes().decode().rstrip()
else:
mmcv.mkdir_or_exist(tmpdir)
# dump the part result to the dir
mmcv.dump(result_part, osp.join(tmpdir, f'part_{rank}.pkl'))
dist.barrier()
# collect all parts
if rank != 0:
return None
else:
# load results of all parts from tmp dir
part_list = []
for i in range(world_size):
part_file = osp.join(tmpdir, f'part_{i}.pkl')
part_list.append(mmcv.load(part_file))
# sort the results
ordered_results = []
for res in zip(*part_list):
ordered_results.extend(list(res))
# the dataloader may pad some samples
ordered_results = ordered_results[:size]
# remove tmp dir
shutil.rmtree(tmpdir)
return ordered_results
def all_gather(data):
"""
Run all_gather on arbitrary picklable data (not necessarily tensors)
Args:
data:
Any picklable object
Returns:
data_list(list):
List of data gathered from each rank
"""
world_size = get_world_size()
if world_size == 1:
return [data]
# serialized to a Tensor
buffer = pickle.dumps(data)
storage = torch.ByteStorage.from_buffer(buffer)
tensor = torch.ByteTensor(storage).to('cuda')
# obtain Tensor size of each rank
local_size = torch.tensor([tensor.numel()], device='cuda')
size_list = [torch.tensor([0], device='cuda') for _ in range(world_size)]
dist.all_gather(size_list, local_size)
size_list = [int(size.item()) for size in size_list]
max_size = max(size_list)
# receiving Tensor from all ranks
# we pad the tensor because torch all_gather does not support
# gathering tensors of different shapes
tensor_list = []
for _ in size_list:
tensor_list.append(
torch.empty((max_size, ), dtype=torch.uint8, device='cuda'))
if local_size != max_size:
padding = torch.empty(
size=(max_size - local_size, ), dtype=torch.uint8, device='cuda')
tensor = torch.cat((tensor, padding), dim=0)
dist.all_gather(tensor_list, tensor)
data_list = []
for size, tensor in zip(size_list, tensor_list):
buffer = tensor.cpu().numpy().tobytes()[:size]
data_list.append(pickle.loads(buffer))
return data_list
-176
View File
@@ -1,176 +0,0 @@
import numpy as np
import torch
import os.path as osp
from config import cfg
from utils.smplx import smplx
import pickle
class SMPLX(object):
def __init__(self):
self.layer_arg = {'create_global_orient': False, 'create_body_pose': False, 'create_left_hand_pose': False, 'create_right_hand_pose': False, 'create_jaw_pose': False, 'create_leye_pose': False, 'create_reye_pose': False, 'create_betas': False, 'create_expression': False, 'create_transl': False}
self.layer = {'neutral': smplx.create(cfg.human_model_path, 'smplx', gender='NEUTRAL', use_pca=False, use_face_contour=True, **self.layer_arg),
'male': smplx.create(cfg.human_model_path, 'smplx', gender='MALE', use_pca=False, use_face_contour=True, **self.layer_arg),
'female': smplx.create(cfg.human_model_path, 'smplx', gender='FEMALE', use_pca=False, use_face_contour=True, **self.layer_arg)
}
self.vertex_num = 10475
self.face = self.layer['neutral'].faces
self.shape_param_dim = 10
self.expr_code_dim = 10
with open(osp.join(cfg.human_model_path, 'smplx', 'SMPLX_to_J14.pkl'), 'rb') as f:
self.j14_regressor = pickle.load(f, encoding='latin1')
with open(osp.join(cfg.human_model_path, 'smplx', 'MANO_SMPLX_vertex_ids.pkl'), 'rb') as f:
self.hand_vertex_idx = pickle.load(f, encoding='latin1')
self.face_vertex_idx = np.load(osp.join(cfg.human_model_path, 'smplx', 'SMPL-X__FLAME_vertex_ids.npy'))
self.J_regressor = self.layer['neutral'].J_regressor.numpy()
self.J_regressor_idx = {'pelvis': 0, 'lwrist': 20, 'rwrist': 21, 'neck': 12}
self.orig_hand_regressor = self.make_hand_regressor()
#self.orig_hand_regressor = {'left': self.layer.J_regressor.numpy()[[20,37,38,39,25,26,27,28,29,30,34,35,36,31,32,33],:], 'right': self.layer.J_regressor.numpy()[[21,52,53,54,40,41,42,43,44,45,49,50,51,46,47,48],:]}
# original SMPLX joint set
self.orig_joint_num = 53 # 22 (body joints) + 30 (hand joints) + 1 (face jaw joint)
self.orig_joints_name = \
('Pelvis', 'L_Hip', 'R_Hip', 'Spine_1', 'L_Knee', 'R_Knee', 'Spine_2', 'L_Ankle', 'R_Ankle', 'Spine_3', 'L_Foot', 'R_Foot', 'Neck', 'L_Collar', 'R_Collar', 'Head', 'L_Shoulder', 'R_Shoulder', 'L_Elbow', 'R_Elbow', 'L_Wrist', 'R_Wrist', # body joints
'L_Index_1', 'L_Index_2', 'L_Index_3', 'L_Middle_1', 'L_Middle_2', 'L_Middle_3', 'L_Pinky_1', 'L_Pinky_2', 'L_Pinky_3', 'L_Ring_1', 'L_Ring_2', 'L_Ring_3', 'L_Thumb_1', 'L_Thumb_2', 'L_Thumb_3', # left hand joints
'R_Index_1', 'R_Index_2', 'R_Index_3', 'R_Middle_1', 'R_Middle_2', 'R_Middle_3', 'R_Pinky_1', 'R_Pinky_2', 'R_Pinky_3', 'R_Ring_1', 'R_Ring_2', 'R_Ring_3', 'R_Thumb_1', 'R_Thumb_2', 'R_Thumb_3', # right hand joints
'Jaw' # face jaw joint
)
self.orig_flip_pairs = \
( (1,2), (4,5), (7,8), (10,11), (13,14), (16,17), (18,19), (20,21), # body joints
(22,37), (23,38), (24,39), (25,40), (26,41), (27,42), (28,43), (29,44), (30,45), (31,46), (32,47), (33,48), (34,49), (35,50), (36,51) # hand joints
)
self.orig_root_joint_idx = self.orig_joints_name.index('Pelvis')
self.orig_joint_part = \
{'body': range(self.orig_joints_name.index('Pelvis'), self.orig_joints_name.index('R_Wrist')+1),
'lhand': range(self.orig_joints_name.index('L_Index_1'), self.orig_joints_name.index('L_Thumb_3')+1),
'rhand': range(self.orig_joints_name.index('R_Index_1'), self.orig_joints_name.index('R_Thumb_3')+1),
'face': range(self.orig_joints_name.index('Jaw'), self.orig_joints_name.index('Jaw')+1)}
# changed SMPLX joint set for the supervision
self.joint_num = 137 # 25 (body joints) + 40 (hand joints) + 72 (face keypoints)
self.joints_name = \
('Pelvis', 'L_Hip', 'R_Hip', 'L_Knee', 'R_Knee', 'L_Ankle', 'R_Ankle', 'Neck', 'L_Shoulder', 'R_Shoulder', 'L_Elbow', 'R_Elbow', 'L_Wrist', 'R_Wrist', 'L_Big_toe', 'L_Small_toe', 'L_Heel', 'R_Big_toe', 'R_Small_toe', 'R_Heel', 'L_Ear', 'R_Ear', 'L_Eye', 'R_Eye', 'Nose',# body joints
'L_Thumb_1', 'L_Thumb_2', 'L_Thumb_3', 'L_Thumb_4', 'L_Index_1', 'L_Index_2', 'L_Index_3', 'L_Index_4', 'L_Middle_1', 'L_Middle_2', 'L_Middle_3', 'L_Middle_4', 'L_Ring_1', 'L_Ring_2', 'L_Ring_3', 'L_Ring_4', 'L_Pinky_1', 'L_Pinky_2', 'L_Pinky_3', 'L_Pinky_4', # left hand joints
'R_Thumb_1', 'R_Thumb_2', 'R_Thumb_3', 'R_Thumb_4', 'R_Index_1', 'R_Index_2', 'R_Index_3', 'R_Index_4', 'R_Middle_1', 'R_Middle_2', 'R_Middle_3', 'R_Middle_4', 'R_Ring_1', 'R_Ring_2', 'R_Ring_3', 'R_Ring_4', 'R_Pinky_1', 'R_Pinky_2', 'R_Pinky_3', 'R_Pinky_4', # right hand joints
*['Face_' + str(i) for i in range(1,73)] # face keypoints (too many keypoints... omit real names. have same name of keypoints defined in FLAME class)
)
self.root_joint_idx = self.joints_name.index('Pelvis')
self.lwrist_idx = self.joints_name.index('L_Wrist')
self.rwrist_idx = self.joints_name.index('R_Wrist')
self.neck_idx = self.joints_name.index('Neck')
self.flip_pairs = \
( (1,2), (3,4), (5,6), (8,9), (10,11), (12,13), (14,17), (15,18), (16,19), (20,21), (22,23), # body joints
(25,45), (26,46), (27,47), (28,48), (29,49), (30,50), (31,51), (32,52), (33,53), (34,54), (35,55), (36,56), (37,57), (38,58), (39,59), (40,60), (41,61), (42,62), (43,63), (44,64), # hand joints
(67,68), # face eyeballs
(69,78), (70,77), (71,76), (72,75), (73,74), # face eyebrow
(83,87), (84,86), # face below nose
(88,97), (89,96), (90,95), (91,94), (92,99), (93,98), # face eyes
(100,106), (101,105), (102,104), (107,111), (108,110), # face mouth
(112,116), (113,115), (117,119), # face lip
(120,136), (121,135), (122,134), (123,133), (124,132), (125,131), (126,130), (127,129) # face contours
)
self.joint_idx = \
(0,1,2,4,5,7,8,12,16,17,18,19,20,21,60,61,62,63,64,65,59,58,57,56,55, # body joints
37,38,39,66,25,26,27,67,28,29,30,68,34,35,36,69,31,32,33,70, # left hand joints
52,53,54,71,40,41,42,72,43,44,45,73,49,50,51,74,46,47,48,75, # right hand joints
22,15, # jaw, head
57,56, # eyeballs
76,77,78,79,80,81,82,83,84,85, # eyebrow
86,87,88,89, # nose
90,91,92,93,94, # below nose
95,96,97,98,99,100,101,102,103,104,105,106, # eyes
107, # right mouth
108,109,110,111,112, # upper mouth
113, # left mouth
114,115,116,117,118, # lower mouth
119, # right lip
120,121,122, # upper lip
123, # left lip
124,125,126, # lower lip
127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143 # face contour
)
self.joint_part = \
{'body': range(self.joints_name.index('Pelvis'), self.joints_name.index('Nose')+1),
'lhand': range(self.joints_name.index('L_Thumb_1'), self.joints_name.index('L_Pinky_4')+1),
'rhand': range(self.joints_name.index('R_Thumb_1'), self.joints_name.index('R_Pinky_4')+1),
'hand': range(self.joints_name.index('L_Thumb_1'), self.joints_name.index('R_Pinky_4')+1),
'face': range(self.joints_name.index('Face_1'), self.joints_name.index('Face_72')+1)}
# changed SMPLX joint set for PositionNet prediction
self.pos_joint_num = 65 # 25 (body joints) + 40 (hand joints)
self.pos_joints_name = \
('Pelvis', 'L_Hip', 'R_Hip', 'L_Knee', 'R_Knee', 'L_Ankle', 'R_Ankle', 'Neck', 'L_Shoulder', 'R_Shoulder', 'L_Elbow', 'R_Elbow', 'L_Wrist', 'R_Wrist', 'L_Big_toe', 'L_Small_toe', 'L_Heel', 'R_Big_toe', 'R_Small_toe', 'R_Heel', 'L_Ear', 'R_Ear', 'L_Eye', 'R_Eye', 'Nose', # body joints
'L_Thumb_1', 'L_Thumb_2', 'L_Thumb_3', 'L_Thumb_4', 'L_Index_1', 'L_Index_2', 'L_Index_3', 'L_Index_4', 'L_Middle_1', 'L_Middle_2', 'L_Middle_3', 'L_Middle_4', 'L_Ring_1', 'L_Ring_2', 'L_Ring_3', 'L_Ring_4', 'L_Pinky_1', 'L_Pinky_2', 'L_Pinky_3', 'L_Pinky_4', # left hand joints
'R_Thumb_1', 'R_Thumb_2', 'R_Thumb_3', 'R_Thumb_4', 'R_Index_1', 'R_Index_2', 'R_Index_3', 'R_Index_4', 'R_Middle_1', 'R_Middle_2', 'R_Middle_3', 'R_Middle_4', 'R_Ring_1', 'R_Ring_2', 'R_Ring_3', 'R_Ring_4', 'R_Pinky_1', 'R_Pinky_2', 'R_Pinky_3', 'R_Pinky_4', # right hand joints
)
self.pos_joint_part = \
{'body': range(self.pos_joints_name.index('Pelvis'), self.pos_joints_name.index('Nose')+1),
'lhand': range(self.pos_joints_name.index('L_Thumb_1'), self.pos_joints_name.index('L_Pinky_4')+1),
'rhand': range(self.pos_joints_name.index('R_Thumb_1'), self.pos_joints_name.index('R_Pinky_4')+1),
'hand': range(self.pos_joints_name.index('L_Thumb_1'), self.pos_joints_name.index('R_Pinky_4')+1)}
self.pos_joint_part['L_MCP'] = [self.pos_joints_name.index('L_Index_1') - len(self.pos_joint_part['body']),
self.pos_joints_name.index('L_Middle_1') - len(self.pos_joint_part['body']),
self.pos_joints_name.index('L_Ring_1') - len(self.pos_joint_part['body']),
self.pos_joints_name.index('L_Pinky_1') - len(self.pos_joint_part['body'])]
self.pos_joint_part['R_MCP'] = [self.pos_joints_name.index('R_Index_1') - len(self.pos_joint_part['body']) - len(self.pos_joint_part['lhand']),
self.pos_joints_name.index('R_Middle_1') - len(self.pos_joint_part['body']) - len(self.pos_joint_part['lhand']),
self.pos_joints_name.index('R_Ring_1') - len(self.pos_joint_part['body']) - len(self.pos_joint_part['lhand']),
self.pos_joints_name.index('R_Pinky_1') - len(self.pos_joint_part['body']) - len(self.pos_joint_part['lhand'])]
def make_hand_regressor(self):
regressor = self.layer['neutral'].J_regressor.numpy()
lhand_regressor = np.concatenate((regressor[[20,37,38,39],:],
np.eye(self.vertex_num)[5361,None],
regressor[[25,26,27],:],
np.eye(self.vertex_num)[4933,None],
regressor[[28,29,30],:],
np.eye(self.vertex_num)[5058,None],
regressor[[34,35,36],:],
np.eye(self.vertex_num)[5169,None],
regressor[[31,32,33],:],
np.eye(self.vertex_num)[5286,None]))
rhand_regressor = np.concatenate((regressor[[21,52,53,54],:],
np.eye(self.vertex_num)[8079,None],
regressor[[40,41,42],:],
np.eye(self.vertex_num)[7669,None],
regressor[[43,44,45],:],
np.eye(self.vertex_num)[7794,None],
regressor[[49,50,51],:],
np.eye(self.vertex_num)[7905,None],
regressor[[46,47,48],:],
np.eye(self.vertex_num)[8022,None]))
hand_regressor = {'left': lhand_regressor, 'right': rhand_regressor}
return hand_regressor
def reduce_joint_set(self, joint):
new_joint = []
for name in self.pos_joints_name:
idx = self.joints_name.index(name)
new_joint.append(joint[:,idx,:])
new_joint = torch.stack(new_joint,1)
return new_joint
class SMPL(object):
def __init__(self):
self.layer_arg = {'create_body_pose': False, 'create_betas': False, 'create_global_orient': False, 'create_transl': False}
self.layer = {'neutral': smplx.create(cfg.human_model_path, 'smpl', gender='NEUTRAL', **self.layer_arg), 'male': smplx.create(cfg.human_model_path, 'smpl', gender='MALE', **self.layer_arg), 'female': smplx.create(cfg.human_model_path, 'smpl', gender='FEMALE', **self.layer_arg)}
self.vertex_num = 6890
self.face = self.layer['neutral'].faces
self.shape_param_dim = 10
self.vposer_code_dim = 32
# original SMPL joint set
self.orig_joint_num = 24
self.orig_joints_name = ('Pelvis', 'L_Hip', 'R_Hip', 'Spine_1', 'L_Knee', 'R_Knee', 'Spine_2', 'L_Ankle', 'R_Ankle', 'Spine_3', 'L_Foot', 'R_Foot', 'Neck', 'L_Collar', 'R_Collar', 'Head', 'L_Shoulder', 'R_Shoulder', 'L_Elbow', 'R_Elbow', 'L_Wrist', 'R_Wrist', 'L_Hand', 'R_Hand')
self.orig_flip_pairs = ( (1,2), (4,5), (7,8), (10,11), (13,14), (16,17), (18,19), (20,21), (22,23) )
self.orig_root_joint_idx = self.orig_joints_name.index('Pelvis')
self.orig_joint_regressor = self.layer['neutral'].J_regressor.numpy().astype(np.float32)
self.joint_num = self.orig_joint_num
self.joints_name = self.orig_joints_name
self.flip_pairs = self.orig_flip_pairs
self.root_joint_idx = self.orig_root_joint_idx
self.joint_regressor = self.orig_joint_regressor
smpl_x = SMPLX()
smpl = SMPL()
-153
View File
@@ -1,153 +0,0 @@
from typing import Literal, Union
def process_mmdet_results(mmdet_results: list,
cat_id: int = 0,
multi_person: bool = True) -> list:
"""Process mmdet results, sort bboxes by area in descending order.
Args:
mmdet_results (list):
Result of mmdet.apis.inference_detector
when the input is a batch.
Shape of the nested lists is
(n_frame, n_category, n_human, 5).
cat_id (int, optional):
Category ID. This function will only select
the selected category, and drop the others.
Defaults to 0, ID of human category.
multi_person (bool, optional):
Whether to allow multi-person detection, which is
slower than single-person. If false, the function
only assure that the first person of each frame
has the biggest bbox.
Defaults to True.
Returns:
list:
A list of detected bounding boxes.
Shape of the nested lists is
(n_frame, n_human, 5)
and each bbox is (x, y, x, y, score).
"""
ret_list = []
only_max_arg = not multi_person
# for _, frame_results in enumerate(mmdet_results):
cat_bboxes = mmdet_results[cat_id]
# import pdb; pdb.set_trace()
sorted_bbox = qsort_bbox_list(cat_bboxes, only_max_arg)
if only_max_arg:
ret_list.append(sorted_bbox[0:1])
else:
ret_list.append(sorted_bbox)
return ret_list
def qsort_bbox_list(bbox_list: list,
only_max: bool = False,
bbox_convention: Literal['xyxy', 'xywh'] = 'xyxy'):
"""Sort a list of bboxes, by their area in pixel(W*H).
Args:
input_list (list):
A list of bboxes. Each item is a list of (x1, y1, x2, y2)
only_max (bool, optional):
If True, only assure the max element at first place,
others may not be well sorted.
If False, return a well sorted descending list.
Defaults to False.
bbox_convention (str, optional):
Bbox type, xyxy or xywh. Defaults to 'xyxy'.
Returns:
list:
A sorted(maybe not so well) descending list.
"""
# import pdb; pdb.set_trace()
if len(bbox_list) <= 1:
return bbox_list
else:
bigger_list = []
less_list = []
anchor_index = int(len(bbox_list) / 2)
anchor_bbox = bbox_list[anchor_index]
anchor_area = get_area_of_bbox(anchor_bbox, bbox_convention)
for i in range(len(bbox_list)):
if i == anchor_index:
continue
tmp_bbox = bbox_list[i]
tmp_area = get_area_of_bbox(tmp_bbox, bbox_convention)
if tmp_area >= anchor_area:
bigger_list.append(tmp_bbox)
else:
less_list.append(tmp_bbox)
if only_max:
return qsort_bbox_list(bigger_list) + \
[anchor_bbox, ] + less_list
else:
return qsort_bbox_list(bigger_list) + \
[anchor_bbox, ] + qsort_bbox_list(less_list)
def get_area_of_bbox(
bbox: Union[list, tuple],
bbox_convention: Literal['xyxy', 'xywh'] = 'xyxy') -> float:
"""Get the area of a bbox_xyxy.
Args:
(Union[list, tuple]):
A list of [x1, y1, x2, y2].
bbox_convention (str, optional):
Bbox type, xyxy or xywh. Defaults to 'xyxy'.
Returns:
float:
Area of the bbox(|y2-y1|*|x2-x1|).
"""
# import pdb;pdb.set_trace()
if bbox_convention == 'xyxy':
return abs(bbox[2] - bbox[0]) * abs(bbox[3] - bbox[1])
elif bbox_convention == 'xywh':
return abs(bbox[2] * bbox[3])
else:
raise TypeError(f'Wrong bbox convention: {bbox_convention}')
def calculate_iou(bbox1, bbox2):
# Calculate the Intersection over Union (IoU) between two bounding boxes
x1 = max(bbox1[0], bbox2[0])
y1 = max(bbox1[1], bbox2[1])
x2 = min(bbox1[2], bbox2[2])
y2 = min(bbox1[3], bbox2[3])
intersection_area = max(0, x2 - x1 + 1) * max(0, y2 - y1 + 1)
bbox1_area = (bbox1[2] - bbox1[0] + 1) * (bbox1[3] - bbox1[1] + 1)
bbox2_area = (bbox2[2] - bbox2[0] + 1) * (bbox2[3] - bbox2[1] + 1)
union_area = bbox1_area + bbox2_area - intersection_area
iou = intersection_area / union_area
return iou
def non_max_suppression(bboxes, iou_threshold):
# Sort the bounding boxes by their confidence scores (e.g., the probability of containing an object)
bboxes = sorted(bboxes, key=lambda x: x[4], reverse=True)
# Initialize a list to store the selected bounding boxes
selected_bboxes = []
# Perform non-maximum suppression
while len(bboxes) > 0:
current_bbox = bboxes[0]
selected_bboxes.append(current_bbox)
bboxes = bboxes[1:]
remaining_bboxes = []
for bbox in bboxes:
iou = calculate_iou(current_bbox, bbox)
if iou < iou_threshold:
remaining_bboxes.append(bbox)
bboxes = remaining_bboxes
return selected_bboxes
-541
View File
@@ -1,541 +0,0 @@
import numpy as np
import cv2
import random
from config import cfg
import math
from utils.human_models import smpl_x, smpl
from utils.transforms import cam2pixel, transform_joint_to_other_db
from plyfile import PlyData, PlyElement
import torch
def load_img(path, order='RGB'):
img = cv2.imread(path, cv2.IMREAD_COLOR | cv2.IMREAD_IGNORE_ORIENTATION)
if not isinstance(img, np.ndarray):
raise IOError("Fail to read %s" % path)
if order == 'RGB':
img = img[:, :, ::-1].copy()
img = img.astype(np.float32)
return img
def get_bbox(joint_img, joint_valid, extend_ratio=1.2):
x_img, y_img = joint_img[:, 0], joint_img[:, 1]
x_img = x_img[joint_valid == 1];
y_img = y_img[joint_valid == 1];
xmin = min(x_img);
ymin = min(y_img);
xmax = max(x_img);
ymax = max(y_img);
x_center = (xmin + xmax) / 2.;
width = xmax - xmin;
xmin = x_center - 0.5 * width * extend_ratio
xmax = x_center + 0.5 * width * extend_ratio
y_center = (ymin + ymax) / 2.;
height = ymax - ymin;
ymin = y_center - 0.5 * height * extend_ratio
ymax = y_center + 0.5 * height * extend_ratio
bbox = np.array([xmin, ymin, xmax - xmin, ymax - ymin]).astype(np.float32)
return bbox
def sanitize_bbox(bbox, img_width, img_height):
x, y, w, h = bbox
x1 = np.max((0, x))
y1 = np.max((0, y))
x2 = np.min((img_width - 1, x1 + np.max((0, w - 1))))
y2 = np.min((img_height - 1, y1 + np.max((0, h - 1))))
if w * h > 0 and x2 > x1 and y2 > y1:
bbox = np.array([x1, y1, x2 - x1, y2 - y1])
else:
bbox = None
return bbox
def process_bbox(bbox, img_width, img_height, ratio=1.25):
bbox = sanitize_bbox(bbox, img_width, img_height)
if bbox is None:
return bbox
# aspect ratio preserving bbox
w = bbox[2]
h = bbox[3]
c_x = bbox[0] + w / 2.
c_y = bbox[1] + h / 2.
aspect_ratio = cfg.input_img_shape[1] / cfg.input_img_shape[0]
if w > aspect_ratio * h:
h = w / aspect_ratio
elif w < aspect_ratio * h:
w = h * aspect_ratio
bbox[2] = w * ratio
bbox[3] = h * ratio
bbox[0] = c_x - bbox[2] / 2.
bbox[1] = c_y - bbox[3] / 2.
bbox = bbox.astype(np.float32)
return bbox
def get_aug_config():
scale_factor = 0.25
rot_factor = 30
color_factor = 0.2
scale = np.clip(np.random.randn(), -1.0, 1.0) * scale_factor + 1.0
rot = np.clip(np.random.randn(), -2.0,
2.0) * rot_factor if random.random() <= 0.6 else 0
c_up = 1.0 + color_factor
c_low = 1.0 - color_factor
color_scale = np.array([random.uniform(c_low, c_up), random.uniform(c_low, c_up), random.uniform(c_low, c_up)])
do_flip = random.random() <= 0.5
return scale, rot, color_scale, do_flip
def augmentation(img, bbox, data_split):
if getattr(cfg, 'no_aug', False):
scale, rot, color_scale, do_flip = 1.0, 0.0, np.array([1, 1, 1]), False
elif data_split == 'train':
scale, rot, color_scale, do_flip = get_aug_config()
else:
scale, rot, color_scale, do_flip = 1.0, 0.0, np.array([1, 1, 1]), False
img, trans, inv_trans = generate_patch_image(img, bbox, scale, rot, do_flip, cfg.input_img_shape)
img = np.clip(img * color_scale[None, None, :], 0, 255)
return img, trans, inv_trans, rot, do_flip
def generate_patch_image(cvimg, bbox, scale, rot, do_flip, out_shape):
img = cvimg.copy()
img_height, img_width, img_channels = img.shape
bb_c_x = float(bbox[0] + 0.5 * bbox[2])
bb_c_y = float(bbox[1] + 0.5 * bbox[3])
bb_width = float(bbox[2])
bb_height = float(bbox[3])
if do_flip:
img = img[:, ::-1, :]
bb_c_x = img_width - bb_c_x - 1
trans = gen_trans_from_patch_cv(bb_c_x, bb_c_y, bb_width, bb_height, out_shape[1], out_shape[0], scale, rot)
img_patch = cv2.warpAffine(img, trans, (int(out_shape[1]), int(out_shape[0])), flags=cv2.INTER_LINEAR)
img_patch = img_patch.astype(np.float32)
inv_trans = gen_trans_from_patch_cv(bb_c_x, bb_c_y, bb_width, bb_height, out_shape[1], out_shape[0], scale, rot,
inv=True)
return img_patch, trans, inv_trans
def rotate_2d(pt_2d, rot_rad):
x = pt_2d[0]
y = pt_2d[1]
sn, cs = np.sin(rot_rad), np.cos(rot_rad)
xx = x * cs - y * sn
yy = x * sn + y * cs
return np.array([xx, yy], dtype=np.float32)
def gen_trans_from_patch_cv(c_x, c_y, src_width, src_height, dst_width, dst_height, scale, rot, inv=False):
# augment size with scale
src_w = src_width * scale
src_h = src_height * scale
src_center = np.array([c_x, c_y], dtype=np.float32)
# augment rotation
rot_rad = np.pi * rot / 180
src_downdir = rotate_2d(np.array([0, src_h * 0.5], dtype=np.float32), rot_rad)
src_rightdir = rotate_2d(np.array([src_w * 0.5, 0], dtype=np.float32), rot_rad)
dst_w = dst_width
dst_h = dst_height
dst_center = np.array([dst_w * 0.5, dst_h * 0.5], dtype=np.float32)
dst_downdir = np.array([0, dst_h * 0.5], dtype=np.float32)
dst_rightdir = np.array([dst_w * 0.5, 0], dtype=np.float32)
src = np.zeros((3, 2), dtype=np.float32)
src[0, :] = src_center
src[1, :] = src_center + src_downdir
src[2, :] = src_center + src_rightdir
dst = np.zeros((3, 2), dtype=np.float32)
dst[0, :] = dst_center
dst[1, :] = dst_center + dst_downdir
dst[2, :] = dst_center + dst_rightdir
if inv:
trans = cv2.getAffineTransform(np.float32(dst), np.float32(src))
else:
trans = cv2.getAffineTransform(np.float32(src), np.float32(dst))
trans = trans.astype(np.float32)
return trans
def process_db_coord(joint_img, joint_cam, joint_valid, do_flip, img_shape, flip_pairs, img2bb_trans, rot,
src_joints_name, target_joints_name):
joint_img_original = joint_img.copy()
joint_img, joint_cam, joint_valid = joint_img.copy(), joint_cam.copy(), joint_valid.copy()
# flip augmentation
if do_flip:
joint_cam[:, 0] = -joint_cam[:, 0]
joint_img[:, 0] = img_shape[1] - 1 - joint_img[:, 0]
for pair in flip_pairs:
joint_img[pair[0], :], joint_img[pair[1], :] = joint_img[pair[1], :].copy(), joint_img[pair[0], :].copy()
joint_cam[pair[0], :], joint_cam[pair[1], :] = joint_cam[pair[1], :].copy(), joint_cam[pair[0], :].copy()
joint_valid[pair[0], :], joint_valid[pair[1], :] = joint_valid[pair[1], :].copy(), joint_valid[pair[0],
:].copy()
# 3D data rotation augmentation
rot_aug_mat = np.array([[np.cos(np.deg2rad(-rot)), -np.sin(np.deg2rad(-rot)), 0],
[np.sin(np.deg2rad(-rot)), np.cos(np.deg2rad(-rot)), 0],
[0, 0, 1]], dtype=np.float32)
joint_cam = np.dot(rot_aug_mat, joint_cam.transpose(1, 0)).transpose(1, 0)
# affine transformation
joint_img_xy1 = np.concatenate((joint_img[:, :2], np.ones_like(joint_img[:, :1])), 1)
joint_img[:, :2] = np.dot(img2bb_trans, joint_img_xy1.transpose(1, 0)).transpose(1, 0)
joint_img[:, 0] = joint_img[:, 0] / cfg.input_img_shape[1] * cfg.output_hm_shape[2]
joint_img[:, 1] = joint_img[:, 1] / cfg.input_img_shape[0] * cfg.output_hm_shape[1]
# check truncation
joint_trunc = joint_valid * ((joint_img_original[:, 0] > 0) * (joint_img[:, 0] >= 0) * (joint_img[:, 0] < cfg.output_hm_shape[2]) * \
(joint_img_original[:, 1] > 0) *(joint_img[:, 1] >= 0) * (joint_img[:, 1] < cfg.output_hm_shape[1]) * \
(joint_img_original[:, 2] > 0) *(joint_img[:, 2] >= 0) * (joint_img[:, 2] < cfg.output_hm_shape[0])).reshape(-1,
1).astype(
np.float32)
# transform joints to target db joints
joint_img = transform_joint_to_other_db(joint_img, src_joints_name, target_joints_name)
joint_cam_wo_ra = transform_joint_to_other_db(joint_cam, src_joints_name, target_joints_name)
joint_valid = transform_joint_to_other_db(joint_valid, src_joints_name, target_joints_name)
joint_trunc = transform_joint_to_other_db(joint_trunc, src_joints_name, target_joints_name)
# root-alignment, for joint_cam input wo ra
joint_cam_ra = joint_cam_wo_ra.copy()
joint_cam_ra = joint_cam_ra - joint_cam_ra[smpl_x.root_joint_idx, None, :] # root-relative
joint_cam_ra[smpl_x.joint_part['lhand'], :] = joint_cam_ra[smpl_x.joint_part['lhand'], :] - joint_cam_ra[
smpl_x.lwrist_idx, None,
:] # left hand root-relative
joint_cam_ra[smpl_x.joint_part['rhand'], :] = joint_cam_ra[smpl_x.joint_part['rhand'], :] - joint_cam_ra[
smpl_x.rwrist_idx, None,
:] # right hand root-relative
joint_cam_ra[smpl_x.joint_part['face'], :] = joint_cam_ra[smpl_x.joint_part['face'], :] - joint_cam_ra[smpl_x.neck_idx,
None,
:] # face root-relative
return joint_img, joint_cam_wo_ra, joint_cam_ra, joint_valid, joint_trunc
def process_human_model_output(human_model_param, cam_param, do_flip, img_shape, img2bb_trans, rot, human_model_type, joint_img=None):
if human_model_type == 'smplx':
human_model = smpl_x
rotation_valid = np.ones((smpl_x.orig_joint_num), dtype=np.float32)
coord_valid = np.ones((smpl_x.joint_num), dtype=np.float32)
root_pose, body_pose, shape, trans = human_model_param['root_pose'], human_model_param['body_pose'], \
human_model_param['shape'], human_model_param['trans']
if 'lhand_pose' in human_model_param and human_model_param['lhand_valid']:
lhand_pose = human_model_param['lhand_pose']
else:
lhand_pose = np.zeros((3 * len(smpl_x.orig_joint_part['lhand'])), dtype=np.float32)
rotation_valid[smpl_x.orig_joint_part['lhand']] = 0
coord_valid[smpl_x.joint_part['lhand']] = 0
if 'rhand_pose' in human_model_param and human_model_param['rhand_valid']:
rhand_pose = human_model_param['rhand_pose']
else:
rhand_pose = np.zeros((3 * len(smpl_x.orig_joint_part['rhand'])), dtype=np.float32)
rotation_valid[smpl_x.orig_joint_part['rhand']] = 0
coord_valid[smpl_x.joint_part['rhand']] = 0
if 'jaw_pose' in human_model_param and 'expr' in human_model_param and human_model_param['face_valid']:
jaw_pose = human_model_param['jaw_pose']
expr = human_model_param['expr']
expr_valid = True
else:
jaw_pose = np.zeros((3), dtype=np.float32)
expr = np.zeros((smpl_x.expr_code_dim), dtype=np.float32)
rotation_valid[smpl_x.orig_joint_part['face']] = 0
coord_valid[smpl_x.joint_part['face']] = 0
expr_valid = False
if 'gender' in human_model_param:
gender = human_model_param['gender']
else:
gender = 'neutral'
root_pose = torch.FloatTensor(root_pose).view(1, 3) # (1,3)
body_pose = torch.FloatTensor(body_pose).view(-1, 3) # (21,3)
lhand_pose = torch.FloatTensor(lhand_pose).view(-1, 3) # (15,3)
rhand_pose = torch.FloatTensor(rhand_pose).view(-1, 3) # (15,3)
jaw_pose = torch.FloatTensor(jaw_pose).view(-1, 3) # (1,3)
shape = torch.FloatTensor(shape).view(1, -1) # SMPLX shape parameter
expr = torch.FloatTensor(expr).view(1, -1) # SMPLX expression parameter
trans = torch.FloatTensor(trans).view(1, -1) # translation vector
# apply camera extrinsic (rotation)
# merge root pose and camera rotation
if 'R' in cam_param:
R = np.array(cam_param['R'], dtype=np.float32).reshape(3, 3)
root_pose = root_pose.numpy()
root_pose, _ = cv2.Rodrigues(root_pose)
root_pose, _ = cv2.Rodrigues(np.dot(R, root_pose))
root_pose = torch.from_numpy(root_pose).view(1, 3)
# get mesh and joint coordinates
zero_pose = torch.zeros((1, 3)).float() # eye poses
with torch.no_grad():
output = smpl_x.layer[gender](betas=shape, body_pose=body_pose.view(1, -1), global_orient=root_pose,
transl=trans, left_hand_pose=lhand_pose.view(1, -1),
right_hand_pose=rhand_pose.view(1, -1), jaw_pose=jaw_pose.view(1, -1),
leye_pose=zero_pose, reye_pose=zero_pose, expression=expr)
mesh_cam = output.vertices[0].numpy()
joint_cam = output.joints[0].numpy()[smpl_x.joint_idx, :]
# apply camera exrinsic (translation)
# compenstate rotation (translation from origin to root joint was not cancled)
if 'R' in cam_param and 't' in cam_param:
R, t = np.array(cam_param['R'], dtype=np.float32).reshape(3, 3), np.array(cam_param['t'],
dtype=np.float32).reshape(1, 3)
root_cam = joint_cam[smpl_x.root_joint_idx, None, :]
joint_cam = joint_cam - root_cam + np.dot(R, root_cam.transpose(1, 0)).transpose(1, 0) + t
mesh_cam = mesh_cam - root_cam + np.dot(R, root_cam.transpose(1, 0)).transpose(1, 0) + t
# concat root, body, two hands, and jaw pose
pose = torch.cat((root_pose, body_pose, lhand_pose, rhand_pose, jaw_pose))
# joint coordinates
if 'focal' not in cam_param or 'princpt' not in cam_param:
assert joint_img is not None
else:
joint_img = cam2pixel(joint_cam, cam_param['focal'], cam_param['princpt'])
joint_img_original = joint_img.copy()
joint_cam = joint_cam - joint_cam[smpl_x.root_joint_idx, None, :] # root-relative
joint_cam[smpl_x.joint_part['lhand'], :] = joint_cam[smpl_x.joint_part['lhand'], :] - joint_cam[
smpl_x.lwrist_idx, None,
:] # left hand root-relative
joint_cam[smpl_x.joint_part['rhand'], :] = joint_cam[smpl_x.joint_part['rhand'], :] - joint_cam[
smpl_x.rwrist_idx, None,
:] # right hand root-relative
joint_cam[smpl_x.joint_part['face'], :] = joint_cam[smpl_x.joint_part['face'], :] - joint_cam[smpl_x.neck_idx,
None,
:] # face root-relative
joint_img[smpl_x.joint_part['body'], 2] = (joint_cam[smpl_x.joint_part['body'], 2].copy() / (
cfg.body_3d_size / 2) + 1) / 2. * cfg.output_hm_shape[0] # body depth discretize
joint_img[smpl_x.joint_part['lhand'], 2] = (joint_cam[smpl_x.joint_part['lhand'], 2].copy() / (
cfg.hand_3d_size / 2) + 1) / 2. * cfg.output_hm_shape[0] # left hand depth discretize
joint_img[smpl_x.joint_part['rhand'], 2] = (joint_cam[smpl_x.joint_part['rhand'], 2].copy() / (
cfg.hand_3d_size / 2) + 1) / 2. * cfg.output_hm_shape[0] # right hand depth discretize
joint_img[smpl_x.joint_part['face'], 2] = (joint_cam[smpl_x.joint_part['face'], 2].copy() / (
cfg.face_3d_size / 2) + 1) / 2. * cfg.output_hm_shape[0] # face depth discretize
elif human_model_type == 'smpl':
human_model = smpl
pose, shape, trans = human_model_param['pose'], human_model_param['shape'], human_model_param['trans']
if 'gender' in human_model_param:
gender = human_model_param['gender']
else:
gender = 'neutral'
pose = torch.FloatTensor(pose).view(-1, 3)
shape = torch.FloatTensor(shape).view(1, -1);
trans = torch.FloatTensor(trans).view(1, -1) # translation vector
# apply camera extrinsic (rotation)
# merge root pose and camera rotation
if 'R' in cam_param:
R = np.array(cam_param['R'], dtype=np.float32).reshape(3, 3)
root_pose = pose[smpl.orig_root_joint_idx, :].numpy()
root_pose, _ = cv2.Rodrigues(root_pose)
root_pose, _ = cv2.Rodrigues(np.dot(R, root_pose))
pose[smpl.orig_root_joint_idx] = torch.from_numpy(root_pose).view(3)
# get mesh and joint coordinates
root_pose = pose[smpl.orig_root_joint_idx].view(1, 3)
body_pose = torch.cat((pose[:smpl.orig_root_joint_idx, :], pose[smpl.orig_root_joint_idx + 1:, :])).view(1, -1)
with torch.no_grad():
output = smpl.layer[gender](betas=shape, body_pose=body_pose, global_orient=root_pose, transl=trans)
mesh_cam = output.vertices[0].numpy()
joint_cam = np.dot(smpl.joint_regressor, mesh_cam)
# apply camera exrinsic (translation)
# compenstate rotation (translation from origin to root joint was not cancled)
if 'R' in cam_param and 't' in cam_param:
R, t = np.array(cam_param['R'], dtype=np.float32).reshape(3, 3), np.array(cam_param['t'],
dtype=np.float32).reshape(1, 3)
root_cam = joint_cam[smpl.root_joint_idx, None, :]
joint_cam = joint_cam - root_cam + np.dot(R, root_cam.transpose(1, 0)).transpose(1, 0) + t
mesh_cam = mesh_cam - root_cam + np.dot(R, root_cam.transpose(1, 0)).transpose(1, 0) + t
# joint coordinates
if 'focal' not in cam_param or 'princpt' not in cam_param:
assert joint_img is not None
else:
joint_img = cam2pixel(joint_cam, cam_param['focal'], cam_param['princpt'])
joint_img_original = joint_img.copy()
joint_cam = joint_cam - joint_cam[smpl.root_joint_idx, None, :] # body root-relative
joint_img[:, 2] = (joint_cam[:, 2].copy() / (cfg.body_3d_size / 2) + 1) / 2. * cfg.output_hm_shape[
0] # body depth discretize
elif human_model_type == 'mano':
human_model = mano
pose, shape, trans = human_model_param['pose'], human_model_param['shape'], human_model_param['trans']
hand_type = human_model_param['hand_type']
pose = torch.FloatTensor(pose).view(-1, 3)
shape = torch.FloatTensor(shape).view(1, -1);
trans = torch.FloatTensor(trans).view(1, -1) # translation vector
# apply camera extrinsic (rotation)
# merge root pose and camera rotation
if 'R' in cam_param:
R = np.array(cam_param['R'], dtype=np.float32).reshape(3, 3)
root_pose = pose[mano.orig_root_joint_idx, :].numpy()
root_pose, _ = cv2.Rodrigues(root_pose)
root_pose, _ = cv2.Rodrigues(np.dot(R, root_pose))
pose[mano.orig_root_joint_idx] = torch.from_numpy(root_pose).view(3)
# get mesh and joint coordinates
root_pose = pose[mano.orig_root_joint_idx].view(1, 3)
hand_pose = torch.cat((pose[:mano.orig_root_joint_idx, :], pose[mano.orig_root_joint_idx + 1:, :])).view(1, -1)
with torch.no_grad():
output = mano.layer[hand_type](betas=shape, hand_pose=hand_pose, global_orient=root_pose, transl=trans)
mesh_cam = output.vertices[0].numpy()
joint_cam = np.dot(mano.joint_regressor, mesh_cam)
# apply camera exrinsic (translation)
# compenstate rotation (translation from origin to root joint was not cancled)
if 'R' in cam_param and 't' in cam_param:
R, t = np.array(cam_param['R'], dtype=np.float32).reshape(3, 3), np.array(cam_param['t'],
dtype=np.float32).reshape(1, 3)
root_cam = joint_cam[mano.root_joint_idx, None, :]
joint_cam = joint_cam - root_cam + np.dot(R, root_cam.transpose(1, 0)).transpose(1, 0) + t
mesh_cam = mesh_cam - root_cam + np.dot(R, root_cam.transpose(1, 0)).transpose(1, 0) + t
# joint coordinates
if 'focal' not in cam_param or 'princpt' not in cam_param:
assert joint_img is not None
else:
joint_img = cam2pixel(joint_cam, cam_param['focal'], cam_param['princpt'])
joint_cam = joint_cam - joint_cam[mano.root_joint_idx, None, :] # hand root-relative
joint_img[:, 2] = (joint_cam[:, 2].copy() / (cfg.hand_3d_size / 2) + 1) / 2. * cfg.output_hm_shape[
0] # hand depth discretize
mesh_cam_orig = mesh_cam.copy() # back-up the original one
## so far, data augmentations are not applied yet
## now, apply data augmentations
# image projection
if do_flip:
joint_cam[:, 0] = -joint_cam[:, 0]
joint_img[:, 0] = img_shape[1] - 1 - joint_img[:, 0]
for pair in human_model.flip_pairs:
joint_cam[pair[0], :], joint_cam[pair[1], :] = joint_cam[pair[1], :].copy(), joint_cam[pair[0], :].copy()
joint_img[pair[0], :], joint_img[pair[1], :] = joint_img[pair[1], :].copy(), joint_img[pair[0], :].copy()
if human_model_type == 'smplx':
coord_valid[pair[0]], coord_valid[pair[1]] = coord_valid[pair[1]].copy(), coord_valid[pair[0]].copy()
# x,y affine transform, root-relative depth
joint_img_xy1 = np.concatenate((joint_img[:, :2], np.ones_like(joint_img[:, 0:1])), 1)
joint_img[:, :2] = np.dot(img2bb_trans, joint_img_xy1.transpose(1, 0)).transpose(1, 0)[:, :2]
joint_img[:, 0] = joint_img[:, 0] / cfg.input_img_shape[1] * cfg.output_hm_shape[2]
joint_img[:, 1] = joint_img[:, 1] / cfg.input_img_shape[0] * cfg.output_hm_shape[1]
# check truncation
# TODO
joint_trunc = ((joint_img_original[:, 0] > 0) * (joint_img[:, 0] >= 0) * (joint_img[:, 0] < cfg.output_hm_shape[2]) * \
(joint_img_original[:, 1] > 0) * (joint_img[:, 1] >= 0) * (joint_img[:, 1] < cfg.output_hm_shape[1]) * \
(joint_img_original[:, 2] > 0) * (joint_img[:, 2] >= 0) * (joint_img[:, 2] < cfg.output_hm_shape[0])).reshape(-1, 1).astype(
np.float32)
# 3D data rotation augmentation
rot_aug_mat = np.array([[np.cos(np.deg2rad(-rot)), -np.sin(np.deg2rad(-rot)), 0],
[np.sin(np.deg2rad(-rot)), np.cos(np.deg2rad(-rot)), 0],
[0, 0, 1]], dtype=np.float32)
# coordinate
joint_cam = np.dot(rot_aug_mat, joint_cam.transpose(1, 0)).transpose(1, 0)
# parameters
# flip pose parameter (axis-angle)
if do_flip:
for pair in human_model.orig_flip_pairs:
pose[pair[0], :], pose[pair[1], :] = pose[pair[1], :].clone(), pose[pair[0], :].clone()
if human_model_type == 'smplx':
rotation_valid[pair[0]], rotation_valid[pair[1]] = rotation_valid[pair[1]].copy(), rotation_valid[
pair[0]].copy()
pose[:, 1:3] *= -1 # multiply -1 to y and z axis of axis-angle
# rotate root pose
pose = pose.numpy()
root_pose = pose[human_model.orig_root_joint_idx, :]
root_pose, _ = cv2.Rodrigues(root_pose)
root_pose, _ = cv2.Rodrigues(np.dot(rot_aug_mat, root_pose))
pose[human_model.orig_root_joint_idx] = root_pose.reshape(3)
# change to mean shape if beta is too far from it
shape[(shape.abs() > 3).any(dim=1)] = 0.
shape = shape.numpy().reshape(-1)
# return results
if human_model_type == 'smplx':
pose = pose.reshape(-1)
expr = expr.numpy().reshape(-1)
return joint_img, joint_cam, joint_trunc, pose, shape, expr, rotation_valid, coord_valid, expr_valid, mesh_cam_orig
elif human_model_type == 'smpl':
pose = pose.reshape(-1)
return joint_img, joint_cam, joint_trunc, pose, shape, mesh_cam_orig
elif human_model_type == 'mano':
pose = pose.reshape(-1)
return joint_img, joint_cam, joint_trunc, pose, shape, mesh_cam_orig
def get_fitting_error_3D(db_joint, db_joint_from_fit, joint_valid):
# mask coordinate
db_joint = db_joint[np.tile(joint_valid, (1, 3)) == 1].reshape(-1, 3)
db_joint_from_fit = db_joint_from_fit[np.tile(joint_valid, (1, 3)) == 1].reshape(-1, 3)
db_joint_from_fit = db_joint_from_fit - np.mean(db_joint_from_fit, 0)[None, :] + np.mean(db_joint, 0)[None,
:] # translation alignment
error = np.sqrt(np.sum((db_joint - db_joint_from_fit) ** 2, 1)).mean()
return error
def load_obj(file_name):
v = []
obj_file = open(file_name)
for line in obj_file:
words = line.split(' ')
if words[0] == 'v':
x, y, z = float(words[1]), float(words[2]), float(words[3])
v.append(np.array([x, y, z]))
return np.stack(v)
def load_ply(file_name):
plydata = PlyData.read(file_name)
x = plydata['vertex']['x']
y = plydata['vertex']['y']
z = plydata['vertex']['z']
v = np.stack((x, y, z), 1)
return v
def resize_bbox(bbox, scale=1.2):
if isinstance(bbox, list):
x1, y1, x2, y2 = bbox[0], bbox[1], bbox[2], bbox[3]
else:
x1, y1, x2, y2 = bbox
x_center = (x1+x2)/2.0
y_center = (y1+y2)/2.0
x_size, y_size = x2-x1, y2-y1
x1_resize = x_center-x_size/2.0*scale
x2_resize = x_center+x_size/2.0*scale
y1_resize = y_center - y_size / 2.0 * scale
y2_resize = y_center + y_size / 2.0 * scale
bbox[0], bbox[1], bbox[2], bbox[3] = x1_resize, y1_resize, x2_resize, y2_resize
return bbox
-58
View File
@@ -1,58 +0,0 @@
License
Software Copyright License for non-commercial scientific research purposes
Please read carefully the following terms and conditions and any accompanying documentation before you download and/or use the SMPL-X/SMPLify-X model, data and software, (the "Model & Software"), including 3D meshes, blend weights, blend shapes, textures, software, scripts, and animations. By downloading and/or using the Model & Software (including downloading, cloning, installing, and any other use of this github repository), you acknowledge that you have read these terms and conditions, understand them, and agree to be bound by them. If you do not agree with these terms and conditions, you must not download and/or use the Model & Software. Any infringement of the terms of this agreement will automatically terminate your rights under this License
Ownership / Licensees
The Software and the associated materials has been developed at the
Max Planck Institute for Intelligent Systems (hereinafter "MPI").
Any copyright or patent right is owned by and proprietary material of the
Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (hereinafter “MPG”; MPI and MPG hereinafter collectively “Max-Planck”)
hereinafter the “Licensor”.
License Grant
Licensor grants you (Licensee) personally a single-user, non-exclusive, non-transferable, free of charge right:
To install the Model & Software on computers owned, leased or otherwise controlled by you and/or your organization;
To use the Model & Software for the sole purpose of performing non-commercial scientific research, non-commercial education, or non-commercial artistic projects;
Any other use, in particular any use for commercial purposes, is prohibited. This includes, without limitation, incorporation in a commercial product, use in a commercial service, or production of other artifacts for commercial purposes. The Model & Software may not be reproduced, modified and/or made available in any form to any third party without Max-Plancks prior written permission.
The Model & Software may not be used for pornographic purposes or to generate pornographic material whether commercial or not. This license also prohibits the use of the Model & Software to train methods/algorithms/neural networks/etc. for commercial use of any kind. By downloading the Model & Software, you agree not to reverse engineer it.
No Distribution
The Model & Software and the license herein granted shall not be copied, shared, distributed, re-sold, offered for re-sale, transferred or sub-licensed in whole or in part except that you may make one copy for archive purposes only.
Disclaimer of Representations and Warranties
You expressly acknowledge and agree that the Model & Software results from basic research, is provided “AS IS”, may contain errors, and that any use of the Model & Software is at your sole risk. LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE MODEL & SOFTWARE, NEITHER EXPRESS NOR IMPLIED, AND THE ABSENCE OF ANY LEGAL OR ACTUAL DEFECTS, WHETHER DISCOVERABLE OR NOT. Specifically, and not to limit the foregoing, licensor makes no representations or warranties (i) regarding the merchantability or fitness for a particular purpose of the Model & Software, (ii) that the use of the Model & Software will not infringe any patents, copyrights or other intellectual property rights of a third party, and (iii) that the use of the Model & Software will not cause any damage of any kind to you or a third party.
Limitation of Liability
Because this Model & Software License Agreement qualifies as a donation, according to Section 521 of the German Civil Code (Bürgerliches Gesetzbuch BGB) Licensor as a donor is liable for intent and gross negligence only. If the Licensor fraudulently conceals a legal or material defect, they are obliged to compensate the Licensee for the resulting damage.
Licensor shall be liable for loss of data only up to the amount of typical recovery costs which would have arisen had proper and regular data backup measures been taken. For the avoidance of doubt Licensor shall be liable in accordance with the German Product Liability Act in the event of product liability. The foregoing applies also to Licensors legal representatives or assistants in performance. Any further liability shall be excluded.
Patent claims generated through the usage of the Model & Software cannot be directed towards the copyright holders.
The Model & Software is provided in the state of development the licensor defines. If modified or extended by Licensee, the Licensor makes no claims about the fitness of the Model & Software and is not responsible for any problems such modifications cause.
No Maintenance Services
You understand and agree that Licensor is under no obligation to provide either maintenance services, update services, notices of latent defects, or corrections of defects with regard to the Model & Software. Licensor nevertheless reserves the right to update, modify, or discontinue the Model & Software at any time.
Defects of the Model & Software must be notified in writing to the Licensor with a comprehensible description of the error symptoms. The notification of the defect should enable the reproduction of the error. The Licensee is encouraged to communicate any use, results, modification or publication.
Publications using the Model & Software
You acknowledge that the Model & Software is a valuable scientific resource and agree to appropriately reference the following paper in any publication making use of the Model & Software.
Citation:
@inproceedings{SMPL-X:2019,
title = {Expressive Body Capture: 3D Hands, Face, and Body from a Single Image},
author = {Pavlakos, Georgios and Choutas, Vasileios and Ghorbani, Nima and Bolkart, Timo and Osman, Ahmed A. A. and Tzionas, Dimitrios and Black, Michael J.},
booktitle = {Proceedings IEEE Conf. on Computer Vision and Pattern Recognition (CVPR)},
year = {2019}
}
Commercial licensing opportunities
For commercial uses of the Software, please send email to ps-license@tue.mpg.de
This Agreement shall be governed by the laws of the Federal Republic of Germany except for the UN Sales Convention.
-186
View File
@@ -1,186 +0,0 @@
## SMPL-X: A new joint 3D model of the human body, face and hands together
[[Paper Page](https://smpl-x.is.tue.mpg.de)] [[Paper](https://ps.is.tuebingen.mpg.de/uploads_file/attachment/attachment/497/SMPL-X.pdf)]
[[Supp. Mat.](https://ps.is.tuebingen.mpg.de/uploads_file/attachment/attachment/498/SMPL-X-supp.pdf)]
![SMPL-X Examples](./images/teaser_fig.png)
## Table of Contents
* [License](#license)
* [Description](#description)
* [Installation](#installation)
* [Downloading the model](#downloading-the-model)
* [Loading SMPL-X, SMPL+H and SMPL](#loading-smpl-x-smplh-and-smpl)
* [SMPL and SMPL+H setup](#smpl-and-smplh-setup)
* [Model loading](https://github.com/vchoutas/smplx#model-loading)
* [MANO and FLAME correspondences](#mano-and-flame-correspondences)
* [Example](#example)
* [Citation](#citation)
* [Acknowledgments](#acknowledgments)
* [Contact](#contact)
## License
Software Copyright License for **non-commercial scientific research purposes**.
Please read carefully the [terms and conditions](https://github.com/vchoutas/smplx/blob/master/LICENSE) and any accompanying documentation before you download and/or use the SMPL-X/SMPLify-X model, data and software, (the "Model & Software"), including 3D meshes, blend weights, blend shapes, textures, software, scripts, and animations. By downloading and/or using the Model & Software (including downloading, cloning, installing, and any other use of this github repository), you acknowledge that you have read these terms and conditions, understand them, and agree to be bound by them. If you do not agree with these terms and conditions, you must not download and/or use the Model & Software. Any infringement of the terms of this agreement will automatically terminate your rights under this [License](./LICENSE).
## Disclaimer
The original images used for the figures 1 and 2 of the paper can be found in this link.
The images in the paper are used under license from gettyimages.com.
We have acquired the right to use them in the publication, but redistribution is not allowed.
Please follow the instructions on the given link to acquire right of usage.
Our results are obtained on the 483 × 724 pixels resolution of the original images.
## Description
*SMPL-X* (SMPL eXpressive) is a unified body model with shape parameters trained jointly for the
face, hands and body. *SMPL-X* uses standard vertex based linear blend skinning with learned corrective blend
shapes, has N = 10, 475 vertices and K = 54 joints,
which include joints for the neck, jaw, eyeballs and fingers.
SMPL-X is defined by a function M(θ, β, ψ), where θ is the pose parameters, β the shape parameters and
ψ the facial expression parameters.
## Installation
To install the model please follow the next steps in the specified order:
1. To install from PyPi simply run:
```Shell
pip install smplx[all]
```
2. Clone this repository and install it using the *setup.py* script:
```Shell
git clone https://github.com/vchoutas/smplx
python setup.py install
```
## Downloading the model
To download the *SMPL-X* model go to [this project website](https://smpl-x.is.tue.mpg.de) and register to get access to the downloads section.
To download the *SMPL+H* model go to [this project website](http://mano.is.tue.mpg.de) and register to get access to the downloads section.
To download the *SMPL* model go to [this](http://smpl.is.tue.mpg.de) (male and female models) and [this](http://smplify.is.tue.mpg.de) (gender neutral model) project website and register to get access to the downloads section.
## Loading SMPL-X, SMPL+H and SMPL
### SMPL and SMPL+H setup
The loader gives the option to use any of the SMPL-X, SMPL+H, SMPL, and MANO models. Depending on the model you want to use, please follow the respective download instructions. To switch between MANO, SMPL, SMPL+H and SMPL-X just change the *model_path* or *model_type* parameters. For more details please check the docs of the model classes.
Before using SMPL and SMPL+H you should follow the instructions in [tools/README.md](./tools/README.md) to remove the
Chumpy objects from both model pkls, as well as merge the MANO parameters with SMPL+H.
### Model loading
You can either use the [create](https://github.com/vchoutas/smplx/blob/c63c02b478c5c6f696491ed9167e3af6b08d89b1/smplx/body_models.py#L54)
function from [body_models](./smplx/body_models.py) or directly call the constructor for the
[SMPL](https://github.com/vchoutas/smplx/blob/c63c02b478c5c6f696491ed9167e3af6b08d89b1/smplx/body_models.py#L106),
[SMPL+H](https://github.com/vchoutas/smplx/blob/c63c02b478c5c6f696491ed9167e3af6b08d89b1/smplx/body_models.py#L395) and
[SMPL-X](https://github.com/vchoutas/smplx/blob/c63c02b478c5c6f696491ed9167e3af6b08d89b1/smplx/body_models.py#L628) model. The path to the model can either be the path to the file with the parameters or a directory with the following structure:
```bash
models
├── smpl
│   ├── SMPL_FEMALE.pkl
│   └── SMPL_MALE.pkl
│   └── SMPL_NEUTRAL.pkl
├── smplh
│   ├── SMPLH_FEMALE.pkl
│   └── SMPLH_MALE.pkl
├── mano
| ├── MANO_RIGHT.pkl
| └── MANO_LEFT.pkl
└── smplx
├── SMPLX_FEMALE.npz
├── SMPLX_FEMALE.pkl
├── SMPLX_MALE.npz
├── SMPLX_MALE.pkl
├── SMPLX_NEUTRAL.npz
└── SMPLX_NEUTRAL.pkl
```
## MANO and FLAME correspondences
The vertex correspondences between SMPL-X and MANO, FLAME can be downloaded
from [the project website](https://smpl-x.is.tue.mpg.de). If you have extracted
the correspondence data in the folder *correspondences*, then use the following
scripts to visualize them:
1. To view MANO correspondences run the following command:
```
python examples/vis_mano_vertices.py --model-folder $SMPLX_FOLDER --corr-fname correspondences/MANO_SMPLX_vertex_ids.pkl
```
2. To view FLAME correspondences run the following command:
```
python examples/vis_flame_vertices.py --model-folder $SMPLX_FOLDER --corr-fname correspondences/SMPL-X__FLAME_vertex_ids.npy
```
## Example
After installing the *smplx* package and downloading the model parameters you should be able to run the *demo.py*
script to visualize the results. For this step you have to install the [pyrender](https://pyrender.readthedocs.io/en/latest/index.html) and [trimesh](https://trimsh.org/) packages.
`python examples/demo.py --model-folder $SMPLX_FOLDER --plot-joints=True --gender="neutral"`
![SMPL-X Examples](./images/example.png)
## Citation
Depending on which model is loaded for your project, i.e. SMPL-X or SMPL+H or SMPL, please cite the most relevant work below, listed in the same order:
```
@inproceedings{SMPL-X:2019,
title = {Expressive Body Capture: 3D Hands, Face, and Body from a Single Image},
author = {Pavlakos, Georgios and Choutas, Vasileios and Ghorbani, Nima and Bolkart, Timo and Osman, Ahmed A. A. and Tzionas, Dimitrios and Black, Michael J.},
booktitle = {Proceedings IEEE Conf. on Computer Vision and Pattern Recognition (CVPR)},
year = {2019}
}
```
```
@article{MANO:SIGGRAPHASIA:2017,
title = {Embodied Hands: Modeling and Capturing Hands and Bodies Together},
author = {Romero, Javier and Tzionas, Dimitrios and Black, Michael J.},
journal = {ACM Transactions on Graphics, (Proc. SIGGRAPH Asia)},
volume = {36},
number = {6},
series = {245:1--245:17},
month = nov,
year = {2017},
month_numeric = {11}
}
```
```
@article{SMPL:2015,
author = {Loper, Matthew and Mahmood, Naureen and Romero, Javier and Pons-Moll, Gerard and Black, Michael J.},
title = {{SMPL}: A Skinned Multi-Person Linear Model},
journal = {ACM Transactions on Graphics, (Proc. SIGGRAPH Asia)},
month = oct,
number = {6},
pages = {248:1--248:16},
publisher = {ACM},
volume = {34},
year = {2015}
}
```
This repository was originally developed for SMPL-X / SMPLify-X (CVPR 2019), you might be interested in having a look: [https://smpl-x.is.tue.mpg.de](https://smpl-x.is.tue.mpg.de).
## Acknowledgments
### Facial Contour
Special thanks to [Soubhik Sanyal](https://github.com/soubhiksanyal) for sharing the Tensorflow code used for the facial
landmarks.
## Contact
The code of this repository was implemented by [Vassilis Choutas](vassilis.choutas@tuebingen.mpg.de).
For questions, please contact [smplx@tue.mpg.de](smplx@tue.mpg.de).
For commercial licensing (and all related questions for business applications), please contact [ps-licensing@tue.mpg.de](ps-licensing@tue.mpg.de).
@@ -1,180 +0,0 @@
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems. All rights reserved.
#
# Contact: ps-license@tuebingen.mpg.de
import os.path as osp
import argparse
import numpy as np
import torch
import smplx
def main(model_folder,
model_type='smplx',
ext='npz',
gender='neutral',
plot_joints=False,
num_betas=10,
sample_shape=True,
sample_expression=True,
num_expression_coeffs=10,
plotting_module='pyrender',
use_face_contour=False):
model = smplx.create(model_folder, model_type=model_type,
gender=gender, use_face_contour=use_face_contour,
num_betas=num_betas,
num_expression_coeffs=num_expression_coeffs,
ext=ext)
print(model)
betas, expression = None, None
if sample_shape:
betas = torch.randn([1, model.num_betas], dtype=torch.float32)
if sample_expression:
expression = torch.randn(
[1, model.num_expression_coeffs], dtype=torch.float32)
output = model(betas=betas, expression=expression,
return_verts=True)
vertices = output.vertices.detach().cpu().numpy().squeeze()
joints = output.joints.detach().cpu().numpy().squeeze()
print('Vertices shape =', vertices.shape)
print('Joints shape =', joints.shape)
if plotting_module == 'pyrender':
import pyrender
import trimesh
vertex_colors = np.ones([vertices.shape[0], 4]) * [0.3, 0.3, 0.3, 0.8]
tri_mesh = trimesh.Trimesh(vertices, model.faces,
vertex_colors=vertex_colors)
mesh = pyrender.Mesh.from_trimesh(tri_mesh)
scene = pyrender.Scene()
scene.add(mesh)
if plot_joints:
sm = trimesh.creation.uv_sphere(radius=0.005)
sm.visual.vertex_colors = [0.9, 0.1, 0.1, 1.0]
tfs = np.tile(np.eye(4), (len(joints), 1, 1))
tfs[:, :3, 3] = joints
joints_pcl = pyrender.Mesh.from_trimesh(sm, poses=tfs)
scene.add(joints_pcl)
pyrender.Viewer(scene, use_raymond_lighting=True)
elif plotting_module == 'matplotlib':
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
mesh = Poly3DCollection(vertices[model.faces], alpha=0.1)
face_color = (1.0, 1.0, 0.9)
edge_color = (0, 0, 0)
mesh.set_edgecolor(edge_color)
mesh.set_facecolor(face_color)
ax.add_collection3d(mesh)
ax.scatter(joints[:, 0], joints[:, 1], joints[:, 2], color='r')
if plot_joints:
ax.scatter(joints[:, 0], joints[:, 1], joints[:, 2], alpha=0.1)
plt.show()
elif plotting_module == 'open3d':
import open3d as o3d
mesh = o3d.geometry.TriangleMesh()
mesh.vertices = o3d.utility.Vector3dVector(
vertices)
mesh.triangles = o3d.utility.Vector3iVector(model.faces)
mesh.compute_vertex_normals()
mesh.paint_uniform_color([0.3, 0.3, 0.3])
geometry = [mesh]
if plot_joints:
joints_pcl = o3d.geometry.PointCloud()
joints_pcl.points = o3d.utility.Vector3dVector(joints)
joints_pcl.paint_uniform_color([0.7, 0.3, 0.3])
geometry.append(joints_pcl)
o3d.visualization.draw_geometries(geometry)
else:
raise ValueError('Unknown plotting_module: {}'.format(plotting_module))
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='SMPL-X Demo')
parser.add_argument('--model-folder', required=True, type=str,
help='The path to the model folder')
parser.add_argument('--model-type', default='smplx', type=str,
choices=['smpl', 'smplh', 'smplx', 'mano', 'flame'],
help='The type of model to load')
parser.add_argument('--gender', type=str, default='neutral',
help='The gender of the model')
parser.add_argument('--num-betas', default=10, type=int,
dest='num_betas',
help='Number of shape coefficients.')
parser.add_argument('--num-expression-coeffs', default=10, type=int,
dest='num_expression_coeffs',
help='Number of expression coefficients.')
parser.add_argument('--plotting-module', type=str, default='pyrender',
dest='plotting_module',
choices=['pyrender', 'matplotlib', 'open3d'],
help='The module to use for plotting the result')
parser.add_argument('--ext', type=str, default='npz',
help='Which extension to use for loading')
parser.add_argument('--plot-joints', default=False,
type=lambda arg: arg.lower() in ['true', '1'],
help='The path to the model folder')
parser.add_argument('--sample-shape', default=True,
dest='sample_shape',
type=lambda arg: arg.lower() in ['true', '1'],
help='Sample a random shape')
parser.add_argument('--sample-expression', default=True,
dest='sample_expression',
type=lambda arg: arg.lower() in ['true', '1'],
help='Sample a random expression')
parser.add_argument('--use-face-contour', default=False,
type=lambda arg: arg.lower() in ['true', '1'],
help='Compute the contour of the face')
args = parser.parse_args()
model_folder = osp.expanduser(osp.expandvars(args.model_folder))
model_type = args.model_type
plot_joints = args.plot_joints
use_face_contour = args.use_face_contour
gender = args.gender
ext = args.ext
plotting_module = args.plotting_module
num_betas = args.num_betas
num_expression_coeffs = args.num_expression_coeffs
sample_shape = args.sample_shape
sample_expression = args.sample_expression
main(model_folder, model_type, ext=ext,
gender=gender, plot_joints=plot_joints,
num_betas=num_betas,
num_expression_coeffs=num_expression_coeffs,
sample_shape=sample_shape,
sample_expression=sample_expression,
plotting_module=plotting_module,
use_face_contour=use_face_contour)
@@ -1,181 +0,0 @@
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems. All rights reserved.
#
# Contact: ps-license@tuebingen.mpg.de
import os.path as osp
import argparse
import numpy as np
import torch
import smplx
def main(model_folder,
model_type='smplx',
ext='npz',
gender='neutral',
plot_joints=False,
num_betas=10,
sample_shape=True,
sample_expression=True,
num_expression_coeffs=10,
plotting_module='pyrender',
use_face_contour=False):
model = smplx.build_layer(
model_folder, model_type=model_type,
gender=gender, use_face_contour=use_face_contour,
num_betas=num_betas,
num_expression_coeffs=num_expression_coeffs,
ext=ext)
print(model)
betas, expression = None, None
if sample_shape:
betas = torch.randn([1, model.num_betas], dtype=torch.float32)
if sample_expression:
expression = torch.randn(
[1, model.num_expression_coeffs], dtype=torch.float32)
output = model(betas=betas, expression=expression,
return_verts=True)
vertices = output.vertices.detach().cpu().numpy().squeeze()
joints = output.joints.detach().cpu().numpy().squeeze()
print('Vertices shape =', vertices.shape)
print('Joints shape =', joints.shape)
if plotting_module == 'pyrender':
import pyrender
import trimesh
vertex_colors = np.ones([vertices.shape[0], 4]) * [0.3, 0.3, 0.3, 0.8]
tri_mesh = trimesh.Trimesh(vertices, model.faces,
vertex_colors=vertex_colors)
mesh = pyrender.Mesh.from_trimesh(tri_mesh)
scene = pyrender.Scene()
scene.add(mesh)
if plot_joints:
sm = trimesh.creation.uv_sphere(radius=0.005)
sm.visual.vertex_colors = [0.9, 0.1, 0.1, 1.0]
tfs = np.tile(np.eye(4), (len(joints), 1, 1))
tfs[:, :3, 3] = joints
joints_pcl = pyrender.Mesh.from_trimesh(sm, poses=tfs)
scene.add(joints_pcl)
pyrender.Viewer(scene, use_raymond_lighting=True)
elif plotting_module == 'matplotlib':
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
mesh = Poly3DCollection(vertices[model.faces], alpha=0.1)
face_color = (1.0, 1.0, 0.9)
edge_color = (0, 0, 0)
mesh.set_edgecolor(edge_color)
mesh.set_facecolor(face_color)
ax.add_collection3d(mesh)
ax.scatter(joints[:, 0], joints[:, 1], joints[:, 2], color='r')
if plot_joints:
ax.scatter(joints[:, 0], joints[:, 1], joints[:, 2], alpha=0.1)
plt.show()
elif plotting_module == 'open3d':
import open3d as o3d
mesh = o3d.geometry.TriangleMesh()
mesh.vertices = o3d.utility.Vector3dVector(
vertices)
mesh.triangles = o3d.utility.Vector3iVector(model.faces)
mesh.compute_vertex_normals()
mesh.paint_uniform_color([0.3, 0.3, 0.3])
geometry = [mesh]
if plot_joints:
joints_pcl = o3d.geometry.PointCloud()
joints_pcl.points = o3d.utility.Vector3dVector(joints)
joints_pcl.paint_uniform_color([0.7, 0.3, 0.3])
geometry.append(joints_pcl)
o3d.visualization.draw_geometries(geometry)
else:
raise ValueError('Unknown plotting_module: {}'.format(plotting_module))
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='SMPL-X Demo')
parser.add_argument('--model-folder', required=True, type=str,
help='The path to the model folder')
parser.add_argument('--model-type', default='smplx', type=str,
choices=['smpl', 'smplh', 'smplx', 'mano', 'flame'],
help='The type of model to load')
parser.add_argument('--gender', type=str, default='neutral',
help='The gender of the model')
parser.add_argument('--num-betas', default=10, type=int,
dest='num_betas',
help='Number of shape coefficients.')
parser.add_argument('--num-expression-coeffs', default=10, type=int,
dest='num_expression_coeffs',
help='Number of expression coefficients.')
parser.add_argument('--plotting-module', type=str, default='pyrender',
dest='plotting_module',
choices=['pyrender', 'matplotlib', 'open3d'],
help='The module to use for plotting the result')
parser.add_argument('--ext', type=str, default='npz',
help='Which extension to use for loading')
parser.add_argument('--plot-joints', default=False,
type=lambda arg: arg.lower() in ['true', '1'],
help='The path to the model folder')
parser.add_argument('--sample-shape', default=True,
dest='sample_shape',
type=lambda arg: arg.lower() in ['true', '1'],
help='Sample a random shape')
parser.add_argument('--sample-expression', default=True,
dest='sample_expression',
type=lambda arg: arg.lower() in ['true', '1'],
help='Sample a random expression')
parser.add_argument('--use-face-contour', default=False,
type=lambda arg: arg.lower() in ['true', '1'],
help='Compute the contour of the face')
args = parser.parse_args()
model_folder = osp.expanduser(osp.expandvars(args.model_folder))
model_type = args.model_type
plot_joints = args.plot_joints
use_face_contour = args.use_face_contour
gender = args.gender
ext = args.ext
plotting_module = args.plotting_module
num_betas = args.num_betas
num_expression_coeffs = args.num_expression_coeffs
sample_shape = args.sample_shape
sample_expression = args.sample_expression
main(model_folder, model_type, ext=ext,
gender=gender, plot_joints=plot_joints,
num_betas=num_betas,
num_expression_coeffs=num_expression_coeffs,
sample_shape=sample_shape,
sample_expression=sample_expression,
plotting_module=plotting_module,
use_face_contour=use_face_contour)
@@ -1,92 +0,0 @@
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems. All rights reserved.
#
# Contact: ps-license@tuebingen.mpg.de
import os.path as osp
import argparse
import pickle
import numpy as np
import torch
import open3d as o3d
import smplx
def main(model_folder, corr_fname, ext='npz',
head_color=(0.3, 0.3, 0.6),
gender='neutral'):
head_idxs = np.load(corr_fname)
model = smplx.create(model_folder, model_type='smplx',
gender=gender,
ext=ext)
betas = torch.zeros([1, 10], dtype=torch.float32)
expression = torch.zeros([1, 10], dtype=torch.float32)
output = model(betas=betas, expression=expression,
return_verts=True)
vertices = output.vertices.detach().cpu().numpy().squeeze()
joints = output.joints.detach().cpu().numpy().squeeze()
print('Vertices shape =', vertices.shape)
print('Joints shape =', joints.shape)
mesh = o3d.geometry.TriangleMesh()
mesh.vertices = o3d.utility.Vector3dVector(vertices)
mesh.triangles = o3d.utility.Vector3iVector(model.faces)
mesh.compute_vertex_normals()
colors = np.ones_like(vertices) * [0.3, 0.3, 0.3]
colors[head_idxs] = head_color
mesh.vertex_colors = o3d.utility.Vector3dVector(colors)
o3d.visualization.draw_geometries([mesh])
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='SMPL-X Demo')
parser.add_argument('--model-folder', required=True, type=str,
help='The path to the model folder')
parser.add_argument('--corr-fname', required=True, type=str,
dest='corr_fname',
help='Filename with the head correspondences')
parser.add_argument('--gender', type=str, default='neutral',
help='The gender of the model')
parser.add_argument('--ext', type=str, default='npz',
help='Which extension to use for loading')
parser.add_argument('--head', default='right',
choices=['right', 'left'],
type=str, help='Which head to plot')
parser.add_argument('--head-color', type=float, nargs=3, dest='head_color',
default=(0.3, 0.3, 0.6),
help='Color for the head vertices')
args = parser.parse_args()
model_folder = osp.expanduser(osp.expandvars(args.model_folder))
corr_fname = args.corr_fname
gender = args.gender
ext = args.ext
head = args.head
head_color = args.head_color
main(model_folder, corr_fname, ext=ext,
head_color=head_color,
gender=gender
)
@@ -1,99 +0,0 @@
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems. All rights reserved.
#
# Contact: ps-license@tuebingen.mpg.de
import os.path as osp
import argparse
import pickle
import numpy as np
import torch
import open3d as o3d
import smplx
def main(model_folder, corr_fname, ext='npz',
hand_color=(0.3, 0.3, 0.6),
gender='neutral', hand='right'):
with open(corr_fname, 'rb') as f:
idxs_data = pickle.load(f)
if hand == 'both':
hand_idxs = np.concatenate(
[idxs_data['left_hand'], idxs_data['right_hand']]
)
else:
hand_idxs = idxs_data[f'{hand}_hand']
model = smplx.create(model_folder, model_type='smplx',
gender=gender,
ext=ext)
betas = torch.zeros([1, 10], dtype=torch.float32)
expression = torch.zeros([1, 10], dtype=torch.float32)
output = model(betas=betas, expression=expression,
return_verts=True)
vertices = output.vertices.detach().cpu().numpy().squeeze()
joints = output.joints.detach().cpu().numpy().squeeze()
print('Vertices shape =', vertices.shape)
print('Joints shape =', joints.shape)
mesh = o3d.geometry.TriangleMesh()
mesh.vertices = o3d.utility.Vector3dVector(vertices)
mesh.triangles = o3d.utility.Vector3iVector(model.faces)
mesh.compute_vertex_normals()
colors = np.ones_like(vertices) * [0.3, 0.3, 0.3]
colors[hand_idxs] = hand_color
mesh.vertex_colors = o3d.utility.Vector3dVector(colors)
o3d.visualization.draw_geometries([mesh])
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='SMPL-X Demo')
parser.add_argument('--model-folder', required=True, type=str,
help='The path to the model folder')
parser.add_argument('--corr-fname', required=True, type=str,
dest='corr_fname',
help='Filename with the hand correspondences')
parser.add_argument('--gender', type=str, default='neutral',
help='The gender of the model')
parser.add_argument('--ext', type=str, default='npz',
help='Which extension to use for loading')
parser.add_argument('--hand', default='right',
choices=['right', 'left', 'both'],
type=str, help='Which hand to plot')
parser.add_argument('--hand-color', type=float, nargs=3, dest='hand_color',
default=(0.3, 0.3, 0.6),
help='Color for the hand vertices')
args = parser.parse_args()
model_folder = osp.expanduser(osp.expandvars(args.model_folder))
corr_fname = args.corr_fname
gender = args.gender
ext = args.ext
hand = args.hand
hand_color = args.hand_color
main(model_folder, corr_fname, ext=ext,
hand_color=hand_color,
gender=gender, hand=hand
)
-79
View File
@@ -1,79 +0,0 @@
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems and the Max Planck Institute for Biological
# Cybernetics. All rights reserved.
#
# Contact: ps-license@tuebingen.mpg.de
import io
import os
from setuptools import setup
# Package meta-data.
NAME = 'smplx'
DESCRIPTION = 'PyTorch module for loading the SMPLX body model'
URL = 'http://smpl-x.is.tuebingen.mpg.de'
EMAIL = 'vassilis.choutas@tuebingen.mpg.de'
AUTHOR = 'Vassilis Choutas'
REQUIRES_PYTHON = '>=3.6.0'
VERSION = '0.1.21'
here = os.path.abspath(os.path.dirname(__file__))
try:
FileNotFoundError
except NameError:
FileNotFoundError = IOError
# Import the README and use it as the long-description.
# Note: this will only work if 'README.md' is present in your MANIFEST.in file!
try:
with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = '\n' + f.read()
except FileNotFoundError:
long_description = DESCRIPTION
# Load the package's __version__.py module as a dictionary.
about = {}
if not VERSION:
with open(os.path.join(here, NAME, '__version__.py')) as f:
exec(f.read(), about)
else:
about['__version__'] = VERSION
pyrender_reqs = ['pyrender>=0.1.23', 'trimesh>=2.37.6', 'shapely']
matplotlib_reqs = ['matplotlib']
open3d_reqs = ['open3d-python']
setup(name=NAME,
version=about['__version__'],
description=DESCRIPTION,
long_description=long_description,
long_description_content_type='text/markdown',
author=AUTHOR,
author_email=EMAIL,
python_requires=REQUIRES_PYTHON,
url=URL,
install_requires=[
'numpy>=1.16.2',
'torch>=1.0.1.post2',
'torchgeometry>=0.1.2'
],
extras_require={
'pyrender': pyrender_reqs,
'open3d': open3d_reqs,
'matplotlib': matplotlib_reqs,
'all': pyrender_reqs + matplotlib_reqs + open3d_reqs
},
packages=['smplx', 'tools'])
@@ -1,30 +0,0 @@
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems. All rights reserved.
#
# Contact: ps-license@tuebingen.mpg.de
from .body_models import (
create,
SMPL,
SMPLH,
SMPLX,
MANO,
FLAME,
build_layer,
SMPLLayer,
SMPLHLayer,
SMPLXLayer,
MANOLayer,
FLAMELayer,
)
File diff suppressed because it is too large Load Diff
@@ -1,163 +0,0 @@
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems. All rights reserved.
#
# Contact: ps-license@tuebingen.mpg.de
JOINT_NAMES = [
'pelvis',
'left_hip',
'right_hip',
'spine1',
'left_knee',
'right_knee',
'spine2',
'left_ankle',
'right_ankle',
'spine3',
'left_foot',
'right_foot',
'neck',
'left_collar',
'right_collar',
'head',
'left_shoulder',
'right_shoulder',
'left_elbow',
'right_elbow',
'left_wrist',
'right_wrist',
'jaw',
'left_eye_smplhf',
'right_eye_smplhf',
'left_index1',
'left_index2',
'left_index3',
'left_middle1',
'left_middle2',
'left_middle3',
'left_pinky1',
'left_pinky2',
'left_pinky3',
'left_ring1',
'left_ring2',
'left_ring3',
'left_thumb1',
'left_thumb2',
'left_thumb3',
'right_index1',
'right_index2',
'right_index3',
'right_middle1',
'right_middle2',
'right_middle3',
'right_pinky1',
'right_pinky2',
'right_pinky3',
'right_ring1',
'right_ring2',
'right_ring3',
'right_thumb1',
'right_thumb2',
'right_thumb3',
'nose',
'right_eye',
'left_eye',
'right_ear',
'left_ear',
'left_big_toe',
'left_small_toe',
'left_heel',
'right_big_toe',
'right_small_toe',
'right_heel',
'left_thumb',
'left_index',
'left_middle',
'left_ring',
'left_pinky',
'right_thumb',
'right_index',
'right_middle',
'right_ring',
'right_pinky',
'right_eye_brow1',
'right_eye_brow2',
'right_eye_brow3',
'right_eye_brow4',
'right_eye_brow5',
'left_eye_brow5',
'left_eye_brow4',
'left_eye_brow3',
'left_eye_brow2',
'left_eye_brow1',
'nose1',
'nose2',
'nose3',
'nose4',
'right_nose_2',
'right_nose_1',
'nose_middle',
'left_nose_1',
'left_nose_2',
'right_eye1',
'right_eye2',
'right_eye3',
'right_eye4',
'right_eye5',
'right_eye6',
'left_eye4',
'left_eye3',
'left_eye2',
'left_eye1',
'left_eye6',
'left_eye5',
'right_mouth_1',
'right_mouth_2',
'right_mouth_3',
'mouth_top',
'left_mouth_3',
'left_mouth_2',
'left_mouth_1',
'left_mouth_5', # 59 in OpenPose output
'left_mouth_4', # 58 in OpenPose output
'mouth_bottom',
'right_mouth_4',
'right_mouth_5',
'right_lip_1',
'right_lip_2',
'lip_top',
'left_lip_2',
'left_lip_1',
'left_lip_3',
'lip_bottom',
'right_lip_3',
# Face contour
'right_contour_1',
'right_contour_2',
'right_contour_3',
'right_contour_4',
'right_contour_5',
'right_contour_6',
'right_contour_7',
'right_contour_8',
'contour_middle',
'left_contour_8',
'left_contour_7',
'left_contour_6',
'left_contour_5',
'left_contour_4',
'left_contour_3',
'left_contour_2',
'left_contour_1',
]
-404
View File
@@ -1,404 +0,0 @@
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems. All rights reserved.
#
# Contact: ps-license@tuebingen.mpg.de
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from typing import Tuple, List
import numpy as np
import torch
import torch.nn.functional as F
from .utils import rot_mat_to_euler, Tensor
def find_dynamic_lmk_idx_and_bcoords(
vertices: Tensor,
pose: Tensor,
dynamic_lmk_faces_idx: Tensor,
dynamic_lmk_b_coords: Tensor,
neck_kin_chain: List[int],
pose2rot: bool = True,
) -> Tuple[Tensor, Tensor]:
''' Compute the faces, barycentric coordinates for the dynamic landmarks
To do so, we first compute the rotation of the neck around the y-axis
and then use a pre-computed look-up table to find the faces and the
barycentric coordinates that will be used.
Special thanks to Soubhik Sanyal (soubhik.sanyal@tuebingen.mpg.de)
for providing the original TensorFlow implementation and for the LUT.
Parameters
----------
vertices: torch.tensor BxVx3, dtype = torch.float32
The tensor of input vertices
pose: torch.tensor Bx(Jx3), dtype = torch.float32
The current pose of the body model
dynamic_lmk_faces_idx: torch.tensor L, dtype = torch.long
The look-up table from neck rotation to faces
dynamic_lmk_b_coords: torch.tensor Lx3, dtype = torch.float32
The look-up table from neck rotation to barycentric coordinates
neck_kin_chain: list
A python list that contains the indices of the joints that form the
kinematic chain of the neck.
dtype: torch.dtype, optional
Returns
-------
dyn_lmk_faces_idx: torch.tensor, dtype = torch.long
A tensor of size BxL that contains the indices of the faces that
will be used to compute the current dynamic landmarks.
dyn_lmk_b_coords: torch.tensor, dtype = torch.float32
A tensor of size BxL that contains the indices of the faces that
will be used to compute the current dynamic landmarks.
'''
dtype = vertices.dtype
batch_size = vertices.shape[0]
if pose2rot:
aa_pose = torch.index_select(pose.view(batch_size, -1, 3), 1,
neck_kin_chain)
rot_mats = batch_rodrigues(
aa_pose.view(-1, 3)).view(batch_size, -1, 3, 3)
else:
rot_mats = torch.index_select(
pose.view(batch_size, -1, 3, 3), 1, neck_kin_chain)
rel_rot_mat = torch.eye(
3, device=vertices.device, dtype=dtype).unsqueeze_(dim=0).repeat(
batch_size, 1, 1)
for idx in range(len(neck_kin_chain)):
rel_rot_mat = torch.bmm(rot_mats[:, idx], rel_rot_mat)
y_rot_angle = torch.round(
torch.clamp(-rot_mat_to_euler(rel_rot_mat) * 180.0 / np.pi,
max=39)).to(dtype=torch.long)
neg_mask = y_rot_angle.lt(0).to(dtype=torch.long)
mask = y_rot_angle.lt(-39).to(dtype=torch.long)
neg_vals = mask * 78 + (1 - mask) * (39 - y_rot_angle)
y_rot_angle = (neg_mask * neg_vals +
(1 - neg_mask) * y_rot_angle)
dyn_lmk_faces_idx = torch.index_select(dynamic_lmk_faces_idx,
0, y_rot_angle)
dyn_lmk_b_coords = torch.index_select(dynamic_lmk_b_coords,
0, y_rot_angle)
return dyn_lmk_faces_idx, dyn_lmk_b_coords
def vertices2landmarks(
vertices: Tensor,
faces: Tensor,
lmk_faces_idx: Tensor,
lmk_bary_coords: Tensor
) -> Tensor:
''' Calculates landmarks by barycentric interpolation
Parameters
----------
vertices: torch.tensor BxVx3, dtype = torch.float32
The tensor of input vertices
faces: torch.tensor Fx3, dtype = torch.long
The faces of the mesh
lmk_faces_idx: torch.tensor L, dtype = torch.long
The tensor with the indices of the faces used to calculate the
landmarks.
lmk_bary_coords: torch.tensor Lx3, dtype = torch.float32
The tensor of barycentric coordinates that are used to interpolate
the landmarks
Returns
-------
landmarks: torch.tensor BxLx3, dtype = torch.float32
The coordinates of the landmarks for each mesh in the batch
'''
# Extract the indices of the vertices for each face
# BxLx3
batch_size, num_verts = vertices.shape[:2]
device = vertices.device
lmk_faces = torch.index_select(faces, 0, lmk_faces_idx.view(-1)).view(
batch_size, -1, 3)
lmk_faces += torch.arange(
batch_size, dtype=torch.long, device=device).view(-1, 1, 1) * num_verts
lmk_vertices = vertices.view(-1, 3)[lmk_faces].view(
batch_size, -1, 3, 3)
landmarks = torch.einsum('blfi,blf->bli', [lmk_vertices, lmk_bary_coords])
return landmarks
def lbs(
betas: Tensor,
pose: Tensor,
v_template: Tensor,
shapedirs: Tensor,
posedirs: Tensor,
J_regressor: Tensor,
parents: Tensor,
lbs_weights: Tensor,
pose2rot: bool = True,
) -> Tuple[Tensor, Tensor]:
''' Performs Linear Blend Skinning with the given shape and pose parameters
Parameters
----------
betas : torch.tensor BxNB
The tensor of shape parameters
pose : torch.tensor Bx(J + 1) * 3
The pose parameters in axis-angle format
v_template torch.tensor BxVx3
The template mesh that will be deformed
shapedirs : torch.tensor 1xNB
The tensor of PCA shape displacements
posedirs : torch.tensor Px(V * 3)
The pose PCA coefficients
J_regressor : torch.tensor JxV
The regressor array that is used to calculate the joints from
the position of the vertices
parents: torch.tensor J
The array that describes the kinematic tree for the model
lbs_weights: torch.tensor N x V x (J + 1)
The linear blend skinning weights that represent how much the
rotation matrix of each part affects each vertex
pose2rot: bool, optional
Flag on whether to convert the input pose tensor to rotation
matrices. The default value is True. If False, then the pose tensor
should already contain rotation matrices and have a size of
Bx(J + 1)x9
dtype: torch.dtype, optional
Returns
-------
verts: torch.tensor BxVx3
The vertices of the mesh after applying the shape and pose
displacements.
joints: torch.tensor BxJx3
The joints of the model
'''
batch_size = max(betas.shape[0], pose.shape[0])
device, dtype = betas.device, betas.dtype
# Add shape contribution
v_shaped = v_template + blend_shapes(betas, shapedirs)
# Get the joints
# NxJx3 array
J = vertices2joints(J_regressor, v_shaped)
# 3. Add pose blend shapes
# N x J x 3 x 3
ident = torch.eye(3, dtype=dtype, device=device)
if pose2rot:
rot_mats = batch_rodrigues(pose.view(-1, 3)).view(
[batch_size, -1, 3, 3])
pose_feature = (rot_mats[:, 1:, :, :] - ident).view([batch_size, -1])
# (N x P) x (P, V * 3) -> N x V x 3
pose_offsets = torch.matmul(
pose_feature, posedirs).view(batch_size, -1, 3)
else:
pose_feature = pose[:, 1:].view(batch_size, -1, 3, 3) - ident
rot_mats = pose.view(batch_size, -1, 3, 3)
pose_offsets = torch.matmul(pose_feature.view(batch_size, -1),
posedirs).view(batch_size, -1, 3)
v_posed = pose_offsets + v_shaped
# 4. Get the global joint location
J_transformed, A = batch_rigid_transform(rot_mats, J, parents, dtype=dtype)
# 5. Do skinning:
# W is N x V x (J + 1)
W = lbs_weights.unsqueeze(dim=0).expand([batch_size, -1, -1])
# (N x V x (J + 1)) x (N x (J + 1) x 16)
num_joints = J_regressor.shape[0]
T = torch.matmul(W, A.view(batch_size, num_joints, 16)) \
.view(batch_size, -1, 4, 4)
homogen_coord = torch.ones([batch_size, v_posed.shape[1], 1],
dtype=dtype, device=device)
v_posed_homo = torch.cat([v_posed, homogen_coord], dim=2)
v_homo = torch.matmul(T, torch.unsqueeze(v_posed_homo, dim=-1))
verts = v_homo[:, :, :3, 0]
return verts, J_transformed
def vertices2joints(J_regressor: Tensor, vertices: Tensor) -> Tensor:
''' Calculates the 3D joint locations from the vertices
Parameters
----------
J_regressor : torch.tensor JxV
The regressor array that is used to calculate the joints from the
position of the vertices
vertices : torch.tensor BxVx3
The tensor of mesh vertices
Returns
-------
torch.tensor BxJx3
The location of the joints
'''
return torch.einsum('bik,ji->bjk', [vertices, J_regressor])
def blend_shapes(betas: Tensor, shape_disps: Tensor) -> Tensor:
''' Calculates the per vertex displacement due to the blend shapes
Parameters
----------
betas : torch.tensor Bx(num_betas)
Blend shape coefficients
shape_disps: torch.tensor Vx3x(num_betas)
Blend shapes
Returns
-------
torch.tensor BxVx3
The per-vertex displacement due to shape deformation
'''
# Displacement[b, m, k] = sum_{l} betas[b, l] * shape_disps[m, k, l]
# i.e. Multiply each shape displacement by its corresponding beta and
# then sum them.
blend_shape = torch.einsum('bl,mkl->bmk', [betas, shape_disps])
return blend_shape
def batch_rodrigues(
rot_vecs: Tensor,
epsilon: float = 1e-8,
) -> Tensor:
''' Calculates the rotation matrices for a batch of rotation vectors
Parameters
----------
rot_vecs: torch.tensor Nx3
array of N axis-angle vectors
Returns
-------
R: torch.tensor Nx3x3
The rotation matrices for the given axis-angle parameters
'''
batch_size = rot_vecs.shape[0]
device, dtype = rot_vecs.device, rot_vecs.dtype
angle = torch.norm(rot_vecs + 1e-8, dim=1, keepdim=True)
rot_dir = rot_vecs / angle
cos = torch.unsqueeze(torch.cos(angle), dim=1)
sin = torch.unsqueeze(torch.sin(angle), dim=1)
# Bx1 arrays
rx, ry, rz = torch.split(rot_dir, 1, dim=1)
K = torch.zeros((batch_size, 3, 3), dtype=dtype, device=device)
zeros = torch.zeros((batch_size, 1), dtype=dtype, device=device)
K = torch.cat([zeros, -rz, ry, rz, zeros, -rx, -ry, rx, zeros], dim=1) \
.view((batch_size, 3, 3))
ident = torch.eye(3, dtype=dtype, device=device).unsqueeze(dim=0)
rot_mat = ident + sin * K + (1 - cos) * torch.bmm(K, K)
return rot_mat
def transform_mat(R: Tensor, t: Tensor) -> Tensor:
''' Creates a batch of transformation matrices
Args:
- R: Bx3x3 array of a batch of rotation matrices
- t: Bx3x1 array of a batch of translation vectors
Returns:
- T: Bx4x4 Transformation matrix
'''
# No padding left or right, only add an extra row
return torch.cat([F.pad(R, [0, 0, 0, 1]),
F.pad(t, [0, 0, 0, 1], value=1)], dim=2)
def batch_rigid_transform(
rot_mats: Tensor,
joints: Tensor,
parents: Tensor,
dtype=torch.float32
) -> Tensor:
"""
Applies a batch of rigid transformations to the joints
Parameters
----------
rot_mats : torch.tensor BxNx3x3
Tensor of rotation matrices
joints : torch.tensor BxNx3
Locations of joints
parents : torch.tensor BxN
The kinematic tree of each object
dtype : torch.dtype, optional:
The data type of the created tensors, the default is torch.float32
Returns
-------
posed_joints : torch.tensor BxNx3
The locations of the joints after applying the pose rotations
rel_transforms : torch.tensor BxNx4x4
The relative (with respect to the root joint) rigid transformations
for all the joints
"""
joints = torch.unsqueeze(joints, dim=-1)
rel_joints = joints.clone()
rel_joints[:, 1:] -= joints[:, parents[1:]]
transforms_mat = transform_mat(
rot_mats.reshape(-1, 3, 3),
rel_joints.reshape(-1, 3, 1)).reshape(-1, joints.shape[1], 4, 4)
transform_chain = [transforms_mat[:, 0]]
for i in range(1, parents.shape[0]):
# Subtract the joint location at the rest pose
# No need for rotation, since it's identity when at rest
curr_res = torch.matmul(transform_chain[parents[i]],
transforms_mat[:, i])
transform_chain.append(curr_res)
transforms = torch.stack(transform_chain, dim=1)
# The last column of the transformations contains the posed joints
posed_joints = transforms[:, :, :3, 3]
# The last column of the transformations contains the posed joints
posed_joints = transforms[:, :, :3, 3]
joints_homogen = F.pad(joints, [0, 0, 0, 1])
rel_transforms = transforms - F.pad(
torch.matmul(transforms, joints_homogen), [3, 0, 0, 0, 0, 0, 0, 0])
return posed_joints, rel_transforms
-125
View File
@@ -1,125 +0,0 @@
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems. All rights reserved.
#
# Contact: ps-license@tuebingen.mpg.de
from typing import NewType, Union, Optional
from dataclasses import dataclass, asdict, fields
import numpy as np
import torch
Tensor = NewType('Tensor', torch.Tensor)
Array = NewType('Array', np.ndarray)
@dataclass
class ModelOutput:
vertices: Optional[Tensor] = None
joints: Optional[Tensor] = None
full_pose: Optional[Tensor] = None
global_orient: Optional[Tensor] = None
transl: Optional[Tensor] = None
def __getitem__(self, key):
return getattr(self, key)
def get(self, key, default=None):
return getattr(self, key, default)
def __iter__(self):
return self.keys()
def keys(self):
keys = [t.name for t in fields(self)]
return iter(keys)
def values(self):
values = [getattr(self, t.name) for t in fields(self)]
return iter(values)
def items(self):
data = [(t.name, getattr(self, t.name)) for t in fields(self)]
return iter(data)
@dataclass
class SMPLOutput(ModelOutput):
betas: Optional[Tensor] = None
body_pose: Optional[Tensor] = None
@dataclass
class SMPLHOutput(SMPLOutput):
left_hand_pose: Optional[Tensor] = None
right_hand_pose: Optional[Tensor] = None
transl: Optional[Tensor] = None
@dataclass
class SMPLXOutput(SMPLHOutput):
expression: Optional[Tensor] = None
jaw_pose: Optional[Tensor] = None
@dataclass
class MANOOutput(ModelOutput):
betas: Optional[Tensor] = None
hand_pose: Optional[Tensor] = None
@dataclass
class FLAMEOutput(ModelOutput):
betas: Optional[Tensor] = None
expression: Optional[Tensor] = None
jaw_pose: Optional[Tensor] = None
neck_pose: Optional[Tensor] = None
def find_joint_kin_chain(joint_id, kinematic_tree):
kin_chain = []
curr_idx = joint_id
while curr_idx != -1:
kin_chain.append(curr_idx)
curr_idx = kinematic_tree[curr_idx]
return kin_chain
def to_tensor(
array: Union[Array, Tensor], dtype=torch.float32
) -> Tensor:
if torch.is_tensor(array):
return array
else:
return torch.tensor(array, dtype=dtype)
class Struct(object):
def __init__(self, **kwargs):
for key, val in kwargs.items():
setattr(self, key, val)
def to_np(array, dtype=np.float32):
if 'scipy.sparse' in str(type(array)):
array = array.todense()
return np.array(array, dtype=dtype)
def rot_mat_to_euler(rot_mats):
# Calculates rotation matrix to euler angles
# Careful for extreme cases of eular angles like [0.0, pi, 0.0]
sy = torch.sqrt(rot_mats[:, 0, 0] * rot_mats[:, 0, 0] +
rot_mats[:, 1, 0] * rot_mats[:, 1, 0])
return torch.atan2(-rot_mats[:, 2, 0], sy)
@@ -1,77 +0,0 @@
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems. All rights reserved.
#
# Contact: ps-license@tuebingen.mpg.de
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
# Joint name to vertex mapping. SMPL/SMPL-H/SMPL-X vertices that correspond to
# MSCOCO and OpenPose joints
vertex_ids = {
'smplh': {
'nose': 332,
'reye': 6260,
'leye': 2800,
'rear': 4071,
'lear': 583,
'rthumb': 6191,
'rindex': 5782,
'rmiddle': 5905,
'rring': 6016,
'rpinky': 6133,
'lthumb': 2746,
'lindex': 2319,
'lmiddle': 2445,
'lring': 2556,
'lpinky': 2673,
'LBigToe': 3216,
'LSmallToe': 3226,
'LHeel': 3387,
'RBigToe': 6617,
'RSmallToe': 6624,
'RHeel': 6787
},
'smplx': {
'nose': 9120,
'reye': 9929,
'leye': 9448,
'rear': 616,
'lear': 6,
'rthumb': 8079,
'rindex': 7669,
'rmiddle': 7794,
'rring': 7905,
'rpinky': 8022,
'lthumb': 5361,
'lindex': 4933,
'lmiddle': 5058,
'lring': 5169,
'lpinky': 5286,
'LBigToe': 5770,
'LSmallToe': 5780,
'LHeel': 8846,
'RBigToe': 8463,
'RSmallToe': 8474,
'RHeel': 8635
},
'mano': {
'thumb': 744,
'index': 320,
'middle': 443,
'ring': 554,
'pinky': 671,
}
}
@@ -1,77 +0,0 @@
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems. All rights reserved.
#
# Contact: ps-license@tuebingen.mpg.de
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import numpy as np
import torch
import torch.nn as nn
from .utils import to_tensor
class VertexJointSelector(nn.Module):
def __init__(self, vertex_ids=None,
use_hands=True,
use_feet_keypoints=True, **kwargs):
super(VertexJointSelector, self).__init__()
extra_joints_idxs = []
face_keyp_idxs = np.array([
vertex_ids['nose'],
vertex_ids['reye'],
vertex_ids['leye'],
vertex_ids['rear'],
vertex_ids['lear']], dtype=np.int64)
extra_joints_idxs = np.concatenate([extra_joints_idxs,
face_keyp_idxs])
if use_feet_keypoints:
feet_keyp_idxs = np.array([vertex_ids['LBigToe'],
vertex_ids['LSmallToe'],
vertex_ids['LHeel'],
vertex_ids['RBigToe'],
vertex_ids['RSmallToe'],
vertex_ids['RHeel']], dtype=np.int32)
extra_joints_idxs = np.concatenate(
[extra_joints_idxs, feet_keyp_idxs])
if use_hands:
self.tip_names = ['thumb', 'index', 'middle', 'ring', 'pinky']
tips_idxs = []
for hand_id in ['l', 'r']:
for tip_name in self.tip_names:
tips_idxs.append(vertex_ids[hand_id + tip_name])
extra_joints_idxs = np.concatenate(
[extra_joints_idxs, tips_idxs])
self.register_buffer('extra_joints_idxs',
to_tensor(extra_joints_idxs, dtype=torch.long))
def forward(self, vertices, joints):
extra_joints = torch.index_select(vertices, 1, self.extra_joints_idxs)
joints = torch.cat([joints, extra_joints], dim=1)
return joints
@@ -1,20 +0,0 @@
## Removing Chumpy objects
In a Python 2 virtual environment with [Chumpy](https://github.com/mattloper/chumpy) installed run the following to remove any Chumpy objects from the model data:
```bash
python tools/clean_ch.py --input-models path-to-models/*.pkl --output-folder output-folder
```
## Merging SMPL-H and MANO parameters
In order to use the given PyTorch SMPL-H module we first need to merge the SMPL-H and MANO parameters in a single file. After agreeing to the license and downloading the models, run the following command:
```bash
python tools/merge_smplh_mano.py --smplh-fn SMPLH_FOLDER/SMPLH_GENDER.pkl \
--mano-left-fn MANO_FOLDER/MANO_LEFT.pkl \
--mano-right-fn MANO_FOLDER/MANO_RIGHT.pkl \
--output-folder OUTPUT_FOLDER
```
where SMPLH_FOLDER is the folder with the SMPL-H files and MANO_FOLDER the one for the MANO files.
@@ -1,19 +0,0 @@
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems and the Max Planck Institute for Biological
# Cybernetics. All rights reserved.
#
# Contact: ps-license@tuebingen.mpg.de
import clean_ch
import merge_smplh_mano
@@ -1,68 +0,0 @@
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems and the Max Planck Institute for Biological
# Cybernetics. All rights reserved.
#
# Contact: ps-license@tuebingen.mpg.de
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import argparse
import os
import os.path as osp
import pickle
from tqdm import tqdm
import numpy as np
def clean_fn(fn, output_folder='output'):
with open(fn, 'rb') as body_file:
body_data = pickle.load(body_file)
output_dict = {}
for key, data in body_data.iteritems():
if 'chumpy' in str(type(data)):
output_dict[key] = np.array(data)
else:
output_dict[key] = data
out_fn = osp.split(fn)[1]
out_path = osp.join(output_folder, out_fn)
with open(out_path, 'wb') as out_file:
pickle.dump(output_dict, out_file)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--input-models', dest='input_models', nargs='+',
required=True, type=str,
help='The path to the model that will be processed')
parser.add_argument('--output-folder', dest='output_folder',
required=True, type=str,
help='The path to the output folder')
args = parser.parse_args()
input_models = args.input_models
output_folder = args.output_folder
if not osp.exists(output_folder):
print('Creating directory: {}'.format(output_folder))
os.makedirs(output_folder)
for input_model in input_models:
clean_fn(input_model, output_folder=output_folder)
@@ -1,89 +0,0 @@
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is authorized to grant you that right.
# Any use of the computer program without a valid license is prohibited and
# liable to prosecution.
#
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
# for Intelligent Systems and the Max Planck Institute for Biological
# Cybernetics. All rights reserved.
#
# Contact: ps-license@tuebingen.mpg.de
from __future__ import print_function
import os
import os.path as osp
import pickle
import argparse
import numpy as np
def merge_models(smplh_fn, mano_left_fn, mano_right_fn,
output_folder='output'):
with open(smplh_fn, 'rb') as body_file:
body_data = pickle.load(body_file)
with open(mano_left_fn, 'rb') as lhand_file:
lhand_data = pickle.load(lhand_file)
with open(mano_right_fn, 'rb') as rhand_file:
rhand_data = pickle.load(rhand_file)
out_fn = osp.split(smplh_fn)[1]
output_data = body_data.copy()
output_data['hands_componentsl'] = lhand_data['hands_components']
output_data['hands_componentsr'] = rhand_data['hands_components']
output_data['hands_coeffsl'] = lhand_data['hands_coeffs']
output_data['hands_coeffsr'] = rhand_data['hands_coeffs']
output_data['hands_meanl'] = lhand_data['hands_mean']
output_data['hands_meanr'] = rhand_data['hands_mean']
for key, data in output_data.iteritems():
if 'chumpy' in str(type(data)):
output_data[key] = np.array(data)
else:
output_data[key] = data
out_path = osp.join(output_folder, out_fn)
print(out_path)
print('Saving to {}'.format(out_path))
with open(out_path, 'wb') as output_file:
pickle.dump(output_data, output_file)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--smplh-fn', dest='smplh_fn', required=True,
type=str, help='The path to the SMPLH model')
parser.add_argument('--mano-left-fn', dest='mano_left_fn', required=True,
type=str, help='The path to the left hand MANO model')
parser.add_argument('--mano-right-fn', dest='mano_right_fn', required=True,
type=str, help='The path to the right hand MANO model')
parser.add_argument('--output-folder', dest='output_folder',
required=True, type=str,
help='The path to the output folder')
args = parser.parse_args()
smplh_fn = args.smplh_fn
mano_left_fn = args.mano_left_fn
mano_right_fn = args.mano_right_fn
output_folder = args.output_folder
if not osp.exists(output_folder):
print('Creating directory: {}'.format(output_folder))
os.makedirs(output_folder)
merge_models(smplh_fn, mano_left_fn, mano_right_fn, output_folder)
-172
View File
@@ -1,172 +0,0 @@
import torch
import numpy as np
import scipy
from config import cfg
from torch.nn import functional as F
import torchgeometry as tgm
def cam2pixel(cam_coord, f, c):
x = cam_coord[:, 0] / cam_coord[:, 2] * f[0] + c[0]
y = cam_coord[:, 1] / cam_coord[:, 2] * f[1] + c[1]
z = cam_coord[:, 2]
return np.stack((x, y, z), 1)
def pixel2cam(pixel_coord, f, c):
x = (pixel_coord[:, 0] - c[0]) / f[0] * pixel_coord[:, 2]
y = (pixel_coord[:, 1] - c[1]) / f[1] * pixel_coord[:, 2]
z = pixel_coord[:, 2]
return np.stack((x, y, z), 1)
def world2cam(world_coord, R, t):
cam_coord = np.dot(R, world_coord.transpose(1, 0)).transpose(1, 0) + t.reshape(1, 3)
return cam_coord
def cam2world(cam_coord, R, t):
world_coord = np.dot(np.linalg.inv(R), (cam_coord - t.reshape(1, 3)).transpose(1, 0)).transpose(1, 0)
return world_coord
def rigid_transform_3D(A, B):
n, dim = A.shape
centroid_A = np.mean(A, axis=0)
centroid_B = np.mean(B, axis=0)
H = np.dot(np.transpose(A - centroid_A), B - centroid_B) / n
U, s, V = np.linalg.svd(H)
R = np.dot(np.transpose(V), np.transpose(U))
if np.linalg.det(R) < 0:
s[-1] = -s[-1]
V[2] = -V[2]
R = np.dot(np.transpose(V), np.transpose(U))
varP = np.var(A, axis=0).sum()
c = 1 / varP * np.sum(s)
t = -np.dot(c * R, np.transpose(centroid_A)) + np.transpose(centroid_B)
return c, R, t
def rigid_align(A, B):
c, R, t = rigid_transform_3D(A, B)
A2 = np.transpose(np.dot(c * R, np.transpose(A))) + t
return A2
def transform_joint_to_other_db(src_joint, src_name, dst_name):
src_joint_num = len(src_name)
dst_joint_num = len(dst_name)
new_joint = np.zeros(((dst_joint_num,) + src_joint.shape[1:]), dtype=np.float32)
for src_idx in range(len(src_name)):
name = src_name[src_idx]
if name in dst_name:
dst_idx = dst_name.index(name)
new_joint[dst_idx] = src_joint[src_idx]
return new_joint
def rot6d_to_axis_angle(x):
batch_size = x.shape[0]
x = x.view(-1, 3, 2)
a1 = x[:, :, 0]
a2 = x[:, :, 1]
b1 = F.normalize(a1)
b2 = F.normalize(a2 - torch.einsum('bi,bi->b', b1, a2).unsqueeze(-1) * b1)
b3 = torch.cross(b1, b2)
rot_mat = torch.stack((b1, b2, b3), dim=-1) # 3x3 rotation matrix
rot_mat = torch.cat([rot_mat, torch.zeros((batch_size, 3, 1)).to(cfg.device).float()], 2) # 3x4 rotation matrix
axis_angle = tgm.rotation_matrix_to_angle_axis(rot_mat).reshape(-1, 3) # axis-angle
axis_angle[torch.isnan(axis_angle)] = 0.0
return axis_angle
def sample_joint_features(img_feat, joint_xy):
height, width = img_feat.shape[2:]
x = joint_xy[:, :, 0] / (width - 1) * 2 - 1
y = joint_xy[:, :, 1] / (height - 1) * 2 - 1
grid = torch.stack((x, y), 2)[:, :, None, :]
img_feat = F.grid_sample(img_feat, grid, align_corners=True)[:, :, :, 0] # batch_size, channel_dim, joint_num
img_feat = img_feat.permute(0, 2, 1).contiguous() # batch_size, joint_num, channel_dim
return img_feat
def soft_argmax_2d(heatmap2d):
batch_size = heatmap2d.shape[0]
height, width = heatmap2d.shape[2:]
heatmap2d = heatmap2d.reshape((batch_size, -1, height * width))
heatmap2d = F.softmax(heatmap2d, 2)
heatmap2d = heatmap2d.reshape((batch_size, -1, height, width))
accu_x = heatmap2d.sum(dim=(2))
accu_y = heatmap2d.sum(dim=(3))
accu_x = accu_x * torch.arange(width).float().to(cfg.device)[None, None, :]
accu_y = accu_y * torch.arange(height).float().to(cfg.device)[None, None, :]
accu_x = accu_x.sum(dim=2, keepdim=True)
accu_y = accu_y.sum(dim=2, keepdim=True)
coord_out = torch.cat((accu_x, accu_y), dim=2)
return coord_out
def soft_argmax_3d(heatmap3d):
batch_size = heatmap3d.shape[0]
depth, height, width = heatmap3d.shape[2:]
heatmap3d = heatmap3d.reshape((batch_size, -1, depth * height * width))
heatmap3d = F.softmax(heatmap3d, 2)
heatmap3d = heatmap3d.reshape((batch_size, -1, depth, height, width))
accu_x = heatmap3d.sum(dim=(2, 3))
accu_y = heatmap3d.sum(dim=(2, 4))
accu_z = heatmap3d.sum(dim=(3, 4))
accu_x = accu_x * torch.arange(width).float().to(cfg.device)[None, None, :]
accu_y = accu_y * torch.arange(height).float().to(cfg.device)[None, None, :]
accu_z = accu_z * torch.arange(depth).float().to(cfg.device)[None, None, :]
accu_x = accu_x.sum(dim=2, keepdim=True)
accu_y = accu_y.sum(dim=2, keepdim=True)
accu_z = accu_z.sum(dim=2, keepdim=True)
coord_out = torch.cat((accu_x, accu_y, accu_z), dim=2)
return coord_out
def restore_bbox(bbox_center, bbox_size, aspect_ratio, extension_ratio):
bbox = bbox_center.view(-1, 1, 2) + torch.cat((-bbox_size.view(-1, 1, 2) / 2., bbox_size.view(-1, 1, 2) / 2.),
1) # xyxy in (cfg.output_hm_shape[2], cfg.output_hm_shape[1]) space
bbox[:, :, 0] = bbox[:, :, 0] / cfg.output_hm_shape[2] * cfg.input_body_shape[1]
bbox[:, :, 1] = bbox[:, :, 1] / cfg.output_hm_shape[1] * cfg.input_body_shape[0]
bbox = bbox.view(-1, 4)
# xyxy -> xywh
bbox[:, 2] = bbox[:, 2] - bbox[:, 0]
bbox[:, 3] = bbox[:, 3] - bbox[:, 1]
# aspect ratio preserving bbox
w = bbox[:, 2]
h = bbox[:, 3]
c_x = bbox[:, 0] + w / 2.
c_y = bbox[:, 1] + h / 2.
mask1 = w > (aspect_ratio * h)
mask2 = w < (aspect_ratio * h)
h[mask1] = w[mask1] / aspect_ratio
w[mask2] = h[mask2] * aspect_ratio
bbox[:, 2] = w * extension_ratio
bbox[:, 3] = h * extension_ratio
bbox[:, 0] = c_x - bbox[:, 2] / 2.
bbox[:, 1] = c_y - bbox[:, 3] / 2.
# xywh -> xyxy
bbox[:, 2] = bbox[:, 2] + bbox[:, 0]
bbox[:, 3] = bbox[:, 3] + bbox[:, 1]
return bbox
-183
View File
@@ -1,183 +0,0 @@
import os
import cv2
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import matplotlib as mpl
import os
os.environ["PYOPENGL_PLATFORM"] = "egl"
import pyrender
import trimesh
from config import cfg
def vis_keypoints_with_skeleton(img, kps, kps_lines, kp_thresh=0.4, alpha=1):
# Convert from plt 0-1 RGBA colors to 0-255 BGR colors for opencv.
cmap = plt.get_cmap('rainbow')
colors = [cmap(i) for i in np.linspace(0, 1, len(kps_lines) + 2)]
colors = [(c[2] * 255, c[1] * 255, c[0] * 255) for c in colors]
# Perform the drawing on a copy of the image, to allow for blending.
kp_mask = np.copy(img)
# Draw the keypoints.
for l in range(len(kps_lines)):
i1 = kps_lines[l][0]
i2 = kps_lines[l][1]
p1 = kps[0, i1].astype(np.int32), kps[1, i1].astype(np.int32)
p2 = kps[0, i2].astype(np.int32), kps[1, i2].astype(np.int32)
if kps[2, i1] > kp_thresh and kps[2, i2] > kp_thresh:
cv2.line(
kp_mask, p1, p2,
color=colors[l], thickness=2, lineType=cv2.LINE_AA)
if kps[2, i1] > kp_thresh:
cv2.circle(
kp_mask, p1,
radius=3, color=colors[l], thickness=-1, lineType=cv2.LINE_AA)
if kps[2, i2] > kp_thresh:
cv2.circle(
kp_mask, p2,
radius=3, color=colors[l], thickness=-1, lineType=cv2.LINE_AA)
# Blend the keypoints.
return cv2.addWeighted(img, 1.0 - alpha, kp_mask, alpha, 0)
def vis_keypoints(img, kps, alpha=1, radius=3, color=None):
# Convert from plt 0-1 RGBA colors to 0-255 BGR colors for opencv.
cmap = plt.get_cmap('rainbow')
if color is None:
colors = [cmap(i) for i in np.linspace(0, 1, len(kps) + 2)]
colors = [(c[2] * 255, c[1] * 255, c[0] * 255) for c in colors]
# Perform the drawing on a copy of the image, to allow for blending.
kp_mask = np.copy(img)
# Draw the keypoints.
for i in range(len(kps)):
p = kps[i][0].astype(np.int32), kps[i][1].astype(np.int32)
if color is None:
cv2.circle(kp_mask, p, radius=radius, color=colors[i], thickness=-1, lineType=cv2.LINE_AA)
else:
cv2.circle(kp_mask, p, radius=radius, color=color, thickness=-1, lineType=cv2.LINE_AA)
# Blend the keypoints.
return cv2.addWeighted(img, 1.0 - alpha, kp_mask, alpha, 0)
def vis_mesh(img, mesh_vertex, alpha=0.5):
# Convert from plt 0-1 RGBA colors to 0-255 BGR colors for opencv.
cmap = plt.get_cmap('rainbow')
colors = [cmap(i) for i in np.linspace(0, 1, len(mesh_vertex))]
colors = [(c[2] * 255, c[1] * 255, c[0] * 255) for c in colors]
# Perform the drawing on a copy of the image, to allow for blending.
mask = np.copy(img)
# Draw the mesh
for i in range(len(mesh_vertex)):
p = mesh_vertex[i][0].astype(np.int32), mesh_vertex[i][1].astype(np.int32)
cv2.circle(mask, p, radius=1, color=colors[i], thickness=-1, lineType=cv2.LINE_AA)
# Blend the keypoints.
return cv2.addWeighted(img, 1.0 - alpha, mask, alpha, 0)
def vis_3d_skeleton(kpt_3d, kpt_3d_vis, kps_lines, filename=None):
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
# Convert from plt 0-1 RGBA colors to 0-255 BGR colors for opencv.
cmap = plt.get_cmap('rainbow')
colors = [cmap(i) for i in np.linspace(0, 1, len(kps_lines) + 2)]
colors = [np.array((c[2], c[1], c[0])) for c in colors]
for l in range(len(kps_lines)):
i1 = kps_lines[l][0]
i2 = kps_lines[l][1]
x = np.array([kpt_3d[i1,0], kpt_3d[i2,0]])
y = np.array([kpt_3d[i1,1], kpt_3d[i2,1]])
z = np.array([kpt_3d[i1,2], kpt_3d[i2,2]])
if kpt_3d_vis[i1,0] > 0 and kpt_3d_vis[i2,0] > 0:
ax.plot(x, z, -y, c=colors[l], linewidth=2)
if kpt_3d_vis[i1,0] > 0:
ax.scatter(kpt_3d[i1,0], kpt_3d[i1,2], -kpt_3d[i1,1], c=colors[l], marker='o')
if kpt_3d_vis[i2,0] > 0:
ax.scatter(kpt_3d[i2,0], kpt_3d[i2,2], -kpt_3d[i2,1], c=colors[l], marker='o')
x_r = np.array([0, cfg.input_shape[1]], dtype=np.float32)
y_r = np.array([0, cfg.input_shape[0]], dtype=np.float32)
z_r = np.array([0, 1], dtype=np.float32)
if filename is None:
ax.set_title('3D vis')
else:
ax.set_title(filename)
ax.set_xlabel('X Label')
ax.set_ylabel('Z Label')
ax.set_zlabel('Y Label')
ax.legend()
plt.show()
cv2.waitKey(0)
def save_obj(v, f, file_name='output.obj'):
obj_file = open(file_name, 'w')
for i in range(len(v)):
obj_file.write('v ' + str(v[i][0]) + ' ' + str(v[i][1]) + ' ' + str(v[i][2]) + '\n')
for i in range(len(f)):
obj_file.write('f ' + str(f[i][0]+1) + '/' + str(f[i][0]+1) + ' ' + str(f[i][1]+1) + '/' + str(f[i][1]+1) + ' ' + str(f[i][2]+1) + '/' + str(f[i][2]+1) + '\n')
obj_file.close()
def perspective_projection(vertices, cam_param):
# vertices: [N, 3]
# cam_param: [3]
fx, fy= cam_param['focal']
cx, cy = cam_param['princpt']
vertices[:, 0] = vertices[:, 0] * fx / vertices[:, 2] + cx
vertices[:, 1] = vertices[:, 1] * fy / vertices[:, 2] + cy
return vertices
def render_mesh(img, mesh, face, cam_param, mesh_as_vertices=False):
if mesh_as_vertices:
# to run on cluster where headless pyrender is not supported for A100/V100
vertices_2d = perspective_projection(mesh, cam_param)
img = vis_keypoints(img, vertices_2d, alpha=0.8, radius=2, color=(0, 0, 255))
else:
# mesh
mesh = trimesh.Trimesh(mesh, face)
rot = trimesh.transformations.rotation_matrix(
np.radians(180), [1, 0, 0])
mesh.apply_transform(rot)
material = pyrender.MetallicRoughnessMaterial(metallicFactor=0.0, alphaMode='OPAQUE', baseColorFactor=(1.0, 1.0, 0.9, 1.0))
mesh = pyrender.Mesh.from_trimesh(mesh, material=material, smooth=False)
scene = pyrender.Scene(ambient_light=(0.3, 0.3, 0.3))
scene.add(mesh, 'mesh')
focal, princpt = cam_param['focal'], cam_param['princpt']
camera = pyrender.IntrinsicsCamera(fx=focal[0], fy=focal[1], cx=princpt[0], cy=princpt[1])
scene.add(camera)
# renderer
renderer = pyrender.OffscreenRenderer(viewport_width=img.shape[1], viewport_height=img.shape[0], point_size=1.0)
# light
light = pyrender.DirectionalLight(color=[1.0, 1.0, 1.0], intensity=0.8)
light_pose = np.eye(4)
light_pose[:3, 3] = np.array([0, -1, 1])
scene.add(light, pose=light_pose)
light_pose[:3, 3] = np.array([0, 1, 1])
scene.add(light, pose=light_pose)
light_pose[:3, 3] = np.array([1, 1, 2])
scene.add(light, pose=light_pose)
# render
rgb, depth = renderer.render(scene, flags=pyrender.RenderFlags.RGBA)
rgb = rgb[:,:,:3].astype(np.float32)
valid_mask = (depth > 0)[:,:,None]
# save to image
img = rgb * valid_mask + img * (1-valid_mask)
return img
-108
View File
@@ -1,108 +0,0 @@
import smplx
import torch
import pickle
import numpy as np
# # Global: Load the SMPL-X model once
# smplx_model = smplx.create(
# "/content/drive/MyDrive/003_Codes/TANGO-JointEmbedding/beat2/smplx_models/",
# model_type='smplx',
# gender='NEUTRAL_2020',
# use_face_contour=False,
# num_betas=10,
# num_expression_coeffs=10,
# ext='npz',
# use_pca=False,
# ).to("cuda").eval()
# device = "cuda"
def extract_frame_number(file_name):
match = re.search(r'(\d{5})', file_name)
if match:
return int(match.group(1))
return None
def merge_npz_files(npz_files, output_file):
npz_files = sorted(npz_files, key=lambda x: extract_frame_number(os.path.basename(x)))
merged_data = {}
for file in npz_files:
data = np.load(file)
for key in data.files:
if key not in merged_data:
merged_data[key] = []
merged_data[key].append(data[key])
for key in merged_data:
merged_data[key] = np.stack(merged_data[key], axis=0)
np.savez(output_file, **merged_data)
# smplierx data
def npz_to_npz_v2(pkl_path, npz_path):
# Load the pickle file
pkl_example = np.load(pkl_path, allow_pickle=True)
bs = 1
n = pkl_example["expression"].shape[0] # Assuming this is the batch size
# Convert numpy arrays to torch tensors
def to_tensor(numpy_array):
return torch.tensor(numpy_array, dtype=torch.float32).to(device)
# Ensure that betas are loaded from the pickle data, converting them to torch tensors
betas = to_tensor(pkl_example["betas"]).reshape(n, -1)
transl = to_tensor(pkl_example["transl"]).reshape(n, -1)
expression = to_tensor(pkl_example["expression"]).reshape(n, -1)
jaw_pose = to_tensor(pkl_example["jaw_pose"]).reshape(n, -1)
global_orient = to_tensor(pkl_example["global_orient"]).reshape(n, -1)
body_pose_axis = to_tensor(pkl_example["body_pose"]).reshape(n, -1)
left_hand_pose = to_tensor(pkl_example['left_hand_pose']).reshape(n, -1)
right_hand_pose = to_tensor(pkl_example['right_hand_pose']).reshape(n, -1)
leye_pose = to_tensor(pkl_example['leye_pose']).reshape(n, -1)
reye_pose = to_tensor(pkl_example['reye_pose']).reshape(n, -1)
# print(left_hand_pose.shape, right_hand_pose.shape)
# Pass the loaded data into the SMPL-X model
gt_vertex = smplx_model(
betas=betas,
transl=transl, # Translation
expression=expression, # Expression
jaw_pose=jaw_pose, # Jaw pose
global_orient=global_orient, # Global orientation
body_pose=body_pose_axis, # Body pose
left_hand_pose=left_hand_pose, # Left hand pose
right_hand_pose=right_hand_pose, # Right hand pose
return_full_pose=True,
leye_pose=leye_pose, # Left eye pose
reye_pose=reye_pose, # Right eye pose
)
# Save the relevant data to an npz file
np.savez(npz_path,
betas=np.zeros((n, 300)),
poses=gt_vertex["full_pose"].cpu().numpy(),
expressions=np.zeros((n, 100)),
trans=pkl_example["transl"].reshape(n, -1),
model='smplx2020',
gender='neutral',
mocap_frame_rate=30,
)
# smplierx data
def npz_to_npz(pkl_path, npz_path):
# Load the pickle file
pkl_example = np.load(pkl_path, allow_pickle=True)
n = pkl_example["expression"].shape[0] # Assuming this is the batch size
full_pose = np.concatenate([pkl_example["global_orient"], pkl_example["body_pose"], pkl_example["jaw_pose"], pkl_example["leye_pose"], pkl_example["reye_pose"], pkl_example["left_hand_pose"], pkl_example["right_hand_pose"]], axis=1)
# print(full_pose.shape)
np.savez(npz_path,
betas=np.zeros(300),
poses=full_pose.reshape(n, -1),
expressions=np.zeros((n, 100)),
trans=np.zeros((n, 3)),
model='smplx2020',
gender='neutral',
mocap_frame_rate=30,
)
if __name__ == "__main__":
npz_to_npz("/content/drive/MyDrive/003_Codes/TANGO/SMPLer-X/demo/outputs/results_smplx.npz", "/content/drive/MyDrive/003_Codes/TANGO/SMPLer-X/demo/outputs/results_smplx_emage.npz")
-468
View File
@@ -1,468 +0,0 @@
import torch
import torch.nn as nn
from torch.nn import functional as F
from nets.smpler_x import PositionNet, HandRotationNet, FaceRegressor, BoxNet, HandRoI, BodyRotationNet
from nets.loss import CoordLoss, ParamLoss, CELoss
from utils.human_models import smpl_x
from utils.transforms import rot6d_to_axis_angle, restore_bbox
from config import cfg
import math
import copy
from mmpose.models import build_posenet
from mmengine.config import Config
class Model(nn.Module):
def __init__(self, encoder, body_position_net, body_rotation_net, box_net, hand_position_net, hand_roi_net,
hand_rotation_net, face_regressor):
super(Model, self).__init__()
# body
self.encoder = encoder
self.body_position_net = body_position_net
self.body_regressor = body_rotation_net
self.box_net = box_net
# hand
self.hand_roi_net = hand_roi_net
self.hand_position_net = hand_position_net
self.hand_regressor = hand_rotation_net
# face
self.face_regressor = face_regressor
self.smplx_layer = copy.deepcopy(smpl_x.layer['neutral']).to(cfg.device)
self.coord_loss = CoordLoss()
self.param_loss = ParamLoss()
self.ce_loss = CELoss()
self.body_num_joints = len(smpl_x.pos_joint_part['body'])
self.hand_joint_num = len(smpl_x.pos_joint_part['rhand'])
self.neck = [self.box_net, self.hand_roi_net]
self.head = [self.body_position_net, self.body_regressor,
self.hand_position_net, self.hand_regressor,
self.face_regressor]
self.trainable_modules = [self.encoder, self.body_position_net, self.body_regressor,
self.box_net, self.hand_position_net,
self.hand_roi_net, self.hand_regressor, self.face_regressor]
self.special_trainable_modules = []
# backbone:
param_bb = sum(p.numel() for p in self.encoder.parameters() if p.requires_grad)
# neck
param_neck = 0
for module in self.neck:
param_neck += sum(p.numel() for p in module.parameters() if p.requires_grad)
# head
param_head = 0
for module in self.head:
param_head += sum(p.numel() for p in module.parameters() if p.requires_grad)
param_net = param_bb + param_neck + param_head
# print('#parameters:')
# print(f'{param_bb}, {param_neck}, {param_head}, {param_net}')
def get_camera_trans(self, cam_param):
# camera translation
t_xy = cam_param[:, :2]
gamma = torch.sigmoid(cam_param[:, 2]) # apply sigmoid to make it positive
k_value = torch.FloatTensor([math.sqrt(cfg.focal[0] * cfg.focal[1] * cfg.camera_3d_size * cfg.camera_3d_size / (
cfg.input_body_shape[0] * cfg.input_body_shape[1]))]).to(cfg.device).view(-1)
t_z = k_value * gamma
cam_trans = torch.cat((t_xy, t_z[:, None]), 1)
return cam_trans
def get_coord(self, root_pose, body_pose, lhand_pose, rhand_pose, jaw_pose, shape, expr, cam_trans, mode):
batch_size = root_pose.shape[0]
zero_pose = torch.zeros((1, 3)).float().to(cfg.device).repeat(batch_size, 1) # eye poses
output = self.smplx_layer(betas=shape, body_pose=body_pose, global_orient=root_pose, right_hand_pose=rhand_pose,
left_hand_pose=lhand_pose, jaw_pose=jaw_pose, leye_pose=zero_pose,
reye_pose=zero_pose, expression=expr)
# camera-centered 3D coordinate
mesh_cam = output.vertices
if mode == 'test' and cfg.testset == 'AGORA': # use 144 joints for AGORA evaluation
joint_cam = output.joints
else:
joint_cam = output.joints[:, smpl_x.joint_idx, :]
# project 3D coordinates to 2D space
if mode == 'train' and len(cfg.trainset_3d) == 1 and cfg.trainset_3d[0] == 'AGORA' and len(
cfg.trainset_2d) == 0: # prevent gradients from backpropagating to SMPLX paraemter regression module
x = (joint_cam[:, :, 0].detach() + cam_trans[:, None, 0]) / (
joint_cam[:, :, 2].detach() + cam_trans[:, None, 2] + 1e-4) * cfg.focal[0] + cfg.princpt[0]
y = (joint_cam[:, :, 1].detach() + cam_trans[:, None, 1]) / (
joint_cam[:, :, 2].detach() + cam_trans[:, None, 2] + 1e-4) * cfg.focal[1] + cfg.princpt[1]
else:
x = (joint_cam[:, :, 0] + cam_trans[:, None, 0]) / (joint_cam[:, :, 2] + cam_trans[:, None, 2] + 1e-4) * \
cfg.focal[0] + cfg.princpt[0]
y = (joint_cam[:, :, 1] + cam_trans[:, None, 1]) / (joint_cam[:, :, 2] + cam_trans[:, None, 2] + 1e-4) * \
cfg.focal[1] + cfg.princpt[1]
x = x / cfg.input_body_shape[1] * cfg.output_hm_shape[2]
y = y / cfg.input_body_shape[0] * cfg.output_hm_shape[1]
joint_proj = torch.stack((x, y), 2)
# root-relative 3D coordinates
root_cam = joint_cam[:, smpl_x.root_joint_idx, None, :]
joint_cam = joint_cam - root_cam
mesh_cam = mesh_cam + cam_trans[:, None, :] # for rendering
joint_cam_wo_ra = joint_cam.clone()
# left hand root (left wrist)-relative 3D coordinatese
lhand_idx = smpl_x.joint_part['lhand']
lhand_cam = joint_cam[:, lhand_idx, :]
lwrist_cam = joint_cam[:, smpl_x.lwrist_idx, None, :]
lhand_cam = lhand_cam - lwrist_cam
joint_cam = torch.cat((joint_cam[:, :lhand_idx[0], :], lhand_cam, joint_cam[:, lhand_idx[-1] + 1:, :]), 1)
# right hand root (right wrist)-relative 3D coordinatese
rhand_idx = smpl_x.joint_part['rhand']
rhand_cam = joint_cam[:, rhand_idx, :]
rwrist_cam = joint_cam[:, smpl_x.rwrist_idx, None, :]
rhand_cam = rhand_cam - rwrist_cam
joint_cam = torch.cat((joint_cam[:, :rhand_idx[0], :], rhand_cam, joint_cam[:, rhand_idx[-1] + 1:, :]), 1)
# face root (neck)-relative 3D coordinates
face_idx = smpl_x.joint_part['face']
face_cam = joint_cam[:, face_idx, :]
neck_cam = joint_cam[:, smpl_x.neck_idx, None, :]
face_cam = face_cam - neck_cam
joint_cam = torch.cat((joint_cam[:, :face_idx[0], :], face_cam, joint_cam[:, face_idx[-1] + 1:, :]), 1)
return joint_proj, joint_cam, joint_cam_wo_ra, mesh_cam
def generate_mesh_gt(self, targets, mode):
if 'smplx_mesh_cam' in targets:
return targets['smplx_mesh_cam']
nums = [3, 63, 45, 45, 3]
accu = []
temp = 0
for num in nums:
temp += num
accu.append(temp)
pose = targets['smplx_pose']
root_pose, body_pose, lhand_pose, rhand_pose, jaw_pose = \
pose[:, :accu[0]], pose[:, accu[0]:accu[1]], pose[:, accu[1]:accu[2]], pose[:, accu[2]:accu[3]], pose[:,
accu[3]:
accu[4]]
# print(lhand_pose)
shape = targets['smplx_shape']
expr = targets['smplx_expr']
cam_trans = targets['smplx_cam_trans']
# final output
joint_proj, joint_cam, joint_cam_wo_ra, mesh_cam = self.get_coord(root_pose, body_pose, lhand_pose, rhand_pose, jaw_pose, shape,
expr, cam_trans, mode)
return mesh_cam
def bbox_split(self, bbox):
# bbox:[bs, 3, 3]
lhand_bbox_center, rhand_bbox_center, face_bbox_center = \
bbox[:, 0, :2], bbox[:, 1, :2], bbox[:, 2, :2]
return lhand_bbox_center, rhand_bbox_center, face_bbox_center
def forward(self, inputs, targets, meta_info, mode):
body_img = F.interpolate(inputs['img'], cfg.input_body_shape)
# 1. Encoder
img_feat, task_tokens = self.encoder(body_img) # task_token:[bs, N, c]
shape_token, cam_token, expr_token, jaw_pose_token, hand_token, body_pose_token = \
task_tokens[:, 0], task_tokens[:, 1], task_tokens[:, 2], task_tokens[:, 3], task_tokens[:, 4:6], task_tokens[:, 6:]
# 2. Body Regressor
body_joint_hm, body_joint_img = self.body_position_net(img_feat)
root_pose, body_pose, shape, cam_param, = self.body_regressor(body_pose_token, shape_token, cam_token, body_joint_img.detach())
root_pose = rot6d_to_axis_angle(root_pose)
body_pose = rot6d_to_axis_angle(body_pose.reshape(-1, 6)).reshape(body_pose.shape[0], -1) # (N, J_R*3)
cam_trans = self.get_camera_trans(cam_param)
# 3. Hand and Face BBox Estimation
lhand_bbox_center, lhand_bbox_size, rhand_bbox_center, rhand_bbox_size, face_bbox_center, face_bbox_size = self.box_net(img_feat, body_joint_hm.detach())
lhand_bbox = restore_bbox(lhand_bbox_center, lhand_bbox_size, cfg.input_hand_shape[1] / cfg.input_hand_shape[0], 2.0).detach() # xyxy in (cfg.input_body_shape[1], cfg.input_body_shape[0]) space
rhand_bbox = restore_bbox(rhand_bbox_center, rhand_bbox_size, cfg.input_hand_shape[1] / cfg.input_hand_shape[0], 2.0).detach() # xyxy in (cfg.input_body_shape[1], cfg.input_body_shape[0]) space
face_bbox = restore_bbox(face_bbox_center, face_bbox_size, cfg.input_face_shape[1] / cfg.input_face_shape[0], 1.5).detach() # xyxy in (cfg.input_body_shape[1], cfg.input_body_shape[0]) space
# 4. Differentiable Feature-level Hand Crop-Upsample
# hand_feat: list, [bsx2, c, cfg.output_hm_shape[1]*scale, cfg.output_hm_shape[2]*scale]
hand_feat = self.hand_roi_net(img_feat, lhand_bbox, rhand_bbox) # hand_feat: flipped left hand + right hand
# 5. Hand/Face Regressor
# hand regressor
_, hand_joint_img = self.hand_position_net(hand_feat) # (2N, J_P, 3)
hand_pose = self.hand_regressor(hand_feat, hand_joint_img.detach())
hand_pose = rot6d_to_axis_angle(hand_pose.reshape(-1, 6)).reshape(hand_feat.shape[0], -1) # (2N, J_R*3)
# restore flipped left hand joint coordinates
batch_size = hand_joint_img.shape[0] // 2
lhand_joint_img = hand_joint_img[:batch_size, :, :]
lhand_joint_img = torch.cat((cfg.output_hand_hm_shape[2] - 1 - lhand_joint_img[:, :, 0:1], lhand_joint_img[:, :, 1:]), 2)
rhand_joint_img = hand_joint_img[batch_size:, :, :]
# restore flipped left hand joint rotations
batch_size = hand_pose.shape[0] // 2
lhand_pose = hand_pose[:batch_size, :].reshape(-1, len(smpl_x.orig_joint_part['lhand']), 3)
lhand_pose = torch.cat((lhand_pose[:, :, 0:1], -lhand_pose[:, :, 1:3]), 2).view(batch_size, -1)
rhand_pose = hand_pose[batch_size:, :]
# hand regressor
expr, jaw_pose = self.face_regressor(expr_token, jaw_pose_token)
jaw_pose = rot6d_to_axis_angle(jaw_pose)
# final output
joint_proj, joint_cam, joint_cam_wo_ra, mesh_cam = self.get_coord(root_pose, body_pose, lhand_pose, rhand_pose, jaw_pose, shape, expr, cam_trans, mode)
pose = torch.cat((root_pose, body_pose, lhand_pose, rhand_pose, jaw_pose), 1)
joint_img = torch.cat((body_joint_img, lhand_joint_img, rhand_joint_img), 1)
if mode == 'test' and 'smplx_pose' in targets:
mesh_pseudo_gt = self.generate_mesh_gt(targets, mode)
if mode == 'train':
# loss functions
loss = {}
smplx_kps_3d_weight = getattr(cfg, 'smplx_kps_3d_weight', 1.0)
smplx_kps_3d_weight = getattr(cfg, 'smplx_kps_weight', smplx_kps_3d_weight) # old config
smplx_kps_2d_weight = getattr(cfg, 'smplx_kps_2d_weight', 1.0)
net_kps_2d_weight = getattr(cfg, 'net_kps_2d_weight', 1.0)
smplx_pose_weight = getattr(cfg, 'smplx_pose_weight', 1.0)
smplx_shape_weight = getattr(cfg, 'smplx_loss_weight', 1.0)
# smplx_orient_weight = getattr(cfg, 'smplx_orient_weight', smplx_pose_weight) # if not specified, use the same weight as pose
# do not supervise root pose if original agora json is used
if getattr(cfg, 'agora_fix_global_orient_transl', False):
# loss['smplx_pose'] = self.param_loss(pose, targets['smplx_pose'], meta_info['smplx_pose_valid'])[:, 3:] * smplx_pose_weight
if hasattr(cfg, 'smplx_orient_weight'):
smplx_orient_weight = getattr(cfg, 'smplx_orient_weight')
loss['smplx_orient'] = self.param_loss(pose, targets['smplx_pose'], meta_info['smplx_pose_valid'])[:, :3] * smplx_orient_weight
loss['smplx_pose'] = self.param_loss(pose, targets['smplx_pose'], meta_info['smplx_pose_valid']) * smplx_pose_weight
else:
loss['smplx_pose'] = self.param_loss(pose, targets['smplx_pose'], meta_info['smplx_pose_valid'])[:, 3:] * smplx_pose_weight
loss['smplx_shape'] = self.param_loss(shape, targets['smplx_shape'],
meta_info['smplx_shape_valid'][:, None]) * smplx_shape_weight
loss['smplx_expr'] = self.param_loss(expr, targets['smplx_expr'], meta_info['smplx_expr_valid'][:, None])
# supervision for keypoints3d wo/ ra
loss['joint_cam'] = self.coord_loss(joint_cam_wo_ra, targets['joint_cam'], meta_info['joint_valid'] * meta_info['is_3D'][:, None, None]) * smplx_kps_3d_weight
# supervision for keypoints3d w/ ra
loss['smplx_joint_cam'] = self.coord_loss(joint_cam, targets['smplx_joint_cam'], meta_info['smplx_joint_valid']) * smplx_kps_3d_weight
if not (meta_info['lhand_bbox_valid'] == 0).all():
loss['lhand_bbox'] = (self.coord_loss(lhand_bbox_center, targets['lhand_bbox_center'], meta_info['lhand_bbox_valid'][:, None]) +
self.coord_loss(lhand_bbox_size, targets['lhand_bbox_size'], meta_info['lhand_bbox_valid'][:, None]))
if not (meta_info['rhand_bbox_valid'] == 0).all():
loss['rhand_bbox'] = (self.coord_loss(rhand_bbox_center, targets['rhand_bbox_center'], meta_info['rhand_bbox_valid'][:, None]) +
self.coord_loss(rhand_bbox_size, targets['rhand_bbox_size'], meta_info['rhand_bbox_valid'][:, None]))
if not (meta_info['face_bbox_valid'] == 0).all():
loss['face_bbox'] = (self.coord_loss(face_bbox_center, targets['face_bbox_center'], meta_info['face_bbox_valid'][:, None]) +
self.coord_loss(face_bbox_size, targets['face_bbox_size'], meta_info['face_bbox_valid'][:, None]))
# if (meta_info['face_bbox_valid'] == 0).all():
# out = {}
targets['original_joint_img'] = targets['joint_img'].clone()
targets['original_smplx_joint_img'] = targets['smplx_joint_img'].clone()
# out['original_joint_proj'] = joint_proj.clone()
if not (meta_info['lhand_bbox_valid'] + meta_info['rhand_bbox_valid'] == 0).all():
# change hand target joint_img and joint_trunc according to hand bbox (cfg.output_hm_shape -> downsampled hand bbox space)
for part_name, bbox in (('lhand', lhand_bbox), ('rhand', rhand_bbox)):
for coord_name, trunc_name in (('joint_img', 'joint_trunc'), ('smplx_joint_img', 'smplx_joint_trunc')):
x = targets[coord_name][:, smpl_x.joint_part[part_name], 0]
y = targets[coord_name][:, smpl_x.joint_part[part_name], 1]
z = targets[coord_name][:, smpl_x.joint_part[part_name], 2]
trunc = meta_info[trunc_name][:, smpl_x.joint_part[part_name], 0]
x -= (bbox[:, None, 0] / cfg.input_body_shape[1] * cfg.output_hm_shape[2])
x *= (cfg.output_hand_hm_shape[2] / (
(bbox[:, None, 2] - bbox[:, None, 0]) / cfg.input_body_shape[1] * cfg.output_hm_shape[
2]))
y -= (bbox[:, None, 1] / cfg.input_body_shape[0] * cfg.output_hm_shape[1])
y *= (cfg.output_hand_hm_shape[1] / (
(bbox[:, None, 3] - bbox[:, None, 1]) / cfg.input_body_shape[0] * cfg.output_hm_shape[
1]))
z *= cfg.output_hand_hm_shape[0] / cfg.output_hm_shape[0]
trunc *= ((x >= 0) * (x < cfg.output_hand_hm_shape[2]) * (y >= 0) * (
y < cfg.output_hand_hm_shape[1]))
coord = torch.stack((x, y, z), 2)
trunc = trunc[:, :, None]
targets[coord_name] = torch.cat((targets[coord_name][:, :smpl_x.joint_part[part_name][0], :], coord,
targets[coord_name][:, smpl_x.joint_part[part_name][-1] + 1:, :]),
1)
meta_info[trunc_name] = torch.cat((meta_info[trunc_name][:, :smpl_x.joint_part[part_name][0], :],
trunc,
meta_info[trunc_name][:, smpl_x.joint_part[part_name][-1] + 1:,
:]), 1)
# change hand projected joint coordinates according to hand bbox (cfg.output_hm_shape -> hand bbox space)
for part_name, bbox in (('lhand', lhand_bbox), ('rhand', rhand_bbox)):
x = joint_proj[:, smpl_x.joint_part[part_name], 0]
y = joint_proj[:, smpl_x.joint_part[part_name], 1]
x -= (bbox[:, None, 0] / cfg.input_body_shape[1] * cfg.output_hm_shape[2])
x *= (cfg.output_hand_hm_shape[2] / (
(bbox[:, None, 2] - bbox[:, None, 0]) / cfg.input_body_shape[1] * cfg.output_hm_shape[2]))
y -= (bbox[:, None, 1] / cfg.input_body_shape[0] * cfg.output_hm_shape[1])
y *= (cfg.output_hand_hm_shape[1] / (
(bbox[:, None, 3] - bbox[:, None, 1]) / cfg.input_body_shape[0] * cfg.output_hm_shape[1]))
coord = torch.stack((x, y), 2)
trans = []
for bid in range(coord.shape[0]):
mask = meta_info['joint_trunc'][bid, smpl_x.joint_part[part_name], 0] == 1
if torch.sum(mask) == 0:
trans.append(torch.zeros((2)).float().to(cfg.device))
else:
trans.append((-coord[bid, mask, :2] + targets['joint_img'][:, smpl_x.joint_part[part_name], :][
bid, mask, :2]).mean(0))
trans = torch.stack(trans)[:, None, :]
coord = coord + trans # global translation alignment
joint_proj = torch.cat((joint_proj[:, :smpl_x.joint_part[part_name][0], :], coord,
joint_proj[:, smpl_x.joint_part[part_name][-1] + 1:, :]), 1)
if not (meta_info['face_bbox_valid'] == 0).all():
# change face projected joint coordinates according to face bbox (cfg.output_hm_shape -> face bbox space)
coord = joint_proj[:, smpl_x.joint_part['face'], :]
trans = []
for bid in range(coord.shape[0]):
mask = meta_info['joint_trunc'][bid, smpl_x.joint_part['face'], 0] == 1
if torch.sum(mask) == 0:
trans.append(torch.zeros((2)).float().to(cfg.device))
else:
trans.append((-coord[bid, mask, :2] + targets['joint_img'][:, smpl_x.joint_part['face'], :][bid,
mask, :2]).mean(0))
trans = torch.stack(trans)[:, None, :]
coord = coord + trans # global translation alignment
joint_proj = torch.cat((joint_proj[:, :smpl_x.joint_part['face'][0], :], coord,
joint_proj[:, smpl_x.joint_part['face'][-1] + 1:, :]), 1)
loss['joint_proj'] = self.coord_loss(joint_proj, targets['joint_img'][:, :, :2], meta_info['joint_trunc']) * smplx_kps_2d_weight
loss['joint_img'] = self.coord_loss(joint_img, smpl_x.reduce_joint_set(targets['joint_img']),
smpl_x.reduce_joint_set(meta_info['joint_trunc']), meta_info['is_3D']) * net_kps_2d_weight
loss['smplx_joint_img'] = self.coord_loss(joint_img, smpl_x.reduce_joint_set(targets['smplx_joint_img']),
smpl_x.reduce_joint_set(meta_info['smplx_joint_trunc'])) * net_kps_2d_weight
return loss
else:
# change hand output joint_img according to hand bbox
for part_name, bbox in (('lhand', lhand_bbox), ('rhand', rhand_bbox)):
joint_img[:, smpl_x.pos_joint_part[part_name], 0] *= (
((bbox[:, None, 2] - bbox[:, None, 0]) / cfg.input_body_shape[1] * cfg.output_hm_shape[2]) /
cfg.output_hand_hm_shape[2])
joint_img[:, smpl_x.pos_joint_part[part_name], 0] += (
bbox[:, None, 0] / cfg.input_body_shape[1] * cfg.output_hm_shape[2])
joint_img[:, smpl_x.pos_joint_part[part_name], 1] *= (
((bbox[:, None, 3] - bbox[:, None, 1]) / cfg.input_body_shape[0] * cfg.output_hm_shape[1]) /
cfg.output_hand_hm_shape[1])
joint_img[:, smpl_x.pos_joint_part[part_name], 1] += (
bbox[:, None, 1] / cfg.input_body_shape[0] * cfg.output_hm_shape[1])
# change input_body_shape to input_img_shape
for bbox in (lhand_bbox, rhand_bbox, face_bbox):
bbox[:, 0] *= cfg.input_img_shape[1] / cfg.input_body_shape[1]
bbox[:, 1] *= cfg.input_img_shape[0] / cfg.input_body_shape[0]
bbox[:, 2] *= cfg.input_img_shape[1] / cfg.input_body_shape[1]
bbox[:, 3] *= cfg.input_img_shape[0] / cfg.input_body_shape[0]
# test output
out = {}
out['img'] = inputs['img']
out['joint_img'] = joint_img
out['smplx_joint_proj'] = joint_proj
out['smplx_mesh_cam'] = mesh_cam
out['smplx_root_pose'] = root_pose
out['smplx_body_pose'] = body_pose
out['smplx_lhand_pose'] = lhand_pose
out['smplx_rhand_pose'] = rhand_pose
out['smplx_jaw_pose'] = jaw_pose
out['smplx_shape'] = shape
out['smplx_expr'] = expr
out['cam_trans'] = cam_trans
out['lhand_bbox'] = lhand_bbox
out['rhand_bbox'] = rhand_bbox
out['face_bbox'] = face_bbox
if 'smplx_shape' in targets:
out['smplx_shape_target'] = targets['smplx_shape']
if 'img_path' in meta_info:
out['img_path'] = meta_info['img_path']
if 'smplx_pose' in targets:
out['smplx_mesh_cam_pseudo_gt'] = mesh_pseudo_gt
if 'smplx_mesh_cam' in targets:
out['smplx_mesh_cam_target'] = targets['smplx_mesh_cam']
if 'smpl_mesh_cam' in targets:
out['smpl_mesh_cam_target'] = targets['smpl_mesh_cam']
if 'bb2img_trans' in meta_info:
out['bb2img_trans'] = meta_info['bb2img_trans']
if 'gt_smplx_transl' in meta_info:
out['gt_smplx_transl'] = meta_info['gt_smplx_transl']
return out
def init_weights(m):
try:
if type(m) == nn.ConvTranspose2d:
nn.init.normal_(m.weight, std=0.001)
elif type(m) == nn.Conv2d:
nn.init.normal_(m.weight, std=0.001)
nn.init.constant_(m.bias, 0)
elif type(m) == nn.BatchNorm2d:
nn.init.constant_(m.weight, 1)
nn.init.constant_(m.bias, 0)
elif type(m) == nn.Linear:
nn.init.normal_(m.weight, std=0.01)
nn.init.constant_(m.bias, 0)
except AttributeError:
pass
def get_model(mode):
# body
vit_cfg = Config.fromfile(cfg.encoder_config_file)
vit = build_posenet(vit_cfg.model)
body_position_net = PositionNet('body', feat_dim=cfg.feat_dim)
body_rotation_net = BodyRotationNet(feat_dim=cfg.feat_dim)
box_net = BoxNet(feat_dim=cfg.feat_dim)
# hand
hand_position_net = PositionNet('hand', feat_dim=cfg.feat_dim)
hand_roi_net = HandRoI(feat_dim=cfg.feat_dim, upscale=cfg.upscale)
hand_rotation_net = HandRotationNet('hand', feat_dim=cfg.feat_dim)
# face
face_regressor = FaceRegressor(feat_dim=cfg.feat_dim)
if mode == 'train':
# body
if not getattr(cfg, 'random_init', False):
encoder_pretrained_model = torch.load(cfg.encoder_pretrained_model_path)['state_dict']
vit.load_state_dict(encoder_pretrained_model, strict=False)
print(f"Initialize encoder from {cfg.encoder_pretrained_model_path}")
else:
print('Random init!!!!!!!')
body_position_net.apply(init_weights)
body_rotation_net.apply(init_weights)
box_net.apply(init_weights)
# hand
hand_position_net.apply(init_weights)
hand_roi_net.apply(init_weights)
hand_rotation_net.apply(init_weights)
# face
face_regressor.apply(init_weights)
encoder = vit.backbone
model = Model(encoder, body_position_net, body_rotation_net, box_net, hand_position_net, hand_roi_net, hand_rotation_net,
face_regressor)
return model
-384
View File
@@ -1,384 +0,0 @@
dataset_info = dict(
dataset_name='300w',
paper_info=dict(
author='Sagonas, Christos and Antonakos, Epameinondas '
'and Tzimiropoulos, Georgios and Zafeiriou, Stefanos '
'and Pantic, Maja',
title='300 faces in-the-wild challenge: '
'Database and results',
container='Image and vision computing',
year='2016',
homepage='https://ibug.doc.ic.ac.uk/resources/300-W/',
),
keypoint_info={
0:
dict(
name='kpt-0', id=0, color=[255, 255, 255], type='', swap='kpt-16'),
1:
dict(
name='kpt-1', id=1, color=[255, 255, 255], type='', swap='kpt-15'),
2:
dict(
name='kpt-2', id=2, color=[255, 255, 255], type='', swap='kpt-14'),
3:
dict(
name='kpt-3', id=3, color=[255, 255, 255], type='', swap='kpt-13'),
4:
dict(
name='kpt-4', id=4, color=[255, 255, 255], type='', swap='kpt-12'),
5:
dict(
name='kpt-5', id=5, color=[255, 255, 255], type='', swap='kpt-11'),
6:
dict(
name='kpt-6', id=6, color=[255, 255, 255], type='', swap='kpt-10'),
7:
dict(name='kpt-7', id=7, color=[255, 255, 255], type='', swap='kpt-9'),
8:
dict(name='kpt-8', id=8, color=[255, 255, 255], type='', swap=''),
9:
dict(name='kpt-9', id=9, color=[255, 255, 255], type='', swap='kpt-7'),
10:
dict(
name='kpt-10', id=10, color=[255, 255, 255], type='',
swap='kpt-6'),
11:
dict(
name='kpt-11', id=11, color=[255, 255, 255], type='',
swap='kpt-5'),
12:
dict(
name='kpt-12', id=12, color=[255, 255, 255], type='',
swap='kpt-4'),
13:
dict(
name='kpt-13', id=13, color=[255, 255, 255], type='',
swap='kpt-3'),
14:
dict(
name='kpt-14', id=14, color=[255, 255, 255], type='',
swap='kpt-2'),
15:
dict(
name='kpt-15', id=15, color=[255, 255, 255], type='',
swap='kpt-1'),
16:
dict(
name='kpt-16', id=16, color=[255, 255, 255], type='',
swap='kpt-0'),
17:
dict(
name='kpt-17',
id=17,
color=[255, 255, 255],
type='',
swap='kpt-26'),
18:
dict(
name='kpt-18',
id=18,
color=[255, 255, 255],
type='',
swap='kpt-25'),
19:
dict(
name='kpt-19',
id=19,
color=[255, 255, 255],
type='',
swap='kpt-24'),
20:
dict(
name='kpt-20',
id=20,
color=[255, 255, 255],
type='',
swap='kpt-23'),
21:
dict(
name='kpt-21',
id=21,
color=[255, 255, 255],
type='',
swap='kpt-22'),
22:
dict(
name='kpt-22',
id=22,
color=[255, 255, 255],
type='',
swap='kpt-21'),
23:
dict(
name='kpt-23',
id=23,
color=[255, 255, 255],
type='',
swap='kpt-20'),
24:
dict(
name='kpt-24',
id=24,
color=[255, 255, 255],
type='',
swap='kpt-19'),
25:
dict(
name='kpt-25',
id=25,
color=[255, 255, 255],
type='',
swap='kpt-18'),
26:
dict(
name='kpt-26',
id=26,
color=[255, 255, 255],
type='',
swap='kpt-17'),
27:
dict(name='kpt-27', id=27, color=[255, 255, 255], type='', swap=''),
28:
dict(name='kpt-28', id=28, color=[255, 255, 255], type='', swap=''),
29:
dict(name='kpt-29', id=29, color=[255, 255, 255], type='', swap=''),
30:
dict(name='kpt-30', id=30, color=[255, 255, 255], type='', swap=''),
31:
dict(
name='kpt-31',
id=31,
color=[255, 255, 255],
type='',
swap='kpt-35'),
32:
dict(
name='kpt-32',
id=32,
color=[255, 255, 255],
type='',
swap='kpt-34'),
33:
dict(name='kpt-33', id=33, color=[255, 255, 255], type='', swap=''),
34:
dict(
name='kpt-34',
id=34,
color=[255, 255, 255],
type='',
swap='kpt-32'),
35:
dict(
name='kpt-35',
id=35,
color=[255, 255, 255],
type='',
swap='kpt-31'),
36:
dict(
name='kpt-36',
id=36,
color=[255, 255, 255],
type='',
swap='kpt-45'),
37:
dict(
name='kpt-37',
id=37,
color=[255, 255, 255],
type='',
swap='kpt-44'),
38:
dict(
name='kpt-38',
id=38,
color=[255, 255, 255],
type='',
swap='kpt-43'),
39:
dict(
name='kpt-39',
id=39,
color=[255, 255, 255],
type='',
swap='kpt-42'),
40:
dict(
name='kpt-40',
id=40,
color=[255, 255, 255],
type='',
swap='kpt-47'),
41:
dict(
name='kpt-41',
id=41,
color=[255, 255, 255],
type='',
swap='kpt-46'),
42:
dict(
name='kpt-42',
id=42,
color=[255, 255, 255],
type='',
swap='kpt-39'),
43:
dict(
name='kpt-43',
id=43,
color=[255, 255, 255],
type='',
swap='kpt-38'),
44:
dict(
name='kpt-44',
id=44,
color=[255, 255, 255],
type='',
swap='kpt-37'),
45:
dict(
name='kpt-45',
id=45,
color=[255, 255, 255],
type='',
swap='kpt-36'),
46:
dict(
name='kpt-46',
id=46,
color=[255, 255, 255],
type='',
swap='kpt-41'),
47:
dict(
name='kpt-47',
id=47,
color=[255, 255, 255],
type='',
swap='kpt-40'),
48:
dict(
name='kpt-48',
id=48,
color=[255, 255, 255],
type='',
swap='kpt-54'),
49:
dict(
name='kpt-49',
id=49,
color=[255, 255, 255],
type='',
swap='kpt-53'),
50:
dict(
name='kpt-50',
id=50,
color=[255, 255, 255],
type='',
swap='kpt-52'),
51:
dict(name='kpt-51', id=51, color=[255, 255, 255], type='', swap=''),
52:
dict(
name='kpt-52',
id=52,
color=[255, 255, 255],
type='',
swap='kpt-50'),
53:
dict(
name='kpt-53',
id=53,
color=[255, 255, 255],
type='',
swap='kpt-49'),
54:
dict(
name='kpt-54',
id=54,
color=[255, 255, 255],
type='',
swap='kpt-48'),
55:
dict(
name='kpt-55',
id=55,
color=[255, 255, 255],
type='',
swap='kpt-59'),
56:
dict(
name='kpt-56',
id=56,
color=[255, 255, 255],
type='',
swap='kpt-58'),
57:
dict(name='kpt-57', id=57, color=[255, 255, 255], type='', swap=''),
58:
dict(
name='kpt-58',
id=58,
color=[255, 255, 255],
type='',
swap='kpt-56'),
59:
dict(
name='kpt-59',
id=59,
color=[255, 255, 255],
type='',
swap='kpt-55'),
60:
dict(
name='kpt-60',
id=60,
color=[255, 255, 255],
type='',
swap='kpt-64'),
61:
dict(
name='kpt-61',
id=61,
color=[255, 255, 255],
type='',
swap='kpt-63'),
62:
dict(name='kpt-62', id=62, color=[255, 255, 255], type='', swap=''),
63:
dict(
name='kpt-63',
id=63,
color=[255, 255, 255],
type='',
swap='kpt-61'),
64:
dict(
name='kpt-64',
id=64,
color=[255, 255, 255],
type='',
swap='kpt-60'),
65:
dict(
name='kpt-65',
id=65,
color=[255, 255, 255],
type='',
swap='kpt-67'),
66:
dict(name='kpt-66', id=66, color=[255, 255, 255], type='', swap=''),
67:
dict(
name='kpt-67',
id=67,
color=[255, 255, 255],
type='',
swap='kpt-65'),
},
skeleton_info={},
joint_weights=[1.] * 68,
sigmas=[])
-83
View File
@@ -1,83 +0,0 @@
dataset_info = dict(
dataset_name='aflw',
paper_info=dict(
author='Koestinger, Martin and Wohlhart, Paul and '
'Roth, Peter M and Bischof, Horst',
title='Annotated facial landmarks in the wild: '
'A large-scale, real-world database for facial '
'landmark localization',
container='2011 IEEE international conference on computer '
'vision workshops (ICCV workshops)',
year='2011',
homepage='https://www.tugraz.at/institute/icg/research/'
'team-bischof/lrs/downloads/aflw/',
),
keypoint_info={
0:
dict(name='kpt-0', id=0, color=[255, 255, 255], type='', swap='kpt-5'),
1:
dict(name='kpt-1', id=1, color=[255, 255, 255], type='', swap='kpt-4'),
2:
dict(name='kpt-2', id=2, color=[255, 255, 255], type='', swap='kpt-3'),
3:
dict(name='kpt-3', id=3, color=[255, 255, 255], type='', swap='kpt-2'),
4:
dict(name='kpt-4', id=4, color=[255, 255, 255], type='', swap='kpt-1'),
5:
dict(name='kpt-5', id=5, color=[255, 255, 255], type='', swap='kpt-0'),
6:
dict(
name='kpt-6', id=6, color=[255, 255, 255], type='', swap='kpt-11'),
7:
dict(
name='kpt-7', id=7, color=[255, 255, 255], type='', swap='kpt-10'),
8:
dict(name='kpt-8', id=8, color=[255, 255, 255], type='', swap='kpt-9'),
9:
dict(name='kpt-9', id=9, color=[255, 255, 255], type='', swap='kpt-8'),
10:
dict(
name='kpt-10', id=10, color=[255, 255, 255], type='',
swap='kpt-7'),
11:
dict(
name='kpt-11', id=11, color=[255, 255, 255], type='',
swap='kpt-6'),
12:
dict(
name='kpt-12',
id=12,
color=[255, 255, 255],
type='',
swap='kpt-14'),
13:
dict(name='kpt-13', id=13, color=[255, 255, 255], type='', swap=''),
14:
dict(
name='kpt-14',
id=14,
color=[255, 255, 255],
type='',
swap='kpt-12'),
15:
dict(
name='kpt-15',
id=15,
color=[255, 255, 255],
type='',
swap='kpt-17'),
16:
dict(name='kpt-16', id=16, color=[255, 255, 255], type='', swap=''),
17:
dict(
name='kpt-17',
id=17,
color=[255, 255, 255],
type='',
swap='kpt-15'),
18:
dict(name='kpt-18', id=18, color=[255, 255, 255], type='', swap='')
},
skeleton_info={},
joint_weights=[1.] * 19,
sigmas=[])
-140
View File
@@ -1,140 +0,0 @@
dataset_info = dict(
dataset_name='aic',
paper_info=dict(
author='Wu, Jiahong and Zheng, He and Zhao, Bo and '
'Li, Yixin and Yan, Baoming and Liang, Rui and '
'Wang, Wenjia and Zhou, Shipei and Lin, Guosen and '
'Fu, Yanwei and others',
title='Ai challenger: A large-scale dataset for going '
'deeper in image understanding',
container='arXiv',
year='2017',
homepage='https://github.com/AIChallenger/AI_Challenger_2017',
),
keypoint_info={
0:
dict(
name='right_shoulder',
id=0,
color=[255, 128, 0],
type='upper',
swap='left_shoulder'),
1:
dict(
name='right_elbow',
id=1,
color=[255, 128, 0],
type='upper',
swap='left_elbow'),
2:
dict(
name='right_wrist',
id=2,
color=[255, 128, 0],
type='upper',
swap='left_wrist'),
3:
dict(
name='left_shoulder',
id=3,
color=[0, 255, 0],
type='upper',
swap='right_shoulder'),
4:
dict(
name='left_elbow',
id=4,
color=[0, 255, 0],
type='upper',
swap='right_elbow'),
5:
dict(
name='left_wrist',
id=5,
color=[0, 255, 0],
type='upper',
swap='right_wrist'),
6:
dict(
name='right_hip',
id=6,
color=[255, 128, 0],
type='lower',
swap='left_hip'),
7:
dict(
name='right_knee',
id=7,
color=[255, 128, 0],
type='lower',
swap='left_knee'),
8:
dict(
name='right_ankle',
id=8,
color=[255, 128, 0],
type='lower',
swap='left_ankle'),
9:
dict(
name='left_hip',
id=9,
color=[0, 255, 0],
type='lower',
swap='right_hip'),
10:
dict(
name='left_knee',
id=10,
color=[0, 255, 0],
type='lower',
swap='right_knee'),
11:
dict(
name='left_ankle',
id=11,
color=[0, 255, 0],
type='lower',
swap='right_ankle'),
12:
dict(
name='head_top',
id=12,
color=[51, 153, 255],
type='upper',
swap=''),
13:
dict(name='neck', id=13, color=[51, 153, 255], type='upper', swap='')
},
skeleton_info={
0:
dict(link=('right_wrist', 'right_elbow'), id=0, color=[255, 128, 0]),
1: dict(
link=('right_elbow', 'right_shoulder'), id=1, color=[255, 128, 0]),
2: dict(link=('right_shoulder', 'neck'), id=2, color=[51, 153, 255]),
3: dict(link=('neck', 'left_shoulder'), id=3, color=[51, 153, 255]),
4: dict(link=('left_shoulder', 'left_elbow'), id=4, color=[0, 255, 0]),
5: dict(link=('left_elbow', 'left_wrist'), id=5, color=[0, 255, 0]),
6: dict(link=('right_ankle', 'right_knee'), id=6, color=[255, 128, 0]),
7: dict(link=('right_knee', 'right_hip'), id=7, color=[255, 128, 0]),
8: dict(link=('right_hip', 'left_hip'), id=8, color=[51, 153, 255]),
9: dict(link=('left_hip', 'left_knee'), id=9, color=[0, 255, 0]),
10: dict(link=('left_knee', 'left_ankle'), id=10, color=[0, 255, 0]),
11: dict(link=('head_top', 'neck'), id=11, color=[51, 153, 255]),
12: dict(
link=('right_shoulder', 'right_hip'), id=12, color=[51, 153, 255]),
13:
dict(link=('left_shoulder', 'left_hip'), id=13, color=[51, 153, 255])
},
joint_weights=[
1., 1.2, 1.5, 1., 1.2, 1.5, 1., 1.2, 1.5, 1., 1.2, 1.5, 1., 1.
],
# 'https://github.com/AIChallenger/AI_Challenger_2017/blob/master/'
# 'Evaluation/keypoint_eval/keypoint_eval.py#L50'
# delta = 2 x sigma
sigmas=[
0.01388152, 0.01515228, 0.01057665, 0.01417709, 0.01497891, 0.01402144,
0.03909642, 0.03686941, 0.01981803, 0.03843971, 0.03412318, 0.02415081,
0.01291456, 0.01236173
])
-166
View File
@@ -1,166 +0,0 @@
dataset_info = dict(
dataset_name='animalpose',
paper_info=dict(
author='Cao, Jinkun and Tang, Hongyang and Fang, Hao-Shu and '
'Shen, Xiaoyong and Lu, Cewu and Tai, Yu-Wing',
title='Cross-Domain Adaptation for Animal Pose Estimation',
container='The IEEE International Conference on '
'Computer Vision (ICCV)',
year='2019',
homepage='https://sites.google.com/view/animal-pose/',
),
keypoint_info={
0:
dict(
name='L_Eye', id=0, color=[0, 255, 0], type='upper', swap='R_Eye'),
1:
dict(
name='R_Eye',
id=1,
color=[255, 128, 0],
type='upper',
swap='L_Eye'),
2:
dict(
name='L_EarBase',
id=2,
color=[0, 255, 0],
type='upper',
swap='R_EarBase'),
3:
dict(
name='R_EarBase',
id=3,
color=[255, 128, 0],
type='upper',
swap='L_EarBase'),
4:
dict(name='Nose', id=4, color=[51, 153, 255], type='upper', swap=''),
5:
dict(name='Throat', id=5, color=[51, 153, 255], type='upper', swap=''),
6:
dict(
name='TailBase', id=6, color=[51, 153, 255], type='lower',
swap=''),
7:
dict(
name='Withers', id=7, color=[51, 153, 255], type='upper', swap=''),
8:
dict(
name='L_F_Elbow',
id=8,
color=[0, 255, 0],
type='upper',
swap='R_F_Elbow'),
9:
dict(
name='R_F_Elbow',
id=9,
color=[255, 128, 0],
type='upper',
swap='L_F_Elbow'),
10:
dict(
name='L_B_Elbow',
id=10,
color=[0, 255, 0],
type='lower',
swap='R_B_Elbow'),
11:
dict(
name='R_B_Elbow',
id=11,
color=[255, 128, 0],
type='lower',
swap='L_B_Elbow'),
12:
dict(
name='L_F_Knee',
id=12,
color=[0, 255, 0],
type='upper',
swap='R_F_Knee'),
13:
dict(
name='R_F_Knee',
id=13,
color=[255, 128, 0],
type='upper',
swap='L_F_Knee'),
14:
dict(
name='L_B_Knee',
id=14,
color=[0, 255, 0],
type='lower',
swap='R_B_Knee'),
15:
dict(
name='R_B_Knee',
id=15,
color=[255, 128, 0],
type='lower',
swap='L_B_Knee'),
16:
dict(
name='L_F_Paw',
id=16,
color=[0, 255, 0],
type='upper',
swap='R_F_Paw'),
17:
dict(
name='R_F_Paw',
id=17,
color=[255, 128, 0],
type='upper',
swap='L_F_Paw'),
18:
dict(
name='L_B_Paw',
id=18,
color=[0, 255, 0],
type='lower',
swap='R_B_Paw'),
19:
dict(
name='R_B_Paw',
id=19,
color=[255, 128, 0],
type='lower',
swap='L_B_Paw')
},
skeleton_info={
0: dict(link=('L_Eye', 'R_Eye'), id=0, color=[51, 153, 255]),
1: dict(link=('L_Eye', 'L_EarBase'), id=1, color=[0, 255, 0]),
2: dict(link=('R_Eye', 'R_EarBase'), id=2, color=[255, 128, 0]),
3: dict(link=('L_Eye', 'Nose'), id=3, color=[0, 255, 0]),
4: dict(link=('R_Eye', 'Nose'), id=4, color=[255, 128, 0]),
5: dict(link=('Nose', 'Throat'), id=5, color=[51, 153, 255]),
6: dict(link=('Throat', 'Withers'), id=6, color=[51, 153, 255]),
7: dict(link=('TailBase', 'Withers'), id=7, color=[51, 153, 255]),
8: dict(link=('Throat', 'L_F_Elbow'), id=8, color=[0, 255, 0]),
9: dict(link=('L_F_Elbow', 'L_F_Knee'), id=9, color=[0, 255, 0]),
10: dict(link=('L_F_Knee', 'L_F_Paw'), id=10, color=[0, 255, 0]),
11: dict(link=('Throat', 'R_F_Elbow'), id=11, color=[255, 128, 0]),
12: dict(link=('R_F_Elbow', 'R_F_Knee'), id=12, color=[255, 128, 0]),
13: dict(link=('R_F_Knee', 'R_F_Paw'), id=13, color=[255, 128, 0]),
14: dict(link=('TailBase', 'L_B_Elbow'), id=14, color=[0, 255, 0]),
15: dict(link=('L_B_Elbow', 'L_B_Knee'), id=15, color=[0, 255, 0]),
16: dict(link=('L_B_Knee', 'L_B_Paw'), id=16, color=[0, 255, 0]),
17: dict(link=('TailBase', 'R_B_Elbow'), id=17, color=[255, 128, 0]),
18: dict(link=('R_B_Elbow', 'R_B_Knee'), id=18, color=[255, 128, 0]),
19: dict(link=('R_B_Knee', 'R_B_Paw'), id=19, color=[255, 128, 0])
},
joint_weights=[
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.2, 1.2, 1.2, 1.2,
1.5, 1.5, 1.5, 1.5
],
# Note: The original paper did not provide enough information about
# the sigmas. We modified from 'https://github.com/cocodataset/'
# 'cocoapi/blob/master/PythonAPI/pycocotools/cocoeval.py#L523'
sigmas=[
0.025, 0.025, 0.026, 0.035, 0.035, 0.10, 0.10, 0.10, 0.107, 0.107,
0.107, 0.107, 0.087, 0.087, 0.087, 0.087, 0.089, 0.089, 0.089, 0.089
])
-142
View File
@@ -1,142 +0,0 @@
dataset_info = dict(
dataset_name='ap10k',
paper_info=dict(
author='Yu, Hang and Xu, Yufei and Zhang, Jing and '
'Zhao, Wei and Guan, Ziyu and Tao, Dacheng',
title='AP-10K: A Benchmark for Animal Pose Estimation in the Wild',
container='35th Conference on Neural Information Processing Systems '
'(NeurIPS 2021) Track on Datasets and Bench-marks.',
year='2021',
homepage='https://github.com/AlexTheBad/AP-10K',
),
keypoint_info={
0:
dict(
name='L_Eye', id=0, color=[0, 255, 0], type='upper', swap='R_Eye'),
1:
dict(
name='R_Eye',
id=1,
color=[255, 128, 0],
type='upper',
swap='L_Eye'),
2:
dict(name='Nose', id=2, color=[51, 153, 255], type='upper', swap=''),
3:
dict(name='Neck', id=3, color=[51, 153, 255], type='upper', swap=''),
4:
dict(
name='Root of tail',
id=4,
color=[51, 153, 255],
type='lower',
swap=''),
5:
dict(
name='L_Shoulder',
id=5,
color=[51, 153, 255],
type='upper',
swap='R_Shoulder'),
6:
dict(
name='L_Elbow',
id=6,
color=[51, 153, 255],
type='upper',
swap='R_Elbow'),
7:
dict(
name='L_F_Paw',
id=7,
color=[0, 255, 0],
type='upper',
swap='R_F_Paw'),
8:
dict(
name='R_Shoulder',
id=8,
color=[0, 255, 0],
type='upper',
swap='L_Shoulder'),
9:
dict(
name='R_Elbow',
id=9,
color=[255, 128, 0],
type='upper',
swap='L_Elbow'),
10:
dict(
name='R_F_Paw',
id=10,
color=[0, 255, 0],
type='lower',
swap='L_F_Paw'),
11:
dict(
name='L_Hip',
id=11,
color=[255, 128, 0],
type='lower',
swap='R_Hip'),
12:
dict(
name='L_Knee',
id=12,
color=[255, 128, 0],
type='lower',
swap='R_Knee'),
13:
dict(
name='L_B_Paw',
id=13,
color=[0, 255, 0],
type='lower',
swap='R_B_Paw'),
14:
dict(
name='R_Hip', id=14, color=[0, 255, 0], type='lower',
swap='L_Hip'),
15:
dict(
name='R_Knee',
id=15,
color=[0, 255, 0],
type='lower',
swap='L_Knee'),
16:
dict(
name='R_B_Paw',
id=16,
color=[0, 255, 0],
type='lower',
swap='L_B_Paw'),
},
skeleton_info={
0: dict(link=('L_Eye', 'R_Eye'), id=0, color=[0, 0, 255]),
1: dict(link=('L_Eye', 'Nose'), id=1, color=[0, 0, 255]),
2: dict(link=('R_Eye', 'Nose'), id=2, color=[0, 0, 255]),
3: dict(link=('Nose', 'Neck'), id=3, color=[0, 255, 0]),
4: dict(link=('Neck', 'Root of tail'), id=4, color=[0, 255, 0]),
5: dict(link=('Neck', 'L_Shoulder'), id=5, color=[0, 255, 255]),
6: dict(link=('L_Shoulder', 'L_Elbow'), id=6, color=[0, 255, 255]),
7: dict(link=('L_Elbow', 'L_F_Paw'), id=6, color=[0, 255, 255]),
8: dict(link=('Neck', 'R_Shoulder'), id=7, color=[6, 156, 250]),
9: dict(link=('R_Shoulder', 'R_Elbow'), id=8, color=[6, 156, 250]),
10: dict(link=('R_Elbow', 'R_F_Paw'), id=9, color=[6, 156, 250]),
11: dict(link=('Root of tail', 'L_Hip'), id=10, color=[0, 255, 255]),
12: dict(link=('L_Hip', 'L_Knee'), id=11, color=[0, 255, 255]),
13: dict(link=('L_Knee', 'L_B_Paw'), id=12, color=[0, 255, 255]),
14: dict(link=('Root of tail', 'R_Hip'), id=13, color=[6, 156, 250]),
15: dict(link=('R_Hip', 'R_Knee'), id=14, color=[6, 156, 250]),
16: dict(link=('R_Knee', 'R_B_Paw'), id=15, color=[6, 156, 250]),
},
joint_weights=[
1., 1., 1., 1., 1., 1., 1., 1.2, 1.2, 1.5, 1.5, 1., 1., 1.2, 1.2, 1.5,
1.5
],
sigmas=[
0.025, 0.025, 0.026, 0.035, 0.035, 0.079, 0.072, 0.062, 0.079, 0.072,
0.062, 0.107, 0.087, 0.089, 0.107, 0.087, 0.089
])
-144
View File
@@ -1,144 +0,0 @@
dataset_info = dict(
dataset_name='atrw',
paper_info=dict(
author='Li, Shuyuan and Li, Jianguo and Tang, Hanlin '
'and Qian, Rui and Lin, Weiyao',
title='ATRW: A Benchmark for Amur Tiger '
'Re-identification in the Wild',
container='Proceedings of the 28th ACM '
'International Conference on Multimedia',
year='2020',
homepage='https://cvwc2019.github.io/challenge.html',
),
keypoint_info={
0:
dict(
name='left_ear',
id=0,
color=[51, 153, 255],
type='upper',
swap='right_ear'),
1:
dict(
name='right_ear',
id=1,
color=[51, 153, 255],
type='upper',
swap='left_ear'),
2:
dict(name='nose', id=2, color=[51, 153, 255], type='upper', swap=''),
3:
dict(
name='right_shoulder',
id=3,
color=[255, 128, 0],
type='upper',
swap='left_shoulder'),
4:
dict(
name='right_front_paw',
id=4,
color=[255, 128, 0],
type='upper',
swap='left_front_paw'),
5:
dict(
name='left_shoulder',
id=5,
color=[0, 255, 0],
type='upper',
swap='right_shoulder'),
6:
dict(
name='left_front_paw',
id=6,
color=[0, 255, 0],
type='upper',
swap='right_front_paw'),
7:
dict(
name='right_hip',
id=7,
color=[255, 128, 0],
type='lower',
swap='left_hip'),
8:
dict(
name='right_knee',
id=8,
color=[255, 128, 0],
type='lower',
swap='left_knee'),
9:
dict(
name='right_back_paw',
id=9,
color=[255, 128, 0],
type='lower',
swap='left_back_paw'),
10:
dict(
name='left_hip',
id=10,
color=[0, 255, 0],
type='lower',
swap='right_hip'),
11:
dict(
name='left_knee',
id=11,
color=[0, 255, 0],
type='lower',
swap='right_knee'),
12:
dict(
name='left_back_paw',
id=12,
color=[0, 255, 0],
type='lower',
swap='right_back_paw'),
13:
dict(name='tail', id=13, color=[51, 153, 255], type='lower', swap=''),
14:
dict(
name='center', id=14, color=[51, 153, 255], type='lower', swap=''),
},
skeleton_info={
0:
dict(link=('left_ear', 'nose'), id=0, color=[51, 153, 255]),
1:
dict(link=('right_ear', 'nose'), id=1, color=[51, 153, 255]),
2:
dict(link=('nose', 'center'), id=2, color=[51, 153, 255]),
3:
dict(
link=('left_shoulder', 'left_front_paw'), id=3, color=[0, 255, 0]),
4:
dict(link=('left_shoulder', 'center'), id=4, color=[0, 255, 0]),
5:
dict(
link=('right_shoulder', 'right_front_paw'),
id=5,
color=[255, 128, 0]),
6:
dict(link=('right_shoulder', 'center'), id=6, color=[255, 128, 0]),
7:
dict(link=('tail', 'center'), id=7, color=[51, 153, 255]),
8:
dict(link=('right_back_paw', 'right_knee'), id=8, color=[255, 128, 0]),
9:
dict(link=('right_knee', 'right_hip'), id=9, color=[255, 128, 0]),
10:
dict(link=('right_hip', 'tail'), id=10, color=[255, 128, 0]),
11:
dict(link=('left_back_paw', 'left_knee'), id=11, color=[0, 255, 0]),
12:
dict(link=('left_knee', 'left_hip'), id=12, color=[0, 255, 0]),
13:
dict(link=('left_hip', 'tail'), id=13, color=[0, 255, 0]),
},
joint_weights=[1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
sigmas=[
0.0277, 0.0823, 0.0831, 0.0202, 0.0716, 0.0263, 0.0646, 0.0302, 0.0440,
0.0316, 0.0333, 0.0547, 0.0263, 0.0683, 0.0539
])
-151
View File
@@ -1,151 +0,0 @@
dataset_info = dict(
dataset_name='campus',
paper_info=dict(
author='Belagiannis, Vasileios and Amin, Sikandar and Andriluka, '
'Mykhaylo and Schiele, Bernt and Navab, Nassir and Ilic, Slobodan',
title='3D Pictorial Structures for Multiple Human Pose Estimation',
container='IEEE Computer Society Conference on Computer Vision and '
'Pattern Recognition (CVPR)',
year='2014',
homepage='http://campar.in.tum.de/Chair/MultiHumanPose',
),
keypoint_info={
0:
dict(
name='right_ankle',
id=0,
color=[255, 128, 0],
type='lower',
swap='left_ankle'),
1:
dict(
name='right_knee',
id=1,
color=[255, 128, 0],
type='lower',
swap='left_knee'),
2:
dict(
name='right_hip',
id=2,
color=[255, 128, 0],
type='lower',
swap='left_hip'),
3:
dict(
name='left_hip',
id=3,
color=[0, 255, 0],
type='lower',
swap='right_hip'),
4:
dict(
name='left_knee',
id=4,
color=[0, 255, 0],
type='lower',
swap='right_knee'),
5:
dict(
name='left_ankle',
id=5,
color=[0, 255, 0],
type='lower',
swap='right_ankle'),
6:
dict(
name='right_wrist',
id=6,
color=[255, 128, 0],
type='upper',
swap='left_wrist'),
7:
dict(
name='right_elbow',
id=7,
color=[255, 128, 0],
type='upper',
swap='left_elbow'),
8:
dict(
name='right_shoulder',
id=8,
color=[255, 128, 0],
type='upper',
swap='left_shoulder'),
9:
dict(
name='left_shoulder',
id=9,
color=[0, 255, 0],
type='upper',
swap='right_shoulder'),
10:
dict(
name='left_elbow',
id=10,
color=[0, 255, 0],
type='upper',
swap='right_elbow'),
11:
dict(
name='left_wrist',
id=11,
color=[0, 255, 0],
type='upper',
swap='right_wrist'),
12:
dict(
name='bottom_head',
id=12,
color=[51, 153, 255],
type='upper',
swap=''),
13:
dict(
name='top_head',
id=13,
color=[51, 153, 255],
type='upper',
swap=''),
},
skeleton_info={
0:
dict(link=('right_ankle', 'right_knee'), id=0, color=[255, 128, 0]),
1:
dict(link=('right_knee', 'right_hip'), id=1, color=[255, 128, 0]),
2:
dict(link=('left_hip', 'left_knee'), id=2, color=[0, 255, 0]),
3:
dict(link=('left_knee', 'left_ankle'), id=3, color=[0, 255, 0]),
4:
dict(link=('right_hip', 'left_hip'), id=4, color=[51, 153, 255]),
5:
dict(link=('right_wrist', 'right_elbow'), id=5, color=[255, 128, 0]),
6:
dict(
link=('right_elbow', 'right_shoulder'), id=6, color=[255, 128, 0]),
7:
dict(link=('left_shoulder', 'left_elbow'), id=7, color=[0, 255, 0]),
8:
dict(link=('left_elbow', 'left_wrist'), id=8, color=[0, 255, 0]),
9:
dict(link=('right_hip', 'right_shoulder'), id=9, color=[255, 128, 0]),
10:
dict(link=('left_hip', 'left_shoulder'), id=10, color=[0, 255, 0]),
11:
dict(
link=('right_shoulder', 'bottom_head'), id=11, color=[255, 128,
0]),
12:
dict(link=('left_shoulder', 'bottom_head'), id=12, color=[0, 255, 0]),
13:
dict(link=('bottom_head', 'top_head'), id=13, color=[51, 153, 255]),
},
joint_weights=[
1.5, 1.2, 1.0, 1.0, 1.2, 1.5, 1.5, 1.2, 1.0, 1.0, 1.2, 1.5, 1.0, 1.0
],
sigmas=[
0.089, 0.087, 0.107, 0.107, 0.087, 0.089, 0.062, 0.072, 0.079, 0.079,
0.072, 0.062, 0.026, 0.026
])
-181
View File
@@ -1,181 +0,0 @@
dataset_info = dict(
dataset_name='coco',
paper_info=dict(
author='Lin, Tsung-Yi and Maire, Michael and '
'Belongie, Serge and Hays, James and '
'Perona, Pietro and Ramanan, Deva and '
r'Doll{\'a}r, Piotr and Zitnick, C Lawrence',
title='Microsoft coco: Common objects in context',
container='European conference on computer vision',
year='2014',
homepage='http://cocodataset.org/',
),
keypoint_info={
0:
dict(name='nose', id=0, color=[51, 153, 255], type='upper', swap=''),
1:
dict(
name='left_eye',
id=1,
color=[51, 153, 255],
type='upper',
swap='right_eye'),
2:
dict(
name='right_eye',
id=2,
color=[51, 153, 255],
type='upper',
swap='left_eye'),
3:
dict(
name='left_ear',
id=3,
color=[51, 153, 255],
type='upper',
swap='right_ear'),
4:
dict(
name='right_ear',
id=4,
color=[51, 153, 255],
type='upper',
swap='left_ear'),
5:
dict(
name='left_shoulder',
id=5,
color=[0, 255, 0],
type='upper',
swap='right_shoulder'),
6:
dict(
name='right_shoulder',
id=6,
color=[255, 128, 0],
type='upper',
swap='left_shoulder'),
7:
dict(
name='left_elbow',
id=7,
color=[0, 255, 0],
type='upper',
swap='right_elbow'),
8:
dict(
name='right_elbow',
id=8,
color=[255, 128, 0],
type='upper',
swap='left_elbow'),
9:
dict(
name='left_wrist',
id=9,
color=[0, 255, 0],
type='upper',
swap='right_wrist'),
10:
dict(
name='right_wrist',
id=10,
color=[255, 128, 0],
type='upper',
swap='left_wrist'),
11:
dict(
name='left_hip',
id=11,
color=[0, 255, 0],
type='lower',
swap='right_hip'),
12:
dict(
name='right_hip',
id=12,
color=[255, 128, 0],
type='lower',
swap='left_hip'),
13:
dict(
name='left_knee',
id=13,
color=[0, 255, 0],
type='lower',
swap='right_knee'),
14:
dict(
name='right_knee',
id=14,
color=[255, 128, 0],
type='lower',
swap='left_knee'),
15:
dict(
name='left_ankle',
id=15,
color=[0, 255, 0],
type='lower',
swap='right_ankle'),
16:
dict(
name='right_ankle',
id=16,
color=[255, 128, 0],
type='lower',
swap='left_ankle')
},
skeleton_info={
0:
dict(link=('left_ankle', 'left_knee'), id=0, color=[0, 255, 0]),
1:
dict(link=('left_knee', 'left_hip'), id=1, color=[0, 255, 0]),
2:
dict(link=('right_ankle', 'right_knee'), id=2, color=[255, 128, 0]),
3:
dict(link=('right_knee', 'right_hip'), id=3, color=[255, 128, 0]),
4:
dict(link=('left_hip', 'right_hip'), id=4, color=[51, 153, 255]),
5:
dict(link=('left_shoulder', 'left_hip'), id=5, color=[51, 153, 255]),
6:
dict(link=('right_shoulder', 'right_hip'), id=6, color=[51, 153, 255]),
7:
dict(
link=('left_shoulder', 'right_shoulder'),
id=7,
color=[51, 153, 255]),
8:
dict(link=('left_shoulder', 'left_elbow'), id=8, color=[0, 255, 0]),
9:
dict(
link=('right_shoulder', 'right_elbow'), id=9, color=[255, 128, 0]),
10:
dict(link=('left_elbow', 'left_wrist'), id=10, color=[0, 255, 0]),
11:
dict(link=('right_elbow', 'right_wrist'), id=11, color=[255, 128, 0]),
12:
dict(link=('left_eye', 'right_eye'), id=12, color=[51, 153, 255]),
13:
dict(link=('nose', 'left_eye'), id=13, color=[51, 153, 255]),
14:
dict(link=('nose', 'right_eye'), id=14, color=[51, 153, 255]),
15:
dict(link=('left_eye', 'left_ear'), id=15, color=[51, 153, 255]),
16:
dict(link=('right_eye', 'right_ear'), id=16, color=[51, 153, 255]),
17:
dict(link=('left_ear', 'left_shoulder'), id=17, color=[51, 153, 255]),
18:
dict(
link=('right_ear', 'right_shoulder'), id=18, color=[51, 153, 255])
},
joint_weights=[
1., 1., 1., 1., 1., 1., 1., 1.2, 1.2, 1.5, 1.5, 1., 1., 1.2, 1.2, 1.5,
1.5
],
sigmas=[
0.026, 0.025, 0.025, 0.035, 0.035, 0.079, 0.079, 0.072, 0.072, 0.062,
0.062, 0.107, 0.107, 0.087, 0.087, 0.089, 0.089
])
File diff suppressed because it is too large Load Diff
@@ -1,448 +0,0 @@
dataset_info = dict(
dataset_name='coco_wholebody_face',
paper_info=dict(
author='Jin, Sheng and Xu, Lumin and Xu, Jin and '
'Wang, Can and Liu, Wentao and '
'Qian, Chen and Ouyang, Wanli and Luo, Ping',
title='Whole-Body Human Pose Estimation in the Wild',
container='Proceedings of the European '
'Conference on Computer Vision (ECCV)',
year='2020',
homepage='https://github.com/jin-s13/COCO-WholeBody/',
),
keypoint_info={
0:
dict(
name='face-0',
id=0,
color=[255, 255, 255],
type='',
swap='face-16'),
1:
dict(
name='face-1',
id=1,
color=[255, 255, 255],
type='',
swap='face-15'),
2:
dict(
name='face-2',
id=2,
color=[255, 255, 255],
type='',
swap='face-14'),
3:
dict(
name='face-3',
id=3,
color=[255, 255, 255],
type='',
swap='face-13'),
4:
dict(
name='face-4',
id=4,
color=[255, 255, 255],
type='',
swap='face-12'),
5:
dict(
name='face-5',
id=5,
color=[255, 255, 255],
type='',
swap='face-11'),
6:
dict(
name='face-6',
id=6,
color=[255, 255, 255],
type='',
swap='face-10'),
7:
dict(
name='face-7', id=7, color=[255, 255, 255], type='',
swap='face-9'),
8:
dict(name='face-8', id=8, color=[255, 255, 255], type='', swap=''),
9:
dict(
name='face-9', id=9, color=[255, 255, 255], type='',
swap='face-7'),
10:
dict(
name='face-10',
id=10,
color=[255, 255, 255],
type='',
swap='face-6'),
11:
dict(
name='face-11',
id=11,
color=[255, 255, 255],
type='',
swap='face-5'),
12:
dict(
name='face-12',
id=12,
color=[255, 255, 255],
type='',
swap='face-4'),
13:
dict(
name='face-13',
id=13,
color=[255, 255, 255],
type='',
swap='face-3'),
14:
dict(
name='face-14',
id=14,
color=[255, 255, 255],
type='',
swap='face-2'),
15:
dict(
name='face-15',
id=15,
color=[255, 255, 255],
type='',
swap='face-1'),
16:
dict(
name='face-16',
id=16,
color=[255, 255, 255],
type='',
swap='face-0'),
17:
dict(
name='face-17',
id=17,
color=[255, 255, 255],
type='',
swap='face-26'),
18:
dict(
name='face-18',
id=18,
color=[255, 255, 255],
type='',
swap='face-25'),
19:
dict(
name='face-19',
id=19,
color=[255, 255, 255],
type='',
swap='face-24'),
20:
dict(
name='face-20',
id=20,
color=[255, 255, 255],
type='',
swap='face-23'),
21:
dict(
name='face-21',
id=21,
color=[255, 255, 255],
type='',
swap='face-22'),
22:
dict(
name='face-22',
id=22,
color=[255, 255, 255],
type='',
swap='face-21'),
23:
dict(
name='face-23',
id=23,
color=[255, 255, 255],
type='',
swap='face-20'),
24:
dict(
name='face-24',
id=24,
color=[255, 255, 255],
type='',
swap='face-19'),
25:
dict(
name='face-25',
id=25,
color=[255, 255, 255],
type='',
swap='face-18'),
26:
dict(
name='face-26',
id=26,
color=[255, 255, 255],
type='',
swap='face-17'),
27:
dict(name='face-27', id=27, color=[255, 255, 255], type='', swap=''),
28:
dict(name='face-28', id=28, color=[255, 255, 255], type='', swap=''),
29:
dict(name='face-29', id=29, color=[255, 255, 255], type='', swap=''),
30:
dict(name='face-30', id=30, color=[255, 255, 255], type='', swap=''),
31:
dict(
name='face-31',
id=31,
color=[255, 255, 255],
type='',
swap='face-35'),
32:
dict(
name='face-32',
id=32,
color=[255, 255, 255],
type='',
swap='face-34'),
33:
dict(name='face-33', id=33, color=[255, 255, 255], type='', swap=''),
34:
dict(
name='face-34',
id=34,
color=[255, 255, 255],
type='',
swap='face-32'),
35:
dict(
name='face-35',
id=35,
color=[255, 255, 255],
type='',
swap='face-31'),
36:
dict(
name='face-36',
id=36,
color=[255, 255, 255],
type='',
swap='face-45'),
37:
dict(
name='face-37',
id=37,
color=[255, 255, 255],
type='',
swap='face-44'),
38:
dict(
name='face-38',
id=38,
color=[255, 255, 255],
type='',
swap='face-43'),
39:
dict(
name='face-39',
id=39,
color=[255, 255, 255],
type='',
swap='face-42'),
40:
dict(
name='face-40',
id=40,
color=[255, 255, 255],
type='',
swap='face-47'),
41:
dict(
name='face-41',
id=41,
color=[255, 255, 255],
type='',
swap='face-46'),
42:
dict(
name='face-42',
id=42,
color=[255, 255, 255],
type='',
swap='face-39'),
43:
dict(
name='face-43',
id=43,
color=[255, 255, 255],
type='',
swap='face-38'),
44:
dict(
name='face-44',
id=44,
color=[255, 255, 255],
type='',
swap='face-37'),
45:
dict(
name='face-45',
id=45,
color=[255, 255, 255],
type='',
swap='face-36'),
46:
dict(
name='face-46',
id=46,
color=[255, 255, 255],
type='',
swap='face-41'),
47:
dict(
name='face-47',
id=47,
color=[255, 255, 255],
type='',
swap='face-40'),
48:
dict(
name='face-48',
id=48,
color=[255, 255, 255],
type='',
swap='face-54'),
49:
dict(
name='face-49',
id=49,
color=[255, 255, 255],
type='',
swap='face-53'),
50:
dict(
name='face-50',
id=50,
color=[255, 255, 255],
type='',
swap='face-52'),
51:
dict(name='face-51', id=52, color=[255, 255, 255], type='', swap=''),
52:
dict(
name='face-52',
id=52,
color=[255, 255, 255],
type='',
swap='face-50'),
53:
dict(
name='face-53',
id=53,
color=[255, 255, 255],
type='',
swap='face-49'),
54:
dict(
name='face-54',
id=54,
color=[255, 255, 255],
type='',
swap='face-48'),
55:
dict(
name='face-55',
id=55,
color=[255, 255, 255],
type='',
swap='face-59'),
56:
dict(
name='face-56',
id=56,
color=[255, 255, 255],
type='',
swap='face-58'),
57:
dict(name='face-57', id=57, color=[255, 255, 255], type='', swap=''),
58:
dict(
name='face-58',
id=58,
color=[255, 255, 255],
type='',
swap='face-56'),
59:
dict(
name='face-59',
id=59,
color=[255, 255, 255],
type='',
swap='face-55'),
60:
dict(
name='face-60',
id=60,
color=[255, 255, 255],
type='',
swap='face-64'),
61:
dict(
name='face-61',
id=61,
color=[255, 255, 255],
type='',
swap='face-63'),
62:
dict(name='face-62', id=62, color=[255, 255, 255], type='', swap=''),
63:
dict(
name='face-63',
id=63,
color=[255, 255, 255],
type='',
swap='face-61'),
64:
dict(
name='face-64',
id=64,
color=[255, 255, 255],
type='',
swap='face-60'),
65:
dict(
name='face-65',
id=65,
color=[255, 255, 255],
type='',
swap='face-67'),
66:
dict(name='face-66', id=66, color=[255, 255, 255], type='', swap=''),
67:
dict(
name='face-67',
id=67,
color=[255, 255, 255],
type='',
swap='face-65')
},
skeleton_info={},
joint_weights=[1.] * 68,
# 'https://github.com/jin-s13/COCO-WholeBody/blob/master/'
# 'evaluation/myeval_wholebody.py#L177'
sigmas=[
0.042, 0.043, 0.044, 0.043, 0.040, 0.035, 0.031, 0.025, 0.020, 0.023,
0.029, 0.032, 0.037, 0.038, 0.043, 0.041, 0.045, 0.013, 0.012, 0.011,
0.011, 0.012, 0.012, 0.011, 0.011, 0.013, 0.015, 0.009, 0.007, 0.007,
0.007, 0.012, 0.009, 0.008, 0.016, 0.010, 0.017, 0.011, 0.009, 0.011,
0.009, 0.007, 0.013, 0.008, 0.011, 0.012, 0.010, 0.034, 0.008, 0.008,
0.009, 0.008, 0.008, 0.007, 0.010, 0.008, 0.009, 0.009, 0.009, 0.007,
0.007, 0.008, 0.011, 0.008, 0.008, 0.008, 0.01, 0.008
])
@@ -1,147 +0,0 @@
dataset_info = dict(
dataset_name='coco_wholebody_hand',
paper_info=dict(
author='Jin, Sheng and Xu, Lumin and Xu, Jin and '
'Wang, Can and Liu, Wentao and '
'Qian, Chen and Ouyang, Wanli and Luo, Ping',
title='Whole-Body Human Pose Estimation in the Wild',
container='Proceedings of the European '
'Conference on Computer Vision (ECCV)',
year='2020',
homepage='https://github.com/jin-s13/COCO-WholeBody/',
),
keypoint_info={
0:
dict(name='wrist', id=0, color=[255, 255, 255], type='', swap=''),
1:
dict(name='thumb1', id=1, color=[255, 128, 0], type='', swap=''),
2:
dict(name='thumb2', id=2, color=[255, 128, 0], type='', swap=''),
3:
dict(name='thumb3', id=3, color=[255, 128, 0], type='', swap=''),
4:
dict(name='thumb4', id=4, color=[255, 128, 0], type='', swap=''),
5:
dict(
name='forefinger1', id=5, color=[255, 153, 255], type='', swap=''),
6:
dict(
name='forefinger2', id=6, color=[255, 153, 255], type='', swap=''),
7:
dict(
name='forefinger3', id=7, color=[255, 153, 255], type='', swap=''),
8:
dict(
name='forefinger4', id=8, color=[255, 153, 255], type='', swap=''),
9:
dict(
name='middle_finger1',
id=9,
color=[102, 178, 255],
type='',
swap=''),
10:
dict(
name='middle_finger2',
id=10,
color=[102, 178, 255],
type='',
swap=''),
11:
dict(
name='middle_finger3',
id=11,
color=[102, 178, 255],
type='',
swap=''),
12:
dict(
name='middle_finger4',
id=12,
color=[102, 178, 255],
type='',
swap=''),
13:
dict(
name='ring_finger1', id=13, color=[255, 51, 51], type='', swap=''),
14:
dict(
name='ring_finger2', id=14, color=[255, 51, 51], type='', swap=''),
15:
dict(
name='ring_finger3', id=15, color=[255, 51, 51], type='', swap=''),
16:
dict(
name='ring_finger4', id=16, color=[255, 51, 51], type='', swap=''),
17:
dict(name='pinky_finger1', id=17, color=[0, 255, 0], type='', swap=''),
18:
dict(name='pinky_finger2', id=18, color=[0, 255, 0], type='', swap=''),
19:
dict(name='pinky_finger3', id=19, color=[0, 255, 0], type='', swap=''),
20:
dict(name='pinky_finger4', id=20, color=[0, 255, 0], type='', swap='')
},
skeleton_info={
0:
dict(link=('wrist', 'thumb1'), id=0, color=[255, 128, 0]),
1:
dict(link=('thumb1', 'thumb2'), id=1, color=[255, 128, 0]),
2:
dict(link=('thumb2', 'thumb3'), id=2, color=[255, 128, 0]),
3:
dict(link=('thumb3', 'thumb4'), id=3, color=[255, 128, 0]),
4:
dict(link=('wrist', 'forefinger1'), id=4, color=[255, 153, 255]),
5:
dict(link=('forefinger1', 'forefinger2'), id=5, color=[255, 153, 255]),
6:
dict(link=('forefinger2', 'forefinger3'), id=6, color=[255, 153, 255]),
7:
dict(link=('forefinger3', 'forefinger4'), id=7, color=[255, 153, 255]),
8:
dict(link=('wrist', 'middle_finger1'), id=8, color=[102, 178, 255]),
9:
dict(
link=('middle_finger1', 'middle_finger2'),
id=9,
color=[102, 178, 255]),
10:
dict(
link=('middle_finger2', 'middle_finger3'),
id=10,
color=[102, 178, 255]),
11:
dict(
link=('middle_finger3', 'middle_finger4'),
id=11,
color=[102, 178, 255]),
12:
dict(link=('wrist', 'ring_finger1'), id=12, color=[255, 51, 51]),
13:
dict(
link=('ring_finger1', 'ring_finger2'), id=13, color=[255, 51, 51]),
14:
dict(
link=('ring_finger2', 'ring_finger3'), id=14, color=[255, 51, 51]),
15:
dict(
link=('ring_finger3', 'ring_finger4'), id=15, color=[255, 51, 51]),
16:
dict(link=('wrist', 'pinky_finger1'), id=16, color=[0, 255, 0]),
17:
dict(
link=('pinky_finger1', 'pinky_finger2'), id=17, color=[0, 255, 0]),
18:
dict(
link=('pinky_finger2', 'pinky_finger3'), id=18, color=[0, 255, 0]),
19:
dict(
link=('pinky_finger3', 'pinky_finger4'), id=19, color=[0, 255, 0])
},
joint_weights=[1.] * 21,
sigmas=[
0.029, 0.022, 0.035, 0.037, 0.047, 0.026, 0.025, 0.024, 0.035, 0.018,
0.024, 0.022, 0.026, 0.017, 0.021, 0.021, 0.032, 0.02, 0.019, 0.022,
0.031
])
-134
View File
@@ -1,134 +0,0 @@
dataset_info = dict(
dataset_name='cofw',
paper_info=dict(
author='Burgos-Artizzu, Xavier P and Perona, '
r'Pietro and Doll{\'a}r, Piotr',
title='Robust face landmark estimation under occlusion',
container='Proceedings of the IEEE international '
'conference on computer vision',
year='2013',
homepage='http://www.vision.caltech.edu/xpburgos/ICCV13/',
),
keypoint_info={
0:
dict(name='kpt-0', id=0, color=[255, 255, 255], type='', swap='kpt-1'),
1:
dict(name='kpt-1', id=1, color=[255, 255, 255], type='', swap='kpt-0'),
2:
dict(name='kpt-2', id=2, color=[255, 255, 255], type='', swap='kpt-3'),
3:
dict(name='kpt-3', id=3, color=[255, 255, 255], type='', swap='kpt-2'),
4:
dict(name='kpt-4', id=4, color=[255, 255, 255], type='', swap='kpt-6'),
5:
dict(name='kpt-5', id=5, color=[255, 255, 255], type='', swap='kpt-7'),
6:
dict(name='kpt-6', id=6, color=[255, 255, 255], type='', swap='kpt-4'),
7:
dict(name='kpt-7', id=7, color=[255, 255, 255], type='', swap='kpt-5'),
8:
dict(name='kpt-8', id=8, color=[255, 255, 255], type='', swap='kpt-9'),
9:
dict(name='kpt-9', id=9, color=[255, 255, 255], type='', swap='kpt-8'),
10:
dict(
name='kpt-10',
id=10,
color=[255, 255, 255],
type='',
swap='kpt-11'),
11:
dict(
name='kpt-11',
id=11,
color=[255, 255, 255],
type='',
swap='kpt-10'),
12:
dict(
name='kpt-12',
id=12,
color=[255, 255, 255],
type='',
swap='kpt-14'),
13:
dict(
name='kpt-13',
id=13,
color=[255, 255, 255],
type='',
swap='kpt-15'),
14:
dict(
name='kpt-14',
id=14,
color=[255, 255, 255],
type='',
swap='kpt-12'),
15:
dict(
name='kpt-15',
id=15,
color=[255, 255, 255],
type='',
swap='kpt-13'),
16:
dict(
name='kpt-16',
id=16,
color=[255, 255, 255],
type='',
swap='kpt-17'),
17:
dict(
name='kpt-17',
id=17,
color=[255, 255, 255],
type='',
swap='kpt-16'),
18:
dict(
name='kpt-18',
id=18,
color=[255, 255, 255],
type='',
swap='kpt-19'),
19:
dict(
name='kpt-19',
id=19,
color=[255, 255, 255],
type='',
swap='kpt-18'),
20:
dict(name='kpt-20', id=20, color=[255, 255, 255], type='', swap=''),
21:
dict(name='kpt-21', id=21, color=[255, 255, 255], type='', swap=''),
22:
dict(
name='kpt-22',
id=22,
color=[255, 255, 255],
type='',
swap='kpt-23'),
23:
dict(
name='kpt-23',
id=23,
color=[255, 255, 255],
type='',
swap='kpt-22'),
24:
dict(name='kpt-24', id=24, color=[255, 255, 255], type='', swap=''),
25:
dict(name='kpt-25', id=25, color=[255, 255, 255], type='', swap=''),
26:
dict(name='kpt-26', id=26, color=[255, 255, 255], type='', swap=''),
27:
dict(name='kpt-27', id=27, color=[255, 255, 255], type='', swap=''),
28:
dict(name='kpt-28', id=28, color=[255, 255, 255], type='', swap='')
},
skeleton_info={},
joint_weights=[1.] * 29,
sigmas=[])
-147
View File
@@ -1,147 +0,0 @@
dataset_info = dict(
dataset_name='crowdpose',
paper_info=dict(
author='Li, Jiefeng and Wang, Can and Zhu, Hao and '
'Mao, Yihuan and Fang, Hao-Shu and Lu, Cewu',
title='CrowdPose: Efficient Crowded Scenes Pose Estimation '
'and A New Benchmark',
container='Proceedings of IEEE Conference on Computer '
'Vision and Pattern Recognition (CVPR)',
year='2019',
homepage='https://github.com/Jeff-sjtu/CrowdPose',
),
keypoint_info={
0:
dict(
name='left_shoulder',
id=0,
color=[51, 153, 255],
type='upper',
swap='right_shoulder'),
1:
dict(
name='right_shoulder',
id=1,
color=[51, 153, 255],
type='upper',
swap='left_shoulder'),
2:
dict(
name='left_elbow',
id=2,
color=[51, 153, 255],
type='upper',
swap='right_elbow'),
3:
dict(
name='right_elbow',
id=3,
color=[51, 153, 255],
type='upper',
swap='left_elbow'),
4:
dict(
name='left_wrist',
id=4,
color=[51, 153, 255],
type='upper',
swap='right_wrist'),
5:
dict(
name='right_wrist',
id=5,
color=[0, 255, 0],
type='upper',
swap='left_wrist'),
6:
dict(
name='left_hip',
id=6,
color=[255, 128, 0],
type='lower',
swap='right_hip'),
7:
dict(
name='right_hip',
id=7,
color=[0, 255, 0],
type='lower',
swap='left_hip'),
8:
dict(
name='left_knee',
id=8,
color=[255, 128, 0],
type='lower',
swap='right_knee'),
9:
dict(
name='right_knee',
id=9,
color=[0, 255, 0],
type='lower',
swap='left_knee'),
10:
dict(
name='left_ankle',
id=10,
color=[255, 128, 0],
type='lower',
swap='right_ankle'),
11:
dict(
name='right_ankle',
id=11,
color=[0, 255, 0],
type='lower',
swap='left_ankle'),
12:
dict(
name='top_head', id=12, color=[255, 128, 0], type='upper',
swap=''),
13:
dict(name='neck', id=13, color=[0, 255, 0], type='upper', swap='')
},
skeleton_info={
0:
dict(link=('left_ankle', 'left_knee'), id=0, color=[0, 255, 0]),
1:
dict(link=('left_knee', 'left_hip'), id=1, color=[0, 255, 0]),
2:
dict(link=('right_ankle', 'right_knee'), id=2, color=[255, 128, 0]),
3:
dict(link=('right_knee', 'right_hip'), id=3, color=[255, 128, 0]),
4:
dict(link=('left_hip', 'right_hip'), id=4, color=[51, 153, 255]),
5:
dict(link=('left_shoulder', 'left_hip'), id=5, color=[51, 153, 255]),
6:
dict(link=('right_shoulder', 'right_hip'), id=6, color=[51, 153, 255]),
7:
dict(
link=('left_shoulder', 'right_shoulder'),
id=7,
color=[51, 153, 255]),
8:
dict(link=('left_shoulder', 'left_elbow'), id=8, color=[0, 255, 0]),
9:
dict(
link=('right_shoulder', 'right_elbow'), id=9, color=[255, 128, 0]),
10:
dict(link=('left_elbow', 'left_wrist'), id=10, color=[0, 255, 0]),
11:
dict(link=('right_elbow', 'right_wrist'), id=11, color=[255, 128, 0]),
12:
dict(link=('top_head', 'neck'), id=12, color=[51, 153, 255]),
13:
dict(link=('right_shoulder', 'neck'), id=13, color=[51, 153, 255]),
14:
dict(link=('left_shoulder', 'neck'), id=14, color=[51, 153, 255])
},
joint_weights=[
0.2, 0.2, 0.2, 1.3, 1.5, 0.2, 1.3, 1.5, 0.2, 0.2, 0.5, 0.2, 0.2, 0.5
],
sigmas=[
0.079, 0.079, 0.072, 0.072, 0.062, 0.062, 0.107, 0.107, 0.087, 0.087,
0.089, 0.089, 0.079, 0.079
])
@@ -1,74 +0,0 @@
dataset_info = dict(
dataset_name='deepfashion_full',
paper_info=dict(
author='Liu, Ziwei and Luo, Ping and Qiu, Shi '
'and Wang, Xiaogang and Tang, Xiaoou',
title='DeepFashion: Powering Robust Clothes Recognition '
'and Retrieval with Rich Annotations',
container='Proceedings of IEEE Conference on Computer '
'Vision and Pattern Recognition (CVPR)',
year='2016',
homepage='http://mmlab.ie.cuhk.edu.hk/projects/'
'DeepFashion/LandmarkDetection.html',
),
keypoint_info={
0:
dict(
name='left collar',
id=0,
color=[255, 255, 255],
type='',
swap='right collar'),
1:
dict(
name='right collar',
id=1,
color=[255, 255, 255],
type='',
swap='left collar'),
2:
dict(
name='left sleeve',
id=2,
color=[255, 255, 255],
type='',
swap='right sleeve'),
3:
dict(
name='right sleeve',
id=3,
color=[255, 255, 255],
type='',
swap='left sleeve'),
4:
dict(
name='left waistline',
id=0,
color=[255, 255, 255],
type='',
swap='right waistline'),
5:
dict(
name='right waistline',
id=1,
color=[255, 255, 255],
type='',
swap='left waistline'),
6:
dict(
name='left hem',
id=2,
color=[255, 255, 255],
type='',
swap='right hem'),
7:
dict(
name='right hem',
id=3,
color=[255, 255, 255],
type='',
swap='left hem'),
},
skeleton_info={},
joint_weights=[1.] * 8,
sigmas=[])
@@ -1,46 +0,0 @@
dataset_info = dict(
dataset_name='deepfashion_lower',
paper_info=dict(
author='Liu, Ziwei and Luo, Ping and Qiu, Shi '
'and Wang, Xiaogang and Tang, Xiaoou',
title='DeepFashion: Powering Robust Clothes Recognition '
'and Retrieval with Rich Annotations',
container='Proceedings of IEEE Conference on Computer '
'Vision and Pattern Recognition (CVPR)',
year='2016',
homepage='http://mmlab.ie.cuhk.edu.hk/projects/'
'DeepFashion/LandmarkDetection.html',
),
keypoint_info={
0:
dict(
name='left waistline',
id=0,
color=[255, 255, 255],
type='',
swap='right waistline'),
1:
dict(
name='right waistline',
id=1,
color=[255, 255, 255],
type='',
swap='left waistline'),
2:
dict(
name='left hem',
id=2,
color=[255, 255, 255],
type='',
swap='right hem'),
3:
dict(
name='right hem',
id=3,
color=[255, 255, 255],
type='',
swap='left hem'),
},
skeleton_info={},
joint_weights=[1.] * 4,
sigmas=[])
@@ -1,60 +0,0 @@
dataset_info = dict(
dataset_name='deepfashion_upper',
paper_info=dict(
author='Liu, Ziwei and Luo, Ping and Qiu, Shi '
'and Wang, Xiaogang and Tang, Xiaoou',
title='DeepFashion: Powering Robust Clothes Recognition '
'and Retrieval with Rich Annotations',
container='Proceedings of IEEE Conference on Computer '
'Vision and Pattern Recognition (CVPR)',
year='2016',
homepage='http://mmlab.ie.cuhk.edu.hk/projects/'
'DeepFashion/LandmarkDetection.html',
),
keypoint_info={
0:
dict(
name='left collar',
id=0,
color=[255, 255, 255],
type='',
swap='right collar'),
1:
dict(
name='right collar',
id=1,
color=[255, 255, 255],
type='',
swap='left collar'),
2:
dict(
name='left sleeve',
id=2,
color=[255, 255, 255],
type='',
swap='right sleeve'),
3:
dict(
name='right sleeve',
id=3,
color=[255, 255, 255],
type='',
swap='left sleeve'),
4:
dict(
name='left hem',
id=4,
color=[255, 255, 255],
type='',
swap='right hem'),
5:
dict(
name='right hem',
id=5,
color=[255, 255, 255],
type='',
swap='left hem'),
},
skeleton_info={},
joint_weights=[1.] * 6,
sigmas=[])
-237
View File
@@ -1,237 +0,0 @@
dataset_info = dict(
dataset_name='fly',
paper_info=dict(
author='Pereira, Talmo D and Aldarondo, Diego E and '
'Willmore, Lindsay and Kislin, Mikhail and '
'Wang, Samuel S-H and Murthy, Mala and Shaevitz, Joshua W',
title='Fast animal pose estimation using deep neural networks',
container='Nature methods',
year='2019',
homepage='https://github.com/jgraving/DeepPoseKit-Data',
),
keypoint_info={
0:
dict(name='head', id=0, color=[255, 255, 255], type='', swap=''),
1:
dict(name='eyeL', id=1, color=[255, 255, 255], type='', swap='eyeR'),
2:
dict(name='eyeR', id=2, color=[255, 255, 255], type='', swap='eyeL'),
3:
dict(name='neck', id=3, color=[255, 255, 255], type='', swap=''),
4:
dict(name='thorax', id=4, color=[255, 255, 255], type='', swap=''),
5:
dict(name='abdomen', id=5, color=[255, 255, 255], type='', swap=''),
6:
dict(
name='forelegR1',
id=6,
color=[255, 255, 255],
type='',
swap='forelegL1'),
7:
dict(
name='forelegR2',
id=7,
color=[255, 255, 255],
type='',
swap='forelegL2'),
8:
dict(
name='forelegR3',
id=8,
color=[255, 255, 255],
type='',
swap='forelegL3'),
9:
dict(
name='forelegR4',
id=9,
color=[255, 255, 255],
type='',
swap='forelegL4'),
10:
dict(
name='midlegR1',
id=10,
color=[255, 255, 255],
type='',
swap='midlegL1'),
11:
dict(
name='midlegR2',
id=11,
color=[255, 255, 255],
type='',
swap='midlegL2'),
12:
dict(
name='midlegR3',
id=12,
color=[255, 255, 255],
type='',
swap='midlegL3'),
13:
dict(
name='midlegR4',
id=13,
color=[255, 255, 255],
type='',
swap='midlegL4'),
14:
dict(
name='hindlegR1',
id=14,
color=[255, 255, 255],
type='',
swap='hindlegL1'),
15:
dict(
name='hindlegR2',
id=15,
color=[255, 255, 255],
type='',
swap='hindlegL2'),
16:
dict(
name='hindlegR3',
id=16,
color=[255, 255, 255],
type='',
swap='hindlegL3'),
17:
dict(
name='hindlegR4',
id=17,
color=[255, 255, 255],
type='',
swap='hindlegL4'),
18:
dict(
name='forelegL1',
id=18,
color=[255, 255, 255],
type='',
swap='forelegR1'),
19:
dict(
name='forelegL2',
id=19,
color=[255, 255, 255],
type='',
swap='forelegR2'),
20:
dict(
name='forelegL3',
id=20,
color=[255, 255, 255],
type='',
swap='forelegR3'),
21:
dict(
name='forelegL4',
id=21,
color=[255, 255, 255],
type='',
swap='forelegR4'),
22:
dict(
name='midlegL1',
id=22,
color=[255, 255, 255],
type='',
swap='midlegR1'),
23:
dict(
name='midlegL2',
id=23,
color=[255, 255, 255],
type='',
swap='midlegR2'),
24:
dict(
name='midlegL3',
id=24,
color=[255, 255, 255],
type='',
swap='midlegR3'),
25:
dict(
name='midlegL4',
id=25,
color=[255, 255, 255],
type='',
swap='midlegR4'),
26:
dict(
name='hindlegL1',
id=26,
color=[255, 255, 255],
type='',
swap='hindlegR1'),
27:
dict(
name='hindlegL2',
id=27,
color=[255, 255, 255],
type='',
swap='hindlegR2'),
28:
dict(
name='hindlegL3',
id=28,
color=[255, 255, 255],
type='',
swap='hindlegR3'),
29:
dict(
name='hindlegL4',
id=29,
color=[255, 255, 255],
type='',
swap='hindlegR4'),
30:
dict(
name='wingL', id=30, color=[255, 255, 255], type='', swap='wingR'),
31:
dict(
name='wingR', id=31, color=[255, 255, 255], type='', swap='wingL'),
},
skeleton_info={
0: dict(link=('eyeL', 'head'), id=0, color=[255, 255, 255]),
1: dict(link=('eyeR', 'head'), id=1, color=[255, 255, 255]),
2: dict(link=('neck', 'head'), id=2, color=[255, 255, 255]),
3: dict(link=('thorax', 'neck'), id=3, color=[255, 255, 255]),
4: dict(link=('abdomen', 'thorax'), id=4, color=[255, 255, 255]),
5: dict(link=('forelegR2', 'forelegR1'), id=5, color=[255, 255, 255]),
6: dict(link=('forelegR3', 'forelegR2'), id=6, color=[255, 255, 255]),
7: dict(link=('forelegR4', 'forelegR3'), id=7, color=[255, 255, 255]),
8: dict(link=('midlegR2', 'midlegR1'), id=8, color=[255, 255, 255]),
9: dict(link=('midlegR3', 'midlegR2'), id=9, color=[255, 255, 255]),
10: dict(link=('midlegR4', 'midlegR3'), id=10, color=[255, 255, 255]),
11:
dict(link=('hindlegR2', 'hindlegR1'), id=11, color=[255, 255, 255]),
12:
dict(link=('hindlegR3', 'hindlegR2'), id=12, color=[255, 255, 255]),
13:
dict(link=('hindlegR4', 'hindlegR3'), id=13, color=[255, 255, 255]),
14:
dict(link=('forelegL2', 'forelegL1'), id=14, color=[255, 255, 255]),
15:
dict(link=('forelegL3', 'forelegL2'), id=15, color=[255, 255, 255]),
16:
dict(link=('forelegL4', 'forelegL3'), id=16, color=[255, 255, 255]),
17: dict(link=('midlegL2', 'midlegL1'), id=17, color=[255, 255, 255]),
18: dict(link=('midlegL3', 'midlegL2'), id=18, color=[255, 255, 255]),
19: dict(link=('midlegL4', 'midlegL3'), id=19, color=[255, 255, 255]),
20:
dict(link=('hindlegL2', 'hindlegL1'), id=20, color=[255, 255, 255]),
21:
dict(link=('hindlegL3', 'hindlegL2'), id=21, color=[255, 255, 255]),
22:
dict(link=('hindlegL4', 'hindlegL3'), id=22, color=[255, 255, 255]),
23: dict(link=('wingL', 'neck'), id=23, color=[255, 255, 255]),
24: dict(link=('wingR', 'neck'), id=24, color=[255, 255, 255])
},
joint_weights=[1.] * 32,
sigmas=[])
-144
View File
@@ -1,144 +0,0 @@
dataset_info = dict(
dataset_name='freihand',
paper_info=dict(
author='Zimmermann, Christian and Ceylan, Duygu and '
'Yang, Jimei and Russell, Bryan and '
'Argus, Max and Brox, Thomas',
title='Freihand: A dataset for markerless capture of hand pose '
'and shape from single rgb images',
container='Proceedings of the IEEE International '
'Conference on Computer Vision',
year='2019',
homepage='https://lmb.informatik.uni-freiburg.de/projects/freihand/',
),
keypoint_info={
0:
dict(name='wrist', id=0, color=[255, 255, 255], type='', swap=''),
1:
dict(name='thumb1', id=1, color=[255, 128, 0], type='', swap=''),
2:
dict(name='thumb2', id=2, color=[255, 128, 0], type='', swap=''),
3:
dict(name='thumb3', id=3, color=[255, 128, 0], type='', swap=''),
4:
dict(name='thumb4', id=4, color=[255, 128, 0], type='', swap=''),
5:
dict(
name='forefinger1', id=5, color=[255, 153, 255], type='', swap=''),
6:
dict(
name='forefinger2', id=6, color=[255, 153, 255], type='', swap=''),
7:
dict(
name='forefinger3', id=7, color=[255, 153, 255], type='', swap=''),
8:
dict(
name='forefinger4', id=8, color=[255, 153, 255], type='', swap=''),
9:
dict(
name='middle_finger1',
id=9,
color=[102, 178, 255],
type='',
swap=''),
10:
dict(
name='middle_finger2',
id=10,
color=[102, 178, 255],
type='',
swap=''),
11:
dict(
name='middle_finger3',
id=11,
color=[102, 178, 255],
type='',
swap=''),
12:
dict(
name='middle_finger4',
id=12,
color=[102, 178, 255],
type='',
swap=''),
13:
dict(
name='ring_finger1', id=13, color=[255, 51, 51], type='', swap=''),
14:
dict(
name='ring_finger2', id=14, color=[255, 51, 51], type='', swap=''),
15:
dict(
name='ring_finger3', id=15, color=[255, 51, 51], type='', swap=''),
16:
dict(
name='ring_finger4', id=16, color=[255, 51, 51], type='', swap=''),
17:
dict(name='pinky_finger1', id=17, color=[0, 255, 0], type='', swap=''),
18:
dict(name='pinky_finger2', id=18, color=[0, 255, 0], type='', swap=''),
19:
dict(name='pinky_finger3', id=19, color=[0, 255, 0], type='', swap=''),
20:
dict(name='pinky_finger4', id=20, color=[0, 255, 0], type='', swap='')
},
skeleton_info={
0:
dict(link=('wrist', 'thumb1'), id=0, color=[255, 128, 0]),
1:
dict(link=('thumb1', 'thumb2'), id=1, color=[255, 128, 0]),
2:
dict(link=('thumb2', 'thumb3'), id=2, color=[255, 128, 0]),
3:
dict(link=('thumb3', 'thumb4'), id=3, color=[255, 128, 0]),
4:
dict(link=('wrist', 'forefinger1'), id=4, color=[255, 153, 255]),
5:
dict(link=('forefinger1', 'forefinger2'), id=5, color=[255, 153, 255]),
6:
dict(link=('forefinger2', 'forefinger3'), id=6, color=[255, 153, 255]),
7:
dict(link=('forefinger3', 'forefinger4'), id=7, color=[255, 153, 255]),
8:
dict(link=('wrist', 'middle_finger1'), id=8, color=[102, 178, 255]),
9:
dict(
link=('middle_finger1', 'middle_finger2'),
id=9,
color=[102, 178, 255]),
10:
dict(
link=('middle_finger2', 'middle_finger3'),
id=10,
color=[102, 178, 255]),
11:
dict(
link=('middle_finger3', 'middle_finger4'),
id=11,
color=[102, 178, 255]),
12:
dict(link=('wrist', 'ring_finger1'), id=12, color=[255, 51, 51]),
13:
dict(
link=('ring_finger1', 'ring_finger2'), id=13, color=[255, 51, 51]),
14:
dict(
link=('ring_finger2', 'ring_finger3'), id=14, color=[255, 51, 51]),
15:
dict(
link=('ring_finger3', 'ring_finger4'), id=15, color=[255, 51, 51]),
16:
dict(link=('wrist', 'pinky_finger1'), id=16, color=[0, 255, 0]),
17:
dict(
link=('pinky_finger1', 'pinky_finger2'), id=17, color=[0, 255, 0]),
18:
dict(
link=('pinky_finger2', 'pinky_finger3'), id=18, color=[0, 255, 0]),
19:
dict(
link=('pinky_finger3', 'pinky_finger4'), id=19, color=[0, 255, 0])
},
joint_weights=[1.] * 21,
sigmas=[])
-152
View File
@@ -1,152 +0,0 @@
dataset_info = dict(
dataset_name='h36m',
paper_info=dict(
author='Ionescu, Catalin and Papava, Dragos and '
'Olaru, Vlad and Sminchisescu, Cristian',
title='Human3.6M: Large Scale Datasets and Predictive '
'Methods for 3D Human Sensing in Natural Environments',
container='IEEE Transactions on Pattern Analysis and '
'Machine Intelligence',
year='2014',
homepage='http://vision.imar.ro/human3.6m/description.php',
),
keypoint_info={
0:
dict(name='root', id=0, color=[51, 153, 255], type='lower', swap=''),
1:
dict(
name='right_hip',
id=1,
color=[255, 128, 0],
type='lower',
swap='left_hip'),
2:
dict(
name='right_knee',
id=2,
color=[255, 128, 0],
type='lower',
swap='left_knee'),
3:
dict(
name='right_foot',
id=3,
color=[255, 128, 0],
type='lower',
swap='left_foot'),
4:
dict(
name='left_hip',
id=4,
color=[0, 255, 0],
type='lower',
swap='right_hip'),
5:
dict(
name='left_knee',
id=5,
color=[0, 255, 0],
type='lower',
swap='right_knee'),
6:
dict(
name='left_foot',
id=6,
color=[0, 255, 0],
type='lower',
swap='right_foot'),
7:
dict(name='spine', id=7, color=[51, 153, 255], type='upper', swap=''),
8:
dict(name='thorax', id=8, color=[51, 153, 255], type='upper', swap=''),
9:
dict(
name='neck_base',
id=9,
color=[51, 153, 255],
type='upper',
swap=''),
10:
dict(name='head', id=10, color=[51, 153, 255], type='upper', swap=''),
11:
dict(
name='left_shoulder',
id=11,
color=[0, 255, 0],
type='upper',
swap='right_shoulder'),
12:
dict(
name='left_elbow',
id=12,
color=[0, 255, 0],
type='upper',
swap='right_elbow'),
13:
dict(
name='left_wrist',
id=13,
color=[0, 255, 0],
type='upper',
swap='right_wrist'),
14:
dict(
name='right_shoulder',
id=14,
color=[255, 128, 0],
type='upper',
swap='left_shoulder'),
15:
dict(
name='right_elbow',
id=15,
color=[255, 128, 0],
type='upper',
swap='left_elbow'),
16:
dict(
name='right_wrist',
id=16,
color=[255, 128, 0],
type='upper',
swap='left_wrist')
},
skeleton_info={
0:
dict(link=('root', 'left_hip'), id=0, color=[0, 255, 0]),
1:
dict(link=('left_hip', 'left_knee'), id=1, color=[0, 255, 0]),
2:
dict(link=('left_knee', 'left_foot'), id=2, color=[0, 255, 0]),
3:
dict(link=('root', 'right_hip'), id=3, color=[255, 128, 0]),
4:
dict(link=('right_hip', 'right_knee'), id=4, color=[255, 128, 0]),
5:
dict(link=('right_knee', 'right_foot'), id=5, color=[255, 128, 0]),
6:
dict(link=('root', 'spine'), id=6, color=[51, 153, 255]),
7:
dict(link=('spine', 'thorax'), id=7, color=[51, 153, 255]),
8:
dict(link=('thorax', 'neck_base'), id=8, color=[51, 153, 255]),
9:
dict(link=('neck_base', 'head'), id=9, color=[51, 153, 255]),
10:
dict(link=('thorax', 'left_shoulder'), id=10, color=[0, 255, 0]),
11:
dict(link=('left_shoulder', 'left_elbow'), id=11, color=[0, 255, 0]),
12:
dict(link=('left_elbow', 'left_wrist'), id=12, color=[0, 255, 0]),
13:
dict(link=('thorax', 'right_shoulder'), id=13, color=[255, 128, 0]),
14:
dict(
link=('right_shoulder', 'right_elbow'), id=14, color=[255, 128,
0]),
15:
dict(link=('right_elbow', 'right_wrist'), id=15, color=[255, 128, 0])
},
joint_weights=[1.] * 17,
sigmas=[],
stats_info=dict(bbox_center=(528., 427.), bbox_scale=400.))
File diff suppressed because it is too large Load Diff
-201
View File
@@ -1,201 +0,0 @@
dataset_info = dict(
dataset_name='horse10',
paper_info=dict(
author='Mathis, Alexander and Biasi, Thomas and '
'Schneider, Steffen and '
'Yuksekgonul, Mert and Rogers, Byron and '
'Bethge, Matthias and '
'Mathis, Mackenzie W',
title='Pretraining boosts out-of-domain robustness '
'for pose estimation',
container='Proceedings of the IEEE/CVF Winter Conference on '
'Applications of Computer Vision',
year='2021',
homepage='http://www.mackenziemathislab.org/horse10',
),
keypoint_info={
0:
dict(name='Nose', id=0, color=[255, 153, 255], type='upper', swap=''),
1:
dict(name='Eye', id=1, color=[255, 153, 255], type='upper', swap=''),
2:
dict(
name='Nearknee',
id=2,
color=[255, 102, 255],
type='upper',
swap=''),
3:
dict(
name='Nearfrontfetlock',
id=3,
color=[255, 102, 255],
type='upper',
swap=''),
4:
dict(
name='Nearfrontfoot',
id=4,
color=[255, 102, 255],
type='upper',
swap=''),
5:
dict(
name='Offknee', id=5, color=[255, 102, 255], type='upper',
swap=''),
6:
dict(
name='Offfrontfetlock',
id=6,
color=[255, 102, 255],
type='upper',
swap=''),
7:
dict(
name='Offfrontfoot',
id=7,
color=[255, 102, 255],
type='upper',
swap=''),
8:
dict(
name='Shoulder',
id=8,
color=[255, 153, 255],
type='upper',
swap=''),
9:
dict(
name='Midshoulder',
id=9,
color=[255, 153, 255],
type='upper',
swap=''),
10:
dict(
name='Elbow', id=10, color=[255, 153, 255], type='upper', swap=''),
11:
dict(
name='Girth', id=11, color=[255, 153, 255], type='upper', swap=''),
12:
dict(
name='Wither', id=12, color=[255, 153, 255], type='upper',
swap=''),
13:
dict(
name='Nearhindhock',
id=13,
color=[255, 51, 255],
type='lower',
swap=''),
14:
dict(
name='Nearhindfetlock',
id=14,
color=[255, 51, 255],
type='lower',
swap=''),
15:
dict(
name='Nearhindfoot',
id=15,
color=[255, 51, 255],
type='lower',
swap=''),
16:
dict(name='Hip', id=16, color=[255, 153, 255], type='lower', swap=''),
17:
dict(
name='Stifle', id=17, color=[255, 153, 255], type='lower',
swap=''),
18:
dict(
name='Offhindhock',
id=18,
color=[255, 51, 255],
type='lower',
swap=''),
19:
dict(
name='Offhindfetlock',
id=19,
color=[255, 51, 255],
type='lower',
swap=''),
20:
dict(
name='Offhindfoot',
id=20,
color=[255, 51, 255],
type='lower',
swap=''),
21:
dict(
name='Ischium',
id=21,
color=[255, 153, 255],
type='lower',
swap='')
},
skeleton_info={
0:
dict(link=('Nose', 'Eye'), id=0, color=[255, 153, 255]),
1:
dict(link=('Eye', 'Wither'), id=1, color=[255, 153, 255]),
2:
dict(link=('Wither', 'Hip'), id=2, color=[255, 153, 255]),
3:
dict(link=('Hip', 'Ischium'), id=3, color=[255, 153, 255]),
4:
dict(link=('Ischium', 'Stifle'), id=4, color=[255, 153, 255]),
5:
dict(link=('Stifle', 'Girth'), id=5, color=[255, 153, 255]),
6:
dict(link=('Girth', 'Elbow'), id=6, color=[255, 153, 255]),
7:
dict(link=('Elbow', 'Shoulder'), id=7, color=[255, 153, 255]),
8:
dict(link=('Shoulder', 'Midshoulder'), id=8, color=[255, 153, 255]),
9:
dict(link=('Midshoulder', 'Wither'), id=9, color=[255, 153, 255]),
10:
dict(
link=('Nearknee', 'Nearfrontfetlock'),
id=10,
color=[255, 102, 255]),
11:
dict(
link=('Nearfrontfetlock', 'Nearfrontfoot'),
id=11,
color=[255, 102, 255]),
12:
dict(
link=('Offknee', 'Offfrontfetlock'), id=12, color=[255, 102, 255]),
13:
dict(
link=('Offfrontfetlock', 'Offfrontfoot'),
id=13,
color=[255, 102, 255]),
14:
dict(
link=('Nearhindhock', 'Nearhindfetlock'),
id=14,
color=[255, 51, 255]),
15:
dict(
link=('Nearhindfetlock', 'Nearhindfoot'),
id=15,
color=[255, 51, 255]),
16:
dict(
link=('Offhindhock', 'Offhindfetlock'),
id=16,
color=[255, 51, 255]),
17:
dict(
link=('Offhindfetlock', 'Offhindfoot'),
id=17,
color=[255, 51, 255])
},
joint_weights=[1.] * 22,
sigmas=[])
@@ -1,142 +0,0 @@
dataset_info = dict(
dataset_name='interhand2d',
paper_info=dict(
author='Moon, Gyeongsik and Yu, Shoou-I and Wen, He and '
'Shiratori, Takaaki and Lee, Kyoung Mu',
title='InterHand2.6M: A dataset and baseline for 3D '
'interacting hand pose estimation from a single RGB image',
container='arXiv',
year='2020',
homepage='https://mks0601.github.io/InterHand2.6M/',
),
keypoint_info={
0:
dict(name='thumb4', id=0, color=[255, 128, 0], type='', swap=''),
1:
dict(name='thumb3', id=1, color=[255, 128, 0], type='', swap=''),
2:
dict(name='thumb2', id=2, color=[255, 128, 0], type='', swap=''),
3:
dict(name='thumb1', id=3, color=[255, 128, 0], type='', swap=''),
4:
dict(
name='forefinger4', id=4, color=[255, 153, 255], type='', swap=''),
5:
dict(
name='forefinger3', id=5, color=[255, 153, 255], type='', swap=''),
6:
dict(
name='forefinger2', id=6, color=[255, 153, 255], type='', swap=''),
7:
dict(
name='forefinger1', id=7, color=[255, 153, 255], type='', swap=''),
8:
dict(
name='middle_finger4',
id=8,
color=[102, 178, 255],
type='',
swap=''),
9:
dict(
name='middle_finger3',
id=9,
color=[102, 178, 255],
type='',
swap=''),
10:
dict(
name='middle_finger2',
id=10,
color=[102, 178, 255],
type='',
swap=''),
11:
dict(
name='middle_finger1',
id=11,
color=[102, 178, 255],
type='',
swap=''),
12:
dict(
name='ring_finger4', id=12, color=[255, 51, 51], type='', swap=''),
13:
dict(
name='ring_finger3', id=13, color=[255, 51, 51], type='', swap=''),
14:
dict(
name='ring_finger2', id=14, color=[255, 51, 51], type='', swap=''),
15:
dict(
name='ring_finger1', id=15, color=[255, 51, 51], type='', swap=''),
16:
dict(name='pinky_finger4', id=16, color=[0, 255, 0], type='', swap=''),
17:
dict(name='pinky_finger3', id=17, color=[0, 255, 0], type='', swap=''),
18:
dict(name='pinky_finger2', id=18, color=[0, 255, 0], type='', swap=''),
19:
dict(name='pinky_finger1', id=19, color=[0, 255, 0], type='', swap=''),
20:
dict(name='wrist', id=20, color=[255, 255, 255], type='', swap='')
},
skeleton_info={
0:
dict(link=('wrist', 'thumb1'), id=0, color=[255, 128, 0]),
1:
dict(link=('thumb1', 'thumb2'), id=1, color=[255, 128, 0]),
2:
dict(link=('thumb2', 'thumb3'), id=2, color=[255, 128, 0]),
3:
dict(link=('thumb3', 'thumb4'), id=3, color=[255, 128, 0]),
4:
dict(link=('wrist', 'forefinger1'), id=4, color=[255, 153, 255]),
5:
dict(link=('forefinger1', 'forefinger2'), id=5, color=[255, 153, 255]),
6:
dict(link=('forefinger2', 'forefinger3'), id=6, color=[255, 153, 255]),
7:
dict(link=('forefinger3', 'forefinger4'), id=7, color=[255, 153, 255]),
8:
dict(link=('wrist', 'middle_finger1'), id=8, color=[102, 178, 255]),
9:
dict(
link=('middle_finger1', 'middle_finger2'),
id=9,
color=[102, 178, 255]),
10:
dict(
link=('middle_finger2', 'middle_finger3'),
id=10,
color=[102, 178, 255]),
11:
dict(
link=('middle_finger3', 'middle_finger4'),
id=11,
color=[102, 178, 255]),
12:
dict(link=('wrist', 'ring_finger1'), id=12, color=[255, 51, 51]),
13:
dict(
link=('ring_finger1', 'ring_finger2'), id=13, color=[255, 51, 51]),
14:
dict(
link=('ring_finger2', 'ring_finger3'), id=14, color=[255, 51, 51]),
15:
dict(
link=('ring_finger3', 'ring_finger4'), id=15, color=[255, 51, 51]),
16:
dict(link=('wrist', 'pinky_finger1'), id=16, color=[0, 255, 0]),
17:
dict(
link=('pinky_finger1', 'pinky_finger2'), id=17, color=[0, 255, 0]),
18:
dict(
link=('pinky_finger2', 'pinky_finger3'), id=18, color=[0, 255, 0]),
19:
dict(
link=('pinky_finger3', 'pinky_finger4'), id=19, color=[0, 255, 0])
},
joint_weights=[1.] * 21,
sigmas=[])
@@ -1,487 +0,0 @@
dataset_info = dict(
dataset_name='interhand3d',
paper_info=dict(
author='Moon, Gyeongsik and Yu, Shoou-I and Wen, He and '
'Shiratori, Takaaki and Lee, Kyoung Mu',
title='InterHand2.6M: A dataset and baseline for 3D '
'interacting hand pose estimation from a single RGB image',
container='arXiv',
year='2020',
homepage='https://mks0601.github.io/InterHand2.6M/',
),
keypoint_info={
0:
dict(
name='right_thumb4',
id=0,
color=[255, 128, 0],
type='',
swap='left_thumb4'),
1:
dict(
name='right_thumb3',
id=1,
color=[255, 128, 0],
type='',
swap='left_thumb3'),
2:
dict(
name='right_thumb2',
id=2,
color=[255, 128, 0],
type='',
swap='left_thumb2'),
3:
dict(
name='right_thumb1',
id=3,
color=[255, 128, 0],
type='',
swap='left_thumb1'),
4:
dict(
name='right_forefinger4',
id=4,
color=[255, 153, 255],
type='',
swap='left_forefinger4'),
5:
dict(
name='right_forefinger3',
id=5,
color=[255, 153, 255],
type='',
swap='left_forefinger3'),
6:
dict(
name='right_forefinger2',
id=6,
color=[255, 153, 255],
type='',
swap='left_forefinger2'),
7:
dict(
name='right_forefinger1',
id=7,
color=[255, 153, 255],
type='',
swap='left_forefinger1'),
8:
dict(
name='right_middle_finger4',
id=8,
color=[102, 178, 255],
type='',
swap='left_middle_finger4'),
9:
dict(
name='right_middle_finger3',
id=9,
color=[102, 178, 255],
type='',
swap='left_middle_finger3'),
10:
dict(
name='right_middle_finger2',
id=10,
color=[102, 178, 255],
type='',
swap='left_middle_finger2'),
11:
dict(
name='right_middle_finger1',
id=11,
color=[102, 178, 255],
type='',
swap='left_middle_finger1'),
12:
dict(
name='right_ring_finger4',
id=12,
color=[255, 51, 51],
type='',
swap='left_ring_finger4'),
13:
dict(
name='right_ring_finger3',
id=13,
color=[255, 51, 51],
type='',
swap='left_ring_finger3'),
14:
dict(
name='right_ring_finger2',
id=14,
color=[255, 51, 51],
type='',
swap='left_ring_finger2'),
15:
dict(
name='right_ring_finger1',
id=15,
color=[255, 51, 51],
type='',
swap='left_ring_finger1'),
16:
dict(
name='right_pinky_finger4',
id=16,
color=[0, 255, 0],
type='',
swap='left_pinky_finger4'),
17:
dict(
name='right_pinky_finger3',
id=17,
color=[0, 255, 0],
type='',
swap='left_pinky_finger3'),
18:
dict(
name='right_pinky_finger2',
id=18,
color=[0, 255, 0],
type='',
swap='left_pinky_finger2'),
19:
dict(
name='right_pinky_finger1',
id=19,
color=[0, 255, 0],
type='',
swap='left_pinky_finger1'),
20:
dict(
name='right_wrist',
id=20,
color=[255, 255, 255],
type='',
swap='left_wrist'),
21:
dict(
name='left_thumb4',
id=21,
color=[255, 128, 0],
type='',
swap='right_thumb4'),
22:
dict(
name='left_thumb3',
id=22,
color=[255, 128, 0],
type='',
swap='right_thumb3'),
23:
dict(
name='left_thumb2',
id=23,
color=[255, 128, 0],
type='',
swap='right_thumb2'),
24:
dict(
name='left_thumb1',
id=24,
color=[255, 128, 0],
type='',
swap='right_thumb1'),
25:
dict(
name='left_forefinger4',
id=25,
color=[255, 153, 255],
type='',
swap='right_forefinger4'),
26:
dict(
name='left_forefinger3',
id=26,
color=[255, 153, 255],
type='',
swap='right_forefinger3'),
27:
dict(
name='left_forefinger2',
id=27,
color=[255, 153, 255],
type='',
swap='right_forefinger2'),
28:
dict(
name='left_forefinger1',
id=28,
color=[255, 153, 255],
type='',
swap='right_forefinger1'),
29:
dict(
name='left_middle_finger4',
id=29,
color=[102, 178, 255],
type='',
swap='right_middle_finger4'),
30:
dict(
name='left_middle_finger3',
id=30,
color=[102, 178, 255],
type='',
swap='right_middle_finger3'),
31:
dict(
name='left_middle_finger2',
id=31,
color=[102, 178, 255],
type='',
swap='right_middle_finger2'),
32:
dict(
name='left_middle_finger1',
id=32,
color=[102, 178, 255],
type='',
swap='right_middle_finger1'),
33:
dict(
name='left_ring_finger4',
id=33,
color=[255, 51, 51],
type='',
swap='right_ring_finger4'),
34:
dict(
name='left_ring_finger3',
id=34,
color=[255, 51, 51],
type='',
swap='right_ring_finger3'),
35:
dict(
name='left_ring_finger2',
id=35,
color=[255, 51, 51],
type='',
swap='right_ring_finger2'),
36:
dict(
name='left_ring_finger1',
id=36,
color=[255, 51, 51],
type='',
swap='right_ring_finger1'),
37:
dict(
name='left_pinky_finger4',
id=37,
color=[0, 255, 0],
type='',
swap='right_pinky_finger4'),
38:
dict(
name='left_pinky_finger3',
id=38,
color=[0, 255, 0],
type='',
swap='right_pinky_finger3'),
39:
dict(
name='left_pinky_finger2',
id=39,
color=[0, 255, 0],
type='',
swap='right_pinky_finger2'),
40:
dict(
name='left_pinky_finger1',
id=40,
color=[0, 255, 0],
type='',
swap='right_pinky_finger1'),
41:
dict(
name='left_wrist',
id=41,
color=[255, 255, 255],
type='',
swap='right_wrist'),
},
skeleton_info={
0:
dict(link=('right_wrist', 'right_thumb1'), id=0, color=[255, 128, 0]),
1:
dict(link=('right_thumb1', 'right_thumb2'), id=1, color=[255, 128, 0]),
2:
dict(link=('right_thumb2', 'right_thumb3'), id=2, color=[255, 128, 0]),
3:
dict(link=('right_thumb3', 'right_thumb4'), id=3, color=[255, 128, 0]),
4:
dict(
link=('right_wrist', 'right_forefinger1'),
id=4,
color=[255, 153, 255]),
5:
dict(
link=('right_forefinger1', 'right_forefinger2'),
id=5,
color=[255, 153, 255]),
6:
dict(
link=('right_forefinger2', 'right_forefinger3'),
id=6,
color=[255, 153, 255]),
7:
dict(
link=('right_forefinger3', 'right_forefinger4'),
id=7,
color=[255, 153, 255]),
8:
dict(
link=('right_wrist', 'right_middle_finger1'),
id=8,
color=[102, 178, 255]),
9:
dict(
link=('right_middle_finger1', 'right_middle_finger2'),
id=9,
color=[102, 178, 255]),
10:
dict(
link=('right_middle_finger2', 'right_middle_finger3'),
id=10,
color=[102, 178, 255]),
11:
dict(
link=('right_middle_finger3', 'right_middle_finger4'),
id=11,
color=[102, 178, 255]),
12:
dict(
link=('right_wrist', 'right_ring_finger1'),
id=12,
color=[255, 51, 51]),
13:
dict(
link=('right_ring_finger1', 'right_ring_finger2'),
id=13,
color=[255, 51, 51]),
14:
dict(
link=('right_ring_finger2', 'right_ring_finger3'),
id=14,
color=[255, 51, 51]),
15:
dict(
link=('right_ring_finger3', 'right_ring_finger4'),
id=15,
color=[255, 51, 51]),
16:
dict(
link=('right_wrist', 'right_pinky_finger1'),
id=16,
color=[0, 255, 0]),
17:
dict(
link=('right_pinky_finger1', 'right_pinky_finger2'),
id=17,
color=[0, 255, 0]),
18:
dict(
link=('right_pinky_finger2', 'right_pinky_finger3'),
id=18,
color=[0, 255, 0]),
19:
dict(
link=('right_pinky_finger3', 'right_pinky_finger4'),
id=19,
color=[0, 255, 0]),
20:
dict(link=('left_wrist', 'left_thumb1'), id=20, color=[255, 128, 0]),
21:
dict(link=('left_thumb1', 'left_thumb2'), id=21, color=[255, 128, 0]),
22:
dict(link=('left_thumb2', 'left_thumb3'), id=22, color=[255, 128, 0]),
23:
dict(link=('left_thumb3', 'left_thumb4'), id=23, color=[255, 128, 0]),
24:
dict(
link=('left_wrist', 'left_forefinger1'),
id=24,
color=[255, 153, 255]),
25:
dict(
link=('left_forefinger1', 'left_forefinger2'),
id=25,
color=[255, 153, 255]),
26:
dict(
link=('left_forefinger2', 'left_forefinger3'),
id=26,
color=[255, 153, 255]),
27:
dict(
link=('left_forefinger3', 'left_forefinger4'),
id=27,
color=[255, 153, 255]),
28:
dict(
link=('left_wrist', 'left_middle_finger1'),
id=28,
color=[102, 178, 255]),
29:
dict(
link=('left_middle_finger1', 'left_middle_finger2'),
id=29,
color=[102, 178, 255]),
30:
dict(
link=('left_middle_finger2', 'left_middle_finger3'),
id=30,
color=[102, 178, 255]),
31:
dict(
link=('left_middle_finger3', 'left_middle_finger4'),
id=31,
color=[102, 178, 255]),
32:
dict(
link=('left_wrist', 'left_ring_finger1'),
id=32,
color=[255, 51, 51]),
33:
dict(
link=('left_ring_finger1', 'left_ring_finger2'),
id=33,
color=[255, 51, 51]),
34:
dict(
link=('left_ring_finger2', 'left_ring_finger3'),
id=34,
color=[255, 51, 51]),
35:
dict(
link=('left_ring_finger3', 'left_ring_finger4'),
id=35,
color=[255, 51, 51]),
36:
dict(
link=('left_wrist', 'left_pinky_finger1'),
id=36,
color=[0, 255, 0]),
37:
dict(
link=('left_pinky_finger1', 'left_pinky_finger2'),
id=37,
color=[0, 255, 0]),
38:
dict(
link=('left_pinky_finger2', 'left_pinky_finger3'),
id=38,
color=[0, 255, 0]),
39:
dict(
link=('left_pinky_finger3', 'left_pinky_finger4'),
id=39,
color=[0, 255, 0]),
},
joint_weights=[1.] * 42,
sigmas=[])
-129
View File
@@ -1,129 +0,0 @@
dataset_info = dict(
dataset_name='jhmdb',
paper_info=dict(
author='H. Jhuang and J. Gall and S. Zuffi and '
'C. Schmid and M. J. Black',
title='Towards understanding action recognition',
container='International Conf. on Computer Vision (ICCV)',
year='2013',
homepage='http://jhmdb.is.tue.mpg.de/dataset',
),
keypoint_info={
0:
dict(name='neck', id=0, color=[255, 128, 0], type='upper', swap=''),
1:
dict(name='belly', id=1, color=[255, 128, 0], type='upper', swap=''),
2:
dict(name='head', id=2, color=[255, 128, 0], type='upper', swap=''),
3:
dict(
name='right_shoulder',
id=3,
color=[0, 255, 0],
type='upper',
swap='left_shoulder'),
4:
dict(
name='left_shoulder',
id=4,
color=[0, 255, 0],
type='upper',
swap='right_shoulder'),
5:
dict(
name='right_hip',
id=5,
color=[0, 255, 0],
type='lower',
swap='left_hip'),
6:
dict(
name='left_hip',
id=6,
color=[51, 153, 255],
type='lower',
swap='right_hip'),
7:
dict(
name='right_elbow',
id=7,
color=[51, 153, 255],
type='upper',
swap='left_elbow'),
8:
dict(
name='left_elbow',
id=8,
color=[51, 153, 255],
type='upper',
swap='right_elbow'),
9:
dict(
name='right_knee',
id=9,
color=[51, 153, 255],
type='lower',
swap='left_knee'),
10:
dict(
name='left_knee',
id=10,
color=[255, 128, 0],
type='lower',
swap='right_knee'),
11:
dict(
name='right_wrist',
id=11,
color=[255, 128, 0],
type='upper',
swap='left_wrist'),
12:
dict(
name='left_wrist',
id=12,
color=[255, 128, 0],
type='upper',
swap='right_wrist'),
13:
dict(
name='right_ankle',
id=13,
color=[0, 255, 0],
type='lower',
swap='left_ankle'),
14:
dict(
name='left_ankle',
id=14,
color=[0, 255, 0],
type='lower',
swap='right_ankle')
},
skeleton_info={
0: dict(link=('right_ankle', 'right_knee'), id=0, color=[255, 128, 0]),
1: dict(link=('right_knee', 'right_hip'), id=1, color=[255, 128, 0]),
2: dict(link=('right_hip', 'belly'), id=2, color=[255, 128, 0]),
3: dict(link=('belly', 'left_hip'), id=3, color=[0, 255, 0]),
4: dict(link=('left_hip', 'left_knee'), id=4, color=[0, 255, 0]),
5: dict(link=('left_knee', 'left_ankle'), id=5, color=[0, 255, 0]),
6: dict(link=('belly', 'neck'), id=6, color=[51, 153, 255]),
7: dict(link=('neck', 'head'), id=7, color=[51, 153, 255]),
8: dict(link=('neck', 'right_shoulder'), id=8, color=[255, 128, 0]),
9: dict(
link=('right_shoulder', 'right_elbow'), id=9, color=[255, 128, 0]),
10:
dict(link=('right_elbow', 'right_wrist'), id=10, color=[255, 128, 0]),
11: dict(link=('neck', 'left_shoulder'), id=11, color=[0, 255, 0]),
12:
dict(link=('left_shoulder', 'left_elbow'), id=12, color=[0, 255, 0]),
13: dict(link=('left_elbow', 'left_wrist'), id=13, color=[0, 255, 0])
},
joint_weights=[
1., 1., 1., 1., 1., 1., 1., 1.2, 1.2, 1.2, 1.2, 1.5, 1.5, 1.5, 1.5
],
# Adapted from COCO dataset.
sigmas=[
0.025, 0.107, 0.025, 0.079, 0.079, 0.107, 0.107, 0.072, 0.072, 0.087,
0.087, 0.062, 0.062, 0.089, 0.089
])
-263
View File
@@ -1,263 +0,0 @@
dataset_info = dict(
dataset_name='locust',
paper_info=dict(
author='Graving, Jacob M and Chae, Daniel and Naik, Hemal and '
'Li, Liang and Koger, Benjamin and Costelloe, Blair R and '
'Couzin, Iain D',
title='DeepPoseKit, a software toolkit for fast and robust '
'animal pose estimation using deep learning',
container='Elife',
year='2019',
homepage='https://github.com/jgraving/DeepPoseKit-Data',
),
keypoint_info={
0:
dict(name='head', id=0, color=[255, 255, 255], type='', swap=''),
1:
dict(name='neck', id=1, color=[255, 255, 255], type='', swap=''),
2:
dict(name='thorax', id=2, color=[255, 255, 255], type='', swap=''),
3:
dict(name='abdomen1', id=3, color=[255, 255, 255], type='', swap=''),
4:
dict(name='abdomen2', id=4, color=[255, 255, 255], type='', swap=''),
5:
dict(
name='anttipL',
id=5,
color=[255, 255, 255],
type='',
swap='anttipR'),
6:
dict(
name='antbaseL',
id=6,
color=[255, 255, 255],
type='',
swap='antbaseR'),
7:
dict(name='eyeL', id=7, color=[255, 255, 255], type='', swap='eyeR'),
8:
dict(
name='forelegL1',
id=8,
color=[255, 255, 255],
type='',
swap='forelegR1'),
9:
dict(
name='forelegL2',
id=9,
color=[255, 255, 255],
type='',
swap='forelegR2'),
10:
dict(
name='forelegL3',
id=10,
color=[255, 255, 255],
type='',
swap='forelegR3'),
11:
dict(
name='forelegL4',
id=11,
color=[255, 255, 255],
type='',
swap='forelegR4'),
12:
dict(
name='midlegL1',
id=12,
color=[255, 255, 255],
type='',
swap='midlegR1'),
13:
dict(
name='midlegL2',
id=13,
color=[255, 255, 255],
type='',
swap='midlegR2'),
14:
dict(
name='midlegL3',
id=14,
color=[255, 255, 255],
type='',
swap='midlegR3'),
15:
dict(
name='midlegL4',
id=15,
color=[255, 255, 255],
type='',
swap='midlegR4'),
16:
dict(
name='hindlegL1',
id=16,
color=[255, 255, 255],
type='',
swap='hindlegR1'),
17:
dict(
name='hindlegL2',
id=17,
color=[255, 255, 255],
type='',
swap='hindlegR2'),
18:
dict(
name='hindlegL3',
id=18,
color=[255, 255, 255],
type='',
swap='hindlegR3'),
19:
dict(
name='hindlegL4',
id=19,
color=[255, 255, 255],
type='',
swap='hindlegR4'),
20:
dict(
name='anttipR',
id=20,
color=[255, 255, 255],
type='',
swap='anttipL'),
21:
dict(
name='antbaseR',
id=21,
color=[255, 255, 255],
type='',
swap='antbaseL'),
22:
dict(name='eyeR', id=22, color=[255, 255, 255], type='', swap='eyeL'),
23:
dict(
name='forelegR1',
id=23,
color=[255, 255, 255],
type='',
swap='forelegL1'),
24:
dict(
name='forelegR2',
id=24,
color=[255, 255, 255],
type='',
swap='forelegL2'),
25:
dict(
name='forelegR3',
id=25,
color=[255, 255, 255],
type='',
swap='forelegL3'),
26:
dict(
name='forelegR4',
id=26,
color=[255, 255, 255],
type='',
swap='forelegL4'),
27:
dict(
name='midlegR1',
id=27,
color=[255, 255, 255],
type='',
swap='midlegL1'),
28:
dict(
name='midlegR2',
id=28,
color=[255, 255, 255],
type='',
swap='midlegL2'),
29:
dict(
name='midlegR3',
id=29,
color=[255, 255, 255],
type='',
swap='midlegL3'),
30:
dict(
name='midlegR4',
id=30,
color=[255, 255, 255],
type='',
swap='midlegL4'),
31:
dict(
name='hindlegR1',
id=31,
color=[255, 255, 255],
type='',
swap='hindlegL1'),
32:
dict(
name='hindlegR2',
id=32,
color=[255, 255, 255],
type='',
swap='hindlegL2'),
33:
dict(
name='hindlegR3',
id=33,
color=[255, 255, 255],
type='',
swap='hindlegL3'),
34:
dict(
name='hindlegR4',
id=34,
color=[255, 255, 255],
type='',
swap='hindlegL4')
},
skeleton_info={
0: dict(link=('neck', 'head'), id=0, color=[255, 255, 255]),
1: dict(link=('thorax', 'neck'), id=1, color=[255, 255, 255]),
2: dict(link=('abdomen1', 'thorax'), id=2, color=[255, 255, 255]),
3: dict(link=('abdomen2', 'abdomen1'), id=3, color=[255, 255, 255]),
4: dict(link=('antbaseL', 'anttipL'), id=4, color=[255, 255, 255]),
5: dict(link=('eyeL', 'antbaseL'), id=5, color=[255, 255, 255]),
6: dict(link=('forelegL2', 'forelegL1'), id=6, color=[255, 255, 255]),
7: dict(link=('forelegL3', 'forelegL2'), id=7, color=[255, 255, 255]),
8: dict(link=('forelegL4', 'forelegL3'), id=8, color=[255, 255, 255]),
9: dict(link=('midlegL2', 'midlegL1'), id=9, color=[255, 255, 255]),
10: dict(link=('midlegL3', 'midlegL2'), id=10, color=[255, 255, 255]),
11: dict(link=('midlegL4', 'midlegL3'), id=11, color=[255, 255, 255]),
12:
dict(link=('hindlegL2', 'hindlegL1'), id=12, color=[255, 255, 255]),
13:
dict(link=('hindlegL3', 'hindlegL2'), id=13, color=[255, 255, 255]),
14:
dict(link=('hindlegL4', 'hindlegL3'), id=14, color=[255, 255, 255]),
15: dict(link=('antbaseR', 'anttipR'), id=15, color=[255, 255, 255]),
16: dict(link=('eyeR', 'antbaseR'), id=16, color=[255, 255, 255]),
17:
dict(link=('forelegR2', 'forelegR1'), id=17, color=[255, 255, 255]),
18:
dict(link=('forelegR3', 'forelegR2'), id=18, color=[255, 255, 255]),
19:
dict(link=('forelegR4', 'forelegR3'), id=19, color=[255, 255, 255]),
20: dict(link=('midlegR2', 'midlegR1'), id=20, color=[255, 255, 255]),
21: dict(link=('midlegR3', 'midlegR2'), id=21, color=[255, 255, 255]),
22: dict(link=('midlegR4', 'midlegR3'), id=22, color=[255, 255, 255]),
23:
dict(link=('hindlegR2', 'hindlegR1'), id=23, color=[255, 255, 255]),
24:
dict(link=('hindlegR3', 'hindlegR2'), id=24, color=[255, 255, 255]),
25:
dict(link=('hindlegR4', 'hindlegR3'), id=25, color=[255, 255, 255])
},
joint_weights=[1.] * 35,
sigmas=[])
-183
View File
@@ -1,183 +0,0 @@
dataset_info = dict(
dataset_name='macaque',
paper_info=dict(
author='Labuguen, Rollyn and Matsumoto, Jumpei and '
'Negrete, Salvador and Nishimaru, Hiroshi and '
'Nishijo, Hisao and Takada, Masahiko and '
'Go, Yasuhiro and Inoue, Ken-ichi and Shibata, Tomohiro',
title='MacaquePose: A novel "in the wild" macaque monkey pose dataset '
'for markerless motion capture',
container='bioRxiv',
year='2020',
homepage='http://www.pri.kyoto-u.ac.jp/datasets/'
'macaquepose/index.html',
),
keypoint_info={
0:
dict(name='nose', id=0, color=[51, 153, 255], type='upper', swap=''),
1:
dict(
name='left_eye',
id=1,
color=[51, 153, 255],
type='upper',
swap='right_eye'),
2:
dict(
name='right_eye',
id=2,
color=[51, 153, 255],
type='upper',
swap='left_eye'),
3:
dict(
name='left_ear',
id=3,
color=[51, 153, 255],
type='upper',
swap='right_ear'),
4:
dict(
name='right_ear',
id=4,
color=[51, 153, 255],
type='upper',
swap='left_ear'),
5:
dict(
name='left_shoulder',
id=5,
color=[0, 255, 0],
type='upper',
swap='right_shoulder'),
6:
dict(
name='right_shoulder',
id=6,
color=[255, 128, 0],
type='upper',
swap='left_shoulder'),
7:
dict(
name='left_elbow',
id=7,
color=[0, 255, 0],
type='upper',
swap='right_elbow'),
8:
dict(
name='right_elbow',
id=8,
color=[255, 128, 0],
type='upper',
swap='left_elbow'),
9:
dict(
name='left_wrist',
id=9,
color=[0, 255, 0],
type='upper',
swap='right_wrist'),
10:
dict(
name='right_wrist',
id=10,
color=[255, 128, 0],
type='upper',
swap='left_wrist'),
11:
dict(
name='left_hip',
id=11,
color=[0, 255, 0],
type='lower',
swap='right_hip'),
12:
dict(
name='right_hip',
id=12,
color=[255, 128, 0],
type='lower',
swap='left_hip'),
13:
dict(
name='left_knee',
id=13,
color=[0, 255, 0],
type='lower',
swap='right_knee'),
14:
dict(
name='right_knee',
id=14,
color=[255, 128, 0],
type='lower',
swap='left_knee'),
15:
dict(
name='left_ankle',
id=15,
color=[0, 255, 0],
type='lower',
swap='right_ankle'),
16:
dict(
name='right_ankle',
id=16,
color=[255, 128, 0],
type='lower',
swap='left_ankle')
},
skeleton_info={
0:
dict(link=('left_ankle', 'left_knee'), id=0, color=[0, 255, 0]),
1:
dict(link=('left_knee', 'left_hip'), id=1, color=[0, 255, 0]),
2:
dict(link=('right_ankle', 'right_knee'), id=2, color=[255, 128, 0]),
3:
dict(link=('right_knee', 'right_hip'), id=3, color=[255, 128, 0]),
4:
dict(link=('left_hip', 'right_hip'), id=4, color=[51, 153, 255]),
5:
dict(link=('left_shoulder', 'left_hip'), id=5, color=[51, 153, 255]),
6:
dict(link=('right_shoulder', 'right_hip'), id=6, color=[51, 153, 255]),
7:
dict(
link=('left_shoulder', 'right_shoulder'),
id=7,
color=[51, 153, 255]),
8:
dict(link=('left_shoulder', 'left_elbow'), id=8, color=[0, 255, 0]),
9:
dict(
link=('right_shoulder', 'right_elbow'), id=9, color=[255, 128, 0]),
10:
dict(link=('left_elbow', 'left_wrist'), id=10, color=[0, 255, 0]),
11:
dict(link=('right_elbow', 'right_wrist'), id=11, color=[255, 128, 0]),
12:
dict(link=('left_eye', 'right_eye'), id=12, color=[51, 153, 255]),
13:
dict(link=('nose', 'left_eye'), id=13, color=[51, 153, 255]),
14:
dict(link=('nose', 'right_eye'), id=14, color=[51, 153, 255]),
15:
dict(link=('left_eye', 'left_ear'), id=15, color=[51, 153, 255]),
16:
dict(link=('right_eye', 'right_ear'), id=16, color=[51, 153, 255]),
17:
dict(link=('left_ear', 'left_shoulder'), id=17, color=[51, 153, 255]),
18:
dict(
link=('right_ear', 'right_shoulder'), id=18, color=[51, 153, 255])
},
joint_weights=[
1., 1., 1., 1., 1., 1., 1., 1.2, 1.2, 1.5, 1.5, 1., 1., 1.2, 1.2, 1.5,
1.5
],
sigmas=[
0.026, 0.025, 0.025, 0.035, 0.035, 0.079, 0.079, 0.072, 0.072, 0.062,
0.062, 0.107, 0.107, 0.087, 0.087, 0.089, 0.089
])
-156
View File
@@ -1,156 +0,0 @@
dataset_info = dict(
dataset_name='mhp',
paper_info=dict(
author='Zhao, Jian and Li, Jianshu and Cheng, Yu and '
'Sim, Terence and Yan, Shuicheng and Feng, Jiashi',
title='Understanding humans in crowded scenes: '
'Deep nested adversarial learning and a '
'new benchmark for multi-human parsing',
container='Proceedings of the 26th ACM '
'international conference on Multimedia',
year='2018',
homepage='https://lv-mhp.github.io/dataset',
),
keypoint_info={
0:
dict(
name='right_ankle',
id=0,
color=[255, 128, 0],
type='lower',
swap='left_ankle'),
1:
dict(
name='right_knee',
id=1,
color=[255, 128, 0],
type='lower',
swap='left_knee'),
2:
dict(
name='right_hip',
id=2,
color=[255, 128, 0],
type='lower',
swap='left_hip'),
3:
dict(
name='left_hip',
id=3,
color=[0, 255, 0],
type='lower',
swap='right_hip'),
4:
dict(
name='left_knee',
id=4,
color=[0, 255, 0],
type='lower',
swap='right_knee'),
5:
dict(
name='left_ankle',
id=5,
color=[0, 255, 0],
type='lower',
swap='right_ankle'),
6:
dict(name='pelvis', id=6, color=[51, 153, 255], type='lower', swap=''),
7:
dict(name='thorax', id=7, color=[51, 153, 255], type='upper', swap=''),
8:
dict(
name='upper_neck',
id=8,
color=[51, 153, 255],
type='upper',
swap=''),
9:
dict(
name='head_top', id=9, color=[51, 153, 255], type='upper',
swap=''),
10:
dict(
name='right_wrist',
id=10,
color=[255, 128, 0],
type='upper',
swap='left_wrist'),
11:
dict(
name='right_elbow',
id=11,
color=[255, 128, 0],
type='upper',
swap='left_elbow'),
12:
dict(
name='right_shoulder',
id=12,
color=[255, 128, 0],
type='upper',
swap='left_shoulder'),
13:
dict(
name='left_shoulder',
id=13,
color=[0, 255, 0],
type='upper',
swap='right_shoulder'),
14:
dict(
name='left_elbow',
id=14,
color=[0, 255, 0],
type='upper',
swap='right_elbow'),
15:
dict(
name='left_wrist',
id=15,
color=[0, 255, 0],
type='upper',
swap='right_wrist')
},
skeleton_info={
0:
dict(link=('right_ankle', 'right_knee'), id=0, color=[255, 128, 0]),
1:
dict(link=('right_knee', 'right_hip'), id=1, color=[255, 128, 0]),
2:
dict(link=('right_hip', 'pelvis'), id=2, color=[255, 128, 0]),
3:
dict(link=('pelvis', 'left_hip'), id=3, color=[0, 255, 0]),
4:
dict(link=('left_hip', 'left_knee'), id=4, color=[0, 255, 0]),
5:
dict(link=('left_knee', 'left_ankle'), id=5, color=[0, 255, 0]),
6:
dict(link=('pelvis', 'thorax'), id=6, color=[51, 153, 255]),
7:
dict(link=('thorax', 'upper_neck'), id=7, color=[51, 153, 255]),
8:
dict(link=('upper_neck', 'head_top'), id=8, color=[51, 153, 255]),
9:
dict(link=('upper_neck', 'right_shoulder'), id=9, color=[255, 128, 0]),
10:
dict(
link=('right_shoulder', 'right_elbow'), id=10, color=[255, 128,
0]),
11:
dict(link=('right_elbow', 'right_wrist'), id=11, color=[255, 128, 0]),
12:
dict(link=('upper_neck', 'left_shoulder'), id=12, color=[0, 255, 0]),
13:
dict(link=('left_shoulder', 'left_elbow'), id=13, color=[0, 255, 0]),
14:
dict(link=('left_elbow', 'left_wrist'), id=14, color=[0, 255, 0])
},
joint_weights=[
1.5, 1.2, 1., 1., 1.2, 1.5, 1., 1., 1., 1., 1.5, 1.2, 1., 1., 1.2, 1.5
],
# Adapted from COCO dataset.
sigmas=[
0.089, 0.083, 0.107, 0.107, 0.083, 0.089, 0.026, 0.026, 0.026, 0.026,
0.062, 0.072, 0.179, 0.179, 0.072, 0.062
])
@@ -1,132 +0,0 @@
dataset_info = dict(
dataset_name='mpi_inf_3dhp',
paper_info=dict(
author='ehta, Dushyant and Rhodin, Helge and Casas, Dan and '
'Fua, Pascal and Sotnychenko, Oleksandr and Xu, Weipeng and '
'Theobalt, Christian',
title='Monocular 3D Human Pose Estimation In The Wild Using Improved '
'CNN Supervision',
container='2017 international conference on 3D vision (3DV)',
year='2017',
homepage='http://gvv.mpi-inf.mpg.de/3dhp-dataset',
),
keypoint_info={
0:
dict(
name='head_top', id=0, color=[51, 153, 255], type='upper',
swap=''),
1:
dict(name='neck', id=1, color=[51, 153, 255], type='upper', swap=''),
2:
dict(
name='right_shoulder',
id=2,
color=[255, 128, 0],
type='upper',
swap='left_shoulder'),
3:
dict(
name='right_elbow',
id=3,
color=[255, 128, 0],
type='upper',
swap='left_elbow'),
4:
dict(
name='right_wrist',
id=4,
color=[255, 128, 0],
type='upper',
swap='left_wrist'),
5:
dict(
name='left_shoulder',
id=5,
color=[0, 255, 0],
type='upper',
swap='right_shoulder'),
6:
dict(
name='left_elbow',
id=6,
color=[0, 255, 0],
type='upper',
swap='right_elbow'),
7:
dict(
name='left_wrist',
id=7,
color=[0, 255, 0],
type='upper',
swap='right_wrist'),
8:
dict(
name='right_hip',
id=8,
color=[255, 128, 0],
type='lower',
swap='left_hip'),
9:
dict(
name='right_knee',
id=9,
color=[255, 128, 0],
type='lower',
swap='left_knee'),
10:
dict(
name='right_ankle',
id=10,
color=[255, 128, 0],
type='lower',
swap='left_ankle'),
11:
dict(
name='left_hip',
id=11,
color=[0, 255, 0],
type='lower',
swap='right_hip'),
12:
dict(
name='left_knee',
id=12,
color=[0, 255, 0],
type='lower',
swap='right_knee'),
13:
dict(
name='left_ankle',
id=13,
color=[0, 255, 0],
type='lower',
swap='right_ankle'),
14:
dict(name='root', id=14, color=[51, 153, 255], type='lower', swap=''),
15:
dict(name='spine', id=15, color=[51, 153, 255], type='upper', swap=''),
16:
dict(name='head', id=16, color=[51, 153, 255], type='upper', swap='')
},
skeleton_info={
0: dict(link=('neck', 'right_shoulder'), id=0, color=[255, 128, 0]),
1: dict(
link=('right_shoulder', 'right_elbow'), id=1, color=[255, 128, 0]),
2:
dict(link=('right_elbow', 'right_wrist'), id=2, color=[255, 128, 0]),
3: dict(link=('neck', 'left_shoulder'), id=3, color=[0, 255, 0]),
4: dict(link=('left_shoulder', 'left_elbow'), id=4, color=[0, 255, 0]),
5: dict(link=('left_elbow', 'left_wrist'), id=5, color=[0, 255, 0]),
6: dict(link=('root', 'right_hip'), id=6, color=[255, 128, 0]),
7: dict(link=('right_hip', 'right_knee'), id=7, color=[255, 128, 0]),
8: dict(link=('right_knee', 'right_ankle'), id=8, color=[255, 128, 0]),
9: dict(link=('root', 'left_hip'), id=9, color=[0, 255, 0]),
10: dict(link=('left_hip', 'left_knee'), id=10, color=[0, 255, 0]),
11: dict(link=('left_knee', 'left_ankle'), id=11, color=[0, 255, 0]),
12: dict(link=('head_top', 'head'), id=12, color=[51, 153, 255]),
13: dict(link=('head', 'neck'), id=13, color=[51, 153, 255]),
14: dict(link=('neck', 'spine'), id=14, color=[51, 153, 255]),
15: dict(link=('spine', 'root'), id=15, color=[51, 153, 255])
},
joint_weights=[1.] * 17,
sigmas=[])
-155
View File
@@ -1,155 +0,0 @@
dataset_info = dict(
dataset_name='mpii',
paper_info=dict(
author='Mykhaylo Andriluka and Leonid Pishchulin and '
'Peter Gehler and Schiele, Bernt',
title='2D Human Pose Estimation: New Benchmark and '
'State of the Art Analysis',
container='IEEE Conference on Computer Vision and '
'Pattern Recognition (CVPR)',
year='2014',
homepage='http://human-pose.mpi-inf.mpg.de/',
),
keypoint_info={
0:
dict(
name='right_ankle',
id=0,
color=[255, 128, 0],
type='lower',
swap='left_ankle'),
1:
dict(
name='right_knee',
id=1,
color=[255, 128, 0],
type='lower',
swap='left_knee'),
2:
dict(
name='right_hip',
id=2,
color=[255, 128, 0],
type='lower',
swap='left_hip'),
3:
dict(
name='left_hip',
id=3,
color=[0, 255, 0],
type='lower',
swap='right_hip'),
4:
dict(
name='left_knee',
id=4,
color=[0, 255, 0],
type='lower',
swap='right_knee'),
5:
dict(
name='left_ankle',
id=5,
color=[0, 255, 0],
type='lower',
swap='right_ankle'),
6:
dict(name='pelvis', id=6, color=[51, 153, 255], type='lower', swap=''),
7:
dict(name='thorax', id=7, color=[51, 153, 255], type='upper', swap=''),
8:
dict(
name='upper_neck',
id=8,
color=[51, 153, 255],
type='upper',
swap=''),
9:
dict(
name='head_top', id=9, color=[51, 153, 255], type='upper',
swap=''),
10:
dict(
name='right_wrist',
id=10,
color=[255, 128, 0],
type='upper',
swap='left_wrist'),
11:
dict(
name='right_elbow',
id=11,
color=[255, 128, 0],
type='upper',
swap='left_elbow'),
12:
dict(
name='right_shoulder',
id=12,
color=[255, 128, 0],
type='upper',
swap='left_shoulder'),
13:
dict(
name='left_shoulder',
id=13,
color=[0, 255, 0],
type='upper',
swap='right_shoulder'),
14:
dict(
name='left_elbow',
id=14,
color=[0, 255, 0],
type='upper',
swap='right_elbow'),
15:
dict(
name='left_wrist',
id=15,
color=[0, 255, 0],
type='upper',
swap='right_wrist')
},
skeleton_info={
0:
dict(link=('right_ankle', 'right_knee'), id=0, color=[255, 128, 0]),
1:
dict(link=('right_knee', 'right_hip'), id=1, color=[255, 128, 0]),
2:
dict(link=('right_hip', 'pelvis'), id=2, color=[255, 128, 0]),
3:
dict(link=('pelvis', 'left_hip'), id=3, color=[0, 255, 0]),
4:
dict(link=('left_hip', 'left_knee'), id=4, color=[0, 255, 0]),
5:
dict(link=('left_knee', 'left_ankle'), id=5, color=[0, 255, 0]),
6:
dict(link=('pelvis', 'thorax'), id=6, color=[51, 153, 255]),
7:
dict(link=('thorax', 'upper_neck'), id=7, color=[51, 153, 255]),
8:
dict(link=('upper_neck', 'head_top'), id=8, color=[51, 153, 255]),
9:
dict(link=('upper_neck', 'right_shoulder'), id=9, color=[255, 128, 0]),
10:
dict(
link=('right_shoulder', 'right_elbow'), id=10, color=[255, 128,
0]),
11:
dict(link=('right_elbow', 'right_wrist'), id=11, color=[255, 128, 0]),
12:
dict(link=('upper_neck', 'left_shoulder'), id=12, color=[0, 255, 0]),
13:
dict(link=('left_shoulder', 'left_elbow'), id=13, color=[0, 255, 0]),
14:
dict(link=('left_elbow', 'left_wrist'), id=14, color=[0, 255, 0])
},
joint_weights=[
1.5, 1.2, 1., 1., 1.2, 1.5, 1., 1., 1., 1., 1.5, 1.2, 1., 1., 1.2, 1.5
],
# Adapted from COCO dataset.
sigmas=[
0.089, 0.083, 0.107, 0.107, 0.083, 0.089, 0.026, 0.026, 0.026, 0.026,
0.062, 0.072, 0.179, 0.179, 0.072, 0.062
])
-380
View File
@@ -1,380 +0,0 @@
dataset_info = dict(
dataset_name='mpii_trb',
paper_info=dict(
author='Duan, Haodong and Lin, Kwan-Yee and Jin, Sheng and '
'Liu, Wentao and Qian, Chen and Ouyang, Wanli',
title='TRB: A Novel Triplet Representation for '
'Understanding 2D Human Body',
container='Proceedings of the IEEE International '
'Conference on Computer Vision',
year='2019',
homepage='https://github.com/kennymckormick/'
'Triplet-Representation-of-human-Body',
),
keypoint_info={
0:
dict(
name='left_shoulder',
id=0,
color=[0, 255, 0],
type='upper',
swap='right_shoulder'),
1:
dict(
name='right_shoulder',
id=1,
color=[255, 128, 0],
type='upper',
swap='left_shoulder'),
2:
dict(
name='left_elbow',
id=2,
color=[0, 255, 0],
type='upper',
swap='right_elbow'),
3:
dict(
name='right_elbow',
id=3,
color=[255, 128, 0],
type='upper',
swap='left_elbow'),
4:
dict(
name='left_wrist',
id=4,
color=[0, 255, 0],
type='upper',
swap='right_wrist'),
5:
dict(
name='right_wrist',
id=5,
color=[255, 128, 0],
type='upper',
swap='left_wrist'),
6:
dict(
name='left_hip',
id=6,
color=[0, 255, 0],
type='lower',
swap='right_hip'),
7:
dict(
name='right_hip',
id=7,
color=[255, 128, 0],
type='lower',
swap='left_hip'),
8:
dict(
name='left_knee',
id=8,
color=[0, 255, 0],
type='lower',
swap='right_knee'),
9:
dict(
name='right_knee',
id=9,
color=[255, 128, 0],
type='lower',
swap='left_knee'),
10:
dict(
name='left_ankle',
id=10,
color=[0, 255, 0],
type='lower',
swap='right_ankle'),
11:
dict(
name='right_ankle',
id=11,
color=[255, 128, 0],
type='lower',
swap='left_ankle'),
12:
dict(name='head', id=12, color=[51, 153, 255], type='upper', swap=''),
13:
dict(name='neck', id=13, color=[51, 153, 255], type='upper', swap=''),
14:
dict(
name='right_neck',
id=14,
color=[255, 255, 255],
type='upper',
swap='left_neck'),
15:
dict(
name='left_neck',
id=15,
color=[255, 255, 255],
type='upper',
swap='right_neck'),
16:
dict(
name='medial_right_shoulder',
id=16,
color=[255, 255, 255],
type='upper',
swap='medial_left_shoulder'),
17:
dict(
name='lateral_right_shoulder',
id=17,
color=[255, 255, 255],
type='upper',
swap='lateral_left_shoulder'),
18:
dict(
name='medial_right_bow',
id=18,
color=[255, 255, 255],
type='upper',
swap='medial_left_bow'),
19:
dict(
name='lateral_right_bow',
id=19,
color=[255, 255, 255],
type='upper',
swap='lateral_left_bow'),
20:
dict(
name='medial_right_wrist',
id=20,
color=[255, 255, 255],
type='upper',
swap='medial_left_wrist'),
21:
dict(
name='lateral_right_wrist',
id=21,
color=[255, 255, 255],
type='upper',
swap='lateral_left_wrist'),
22:
dict(
name='medial_left_shoulder',
id=22,
color=[255, 255, 255],
type='upper',
swap='medial_right_shoulder'),
23:
dict(
name='lateral_left_shoulder',
id=23,
color=[255, 255, 255],
type='upper',
swap='lateral_right_shoulder'),
24:
dict(
name='medial_left_bow',
id=24,
color=[255, 255, 255],
type='upper',
swap='medial_right_bow'),
25:
dict(
name='lateral_left_bow',
id=25,
color=[255, 255, 255],
type='upper',
swap='lateral_right_bow'),
26:
dict(
name='medial_left_wrist',
id=26,
color=[255, 255, 255],
type='upper',
swap='medial_right_wrist'),
27:
dict(
name='lateral_left_wrist',
id=27,
color=[255, 255, 255],
type='upper',
swap='lateral_right_wrist'),
28:
dict(
name='medial_right_hip',
id=28,
color=[255, 255, 255],
type='lower',
swap='medial_left_hip'),
29:
dict(
name='lateral_right_hip',
id=29,
color=[255, 255, 255],
type='lower',
swap='lateral_left_hip'),
30:
dict(
name='medial_right_knee',
id=30,
color=[255, 255, 255],
type='lower',
swap='medial_left_knee'),
31:
dict(
name='lateral_right_knee',
id=31,
color=[255, 255, 255],
type='lower',
swap='lateral_left_knee'),
32:
dict(
name='medial_right_ankle',
id=32,
color=[255, 255, 255],
type='lower',
swap='medial_left_ankle'),
33:
dict(
name='lateral_right_ankle',
id=33,
color=[255, 255, 255],
type='lower',
swap='lateral_left_ankle'),
34:
dict(
name='medial_left_hip',
id=34,
color=[255, 255, 255],
type='lower',
swap='medial_right_hip'),
35:
dict(
name='lateral_left_hip',
id=35,
color=[255, 255, 255],
type='lower',
swap='lateral_right_hip'),
36:
dict(
name='medial_left_knee',
id=36,
color=[255, 255, 255],
type='lower',
swap='medial_right_knee'),
37:
dict(
name='lateral_left_knee',
id=37,
color=[255, 255, 255],
type='lower',
swap='lateral_right_knee'),
38:
dict(
name='medial_left_ankle',
id=38,
color=[255, 255, 255],
type='lower',
swap='medial_right_ankle'),
39:
dict(
name='lateral_left_ankle',
id=39,
color=[255, 255, 255],
type='lower',
swap='lateral_right_ankle'),
},
skeleton_info={
0:
dict(link=('head', 'neck'), id=0, color=[51, 153, 255]),
1:
dict(link=('neck', 'left_shoulder'), id=1, color=[51, 153, 255]),
2:
dict(link=('neck', 'right_shoulder'), id=2, color=[51, 153, 255]),
3:
dict(link=('left_shoulder', 'left_elbow'), id=3, color=[0, 255, 0]),
4:
dict(
link=('right_shoulder', 'right_elbow'), id=4, color=[255, 128, 0]),
5:
dict(link=('left_elbow', 'left_wrist'), id=5, color=[0, 255, 0]),
6:
dict(link=('right_elbow', 'right_wrist'), id=6, color=[255, 128, 0]),
7:
dict(link=('left_shoulder', 'left_hip'), id=7, color=[51, 153, 255]),
8:
dict(link=('right_shoulder', 'right_hip'), id=8, color=[51, 153, 255]),
9:
dict(link=('left_hip', 'right_hip'), id=9, color=[51, 153, 255]),
10:
dict(link=('left_hip', 'left_knee'), id=10, color=[0, 255, 0]),
11:
dict(link=('right_hip', 'right_knee'), id=11, color=[255, 128, 0]),
12:
dict(link=('left_knee', 'left_ankle'), id=12, color=[0, 255, 0]),
13:
dict(link=('right_knee', 'right_ankle'), id=13, color=[255, 128, 0]),
14:
dict(link=('right_neck', 'left_neck'), id=14, color=[255, 255, 255]),
15:
dict(
link=('medial_right_shoulder', 'lateral_right_shoulder'),
id=15,
color=[255, 255, 255]),
16:
dict(
link=('medial_right_bow', 'lateral_right_bow'),
id=16,
color=[255, 255, 255]),
17:
dict(
link=('medial_right_wrist', 'lateral_right_wrist'),
id=17,
color=[255, 255, 255]),
18:
dict(
link=('medial_left_shoulder', 'lateral_left_shoulder'),
id=18,
color=[255, 255, 255]),
19:
dict(
link=('medial_left_bow', 'lateral_left_bow'),
id=19,
color=[255, 255, 255]),
20:
dict(
link=('medial_left_wrist', 'lateral_left_wrist'),
id=20,
color=[255, 255, 255]),
21:
dict(
link=('medial_right_hip', 'lateral_right_hip'),
id=21,
color=[255, 255, 255]),
22:
dict(
link=('medial_right_knee', 'lateral_right_knee'),
id=22,
color=[255, 255, 255]),
23:
dict(
link=('medial_right_ankle', 'lateral_right_ankle'),
id=23,
color=[255, 255, 255]),
24:
dict(
link=('medial_left_hip', 'lateral_left_hip'),
id=24,
color=[255, 255, 255]),
25:
dict(
link=('medial_left_knee', 'lateral_left_knee'),
id=25,
color=[255, 255, 255]),
26:
dict(
link=('medial_left_ankle', 'lateral_left_ankle'),
id=26,
color=[255, 255, 255])
},
joint_weights=[1.] * 40,
sigmas=[])
@@ -1,42 +0,0 @@
dataset_info = dict(
dataset_name='nvgesture',
paper_info=dict(
author='Pavlo Molchanov and Xiaodong Yang and Shalini Gupta '
'and Kihwan Kim and Stephen Tyree and Jan Kautz',
title='Online Detection and Classification of Dynamic Hand Gestures '
'with Recurrent 3D Convolutional Neural Networks',
container='Proceedings of the IEEE Conference on '
'Computer Vision and Pattern Recognition',
year='2016',
homepage='https://research.nvidia.com/publication/2016-06_online-'
'detection-and-classification-dynamic-hand-gestures-recurrent-3d',
),
category_info={
0: 'five fingers move right',
1: 'five fingers move left',
2: 'five fingers move up',
3: 'five fingers move down',
4: 'two fingers move right',
5: 'two fingers move left',
6: 'two fingers move up',
7: 'two fingers move down',
8: 'click',
9: 'beckoned',
10: 'stretch hand',
11: 'shake hand',
12: 'one',
13: 'two',
14: 'three',
15: 'lift up',
16: 'press down',
17: 'push',
18: 'shrink',
19: 'levorotation',
20: 'dextrorotation',
21: 'two fingers prod',
22: 'grab',
23: 'thumbs up',
24: 'OK'
},
flip_pairs=[(0, 1), (4, 5), (19, 20)],
fps=30)
-181
View File
@@ -1,181 +0,0 @@
dataset_info = dict(
dataset_name='ochuman',
paper_info=dict(
author='Zhang, Song-Hai and Li, Ruilong and Dong, Xin and '
'Rosin, Paul and Cai, Zixi and Han, Xi and '
'Yang, Dingcheng and Huang, Haozhi and Hu, Shi-Min',
title='Pose2seg: Detection free human instance segmentation',
container='Proceedings of the IEEE conference on computer '
'vision and pattern recognition',
year='2019',
homepage='https://github.com/liruilong940607/OCHumanApi',
),
keypoint_info={
0:
dict(name='nose', id=0, color=[51, 153, 255], type='upper', swap=''),
1:
dict(
name='left_eye',
id=1,
color=[51, 153, 255],
type='upper',
swap='right_eye'),
2:
dict(
name='right_eye',
id=2,
color=[51, 153, 255],
type='upper',
swap='left_eye'),
3:
dict(
name='left_ear',
id=3,
color=[51, 153, 255],
type='upper',
swap='right_ear'),
4:
dict(
name='right_ear',
id=4,
color=[51, 153, 255],
type='upper',
swap='left_ear'),
5:
dict(
name='left_shoulder',
id=5,
color=[0, 255, 0],
type='upper',
swap='right_shoulder'),
6:
dict(
name='right_shoulder',
id=6,
color=[255, 128, 0],
type='upper',
swap='left_shoulder'),
7:
dict(
name='left_elbow',
id=7,
color=[0, 255, 0],
type='upper',
swap='right_elbow'),
8:
dict(
name='right_elbow',
id=8,
color=[255, 128, 0],
type='upper',
swap='left_elbow'),
9:
dict(
name='left_wrist',
id=9,
color=[0, 255, 0],
type='upper',
swap='right_wrist'),
10:
dict(
name='right_wrist',
id=10,
color=[255, 128, 0],
type='upper',
swap='left_wrist'),
11:
dict(
name='left_hip',
id=11,
color=[0, 255, 0],
type='lower',
swap='right_hip'),
12:
dict(
name='right_hip',
id=12,
color=[255, 128, 0],
type='lower',
swap='left_hip'),
13:
dict(
name='left_knee',
id=13,
color=[0, 255, 0],
type='lower',
swap='right_knee'),
14:
dict(
name='right_knee',
id=14,
color=[255, 128, 0],
type='lower',
swap='left_knee'),
15:
dict(
name='left_ankle',
id=15,
color=[0, 255, 0],
type='lower',
swap='right_ankle'),
16:
dict(
name='right_ankle',
id=16,
color=[255, 128, 0],
type='lower',
swap='left_ankle')
},
skeleton_info={
0:
dict(link=('left_ankle', 'left_knee'), id=0, color=[0, 255, 0]),
1:
dict(link=('left_knee', 'left_hip'), id=1, color=[0, 255, 0]),
2:
dict(link=('right_ankle', 'right_knee'), id=2, color=[255, 128, 0]),
3:
dict(link=('right_knee', 'right_hip'), id=3, color=[255, 128, 0]),
4:
dict(link=('left_hip', 'right_hip'), id=4, color=[51, 153, 255]),
5:
dict(link=('left_shoulder', 'left_hip'), id=5, color=[51, 153, 255]),
6:
dict(link=('right_shoulder', 'right_hip'), id=6, color=[51, 153, 255]),
7:
dict(
link=('left_shoulder', 'right_shoulder'),
id=7,
color=[51, 153, 255]),
8:
dict(link=('left_shoulder', 'left_elbow'), id=8, color=[0, 255, 0]),
9:
dict(
link=('right_shoulder', 'right_elbow'), id=9, color=[255, 128, 0]),
10:
dict(link=('left_elbow', 'left_wrist'), id=10, color=[0, 255, 0]),
11:
dict(link=('right_elbow', 'right_wrist'), id=11, color=[255, 128, 0]),
12:
dict(link=('left_eye', 'right_eye'), id=12, color=[51, 153, 255]),
13:
dict(link=('nose', 'left_eye'), id=13, color=[51, 153, 255]),
14:
dict(link=('nose', 'right_eye'), id=14, color=[51, 153, 255]),
15:
dict(link=('left_eye', 'left_ear'), id=15, color=[51, 153, 255]),
16:
dict(link=('right_eye', 'right_ear'), id=16, color=[51, 153, 255]),
17:
dict(link=('left_ear', 'left_shoulder'), id=17, color=[51, 153, 255]),
18:
dict(
link=('right_ear', 'right_shoulder'), id=18, color=[51, 153, 255])
},
joint_weights=[
1., 1., 1., 1., 1., 1., 1., 1.2, 1.2, 1.5, 1.5, 1., 1., 1.2, 1.2, 1.5,
1.5
],
sigmas=[
0.026, 0.025, 0.025, 0.035, 0.035, 0.079, 0.079, 0.072, 0.072, 0.062,
0.062, 0.107, 0.107, 0.087, 0.087, 0.089, 0.089
])
-142
View File
@@ -1,142 +0,0 @@
dataset_info = dict(
dataset_name='onehand10k',
paper_info=dict(
author='Wang, Yangang and Peng, Cong and Liu, Yebin',
title='Mask-pose cascaded cnn for 2d hand pose estimation '
'from single color image',
container='IEEE Transactions on Circuits and Systems '
'for Video Technology',
year='2018',
homepage='https://www.yangangwang.com/papers/WANG-MCC-2018-10.html',
),
keypoint_info={
0:
dict(name='wrist', id=0, color=[255, 255, 255], type='', swap=''),
1:
dict(name='thumb1', id=1, color=[255, 128, 0], type='', swap=''),
2:
dict(name='thumb2', id=2, color=[255, 128, 0], type='', swap=''),
3:
dict(name='thumb3', id=3, color=[255, 128, 0], type='', swap=''),
4:
dict(name='thumb4', id=4, color=[255, 128, 0], type='', swap=''),
5:
dict(
name='forefinger1', id=5, color=[255, 153, 255], type='', swap=''),
6:
dict(
name='forefinger2', id=6, color=[255, 153, 255], type='', swap=''),
7:
dict(
name='forefinger3', id=7, color=[255, 153, 255], type='', swap=''),
8:
dict(
name='forefinger4', id=8, color=[255, 153, 255], type='', swap=''),
9:
dict(
name='middle_finger1',
id=9,
color=[102, 178, 255],
type='',
swap=''),
10:
dict(
name='middle_finger2',
id=10,
color=[102, 178, 255],
type='',
swap=''),
11:
dict(
name='middle_finger3',
id=11,
color=[102, 178, 255],
type='',
swap=''),
12:
dict(
name='middle_finger4',
id=12,
color=[102, 178, 255],
type='',
swap=''),
13:
dict(
name='ring_finger1', id=13, color=[255, 51, 51], type='', swap=''),
14:
dict(
name='ring_finger2', id=14, color=[255, 51, 51], type='', swap=''),
15:
dict(
name='ring_finger3', id=15, color=[255, 51, 51], type='', swap=''),
16:
dict(
name='ring_finger4', id=16, color=[255, 51, 51], type='', swap=''),
17:
dict(name='pinky_finger1', id=17, color=[0, 255, 0], type='', swap=''),
18:
dict(name='pinky_finger2', id=18, color=[0, 255, 0], type='', swap=''),
19:
dict(name='pinky_finger3', id=19, color=[0, 255, 0], type='', swap=''),
20:
dict(name='pinky_finger4', id=20, color=[0, 255, 0], type='', swap='')
},
skeleton_info={
0:
dict(link=('wrist', 'thumb1'), id=0, color=[255, 128, 0]),
1:
dict(link=('thumb1', 'thumb2'), id=1, color=[255, 128, 0]),
2:
dict(link=('thumb2', 'thumb3'), id=2, color=[255, 128, 0]),
3:
dict(link=('thumb3', 'thumb4'), id=3, color=[255, 128, 0]),
4:
dict(link=('wrist', 'forefinger1'), id=4, color=[255, 153, 255]),
5:
dict(link=('forefinger1', 'forefinger2'), id=5, color=[255, 153, 255]),
6:
dict(link=('forefinger2', 'forefinger3'), id=6, color=[255, 153, 255]),
7:
dict(link=('forefinger3', 'forefinger4'), id=7, color=[255, 153, 255]),
8:
dict(link=('wrist', 'middle_finger1'), id=8, color=[102, 178, 255]),
9:
dict(
link=('middle_finger1', 'middle_finger2'),
id=9,
color=[102, 178, 255]),
10:
dict(
link=('middle_finger2', 'middle_finger3'),
id=10,
color=[102, 178, 255]),
11:
dict(
link=('middle_finger3', 'middle_finger4'),
id=11,
color=[102, 178, 255]),
12:
dict(link=('wrist', 'ring_finger1'), id=12, color=[255, 51, 51]),
13:
dict(
link=('ring_finger1', 'ring_finger2'), id=13, color=[255, 51, 51]),
14:
dict(
link=('ring_finger2', 'ring_finger3'), id=14, color=[255, 51, 51]),
15:
dict(
link=('ring_finger3', 'ring_finger4'), id=15, color=[255, 51, 51]),
16:
dict(link=('wrist', 'pinky_finger1'), id=16, color=[0, 255, 0]),
17:
dict(
link=('pinky_finger1', 'pinky_finger2'), id=17, color=[0, 255, 0]),
18:
dict(
link=('pinky_finger2', 'pinky_finger3'), id=18, color=[0, 255, 0]),
19:
dict(
link=('pinky_finger3', 'pinky_finger4'), id=19, color=[0, 255, 0])
},
joint_weights=[1.] * 21,
sigmas=[])
@@ -1,160 +0,0 @@
dataset_info = dict(
dataset_name='panoptic_pose_3d',
paper_info=dict(
author='Joo, Hanbyul and Simon, Tomas and Li, Xulong'
'and Liu, Hao and Tan, Lei and Gui, Lin and Banerjee, Sean'
'and Godisart, Timothy and Nabbe, Bart and Matthews, Iain'
'and Kanade, Takeo and Nobuhara, Shohei and Sheikh, Yaser',
title='Panoptic Studio: A Massively Multiview System '
'for Interaction Motion Capture',
container='IEEE Transactions on Pattern Analysis'
' and Machine Intelligence',
year='2017',
homepage='http://domedb.perception.cs.cmu.edu',
),
keypoint_info={
0:
dict(name='neck', id=0, color=[51, 153, 255], type='upper', swap=''),
1:
dict(name='nose', id=1, color=[51, 153, 255], type='upper', swap=''),
2:
dict(name='mid_hip', id=2, color=[0, 255, 0], type='lower', swap=''),
3:
dict(
name='left_shoulder',
id=3,
color=[0, 255, 0],
type='upper',
swap='right_shoulder'),
4:
dict(
name='left_elbow',
id=4,
color=[0, 255, 0],
type='upper',
swap='right_elbow'),
5:
dict(
name='left_wrist',
id=5,
color=[0, 255, 0],
type='upper',
swap='right_wrist'),
6:
dict(
name='left_hip',
id=6,
color=[0, 255, 0],
type='lower',
swap='right_hip'),
7:
dict(
name='left_knee',
id=7,
color=[0, 255, 0],
type='lower',
swap='right_knee'),
8:
dict(
name='left_ankle',
id=8,
color=[0, 255, 0],
type='lower',
swap='right_ankle'),
9:
dict(
name='right_shoulder',
id=9,
color=[255, 128, 0],
type='upper',
swap='left_shoulder'),
10:
dict(
name='right_elbow',
id=10,
color=[255, 128, 0],
type='upper',
swap='left_elbow'),
11:
dict(
name='right_wrist',
id=11,
color=[255, 128, 0],
type='upper',
swap='left_wrist'),
12:
dict(
name='right_hip',
id=12,
color=[255, 128, 0],
type='lower',
swap='left_hip'),
13:
dict(
name='right_knee',
id=13,
color=[255, 128, 0],
type='lower',
swap='left_knee'),
14:
dict(
name='right_ankle',
id=14,
color=[255, 128, 0],
type='lower',
swap='left_ankle'),
15:
dict(
name='left_eye',
id=15,
color=[51, 153, 255],
type='upper',
swap='right_eye'),
16:
dict(
name='left_ear',
id=16,
color=[51, 153, 255],
type='upper',
swap='right_ear'),
17:
dict(
name='right_eye',
id=17,
color=[51, 153, 255],
type='upper',
swap='left_eye'),
18:
dict(
name='right_ear',
id=18,
color=[51, 153, 255],
type='upper',
swap='left_ear')
},
skeleton_info={
0: dict(link=('nose', 'neck'), id=0, color=[51, 153, 255]),
1: dict(link=('neck', 'left_shoulder'), id=1, color=[0, 255, 0]),
2: dict(link=('neck', 'right_shoulder'), id=2, color=[255, 128, 0]),
3: dict(link=('left_shoulder', 'left_elbow'), id=3, color=[0, 255, 0]),
4: dict(
link=('right_shoulder', 'right_elbow'), id=4, color=[255, 128, 0]),
5: dict(link=('left_elbow', 'left_wrist'), id=5, color=[0, 255, 0]),
6:
dict(link=('right_elbow', 'right_wrist'), id=6, color=[255, 128, 0]),
7: dict(link=('left_ankle', 'left_knee'), id=7, color=[0, 255, 0]),
8: dict(link=('left_knee', 'left_hip'), id=8, color=[0, 255, 0]),
9: dict(link=('right_ankle', 'right_knee'), id=9, color=[255, 128, 0]),
10: dict(link=('right_knee', 'right_hip'), id=10, color=[255, 128, 0]),
11: dict(link=('mid_hip', 'left_hip'), id=11, color=[0, 255, 0]),
12: dict(link=('mid_hip', 'right_hip'), id=12, color=[255, 128, 0]),
13: dict(link=('mid_hip', 'neck'), id=13, color=[51, 153, 255]),
},
joint_weights=[
1.0, 1.0, 1.0, 1.0, 1.2, 1.5, 1.0, 1.2, 1.5, 1.0, 1.2, 1.5, 1.0, 1.2,
1.5, 1.0, 1.0, 1.0, 1.0
],
sigmas=[
0.026, 0.026, 0.107, 0.079, 0.072, 0.062, 0.107, 0.087, 0.089, 0.079,
0.072, 0.062, 0.107, 0.087, 0.089, 0.025, 0.035, 0.025, 0.035
])
@@ -1,143 +0,0 @@
dataset_info = dict(
dataset_name='panoptic_hand2d',
paper_info=dict(
author='Simon, Tomas and Joo, Hanbyul and '
'Matthews, Iain and Sheikh, Yaser',
title='Hand keypoint detection in single images using '
'multiview bootstrapping',
container='Proceedings of the IEEE conference on '
'Computer Vision and Pattern Recognition',
year='2017',
homepage='http://domedb.perception.cs.cmu.edu/handdb.html',
),
keypoint_info={
0:
dict(name='wrist', id=0, color=[255, 255, 255], type='', swap=''),
1:
dict(name='thumb1', id=1, color=[255, 128, 0], type='', swap=''),
2:
dict(name='thumb2', id=2, color=[255, 128, 0], type='', swap=''),
3:
dict(name='thumb3', id=3, color=[255, 128, 0], type='', swap=''),
4:
dict(name='thumb4', id=4, color=[255, 128, 0], type='', swap=''),
5:
dict(
name='forefinger1', id=5, color=[255, 153, 255], type='', swap=''),
6:
dict(
name='forefinger2', id=6, color=[255, 153, 255], type='', swap=''),
7:
dict(
name='forefinger3', id=7, color=[255, 153, 255], type='', swap=''),
8:
dict(
name='forefinger4', id=8, color=[255, 153, 255], type='', swap=''),
9:
dict(
name='middle_finger1',
id=9,
color=[102, 178, 255],
type='',
swap=''),
10:
dict(
name='middle_finger2',
id=10,
color=[102, 178, 255],
type='',
swap=''),
11:
dict(
name='middle_finger3',
id=11,
color=[102, 178, 255],
type='',
swap=''),
12:
dict(
name='middle_finger4',
id=12,
color=[102, 178, 255],
type='',
swap=''),
13:
dict(
name='ring_finger1', id=13, color=[255, 51, 51], type='', swap=''),
14:
dict(
name='ring_finger2', id=14, color=[255, 51, 51], type='', swap=''),
15:
dict(
name='ring_finger3', id=15, color=[255, 51, 51], type='', swap=''),
16:
dict(
name='ring_finger4', id=16, color=[255, 51, 51], type='', swap=''),
17:
dict(name='pinky_finger1', id=17, color=[0, 255, 0], type='', swap=''),
18:
dict(name='pinky_finger2', id=18, color=[0, 255, 0], type='', swap=''),
19:
dict(name='pinky_finger3', id=19, color=[0, 255, 0], type='', swap=''),
20:
dict(name='pinky_finger4', id=20, color=[0, 255, 0], type='', swap='')
},
skeleton_info={
0:
dict(link=('wrist', 'thumb1'), id=0, color=[255, 128, 0]),
1:
dict(link=('thumb1', 'thumb2'), id=1, color=[255, 128, 0]),
2:
dict(link=('thumb2', 'thumb3'), id=2, color=[255, 128, 0]),
3:
dict(link=('thumb3', 'thumb4'), id=3, color=[255, 128, 0]),
4:
dict(link=('wrist', 'forefinger1'), id=4, color=[255, 153, 255]),
5:
dict(link=('forefinger1', 'forefinger2'), id=5, color=[255, 153, 255]),
6:
dict(link=('forefinger2', 'forefinger3'), id=6, color=[255, 153, 255]),
7:
dict(link=('forefinger3', 'forefinger4'), id=7, color=[255, 153, 255]),
8:
dict(link=('wrist', 'middle_finger1'), id=8, color=[102, 178, 255]),
9:
dict(
link=('middle_finger1', 'middle_finger2'),
id=9,
color=[102, 178, 255]),
10:
dict(
link=('middle_finger2', 'middle_finger3'),
id=10,
color=[102, 178, 255]),
11:
dict(
link=('middle_finger3', 'middle_finger4'),
id=11,
color=[102, 178, 255]),
12:
dict(link=('wrist', 'ring_finger1'), id=12, color=[255, 51, 51]),
13:
dict(
link=('ring_finger1', 'ring_finger2'), id=13, color=[255, 51, 51]),
14:
dict(
link=('ring_finger2', 'ring_finger3'), id=14, color=[255, 51, 51]),
15:
dict(
link=('ring_finger3', 'ring_finger4'), id=15, color=[255, 51, 51]),
16:
dict(link=('wrist', 'pinky_finger1'), id=16, color=[0, 255, 0]),
17:
dict(
link=('pinky_finger1', 'pinky_finger2'), id=17, color=[0, 255, 0]),
18:
dict(
link=('pinky_finger2', 'pinky_finger3'), id=18, color=[0, 255, 0]),
19:
dict(
link=('pinky_finger3', 'pinky_finger4'), id=19, color=[0, 255, 0])
},
joint_weights=[1.] * 21,
sigmas=[])
@@ -1,176 +0,0 @@
dataset_info = dict(
dataset_name='posetrack18',
paper_info=dict(
author='Andriluka, Mykhaylo and Iqbal, Umar and '
'Insafutdinov, Eldar and Pishchulin, Leonid and '
'Milan, Anton and Gall, Juergen and Schiele, Bernt',
title='Posetrack: A benchmark for human pose estimation and tracking',
container='Proceedings of the IEEE Conference on '
'Computer Vision and Pattern Recognition',
year='2018',
homepage='https://posetrack.net/users/download.php',
),
keypoint_info={
0:
dict(name='nose', id=0, color=[51, 153, 255], type='upper', swap=''),
1:
dict(
name='head_bottom',
id=1,
color=[51, 153, 255],
type='upper',
swap=''),
2:
dict(
name='head_top', id=2, color=[51, 153, 255], type='upper',
swap=''),
3:
dict(
name='left_ear',
id=3,
color=[51, 153, 255],
type='upper',
swap='right_ear'),
4:
dict(
name='right_ear',
id=4,
color=[51, 153, 255],
type='upper',
swap='left_ear'),
5:
dict(
name='left_shoulder',
id=5,
color=[0, 255, 0],
type='upper',
swap='right_shoulder'),
6:
dict(
name='right_shoulder',
id=6,
color=[255, 128, 0],
type='upper',
swap='left_shoulder'),
7:
dict(
name='left_elbow',
id=7,
color=[0, 255, 0],
type='upper',
swap='right_elbow'),
8:
dict(
name='right_elbow',
id=8,
color=[255, 128, 0],
type='upper',
swap='left_elbow'),
9:
dict(
name='left_wrist',
id=9,
color=[0, 255, 0],
type='upper',
swap='right_wrist'),
10:
dict(
name='right_wrist',
id=10,
color=[255, 128, 0],
type='upper',
swap='left_wrist'),
11:
dict(
name='left_hip',
id=11,
color=[0, 255, 0],
type='lower',
swap='right_hip'),
12:
dict(
name='right_hip',
id=12,
color=[255, 128, 0],
type='lower',
swap='left_hip'),
13:
dict(
name='left_knee',
id=13,
color=[0, 255, 0],
type='lower',
swap='right_knee'),
14:
dict(
name='right_knee',
id=14,
color=[255, 128, 0],
type='lower',
swap='left_knee'),
15:
dict(
name='left_ankle',
id=15,
color=[0, 255, 0],
type='lower',
swap='right_ankle'),
16:
dict(
name='right_ankle',
id=16,
color=[255, 128, 0],
type='lower',
swap='left_ankle')
},
skeleton_info={
0:
dict(link=('left_ankle', 'left_knee'), id=0, color=[0, 255, 0]),
1:
dict(link=('left_knee', 'left_hip'), id=1, color=[0, 255, 0]),
2:
dict(link=('right_ankle', 'right_knee'), id=2, color=[255, 128, 0]),
3:
dict(link=('right_knee', 'right_hip'), id=3, color=[255, 128, 0]),
4:
dict(link=('left_hip', 'right_hip'), id=4, color=[51, 153, 255]),
5:
dict(link=('left_shoulder', 'left_hip'), id=5, color=[51, 153, 255]),
6:
dict(link=('right_shoulder', 'right_hip'), id=6, color=[51, 153, 255]),
7:
dict(
link=('left_shoulder', 'right_shoulder'),
id=7,
color=[51, 153, 255]),
8:
dict(link=('left_shoulder', 'left_elbow'), id=8, color=[0, 255, 0]),
9:
dict(
link=('right_shoulder', 'right_elbow'), id=9, color=[255, 128, 0]),
10:
dict(link=('left_elbow', 'left_wrist'), id=10, color=[0, 255, 0]),
11:
dict(link=('right_elbow', 'right_wrist'), id=11, color=[255, 128, 0]),
12:
dict(link=('nose', 'head_bottom'), id=12, color=[51, 153, 255]),
13:
dict(link=('nose', 'head_top'), id=13, color=[51, 153, 255]),
14:
dict(
link=('head_bottom', 'left_shoulder'), id=14, color=[51, 153,
255]),
15:
dict(
link=('head_bottom', 'right_shoulder'),
id=15,
color=[51, 153, 255])
},
joint_weights=[
1., 1., 1., 1., 1., 1., 1., 1.2, 1.2, 1.5, 1.5, 1., 1., 1.2, 1.2, 1.5,
1.5
],
sigmas=[
0.026, 0.025, 0.025, 0.035, 0.035, 0.079, 0.079, 0.072, 0.072, 0.062,
0.062, 0.107, 0.107, 0.087, 0.087, 0.089, 0.089
])
-151
View File
@@ -1,151 +0,0 @@
dataset_info = dict(
dataset_name='rhd2d',
paper_info=dict(
author='Christian Zimmermann and Thomas Brox',
title='Learning to Estimate 3D Hand Pose from Single RGB Images',
container='arXiv',
year='2017',
homepage='https://lmb.informatik.uni-freiburg.de/resources/'
'datasets/RenderedHandposeDataset.en.html',
),
# In RHD, 1-4: left thumb [tip to palm], which means the finger is from
# tip to palm, so as other fingers. Please refer to
# `https://lmb.informatik.uni-freiburg.de/resources/datasets/
# RenderedHandpose/README` for details of keypoint definition.
# But in COCO-WholeBody-Hand, FreiHand, CMU Panoptic HandDB, it is in
# inverse order. Pay attention to this if you want to combine RHD with
# other hand datasets to train a single model.
# Also, note that 'keypoint_info' will not directly affect the order of
# the keypoint in the dataset. It is mostly for visualization & storing
# information about flip_pairs.
keypoint_info={
0:
dict(name='wrist', id=0, color=[255, 255, 255], type='', swap=''),
1:
dict(name='thumb4', id=1, color=[255, 128, 0], type='', swap=''),
2:
dict(name='thumb3', id=2, color=[255, 128, 0], type='', swap=''),
3:
dict(name='thumb2', id=3, color=[255, 128, 0], type='', swap=''),
4:
dict(name='thumb1', id=4, color=[255, 128, 0], type='', swap=''),
5:
dict(
name='forefinger4', id=5, color=[255, 153, 255], type='', swap=''),
6:
dict(
name='forefinger3', id=6, color=[255, 153, 255], type='', swap=''),
7:
dict(
name='forefinger2', id=7, color=[255, 153, 255], type='', swap=''),
8:
dict(
name='forefinger1', id=8, color=[255, 153, 255], type='', swap=''),
9:
dict(
name='middle_finger4',
id=9,
color=[102, 178, 255],
type='',
swap=''),
10:
dict(
name='middle_finger3',
id=10,
color=[102, 178, 255],
type='',
swap=''),
11:
dict(
name='middle_finger2',
id=11,
color=[102, 178, 255],
type='',
swap=''),
12:
dict(
name='middle_finger1',
id=12,
color=[102, 178, 255],
type='',
swap=''),
13:
dict(
name='ring_finger4', id=13, color=[255, 51, 51], type='', swap=''),
14:
dict(
name='ring_finger3', id=14, color=[255, 51, 51], type='', swap=''),
15:
dict(
name='ring_finger2', id=15, color=[255, 51, 51], type='', swap=''),
16:
dict(
name='ring_finger1', id=16, color=[255, 51, 51], type='', swap=''),
17:
dict(name='pinky_finger4', id=17, color=[0, 255, 0], type='', swap=''),
18:
dict(name='pinky_finger3', id=18, color=[0, 255, 0], type='', swap=''),
19:
dict(name='pinky_finger2', id=19, color=[0, 255, 0], type='', swap=''),
20:
dict(name='pinky_finger1', id=20, color=[0, 255, 0], type='', swap='')
},
skeleton_info={
0:
dict(link=('wrist', 'thumb1'), id=0, color=[255, 128, 0]),
1:
dict(link=('thumb1', 'thumb2'), id=1, color=[255, 128, 0]),
2:
dict(link=('thumb2', 'thumb3'), id=2, color=[255, 128, 0]),
3:
dict(link=('thumb3', 'thumb4'), id=3, color=[255, 128, 0]),
4:
dict(link=('wrist', 'forefinger1'), id=4, color=[255, 153, 255]),
5:
dict(link=('forefinger1', 'forefinger2'), id=5, color=[255, 153, 255]),
6:
dict(link=('forefinger2', 'forefinger3'), id=6, color=[255, 153, 255]),
7:
dict(link=('forefinger3', 'forefinger4'), id=7, color=[255, 153, 255]),
8:
dict(link=('wrist', 'middle_finger1'), id=8, color=[102, 178, 255]),
9:
dict(
link=('middle_finger1', 'middle_finger2'),
id=9,
color=[102, 178, 255]),
10:
dict(
link=('middle_finger2', 'middle_finger3'),
id=10,
color=[102, 178, 255]),
11:
dict(
link=('middle_finger3', 'middle_finger4'),
id=11,
color=[102, 178, 255]),
12:
dict(link=('wrist', 'ring_finger1'), id=12, color=[255, 51, 51]),
13:
dict(
link=('ring_finger1', 'ring_finger2'), id=13, color=[255, 51, 51]),
14:
dict(
link=('ring_finger2', 'ring_finger3'), id=14, color=[255, 51, 51]),
15:
dict(
link=('ring_finger3', 'ring_finger4'), id=15, color=[255, 51, 51]),
16:
dict(link=('wrist', 'pinky_finger1'), id=16, color=[0, 255, 0]),
17:
dict(
link=('pinky_finger1', 'pinky_finger2'), id=17, color=[0, 255, 0]),
18:
dict(
link=('pinky_finger2', 'pinky_finger3'), id=18, color=[0, 255, 0]),
19:
dict(
link=('pinky_finger3', 'pinky_finger4'), id=19, color=[0, 255, 0])
},
joint_weights=[1.] * 21,
sigmas=[])
-151
View File
@@ -1,151 +0,0 @@
dataset_info = dict(
dataset_name='shelf',
paper_info=dict(
author='Belagiannis, Vasileios and Amin, Sikandar and Andriluka, '
'Mykhaylo and Schiele, Bernt and Navab, Nassir and Ilic, Slobodan',
title='3D Pictorial Structures for Multiple Human Pose Estimation',
container='IEEE Computer Society Conference on Computer Vision and '
'Pattern Recognition (CVPR)',
year='2014',
homepage='http://campar.in.tum.de/Chair/MultiHumanPose',
),
keypoint_info={
0:
dict(
name='right_ankle',
id=0,
color=[255, 128, 0],
type='lower',
swap='left_ankle'),
1:
dict(
name='right_knee',
id=1,
color=[255, 128, 0],
type='lower',
swap='left_knee'),
2:
dict(
name='right_hip',
id=2,
color=[255, 128, 0],
type='lower',
swap='left_hip'),
3:
dict(
name='left_hip',
id=3,
color=[0, 255, 0],
type='lower',
swap='right_hip'),
4:
dict(
name='left_knee',
id=4,
color=[0, 255, 0],
type='lower',
swap='right_knee'),
5:
dict(
name='left_ankle',
id=5,
color=[0, 255, 0],
type='lower',
swap='right_ankle'),
6:
dict(
name='right_wrist',
id=6,
color=[255, 128, 0],
type='upper',
swap='left_wrist'),
7:
dict(
name='right_elbow',
id=7,
color=[255, 128, 0],
type='upper',
swap='left_elbow'),
8:
dict(
name='right_shoulder',
id=8,
color=[255, 128, 0],
type='upper',
swap='left_shoulder'),
9:
dict(
name='left_shoulder',
id=9,
color=[0, 255, 0],
type='upper',
swap='right_shoulder'),
10:
dict(
name='left_elbow',
id=10,
color=[0, 255, 0],
type='upper',
swap='right_elbow'),
11:
dict(
name='left_wrist',
id=11,
color=[0, 255, 0],
type='upper',
swap='right_wrist'),
12:
dict(
name='bottom_head',
id=12,
color=[51, 153, 255],
type='upper',
swap=''),
13:
dict(
name='top_head',
id=13,
color=[51, 153, 255],
type='upper',
swap=''),
},
skeleton_info={
0:
dict(link=('right_ankle', 'right_knee'), id=0, color=[255, 128, 0]),
1:
dict(link=('right_knee', 'right_hip'), id=1, color=[255, 128, 0]),
2:
dict(link=('left_hip', 'left_knee'), id=2, color=[0, 255, 0]),
3:
dict(link=('left_knee', 'left_ankle'), id=3, color=[0, 255, 0]),
4:
dict(link=('right_hip', 'left_hip'), id=4, color=[51, 153, 255]),
5:
dict(link=('right_wrist', 'right_elbow'), id=5, color=[255, 128, 0]),
6:
dict(
link=('right_elbow', 'right_shoulder'), id=6, color=[255, 128, 0]),
7:
dict(link=('left_shoulder', 'left_elbow'), id=7, color=[0, 255, 0]),
8:
dict(link=('left_elbow', 'left_wrist'), id=8, color=[0, 255, 0]),
9:
dict(link=('right_hip', 'right_shoulder'), id=9, color=[255, 128, 0]),
10:
dict(link=('left_hip', 'left_shoulder'), id=10, color=[0, 255, 0]),
11:
dict(
link=('right_shoulder', 'bottom_head'), id=11, color=[255, 128,
0]),
12:
dict(link=('left_shoulder', 'bottom_head'), id=12, color=[0, 255, 0]),
13:
dict(link=('bottom_head', 'top_head'), id=13, color=[51, 153, 255]),
},
joint_weights=[
1.5, 1.2, 1.0, 1.0, 1.2, 1.5, 1.5, 1.2, 1.0, 1.0, 1.2, 1.5, 1.0, 1.0
],
sigmas=[
0.089, 0.087, 0.107, 0.107, 0.087, 0.089, 0.062, 0.072, 0.079, 0.079,
0.072, 0.062, 0.026, 0.026
])
-582
View File
@@ -1,582 +0,0 @@
dataset_info = dict(
dataset_name='wflw',
paper_info=dict(
author='Wu, Wayne and Qian, Chen and Yang, Shuo and Wang, '
'Quan and Cai, Yici and Zhou, Qiang',
title='Look at boundary: A boundary-aware face alignment algorithm',
container='Proceedings of the IEEE conference on computer '
'vision and pattern recognition',
year='2018',
homepage='https://wywu.github.io/projects/LAB/WFLW.html',
),
keypoint_info={
0:
dict(
name='kpt-0', id=0, color=[255, 255, 255], type='', swap='kpt-32'),
1:
dict(
name='kpt-1', id=1, color=[255, 255, 255], type='', swap='kpt-31'),
2:
dict(
name='kpt-2', id=2, color=[255, 255, 255], type='', swap='kpt-30'),
3:
dict(
name='kpt-3', id=3, color=[255, 255, 255], type='', swap='kpt-29'),
4:
dict(
name='kpt-4', id=4, color=[255, 255, 255], type='', swap='kpt-28'),
5:
dict(
name='kpt-5', id=5, color=[255, 255, 255], type='', swap='kpt-27'),
6:
dict(
name='kpt-6', id=6, color=[255, 255, 255], type='', swap='kpt-26'),
7:
dict(
name='kpt-7', id=7, color=[255, 255, 255], type='', swap='kpt-25'),
8:
dict(
name='kpt-8', id=8, color=[255, 255, 255], type='', swap='kpt-24'),
9:
dict(
name='kpt-9', id=9, color=[255, 255, 255], type='', swap='kpt-23'),
10:
dict(
name='kpt-10',
id=10,
color=[255, 255, 255],
type='',
swap='kpt-22'),
11:
dict(
name='kpt-11',
id=11,
color=[255, 255, 255],
type='',
swap='kpt-21'),
12:
dict(
name='kpt-12',
id=12,
color=[255, 255, 255],
type='',
swap='kpt-20'),
13:
dict(
name='kpt-13',
id=13,
color=[255, 255, 255],
type='',
swap='kpt-19'),
14:
dict(
name='kpt-14',
id=14,
color=[255, 255, 255],
type='',
swap='kpt-18'),
15:
dict(
name='kpt-15',
id=15,
color=[255, 255, 255],
type='',
swap='kpt-17'),
16:
dict(name='kpt-16', id=16, color=[255, 255, 255], type='', swap=''),
17:
dict(
name='kpt-17',
id=17,
color=[255, 255, 255],
type='',
swap='kpt-15'),
18:
dict(
name='kpt-18',
id=18,
color=[255, 255, 255],
type='',
swap='kpt-14'),
19:
dict(
name='kpt-19',
id=19,
color=[255, 255, 255],
type='',
swap='kpt-13'),
20:
dict(
name='kpt-20',
id=20,
color=[255, 255, 255],
type='',
swap='kpt-12'),
21:
dict(
name='kpt-21',
id=21,
color=[255, 255, 255],
type='',
swap='kpt-11'),
22:
dict(
name='kpt-22',
id=22,
color=[255, 255, 255],
type='',
swap='kpt-10'),
23:
dict(
name='kpt-23', id=23, color=[255, 255, 255], type='',
swap='kpt-9'),
24:
dict(
name='kpt-24', id=24, color=[255, 255, 255], type='',
swap='kpt-8'),
25:
dict(
name='kpt-25', id=25, color=[255, 255, 255], type='',
swap='kpt-7'),
26:
dict(
name='kpt-26', id=26, color=[255, 255, 255], type='',
swap='kpt-6'),
27:
dict(
name='kpt-27', id=27, color=[255, 255, 255], type='',
swap='kpt-5'),
28:
dict(
name='kpt-28', id=28, color=[255, 255, 255], type='',
swap='kpt-4'),
29:
dict(
name='kpt-29', id=29, color=[255, 255, 255], type='',
swap='kpt-3'),
30:
dict(
name='kpt-30', id=30, color=[255, 255, 255], type='',
swap='kpt-2'),
31:
dict(
name='kpt-31', id=31, color=[255, 255, 255], type='',
swap='kpt-1'),
32:
dict(
name='kpt-32', id=32, color=[255, 255, 255], type='',
swap='kpt-0'),
33:
dict(
name='kpt-33',
id=33,
color=[255, 255, 255],
type='',
swap='kpt-46'),
34:
dict(
name='kpt-34',
id=34,
color=[255, 255, 255],
type='',
swap='kpt-45'),
35:
dict(
name='kpt-35',
id=35,
color=[255, 255, 255],
type='',
swap='kpt-44'),
36:
dict(
name='kpt-36',
id=36,
color=[255, 255, 255],
type='',
swap='kpt-43'),
37:
dict(
name='kpt-37',
id=37,
color=[255, 255, 255],
type='',
swap='kpt-42'),
38:
dict(
name='kpt-38',
id=38,
color=[255, 255, 255],
type='',
swap='kpt-50'),
39:
dict(
name='kpt-39',
id=39,
color=[255, 255, 255],
type='',
swap='kpt-49'),
40:
dict(
name='kpt-40',
id=40,
color=[255, 255, 255],
type='',
swap='kpt-48'),
41:
dict(
name='kpt-41',
id=41,
color=[255, 255, 255],
type='',
swap='kpt-47'),
42:
dict(
name='kpt-42',
id=42,
color=[255, 255, 255],
type='',
swap='kpt-37'),
43:
dict(
name='kpt-43',
id=43,
color=[255, 255, 255],
type='',
swap='kpt-36'),
44:
dict(
name='kpt-44',
id=44,
color=[255, 255, 255],
type='',
swap='kpt-35'),
45:
dict(
name='kpt-45',
id=45,
color=[255, 255, 255],
type='',
swap='kpt-34'),
46:
dict(
name='kpt-46',
id=46,
color=[255, 255, 255],
type='',
swap='kpt-33'),
47:
dict(
name='kpt-47',
id=47,
color=[255, 255, 255],
type='',
swap='kpt-41'),
48:
dict(
name='kpt-48',
id=48,
color=[255, 255, 255],
type='',
swap='kpt-40'),
49:
dict(
name='kpt-49',
id=49,
color=[255, 255, 255],
type='',
swap='kpt-39'),
50:
dict(
name='kpt-50',
id=50,
color=[255, 255, 255],
type='',
swap='kpt-38'),
51:
dict(name='kpt-51', id=51, color=[255, 255, 255], type='', swap=''),
52:
dict(name='kpt-52', id=52, color=[255, 255, 255], type='', swap=''),
53:
dict(name='kpt-53', id=53, color=[255, 255, 255], type='', swap=''),
54:
dict(name='kpt-54', id=54, color=[255, 255, 255], type='', swap=''),
55:
dict(
name='kpt-55',
id=55,
color=[255, 255, 255],
type='',
swap='kpt-59'),
56:
dict(
name='kpt-56',
id=56,
color=[255, 255, 255],
type='',
swap='kpt-58'),
57:
dict(name='kpt-57', id=57, color=[255, 255, 255], type='', swap=''),
58:
dict(
name='kpt-58',
id=58,
color=[255, 255, 255],
type='',
swap='kpt-56'),
59:
dict(
name='kpt-59',
id=59,
color=[255, 255, 255],
type='',
swap='kpt-55'),
60:
dict(
name='kpt-60',
id=60,
color=[255, 255, 255],
type='',
swap='kpt-72'),
61:
dict(
name='kpt-61',
id=61,
color=[255, 255, 255],
type='',
swap='kpt-71'),
62:
dict(
name='kpt-62',
id=62,
color=[255, 255, 255],
type='',
swap='kpt-70'),
63:
dict(
name='kpt-63',
id=63,
color=[255, 255, 255],
type='',
swap='kpt-69'),
64:
dict(
name='kpt-64',
id=64,
color=[255, 255, 255],
type='',
swap='kpt-68'),
65:
dict(
name='kpt-65',
id=65,
color=[255, 255, 255],
type='',
swap='kpt-75'),
66:
dict(
name='kpt-66',
id=66,
color=[255, 255, 255],
type='',
swap='kpt-74'),
67:
dict(
name='kpt-67',
id=67,
color=[255, 255, 255],
type='',
swap='kpt-73'),
68:
dict(
name='kpt-68',
id=68,
color=[255, 255, 255],
type='',
swap='kpt-64'),
69:
dict(
name='kpt-69',
id=69,
color=[255, 255, 255],
type='',
swap='kpt-63'),
70:
dict(
name='kpt-70',
id=70,
color=[255, 255, 255],
type='',
swap='kpt-62'),
71:
dict(
name='kpt-71',
id=71,
color=[255, 255, 255],
type='',
swap='kpt-61'),
72:
dict(
name='kpt-72',
id=72,
color=[255, 255, 255],
type='',
swap='kpt-60'),
73:
dict(
name='kpt-73',
id=73,
color=[255, 255, 255],
type='',
swap='kpt-67'),
74:
dict(
name='kpt-74',
id=74,
color=[255, 255, 255],
type='',
swap='kpt-66'),
75:
dict(
name='kpt-75',
id=75,
color=[255, 255, 255],
type='',
swap='kpt-65'),
76:
dict(
name='kpt-76',
id=76,
color=[255, 255, 255],
type='',
swap='kpt-82'),
77:
dict(
name='kpt-77',
id=77,
color=[255, 255, 255],
type='',
swap='kpt-81'),
78:
dict(
name='kpt-78',
id=78,
color=[255, 255, 255],
type='',
swap='kpt-80'),
79:
dict(name='kpt-79', id=79, color=[255, 255, 255], type='', swap=''),
80:
dict(
name='kpt-80',
id=80,
color=[255, 255, 255],
type='',
swap='kpt-78'),
81:
dict(
name='kpt-81',
id=81,
color=[255, 255, 255],
type='',
swap='kpt-77'),
82:
dict(
name='kpt-82',
id=82,
color=[255, 255, 255],
type='',
swap='kpt-76'),
83:
dict(
name='kpt-83',
id=83,
color=[255, 255, 255],
type='',
swap='kpt-87'),
84:
dict(
name='kpt-84',
id=84,
color=[255, 255, 255],
type='',
swap='kpt-86'),
85:
dict(name='kpt-85', id=85, color=[255, 255, 255], type='', swap=''),
86:
dict(
name='kpt-86',
id=86,
color=[255, 255, 255],
type='',
swap='kpt-84'),
87:
dict(
name='kpt-87',
id=87,
color=[255, 255, 255],
type='',
swap='kpt-83'),
88:
dict(
name='kpt-88',
id=88,
color=[255, 255, 255],
type='',
swap='kpt-92'),
89:
dict(
name='kpt-89',
id=89,
color=[255, 255, 255],
type='',
swap='kpt-91'),
90:
dict(name='kpt-90', id=90, color=[255, 255, 255], type='', swap=''),
91:
dict(
name='kpt-91',
id=91,
color=[255, 255, 255],
type='',
swap='kpt-89'),
92:
dict(
name='kpt-92',
id=92,
color=[255, 255, 255],
type='',
swap='kpt-88'),
93:
dict(
name='kpt-93',
id=93,
color=[255, 255, 255],
type='',
swap='kpt-95'),
94:
dict(name='kpt-94', id=94, color=[255, 255, 255], type='', swap=''),
95:
dict(
name='kpt-95',
id=95,
color=[255, 255, 255],
type='',
swap='kpt-93'),
96:
dict(
name='kpt-96',
id=96,
color=[255, 255, 255],
type='',
swap='kpt-97'),
97:
dict(
name='kpt-97',
id=97,
color=[255, 255, 255],
type='',
swap='kpt-96')
},
skeleton_info={},
joint_weights=[1.] * 98,
sigmas=[])
-64
View File
@@ -1,64 +0,0 @@
dataset_info = dict(
dataset_name='zebra',
paper_info=dict(
author='Graving, Jacob M and Chae, Daniel and Naik, Hemal and '
'Li, Liang and Koger, Benjamin and Costelloe, Blair R and '
'Couzin, Iain D',
title='DeepPoseKit, a software toolkit for fast and robust '
'animal pose estimation using deep learning',
container='Elife',
year='2019',
homepage='https://github.com/jgraving/DeepPoseKit-Data',
),
keypoint_info={
0:
dict(name='snout', id=0, color=[255, 255, 255], type='', swap=''),
1:
dict(name='head', id=1, color=[255, 255, 255], type='', swap=''),
2:
dict(name='neck', id=2, color=[255, 255, 255], type='', swap=''),
3:
dict(
name='forelegL1',
id=3,
color=[255, 255, 255],
type='',
swap='forelegR1'),
4:
dict(
name='forelegR1',
id=4,
color=[255, 255, 255],
type='',
swap='forelegL1'),
5:
dict(
name='hindlegL1',
id=5,
color=[255, 255, 255],
type='',
swap='hindlegR1'),
6:
dict(
name='hindlegR1',
id=6,
color=[255, 255, 255],
type='',
swap='hindlegL1'),
7:
dict(name='tailbase', id=7, color=[255, 255, 255], type='', swap=''),
8:
dict(name='tailtip', id=8, color=[255, 255, 255], type='', swap='')
},
skeleton_info={
0: dict(link=('head', 'snout'), id=0, color=[255, 255, 255]),
1: dict(link=('neck', 'head'), id=1, color=[255, 255, 255]),
2: dict(link=('forelegL1', 'neck'), id=2, color=[255, 255, 255]),
3: dict(link=('forelegR1', 'neck'), id=3, color=[255, 255, 255]),
4: dict(link=('hindlegL1', 'tailbase'), id=4, color=[255, 255, 255]),
5: dict(link=('hindlegR1', 'tailbase'), id=5, color=[255, 255, 255]),
6: dict(link=('tailbase', 'neck'), id=6, color=[255, 255, 255]),
7: dict(link=('tailtip', 'tailbase'), id=7, color=[255, 255, 255])
},
joint_weights=[1.] * 9,
sigmas=[])
-20
View File
@@ -1,20 +0,0 @@
checkpoint_config = dict(interval=10)
log_config = dict(
interval=50,
hooks=[
dict(type='TextLoggerHook'),
# dict(type='TensorboardLoggerHook')
# dict(type='PaviLoggerHook') # for internal services
])
log_level = 'INFO'
load_from = None
resume_from = None
dist_params = dict(backend='nccl')
workflow = [('train', 1)]
# disable opencv multithreading to avoid system being overloaded
opencv_num_threads = 0
# set multi-process start method as `fork` to speed up the training
mp_start_method = 'fork'
-5
View File
@@ -1,5 +0,0 @@
filter_cfg = dict(
type='GaussianFilter',
window_size=11,
sigma=4.0,
)
-5
View File
@@ -1,5 +0,0 @@
filter_cfg = dict(
type='OneEuroFilter',
min_cutoff=0.004,
beta=0.7,
)
@@ -1,5 +0,0 @@
filter_cfg = dict(
type='SavizkyGolayFilter',
window_size=11,
polyorder=2,
)
@@ -1,45 +0,0 @@
<!-- [OTHERS] -->
<details>
<summary align="right"><a href="https://arxiv.org/abs/2112.13715">SmoothNet (arXiv'2021)</a></summary>
```bibtex
@article{zeng2021smoothnet,
title={SmoothNet: A Plug-and-Play Network for Refining Human Poses in Videos},
author={Zeng, Ailing and Yang, Lei and Ju, Xuan and Li, Jiefeng and Wang, Jianyi and Xu, Qiang},
journal={arXiv preprint arXiv:2112.13715},
year={2021}
}
```
</details>
<!-- [DATASET] -->
<details>
<summary align="right"><a href="https://ieeexplore.ieee.org/abstract/document/6682899/">Human3.6M (TPAMI'2014)</a></summary>
```bibtex
@article{h36m_pami,
author = {Ionescu, Catalin and Papava, Dragos and Olaru, Vlad and Sminchisescu, Cristian},
title = {Human3.6M: Large Scale Datasets and Predictive Methods for 3D Human Sensing in Natural Environments},
journal = {IEEE Transactions on Pattern Analysis and Machine Intelligence},
publisher = {IEEE Computer Society},
volume = {36},
number = {7},
pages = {1325-1339},
month = {jul},
year = {2014}
}
```
</details>
The following SmoothNet model checkpoints are available for pose smoothing. The table shows the the performance of [SimpleBaseline3D](https://arxiv.org/abs/1705.03098) on [Human3.6M](https://ieeexplore.ieee.org/abstract/document/6682899/) dataset without/with the SmoothNet plugin, and compares the SmoothNet models with 4 different window sizes (8, 16, 32 and 64). The metrics are MPJPE(mm), P-MEJPE(mm) and Acceleration Error (mm/frame^2).
| Arch | Window Size | MPJPE<sup>w/o</sup> | MPJPE<sup>w</sup> | P-MPJPE<sup>w/o</sup> | P-MPJPE<sup>w</sup> | AC. Err<sup>w/o</sup> | AC. Err<sup>w</sup> | ckpt |
| :----------------------------------- | :---------: | :-----------------: | :---------------: | :-------------------: | :-----------------: | :-------------------: | :-----------------: | :-----------------------------------: |
| [smoothnet_ws8](/configs/_base_/filters/smoothnet_t8_h36m.py) | 8 | 54.48 | 53.15 | 42.20 | 41.32 | 19.18 | 1.87 | [ckpt](https://download.openmmlab.com/mmpose/plugin/smoothnet/smoothnet_ws8_h36m.pth) |
| [smoothnet_ws16](/configs/_base_/filters/smoothnet_t16_h36m.py) | 16 | 54.48 | 52.74 | 42.20 | 41.20 | 19.18 | 1.22 | [ckpt](https://download.openmmlab.com/mmpose/plugin/smoothnet/smoothnet_ws16_h36m.pth) |
| [smoothnet_ws32](/configs/_base_/filters/smoothnet_t32_h36m.py) | 32 | 54.48 | 52.47 | 42.20 | 40.84 | 19.18 | 0.99 | [ckpt](https://download.openmmlab.com/mmpose/plugin/smoothnet/smoothnet_ws32_h36m.pth) |
| [smoothnet_ws64](/configs/_base_/filters/smoothnet_t64_h36m.py) | 64 | 54.48 | 53.37 | 42.20 | 40.77 | 19.18 | 0.92 | [ckpt](https://download.openmmlab.com/mmpose/plugin/smoothnet/smoothnet_ws64_h36m.pth) |
@@ -1,13 +0,0 @@
# Config for SmoothNet filter trained on Human3.6M data with a window size of
# 16. The model is trained using root-centered keypoint coordinates around the
# pelvis (index:0), thus we set root_index=0 for the filter
filter_cfg = dict(
type='SmoothNetFilter',
window_size=16,
output_size=16,
checkpoint='https://download.openmmlab.com/mmpose/plugin/smoothnet/'
'smoothnet_ws16_h36m.pth',
hidden_size=512,
res_hidden_size=256,
num_blocks=3,
root_index=0)
@@ -1,13 +0,0 @@
# Config for SmoothNet filter trained on Human3.6M data with a window size of
# 32. The model is trained using root-centered keypoint coordinates around the
# pelvis (index:0), thus we set root_index=0 for the filter
filter_cfg = dict(
type='SmoothNetFilter',
window_size=32,
output_size=32,
checkpoint='https://download.openmmlab.com/mmpose/plugin/smoothnet/'
'smoothnet_ws32_h36m.pth',
hidden_size=512,
res_hidden_size=256,
num_blocks=3,
root_index=0)
@@ -1,13 +0,0 @@
# Config for SmoothNet filter trained on Human3.6M data with a window size of
# 64. The model is trained using root-centered keypoint coordinates around the
# pelvis (index:0), thus we set root_index=0 for the filter
filter_cfg = dict(
type='SmoothNetFilter',
window_size=64,
output_size=64,
checkpoint='https://download.openmmlab.com/mmpose/plugin/smoothnet/'
'smoothnet_ws64_h36m.pth',
hidden_size=512,
res_hidden_size=256,
num_blocks=3,
root_index=0)
@@ -1,13 +0,0 @@
# Config for SmoothNet filter trained on Human3.6M data with a window size of
# 8. The model is trained using root-centered keypoint coordinates around the
# pelvis (index:0), thus we set root_index=0 for the filter
filter_cfg = dict(
type='SmoothNetFilter',
window_size=8,
output_size=8,
checkpoint='https://download.openmmlab.com/mmpose/plugin/smoothnet/'
'smoothnet_ws8_h36m.pth',
hidden_size=512,
res_hidden_size=256,
num_blocks=3,
root_index=0)
-66
View File
@@ -1,66 +0,0 @@
import os
import os.path as osp
import sys
import datetime
from mmengine.config import Config as MMConfig
class Config:
def get_config_fromfile(self, config_path):
self.config_path = config_path
cfg = MMConfig.fromfile(self.config_path)
self.__dict__.update(dict(cfg))
# update dir
self.cur_dir = osp.dirname(os.path.abspath(__file__))
self.root_dir = osp.join(self.cur_dir, '..')
self.data_dir = osp.join(self.root_dir, 'dataset')
self.human_model_path = osp.join(self.root_dir, 'common', 'utils', 'human_model_files')
## add some paths to the system root dir
sys.path.insert(0, osp.join(self.root_dir, 'common'))
def prepare_dirs(self, exp_name):
time_str = datetime.datetime.now().strftime('%Y%m%d_%H%M%S')
self.output_dir = osp.join(self.root_dir, f'{exp_name}_{time_str}')
self.model_dir = osp.join(self.output_dir, 'model_dump')
self.vis_dir = osp.join(self.output_dir, 'vis')
self.log_dir = osp.join(self.output_dir, 'log')
self.code_dir = osp.join(self.output_dir, 'code')
self.result_dir = osp.join(self.output_dir, 'result')
from utils.dir import make_folder
make_folder(self.model_dir)
make_folder(self.vis_dir)
make_folder(self.log_dir)
make_folder(self.code_dir)
make_folder(self.result_dir)
## copy some code to log dir as a backup
copy_files = ['main/train.py', 'main/test.py', 'common/base.py',
'common/nets', 'main/SMPLer_X.py',
'data/dataset.py', 'data/MSCOCO/MSCOCO.py', 'data/AGORA/AGORA.py']
for file in copy_files:
os.system(f'cp -r {self.root_dir}/{file} {self.code_dir}')
def update_test_config(self, testset, agora_benchmark, shapy_eval_split, pretrained_model_path, use_cache,
eval_on_train=False, vis=False):
self.testset = testset
self.agora_benchmark = agora_benchmark
self.pretrained_model_path = pretrained_model_path
self.shapy_eval_split = shapy_eval_split
self.use_cache = use_cache
self.eval_on_train = eval_on_train
self.vis = vis
def update_config(self, num_gpus, pretrained_model_path, output_folder, device):
self.num_gpus = num_gpus
self.pretrained_model_path = pretrained_model_path
self.log_dir = output_folder
self.device = device
# Save
cfg_save = MMConfig(self.__dict__)
cfg = Config()
-112
View File
@@ -1,112 +0,0 @@
import os
import os.path as osp
# will be update in exp
num_gpus = -1
exp_name = 'output/exp1/pre_analysis'
# quick access
save_epoch = 1
lr = 1e-5
end_epoch = 10
train_batch_size = 32
syncbn = True
bbox_ratio = 1.2
# continue
continue_train = False
start_over = True
# dataset setting
agora_fix_betas = True
agora_fix_global_orient_transl = True
agora_valid_root_pose = True
# all
dataset_list = ['Human36M', 'MSCOCO', 'MPII', 'AGORA', 'EHF', 'SynBody', 'GTA_Human2', \
'EgoBody_Egocentric', 'EgoBody_Kinect', 'UBody', 'PW3D', 'MuCo', 'PROX']
trainset_3d = ['MSCOCO','AGORA', 'UBody']
trainset_2d = ['PW3D', 'MPII', 'Human36M']
trainset_humandata = ['BEDLAM', 'SPEC', 'GTA_Human2','SynBody', 'PoseTrack',
'EgoBody_Egocentric', 'PROX', 'CrowdPose',
'EgoBody_Kinect', 'MPI_INF_3DHP', 'RICH', 'MuCo', 'InstaVariety',
'Behave', 'UP3D', 'ARCTIC',
'OCHuman', 'CHI3D', 'RenBody_HiRes', 'MTP', 'HumanSC3D', 'RenBody',
'FIT3D', 'Talkshow' , 'SSP3D', 'LSPET']
testset = 'EHF'
use_cache = True
# downsample
BEDLAM_train_sample_interval = 5
EgoBody_Kinect_train_sample_interval = 10
train_sample_interval = 10 # UBody
MPI_INF_3DHP_train_sample_interval = 5
InstaVariety_train_sample_interval = 10
RenBody_HiRes_train_sample_interval = 5
ARCTIC_train_sample_interval = 10
# RenBody_train_sample_interval = 10
FIT3D_train_sample_interval = 10
Talkshow_train_sample_interval = 10
# strategy
data_strategy = 'balance' # 'balance' need to define total_data_len
total_data_len = 4500000
# model
smplx_loss_weight = 1.0 #2 for agora_model for smplx shape
smplx_pose_weight = 10.0
smplx_kps_3d_weight = 100.0
smplx_kps_2d_weight = 1.0
net_kps_2d_weight = 1.0
agora_benchmark = 'agora_model' # 'agora_model', 'test_only'
model_type = 'smpler_x_b'
encoder_config_file = 'main/transformer_utils/configs/smpler_x/encoder/body_encoder_base.py'
encoder_pretrained_model_path = 'pretrained_models/vitpose_base.pth'
feat_dim = 768
## =====FIXED ARGS============================================================
## model setting
upscale = 4
hand_pos_joint_num = 20
face_pos_joint_num = 72
num_task_token = 24
num_noise_sample = 0
## UBody setting
train_sample_interval = 10
test_sample_interval = 100
make_same_len = False
## input, output size
input_img_shape = (512, 384)
input_body_shape = (256, 192)
output_hm_shape = (16, 16, 12)
input_hand_shape = (256, 256)
output_hand_hm_shape = (16, 16, 16)
output_face_hm_shape = (8, 8, 8)
input_face_shape = (192, 192)
focal = (5000, 5000) # virtual focal lengths
princpt = (input_body_shape[1] / 2, input_body_shape[0] / 2) # virtual principal point position
body_3d_size = 2
hand_3d_size = 0.3
face_3d_size = 0.3
camera_3d_size = 2.5
## training config
print_iters = 100
lr_mult = 1
## testing config
test_batch_size = 32
## others
num_thread = 2
vis = False
## directory
output_dir, model_dir, vis_dir, log_dir, result_dir, code_dir = None, None, None, None, None, None
-111
View File
@@ -1,111 +0,0 @@
import os
import os.path as osp
# will be update in exp
num_gpus = -1
exp_name = 'output/exp1/pre_analysis'
# quick access
save_epoch = 1
lr = 1e-5
end_epoch = 10
train_batch_size = 16
syncbn = True
bbox_ratio = 1.2
# continue
continue_train = False
start_over = True
# dataset setting
agora_fix_betas = True
agora_fix_global_orient_transl = True
agora_valid_root_pose = True
# all
dataset_list = ['Human36M', 'MSCOCO', 'MPII', 'AGORA', 'EHF', 'SynBody', 'GTA_Human2', \
'EgoBody_Egocentric', 'EgoBody_Kinect', 'UBody', 'PW3D', 'MuCo', 'PROX']
trainset_3d = ['MSCOCO','AGORA', 'UBody']
trainset_2d = ['PW3D', 'MPII', 'Human36M']
trainset_humandata = ['BEDLAM', 'SPEC', 'GTA_Human2','SynBody', 'PoseTrack',
'EgoBody_Egocentric', 'PROX', 'CrowdPose',
'EgoBody_Kinect', 'MPI_INF_3DHP', 'RICH', 'MuCo', 'InstaVariety',
'Behave', 'UP3D', 'ARCTIC',
'OCHuman', 'CHI3D', 'RenBody_HiRes', 'MTP', 'HumanSC3D', 'RenBody',
'FIT3D', 'Talkshow' , 'SSP3D', 'LSPET']
testset = 'EHF'
use_cache = True
# downsample
BEDLAM_train_sample_interval = 5
EgoBody_Kinect_train_sample_interval = 10
train_sample_interval = 10 # UBody
MPI_INF_3DHP_train_sample_interval = 5
InstaVariety_train_sample_interval = 10
RenBody_HiRes_train_sample_interval = 5
ARCTIC_train_sample_interval = 10
# RenBody_train_sample_interval = 10
FIT3D_train_sample_interval = 10
Talkshow_train_sample_interval = 10
# strategy
data_strategy = 'balance' # 'balance' need to define total_data_len
total_data_len = 4500000
# model
smplx_loss_weight = 1.0 #2 for agora_model for smplx shape
smplx_pose_weight = 10.0
smplx_kps_3d_weight = 100.0
smplx_kps_2d_weight = 1.0
net_kps_2d_weight = 1.0
agora_benchmark = 'agora_model' # 'agora_model', 'test_only'
model_type = 'smpler_x_h'
encoder_config_file = 'main/transformer_utils/configs/smpler_x/encoder/body_encoder_huge.py'
encoder_pretrained_model_path = 'pretrained_models/vitpose_huge.pth'
feat_dim = 1280
## =====FIXED ARGS============================================================
## model setting
upscale = 4
hand_pos_joint_num = 20
face_pos_joint_num = 72
num_task_token = 24
num_noise_sample = 0
## UBody setting
train_sample_interval = 10
test_sample_interval = 100
make_same_len = False
## input, output size
input_img_shape = (512, 384)
input_body_shape = (256, 192)
output_hm_shape = (16, 16, 12)
input_hand_shape = (256, 256)
output_hand_hm_shape = (16, 16, 16)
output_face_hm_shape = (8, 8, 8)
input_face_shape = (192, 192)
focal = (5000, 5000) # virtual focal lengths
princpt = (input_body_shape[1] / 2, input_body_shape[0] / 2) # virtual principal point position
body_3d_size = 2
hand_3d_size = 0.3
face_3d_size = 0.3
camera_3d_size = 2.5
## training config
print_iters = 100
lr_mult = 1
## testing config
test_batch_size = 32
## others
num_thread = 2
vis = False
## directory
output_dir, model_dir, vis_dir, log_dir, result_dir, code_dir = None, None, None, None, None, None
-112
View File
@@ -1,112 +0,0 @@
import os
import os.path as osp
# will be update in exp
num_gpus = -1
exp_name = 'output/exp1/pre_analysis'
# quick access
save_epoch = 1
lr = 1e-5
end_epoch = 10
train_batch_size = 32
syncbn = True
bbox_ratio = 1.2
# continue
continue_train = False
start_over = True
# dataset setting
agora_fix_betas = True
agora_fix_global_orient_transl = True
agora_valid_root_pose = True
# all
dataset_list = ['Human36M', 'MSCOCO', 'MPII', 'AGORA', 'EHF', 'SynBody', 'GTA_Human2', \
'EgoBody_Egocentric', 'EgoBody_Kinect', 'UBody', 'PW3D', 'MuCo', 'PROX']
trainset_3d = ['MSCOCO','AGORA', 'UBody']
trainset_2d = ['PW3D', 'MPII', 'Human36M']
trainset_humandata = ['BEDLAM', 'SPEC', 'GTA_Human2','SynBody', 'PoseTrack',
'EgoBody_Egocentric', 'PROX', 'CrowdPose',
'EgoBody_Kinect', 'MPI_INF_3DHP', 'RICH', 'MuCo', 'InstaVariety',
'Behave', 'UP3D', 'ARCTIC',
'OCHuman', 'CHI3D', 'RenBody_HiRes', 'MTP', 'HumanSC3D', 'RenBody',
'FIT3D', 'Talkshow' , 'SSP3D', 'LSPET']
testset = 'EHF'
use_cache = True
# downsample
BEDLAM_train_sample_interval = 5
EgoBody_Kinect_train_sample_interval = 10
train_sample_interval = 10 # UBody
MPI_INF_3DHP_train_sample_interval = 5
InstaVariety_train_sample_interval = 10
RenBody_HiRes_train_sample_interval = 5
ARCTIC_train_sample_interval = 10
# RenBody_train_sample_interval = 10
FIT3D_train_sample_interval = 10
Talkshow_train_sample_interval = 10
# strategy
data_strategy = 'balance' # 'balance' need to define total_data_len
total_data_len = 4500000
# model
smplx_loss_weight = 1.0 #2 for agora_model for smplx shape
smplx_pose_weight = 10.0
smplx_kps_3d_weight = 100.0
smplx_kps_2d_weight = 1.0
net_kps_2d_weight = 1.0
agora_benchmark = 'agora_model' # 'agora_model', 'test_only'
model_type = 'smpler_x_l'
encoder_config_file = 'main/transformer_utils/configs/smpler_x/encoder/body_encoder_large.py'
encoder_pretrained_model_path = 'pretrained_models/vitpose_large.pth'
feat_dim = 1024
## =====FIXED ARGS============================================================
## model setting
upscale = 4
hand_pos_joint_num = 20
face_pos_joint_num = 72
num_task_token = 24
num_noise_sample = 0
## UBody setting
train_sample_interval = 10
test_sample_interval = 100
make_same_len = False
## input, output size
input_img_shape = (512, 384)
input_body_shape = (256, 192)
output_hm_shape = (16, 16, 12)
input_hand_shape = (256, 256)
output_hand_hm_shape = (16, 16, 16)
output_face_hm_shape = (8, 8, 8)
input_face_shape = (192, 192)
focal = (5000, 5000) # virtual focal lengths
princpt = (input_body_shape[1] / 2, input_body_shape[0] / 2) # virtual principal point position
body_3d_size = 2
hand_3d_size = 0.3
face_3d_size = 0.3
camera_3d_size = 2.5
## training config
print_iters = 100
lr_mult = 1
## testing config
test_batch_size = 32
## others
num_thread = 2
vis = False
## directory
output_dir, model_dir, vis_dir, log_dir, result_dir, code_dir = None, None, None, None, None, None
-111
View File
@@ -1,111 +0,0 @@
import os
import os.path as osp
# will be update in exp
num_gpus = -1
exp_name = 'output/exp1/pre_analysis'
# quick access
save_epoch = 1
lr = 1e-5
end_epoch = 10
train_batch_size = 32
syncbn = True
bbox_ratio = 1.2
# continue
continue_train = False
start_over = True
# dataset setting
agora_fix_betas = True
agora_fix_global_orient_transl = True
agora_valid_root_pose = True
# all data
dataset_list = ['Human36M', 'MSCOCO', 'MPII', 'AGORA', 'EHF', 'SynBody', 'GTA_Human2', \
'EgoBody_Egocentric', 'EgoBody_Kinect', 'UBody', 'PW3D', 'MuCo', 'PROX']
trainset_3d = ['MSCOCO','AGORA', 'UBody']
trainset_2d = ['PW3D', 'MPII', 'Human36M']
trainset_humandata = ['BEDLAM', 'SPEC', 'GTA_Human2','SynBody', 'PoseTrack',
'EgoBody_Egocentric', 'PROX', 'CrowdPose',
'EgoBody_Kinect', 'MPI_INF_3DHP', 'RICH', 'MuCo', 'InstaVariety',
'Behave', 'UP3D', 'ARCTIC',
'OCHuman', 'CHI3D', 'RenBody_HiRes', 'MTP', 'HumanSC3D', 'RenBody',
'FIT3D', 'Talkshow' , 'SSP3D', 'LSPET']
testset = 'EHF'
use_cache = True
# downsample
BEDLAM_train_sample_interval = 5
EgoBody_Kinect_train_sample_interval = 10
train_sample_interval = 10 # UBody
MPI_INF_3DHP_train_sample_interval = 5
InstaVariety_train_sample_interval = 10
RenBody_HiRes_train_sample_interval = 5
ARCTIC_train_sample_interval = 10
# RenBody_train_sample_interval = 10
FIT3D_train_sample_interval = 10
Talkshow_train_sample_interval = 10
# strategy
data_strategy = 'balance' # 'balance' need to define total_data_len
total_data_len = 4500000
# model
smplx_loss_weight = 1.0 #2 for agora_model for smplx shape
smplx_pose_weight = 10.0
smplx_kps_3d_weight = 100.0
smplx_kps_2d_weight = 1.0
net_kps_2d_weight = 1.0
agora_benchmark = 'agora_model' # 'agora_model', 'test_only'
model_type = 'smpler_x_s'
encoder_config_file = 'main/transformer_utils/configs/smpler_x/encoder/body_encoder_small.py'
encoder_pretrained_model_path = 'pretrained_models/vitpose_small.pth'
feat_dim = 384
## =====FIXED ARGS============================================================
## model setting
upscale = 4
hand_pos_joint_num = 20
face_pos_joint_num = 72
num_task_token = 24
num_noise_sample = 0
## UBody setting
train_sample_interval = 10
test_sample_interval = 100
make_same_len = False
## input, output size
input_img_shape = (512, 384)
input_body_shape = (256, 192)
output_hm_shape = (16, 16, 12)
input_hand_shape = (256, 256)
output_hand_hm_shape = (16, 16, 16)
output_face_hm_shape = (8, 8, 8)
input_face_shape = (192, 192)
focal = (5000, 5000) # virtual focal lengths
princpt = (input_body_shape[1] / 2, input_body_shape[0] / 2) # virtual principal point position
body_3d_size = 2
hand_3d_size = 0.3
face_3d_size = 0.3
camera_3d_size = 2.5
## training config
print_iters = 100
lr_mult = 1
## testing config
test_batch_size = 32
## others
num_thread = 2
vis = False
## directory
output_dir, model_dir, vis_dir, log_dir, result_dir, code_dir = None, None, None, None, None, None
-137
View File
@@ -1,137 +0,0 @@
import os
import sys
import os.path as osp
import argparse
import numpy as np
import torchvision.transforms as transforms
import torch.backends.cudnn as cudnn
import torch
CUR_DIR = osp.dirname(os.path.abspath(__file__))
sys.path.insert(0, osp.join(CUR_DIR, '..', 'main'))
sys.path.insert(0, osp.join(CUR_DIR , '..', 'common'))
from config import cfg
import cv2
from tqdm import tqdm
import json
from typing import Literal, Union
from mmdet.apis import init_detector, inference_detector
from utils.inference_utils import process_mmdet_results, non_max_suppression
class Inferer:
def __init__(self, pretrained_model, num_gpus, output_folder):
self.output_folder = output_folder
self.device = torch.device('cuda') if (num_gpus > 0) else torch.device('cpu')
config_path = osp.join(CUR_DIR, './config', f'config_{pretrained_model}.py')
ckpt_path = osp.join(CUR_DIR, '../pretrained_models', f'{pretrained_model}.pth.tar')
cfg.get_config_fromfile(config_path)
cfg.update_config(num_gpus, ckpt_path, output_folder, self.device)
self.cfg = cfg
cudnn.benchmark = True
# load model
from base import Demoer
demoer = Demoer()
demoer._make_model()
demoer.model.eval()
self.demoer = demoer
checkpoint_file = osp.join(CUR_DIR, '../pretrained_models/mmdet/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth')
config_file= osp.join(CUR_DIR, '../pretrained_models/mmdet/mmdet_faster_rcnn_r50_fpn_coco.py')
model = init_detector(config_file, checkpoint_file, device=self.device) # or device='cuda:0'
self.model = model
def infer(self, original_img, iou_thr, frame, multi_person=False, mesh_as_vertices=False):
from utils.preprocessing import process_bbox, generate_patch_image
# from utils.vis import render_mesh, save_obj
from utils.human_models import smpl_x
mesh_paths = []
smplx_paths = []
# prepare input image
transform = transforms.ToTensor()
vis_img = original_img.copy()
original_img_height, original_img_width = original_img.shape[:2]
## mmdet inference
mmdet_results = inference_detector(self.model, original_img)
pred_instance = mmdet_results.pred_instances.cpu().numpy()
bboxes = np.concatenate(
(pred_instance.bboxes, pred_instance.scores[:, None]), axis=1)
bboxes = bboxes[pred_instance.labels == 0]
bboxes = np.expand_dims(bboxes, axis=0)
mmdet_box = process_mmdet_results(bboxes, cat_id=0, multi_person=True)
# save original image if no bbox
if len(mmdet_box[0])<1:
return original_img, [], []
# if not multi_person:
# only select the largest bbox
num_bbox = 1
mmdet_box = mmdet_box[0]
# else:
# # keep bbox by NMS with iou_thr
# mmdet_box = non_max_suppression(mmdet_box[0], iou_thr)
# num_bbox = len(mmdet_box)
## loop all detected bboxes
for bbox_id in range(num_bbox):
mmdet_box_xywh = np.zeros((4))
mmdet_box_xywh[0] = mmdet_box[bbox_id][0]
mmdet_box_xywh[1] = mmdet_box[bbox_id][1]
mmdet_box_xywh[2] = abs(mmdet_box[bbox_id][2]-mmdet_box[bbox_id][0])
mmdet_box_xywh[3] = abs(mmdet_box[bbox_id][3]-mmdet_box[bbox_id][1])
# skip small bboxes by bbox_thr in pixel
if mmdet_box_xywh[2] < 50 or mmdet_box_xywh[3] < 150:
continue
bbox = process_bbox(mmdet_box_xywh, original_img_width, original_img_height)
img, img2bb_trans, bb2img_trans = generate_patch_image(original_img, bbox, 1.0, 0.0, False, self.cfg.input_img_shape)
img = transform(img.astype(np.float32))/255
img = img.to(cfg.device)[None,:,:,:]
inputs = {'img': img}
targets = {}
meta_info = {}
# mesh recovery
with torch.no_grad():
out = self.demoer.model(inputs, targets, meta_info, 'test')
# mesh = out['smplx_mesh_cam'].detach().cpu().numpy()[0]
## save mesh
# save_path_mesh = os.path.join(self.output_folder, 'mesh')
# os.makedirs(save_path_mesh, exist_ok= True)
# obj_path = os.path.join(save_path_mesh, f'{frame:05}_{bbox_id}.obj')
# save_obj(mesh, smpl_x.face, obj_path)
# mesh_paths.append(obj_path)
## save single person param
smplx_pred = {}
smplx_pred['global_orient'] = out['smplx_root_pose'].reshape(-1,3).cpu().numpy()
smplx_pred['body_pose'] = out['smplx_body_pose'].reshape(-1,3).cpu().numpy()
smplx_pred['left_hand_pose'] = out['smplx_lhand_pose'].reshape(-1,3).cpu().numpy()
smplx_pred['right_hand_pose'] = out['smplx_rhand_pose'].reshape(-1,3).cpu().numpy()
smplx_pred['jaw_pose'] = out['smplx_jaw_pose'].reshape(-1,3).cpu().numpy()
smplx_pred['leye_pose'] = np.zeros((1, 3))
smplx_pred['reye_pose'] = np.zeros((1, 3))
smplx_pred['betas'] = out['smplx_shape'].reshape(-1,10).cpu().numpy()
smplx_pred['expression'] = out['smplx_expr'].reshape(-1,10).cpu().numpy()
smplx_pred['transl'] = out['cam_trans'].reshape(-1,3).cpu().numpy()
save_path_smplx = os.path.join(self.output_folder, 'smplx')
os.makedirs(save_path_smplx, exist_ok= True)
npz_path = os.path.join(save_path_smplx, f'{frame:05}_{bbox_id}.npz')
np.savez(npz_path, **smplx_pred)
smplx_paths.append(npz_path)
## render single person mesh
# focal = [self.cfg.focal[0] / self.cfg.input_body_shape[1] * bbox[2], self.cfg.focal[1] / self.cfg.input_body_shape[0] * bbox[3]]
# princpt = [self.cfg.princpt[0] / self.cfg.input_body_shape[1] * bbox[2] + bbox[0], self.cfg.princpt[1] / self.cfg.input_body_shape[0] * bbox[3] + bbox[1]]
# vis_img = render_mesh(vis_img, mesh, smpl_x.face, {'focal': focal, 'princpt': princpt},
# mesh_as_vertices=mesh_as_vertices)
# vis_img = vis_img.astype('uint8')
vis_img = None
mesh_paths = None
return vis_img, mesh_paths, smplx_paths
-141
View File
@@ -1,141 +0,0 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
**/*.pyc
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/en/_build
docs/zh_cn/_build
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
# custom
mmpose/.mim
/models
/data
.vscode
.idea
*.pkl
*.pkl.json
*.log.json
*.npy
work_dirs/
docs/**/topics/
docs/**/papers/*.md
docs/**/datasets.md
docs/**/modelzoo.md
!tests/data/**/*.pkl
!tests/data/**/*.pkl.json
!tests/data/**/*.log.json
!tests/data/**/*.pth
!tests/data/**/*.npy
# Pytorch
*.pth
*.DS_Store
# checkpoints
ckpts/
vis_results
vis_results_poseur
scripts
@@ -1,8 +0,0 @@
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- name: "Poseur Contributors"
title: "Poseur: Direct Human Pose Regression with Transformers"
date-released: 2022-07-21
url: "https://github.com/aim-uofa/Poseur"
license: 2-clause BSD
-677
View File
@@ -1,677 +0,0 @@
Poseur for non-commercial purposes
(For commercial use, contact chhshen@gmail.com for obtaining a commerical license.)
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
@@ -1,5 +0,0 @@
include requirements/*.txt
include mmpose/.mim/model-index.yml
recursive-include mmpose/.mim/configs *.py *.yml
recursive-include mmpose/.mim/tools *.py *.sh
recursive-include mmpose/.mim/demo *.py
-80
View File
@@ -1,80 +0,0 @@
# Poseur: Direct Human Pose Regression with Transformers
> [**Poseur: Direct Human Pose Regression with Transformers**](https://arxiv.org/pdf/2201.07412.pdf),
> Weian Mao\*, Yongtao Ge\*, Chunhua Shen, Zhi Tian, Xinlong Wang, Zhibin Wang, Anton van den Hengel
> In: European Conference on Computer Vision (ECCV), 2022
> *arXiv preprint ([arXiv 2201.07412](https://arxiv.org/pdf/2201.07412))*
> (\* equal contribution)
# Introduction
This is a preview for Poseur, which currently including Poseur with R-50 backbone for both training and inference. More models with various backbones will be released soon. This project is bulit upon [MMPose](https://github.com/open-mmlab/mmpose) with commit ID [eeebc652842a9724259ed345c00112641d8ee06d](https://github.com/open-mmlab/mmpose/commit/eeebc652842a9724259ed345c00112641d8ee06d).
# Installation & Quick Start
1. Install following packages
```
pip install easydict einops
```
2. Follow the [MMPose instruction](mmpose_README.md) to install the project and set up the datasets (MS-COCO).
For training on COCO, run:
```
./tools/dist_train.sh \
configs/body/2d_kpt_sview_rgb_img/poseur/coco/poseur_res50_coco_256x192.py 8 \
--work-dir work_dirs/poseur_res50_coco_256x192
```
For evaluating on COCO, run the following command lines:
```
wget https://cloudstor.aarnet.edu.au/plus/s/UXr1Dn9w6ja4fM9/download -O poseur_256x192_r50_6dec_coco.pth
./tools/dist_test.sh configs/body/2d_kpt_sview_rgb_img/poseur/coco/poseur_res50_coco_256x192.py \
poseur_256x192_r50_6dec_coco.pth 4 \
--eval mAP \
--cfg-options model.filp_fuse_type=\'type2\'
```
For visualizing on COCO, run the following command lines:
```
python demo/top_down_img_demo.py \
configs/body/2d_kpt_sview_rgb_img/poseur/coco/poseur_res50_coco_256x192.py \
poseur_256x192_r50_6dec_coco.pth \
--img-root tests/data/coco/ --json-file tests/data/coco/test_coco.json \
--out-img-root vis_results_poseur
```
## Models
### COCO Keypoint Detection Results
Name | AP | AP.5| AP.75 |download
--- |:---:|:---:|:---:|:---:
[poseur_mobilenetv2_coco_256x192](configs/body/2d_kpt_sview_rgb_img/poseur/coco/poseur_mobilenetv2_coco_256x192.py)| 71.9 | 88.9 |78.6 | [model](https://cloudstor.aarnet.edu.au/plus/s/L198TFFqwWYsSop/download)
[poseur_mobilenetv2_coco_256x192_12dec](configs/body/2d_kpt_sview_rgb_img/poseur/coco/poseur_mobilenetv2_coco_256x192_12dec.py)| 72.3 | 88.9 |78.9 | [model](https://cloudstor.aarnet.edu.au/plus/s/sw0II7qSQDjJ88h/download)
[poseur_res50_coco_256x192](configs/body/2d_kpt_sview_rgb_img/poseur/coco/poseur_res50_coco_256x192.py)| 75.5 | 90.7 |82.6 | [model](https://cloudstor.aarnet.edu.au/plus/s/UXr1Dn9w6ja4fM9/download)
[poseur_hrnet_w32_coco_256x192](configs/body/2d_kpt_sview_rgb_img/poseur/coco/poseur_hrnet_w32_coco_256x192.py)| 76.8 | 91.0 |83.5 | [model](https://cloudstor.aarnet.edu.au/plus/s/xMvCnp5lb2MR7S4/download)
[poseur_hrnet_w48_coco_384x288](configs/body/2d_kpt_sview_rgb_img/poseur/coco/poseur_hrnet_w48_coco_384x288.py)| 78.7 | 91.6 |85.1 | [model](https://cloudstor.aarnet.edu.au/plus/s/IGXy98TZlJYerNc/download)
[poseur_hrformer_tiny_coco_256x192_3dec](configs/body/2d_kpt_sview_rgb_img/poseur/coco/poseur_hrformer_tiny_coco_256x192_3dec.py)| 74.2 | 90.1 |81.4 | [model](https://cloudstor.aarnet.edu.au/plus/s/CpGYghZQX3mv32i/download)
[poseur_hrformer_small_coco_256x192_3dec](configs/body/2d_kpt_sview_rgb_img/poseur/coco/poseur_hrformer_small_coco_256x192_3dec.py)| 76.6 | 91.0 |83.4 | [model](https://cloudstor.aarnet.edu.au/plus/s/rK2s3fdrpeP9k6l/download)
[poseur_hrformer_big_coco_256x192](configs/body/2d_kpt_sview_rgb_img/poseur/coco/poseur_hrformer_big_coco_256x192.py)| 78.9 | 91.9 |85.6 | [model](https://cloudstor.aarnet.edu.au/plus/s/34udjbTr9p9Aigo/download)
[poseur_hrformer_big_coco_384x288](configs/body/2d_kpt_sview_rgb_img/poseur/coco/poseur_hrformer_big_coco_384x288.py)| 79.6 | 92.1 |85.9 | [model](https://cloudstor.aarnet.edu.au/plus/s/KST3aSAlGd8PJpQ/download)
*Disclaimer:*
- Due to the update of MMPose, the results are slightly different from our original paper.
- We use the official HRFormer implement from [here](https://github.com/HRNet/HRFormer/tree/main/pose), the implementation in mmpose has not been verified by us.
# Citations
Please consider citing our papers in your publications if the project helps your research. BibTeX reference is as follows.
```BibTeX
@inproceedings{mao2022poseur,
title={Poseur: Direct human pose regression with transformers},
author={Mao, Weian and Ge, Yongtao and Shen, Chunhua and Tian, Zhi and Wang, Xinlong and Wang, Zhibin and Hengel, Anton van den},
journal = {Proceedings of the European Conference on Computer Vision {(ECCV)}},
month = {October},
year={2022}
}
```
## License
For commercial use, please contact [Chunhua Shen](mailto:chhshen@gmail.com).

Some files were not shown because too many files have changed in this diff Show More