Giter VIP home page Giter VIP logo

behavioral-cloning's Introduction

Behavioral Cloning Project

This project involves training a deep learning model to drive a car in a simulator using behavioral cloning. The model learns from human driving data and predicts steering angles based on the input images.

Project Overview

The project consists of two main parts:

  1. Training the Model: A Convolutional Neural Network (CNN) is trained on images captured by the car's camera along with the corresponding steering angles.
  2. Running the Model: The trained model is deployed in a simulator where it controls the car based on the camera feed in real-time.

File Structure

  • behavioural_Cloning.ipynb: Jupyter Notebook containing the model architecture, training process, and data preprocessing steps.
  • drive.py: Python script used to interface with the simulator and drive the car using the trained model.
  • model.h5: The trained model file (not included, must be generated from the notebook or downloaded).

Dependencies

To run this project, you will need the following dependencies:

  • Python 3.7+
  • TensorFlow 2.x
  • Keras
  • Flask
  • eventlet
  • numpy
  • Pillow
  • OpenCV
  • socketio

Model Training

The model is trained using a Convolutional Neural Network (CNN) architecture, similar to NVIDIA's model for self-driving cars. The following preprocessing steps are applied to the images:

  • Cropping: The image is cropped to remove irrelevant parts, such as the sky and car hood.
  • Color Space Conversion: The image is converted to the YUV color space, which is more suitable for computer vision tasks.
  • Gaussian Blur: A Gaussian blur is applied to the image to reduce noise and smooth the image.
  • Resizing: The image is resized to 200x66 pixels, a size compatible with the input layer of the CNN.
  • Normalization: The image pixel values are normalized to a range between 0 and 1, improving the model's convergence during training.

Training Process

To train the model, run the notebook behavioural_Cloning.ipynb. The notebook contains the following key sections:

  1. Data Loading and Augmentation: Load the training data and apply augmentation techniques such as flipping and shifting to increase the dataset's diversity.
  2. Model Architecture Definition: Define the CNN architecture, including convolutional layers, dropout layers, and dense layers.
  3. Model Training and Validation: Train the model on the preprocessed data and validate its performance using a separate validation set.

Driving the Car

Once the model is trained, it can be used to drive the car in the simulator. The drive.py script is responsible for this task. It loads the trained model, preprocesses the incoming images from the simulator, and sends the predicted steering angle back to the simulator.

Running the Model

To drive the car using the trained model, execute the following command in your terminal:

python drive.py model.h5

About the simulator

We will use a driving simulator built in Unity, provided for free by Udacity, that can be found here:

https://github.com/udacity/self-driving-car-sim

after downloading run

./Default\ Linux\ desktop\ Universal.x86_64 

Demo Video

https://www.youtube.com/watch?v=CEgN-XkuUJE

behavioral-cloning's People

Contributors

proxi666 avatar

Watchers

 avatar

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.