Giter Club home page Giter Club logo

self-driving-car-sim's Introduction

Self-driving Car. Learning by Example

Appetizer

Live environment can be found here

Self-driving car

Introduction

Reinforcement learning refers to goal-oriented algorithms, which learn how to attain a complex objective (goal) or maximize along a particular dimension over many steps; for example, maximize the points won in a game over many moves. They can start from a blank slate, and under the right conditions they achieve superhuman performance. Like a child incentivized by spankings and candy, these algorithms are penalized when they make the wrong decisions and rewarded when they make the right ones โ€“ this is reinforcement.

However there are situations when the ideal/appropriate course of actions requires too many inputs or can't not be formally defined. And here comes extra techniques like inverse reinforcement learning and apprenticeship learning or simply put "Learn by Example".

Description

My project utilizes this concept in some way but by no means my implementation should be considered following any published academic researched.

It consists of two main parts: an environment that emulates some of the real world concepts e.g. mass, force, intertia, friction and contains physical bodies (obstacles) and an agent (car) that can observe and record human player actions and then try to learn this behavior and apply it to the unknown situations.

The car's brain is represented by a simple neural network (NN) with fixed number of inputs (obstacle position data comes from front and rear sensors), a hidden layer with triple the number of inputs or 100 (whichever is greater) and 9 outputs that represent the possible set of two actions taken at any given moment: one of the move actions (No action, move forward/speed up, move backward/slow down) and one of the turn actions (No action, turn right, turn left).

The human player starts recording and manully controls the car with the arrow keys. Later when he decides that enough positions have been recorded, he commits the recorded data which triggers the creation and fitting the new NN. After this he can start the self-driving mode and this NN begins to process the car inputs and predict the action/actions needed to be taken. At any given moment human player can add more obstacles to the world (or remove the existing ones) and perform new actions (which can in turn be recorded and used to further hone the car skills)

Technology Stack

The whole application is built using client-side only technologies (HTML, CSS, JavaScript) thus requires no special deployment.

The environment is built using matter.js physics engine and utilizes Technostalgic implementation of raycasting algorithm.

UI and styling is done with the help of Bootstrap and jQuery

Machine learning part is built using Tensorflow.js

self-driving-car-sim's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

n0v0cain3 simrit1

self-driving-car-sim's Issues

Sticky moving mode

I need to add a new mode where the car is actually displayed as a static one inside the center of the screen and the world should be scrolled in respective directions

Add configuration of car parameters

I need to have a settings popup that will allow to configure the following parameters:

  • Delta speed
  • Delta angle
  • Front FoV angle
  • Front sensors number
  • Rear FoV angle
  • Rear sensors number

TODO List

  • create a scene with physical bounds
  • create a car a make it accelerate, decelerate and turn
  • using ray-casting imitate a car FoV
  • establish car communication with the environment in the form of action-state-reward
  • design and implement one of the reinforcement learning techniques
  • train the agent until it learns to avoid the obstacles
    ---------------------------------MVP----------------------------------------
  • add extra visuals: car FoV, closest obstacle detector (line from car to obstacle - the closer the more thick and red it becomes, floating numbers - rewards and penalties)
  • add configuration elements: level selector, obstacle adder, settings (e.g. penalty-reward ratio for specific actions)

Multi-agent mode

Add ability to list the loaded agents in the toolbar to the left with options to import/export. Click on the agent should add the instance of this agent to the world and run the permanent auto-move (untill deleted manually). Click on the agent should remove it from the world

Add training data viewer

Add a band at the bottom of screen to visualize the training data. The band should consist of the number of frames that will fit the screen width. The band should be scrollable but not by-pixel, rather by-frame - this will allow to utilize virtualization.

Every frame should represent a picture of car, the data from its sensors and the action taken at that time point. User should be able to toggle between viewing training data and viewing last X (lets say 1000) actions taken.

When the frame viewer is in training data mode user should be able to delete every single frame or override the actions taken at that time point with the ability to batch apply these manual changes.

When the frame viewer is in 'last actions' mode, user should be able to pick specific frame or frame collections and add them to the training data.

Use matter.js time scale feature

I need to investigate the potential usage of matter.js timescale. This can improve the training as user won't record many similar states

Import/export of training data and trained agent

I need to have a way to download the training data and trained agent model and symmetric way to upload it. Need to consider the situations, with the custom number of front and rear sensors and custom field of view

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.