This project aims to recognize hand gestures using Convolutional Neural Networks (CNN) and OpenCV. It involves data augmentation, CNN model training, and integration with OpenCV for real-time gesture recognition.
This repository contains scripts and models for:
- Data augmentation using Keras' ImageDataGenerator.
- CNN model creation and training for hand gesture recognition.
- OpenCV integration to detect and classify gestures in real-time.
This model, trained with augmented data, initially achieved an accuracy of around 95.67% on the test data. However, it exhibited signs of overfitting, affecting its generalization.
The second model, CNN_model02.h5
, was developed to address overfitting concerns observed in the initial model. Through strategic adjustments, including added dropout layers and regularization techniques, this model aims to mitigate overfitting issues while maintaining or improving overall accuracy.
data_augmentation.py
: Script to perform data augmentation on the input dataset.- Usage example:
python data_augmentation.py input_directory output_directory
model_training.py
: Script to build, train, and evaluate the CNN model.
gesture_detection.py
: Code utilizing OpenCV and cvzone for real-time gesture recognition.- Usage:
- Ensure all dependencies are installed (
requirements.txt
). - Run the script to access the webcam and perform gesture recognition.
- Ensure all dependencies are installed (
- Python 3.x
- Libraries: Keras, OpenCV, cvzone, matplotlib, pandas, scikit-learn, seaborn
The CNN_model02.h5
script addresses overfitting by incorporating dropout layers and regularization techniques. It includes usage instructions and documentation within the codebase.
Caption: Real-time gesture detection using OpenCV.
Caption: Real-time gesture detection using OpenCV.
- The dataset used for training and testing the models can be found on Kaggle.
- For this project, we specifically used only the 'A', 'B', 'C', 'F', 'K', and 'Y' classes from the ASL alphabet dataset.
- We've labeled these classes as follows: "Down", "Up", "Right", "Back", "Front", and "Left". These labels correspond to distinct movements for controlling the AirSim drone.
- Tello_Test.py controls the DJI Tello drone using recognized hand gestures. The gestures correspond to specific drone movements triggered upon detection.
- AirSim_Test.py controls the drone in the AirSim environment based on recognized hand gestures. The gestures correspond to distinct movements, triggering specific actions for the AirSim drone.
AirSim_Drone_Control.py
The recognized gestures correspond to distinct movements for the AirSim drone:
Down: Move the drone downwards. Up: Move the drone upwards. Right: Move the drone to the right. Back: Move the drone backward. Front: Move the drone forward. Left: Move the drone to the left. These gestures trigger specific actions for the drone when detected.
You can feel free to contribute by forking the repository and submitting pull requests. Bug fixes, enhancements, and new features are welcome!
This project is licensed under the MIT License.