This repository contains the source code for the project "Terrain Classification for Small Legged Robots Using Deep Learning on Tactile Data." The goal is to classify terrain types using tactile sensor data from the SAIL-R robot, enabling it to adapt its gait for more efficient locomotion. This implementation features a 1D Convolutional Neural Network (CNN) that processes raw time-series data, and its performance is benchmarked against an SVM baseline.
Follow these steps to get the project running.
- Clone the Repository:
git clone https://github.com/marshallmathers0/ML_project.git cd ML_project
- Create a Virtual Environment & Install Dependencies:
# Create and activate the environment python -m venv venv && source venv/bin/activate # Install required libraries pip install -r requirements.txt
- Generate the Dataset:
Run the following script once to create the necessary dummy data files in the
data/
directory.python create_dummy_data.py
- Train the Model:
Train the best-performing model (CNN with all features) using this command. Trained models are saved in the
models/
folder.python code/train_model.py --model_type cnn_all_features --label_type class
- Run a Prediction (Live Demo):
After training, execute the prediction script to classify a random sample.
Expected Output:
python code/predict.py
--- Running Prediction Demo --- Loading model for Label: 'class', Type: 'cnn_all_features' Classifying a random sample (ID: 412)... True Label: HF --- Prediction Result --- Predicted Label: HF Confidence: 99.12% Result: CORRECT β
The deep learning models showed a significant improvement in accuracy compared to the SVM baseline. The best results were achieved by the hybrid model that combined raw sensor data with all 33 hand-designed features.
Model | Class Accuracy | Terrain Accuracy |
---|---|---|
SVM Baseline | 84% | 70% |
CNN (Raw Data Only) | 87% | 69% |
CNN (Raw Data + Control Inputs) | 93% | 76% |
CNN (Raw Data + All Features) | 97% | 80% |
This represents an accuracy improvement of over 10% for both class and individual terrain prediction.
- This project is an implementation of the work described in "Terrain Classification for Small Legged Robots Using Deep Learning on Tactile Data" by Hojung Choi and Rachel Thomasson.
- Special thanks to Alice Wu and Tae Myung Huh for providing the original SAIL-R tactile dataset and the SVM implementation used as a baseline.