A gesture recognition system using accelerometer and gyroscope data to classify 3 magic gestures:
Stone , Paper , and Scissors — implemented with a Random Forest classifier.
Build a machine learning pipeline that:
- Records wand gestures via motion sensors
- Preprocesses and extracts features
- Trains a classifier (Random Forest)
- Predicts the gesture class in real-time
- Records motion sensor data (acceleration + gyroscope)
- Visualizes sensor data over time
- Preprocesses and standardizes features
- Trains and evaluates a Random Forest model
- Live prediction using trained model
| Layer | Tool / Library |
|---|---|
| Data Viz | matplotlib, pandas |
| ML Model | scikit-learn |
| Preproc | pandas, joblib, os |
| Input | CSV recordings (6-axis data) |
├── recordings/ # Raw gesture data (CSV) ├── features/ # Extracted feature vectors ├── graphs/ # Saved plots of motion data ├── preprocess.py # Feature extraction + labeling ├── train_classifier.py # Train + evaluate + save model ├── yourcode.py # Predict spell from new gesture ├── plot_graphs.py # Plot gesture data ├── README.md # Project description
pip install pandas matplotlib scikit-learn joblib- Collect and Save Gesture Recordings Each recording is saved as a CSV with columns: time, accX, accY, accZ, gyroX, gyroY, gyroZ
Save recordings to the recordings/ folder. Make sure filenames contain "Stone", "Paper", or "Scissors" to label them correctly.
- Preprocess Data
python preprocess.pyExtracts mean, std, min, max from all 6 channels
Adds gesture labels
Saves result to features/features.csv
- Train the Classifier
python train_classifier.pyLoads features
Splits data (80% training, 20% test)
Trains Random Forest model
Evaluates performance
Saves random_forest_model.pkl
- Predict on New Gestures
python yourcode.pyLoads a new CSV from recordings/
Extracts features
Predicts the gesture with the trained model
Outputs predicted class (stone/paper/scissors)