A deep learning computer vision project that recognizes 10 hand gestures from grayscale images using MobileNetV2 transfer learning.
- Overview
- Project Objective
- Technologies Used
- Model Architecture
- Dataset
- Project Structure
- Requirements
- Setup
- How to Run
- Model Performance
- Generated Outputs
- Learning Outcomes
- Future Improvements
- Author
- Internship Details
This project is part of the SkillCraft Technology Machine Learning Internship. It classifies images from the LeapGestRecog dataset into 10 hand gesture categories.
Workflow:
- Inspect and organize the gesture dataset
- Create subject-based training, validation, and testing splits
- Convert grayscale images to RGB and resize them to 128 Γ 128 pixels
- Use MobileNetV2 pretrained on ImageNet as a feature extractor
- Train and evaluate a 10-class classifier
- Generate training graphs and a confusion matrix
- Perform real-time recognition with a webcam
Build a multi-class CNN system that accurately recognizes hand gestures while keeping people in the test set separate from people in the training set.
- Python 3.10+
- TensorFlow / Keras
- MobileNetV2
- NumPy
- Scikit-learn
- Matplotlib
- Seaborn
- OpenCV
- Transfer learning
The pretrained MobileNetV2 base is frozen and connected to a custom classification head.
Input Image (128 x 128 grayscale)
|
v
Convert to RGB
|
v
MobileNetV2 (ImageNet)
|
v
Global Average Pooling
|
v
Dropout (0.2)
|
v
Dense Layer (10 units, Softmax)
|
v
Gesture Prediction
| Parameter | Value |
|---|---|
| Input size | 128 Γ 128 Γ 3 |
| Batch size | 4 |
| Epochs | 3 |
| Optimizer | Adam |
| Loss | Sparse categorical crossentropy |
| Random seed | 42 |
| Classes | 10 |
The project uses the LeapGestRecog dataset:
- 10 subjects
- 10 gesture classes
- 200 images per class for each subject
- 20,000 images in total
| Split | Subjects | Images |
|---|---|---|
| Training | 00-06 | 14,000 |
| Validation | 07 | 2,000 |
| Testing | 08-09 | 4,000 |
palm, l, fist, fist_moved, thumb, index, ok, palm_moved, c, down
SCT_ML_Task4/
βββ README.md
βββ requirements.txt
βββ dataset/
β βββ leapGestRecog/
β βββ 00/
β βββ 01/
β βββ ...
β βββ 09/
βββ models/
β βββ gesture_model.keras
βββ results/
β βββ confusion_matrix.png
β βββ training_accuracy.png
β βββ training_loss.png
βββ src/
β βββ inspect_dataset.py
β βββ train.py
β βββ evaluate.py
βββ demo/
βββ webcam.py
The virtual environment and temporary editor files are intentionally excluded from this structure.
Python 3.10+ and a webcam are recommended. Install the project dependencies with:
pip install -r requirements.txtWindows PowerShell:
python -m venv .venv
.\.venv\Scripts\Activate.ps1Windows Command Prompt:
python -m venv .venv
.venv\Scripts\activate.batpip install -r requirements.txtPlace the LeapGestRecog subject folders inside:
dataset/leapGestRecog/
The folder must contain subjects 00 through 09, each with the 10 gesture-class folders.
Before training or evaluation, set DATASET_PATH in src/train.py and src/evaluate.py to the location of your local leapGestRecog folder.
python src/inspect_dataset.pypython src/train.pyThe trained model is saved to models/gesture_model.keras and training graphs are saved to results/.
python src/evaluate.pyThis generates the confusion matrix and classification metrics for the test subjects.
python demo/webcam.pyPress q in the webcam window to quit.
| Metric | Value |
|---|---|
| Test Accuracy | 94.15% |
| Test Loss | 0.1526 |
| Test Images | 4,000 |
The test set contains 400 images for each gesture class.
| File | Description |
|---|---|
models/gesture_model.keras |
Saved trained model |
results/training_accuracy.png |
Training and validation accuracy |
results/training_loss.png |
Training and validation loss |
results/confusion_matrix.png |
Class-level prediction performance |
- Image classification with CNNs
- Transfer learning with MobileNetV2
- Subject-based dataset splitting
- Grayscale image preprocessing and RGB conversion
- Multi-class classification with softmax output
- Evaluation using accuracy, precision, recall, F1-score, and confusion matrices
- Real-time webcam-based computer vision
- Fine-tune selected MobileNetV2 layers
- Apply additional image augmentation
- Improve webcam prediction stability
- Add gesture tracking
- Compare other CNN architectures
- Deploy the model as a desktop or web application
Devarakonda Vignesh Varsha
| Detail | Information |
|---|---|
| Internship | SkillCraft Technology |
| Domain | Machine Learning |
| Task | Task 04 - Hand Gesture Recognition |
| Model | MobileNetV2 Transfer Learning |
| Dataset | LeapGestRecog |
| Test Accuracy | 94.15% |
Built with β€οΈ during SkillCraft Technology ML Internship