Skip to content

ethanburrell/DonkeySelfDriving-v1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SdSandbox

Self Driving Car Sandbox

IMAGE ALT TEXT

Summary

Use Unity 3d game engine to simulate car physics in a 3d world. Generate image steering pairs to train a neural network. Uses NVidia PilotNet NN topology. Then validate the steering control by sending images to your neural network and feed steering back into the simulator to drive.

Some videos to help you get started

Training your first network

IMAGE ALT TEXT

World complexity

IMAGE ALT TEXT

Creating a robust training set

IMAGE ALT TEXT

Setup

You need to have Unity installed, and all python modules listed in the Requirements section below.

Linix Unity install here. Check last post in this thread.

You need python 3.4 or higher, 64 bit. You can create a virtual env if you like:

virtualenv -p python3 env
source env/bin/activate

And then you can install the requirements.

pip install -r requirements.txt

If you have an cuda supported GPU - probably NVidia

pip install tensorflow-gpu

Or without a supported gpu

pip install tensorflow

Demo

  1. Start the prediction server with the pre-trained model.
cd sdsandbox
python src/predict_server.py outputs/highway.h5

If you get a crash loading this model, you will not be able to run the demo. But you can still generate your own model. This is a problem between tensorflow/keras versions.

  1. Load the Unity project sdsandbox/sdsim in Unity. Double click on Assets/Scenes/main to open that scene.

  2. Hit the start button to launch. Then the "Use NN Steering".

#To create your own data and train

Generate training data

  1. Load the Unity project sdsandbox/sdsim in Unity.

  2. Create a dir sdsandbox/sdsim/log.

  3. Hit the start arrow in Unity to launch project.

  4. Hit button "Generate Training Data" to generate image and steering training data. See sdsim/log for output files.

  5. Stop Unity sim by clicking run arrow again.

  6. Run this python script to prepare raw data for training:

cd sdsandbox
python src/prepare_data.py --src=sdsim/log/*.* --dest=dataset
  1. Repeat 4, 5, 6 until you have lots of training data. Over 50K images for best results.

Train Neural network

python src/train.py outputs/mymodel.h5

Let this run. It may take many minutes if running on CPU. A GPU is faster, but requires you setup tensorflow-gpu.

Run car with NN

  1. Start the prediction server. This listens for images and returns a steering result.
python src/predict_server.py --model=outputs/mymodel.h5
  1. Start Unity project sdsim

  2. Push button "Use NN Steering"

Requirements

Credits

Tawn Kramer

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages