# fannovel16/comfyui_controlnet_aux architecture

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

- Interactive diagram: https://gitdiagram.com/fannovel16/comfyui_controlnet_aux
- Repository: https://github.com/fannovel16/comfyui_controlnet_aux

## Overview

##### Main Components Identification

The system can be broken down into these major components:

a. Core Processing Layer
- Preprocessor Base System
- Node Wrappers Interface
- Configuration Management

b. Preprocessor Categories
- Line Extractors
- Normal and Depth Estimators
- Faces and Poses Estimators
- Semantic Segmentation
- T2IAdapter Processors
- Recolor Processors

c. External Dependencies
- Model Management
- Asset Loading System
- ComfyUI Integration Layer

##### System Architecture Representation

**┌─────────────────────────────────────────────────────────┐**
- ComfyUI Interface                      │
- ┬─────────────────────────────┘
- ↓
**┌─────────────────────────────────────────────────────────┐**
- Node Management System                      │
- ┌────────────────┐    ┌────────────────┐              │
- Node Registry │    │ Config Manager  │              │
- ┘    └────────────────┘              │
- ┬─────────────────────────────┘
- ↓
**┌─────────────────────────────────────────────────────────┐**
- Preprocessor Core                        │
- ┌────────────────┐    ┌────────────────┐              │
- Model Loader  │    │  Asset Manager │              │
- ┘    └────────────────┘              │
- ┬─────────────────────────────┘
- ↓
**┌─────────────────────────────────────────────────────────┐**
- Preprocessor Categories                  │
- ┌────────────┐ ┌─────────┐ ┌──────────┐ ┌──────────┐  │
- Line    │ │  Depth  │ │  Poses   │ │ Semantic │  │
- Extractors │ │   Maps  │ │Estimators│ │   Seg    │  │
- ┘ └─────────┘ └──────────┘ └──────────┘  │
- ┬─────────────────────────────┘
- ↓
**┌─────────────────────────────────────────────────────────┐**
- External Model Storage                   │
- (Hugging Face Hub Integration)             │
- ┘

##### Connection Types

Different types of connections:

##### Important Elements to Highlight

a. Model Management:
- Asset downloading system
- Model caching
- Version control

b. Processing Pipeline:
- Input handling
- Preprocessing steps
- Output generation

c. Integration Points:
- ComfyUI node registration
- External model loading
- Configuration management

##### Implementation Details

- The modular nature of the preprocessors
- The plugin architecture for ComfyUI
- The asset management system
- The configuration system

This system design should emphasize:

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph ComfyUI["ComfyUI Integration Layer"]
        CI["Main Interface"]:::interface
        DI["Development Interface"]:::interface
    end

    subgraph Core["Core Processing Layer"]
        NMS["Node Management System"]:::core
        PB["Preprocessor Base System"]:::core
        CM["Configuration Management"]:::config
    end

    subgraph NodeWrappers["Node Wrappers Interface"]
        direction TB
        subgraph LineExtraction["Line Extraction"]
            CE["Canny Edge"]:::processor
            LA["Line Art"]:::processor
            ML["Manga Line"]:::processor
            PD["PiDiNet"]:::processor
        end

        subgraph DepthNormal["Depth & Normal Estimation"]
            DA["Depth Anything"]:::processor
            MD["MiDaS"]:::processor
            NB["NormalBAE"]:::processor
            LR["LeReS"]:::processor
        end

        subgraph FacePose["Face & Pose Detection"]
            MF["MediaPipe Face"]:::processor
            OP["OpenPose"]:::processor
            DW["DWPose"]:::processor
            MG["Mesh Graphormer"]:::processor
        end

        subgraph Semantic["Semantic Segmentation"]
            OF["OneFormer"]:::processor
            UF["Uniformer"]:::processor
            SA["Segment Anything"]:::processor
        end
    end

    subgraph AssetManagement["Asset Management"]
        ML2["Model Loader"]:::util
        AS["Asset Search"]:::util
        LS["Logging System"]:::util
    end

    subgraph External["External Dependencies"]
        HF["HuggingFace Hub"]:::external
        GPU["GPU Processing"]:::external
    end

    ComfyUI --> Core
    Core --> NodeWrappers
    Core --> AssetManagement
    AssetManagement --> External
    NodeWrappers --> External

    %% Click Events
    click CI "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/__init__.py"
    click DI "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/dev_interface.py"
    click PB "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/src/custom_controlnet_aux/processor.py"
    click CM "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/config.example.yaml"
    click CE "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/node_wrappers/canny.py"
    click LA "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/node_wrappers/lineart.py"
    click ML "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/node_wrappers/manga_line.py"
    click PD "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/node_wrappers/pidinet.py"
    click DA "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/node_wrappers/depth_anything.py"
    click MD "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/node_wrappers/midas.py"
    click NB "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/node_wrappers/normalbae.py"
    click LR "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/node_wrappers/leres.py"
    click MF "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/node_wrappers/mediapipe_face.py"
    click OP "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/node_wrappers/openpose.py"
    click DW "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/node_wrappers/dwpose.py"
    click MG "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/node_wrappers/mesh_graphormer.py"
    click OF "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/node_wrappers/oneformer.py"
    click UF "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/node_wrappers/uniformer.py"
    click SA "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/node_wrappers/segment_anything.py"
    click ML2 "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/src/custom_controlnet_aux/util.py"
    click AS "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/search_hf_assets.py"
    click LS "https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/log.py"

    %% Styling
    classDef core fill:#2374ab
    classDef interface fill:#48cae4
    classDef processor fill:#90be6d
    classDef config fill:#f9c74f
    classDef util fill:#b5838d
    classDef external fill:#e76f51
```
