# manishak784/ai-powered-anomaly-detection-for-survillance-cameras- architecture

> Architecture diagram of the GitHub repository manishak784/ai-powered-anomaly-detection-for-survillance-cameras-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/manishak784/ai-powered-anomaly-detection-for-survillance-cameras-
- Repository: https://github.com/manishak784/ai-powered-anomaly-detection-for-survillance-cameras-

## Overview

##### Project type and purpose
- From the file names (dataset.py, learner.py, loss.py, FFC.py) and the README title “AI-powered-Anomaly-detection-for-survillance-cameras-,” this is an open-source Python toolkit for anomaly detection in surveillance camera feeds. It provides data loading, model architectures (FFC = Fast Fourier Convolution?), training loops, loss definitions, and testing routines.

##### File structure
- Top-level scripts:
- main.py – orchestrates full training or inference runs
- test.py – runs evaluation on a held-out dataset or live stream
- Core modules:
- dataset.py – data ingestion, frame extraction, augmentation
- FFC.py – model sub-module likely implementing a convolution variant
- learner.py & learner2.py – training engine wrappers, one for baseline, one for advanced training
- loss.py – definition of anomaly detection loss functions
- No separate “frontend” or “backend” folders; this is a single-library/CLI tool.
- Configuration is likely passed via command-line flags or a config file inside main.py.

##### README for additional insights
- Purpose: detect anomalies in surveillance video streams using ML.

##### Elements
- Blue for data components
- Green for model and training
- Orange for evaluation/reporting

##### Detail and essential elements
- Both training and inference paths side by side.
- Distinction between learner.py and learner2.py by placing them in parallel under the Training Engine node.
- Configuration flow from main.py to all sub-modules.
- Avoid over-complicating; break the system into the smallest coherent components listed above.

## Diagram (Mermaid)

```mermaid
graph TB
    Camera["Camera Stream / Dataset Source"]:::data
    DataLoader["Data Loader & Preprocessing"]:::data
    Model["Anomaly Detection Model (FFC)"]:::model
    Loss["Loss Function Module"]:::model
    subgraph "Training Engine"
        Learner1["Baseline (learner.py)"]:::train
        Learner2["Advanced (learner2.py)"]:::train
    end
    Orchestrator["Orchestrator & CLI (main.py)"]:::orchestrator
    Evaluation["Evaluation & Reporting (test.py)"]:::eval

    %% Data flow for training
    Camera -->|"frames"| DataLoader
    DataLoader -->|"batches"| Model
    Model -->|"predictions"| Loss
    Loss -->|"gradients"| Model
    Loss -->|"loss values"| Learner1
    Loss -->|"loss values"| Learner2
    Learner1 -->|"updated weights"| Model
    Learner2 -->|"updated weights"| Model

    %% Inference/Evaluation flow
    Camera -->|"frames"| Evaluation
    Model -->|"predictions"| Evaluation
    DataLoader -->|"batches"| Evaluation
    Evaluation -->|"reports"| UserUI["User / Report Output"]:::eval

    %% Orchestration
    Orchestrator --> DataLoader
    Orchestrator --> Model
    Orchestrator --> Learner1
    Orchestrator --> Learner2
    Orchestrator --> Evaluation

    %% Click Events
    click Camera "https://github.com/manishak784/ai-powered-anomaly-detection-for-survillance-cameras-/blob/main/dataset.py"
    click DataLoader "https://github.com/manishak784/ai-powered-anomaly-detection-for-survillance-cameras-/blob/main/dataset.py"
    click Model "https://github.com/manishak784/ai-powered-anomaly-detection-for-survillance-cameras-/blob/main/FFC.py"
    click Learner1 "https://github.com/manishak784/ai-powered-anomaly-detection-for-survillance-cameras-/blob/main/learner.py"
    click Learner2 "https://github.com/manishak784/ai-powered-anomaly-detection-for-survillance-cameras-/blob/main/learner2.py"
    click Loss "https://github.com/manishak784/ai-powered-anomaly-detection-for-survillance-cameras-/blob/main/loss.py"
    click Orchestrator "https://github.com/manishak784/ai-powered-anomaly-detection-for-survillance-cameras-/blob/main/main.py"
    click Evaluation "https://github.com/manishak784/ai-powered-anomaly-detection-for-survillance-cameras-/blob/main/test.py"

    %% Styles
    classDef data fill:#D0E6F5,stroke:#333,stroke-width:1px
    classDef model fill:#C6EBC5,stroke:#333,stroke-width:1px
    classDef train fill:#9FE2BF,stroke:#333,stroke-width:1px
    classDef orchestrator fill:#D8BFD8,stroke:#333,stroke-width:1px
    classDef eval fill:#FFD8B1,stroke:#333,stroke-width:1px
```
