# vchoutas/smplx architecture

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

- Interactive diagram: https://gitdiagram.com/vchoutas/smplx
- Repository: https://github.com/vchoutas/smplx

## Overview

The repository contains two related products: the SMPL-X family of parametric human-body models, and a mesh-fitting tool that transfers deformation between body-model topologies. The main fitting workflow configures a run, loads mesh inputs, applies a deformation-transfer mapping, optimizes pose and shape against edge and vertex losses, and writes results. Model evaluation relies on linear blend skinning; separate utilities prepare legacy model files and inspect or export model data. Some subsystem links are documented or indexed but their implementation excerpts were not provided, so those links are omitted or marked unverified.

Main entry points: [`transfer_model/transfer_model.py`](https://github.com/vchoutas/smplx/blob/main/transfer_model/transfer_model.py) (Fit runner), [`smplx/body_models.py`](https://github.com/vchoutas/smplx/blob/main/smplx/body_models.py) (SMPL family), [`transfer_model/config/cmd_parser.py`](https://github.com/vchoutas/smplx/blob/main/transfer_model/config/cmd_parser.py) (CLI config), [`transfer_model/data/build.py`](https://github.com/vchoutas/smplx/blob/main/transfer_model/data/build.py) (Data loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_models["Body models"]
  node_smpl_models["SMPL family<br/>[body_models.py]"]
  node_skinning["Blend skinning<br/>[lbs.py]"]
  node_joint_names["Joint names<br/>[joint_names.py]"]
  node_vertex_ids["Vertex IDs<br/>[vertex_ids.py]"]
  node_joint_selector["Joint selector"]
end

subgraph group_fitting["Mesh transfer"]
  node_config["Run configuration<br/>[defaults.py]"]
  node_cli_config["CLI config<br/>[cmd_parser.py]"]
  node_mesh_input["Mesh dataset<br/>[mesh.py]"]
  node_data_loader["Data loader<br/>[build.py]"]
  node_runner["Fit runner<br/>[transfer_model.py]"]
  node_deformation["Deformation mapping<br/>[def_transfer.py]"]
  node_losses["Fitting losses<br/>[losses.py]"]
  node_optimizer["Optimizer loop<br/>[minimize.py]"]
  node_optimizer_factory["Optimizer setup<br/>[optim_factory.py]"]
end

subgraph group_model_tools["Model utilities"]
  node_legacy_clean["Legacy cleanup<br/>[clean_ch.py]"]
  node_model_merge["SMPL+H merge"]
end

subgraph group_fit_tools["Fit utilities"]
  node_fit_output["Result output<br/>[merge_output.py]"]
  node_pkl_view["Model viewer<br/>[view_pkl.py]"]
  node_obj_writer["OBJ export<br/>[write_obj.py]"]
end

node_user(("Model user"))
node_model_files["Model parameters"]

node_user -->|"loads model"| node_smpl_models
node_model_files -->|"provides parameters"| node_smpl_models
node_smpl_models -->|"evaluates with"| node_skinning
node_smpl_models -->|"uses IDs"| node_vertex_ids
node_smpl_models -->|"uses selector"| node_joint_selector
node_user -->|"prepares models"| node_legacy_clean
node_user -->|"merges parameters"| node_model_merge
node_model_files -->|"reads model files"| node_model_merge
node_user -->|"sets run options"| node_cli_config
node_cli_config -->|"merges defaults"| node_config
node_user -.->|"supplies meshes"| node_data_loader
node_data_loader -->|"builds dataset"| node_mesh_input
node_user -.->|"starts fitting"| node_runner
node_runner -->|"transfers vertices"| node_deformation
node_runner -->|"evaluates losses"| node_losses
node_runner -.->|"builds optimizer"| node_optimizer_factory
node_runner -->|"runs iterations"| node_optimizer
node_runner -.->|"forwards model"| node_smpl_models
node_runner -.->|"saves results"| node_fit_output
node_user -->|"inspects model"| node_pkl_view
node_user -->|"exports mesh"| node_obj_writer
node_obj_writer -->|"loads model"| node_smpl_models

click node_smpl_models "https://github.com/vchoutas/smplx/blob/main/smplx/body_models.py"
click node_skinning "https://github.com/vchoutas/smplx/blob/main/smplx/lbs.py"
click node_joint_names "https://github.com/vchoutas/smplx/blob/main/smplx/joint_names.py"
click node_vertex_ids "https://github.com/vchoutas/smplx/blob/main/smplx/vertex_ids.py"
click node_joint_selector "https://github.com/vchoutas/smplx/blob/main/smplx/vertex_joint_selector.py"
click node_legacy_clean "https://github.com/vchoutas/smplx/blob/main/tools/clean_ch.py"
click node_model_merge "https://github.com/vchoutas/smplx/blob/main/tools/merge_smplh_mano.py"
click node_config "https://github.com/vchoutas/smplx/blob/main/transfer_model/config/defaults.py"
click node_cli_config "https://github.com/vchoutas/smplx/blob/main/transfer_model/config/cmd_parser.py"
click node_mesh_input "https://github.com/vchoutas/smplx/blob/main/transfer_model/data/datasets/mesh.py"
click node_data_loader "https://github.com/vchoutas/smplx/blob/main/transfer_model/data/build.py"
click node_runner "https://github.com/vchoutas/smplx/blob/main/transfer_model/transfer_model.py"
click node_deformation "https://github.com/vchoutas/smplx/blob/main/transfer_model/utils/def_transfer.py"
click node_losses "https://github.com/vchoutas/smplx/blob/main/transfer_model/losses/losses.py"
click node_optimizer "https://github.com/vchoutas/smplx/blob/main/transfer_model/optimizers/minimize.py"
click node_optimizer_factory "https://github.com/vchoutas/smplx/blob/main/transfer_model/optimizers/optim_factory.py"
click node_fit_output "https://github.com/vchoutas/smplx/blob/main/transfer_model/merge_output.py"
click node_pkl_view "https://github.com/vchoutas/smplx/blob/main/transfer_model/view_pkl.py"
click node_obj_writer "https://github.com/vchoutas/smplx/blob/main/transfer_model/write_obj.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_smpl_models,node_skinning,node_joint_names,node_vertex_ids,node_joint_selector,node_user toneBlue
class node_config,node_cli_config,node_mesh_input,node_data_loader,node_runner,node_deformation,node_losses,node_optimizer,node_optimizer_factory toneAmber
class node_legacy_clean,node_model_merge toneMint
class node_fit_output,node_pkl_view,node_obj_writer toneRose
class node_model_files toneIndigo
```

## Components

### Body models

- [SMPL family](https://github.com/vchoutas/smplx/blob/main/smplx/body_models.py): `smplx/body_models.py`
- [Blend skinning](https://github.com/vchoutas/smplx/blob/main/smplx/lbs.py): `smplx/lbs.py`
- [Joint names](https://github.com/vchoutas/smplx/blob/main/smplx/joint_names.py): `smplx/joint_names.py`
- [Vertex IDs](https://github.com/vchoutas/smplx/blob/main/smplx/vertex_ids.py): `smplx/vertex_ids.py`
- [Joint selector](https://github.com/vchoutas/smplx/blob/main/smplx/vertex_joint_selector.py): `smplx/vertex_joint_selector.py`

### Mesh transfer

- [Run configuration](https://github.com/vchoutas/smplx/blob/main/transfer_model/config/defaults.py): `transfer_model/config/defaults.py`
- [CLI config](https://github.com/vchoutas/smplx/blob/main/transfer_model/config/cmd_parser.py): `transfer_model/config/cmd_parser.py`
- [Mesh dataset](https://github.com/vchoutas/smplx/blob/main/transfer_model/data/datasets/mesh.py): `transfer_model/data/datasets/mesh.py`
- [Data loader](https://github.com/vchoutas/smplx/blob/main/transfer_model/data/build.py): `transfer_model/data/build.py`
- [Fit runner](https://github.com/vchoutas/smplx/blob/main/transfer_model/transfer_model.py): `transfer_model/transfer_model.py`
- [Deformation mapping](https://github.com/vchoutas/smplx/blob/main/transfer_model/utils/def_transfer.py): `transfer_model/utils/def_transfer.py`
- [Fitting losses](https://github.com/vchoutas/smplx/blob/main/transfer_model/losses/losses.py): `transfer_model/losses/losses.py`
- [Optimizer loop](https://github.com/vchoutas/smplx/blob/main/transfer_model/optimizers/minimize.py): `transfer_model/optimizers/minimize.py`
- [Optimizer setup](https://github.com/vchoutas/smplx/blob/main/transfer_model/optimizers/optim_factory.py): `transfer_model/optimizers/optim_factory.py`

### Model utilities

- [Legacy cleanup](https://github.com/vchoutas/smplx/blob/main/tools/clean_ch.py): `tools/clean_ch.py`
- [SMPL+H merge](https://github.com/vchoutas/smplx/blob/main/tools/merge_smplh_mano.py): `tools/merge_smplh_mano.py`

### Fit utilities

- [Result output](https://github.com/vchoutas/smplx/blob/main/transfer_model/merge_output.py): `transfer_model/merge_output.py`
- [Model viewer](https://github.com/vchoutas/smplx/blob/main/transfer_model/view_pkl.py): `transfer_model/view_pkl.py`
- [OBJ export](https://github.com/vchoutas/smplx/blob/main/transfer_model/write_obj.py): `transfer_model/write_obj.py`

### Other components

- **Model user**
- **Model parameters**

## Connections

- Model user → SMPL family: loads model (evidence: `README.md`)
- Model parameters → SMPL family: provides parameters (evidence: `README.md`)
- SMPL family → Blend skinning: evaluates with (evidence: `smplx/body_models.py`)
- SMPL family → Vertex IDs: uses IDs (evidence: `smplx/body_models.py`)
- SMPL family → Joint selector: uses selector (evidence: `smplx/body_models.py`)
- Model user → Legacy cleanup: prepares models (evidence: `README.md`)
- Model user → SMPL+H merge: merges parameters (evidence: `README.md`)
- Model parameters → SMPL+H merge: reads model files (evidence: `tools/merge_smplh_mano.py`)
- Model user → CLI config: sets run options (evidence: `transfer_model/config/cmd_parser.py`)
- CLI config → Run configuration: merges defaults (evidence: `transfer_model/config/cmd_parser.py`)
- Model user → Data loader: supplies meshes
- Data loader → Mesh dataset: builds dataset (evidence: `transfer_model/data/build.py`)
- Model user → Fit runner: starts fitting
- Fit runner → Deformation mapping: transfers vertices (evidence: `transfer_model/transfer_model.py`)
- Fit runner → Fitting losses: evaluates losses (evidence: `transfer_model/transfer_model.py`)
- Fit runner → Optimizer setup: builds optimizer
- Fit runner → Optimizer loop: runs iterations (evidence: `transfer_model/transfer_model.py`)
- Fit runner → SMPL family: forwards model
- Fit runner → Result output: saves results
- Model user → Model viewer: inspects model (evidence: `transfer_model/view_pkl.py`)
- Model user → OBJ export: exports mesh (evidence: `transfer_model/write_obj.py`)
- OBJ export → SMPL family: loads model (evidence: `transfer_model/write_obj.py`)
