Giter Site home page Giter Site logo

dinobot's Introduction

DinoBot

A PyTorch based approach for the popular dinosaur game on Google Chrome

Background and Motivation

Based as an Adaptation to DeepMind paper in 2013 on an introductory blog presented in PaperSpace based on Deep RL of QNetwrok

Initial configurations

Download chromedriver from this link and extract it to a directory Install the required python library commands by issuing pip install -r requirements.txt

Arguments available for train.py

  --chrome_driver_path  CHROME_DRIVER_PATH  Path of chrome driver
  --checkpoint_path     CHECKPOINT_PATH     Path of Pytorch model path
  --nb_actions NB_ACTIONS   Number of possible actions for bot
  --initial_epsilon INITIAL_EPSILON Starting epsilon value for explorations
  --final_epsilon FINAL_EPSILON Final value for epsilon after exploration
  --gamma GAMMA         Value of gamma for attenuation of rewards in next
                        states.
  --nb_memory NB_MEMORY Number of memory to store previous states and rewards
                        for training.
  --nb_expolre NB_EXPOLRE   Number of times for explorations. After this time the 
                        epsilon is in final_epsilon value and the explorations
                        is in its minumum value.
  --is_debug            A flag for debugging. If enabled an OpenCV window is
                        shown that illustrates the feeded image to the netwrok
  --batch_size BATCH_SIZE
                        Batch size for training.
  --nb_observation NB_OBSERVATION
                        Number of observations before starting training
  --use_cuda            Use cuda if it\'s available
  --exploiting          Enable this to skip training
  --log_frequency LOG_FREQUENCY
                        Frequency of logging every time step.
  --save_frequency SAVE_FREQUENCY
                        Frequency of saving state of the training
  --game_speed GAME_SPEED
                        Speed of the game. Higher speeds call for better CPU/GPU.
  --ratio_of_win RATIO_OF_WIN
                        Ration of usage of win actions in training. It should
                        be between (0,1]. 1 means use all actions and 1e-6
                        means small amount of win actions.
  --desired_fps DESIRED_FPS
                        If you want to reduce processing fps to have
                        constant fps in training and testing time.

Running the Code

  • Train from scratch with default values
    • python train.py --chrome_driver_path /path/to/chromedriver
  • Train more with failures.
    • python train.py --chrome_driver_path /path/to/chromedriver --ratio_of_win 0.1
  • Load the pretrained model for testing purposes
    • python train.py --chrome_driver_path /path/to/chromedriver --checkpoint_path ../weights/freezed_model.pth --exploiting

Pre-trained weight

Generated as a sample after 400 trials of the game

dinobot's People

Contributors

saswat0 avatar

Stargazers

 avatar  avatar

Watchers

James Cloos 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.