This code implements an autonomous car agent using Udacity's self driving car simulator. The model is based on an end-to-end imitation learning algorithm as described in NVIDIA's DaveNet2 paper.
You will need a spedific version of Keras, Matplotlib etc.. to run this code. So the best way to install without touching your config is to put everything into a virtual environment e.g. virtualenv.
Use Python 2.7 and install virtualenv
sudo apt-get install python-pip python-dev python-virtualenv
Create a virtualenv environment in terminal
virtualenv --system-site-packages car_simulation
Activate the virtualenv environment in terminal (use deactivate
to exit)
source ~/car_simulation/bin/activate
Use TensorFlow without GPU
pip install tensorflow==1.0
Use TensorFlow with GPU (check your Cuda version first nvcc --version
)
For Cuda 8.0:
pip install tensorflow-gpu==1.0
For Cuda 9.x: download a python 2.7 tf1.4 or higher wheel and install with
pip install tensorflow-1.4.0-cp27-cp27mu-linux_x86_64.whl
In case of numa=-1 error, run
sudo apt install numactl
Clone the Repo, cd into the folder and install all other dependencies in the requirements.txt file:
pip install -r requirements.txt
Download and start up the Udacity self-driving simulator, choose a scene and press the Autonomous Mode button. Then, run the model in terminal as follows:
python drive.py model-006.h5
The model should give you good performance on the lake track and bad performance on the jungle track. (Was trained for 20 min, 10 epochs on the lake track).
Once you created your IMG and driving_log.csv data in the /data directory you can start to train your model. Before that you can go into model.py and create your own model, tune hyperparameter etc... that's were your creativity comes into play...
python model.py
This will generate a file model-<epoch>.h5
whenever the performance in the epoch is better than the previous best. For example, the first epoch will generate a file called model-000.h5
.
The credits for this code go to Udacity and naokishibuya. I have contributed to this code by implementing some new model architectures.