Skip to content

YashSax/AI-Racer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AI Racer

An AI agent that can drive on user-drawn racetracks using NEAT (Neuroevolution of Augmenting Topologies)

Play at: website Currently experiencing issues due to CPU utilization on free containers, for good performance, run locally by cloning and running app.py from the projects home directory. However, view some demos:

AI_Racer_.Visualization_Enabled.mp4
AI.Racer.mp4

Training

The agent was trained in a python pygame environment, then, once trained, ported over to Javascript using p5.js to render on a webpage using Flask.

Network Inputs

The agent's observations included:

  • The distance straight to a road
  • The distance left to a road
  • The distance right to a road
  • The distance diagonally left to a road
  • The distance diagonally right to a road

image alt >

NEAT (Neuroevolution of Augmenting Topologies)

NEAT is an evolutionary algorithm, an algorithm that simulates genetic evolution for Reinforcement Learning (RL). For this AI Racer, 100 candidate neural networks are generated. Each candidate, while similar, has various mutations and differences in genotype that can cause it to perform better or worse than its peers. After all candidates are evaluated on some race track, the highest-performing cars reproduce to mix their genes, creating a new and improved generation of candidates. This process repeats until convergence or the AIs exceed some standard of performance (i.e. completing the race in under 30 seconds).

The AI winner currently driving generated this neural network:

image

Where the items at the top represent the inputs, and "right_arr," "left_arr," and "up_arr" represent Turn Right, Turn Left, and Accelerate, respectively. 51 and 52 are two hidden nodes adding extra complexity.

About

An AI agent that can drive on user-drawn racetracks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published