This is the code for training a machine learning model to drive a simulated car using Convolutional Neural Networks. I used Udacity's self driving car simulator as a testbed for training an autonomous car.
-
You can install all dependencies by running one of the following commands
You need a anaconda or miniconda to use the environment setting.
# Use TensorFlow without GPU conda env create -f environments.yml # Use TensorFlow with GPU conda env create -f environment-gpu.yml
Or you can manually install the required libraries (see the contents of the environemnt*.yml files) using pip.
-
Download Udacity's self driving car simulator from here.
Type the following commands in your terminal:
cd path/to/directory/you/like/
git clone https://github.com/anubhavshrimal/Simulated_Self_Driving_Car.git
cd Simulated_Self_Driving_Car/
Start up the Udacity self-driving simulator, choose a scene and press the Autonomous Mode button. Then, run the model as follows:
python drive.py model-mix.h5
-
Start up the Udacity self-driving simulator, choose a scene and press the Training Mode button.
-
Then press
R key
and select the data folder, where our training images and CSV will be stored. -
Press R again to start recording and R to stop recording. Let the processing of video complete.
-
You should do somewhere between 1 and 5 laps of the simulated road track.
-
The run the following command:
python model-mix.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
.
NVIDIA's paper: End to End Learning for Self-Driving Cars for the inspiration and model structure.
Siraj Raval & naokishibuya for the knowledge and code help.