This project implements a Convolutional Neural Network (CNN) to recognize hand gestures from the "LeapGestRecog" dataset, available on Kaggle.
The project follows these main steps:
- Dataset Download:
- Utilizes
kagglehubto download the "gti-upm/leapgestrecog" dataset.
- Utilizes
- Data Loading and Preprocessing:
- Loads images and their corresponding labels.
- Verifies image consistency in size (240x640 grayscale).
- Splits the dataset into training and testing sets (80/20 split).
- Normalizes pixel values to the range [0, 1].
- Shuffles the data to ensure randomness.
- Model Building:
- Constructs a CNN model using TensorFlow/Keras.
- The model architecture includes:
- Convolutional layer (
Conv2D) for feature extraction. - Max pooling layer (
MaxPooling2D) for dimensionality reduction. - Flatten layer.
- Dense layers with ReLU and softmax activation functions for classification.
- Convolutional layer (
- Model Compiled using the Adam optimizer, and sparse categorical cross entropy loss function.
- Model Training:
- Trains the CNN model on the training data.
- Monitors training and validation loss and accuracy.
- Model Evaluation:
- Evaluates the trained model on the test data.
- Generates a confusion matrix and classification report to assess performance.
- Plots the training and validation loss and accuracy.
- Model Saving:
- Saves the trained model to a file named "hand_recognition_model.keras".
kagglehubnumpypandasmatplotlibopencv-python (cv2)tensorflowscikit-learnseaborn
The "LeapGestRecog" dataset contains images of hand gestures, categorized into 10 classes.
The model achieves high accuracy on the test data, demonstrating its effectiveness in hand gesture recognition. The confusion matrix and classification report provide detailed insights into the model's performance for each gesture class.