A real-time AI-powered military hand signal detection system using your webcam. Built with MediaPipe, OpenCV, and Scikit-learn. Detects tactical hand signals and announces them out loud using text-to-speech.
Point your hand at the camera and the system will detect and announce the signal in real time.
| Signal | Description |
|---|---|
| Stop | Flat hand raised, palm facing forward |
| Move Out | Index finger pointing forward, arm swinging |
| Enemy | Fist with index finger pointing downward |
| Down | Palm facing down, pushing toward ground |
| Come Here | Arm extended, fingers curling toward yourself |
- MediaPipe detects 21 hand landmark points (x, y, z) per hand from your webcam feed
- Those landmark coordinates are fed into a Random Forest classifier
- The classifier predicts which military signal is being shown
- pyttsx3 announces the detected signal out loud in real time
- Python 3
- OpenCV — webcam feed and visual overlay
- MediaPipe — hand landmark detection
- Scikit-learn — Random Forest classifier
- pyttsx3 — text-to-speech output
git clone https://github.com/zayd100/MILITARY-HAND-SIGNALS-CAMERA-DETECTOR.git
cd MILITARY-HAND-SIGNALS-CAMERA-DETECTORpy -m venv venv
.\venv\Scripts\activatepip install opencv-python mediapipe scikit-learn numpy pyttsx3curl -o hand_landmarker.task https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/1/hand_landmarker.taskMILITARY-HAND-SIGNALS-CAMERA-DETECTOR/
│
├── data/ # CSV files of recorded hand landmarks
├── collect_data.py # Record your own hand signal training data
├── train_model.py # Train the AI classifier on your data
├── detect.py # Run real-time detection with voice output
└── README.md
py collect_data.py- Pick a signal number
- Perform the signal in front of your webcam
- Press
SPACEto capture 200 samples - Repeat for all 5 signals
py train_model.pyTrains a Random Forest model on your captured data and saves it as model.pkl.
py detect.pyYour webcam opens and the system detects and announces signals live.
In detect.py you can adjust:
COOLDOWN_SECONDS = 1.5 # how often it speaks when a signal is heldLower this value for faster announcements.
- Windows 10/11
- Python 3.10+
- Webcam
hand_landmarker.taskfile (downloaded separately — see setup)
- Add more signals (wedge formation, speed up, slow down)
- Full body pose detection using MediaPipe Pose
- Log detected signals with timestamps
- Build a GUI interface
- Add support for two-handed signals
Zayd — @zayd100
This project is open source and available under the MIT License.
