# luxxxonly/deep-live-cam architecture

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

- Interactive diagram: https://gitdiagram.com/luxxxonly/deep-live-cam
- Repository: https://github.com/luxxxonly/deep-live-cam

## Overview

Deep-Live-Cam is a desktop application for live and file-based face swapping, with optional enhancement, face mapping, mouth masking, and GPU acceleration. Users choose a source face and a camera or image/video target; the UI or CLI configures processing, frame processors transform frames, and the application displays or writes the result. The graph combines sampled calls with relationships named by the source index and README. Some dynamic processor dispatch and live-mode wiring are not shown in the excerpts, so those links are marked unverified.

Main entry points: [`modules/ui.py`](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/ui.py) (Desktop UI), [`modules/core.py`](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/core.py) (CLI entry), [`modules/processors/frame/face_swapper.py`](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/processors/frame/face_swapper.py) (Face swapping), [`modules/processors/frame/core.py`](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/processors/frame/core.py) (Frame dispatch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Interaction"]
  node_cli["CLI entry<br/>[core.py]"]
  node_ui["Desktop UI<br/>[ui.py]"]
  node_capture["Live capture<br/>[capturer.py]"]
  node_video_capture["Video capture<br/>[video_capture.py]"]
end

subgraph group_analysis["Face analysis"]
  node_face_analysis["Face analysis<br/>[face_analyser.py]"]
  node_clustering["Face mapping"]
end

subgraph group_processing["Frame processing"]
  node_swap["Face swapping<br/>[face_swapper.py]"]
  node_frame_core["Frame dispatch<br/>[core.py]"]
  node_masking["Mouth masking<br/>[face_masking.py]"]
  node_enhancer["Face enhancement<br/>[face_enhancer.py]"]
  node_gpen256["GPEN 256"]
  node_gpen512["GPEN 512"]
  node_onnx_enhance["ONNX enhancement<br/>[_onnx_enhancer.py]"]
end

subgraph group_runtime["Runtime support"]
  node_utilities["Media utilities<br/>[utilities.py]"]
  node_globals["Runtime settings<br/>[globals.py]"]
  node_gpu["GPU image ops<br/>[gpu_processing.py]"]
  node_models[("Model files")]
  node_downloader["Model downloader"]
  node_optimize["ONNX optimization<br/>[onnx_optimize.py]"]
  node_predicter["Frame prediction<br/>[predicter.py]"]
end

node_user(("User"))
node_camera(("Camera"))
node_huggingface(("Hugging Face"))

node_user -->|"configures"| node_ui
node_user -->|"configures"| node_cli
node_ui -.->|"starts"| node_cli
node_ui -->|"controls"| node_capture
node_camera -.->|"provides frames"| node_capture
node_ui -->|"uses"| node_video_capture
node_cli -->|"dispatches frames"| node_frame_core
node_cli -->|"uses media tools"| node_utilities
node_cli -->|"initializes"| node_ui
node_cli -->|"sets options"| node_globals
node_frame_core -->|"gets faces"| node_face_analysis
node_frame_core -.->|"dispatches processor"| node_swap
node_swap -->|"detects faces"| node_face_analysis
node_swap -->|"uses mapping"| node_clustering
node_swap -->|"uses GPU ops"| node_gpu
node_swap -->|"ensures models"| node_downloader
node_face_analysis -->|"ensures models"| node_downloader
node_face_analysis -->|"optimizes models"| node_optimize
node_frame_core -->|"reads and writes media"| node_utilities
node_enhancer -->|"uses inference"| node_onnx_enhance
node_gpen256 -->|"uses inference"| node_onnx_enhance
node_gpen512 -->|"uses inference"| node_onnx_enhance
node_onnx_enhance -->|"uses optimization"| node_optimize
node_downloader -->|"downloads models"| node_huggingface
node_downloader -->|"stores models"| node_models
node_ui -->|"uses face tools"| node_face_analysis
node_ui -->|"selects processors"| node_frame_core
node_ui -->|"uses prediction"| node_predicter
node_masking -->|"uses GPU ops"| node_gpu
node_cli -->|"configures runtime"| node_globals

click node_cli "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/core.py"
click node_ui "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/ui.py"
click node_capture "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/capturer.py"
click node_video_capture "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/video_capture.py"
click node_face_analysis "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/face_analyser.py"
click node_clustering "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/cluster_analysis.py"
click node_swap "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/processors/frame/face_swapper.py"
click node_frame_core "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/processors/frame/core.py"
click node_masking "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/processors/frame/face_masking.py"
click node_enhancer "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/processors/frame/face_enhancer.py"
click node_gpen256 "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/processors/frame/face_enhancer_gpen256.py"
click node_gpen512 "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/processors/frame/face_enhancer_gpen512.py"
click node_onnx_enhance "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/processors/frame/_onnx_enhancer.py"
click node_utilities "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/utilities.py"
click node_globals "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/globals.py"
click node_gpu "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/gpu_processing.py"
click node_models "https://github.com/luxxxonly/deep-live-cam/tree/main/models"
click node_downloader "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/model_downloader.py"
click node_optimize "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/onnx_optimize.py"
click node_predicter "https://github.com/luxxxonly/deep-live-cam/blob/main/modules/predicter.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_cli,node_ui,node_capture,node_video_capture,node_user toneBlue
class node_face_analysis,node_clustering toneAmber
class node_swap,node_frame_core,node_masking,node_enhancer,node_gpen256,node_gpen512,node_onnx_enhance toneMint
class node_utilities,node_globals,node_gpu,node_models,node_downloader,node_optimize,node_predicter toneRose
class node_camera,node_huggingface toneIndigo
```

## Components

### Interaction

- [CLI entry](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/core.py): `modules/core.py`
- [Desktop UI](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/ui.py): `modules/ui.py`
- [Live capture](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/capturer.py): `modules/capturer.py`
- [Video capture](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/video_capture.py): `modules/video_capture.py`

### Face analysis

- [Face analysis](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/face_analyser.py): `modules/face_analyser.py`
- [Face mapping](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/cluster_analysis.py): `modules/cluster_analysis.py`

### Frame processing

- [Face swapping](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/processors/frame/face_swapper.py): `modules/processors/frame/face_swapper.py`
- [Frame dispatch](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/processors/frame/core.py): `modules/processors/frame/core.py`
- [Mouth masking](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/processors/frame/face_masking.py): `modules/processors/frame/face_masking.py`
- [Face enhancement](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/processors/frame/face_enhancer.py): `modules/processors/frame/face_enhancer.py`
- [GPEN 256](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/processors/frame/face_enhancer_gpen256.py): `modules/processors/frame/face_enhancer_gpen256.py`
- [GPEN 512](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/processors/frame/face_enhancer_gpen512.py): `modules/processors/frame/face_enhancer_gpen512.py`
- [ONNX enhancement](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/processors/frame/_onnx_enhancer.py): `modules/processors/frame/_onnx_enhancer.py`

### Runtime support

- [Media utilities](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/utilities.py): `modules/utilities.py`
- [Runtime settings](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/globals.py): `modules/globals.py`
- [GPU image ops](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/gpu_processing.py): `modules/gpu_processing.py`
- [Model files](https://github.com/luxxxonly/deep-live-cam/tree/main/models): `models`
- [Model downloader](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/model_downloader.py): `modules/model_downloader.py`
- [ONNX optimization](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/onnx_optimize.py): `modules/onnx_optimize.py`
- [Frame prediction](https://github.com/luxxxonly/deep-live-cam/blob/main/modules/predicter.py): `modules/predicter.py`

### Other components

- **User**
- **Camera**
- **Hugging Face**

## Connections

- User → Desktop UI: configures (evidence: `README.md`)
- User → CLI entry: configures (evidence: `modules/core.py`)
- Desktop UI → CLI entry: starts (evidence: `modules/core.py`)
- Desktop UI → Live capture: controls (evidence: `modules/ui.py`)
- Camera → Live capture: provides frames
- Desktop UI → Video capture: uses (evidence: `modules/ui.py`)
- CLI entry → Frame dispatch: dispatches frames (evidence: `modules/core.py`)
- CLI entry → Media utilities: uses media tools (evidence: `modules/core.py`)
- CLI entry → Desktop UI: initializes (evidence: `modules/core.py`)
- CLI entry → Runtime settings: sets options (evidence: `modules/core.py`)
- Frame dispatch → Face analysis: gets faces (evidence: `modules/processors/frame/core.py`)
- Frame dispatch → Face swapping: dispatches processor (evidence: `modules/processors/frame/face_swapper.py`)
- Face swapping → Face analysis: detects faces (evidence: `modules/processors/frame/face_swapper.py`)
- Face swapping → Face mapping: uses mapping (evidence: `modules/processors/frame/face_swapper.py`)
- Face swapping → GPU image ops: uses GPU ops (evidence: `modules/processors/frame/face_swapper.py`)
- Face swapping → Model downloader: ensures models (evidence: `modules/processors/frame/face_swapper.py`)
- Face analysis → Model downloader: ensures models (evidence: `modules/face_analyser.py`)
- Face analysis → ONNX optimization: optimizes models (evidence: `modules/face_analyser.py`)
- Frame dispatch → Media utilities: reads and writes media (evidence: `modules/processors/frame/core.py`)
- Face enhancement → ONNX enhancement: uses inference (evidence: `modules/processors/frame/face_enhancer.py`)
- GPEN 256 → ONNX enhancement: uses inference (evidence: `modules/processors/frame/face_enhancer_gpen256.py`)
- GPEN 512 → ONNX enhancement: uses inference (evidence: `modules/processors/frame/face_enhancer_gpen512.py`)
- ONNX enhancement → ONNX optimization: uses optimization (evidence: `modules/processors/frame/_onnx_enhancer.py`)
- Model downloader → Hugging Face: downloads models (evidence: `modules/model_downloader.py`)
- Model downloader → Model files: stores models (evidence: `modules/model_downloader.py`)
- Desktop UI → Face analysis: uses face tools (evidence: `modules/ui.py`)
- Desktop UI → Frame dispatch: selects processors (evidence: `modules/ui.py`)
- Desktop UI → Frame prediction: uses prediction (evidence: `modules/ui.py`)
- Mouth masking → GPU image ops: uses GPU ops (evidence: `modules/processors/frame/face_masking.py`)
- CLI entry → Runtime settings: configures runtime (evidence: `modules/core.py`)
