# rsingh230105/fake_product_detector architecture

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

- Interactive diagram: https://gitdiagram.com/rsingh230105/fake_product_detector
- Repository: https://github.com/rsingh230105/fake_product_detector

## Overview

This is a Django product-authenticity web application backed by image-analysis utilities and a separate MobileNetV2 training pipeline. The principal workflow is user image upload, validation, authenticity analysis, persistence, and a user-facing result. The README documents OCR, barcode, logo, and packaging checks; sampled views and utility excerpts establish the web-to-analysis/report path, but do not expose all internal analyzer calls, so those links are documented at a high level.

Main entry points: [`webapp/detector/views.py`](https://github.com/rsingh230105/fake_product_detector/blob/main/webapp/detector/views.py) (Django views), [`webapp/detector/utils/ml_utils.py`](https://github.com/rsingh230105/fake_product_detector/blob/main/webapp/detector/utils/ml_utils.py) (Inference utilities), [`model_pipeline/config.py`](https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/config.py) (Pipeline configuration), [`model_pipeline/train.py`](https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/train.py) (Training pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_views["Django views<br/>[views.py]"]
  node_routes["App routes<br/>[urls.py]"]
  node_upload_validation["Upload validation<br/>[validators.py]"]
  node_records[("Product and user records<br/>[models.py]")]
end

subgraph group_analysis["Authenticity analysis"]
  node_ml_inference["Inference utilities<br/>[ml_utils.py]"]
  node_reports["Readable result reports"]
  node_cnn["MobileNetV2 classifier<br/>[model.py]"]
  node_ocr["OCR checks<br/>[ocr_module.py]"]
  node_barcode["Barcode checks<br/>[barcode_module.py]"]
  node_fusion["Analysis fusion<br/>[fusion_model.py]"]
end

subgraph group_training["Model training and evaluation"]
  node_train["Training pipeline<br/>[train.py]"]
  node_train_enhanced["Enhanced training<br/>[train_enhanced.py]"]
  node_data["Training data loading<br/>[data_loader.py]"]
  node_config["Pipeline configuration<br/>[config.py]"]
  node_evaluation["Model evaluation<br/>[evaluate.py]"]
  node_prediction["Pipeline prediction<br/>[predict.py]"]
  node_preprocessing["Image preprocessing<br/>[preprocessing.py]"]
end

subgraph group_content["Accounts and content"]
  node_forms["Account and content forms<br/>[forms.py]"]
  node_admin["Content administration<br/>[admin.py]"]
  node_templates["Web pages"]
end

node_user(("Product checker"))

node_user -->|"requests analysis"| node_routes
node_routes -->|"routes to"| node_views
node_views -->|"validates uploads"| node_upload_validation
node_views -->|"runs analysis"| node_ml_inference
node_views -->|"builds report"| node_reports
node_views -->|"saves analysis"| node_records
node_ml_inference -->|"classifies images"| node_cnn
node_ml_inference -->|"extracts text"| node_ocr
node_ml_inference -->|"checks barcode"| node_barcode
node_ml_inference -.->|"combines checks"| node_fusion
node_train -->|"loads settings"| node_config
node_train -->|"builds classifier"| node_cnn
node_train_enhanced -->|"loads settings"| node_config
node_train_enhanced -->|"builds classifier"| node_cnn
node_train -.->|"loads datasets"| node_data
node_evaluation -->|"loads settings"| node_config
node_prediction -->|"loads settings"| node_config
node_preprocessing -->|"loads settings"| node_config
node_forms -->|"validates records"| node_records
node_admin -->|"manages content"| node_records
node_views -->|"uses forms"| node_forms
node_views -.->|"renders pages"| node_templates

click node_views "https://github.com/rsingh230105/fake_product_detector/blob/main/webapp/detector/views.py"
click node_routes "https://github.com/rsingh230105/fake_product_detector/blob/main/webapp/detector/urls.py"
click node_upload_validation "https://github.com/rsingh230105/fake_product_detector/blob/main/webapp/detector/validators.py"
click node_records "https://github.com/rsingh230105/fake_product_detector/blob/main/webapp/detector/models.py"
click node_ml_inference "https://github.com/rsingh230105/fake_product_detector/blob/main/webapp/detector/utils/ml_utils.py"
click node_reports "https://github.com/rsingh230105/fake_product_detector/blob/main/webapp/detector/utils/report_generator.py"
click node_cnn "https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/model.py"
click node_ocr "https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/ocr_module.py"
click node_barcode "https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/barcode_module.py"
click node_fusion "https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/fusion_model.py"
click node_train "https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/train.py"
click node_train_enhanced "https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/train_enhanced.py"
click node_data "https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/data_loader.py"
click node_config "https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/config.py"
click node_evaluation "https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/evaluate.py"
click node_prediction "https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/predict.py"
click node_preprocessing "https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/preprocessing.py"
click node_forms "https://github.com/rsingh230105/fake_product_detector/blob/main/webapp/detector/forms.py"
click node_admin "https://github.com/rsingh230105/fake_product_detector/blob/main/webapp/detector/admin.py"
click node_templates "https://github.com/rsingh230105/fake_product_detector/tree/main/webapp/detector/templates"

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_views,node_routes,node_upload_validation,node_records toneBlue
class node_ml_inference,node_reports,node_cnn,node_ocr,node_barcode,node_fusion toneAmber
class node_train,node_train_enhanced,node_data,node_config,node_evaluation,node_prediction,node_preprocessing toneMint
class node_forms,node_admin,node_templates toneRose
class node_user toneIndigo
```

## Components

### Web application

- [Django views](https://github.com/rsingh230105/fake_product_detector/blob/main/webapp/detector/views.py): `webapp/detector/views.py`
- [App routes](https://github.com/rsingh230105/fake_product_detector/blob/main/webapp/detector/urls.py): `webapp/detector/urls.py`
- [Upload validation](https://github.com/rsingh230105/fake_product_detector/blob/main/webapp/detector/validators.py): `webapp/detector/validators.py`
- [Product and user records](https://github.com/rsingh230105/fake_product_detector/blob/main/webapp/detector/models.py): `webapp/detector/models.py`

### Authenticity analysis

- [Inference utilities](https://github.com/rsingh230105/fake_product_detector/blob/main/webapp/detector/utils/ml_utils.py): `webapp/detector/utils/ml_utils.py`
- [Readable result reports](https://github.com/rsingh230105/fake_product_detector/blob/main/webapp/detector/utils/report_generator.py): `webapp/detector/utils/report_generator.py`
- [MobileNetV2 classifier](https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/model.py): `model_pipeline/model.py`
- [OCR checks](https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/ocr_module.py): `model_pipeline/ocr_module.py`
- [Barcode checks](https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/barcode_module.py): `model_pipeline/barcode_module.py`
- [Analysis fusion](https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/fusion_model.py): `model_pipeline/fusion_model.py`

### Model training and evaluation

- [Training pipeline](https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/train.py): `model_pipeline/train.py`
- [Enhanced training](https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/train_enhanced.py): `model_pipeline/train_enhanced.py`
- [Training data loading](https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/data_loader.py): `model_pipeline/data_loader.py`
- [Pipeline configuration](https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/config.py): `model_pipeline/config.py`
- [Model evaluation](https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/evaluate.py): `model_pipeline/evaluate.py`
- [Pipeline prediction](https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/predict.py): `model_pipeline/predict.py`
- [Image preprocessing](https://github.com/rsingh230105/fake_product_detector/blob/main/model_pipeline/preprocessing.py): `model_pipeline/preprocessing.py`

### Accounts and content

- [Account and content forms](https://github.com/rsingh230105/fake_product_detector/blob/main/webapp/detector/forms.py): `webapp/detector/forms.py`
- [Content administration](https://github.com/rsingh230105/fake_product_detector/blob/main/webapp/detector/admin.py): `webapp/detector/admin.py`
- [Web pages](https://github.com/rsingh230105/fake_product_detector/tree/main/webapp/detector/templates): `webapp/detector/templates`

### Other components

- **Product checker**

## Connections

- Product checker → App routes: requests analysis (evidence: `README.md`)
- App routes → Django views: routes to (evidence: `webapp/detector/urls.py`)
- Django views → Upload validation: validates uploads (evidence: `webapp/detector/views.py`)
- Django views → Inference utilities: runs analysis (evidence: `webapp/detector/views.py`)
- Django views → Readable result reports: builds report (evidence: `webapp/detector/views.py`)
- Django views → Product and user records: saves analysis (evidence: `webapp/detector/views.py`)
- Inference utilities → MobileNetV2 classifier: classifies images (evidence: `README.md`)
- Inference utilities → OCR checks: extracts text (evidence: `README.md`)
- Inference utilities → Barcode checks: checks barcode (evidence: `README.md`)
- Inference utilities → Analysis fusion: combines checks
- Training pipeline → Pipeline configuration: loads settings (evidence: `model_pipeline/train.py`)
- Training pipeline → MobileNetV2 classifier: builds classifier (evidence: `model_pipeline/train.py`)
- Enhanced training → Pipeline configuration: loads settings (evidence: `model_pipeline/train_enhanced.py`)
- Enhanced training → MobileNetV2 classifier: builds classifier (evidence: `model_pipeline/train_enhanced.py`)
- Training pipeline → Training data loading: loads datasets
- Model evaluation → Pipeline configuration: loads settings (evidence: `model_pipeline/evaluate.py`)
- Pipeline prediction → Pipeline configuration: loads settings (evidence: `model_pipeline/predict.py`)
- Image preprocessing → Pipeline configuration: loads settings (evidence: `model_pipeline/preprocessing.py`)
- Account and content forms → Product and user records: validates records (evidence: `webapp/detector/forms.py`)
- Content administration → Product and user records: manages content (evidence: `webapp/detector/admin.py`)
- Django views → Account and content forms: uses forms (evidence: `webapp/detector/views.py`)
- Django views → Web pages: renders pages
