# vikramforsk2019/vehicle-plate-identify architecture

> Architecture diagram of the GitHub repository vikramforsk2019/vehicle-plate-identify, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vikramforsk2019/vehicle-plate-identify
- Repository: https://github.com/vikramforsk2019/vehicle-plate-identify

## Overview

##### Project type and purpose
- This is a full-stack, single-service web application.
- Purpose: users upload car images via a browser UI; the server runs YOLOv3 to detect license plates, crops them, runs OCR, and returns an annotated image or plate text.

##### File structure
Top-level files:
- Procfile – deploy on Heroku or similar.
- app.py – Flask entry point that wires routes to detection logic.
- requirements.txt – Python dependencies (Flask, TensorFlow/PyTorch, OpenCV, OCR libs).
- darknet-yolov3.cfg, classes.names, lapi.weights – YOLOv3 model definition, labels, and trained weights.
- ocr_core.py – logic to perform OCR on cropped plate images.
Directories:
- static/ – client assets (index.js, style.css), upload folder for images, detect_cut folder for cropped plates.
- templates/ – HTML templates for upload form and results.

##### README for additional insights
- Detailed pipeline for data preparation, training Darknet YOLOv3 on plate datasets.
- Instructions for using the Flask API.
- References to Google Drive folder structure (training artifacts).

##### Detail
- Every folder that holds runtime artifacts (static/uploads, static/detect_cut).
- Call out config & weight files loading by the YOLO component.
- Flow from cropping to OCR and back to the user.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External User
    User["User"]:::external

    %% Front-End Layer
    subgraph "Front-End (Browser)" 
        direction TB
        FE_HTML["Upload Form (templates/upload.html)"]:::frontend
        FE_JS["Client Script (static/index.js)"]:::frontend
        FE_CSS["Stylesheet (static/style.css)"]:::frontend
    end

    %% Back-End Layer
    subgraph "Back-End (Flask Server)" 
        direction TB
        Flask["Flask Server\n(app.py)"]:::backend
    end

    %% Inference Layer
    subgraph "Model Inference" 
        direction TB
        YOLO["YOLOv3 Engine\n(yolo_detection.py)"]:::ml
        OCR["OCR Engine\n(ocr_core.py)"]:::ml
    end

    %% Storage Layer
    subgraph "File System Storage" 
        direction TB
        Uploads["Uploads Folder\n(static/uploads/)"]:::storage
        Crops["Crops Folder\n(static/detect_cut/)"]:::storage
    end

    %% Deployment
    Deployment["Heroku (Procfile)"]:::external

    %% Data Flows
    User -->|"opens upload page"| FE_HTML
    FE_HTML -->|"JavaScript POST"| FE_JS
    FE_JS -->|"HTTP POST /upload"| Flask
    Flask -->|"run inference"| YOLO
    YOLO -->|"save crops"| Crops
    Flask -->|"run OCR on crops"| OCR
    OCR -->|"text result"| Flask
    Flask -->|"render result"| FE_HTML
    Deployment -->|"deploys"| Flask

    %% Click Events
    click FE_HTML "https://github.com/vikramforsk2019/vehicle-plate-identify/blob/main/templates/upload.html"
    click FE_JS "https://github.com/vikramforsk2019/vehicle-plate-identify/blob/main/static/index.js"
    click FE_CSS "https://github.com/vikramforsk2019/vehicle-plate-identify/blob/main/static/style.css"
    click Flask "https://github.com/vikramforsk2019/vehicle-plate-identify/blob/main/app.py"
    click YOLO "https://github.com/vikramforsk2019/vehicle-plate-identify/blob/main/yolo_detection.py"
    click OCR "https://github.com/vikramforsk2019/vehicle-plate-identify/blob/main/ocr_core.py"
    click Uploads "https://github.com/vikramforsk2019/vehicle-plate-identify/tree/main/static/uploads/"
    click Crops "https://github.com/vikramforsk2019/vehicle-plate-identify/tree/main/static/detect_cut/"
    click Deployment "https://github.com/vikramforsk2019/vehicle-plate-identify/tree/main/Procfile"

    %% Styles
    classDef frontend fill:#D0E6FF,stroke:#3399FF,stroke-width:1px;
    classDef backend fill:#DFF7E0,stroke:#33CC33,stroke-width:1px;
    classDef ml fill:#FFE8CC,stroke:#FF9900,stroke-width:1px;
    classDef storage fill:#E0E0E0,stroke:#666666,stroke-width:1px;
    classDef external fill:#F0E0FF,stroke:#9933CC,stroke-width:1px;
```
