Volver al ranking

ArztSamuel/Applying_EANNs

ASP

A 2D Unity simulation in which cars learn to navigate themselves through different courses. The cars are steered by a feedforward neural network. The weights of the network are trained using a modified genetic algorithm.

artificial-neural-networksneural-networksevolutionary-algorithmsgenetic-algorithmdeep-learningmachine-learningself-driving-cars
Crecimiento de estrellas
Estrellas
1.6k
Forks
367
Crecimiento semanal
Issues
0
5001k1.5k
abr 2017may 2020jun 2023jul 2026
README

Applying Evolutionary Artificial Neural Networks

A 2D Unity simulation in which cars learn to navigate themselves through different courses. The cars are steered by a feedforward Neural Network. The weights of the network are trained using a modified genetic algorithm. Short demo video of an early version: https://youtu.be/rEDzUT3ymw4

The Simulation

Cars have to navigate through a course without touching the walls or any other obstacles of the course. A car has five front-facing sensors which measure the distance to obstacles in a given direction. The readings of these sensors serve as the input of the car's neural network. Each sensor points into a different direction, covering a front facing range of approximately 90 degrees. The maximum range of a sensor is 10 unity units. The output of the Neural Network then determines the car’s current engine and turning force.

If you would like to tinker with the parameters of the simulation, you can do so in the Unity Editor. If you would simply like to run the simulation with default parameters, you can start the built file [Builds/Applying EANNs.exe](Builds/Applying EANNs.exe).

The Neural Network

The Neural Network used is a standard, fully connected, feedforward Neural Network. It comprises 4 layers: an input layer with 5 neurons, two hidden layers with 4 and 3 neurons respectively and an output layer with 2 neurons. The code for the Neural Network can be found at UnityProject/Assets/Scripts/AI/NeuralNetworks/.

Training the Neural Network

The weights of the Neural Network are trained using an Evolutionary Algorithm known as the Genetic Algorithm.

At first there are N randomly initialised cars spawned. The best cars are then selected to be recombined with each other, creating new "offspring" cars. These offspring cars then form a new population of N cars and are also slightly mutated in order to inject some more diversity into the population. The newly created population of cars then tries to navigate the course again and the process of evaluation, selection, recombination and mutation starts again. One complete cycle from the evaluation of one population to the evaluation of the next is called a generation.

The generic version of a Genetic Algorithm can be found at UnityProject/Assets/Scripts/AI/Evolution/GeneticAlgorithm.cs. This class can be modified in a very easy way, by simply assigning your own methods to the delegate operator methods of the class. Some example code for adapting the Genetic Algorithm to your own needs can be found in the EvolutionManager UnityProject/Assets/Scripts/AI/Evolution/EvolutionManager.cs, which is already able to switch between two differently modified Genetic Algorithms.

User Interface

The user interface always displays the data of the current best car. In the top left corner the Neural Network's output (engine and turning) is displayed. Right below the output, the evaluation value is displayed (the evaluation value is equal to the percentage of course completion). In the lower left corner a generation counter is displayed. In the upper right corner the Neural Network of the current best car is displayed. The weights are symbolised by the color and width of the connections between neurons: The wider a connection, the bigger the absolute value of the weight; Green means that the weight is positive, red means that the weight is negative.

The entire UI-code is located at UnityProject/Assets/Scripts/GUI/.

Courses

There are multiple courses of different difficulties which are all located in different unity scenes and can be found in the folder UnityProject/Assets/Scenes/Tracks/.

In order to start the simulation on a specific course, open the Main scene and enter the desired track-name (= scene name) in the Inspector of the GameStateManager object.

Two different courses the cars can be trained on.

License

Feel free to use my code in your personal projects. I would be very interested in any work that originates from this project. I would be more than happy to hear from your impressions and results, so feel free to mail me at arzt.samuel@live.de. You can also follow me on twitter: https://twitter.com/SamuelArzt

Repositorios relacionados
kmario23/deep-learning-drizzle

Drench yourself in Deep Learning, Reinforcement Learning, Machine Learning, Computer Vision, and NLP by learning from these exciting lectures!!

HTMLmachine-learningdeep-learning
deep-learning-drizzle.github.io
12.9k3k
willwulfken/MidJourney-Styles-and-Keywords-Reference

A reference containing Styles and Keywords that you can use with MidJourney AI. There are also pages showing resolution comparison, image weights, and much more!

aiartificial-intelligence
12.3k1.6k
OlafenwaMoses/ImageAI

A python library built to empower developers to build applications and systems with self-contained Computer Vision capabilities

PythonPyPIMIT Licenseartificial-intelligencemachine-learning
genxr.co
8.9k2.2k
liuruoze/EasyPR

(CGCSTCD'2017) An easy, flexible, and accurate plate recognition project for Chinese licenses in unconstrained situations. CGCSTCD = China Graduate Contest on Smart-city Technology and Creative Design

C++Apache License 2.0computer-visionmachine-learning
6.4k2.5k
krishnakumarsekar/awesome-quantum-machine-learning

Here you can get all the Quantum Machine learning Basics, Algorithms ,Study Materials ,Projects and the descriptions of the projects around the web

HTMLCreative Commons Zero v1.0 Universalquantumquantum-computing
3.6k802
codeplea/genann

simple neural network library in ANSI C

Czlib Licensebackpropagationgenetic-algorithm
codeplea.com/genann
2.3k270
VivekPa/AIAlpha

Use unsupervised and supervised learning to predict stocks

PythonPyPIMIT Licenseartificial-intelligenceartificial-neural-networks
1.9k447
mrsaeeddev/free-ai-resources

🚀 FREE AI Resources - 🎓 Courses, 👷 Jobs, 📝 Blogs, 🔬 AI Research, and many more - for everyone!

MIT Licenseartificial-intelligenceartificial-neural-networks
1.9k326
GMvandeVen/continual-learning

PyTorch implementation of various methods for continual learning (XdG, EWC, SI, LwF, FROMP, DGR, BI-R, ER, A-GEM, iCaRL, Generative Classifier) in three different scenarios.

Jupyter NotebookMIT Licensedeep-learningartificial-neural-networks
1.9k346
mbadry1/Top-Deep-Learning

Top 200 deep learning Github repositories sorted by the number of stars.

PythonPyPIMIT Licensedeep-learningdeep-neural-networks
1.8k438
LiYangHart/Hyperparameter-Optimization-of-Machine-Learning-Algorithms

Implementation of hyperparameter optimization/tuning methods for machine learning & deep learning models (easy&clear)

Jupyter NotebookMIT Licensehyperparameter-optimizationmachine-learning-algorithms
1.3k303
kennethleungty/Neural-Network-Architecture-Diagrams

Diagrams for visualizing neural network architecture

MIT Licenseneural-networkarchitecture
towardsdatascience.com/how-to-easily-draw-neural-network-architecture-diagrams-a6b6138ed875
1.2k525