A real-time hand gesture recognition system using MediaPipe and PyTorch to control system commands like opening a terminal, copying text, or pausing videos.
- ✅ Real-time gesture recognition using webcam
- ✅ Context-aware gesture modes (
media_mode,word_mode,presentation_mode) - ✅ Customizable gesture-to-action mappings
- ✅ Streamlit UI for editing gesture mappings
- ✅ Cross-platform (macOS, Linux, Windows)
GesturAI/
│
├── actions.py # Maps gestures to system commands
├── collect_data.py # Collects gesture data via webcam
├── gesture_data.pkl # (ignored) Collected training data
├── gesture_model.pth # (ignored) Trained PyTorch model
├── label_map.pkl # (ignored) Label-to-gesture mapping
├── model.py # PyTorch MLP model definition
├── run_gesture_control.py # Main real-time gesture prediction script
├── training.py # Trains the classifier
├── hand_tracker.py # MediaPipe-based hand landmark tracking
├── gesture_ui_mapper.py # Streamlit app for updating gesture mappings
├── gesture_cli_mapper.py # CLI to update gesture-action mapping
├── gesture_config.json # Saved gesture-action mappings
├── requirements.txt # All dependencies
└── README.md # Project overview
pip install -r requirements.txtpython collect_data.pypython training.py# Option A: Streamlit UI
streamlit run gesture_ui_mapper.py
# Option B: CLI
python gesture_cli_mapper.pypython run_gesture_control.py| Gesture | Action | Context |
|---|---|---|
fist |
Open Terminal | default |
thumbs_up |
Open Browser | default |
peace_sign |
Copy | word_mode |
palm |
Paste | word_mode |
pinch |
Pause YouTube | media_mode |
swipe_right |
Next Slide | presentation_mode |
swipe_left |
Previous Slide | presentation_mode |
defaultword_modemedia_modepresentation_mode
You can switch between modes using trigger gestures like three_fingers, peace_sign, or ok_sign.
Use gesture_ui_mapper.py to:
- Add new gestures
- Map gestures to system actions
- Delete or reset mappings
- Save to
gesture_config.json
- Record your own custom gestures
- Add voice feedback or sound effects
- Integrate with specific apps (Zoom, PowerPoint, etc.)
- Cloud-hosted UI for remote gesture mapping