How gowtham-369/indiancurrencynotesdetection works
Purpose and Runtime
This is a Python/Flask web application that detects Indian currency-note denominations in uploaded or camera-supplied images using a custom-trained YOLOv5 model. It returns detection results to a browser UI, which presents the value and produces client-side spoken output for accessibility. Primary runtime entry point: app.py.
HTTP Application Boundary
app.py is the application orchestrator: it serves the HTML frontend and exposes the inference-facing API consumed by browser JavaScript. The server boundary separates browser request handling from Python/PyTorch model execution.
• app.py
• templates/index.html
• static/index.js
Browser UI and Accessibility
The static frontend accepts image input, sends asynchronous requests to the Flask backend, renders returned detection information, and uses browser speech-synthesis APIs for audio output. Its backend URL is explicitly configured in the JavaScript, making deployment host configuration a frontend concern.
• templates/index.html
• static/index.js
• static/index.css
Detection Adapter
yolo_detection.py is the application-specific inference layer between Flask and the vendored YOLOv5 implementation. It is the key boundary for image preprocessing, invoking model inference, and translating detector outputs into currency-recognition results suitable for the API/UI.
• yolo_detection.py
• app.py
• yolov5/detect.py
Language/Result Conversion
language_conversion.py is a distinct application module for converting recognition output into language-oriented presentation data, likely supporting the app’s user-facing and audio-oriented result flow.
• language_conversion.py
• app.py
• static/index.js
ML Model and YOLOv5 Core
The repository vendors YOLOv5 and includes both generic pretrained weights and trained run artifacts. The custom currency model checkpoint is the likely production inference asset; YOLOv5 depends on PyTorch and handles model construction, device execution, and detection post-processing.
• yolov5/runs/train/exp/weights/best.pt
• yolov5/models/yolo.py
• yolov5/utils/general.py
Model Lifecycle and Stored Artifacts
Training, validation, and detection commands remain in-repo, alongside experiment outputs. These are offline/model-development capabilities rather than the web request path. Detection runs persist annotated media and per-image label files; training artifacts retain weights and metrics.
• yolov5/train.py
• yolov5/val.py
• yolov5/runs/detect/
• yolov5/runs/train/exp/
Inputs, Dependencies, and External Services
Sample denomination and mixed-note inputs reside under test_images/. Runtime dependencies are declared at both application and vendored-YOLO levels. The app requires Python 3.7+, Flask, PyTorch/YOLOv5 dependencies, and a browser with speech synthesis; no database or required external inference service is evident. The README identifies PythonAnywhere as a deployed hosting target and Kaggle as the source dataset.
• requirements.txt
• yolov5/requirements.txt
• test_images/
Components 18
Browser UI
- HTML page
templates/index.html - Image upload UI · Submits images asynchronously and presents recognition results.
static/index.js - UI styles
static/index.css - Speech synthesis · Produces accessible spoken result output client-side.
Flask Application
- Flask server & API · Serves the frontend and handles inference requests.
app.py - Language conversion · Converts recognition output into language-oriented data.
language_conversion.py - Detection adapter · Preprocesses images and translates detector outputs for the API.
yolo_detection.py - App dependencies
requirements.txt
YOLOv5 & Model Assets
- Detection runtime
yolov5/detect.py - Custom currency weights · Production currency-denomination model.
yolov5/runs/train/exp/weights/best.pt - YOLO model construction
yolov5/models/yolo.py - Detection utilities
yolov5/utils/general.py - Sample images · Currency-note and mixed-note inference inputs.
- YOLOv5 dependencies
yolov5/requirements.txt
Model Development
Offline training, validation, and output artifacts.
- Training command
yolov5/train.py - Validation command
yolov5/val.py - Training artifacts · Stores weights and training metrics.
- Detection artifacts · Stores annotated media and per-image labels.
Connections 19
- HTML page → Image upload UI: loads
- HTML page → UI styles: styles with
- Image upload UI → Flask server & API: uploads image to API
- Flask server & API → HTML page: serves
- Flask server & API → Detection adapter: requests detection
- Detection adapter → Detection runtime: invokes
- Detection runtime → Custom currency weights: loads
- Detection runtime → YOLO model construction: constructs model
- Detection runtime → Detection utilities: post-processes detections
- Flask server & API → Language conversion: formats result
- Language conversion → Image upload UI: presentation data
- Image upload UI → Speech synthesis: speaks result
- Sample images → Detection adapter: test input
- Training command → Training artifacts: produces
- Training artifacts → Custom currency weights: provides selected checkpoint
- Validation command → Custom currency weights: evaluates
- Detection runtime → Detection artifacts: writes outputs
- App dependencies → Flask server & API: declares runtime
- YOLOv5 dependencies → Detection runtime: declares runtime