A real-time hand sign recognition system that detects static hand gestures using MediaPipe Hands and classifies them using a TensorFlow Deep Neural Network (DNN). The project recognizes hand signs such as A, B, and C from a webcam feed.
- Real-time hand detection using MediaPipe
- Hand landmark extraction (21 landmarks, 63 features)
- Deep Neural Network for hand sign classification
- Live webcam prediction
- Confidence score visualization
- Easy to extend for additional hand signs
WasteDetection/
│
├── Data/
│ ├── A/
│ ├── B/
│ └── C/
│
├── MP_Data/
│ ├── A/
│ ├── B/
│ └── C/
│
├── Logs/
│
├── function.py
├── datacollection.py
├── data.py
├── trainmodel.py
├── app.py
├── model.keras
├── requirements.txt
└── README.md
- Python 3.10+
- TensorFlow / Keras
- MediaPipe
- OpenCV
- NumPy
- Scikit-learn
git clone https://github.com/yourusername/Hand-Sign-Recognition.git
cd Hand-Sign-RecognitionWindows
python -m venv .venvActivate
.venv\Scripts\activatepip install -r requirements.txtThe dataset consists of static hand images.
Classes:
- A
- B
- C
Each class contains approximately 30 images.
The images are captured using the webcam and stored in the Data folder.
Run
python datacollection.pyThis captures hand images for each gesture.
Run
python data.pyThis extracts
- 21 hand landmarks
- x, y, z coordinates
Total Features:
21 × 3 = 63
The extracted features are stored as .npy files inside MP_Data.
Run
python trainmodel.pyThis
- Loads all keypoints
- Splits the dataset
- Trains a Deep Neural Network
- Saves the trained model as
model.keras
Run
python app.pyThe webcam opens and predicts the detected hand sign in real time.
Press
Q
to quit.
Input Layer
│
▼
Dense (128)
│
Dropout (0.3)
│
Dense (64)
│
Dropout (0.3)
│
Dense (32)
│
Output Layer
(Softmax)
Input Features:
63
Output Classes:
3
MediaPipe detects 21 hand landmarks.
Each landmark contains
- x
- y
- z
Total features:
63
These features are used for training instead of raw images.
- Add all 26 alphabet signs
- Add digit recognition (0–9)
- Improve dataset size
- Support two-hand gestures
- Build sentence recognition
- Add speech output
- Deploy as a web application using Streamlit
- Deploy using Flask or FastAPI
Example
tensorflow==2.15.0
mediapipe==0.10.14
opencv-python
numpy
scikit-learn
matplotlib
Ruchika Bambal
B.Tech Student
Interested in AI, Machine Learning, Computer Vision, and Web Development.
- Google MediaPipe
- TensorFlow
- OpenCV
- Scikit-learn
This project is created for educational and learning purposes.
Feel free to use and modify it.