GithubHelp home page GithubHelp logo

shepherd_gym's Introduction

shepherd_gym

Build Status codecov.io

Gym environment implementation of dog shepherding task

Installation

  • Package stable-baselines requires the following dependencies

    $ sudo apt update
    $ sudo apt install -y cmake libopenmpi-dev python3-dev zlib1g-dev
    
  • Install machine learning dependencies for examples folder:

    $ pip install -r requirements.txt
    
  • The library can be installed by running:

    $ pip install -e .
    

Usage

This package has several scripts:

  • To test the dog heuristic model with the shepherd gym env:

    $ python examples/shepherd_heuristic.py
    

    The program supports several command line arguments. Check using:

    $ python examples/shepherd_heuristic.py -h
    

Imitation Learning

Follow the following sequence to experiment with imitation learning

  • Generate training dataset using the shepherd env:

    $ cd examples
    $ python shepherd_heuristic.py -e heuristic -n 1000 --store --norender --noplot
    

    This should create the shepherding data for 1000 trials in the data/heuristic folder.

  • Preprocess the training dataset into a pickle file:

    $ python dataset_process.py -d heuristic
    

    This should create a pickle file with processed dataset in data/heuristic folder.

  • Training imitation learning model:

    $ python shepherd_imitation.py -e heuristic 
    

    This will train a policy network using the expert dataset and store in results folder.

  • View training performance using tensorboard:

    $ cd ../results/imitation
    $ tensorboard --logdir=.
    

    Open a webbrowser and check the URL: localhost:6006.

  • Check training performance of model:

    $ python shepherd_imitation.py -e heuristic -m eval 
    
    
  • Test performance of imitation learning model:

    $ cd examples
    $ python shepherd_imitation.py -e heuristic -m test --display
    

    This should render the environment window showing performance of IL agent.

Curriculum Learning

  • Generate training dataset using heuristic envrionment:

    $ cd examples
    $ python shepherd_heuristic.py -e curriculum -n 1000 --store --norender --noplot
    

    This should create the shepherding data for 1000 trials in the data/curriculum folder.

  • Generate the curriculum for training dataset:

    $ python dataset_curriculum.py -d ../data/curriculum -n 1000
    

    This should create a pickle file with processed dataset. All the trajectories have a fixed length of 100 for uniform sampling.

  • Train reinforcement learning model using curriculum wrapper:

    $ python shepherd_curriculum.py -d ../data/curriculum -m train -t 1000000
    

    This should train a neural network policy using PPO and the curriculum generated from the pickle file.

  • The performance of curriculum learning is not so good. It is still a work in progress.

Simulations

Heuristic model simulation (generated using matplotlib):

heuristic model simulation

Rewards for heuristic model (rewards keep increasing):

heuristic model rewards

Rewards for random model (rewards remain low):

random model rewards

Requirements

  • gym>=0.10.8
  • numpy>=1.15.0
  • matplotlib>=2.2.2

Compatibility

  • python>=3.5
  • Note: There are some issues with python 3.7 due to stable-baselines dependency. However, it will work without that dependency.

Authors

shepherd_gym was written by Clark Kendrick Go, Nishanth Koganti.

shepherd_gym's People

Watchers

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