# xiaobenli00/etch-x architecture

> Architecture diagram of the GitHub repository xiaobenli00/etch-x, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xiaobenli00/etch-x
- Repository: https://github.com/xiaobenli00/etch-x

## Overview

ETCH-X is a two-stage inference product for fitting expressive SMPL-X bodies to clothed-human scans. Stage 1 samples and centers scan points, predicts tightness vectors, and writes inner-body points; Stage 2 voxelizes those points, performs LVD dense-correspondence fitting, and emits fitted-body results. Optional hand processing segments hands, fits MANO, and grafts them onto the body. Groups distinguish inference orchestration, learned models, fitting, and data preparation. Stage 2 excerpts are partial, so internal links are limited to the documented workflow and visible fitting responsibilities.

Main entry points: [`infer_stage2.py`](https://github.com/xiaobenli00/etch-x/blob/main/infer_stage2.py) (Stage 2 inference), [`infer_stage1.py`](https://github.com/xiaobenli00/etch-x/blob/main/infer_stage1.py) (Stage 1 inference), [`src/nicp/lvd_templ/evaluation/fit_SMPLX.py`](https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/evaluation/fit_SMPLX.py) (SMPL-X fitting), [`src/etchx/models/models_pointcloud.py`](https://github.com/xiaobenli00/etch-x/blob/main/src/etchx/models/models_pointcloud.py) (Tightness network)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_stage1["Undressing"]
  node_stage1_entry["Stage 1 inference<br/>[infer_stage1.py]"]
  node_stage1_model["Tightness network"]
  node_stage1_utils["Geometry utilities<br/>[geometry.py]"]
end

subgraph group_stage2["Dense fitting"]
  node_stage2_entry["Stage 2 inference<br/>[infer_stage2.py]"]
  node_lvd_model["LVD network<br/>[module.py]"]
  node_ifnet_module["IFNet module<br/>[pl_module_ifnet.py]"]
  node_smplx_fit["SMPL-X fitting<br/>[fit_SMPLX.py]"]
  node_rendering["Mesh rendering<br/>[render.py]"]
end

subgraph group_hands["Hand refinement"]
  node_hand_seg_data["Hand segmentation data"]
  node_hand_seg_model["Hand segmentation model<br/>[model_hand_seg.py]"]
  node_hand_lvd_data["Hand LVD data"]
  node_mano_fit["MANO fitting<br/>[infer_stage2.py]"]
  node_hand_fit_utils["Hand refinement<br/>[fit_SMPLX.py]"]
end

subgraph group_data["Data preparation"]
  node_stage2_paths["Model paths<br/>[paths.py]"]
end

node_scan(("Human scan"))
node_inner_points["Inner-body points"]
node_body_result["Fitted body output"]

node_scan -->|"provides scan"| node_stage1_entry
node_stage1_entry -->|"runs network"| node_stage1_model
node_stage1_entry -->|"uses geometry"| node_stage1_utils
node_stage1_entry -->|"writes points"| node_inner_points
node_inner_points -->|"feeds stage two"| node_stage2_entry
node_stage2_entry -->|"selects templates"| node_stage2_paths
node_stage2_entry -->|"queries correspondences"| node_lvd_model
node_stage2_entry -->|"builds refinement"| node_ifnet_module
node_stage2_entry -->|"fits body"| node_smplx_fit
node_smplx_fit -->|"produces mesh"| node_body_result
node_stage2_entry -.->|"loads hand data"| node_hand_seg_data
node_stage2_entry -.->|"segments hands"| node_hand_seg_model
node_stage2_entry -.->|"loads hand LVD"| node_hand_lvd_data
node_stage2_entry -.->|"fits MANO"| node_mano_fit
node_stage2_entry -.->|"refines graft"| node_hand_fit_utils
node_stage2_entry -.->|"renders outputs"| node_rendering

click node_stage1_entry "https://github.com/xiaobenli00/etch-x/blob/main/infer_stage1.py"
click node_stage1_model "https://github.com/xiaobenli00/etch-x/blob/main/src/etchx/models/models_pointcloud.py"
click node_stage1_utils "https://github.com/xiaobenli00/etch-x/blob/main/src/etchx/utils/geometry.py"
click node_stage2_entry "https://github.com/xiaobenli00/etch-x/blob/main/infer_stage2.py"
click node_stage2_paths "https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/paths.py"
click node_lvd_model "https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/modules/module.py"
click node_ifnet_module "https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/pl_modules/pl_module_ifnet.py"
click node_smplx_fit "https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/evaluation/fit_SMPLX.py"
click node_hand_seg_data "https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/data/dataset_hand_seg.py"
click node_hand_seg_model "https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/pl_modules/model_hand_seg.py"
click node_hand_lvd_data "https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/data/dataset_mano_hand.py"
click node_mano_fit "https://github.com/xiaobenli00/etch-x/blob/main/infer_stage2.py"
click node_hand_fit_utils "https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/evaluation/fit_SMPLX.py"
click node_rendering "https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/utils/smpl_utils/render.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_stage1_entry,node_stage1_model,node_stage1_utils toneBlue
class node_stage2_entry,node_lvd_model,node_ifnet_module,node_smplx_fit,node_rendering toneAmber
class node_hand_seg_data,node_hand_seg_model,node_hand_lvd_data,node_mano_fit,node_hand_fit_utils toneMint
class node_stage2_paths toneRose
class node_scan,node_inner_points,node_body_result toneIndigo
```

## Components

### Undressing

- [Stage 1 inference](https://github.com/xiaobenli00/etch-x/blob/main/infer_stage1.py): `infer_stage1.py`
- [Tightness network](https://github.com/xiaobenli00/etch-x/blob/main/src/etchx/models/models_pointcloud.py): `src/etchx/models/models_pointcloud.py`
- [Geometry utilities](https://github.com/xiaobenli00/etch-x/blob/main/src/etchx/utils/geometry.py): `src/etchx/utils/geometry.py`

### Dense fitting

- [Stage 2 inference](https://github.com/xiaobenli00/etch-x/blob/main/infer_stage2.py): `infer_stage2.py`
- [LVD network](https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/modules/module.py): `src/nicp/lvd_templ/modules/module.py`
- [IFNet module](https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/pl_modules/pl_module_ifnet.py): `src/nicp/lvd_templ/pl_modules/pl_module_ifnet.py`
- [SMPL-X fitting](https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/evaluation/fit_SMPLX.py): `src/nicp/lvd_templ/evaluation/fit_SMPLX.py`
- [Mesh rendering](https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/utils/smpl_utils/render.py): `src/nicp/lvd_templ/utils/smpl_utils/render.py`

### Hand refinement

- [Hand segmentation data](https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/data/dataset_hand_seg.py): `src/nicp/lvd_templ/data/dataset_hand_seg.py`
- [Hand segmentation model](https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/pl_modules/model_hand_seg.py): `src/nicp/lvd_templ/pl_modules/model_hand_seg.py`
- [Hand LVD data](https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/data/dataset_mano_hand.py): `src/nicp/lvd_templ/data/dataset_mano_hand.py`
- [MANO fitting](https://github.com/xiaobenli00/etch-x/blob/main/infer_stage2.py): `infer_stage2.py`
- [Hand refinement](https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/evaluation/fit_SMPLX.py): `src/nicp/lvd_templ/evaluation/fit_SMPLX.py`

### Data preparation

- [Model paths](https://github.com/xiaobenli00/etch-x/blob/main/src/nicp/lvd_templ/paths.py): `src/nicp/lvd_templ/paths.py`

### Other components

- **Human scan**
- **Inner-body points**
- **Fitted body output**

## Connections

- Human scan → Stage 1 inference: provides scan
- Stage 1 inference → Tightness network: runs network
- Stage 1 inference → Geometry utilities: uses geometry
- Stage 1 inference → Inner-body points: writes points
- Inner-body points → Stage 2 inference: feeds stage two
- Stage 2 inference → Model paths: selects templates
- Stage 2 inference → LVD network: queries correspondences
- Stage 2 inference → IFNet module: builds refinement
- Stage 2 inference → SMPL-X fitting: fits body
- SMPL-X fitting → Fitted body output: produces mesh
- Stage 2 inference → Hand segmentation data: loads hand data
- Stage 2 inference → Hand segmentation model: segments hands
- Stage 2 inference → Hand LVD data: loads hand LVD
- Stage 2 inference → MANO fitting: fits MANO
- Stage 2 inference → Hand refinement: refines graft
- Stage 2 inference → Mesh rendering: renders outputs
