Skip to content

Commit

Permalink
update readme & rm outdated demos
Browse files Browse the repository at this point in the history
  • Loading branch information
lixiny committed Apr 9, 2023
1 parent 35f3b98 commit 9515773
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 153 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
__pycache__/
build/
dist/
test/
assets/mano/
assets/mano_v1_2/
assets/mano_layer.svg
Expand Down
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ python scripts/simple_app.py --mode axis
<img src="doc/axis.gif", width=400>
</p>


To overcome the first issue,
For each joint rotation, we decomposed it as two rotations, one is the rotation from the original MANO basis to our newly defined anatomical consistent basis (this rotation is calculated in MANO's canonical pose and is independent to the pose of the hand),
and the other is the rotation from the **unposed** anatomical consistent basis to that of the **posed** hand.
Expand All @@ -61,18 +60,22 @@ To overcome the second issue,
we penalize the rotation in form of the euler angles, which is more robust to the small angle.

:eyes: See [manotorch/anatomy_loss.py](manotorch/anatomy_loss.py): `AnatomyConstraintLossEE` for details (EE: euler angle).
:runner: Run: [scripts/simple_anatomy_loss.py](scripts/simple_anatomy_loss.py)
:runner: Run: [scripts/simple_anatomy_loss.py](scripts/simple_anatomy_loss.py) to show the pose correction.

```shell
python scripts/simple_anatomy_loss.py
```

<p align="center">
<img src="doc/pose_correction.gif", width=400>
</p>

### Composing the Hand

Based on the Anatomical Consistent Basis, we can also compose the hand from a given euler angles.

:eyes: See: [manotorch/axislayer.py](manotorch/axislayer.py): `AxisLayerFK.compose` for details (FK: forward kinematics).
:runner: Run: [scripts/simple_compose.py](scripts/simple_compose.py), It demonstrates how we specify the euler angles of joint on the index finger and compose the hand in a deterministic way.
:runner: Run: [scripts/simple_compose.py](scripts/simple_compose.py), It shows how we specify the euler angles of joint on the index finger and compose the hand in a deterministic way.

```shell
# transform order of right hand
Expand Down Expand Up @@ -212,7 +215,7 @@ random_shape = torch.rand(batch_size, 10)
# Generate random pose parameters, including 3 values for global axis-angle rotation
random_pose = torch.rand(batch_size, 3 + ncomps)

# The mano_layer's output contains:
# The mano_layer's output contains:
"""
MANOOutput = namedtuple(
"MANOOutput",
Expand All @@ -234,5 +237,10 @@ mano_output: MANOOutput = mano_layer(random_pose, random_shape)
verts = mano_output.verts # (B, 778, 3), root(center_joint) relative
joints = mano_output.joints # (B, 21, 3), root relative
transforms_abs = mano_output.transforms_abs # (B, 16, 4, 4), root relative
```
For advance usages, please visit [scripts](./scripts/) for demonstrations.
```

### Advanced Usage

| [Visualize](scripts/simple_app.py) | [Simple Compose](scripts/simple_compose.py) | [Error Correction](scripts/simple_anatomy_loss.py) |
| :--------------------------------: | :-----------------------------------------: | :------------------------------------------------: |
| ![](doc/axis.gif) | ![](doc/simple_compose.gif) | ![](doc/pose_correction.gif) |
102 changes: 0 additions & 102 deletions demo_axis_layer.py

This file was deleted.

Binary file added doc/pose_correction.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 0 additions & 44 deletions scripts/_app.py

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/simple_anatomy_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def main():
# 12 - 11 - 10 --/
# 9-- 8 -- 7 --/
composed_ee[:, 1] = torch.tensor([0, 0, -pi / 3]).unsqueeze(0)
composed_ee[:, 2] = torch.tensor([0, 0, -pi / 3]).unsqueeze(0)
composed_ee[:, 2] = torch.tensor([pi / 3, 0, -pi / 3]).unsqueeze(0)
composed_ee[:, 3] = torch.tensor([0, pi / 3, -pi / 3]).unsqueeze(0)
composed_aa = axisFK.compose(composed_ee)[:, 1:, :].clone() # (B, 15, 3)
composed_aa.requires_grad_(True)
Expand Down

0 comments on commit 9515773

Please sign in to comment.