Giter VIP home page Giter VIP logo

simulated-self-driving-car's Introduction

Simulated Self Driving Car

Overview

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.

Demo

Simulated Self Driving Car Project Demo

Dependencies

  1. 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.

  2. Download Udacity's self driving car simulator from here.

Usage

Clone this repository

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/

Run the pretrained model

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

To train the model

  1. Start up the Udacity self-driving simulator, choose a scene and press the Training Mode button.

  2. Then press R key and select the data folder, where our training images and CSV will be stored.

  3. Press R again to start recording and R to stop recording. Let the processing of video complete.

  4. You should do somewhere between 1 and 5 laps of the simulated road track.

  5. 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.

Vote of Thanks

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.

simulated-self-driving-car's People

Contributors

anubhavshrimal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

simulated-self-driving-car's Issues

cant work

c:\Users\YRP\Desktop\autodrive\Simulated_Self_Driving_Car\model.py:124: UserWarning: The semantics of the Keras 2 argument steps_per_epoch is not the same as the Keras 1 argument samples_per_epoch. steps_per_epoch is the number of batches to draw from the generator at each epoch. Basically steps_per_epoch = samples_per_epoch/batch_size. Similarly nb_val_samples->validation_steps and val_samples->steps arguments have changed. Update your method calls accordingly.
callbacks=[checkpoint], verbose=1)
c:\Users\YRP\Desktop\autodrive\Simulated_Self_Driving_Car\model.py:124: UserWarning: Update your fit_generator call to the Keras 2 API: fit_generator(<generator..., 20000, 10, validation_data=<generator..., callbacks=[<keras.ca..., verbose=1, validation_steps=12, max_queue_size=1)
callbacks=[checkpoint], verbose=1)
Epoch 1/10
Traceback (most recent call last):
File "c:\Users\YRP\Desktop\autodrive\Simulated_Self_Driving_Car\model.py", line 170, in
main()
File "c:\Users\YRP\Desktop\autodrive\Simulated_Self_Driving_Car\model.py", line 166, in main
train_model(model, args, *data)
File "c:\Users\YRP\Desktop\autodrive\Simulated_Self_Driving_Car\model.py", line 124, in train_model
callbacks=[checkpoint], verbose=1)
File "D:\ProgramData\Anaconda3\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "D:\ProgramData\Anaconda3\lib\site-packages\keras\models.py", line 1276, in fit_generator
initial_epoch=initial_epoch)
File "D:\ProgramData\Anaconda3\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "D:\ProgramData\Anaconda3\lib\site-packages\keras\engine\training.py", line 2192, in fit_generator
generator_output = next(output_generator)
File "D:\ProgramData\Anaconda3\lib\site-packages\keras\utils\data_utils.py", line 793, in get
six.reraise(value.class, value, value.traceback)
File "D:\ProgramData\Anaconda3\lib\site-packages\six.py", line 693, in reraise
raise value
File "D:\ProgramData\Anaconda3\lib\site-packages\keras\utils\data_utils.py", line 658, in _data_generator_task
generator_output = next(self._generator)
File "c:\Users\YRP\Desktop\autodrive\Simulated_Self_Driving_Car\utils.py", line 148, in batch_generator
image, steering_angle = augument(data_dir, center, left, right, steering_angle)
File "c:\Users\YRP\Desktop\autodrive\Simulated_Self_Driving_Car\utils.py", line 127, in augument
image, steering_angle = choose_image(data_dir, center, left, right, steering_angle)
File "c:\Users\YRP\Desktop\autodrive\Simulated_Self_Driving_Car\utils.py", line 56, in choose_image
return load_image(data_dir, right), steering_angle - 0.2
File "c:\Users\YRP\Desktop\autodrive\Simulated_Self_Driving_Car\utils.py", line 13, in load_image
return mpimg.imread(os.path.join(data_dir, image_file.strip()))
AttributeError: 'int' object has no attribute 'strip'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.