All Projects → tawnkramer → Sdsandbox

tawnkramer / Sdsandbox

Licence: bsd-3-clause
This provides a sandbox simulator for training a self-driving car. This uses Unity for simulation and Python with Keras and Tensorflow for training. Recently updated to work on Python 3.4+ and Keras 2+

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Sdsandbox

Unitylockstep
Modern Lockstep with clientside prediction and rollback
Stars: ✭ 349 (-5.42%)
Mutual labels:  unity, simulation
Unity Robotics Hub
Central repository for tools, tutorials, resources, and documentation for robotics simulation in Unity.
Stars: ✭ 439 (+18.97%)
Mutual labels:  unity, simulation
Pbd Fluid In Unity
A PBD fluid in unity running on the GPU
Stars: ✭ 350 (-5.15%)
Mutual labels:  unity, simulation
Assetsextractor
『Assets提取工具』是一款OSX平台上用于将Assets.car或xxx.app中打包的png图片、pdf等资源重新提取出来的开发者工具。Assets.car常见于iOS/Mac/Unity等开发中的资源打包。
Stars: ✭ 486 (+31.71%)
Mutual labels:  unity, car
Prosperity Wars
Game-like agent based economy simulator
Stars: ✭ 153 (-58.54%)
Mutual labels:  unity, simulation
Liquidsimulator
Cellular Automaton 2D Liquid Simulator for Unity
Stars: ✭ 302 (-18.16%)
Mutual labels:  unity, simulation
Autonomousdrivingcookbook
Scenarios, tutorials and demos for Autonomous Driving
Stars: ✭ 1,939 (+425.47%)
Mutual labels:  car, simulation
Ocean community next gen
Next gen iteration of the unity community ocean shader
Stars: ✭ 855 (+131.71%)
Mutual labels:  unity, simulation
Articulations Robot Demo
Stars: ✭ 145 (-60.7%)
Mutual labels:  unity, simulation
Carsimulator
A Top Down 2D Car Simulator For Unity
Stars: ✭ 184 (-50.14%)
Mutual labels:  unity, simulation
Stuntrally
The main repository containing Stunt Rally sources and game data. A 3D racing game based on VDrift and OGRE with track editor.
Stars: ✭ 314 (-14.91%)
Mutual labels:  car, simulation
Liliumtoongraph
UniversalRP Toon Shader with ShaderGraph
Stars: ✭ 356 (-3.52%)
Mutual labels:  unity
Retro3dpipeline
A minimal example of a custom render pipeline with the Retro3D shader.
Stars: ✭ 354 (-4.07%)
Mutual labels:  unity
Akvfx
Azure Kinect plugin for Unity VFX Graph
Stars: ✭ 366 (-0.81%)
Mutual labels:  unity
Unity Actions
Github actions for testing and building Unity projects
Stars: ✭ 358 (-2.98%)
Mutual labels:  unity
Texturelab
Free, Cross-Platform, GPU-Accelerated Procedural Texture Generator
Stars: ✭ 349 (-5.42%)
Mutual labels:  unity
Monohook
hook C# method at runtime without modify dll file (such as UnityEditor.dll)
Stars: ✭ 348 (-5.69%)
Mutual labels:  unity
Rpgcore
RPGCore is a toolkit for producing RPG games and mechanics for Unity.
Stars: ✭ 349 (-5.42%)
Mutual labels:  unity
Vtuber unity
Use Unity 3D character and Python deep learning algorithms to stream as a VTuber!
Stars: ✭ 361 (-2.17%)
Mutual labels:  unity
Unity Winforms
A Windows Forms port for Unity3d
Stars: ✭ 365 (-1.08%)
Mutual labels:  unity

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 dependancies. This installs a specific version of keras only because it will allow you to load the pre-trained model with fewer problems. If not an issue for you, you can install the latest keras.

pip install -r requirements.txt

This will install Donkey Gym and Donkey Car packages from source.

Note: Tensorflow >= 1.10.1 is required

If you have an cuda supported GPU - probably NVidia

pip install tensorflow-gpu

Or without a supported gpu

pip install tensorflow

Demo

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

  2. Hit the start button to launch. Then the "Use NN Steering". When you hit this button, the car will disappear. This is normal. You will see one car per client that connects.

  3. Start the prediction server with the pre-trained model.

cd sdsandbox/src
python predict_client.py --model=../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.

Note* You can start multiple clients at the same time and you will see them spawn as they connect.

#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/src
python prepare_data.py
  1. Repeat 4, 5, 6 until you have lots of training data.

Train Neural network

python train.py --model=../outputs/mymodel.h5

Let this run. It may take a few hours if running on CPU. Usually far less on a GPU.

Run car with NN

  1. Start Unity project sdsim

  2. Push button "Use NN Steering"

  3. Start the prediction client. This listens for images and returns a steering result.

python predict_client.py --model=../outputs/mymodel.h5

Requirements

**Note: pygame only needed if using mon_and_predict_server.py which gives a live camera feed during inferencing.

Credits

Tawn Kramer

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].