GithubHelp home page GithubHelp logo

fedebotu / vision-cartpole-dqn Goto Github PK

View Code? Open in Web Editor NEW
14.0 0.0 4.0 2.02 MB

Implementation of the CartPole from OpenAI's Gym using only visual input for Reinforcement Learning control with DQN

License: GNU General Public License v3.0

Python 7.54% Jupyter Notebook 74.56% TeX 17.91%
reinforcement-learning vision-cartpole cartpole openai-gym dqn inverted-pendulum model-free-rl model-free-control model-free computer-vision

vision-cartpole-dqn's Introduction

Vision-Based CartPole with DQN

Python PyTorch

Implementation of the CartPole from OpenAI's Gym using only visual input for Reinforcement Learning control with Deep Q-Networks

Author: Federico Berto

Thesis Project for University of Bologna; Reinforcement Learning: a Preliminary Study on Vision-Based Control

A special thanks goes to Adam Paszke <https://github.com/apaszke>_, for a first implementation of the DQN algorithm with vision input in the Cartpole-V0 environment from OpenAI Gym. Gym website <https://gym.openai.com/envs/CartPole-v0>__.

The goal of this project is to design a control system for stabilizing a Cart and Pole using Deep Reinforcement Learning, having only images as control inputs. We implement the vision-based control using the DQN algorithm combined with Convolutional Neural Network for Q-values approximation.

Agent Environment

The last two frames of the Cartpole are used as input, cropped and processed before using them in the Neural Network. In order to stabilize the training, we use an experience replay buffer as shown in the paper "Playing Atari with Deep Reinforcement Learning: https://www.cs.toronto.edu/~vmnih/docs/dqn.pdf__.

Besides, a target network to further stabilize the training process is used. make the training not converge, we set a threshold for stopping training when we detect stable improvements: this way we learn optimal behavior without saturation.

Version 1

This version is less polished and in a .py file. The GUI is a handy tool for saving and loading trained models, and also for training start/stop. Models and Graphs are saved in Vision_Carpole/save_model and Vision_Cartpole/save_graph respectively.

Version 2

This .ipynb (Jupyter Notebook) version is clearer and with a more stable training. The architecture is as following:

DQN Architecture

You may find more information inside the PDF report too.

DQN Final Score over 6 Runs

Final score averaged over 6 runs mean ยฑ std

If you want to improve this project, your help is always welcome! ๐Ÿ˜„

vision-cartpole-dqn's People

Contributors

fedebotu avatar

Stargazers

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