# mnewer/anticake architecture

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

- Interactive diagram: https://gitdiagram.com/mnewer/anticake
- Repository: https://github.com/mnewer/anticake

## Overview

##### Project Type Analysis
This appears to be a machine learning/computer vision application with the following key components:
- Image processing pipeline
- Face detection and alignment system
- Model training functionality
- GUI interface
- Camera integration

##### Main Components

A. Input Layer:
- Camera Input (utils/camera.py)
- Image Input (utils/imageFaceRecognition.py)
- GUI Interface (gui.py)

B. Processing Pipeline:
- Quality Check Module (utils/imageQualityCheck.py)
- Face Detection Module (using Haar Cascades)
- Face Alignment Module (utils/alignFaces.py)
- Undetectable Face Removal (utils/removeUndetectable.py)

C. Model Layer:
- Training Module (utils/training.py)
- Trained Models Storage (model/trained_model.yml, model/trained_modelFisher.yml)

**[Input Sources]**
- ↓
**[Preprocessing Pipeline]**
- ↓
**[Face Processing]**
- ↓
**[Model Operations]**
- ↓
**[Output/Results]**

##### Specific Elements

a. Input Layer (Top):

b. Processing Pipeline (Middle):
1. Image Quality Check
2. Face Detection (with Haar Cascade files)
3. Face Alignment
4. Undetectable Face Removal

c. Model Layer (Bottom):
- Model storage component
- Inference path

##### Connection Types

- Double lines: High-bandwidth data transfer

##### Additional Details

Callouts for:
- Haar Cascade files used (haarcascade_*.xml)
- Model file formats (YML)
- Python dependencies (from requirements.txt)

##### Optimization Flow

Training pipeline separately from the inference pipeline, with clear indication of where the trained models are saved and loaded.

Remember to:
- Clear labels for each module
- Brief descriptions for complex processes
- Error handling paths
- Where configuration files are used

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        CAM[Camera Input]
        IMG[Image Input]
        GUI[GUI Interface]
    end

    subgraph Processing
        QC[Quality Check]
        FD[Face Detection]
        FA[Face Alignment]
        UFR[Undetectable Face Removal]
    end

    subgraph "Face Detection Resources"
        HC1[Haar Cascade - Frontal Face]
        HC2[Haar Cascade - Eye]
        HC3[Haar Cascade - Cat Face]
    end

    subgraph "Model Operations"
        TM[Training Module]
        MS1[Trained Model]
        MS2[Trained Fisher Model]
    end

    %% Main flow
    CAM --> GUI
    IMG --> GUI
    GUI --> QC
    QC --> FD
    FD --> FA
    FA --> UFR
    UFR --> TM
    TM --> MS1
    TM --> MS2

    %% Face Detection Resources connections
    HC1 -.-> FD
    HC2 -.-> FD
    HC3 -.-> FD

    %% Click events
    click CAM "https://github.com/Mnewer/AntiCake/blob/main/utils/camera.py"
    click IMG "https://github.com/Mnewer/AntiCake/blob/main/utils/imageFaceRecognition.py"
    click GUI "https://github.com/Mnewer/AntiCake/blob/main/gui.py"
    click QC "https://github.com/Mnewer/AntiCake/blob/main/utils/imageQualityCheck.py"
    click HC1 "https://github.com/Mnewer/AntiCake/blob/main/utils/haarcascade_frontalface_default.xml"
    click HC2 "https://github.com/Mnewer/AntiCake/blob/main/utils/haarcascade_eye.xml"
    click HC3 "https://github.com/Mnewer/AntiCake/blob/main/utils/haarcascade_frontalcatface_extended.xml"
    click FA "https://github.com/Mnewer/AntiCake/blob/main/utils/alignFaces.py"
    click UFR "https://github.com/Mnewer/AntiCake/blob/main/utils/removeUndetectable.py"
    click TM "https://github.com/Mnewer/AntiCake/blob/main/utils/training.py"
    click MS1 "https://github.com/Mnewer/AntiCake/blob/main/model/trained_model.yml"
    click MS2 "https://github.com/Mnewer/AntiCake/blob/main/model/trained_modelFisher.yml"

    %% Styling
    classDef input fill:#a8d1ff
    classDef processing fill:#90EE90
    classDef resources fill:#FFE5B4
    classDef model fill:#FFB6C1
    
    class CAM,IMG,GUI input
    class QC,FD,FA,UFR processing
    class HC1,HC2,HC3 resources
    class TM,MS1,MS2 model

    %% Legend
    subgraph Legend
        L1[Input Components]:::input
        L2[Processing Components]:::processing
        L3[Resources]:::resources
        L4[Model Components]:::model
    end
```
