Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test #325

Closed
wants to merge 34 commits into from
Closed

Test #325

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4ded5cb
add cliff head
oneScotch Jan 18, 2023
2a4b793
add function to convert from crop to full camera
oneScotch Jan 18, 2023
8b896bc
add cliff annotation datasets converter
oneScotch Jan 18, 2023
e0da7ed
add tramsforms to get bbox information
oneScotch Jan 18, 2023
a0152b0
store crop trans
oneScotch Jan 18, 2023
0f2dc25
cliff mesh estimator
oneScotch Jan 18, 2023
a23a047
modification to take in different resolutions
oneScotch Jan 18, 2023
fad7b65
add configs
oneScotch Jan 18, 2023
ee5fa82
add missing comma
oneScotch Jan 19, 2023
17c617a
format correction
oneScotch Jan 19, 2023
8d85fa9
isort formating
oneScotch Feb 3, 2023
e233a8c
correct error in cliff_head
oneScotch Feb 14, 2023
62ee755
revert unnecessary changes in cliff_head
oneScotch Feb 15, 2023
4e0f3b9
add configs(single dataset) and small modification
oneScotch Feb 15, 2023
c9e1952
configs format modification
oneScotch Feb 15, 2023
f26d399
add test for cliff head
oneScotch Feb 15, 2023
92919e5
Merge branch 'main' into main
oneScotch Feb 15, 2023
067aa44
format correction
oneScotch Feb 15, 2023
69ca605
Merge branch 'main' of https://github.com/oneScotch/mmhuman3d into main
oneScotch Feb 15, 2023
19a00a1
update test file
oneScotch Feb 22, 2023
780dc8c
format correction
oneScotch Feb 22, 2023
d5869c6
update test file
oneScotch Feb 22, 2023
40ed228
format correction
oneScotch Feb 22, 2023
eb3b379
update test file
oneScotch Feb 22, 2023
97dbe71
format correction
oneScotch Feb 22, 2023
031a2d6
docformatter correction
oneScotch Feb 22, 2023
0547c16
update test file
oneScotch Feb 22, 2023
2e054a1
format
Feb 25, 2023
cec733d
add README
oneScotch Feb 25, 2023
af05781
add README
oneScotch Feb 25, 2023
75285a7
add test for cliff data converter
oneScotch Feb 28, 2023
0ff53bb
add test for cliff mesh estimator
oneScotch Feb 28, 2023
ca34992
update tests
oneScotch Feb 28, 2023
4a75b3e
format
oneScotch Mar 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into main
  • Loading branch information
oneScotch authored Feb 15, 2023
commit 92919e53878f903fdaaa9fe45efd2dca3e02eba4
1 change: 1 addition & 0 deletions mmhuman3d/models/architectures/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def build_from_cfg(cfg, registry, default_args=None):
name='SMPLXImageBodyModelEstimator', module=SMPLXImageBodyModelEstimator)
ARCHITECTURES.register_module(
name='CliffImageBodyModelEstimator', module=CliffImageBodyModelEstimator)
ARCHITECTURES.register_module(name='PyMAFX', module=PyMAFX)


def build_architecture(cfg):
Expand Down
2 changes: 2 additions & 0 deletions mmhuman3d/models/heads/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
HEADS.register_module(name='ExPoseHandHead', module=ExPoseHandHead)
HEADS.register_module(name='ExPoseFaceHead', module=ExPoseFaceHead)
HEADS.register_module(name='CliffHead', module=CliffHead)
HEADS.register_module(name='PyMAFXHead', module=PyMAFXHead)
HEADS.register_module(name='Regressor', module=Regressor)


def build_head(cfg):
Expand Down
65 changes: 65 additions & 0 deletions mmhuman3d/utils/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,3 +427,68 @@ def cam_crop2full(crop_cam, center, scale, full_img_shape, focal_length):
ty = (2 * (cy - img_h / 2.) / bs) + crop_cam[:, 2]
full_cam = torch.stack([tx, ty, tz], dim=-1)
return full_cam


def projection(pred_joints, pred_camera, iwp_mode=True):
"""Project 3D points on the image plane based on the given camera info,
Identity rotation and Weak Perspective (IWP) camera is used when
iwp_mode = True
"""
batch_size = pred_joints.shape[0]
if iwp_mode:
cam_sxy = pred_camera['cam_sxy']
pred_cam_t = torch.stack([
cam_sxy[:, 1], cam_sxy[:, 2], 2 * 5000. /
(224. * cam_sxy[:, 0] + 1e-9)
],
dim=-1)

camera_center = torch.zeros(batch_size, 2)
pred_keypoints_2d = perspective_projection(
pred_joints,
rotation=torch.eye(3).unsqueeze(0).expand(batch_size, -1, -1).to(
pred_joints.device),
translation=pred_cam_t,
focal_length=5000.,
camera_center=camera_center)

else:
raise NotImplementedError
return pred_keypoints_2d


def compute_twist_rotation(rotation_matrix, twist_axis):
'''
Compute the twist component of given rotation and twist axis
https://stackoverflow.com/questions/3684269/component-of-a-quaternion-rotation-around-an-axis
Parameters
----------
rotation_matrix : Tensor (B, 3, 3,)
The rotation to convert
twist_axis : Tensor (B, 3,)
The twist axis
Returns
-------
Tensor (B, 3, 3)
The twist rotation
'''
quaternion = rotation_matrix_to_quaternion(rotation_matrix)

twist_axis = twist_axis / (
torch.norm(twist_axis, dim=1, keepdim=True) + 1e-9)

projection = torch.einsum('bi,bi->b', twist_axis,
quaternion[:, 1:]).unsqueeze(-1) * twist_axis

twist_quaternion = torch.cat([quaternion[:, 0:1], projection], dim=1)
twist_quaternion = twist_quaternion / (
torch.norm(twist_quaternion, dim=1, keepdim=True) + 1e-9)

twist_rotation = quat_to_rotmat(twist_quaternion)
twist_aa = quaternion_to_angle_axis(twist_quaternion)

twist_angle = torch.sum(
twist_aa, dim=1, keepdim=True) / torch.sum(
twist_axis, dim=1, keepdim=True)

return twist_rotation, twist_angle
You are viewing a condensed version of this merge commit. You can view the full changes here.