This project is a computer vision-based hand sign recognition system that uses OpenCV, CVZone, and a TensorFlow/Keras classification model to recognize hand gestures in real time.
The system consists of two main stages:
- Data Collection – Capturing and organizing custom hand sign images for training.
- Real-Time Classification – Using a trained machine learning model to detect and classify hand signs from a webcam feed.
The current model is trained to recognize the hand signs A, B, and C, but additional gestures can be added by collecting more data and retraining the model.
- Real-time hand detection using CVZone.
- Webcam-based hand sign classification.
- Custom dataset collection.
- Image preprocessing and normalization.
- TensorFlow/Keras model integration.
- Live prediction display with bounding boxes.
- Python 3.11
- OpenCV
- TensorFlow / Keras
- CVZone Hand Tracking Module
- NumPy
Hand-Sign-Recognition/
│
├── Data/
│ ├── A/
│ ├── B/
│ └── C/
│
├── Model/
│ ├── keras_model.h5
│ └── labels.txt
│
├── dataCollection.py
├── test.py
└── README.md
This script is used to collect the custom dataset required for training the hand sign classification model.
The program uses the webcam to capture hand images and saves them into a selected class folder. The user can collect images for different hand signs by changing the folder path in the script.
The workflow:
- Opens the webcam feed.
- Detects the user's hand using CVZone's Hand Tracking module.
- Extracts and crops the detected hand region.
- Presses
sto save the current hand image. - Stores the image inside the selected class folder.
Example:
Data/
│
├── A/
│ ├── Image_1.jpg
│ ├── Image_2.jpg
│
├── B/
│ ├── Image_1.jpg
│
└── C/
├── Image_1.jpg
To collect images for a specific hand sign, update the folder path:
folder = 'Data/A'For example:
folder = 'Data/B'will save captured images as training data for the B hand sign.
The collected dataset is then used to train the TensorFlow/Keras classification model.
This script performs real-time hand sign classification using the trained model.
The workflow:
- Opens the webcam feed.
- Detects a single hand using CVZone.
- Crops the hand region from the frame.
- Resizes and normalizes the image into a 300×300 format.
- Passes the processed image into the TensorFlow/Keras model.
- Displays the predicted hand sign in real time.
The Model folder contains the trained classification model and label mappings.
Model/
│
├── keras_model.h5
└── labels.txt
Contains the trained neural network used for classifying hand signs.
Maps the model output indexes to their corresponding labels.
Example:
0 A
1 B
2 C
python -m venv venvActivate the environment:
venv\Scripts\activatesource venv/bin/activateInstall the required packages:
pip install opencv-python
pip install tensorflow
pip install cvzone
pip install numpyRun:
python dataCollection.pyChange the folder path inside the script depending on the hand sign being collected:
folder = 'Data/A'Press s while showing the desired hand sign to save images.
Train a TensorFlow/Keras classification model using the collected images.
After training, place the generated files inside:
Model/
│
├── keras_model.h5
└── labels.txt
Start the recognition system:
python test.pyThe webcam will open and display the predicted hand sign.
Press q to exit.
Webcam
|
v
Hand Detection (CVZone)
|
v
Dataset Collection (s key)
|
v
Model Training
|
v
TensorFlow/Keras Classification
|
v
Real-Time Sign Prediction
- Expand recognition to the full sign language alphabet.
- Add dynamic gesture recognition.
- Improve accuracy with larger datasets.
- Implement word and sentence prediction.
- Deploy as a web or mobile application.
This project is intended for educational and research purposes.