Code used to train an augmented auto-encoder (aka denoising auto-encoder with more augmentations) for the DonkeyCar simulator.
Presentation: Learning To Race in Hours
-
Download and launch the donkey car simulator
-
Install dependencies
# Install current package
pip install -e .
# If not using custom donkey car gym
pip install git+https://github.com/araffin/gym-donkeycar-1@feat/live-twitch
- Drive around randomly (make sure to check the script first)
python record_data.py --max-steps 10000 -f logs/dataset-mountain
- [Optional, only a folder with images is required] Split video into a sequence of images
python -m ae.split_video -i logs/videos/video.mp4 -o logs/dataset/
- Train the autoencoder (with data-augmentation)
python -m ae.train_ae --n-epochs 100 --batch-size 8 --z-size 32 -f logs/dataset-test/ --verbose 0
# You can train on multiple datasets easily:
python -m ae.train_ae --n-epochs 200 --z-size 32 -f logs/dataset-0/ logs/dataset-1/ --batch-size 4
-
Have a coffee while the autoencoder is training ;)
-
[Optional but recommended] Inspect the trained autoencoder
python -m ae.test -f logs/dataset-test/ -ae logs/ae-32_000000.pkl --n-samples 50 -augment
The Gym wrapper is ae.wrapper.AutoencoderWrapper
, you can add it to the RL Zoo (branch "offline-rl").
# Export path to trained autoencoder
export AAE_PATH=/absolute/path/to/autoencoder.pkl
# Then you can call python train.py --algo ... --env ... with the RL Zoo