Step 3: Train & Test - smellslikeml/LitterBug_donkey GitHub Wiki
Overview
This guide will help you train your first trashpilot after collecting plenty of samples.
Prepping your computer
Since the raspberry pi is very low specs, training is done on your regular computer. First, you'll want to copy the files necessary for training from your pi onto your computer.
scp -r [email protected]:/home/pi/mycar /path/on/your/computer
You'll need to install our version of the donkeycar library as well on your computer
#In your home directory
git clone https://github.com/smellslikeml/LitterBug_donkey.git
sudo pip3 install -e /path/to/LitterBug_donkey/
Curating data
All of the training data you've accumulated will be stored in the /path/to/mycar/tub
directory. This entails photo images and json files. Sometimes json files can become corrupted or not be written correctly to file, resulting in empty files. We recommend you try to delete any empty json files you run into. Here's a handy command that can help you find corrupted files:
donkey tubcheck /path/to/mycar/tub --fix
Training
Training is done just as described in the donkeycar docs. Run the following on your machine.
python /path/to/mycar/manage.py train --tub /path/to/mycar/tub --model /path/to/mycar/models/trashpilot
Depending on how much data you've collected, training could take a little while.
Using your Trashpilot
Congrats! You have a new trashpilot to test. You'll want to move this model onto your pi for usage
scp /path/to/mycar/models/trashpilot [email protected]:/home/pi/mycar/models/
Start Autopilot
Ssh into the LitterBug pi, run:
screen #press enter
cd mycar
python manage.py drive --model ~/mycar/models/trashpilot
Wait until the local server is up and running. Navigate to the server address, which should be 192.168.4.1:8887
. Now find the dropdown menu that reads Mode & Pilot. Choose the option Local Pilot to test the full autopilot. You should start seeing your LitterBug moving!
Training a model that can pick up trash reliably will take some experimentation. Our tips for improving the model include
- Collect more data: The more clean examples you can gather, the easier it will be for the model to pick up on important patterns. Make sure you get plenty of practice picking up trash to collect quality samples.
- Play with model architecture: There's plenty of variables you can play with to tweak the model and see if there can be any improvements. This is an excellent way to learn more about creating better models. The file that holds the model architecture is
/path/to/donkeycar/donkeycar/parts/keras.py
.
If you have any questions and/or want to share your modifications, share them on the donkeycar slack channel. Happy tinkering!