This is a Flask-based web application that uses deep learning models (MobileNetV2 and ResNet50) to recognize and classify Indian currency notes.
- Upload an image of an Indian currency note.
- Real-time classification using pre-trained models.
- Support for multiple denominations (10, 20, 50, 100, 200, 500, 2000).
Important
Python Version Requirement: This project requires Python 3.9 to 3.12. (TensorFlow is currently not fully compatible with Python 3.13+).
-
Clone the repository:
git clone https://github.com/albinmmathew/CurrencyWebApp.git cd CurrencyWebApp -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
python app.py
If you want to retrain the models or create new ones, follow these steps using the scripts in the root directory or the training/ folder.
- Download the dataset from Kaggle: Indian Currency Note Images Dataset (2020)
- Extract the downloaded zip file into your root Project folder.
- IMPORTANT: Rename the extracted folder to simply
dataset. - Your Local Project Structure should look like this:
Project/ (Local Root Folder)
├── dataset/ # Kaggle Dataset (Download & Rename)
│ └── Indian currency dataset v1/
├── class_indices.txt # Class Mapping
├── train_mobilenet.py # Training script (MobileNetV2)
├── train_resnet.py # Training script (ResNet50)
├── compare_models.py # Comparison & Confusion Matrices
├── requirements.txt # Dependencies for training
└── CurrencyWebApp/ # Git Repository
├── training/ # Scripts (Copy to root folder to retrain)
│ ├── train_mobilenet.py
│ ├── train_resnet.py
│ ├── compare_models.py
│ └── requirements.txt # Dependencies for training
├── models/ # Latest .h5 model files
├── static/ # UI Assets (CSS, JS)
├── templates/ # HTML Templates
├── app.py # Flask Application
├── requirements.txt # Dependencies
└── class_indices.txt # Mapping file copy
Retraining should be done in the Root Folder where the dataset/ is located.
Steps:
-
Copy Necessary Files: Copy the following files from
CurrencyWebApp/training/to your root folder:train_mobilenet.pytrain_resnet.pycompare_models.pyrequirements.txtclass_indices.txt
-
Activate Virtual Environment: Ensure you are in the project folder and your venv is active:
# On Windows: venv\Scripts\activate # On macOS/Linux: source venv/bin/activate
-
Install Dependencies:
pip install -r requirements.txt
-
Run Training:
python train_mobilenet.py # For MobileNetV2 # OR python train_resnet.py # For ResNet50
-
Evaluate & Compare:
python compare_models.py
This will generate visual reports (
.pngfiles) and classification reports (.txtfiles) in the root folder.
- Copy the newly generated
.h5files into themodels/directory. - Restart the Flask server to use the updated models.
app.py: Main Flask application.models/: Contains pre-trained Keras model files.static/: CSS and client-side JavaScript.templates/: HTML templates.uploads/: Temporary storage for uploaded images.