# raoujj/analyse-faciale-3d architecture

> Architecture diagram of the GitHub repository raoujj/analyse-faciale-3d, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/raoujj/analyse-faciale-3d
- Repository: https://github.com/raoujj/analyse-faciale-3d

## Overview

This is a photo-to-3D facial reconstruction and simulation application: a user selects a face image, the web front end submits it to FastAPI, the backend invokes DECA, and the resulting model is presented in a viewer; users can also adjust facial parameters. The graph preserves the documented DECA and PyTorch3D capabilities and the indexed core modules. Some links are based on the README rather than sampled implementation; the excerpts do not establish every internal rendering or front-end call.

Main entry points: [`external/DECA/decalib/deca.py`](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/DECA/decalib/deca.py) (DECA reconstruction), [`backend/app/main.py`](https://github.com/raoujj/analyse-faciale-3d/blob/main/backend/app/main.py) (FastAPI endpoints), [`external/DECA/decalib/utils/renderer.py`](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/DECA/decalib/utils/renderer.py) (DECA rendering), [`mobile_app/js/main.js`](https://github.com/raoujj/analyse-faciale-3d/blob/main/mobile_app/js/main.js) (Web interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_web["Web interface<br/>[main.js]"]
  node_client_api["API client<br/>[api.js]"]
  node_model_viewer["3D viewer<br/>[viewer.js]"]
end

subgraph group_backend["API and simulation"]
  node_fastapi["FastAPI endpoints<br/>[main.py]"]
  node_deca_service["DECA service<br/>[deca_service.py]"]
  node_face_detection["Face detection<br/>[face_detector.py]"]
  node_measurements["Face measurements<br/>[measurements.py]"]
  node_advice["Facial advice<br/>[advisor.py]"]
end

subgraph group_deca["DECA reconstruction"]
  node_deca_inference["DECA reconstruction<br/>[deca.py]"]
  node_deca_datasets["Image datasets<br/>[datasets.py]"]
  node_now_dataset["NOW dataset<br/>[now.py]"]
  node_flame["FLAME face model<br/>[FLAME.py]"]
  node_deca_config["DECA configuration<br/>[config.py]"]
  node_deca_losses["Training losses<br/>[lossfunc.py]"]
  node_deca_render["DECA rendering<br/>[renderer.py]"]
  node_rotation["Rotation conversion"]
end

subgraph group_p3d["3D components"]
  node_p3d_mesh["Mesh structures<br/>[meshes.py]"]
  node_p3d_points["Point clouds<br/>[pointclouds.py]"]
  node_p3d_volumes["Volumes<br/>[volumes.py]"]
  node_p3d_cameras["Camera models<br/>[cameras.py]"]
  node_p3d_camera_utils["Camera utilities<br/>[camera_utils.py]"]
  node_p3d_raster["Mesh rasterization"]
  node_p3d_knn["K-nearest neighbors<br/>[knn.py]"]
  node_p3d_point_volume["Points to volumes"]
  node_p3d_transforms["3D transforms<br/>[math.py]"]
end

node_user(("Photo user"))

node_user -->|"selects photo"| node_web
node_web -.->|"submits request"| node_client_api
node_client_api -.->|"calls API"| node_fastapi
node_fastapi -->|"invokes reconstruction"| node_deca_service
node_fastapi -->|"requests simulation"| node_deca_service
node_deca_service -.->|"runs DECA"| node_deca_inference
node_fastapi -.->|"serves model results"| node_model_viewer
node_user -->|"adjusts parameters"| node_web
node_face_detection -->|"uses measurements"| node_measurements
node_face_detection -->|"uses advice"| node_advice
node_deca_inference -->|"uses dataset utilities"| node_deca_datasets
node_deca_inference -->|"uses face model"| node_flame
node_deca_inference -->|"uses configuration"| node_deca_config
node_deca_inference -->|"uses renderer"| node_deca_render
node_deca_inference -->|"uses conversions"| node_rotation
node_deca_inference -.->|"supports validation"| node_now_dataset
node_deca_render -->|"uses meshes"| node_p3d_mesh
node_deca_render -->|"uses rasterizer"| node_p3d_raster
node_deca_render -.->|"uses cameras"| node_p3d_cameras
node_p3d_camera_utils -.->|"operates on cameras"| node_p3d_cameras
node_p3d_point_volume -.->|"populates volumes"| node_p3d_volumes
node_p3d_knn -.->|"queries neighbors"| node_p3d_points
node_p3d_mesh -.->|"uses transforms"| node_p3d_transforms
node_deca_inference -.->|"training capability"| node_deca_losses

click node_web "https://github.com/raoujj/analyse-faciale-3d/blob/main/mobile_app/js/main.js"
click node_client_api "https://github.com/raoujj/analyse-faciale-3d/blob/main/mobile_app/js/api.js"
click node_model_viewer "https://github.com/raoujj/analyse-faciale-3d/blob/main/mobile_app/js/viewer.js"
click node_fastapi "https://github.com/raoujj/analyse-faciale-3d/blob/main/backend/app/main.py"
click node_deca_service "https://github.com/raoujj/analyse-faciale-3d/blob/main/backend/app/core/deca_service.py"
click node_face_detection "https://github.com/raoujj/analyse-faciale-3d/blob/main/backend/app/core/face_detector.py"
click node_measurements "https://github.com/raoujj/analyse-faciale-3d/blob/main/backend/app/core/measurements.py"
click node_advice "https://github.com/raoujj/analyse-faciale-3d/blob/main/backend/app/core/advisor.py"
click node_deca_inference "https://github.com/raoujj/analyse-faciale-3d/blob/main/external/DECA/decalib/deca.py"
click node_deca_datasets "https://github.com/raoujj/analyse-faciale-3d/blob/main/external/DECA/decalib/datasets/datasets.py"
click node_now_dataset "https://github.com/raoujj/analyse-faciale-3d/blob/main/external/DECA/decalib/datasets/now.py"
click node_flame "https://github.com/raoujj/analyse-faciale-3d/blob/main/external/DECA/decalib/models/FLAME.py"
click node_deca_config "https://github.com/raoujj/analyse-faciale-3d/blob/main/external/DECA/decalib/utils/config.py"
click node_deca_losses "https://github.com/raoujj/analyse-faciale-3d/blob/main/external/DECA/decalib/utils/lossfunc.py"
click node_deca_render "https://github.com/raoujj/analyse-faciale-3d/blob/main/external/DECA/decalib/utils/renderer.py"
click node_rotation "https://github.com/raoujj/analyse-faciale-3d/blob/main/external/DECA/decalib/utils/rotation_converter.py"
click node_p3d_mesh "https://github.com/raoujj/analyse-faciale-3d/blob/main/external/pytorch3d/pytorch3d/structures/meshes.py"
click node_p3d_points "https://github.com/raoujj/analyse-faciale-3d/blob/main/external/pytorch3d/pytorch3d/structures/pointclouds.py"
click node_p3d_volumes "https://github.com/raoujj/analyse-faciale-3d/blob/main/external/pytorch3d/pytorch3d/structures/volumes.py"
click node_p3d_cameras "https://github.com/raoujj/analyse-faciale-3d/blob/main/external/pytorch3d/pytorch3d/renderer/cameras.py"
click node_p3d_camera_utils "https://github.com/raoujj/analyse-faciale-3d/blob/main/external/pytorch3d/pytorch3d/renderer/camera_utils.py"
click node_p3d_raster "https://github.com/raoujj/analyse-faciale-3d/blob/main/external/pytorch3d/pytorch3d/renderer/mesh/rasterize_meshes.py"
click node_p3d_knn "https://github.com/raoujj/analyse-faciale-3d/blob/main/external/pytorch3d/pytorch3d/ops/knn.py"
click node_p3d_point_volume "https://github.com/raoujj/analyse-faciale-3d/blob/main/external/pytorch3d/pytorch3d/ops/points_to_volumes.py"
click node_p3d_transforms "https://github.com/raoujj/analyse-faciale-3d/blob/main/external/pytorch3d/pytorch3d/transforms/math.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_web,node_client_api,node_model_viewer,node_user toneBlue
class node_fastapi,node_deca_service,node_face_detection,node_measurements,node_advice toneAmber
class node_deca_inference,node_deca_datasets,node_now_dataset,node_flame,node_deca_config,node_deca_losses,node_deca_render,node_rotation toneMint
class node_p3d_mesh,node_p3d_points,node_p3d_volumes,node_p3d_cameras,node_p3d_camera_utils,node_p3d_raster,node_p3d_knn,node_p3d_point_volume,node_p3d_transforms toneRose
```

## Components

### Web client

- [Web interface](https://github.com/raoujj/analyse-faciale-3d/blob/main/mobile_app/js/main.js): `mobile_app/js/main.js`
- [API client](https://github.com/raoujj/analyse-faciale-3d/blob/main/mobile_app/js/api.js): `mobile_app/js/api.js`
- [3D viewer](https://github.com/raoujj/analyse-faciale-3d/blob/main/mobile_app/js/viewer.js): `mobile_app/js/viewer.js`

### API and simulation

- [FastAPI endpoints](https://github.com/raoujj/analyse-faciale-3d/blob/main/backend/app/main.py): `backend/app/main.py`
- [DECA service](https://github.com/raoujj/analyse-faciale-3d/blob/main/backend/app/core/deca_service.py): `backend/app/core/deca_service.py`
- [Face detection](https://github.com/raoujj/analyse-faciale-3d/blob/main/backend/app/core/face_detector.py): `backend/app/core/face_detector.py`
- [Face measurements](https://github.com/raoujj/analyse-faciale-3d/blob/main/backend/app/core/measurements.py): `backend/app/core/measurements.py`
- [Facial advice](https://github.com/raoujj/analyse-faciale-3d/blob/main/backend/app/core/advisor.py): `backend/app/core/advisor.py`

### DECA reconstruction

- [DECA reconstruction](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/DECA/decalib/deca.py): `external/DECA/decalib/deca.py`
- [Image datasets](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/DECA/decalib/datasets/datasets.py): `external/DECA/decalib/datasets/datasets.py`
- [NOW dataset](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/DECA/decalib/datasets/now.py): `external/DECA/decalib/datasets/now.py`
- [FLAME face model](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/DECA/decalib/models/FLAME.py): `external/DECA/decalib/models/FLAME.py`
- [DECA configuration](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/DECA/decalib/utils/config.py): `external/DECA/decalib/utils/config.py`
- [Training losses](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/DECA/decalib/utils/lossfunc.py): `external/DECA/decalib/utils/lossfunc.py`
- [DECA rendering](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/DECA/decalib/utils/renderer.py): `external/DECA/decalib/utils/renderer.py`
- [Rotation conversion](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/DECA/decalib/utils/rotation_converter.py): `external/DECA/decalib/utils/rotation_converter.py`

### 3D components

- [Mesh structures](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/pytorch3d/pytorch3d/structures/meshes.py): `external/pytorch3d/pytorch3d/structures/meshes.py`
- [Point clouds](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/pytorch3d/pytorch3d/structures/pointclouds.py): `external/pytorch3d/pytorch3d/structures/pointclouds.py`
- [Volumes](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/pytorch3d/pytorch3d/structures/volumes.py): `external/pytorch3d/pytorch3d/structures/volumes.py`
- [Camera models](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/pytorch3d/pytorch3d/renderer/cameras.py): `external/pytorch3d/pytorch3d/renderer/cameras.py`
- [Camera utilities](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/pytorch3d/pytorch3d/renderer/camera_utils.py): `external/pytorch3d/pytorch3d/renderer/camera_utils.py`
- [Mesh rasterization](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/pytorch3d/pytorch3d/renderer/mesh/rasterize_meshes.py): `external/pytorch3d/pytorch3d/renderer/mesh/rasterize_meshes.py`
- [K-nearest neighbors](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/pytorch3d/pytorch3d/ops/knn.py): `external/pytorch3d/pytorch3d/ops/knn.py`
- [Points to volumes](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/pytorch3d/pytorch3d/ops/points_to_volumes.py): `external/pytorch3d/pytorch3d/ops/points_to_volumes.py`
- [3D transforms](https://github.com/raoujj/analyse-faciale-3d/blob/main/external/pytorch3d/pytorch3d/transforms/math.py): `external/pytorch3d/pytorch3d/transforms/math.py`

### Other components

- **Photo user**

## Connections

- Photo user → Web interface: selects photo (evidence: `README.md`)
- Web interface → API client: submits request
- API client → FastAPI endpoints: calls API
- FastAPI endpoints → DECA service: invokes reconstruction (evidence: `backend/app/main.py`)
- FastAPI endpoints → DECA service: requests simulation (evidence: `backend/app/main.py`)
- DECA service → DECA reconstruction: runs DECA
- FastAPI endpoints → 3D viewer: serves model results
- Photo user → Web interface: adjusts parameters (evidence: `README.md`)
- Face detection → Face measurements: uses measurements (evidence: `backend/app/core/face_detector.py`)
- Face detection → Facial advice: uses advice (evidence: `backend/app/core/face_detector.py`)
- DECA reconstruction → Image datasets: uses dataset utilities (evidence: `external/DECA/decalib/deca.py`)
- DECA reconstruction → FLAME face model: uses face model (evidence: `external/DECA/decalib/deca.py`)
- DECA reconstruction → DECA configuration: uses configuration (evidence: `external/DECA/decalib/deca.py`)
- DECA reconstruction → DECA rendering: uses renderer (evidence: `external/DECA/decalib/deca.py`)
- DECA reconstruction → Rotation conversion: uses conversions (evidence: `external/DECA/decalib/deca.py`)
- DECA reconstruction → NOW dataset: supports validation
- DECA rendering → Mesh structures: uses meshes (evidence: `external/DECA/decalib/utils/renderer.py`)
- DECA rendering → Mesh rasterization: uses rasterizer (evidence: `external/DECA/decalib/utils/renderer.py`)
- DECA rendering → Camera models: uses cameras
- Camera utilities → Camera models: operates on cameras
- Points to volumes → Volumes: populates volumes
- K-nearest neighbors → Point clouds: queries neighbors
- Mesh structures → 3D transforms: uses transforms
- DECA reconstruction → Training losses: training capability
