# kirteshchavhan/forgery architecture

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

- Interactive diagram: https://gitdiagram.com/kirteshchavhan/forgery
- Repository: https://github.com/kirteshchavhan/forgery

## Overview

NeuralForensics AI is a web platform for image-forgery detection, localization, and forensic reporting. The principal workflow is user upload through the dashboard to the API, which evaluates the image with a dual-stream CNN and three image-analysis techniques, fuses their findings, and can produce a PDF report. Separate capabilities include account management, dataset benchmarking, and additional forensic analyses documented in the README. The sampled API imports support its core analysis and report links; the additional techniques are preserved as capabilities, but their API wiring was not shown.

Main entry points: [`backend/app.py`](https://github.com/kirteshchavhan/forgery/blob/main/backend/app.py) (Analysis API), [`backend/dataset_manager.py`](https://github.com/kirteshchavhan/forgery/blob/main/backend/dataset_manager.py) (Dataset benchmark), [`frontend/js/app.js`](https://github.com/kirteshchavhan/forgery/blob/main/frontend/js/app.js) (Forensics dashboard), [`backend/auth.py`](https://github.com/kirteshchavhan/forgery/blob/main/backend/auth.py) (Account authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Web interface"]
  node_dashboard["Forensics dashboard<br/>[app.js]"]
end

subgraph group_service["API and accounts"]
  node_api["Analysis API<br/>[app.py]"]
  node_auth["Account authentication<br/>[auth.py]"]
  node_userstore[("User records<br/>[users.json]")]
end

subgraph group_analysis["Forensic analysis"]
  node_cnn["Dual-stream CNN<br/>[cnn_detector.py]"]
  node_localization["Grad-CAM localization<br/>[gradcam.py]"]
  node_chroma["Chrominance DCT<br/>[chrominance_dct.py]"]
  node_texture["Micro-texture analysis<br/>[micro_texture.py]"]
  node_frequency["Frequency analysis"]
  node_ensemble["Multimodal fusion<br/>[ensemble.py]"]
  node_copy_move["Copy-move matching<br/>[copy_move.py]"]
  node_ela["Error-level analysis<br/>[ela.py]"]
  node_noise["Sensor-noise analysis<br/>[noise_analysis.py]"]
  node_metadata["Metadata audit"]
end

subgraph group_operations["Benchmark and reporting"]
  node_benchmark["Dataset benchmark<br/>[dataset_manager.py]"]
  node_report["PDF report generation"]
  node_trainer["CNN training<br/>[trainer.py]"]
end

node_user(("Analyst"))

node_user -->|"submits image"| node_dashboard
node_dashboard -->|"uses API"| node_api
node_api -->|"authenticates users"| node_auth
node_auth -->|"reads and writes"| node_userstore
node_api -->|"runs detection"| node_cnn
node_api -->|"generates heatmap"| node_localization
node_api -->|"analyzes image"| node_chroma
node_api -->|"analyzes image"| node_texture
node_api -->|"analyzes image"| node_frequency
node_api -->|"fuses findings"| node_ensemble
node_api -->|"generates report"| node_report
node_api -->|"runs benchmark"| node_benchmark
node_benchmark -->|"analyzes image"| node_chroma
node_benchmark -->|"analyzes image"| node_texture
node_benchmark -->|"analyzes image"| node_frequency
node_benchmark -->|"fuses findings"| node_ensemble
node_trainer -->|"trains model"| node_cnn

click node_dashboard "https://github.com/kirteshchavhan/forgery/blob/main/frontend/js/app.js"
click node_api "https://github.com/kirteshchavhan/forgery/blob/main/backend/app.py"
click node_auth "https://github.com/kirteshchavhan/forgery/blob/main/backend/auth.py"
click node_userstore "https://github.com/kirteshchavhan/forgery/blob/main/backend/auth_data/users.json"
click node_cnn "https://github.com/kirteshchavhan/forgery/blob/main/backend/models/cnn_detector.py"
click node_localization "https://github.com/kirteshchavhan/forgery/blob/main/backend/models/gradcam.py"
click node_chroma "https://github.com/kirteshchavhan/forgery/blob/main/backend/forensics/chrominance_dct.py"
click node_texture "https://github.com/kirteshchavhan/forgery/blob/main/backend/forensics/micro_texture.py"
click node_frequency "https://github.com/kirteshchavhan/forgery/blob/main/backend/forensics/frequency_analysis.py"
click node_ensemble "https://github.com/kirteshchavhan/forgery/blob/main/backend/forensics/ensemble.py"
click node_copy_move "https://github.com/kirteshchavhan/forgery/blob/main/backend/forensics/copy_move.py"
click node_ela "https://github.com/kirteshchavhan/forgery/blob/main/backend/forensics/ela.py"
click node_noise "https://github.com/kirteshchavhan/forgery/blob/main/backend/forensics/noise_analysis.py"
click node_metadata "https://github.com/kirteshchavhan/forgery/blob/main/backend/forensics/metadata_analysis.py"
click node_benchmark "https://github.com/kirteshchavhan/forgery/blob/main/backend/dataset_manager.py"
click node_report "https://github.com/kirteshchavhan/forgery/blob/main/backend/forensics/report_generator.py"
click node_trainer "https://github.com/kirteshchavhan/forgery/blob/main/backend/models/trainer.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_dashboard toneBlue
class node_api,node_auth,node_userstore toneAmber
class node_cnn,node_localization,node_chroma,node_texture,node_frequency,node_ensemble,node_copy_move,node_ela,node_noise,node_metadata toneMint
class node_benchmark,node_report,node_trainer toneRose
class node_user toneIndigo
```

## Components

### Web interface

- [Forensics dashboard](https://github.com/kirteshchavhan/forgery/blob/main/frontend/js/app.js): `frontend/js/app.js`

### API and accounts

- [Analysis API](https://github.com/kirteshchavhan/forgery/blob/main/backend/app.py): `backend/app.py`
- [Account authentication](https://github.com/kirteshchavhan/forgery/blob/main/backend/auth.py): `backend/auth.py`
- [User records](https://github.com/kirteshchavhan/forgery/blob/main/backend/auth_data/users.json): `backend/auth_data/users.json`

### Forensic analysis

- [Dual-stream CNN](https://github.com/kirteshchavhan/forgery/blob/main/backend/models/cnn_detector.py): `backend/models/cnn_detector.py`
- [Grad-CAM localization](https://github.com/kirteshchavhan/forgery/blob/main/backend/models/gradcam.py): `backend/models/gradcam.py`
- [Chrominance DCT](https://github.com/kirteshchavhan/forgery/blob/main/backend/forensics/chrominance_dct.py): `backend/forensics/chrominance_dct.py`
- [Micro-texture analysis](https://github.com/kirteshchavhan/forgery/blob/main/backend/forensics/micro_texture.py): `backend/forensics/micro_texture.py`
- [Frequency analysis](https://github.com/kirteshchavhan/forgery/blob/main/backend/forensics/frequency_analysis.py): `backend/forensics/frequency_analysis.py`
- [Multimodal fusion](https://github.com/kirteshchavhan/forgery/blob/main/backend/forensics/ensemble.py): `backend/forensics/ensemble.py`
- [Copy-move matching](https://github.com/kirteshchavhan/forgery/blob/main/backend/forensics/copy_move.py): `backend/forensics/copy_move.py`
- [Error-level analysis](https://github.com/kirteshchavhan/forgery/blob/main/backend/forensics/ela.py): `backend/forensics/ela.py`
- [Sensor-noise analysis](https://github.com/kirteshchavhan/forgery/blob/main/backend/forensics/noise_analysis.py): `backend/forensics/noise_analysis.py`
- [Metadata audit](https://github.com/kirteshchavhan/forgery/blob/main/backend/forensics/metadata_analysis.py): `backend/forensics/metadata_analysis.py`

### Benchmark and reporting

- [Dataset benchmark](https://github.com/kirteshchavhan/forgery/blob/main/backend/dataset_manager.py): `backend/dataset_manager.py`
- [PDF report generation](https://github.com/kirteshchavhan/forgery/blob/main/backend/forensics/report_generator.py): `backend/forensics/report_generator.py`
- [CNN training](https://github.com/kirteshchavhan/forgery/blob/main/backend/models/trainer.py): `backend/models/trainer.py`

### Other components

- **Analyst**

## Connections

- Analyst → Forensics dashboard: submits image (evidence: `README.md`)
- Forensics dashboard → Analysis API: uses API (evidence: `README.md`)
- Analysis API → Account authentication: authenticates users (evidence: `backend/app.py`)
- Account authentication → User records: reads and writes (evidence: `backend/auth.py`)
- Analysis API → Dual-stream CNN: runs detection (evidence: `backend/app.py`)
- Analysis API → Grad-CAM localization: generates heatmap (evidence: `backend/app.py`)
- Analysis API → Chrominance DCT: analyzes image (evidence: `backend/app.py`)
- Analysis API → Micro-texture analysis: analyzes image (evidence: `backend/app.py`)
- Analysis API → Frequency analysis: analyzes image (evidence: `backend/app.py`)
- Analysis API → Multimodal fusion: fuses findings (evidence: `backend/app.py`)
- Analysis API → PDF report generation: generates report (evidence: `backend/app.py`)
- Analysis API → Dataset benchmark: runs benchmark (evidence: `backend/app.py`)
- Dataset benchmark → Chrominance DCT: analyzes image (evidence: `backend/dataset_manager.py`)
- Dataset benchmark → Micro-texture analysis: analyzes image (evidence: `backend/dataset_manager.py`)
- Dataset benchmark → Frequency analysis: analyzes image (evidence: `backend/dataset_manager.py`)
- Dataset benchmark → Multimodal fusion: fuses findings (evidence: `backend/dataset_manager.py`)
- CNN training → Dual-stream CNN: trains model (evidence: `backend/models/trainer.py`)
