# qiisun/meshflow architecture

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

- Interactive diagram: https://gitdiagram.com/qiisun/meshflow
- Repository: https://github.com/qiisun/meshflow

## Overview

MeshFlow is a PyTorch system for unconditional, equivariant flow-matching mesh generation, with category-conditioned demo controls. The main workflow is training mesh data into a learned model and checkpoint, then sampling that checkpoint into mesh files; users can also interactively generate and post-process meshes or evaluate generated outputs. The graph retains the indexed analysis, logging, and attention internals. Some subsystems are documented or indexed but not fully excerpted, so only documented or directly evidenced relationships are shown.

Main entry points: [`train.py`](https://github.com/qiisun/meshflow/blob/master/train.py) (Training loop), [`inference.py`](https://github.com/qiisun/meshflow/blob/master/inference.py) (Mesh inference), [`models/equidit.py`](https://github.com/qiisun/meshflow/blob/master/models/equidit.py) (Equivariant DiT), [`gradio_demo.py`](https://github.com/qiisun/meshflow/blob/master/gradio_demo.py) (Interactive demo)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Mesh data"]
  node_mesh_data["Mesh dataset<br/>[mesh_dataset.py]"]
  node_mesh_files["Mesh data files"]
  node_ot["Noise matching<br/>[ot_utils.py]"]
end

subgraph group_learning["Training and model"]
  node_trainer["Training loop<br/>[train.py]"]
  node_flow["Flow matching<br/>[flow_matching.py]"]
  node_model["Equivariant DiT<br/>[equidit.py]"]
  node_attention["Attention layers<br/>[attention.py]"]
  node_model_utils["Model utilities<br/>[utils.py]"]
  node_logger["Experiment logging<br/>[logger.py]"]
end

subgraph group_generation["Generation"]
  node_checkpoint["Model checkpoint"]
  node_inference["Mesh inference<br/>[inference.py]"]
  node_mesh_output["Generated meshes"]
  node_demo["Interactive demo<br/>[gradio_demo.py]"]
  node_postprocess["Mesh post-processing<br/>[gradio_demo.py]"]
end

subgraph group_assessment["Evaluation and analysis"]
  node_evaluation["Point evaluation"]
  node_metrics["Mesh metrics"]
  node_step_analysis["Sampling-step analysis"]
  node_chamfer["Chamfer distance<br/>[dist_chamfer_3D.py]"]
end

node_user(("User"))

node_user -->|"starts training"| node_trainer
node_mesh_files -->|"loaded for training"| node_mesh_data
node_mesh_data -->|"aligns noise"| node_ot
node_trainer -->|"loads batches"| node_mesh_data
node_trainer -->|"builds and trains"| node_model
node_trainer -->|"uses flow matching"| node_flow
node_trainer -->|"logs experiments"| node_logger
node_model -->|"uses layers"| node_attention
node_model -->|"uses utilities"| node_model_utils
node_trainer -->|"saves checkpoint"| node_checkpoint
node_user -->|"requests generation"| node_inference
node_checkpoint -->|"loads weights"| node_inference
node_inference -->|"samples with"| node_model
node_inference -->|"integrates trajectory"| node_flow
node_inference -->|"exports meshes"| node_mesh_output
node_user -->|"selects generation"| node_demo
node_demo -->|"generates raw mesh"| node_mesh_output
node_demo -->|"runs post-processing"| node_postprocess
node_postprocess -->|"exports processed mesh"| node_mesh_output
node_user -->|"evaluates outputs"| node_evaluation
node_mesh_output -->|"provides generated meshes"| node_evaluation
node_evaluation -.->|"computes metrics"| node_metrics
node_user -->|"analyzes sampling"| node_step_analysis
node_step_analysis -->|"measures distance"| node_chamfer

click node_mesh_data "https://github.com/qiisun/meshflow/blob/master/datasets/mesh_dataset.py"
click node_ot "https://github.com/qiisun/meshflow/blob/master/utils/ot_utils.py"
click node_trainer "https://github.com/qiisun/meshflow/blob/master/train.py"
click node_flow "https://github.com/qiisun/meshflow/blob/master/flow_matching.py"
click node_model "https://github.com/qiisun/meshflow/blob/master/models/equidit.py"
click node_attention "https://github.com/qiisun/meshflow/blob/master/models/attention.py"
click node_model_utils "https://github.com/qiisun/meshflow/blob/master/models/utils.py"
click node_logger "https://github.com/qiisun/meshflow/blob/master/utils/logger.py"
click node_inference "https://github.com/qiisun/meshflow/blob/master/inference.py"
click node_demo "https://github.com/qiisun/meshflow/blob/master/gradio_demo.py"
click node_postprocess "https://github.com/qiisun/meshflow/blob/master/gradio_demo.py"
click node_evaluation "https://github.com/qiisun/meshflow/blob/master/tools/point_evaluation.py"
click node_metrics "https://github.com/qiisun/meshflow/blob/master/utils/mesh_evaluation_metrics.py"
click node_step_analysis "https://github.com/qiisun/meshflow/blob/master/tools/plot_chamfer_vs_steps.py"
click node_chamfer "https://github.com/qiisun/meshflow/blob/master/utils/chamfer3D/dist_chamfer_3D.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_mesh_data,node_mesh_files,node_ot,node_user toneBlue
class node_trainer,node_flow,node_model,node_attention,node_model_utils,node_logger toneAmber
class node_checkpoint,node_inference,node_mesh_output,node_demo,node_postprocess toneMint
class node_evaluation,node_metrics,node_step_analysis,node_chamfer toneRose
```

## Components

### Mesh data

- [Mesh dataset](https://github.com/qiisun/meshflow/blob/master/datasets/mesh_dataset.py): `datasets/mesh_dataset.py`
- **Mesh data files**
- [Noise matching](https://github.com/qiisun/meshflow/blob/master/utils/ot_utils.py): `utils/ot_utils.py`

### Training and model

- [Training loop](https://github.com/qiisun/meshflow/blob/master/train.py): `train.py`
- [Flow matching](https://github.com/qiisun/meshflow/blob/master/flow_matching.py): `flow_matching.py`
- [Equivariant DiT](https://github.com/qiisun/meshflow/blob/master/models/equidit.py): `models/equidit.py`
- [Attention layers](https://github.com/qiisun/meshflow/blob/master/models/attention.py): `models/attention.py`
- [Model utilities](https://github.com/qiisun/meshflow/blob/master/models/utils.py): `models/utils.py`
- [Experiment logging](https://github.com/qiisun/meshflow/blob/master/utils/logger.py): `utils/logger.py`

### Generation

- **Model checkpoint**
- [Mesh inference](https://github.com/qiisun/meshflow/blob/master/inference.py): `inference.py`
- **Generated meshes**
- [Interactive demo](https://github.com/qiisun/meshflow/blob/master/gradio_demo.py): `gradio_demo.py`
- [Mesh post-processing](https://github.com/qiisun/meshflow/blob/master/gradio_demo.py): `gradio_demo.py`

### Evaluation and analysis

- [Point evaluation](https://github.com/qiisun/meshflow/blob/master/tools/point_evaluation.py): `tools/point_evaluation.py`
- [Mesh metrics](https://github.com/qiisun/meshflow/blob/master/utils/mesh_evaluation_metrics.py): `utils/mesh_evaluation_metrics.py`
- [Sampling-step analysis](https://github.com/qiisun/meshflow/blob/master/tools/plot_chamfer_vs_steps.py): `tools/plot_chamfer_vs_steps.py`
- [Chamfer distance](https://github.com/qiisun/meshflow/blob/master/utils/chamfer3D/dist_chamfer_3D.py): `utils/chamfer3D/dist_chamfer_3D.py`

### Other components

- **User**

## Connections

- User → Training loop: starts training (evidence: `README.md`)
- Mesh data files → Mesh dataset: loaded for training (evidence: `README.md`)
- Mesh dataset → Noise matching: aligns noise (evidence: `datasets/mesh_dataset.py`)
- Training loop → Mesh dataset: loads batches (evidence: `train.py`)
- Training loop → Equivariant DiT: builds and trains (evidence: `train.py`)
- Training loop → Flow matching: uses flow matching (evidence: `train.py`)
- Training loop → Experiment logging: logs experiments (evidence: `train.py`)
- Equivariant DiT → Attention layers: uses layers (evidence: `models/equidit.py`)
- Equivariant DiT → Model utilities: uses utilities (evidence: `models/equidit.py`)
- Training loop → Model checkpoint: saves checkpoint (evidence: `README.md`)
- User → Mesh inference: requests generation (evidence: `README.md`)
- Model checkpoint → Mesh inference: loads weights (evidence: `inference.py`)
- Mesh inference → Equivariant DiT: samples with (evidence: `inference.py`)
- Mesh inference → Flow matching: integrates trajectory (evidence: `inference.py`)
- Mesh inference → Generated meshes: exports meshes (evidence: `README.md`)
- User → Interactive demo: selects generation (evidence: `README.md`)
- Interactive demo → Generated meshes: generates raw mesh (evidence: `gradio_demo.py`)
- Interactive demo → Mesh post-processing: runs post-processing (evidence: `README.md`)
- Mesh post-processing → Generated meshes: exports processed mesh (evidence: `README.md`)
- User → Point evaluation: evaluates outputs (evidence: `README.md`)
- Generated meshes → Point evaluation: provides generated meshes (evidence: `README.md`)
- Point evaluation → Mesh metrics: computes metrics
- User → Sampling-step analysis: analyzes sampling (evidence: `tools/plot_chamfer_vs_steps.py`)
- Sampling-step analysis → Chamfer distance: measures distance (evidence: `tools/plot_chamfer_vs_steps.py`)
