We aim to predict dance moves using a combination of Random Forest and Support Vector Machine (SVM) to get the best possible accuracy. Train and test data are based on the readings obtained from two sensors (GY-521 MPU6050 3-Axis Acceleration Gyroscope 6DOF Module) attached to the dancers wrists. The raw features are Acceleration x, y, z and Rotation x, y, z. There are a total of 11 dance moves to be classified.
- Create a virtual environment in the directory
python3 -m venv venv
- Activate the virtual environment
source venv/bin/activate
- Install all the required dependencies
pip install -r requirements.txt
- Activate the virtual environment
- Resolve all the dependencies
- Run
python train_random_forest.py
to generate Random Forest model - Find the models in
.sav
format inmodels
directory - Find the training statistics and evaluation results in
eval_results
directory
To generate SVM model, run python train_svm.py
at Step 3 instead.
Alternatively, run ./fast_generate_models.sh
at Step 3 to generate both models at the same time.
See sample evaluation results here
Note that if you run this without GPU, each Machine Learning model takes around 1.5 hours to generate owing to the hyperparameter tuning involved. As such, you may want to train the models from a detached session of a terminal multiplexer.
- Activate the virtual environment
- Resolve all the dependencies
- Make sure that the code below is commented out in
train_data.py
👎
##### COMMENT OUT THE CODE BELOW BEFORE RUNNING plot.py #####
df_max_min = prep.flatten(df, interval)
df_var = prep.flatten(df, 'var', interval)
df_concat = prep.concat_df(df_max_min, df_var)
df = prep.append_truth(df_concat, number)
#############################################################
- Run
python plot.py
- Find the graphs in
.png
format inplots
directory
For some reason, adding an additional parameter in the dode to skip Step 3 makes the code runs 99999x slower. 😓
See sample plots here
- Activate the virtual environment
- Resolve all the dependencies
- Generate machine learning models
- Customise how the models generated are utilised in MLModel class (
test_model/__init__.py
file) - Run
python test.py
Note that final model can be a combination of both Random Forest and SVM.