Coder Social home page Coder Social logo

aanirudh07 / self-driving-2d-neat Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 237 KB

This repository contains the implementation of a 2D self driving agent using NEAT to navigate a racetrack autonomously.

Python 100.00%
genetic-algorithm neat-python self-driving-car deep-learning neural-network

self-driving-2d-neat's Introduction

self-driving-2D-NEAT

This repository contains the Python code for creating a self-driving AI based on the NeuroEvolution of Augmenting Topologies algorithm. NEAT is used to evolve Artificial Neural Networks using genetic algorithm techniques.

  • Each generation has 20 instances.
  • Each instance is associated with a feed-forward neural network which learns how to navigate the track.
  • Each instance is given a fitness value according to the how long it remained on the track.
  • New generations are created until at least one car is able to finish a lap without leaving the track.

Packages Required

  1. pygame

       pip install pygame
    
  2. neat-python

       pip install neat-python==0.92
    

The Car

The car has a total of 3 sensors, positioned at -45, 0 and 45 degrees respectively. Each sensor has a maximum range of 200 pixels. The blue circles are used to detect if the car left the track (by detecting the green color of grass around the track).

alt text

The Network

A simple feed forward neural network with 3 inputs and 2 outputs is used. There are no hidden layers. The 3 inputs correspond to the sensor values. There were orignally four outputs: Left, Right, Speed up, Slow down. However, after some experimentation it was found that the later two increased the complexity of the network unnecessarily. The final network has only two outputs: Left and Right.

Tunable Parameters

The following parameters can be modified:

  1. config.txt

       fitness_criterion
       fitness_threshold
       reset_on_extinction
       pop_size
       activation_default
       num_hidden
       num_inputs 
       num_outputs
    
  2. main.py

       angle
       rotation
       velocity
       radar_angles
       translation constant in drive() method of Car class
    

self-driving-2d-neat's People

Contributors

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