Git Product home page Git Product logo

gr_football_analytics's Introduction

Creating a virtual environment using conda (recommended)

Install conda if it is not already installed in your system. Then create and activate a virtual environment using the following commands:

conda create -n football-env python=3.9
conda activate football-env

On your computer

1. Install required packages

Linux

sudo apt-get install git cmake build-essential libgl1-mesa-dev libsdl2-dev \
libsdl2-image-dev libsdl2-ttf-dev libsdl2-gfx-dev libboost-all-dev \
libdirectfb-dev libst-dev mesa-utils xvfb x11vnc python3-pip

python3 -m pip install --upgrade pip setuptools psutil wheel

macOS

First install brew. It should automatically install Command Line Tools. Next install required packages:

brew install git python3 cmake sdl2 sdl2_image sdl2_ttf sdl2_gfx boost boost-python3

python3 -m pip install --upgrade pip setuptools psutil wheel

Windows

Install Git and Python 3. Update pip in the Command Line (here and for the next steps type python instead of python3)

python -m pip install --upgrade pip setuptools psutil wheel

2. Install GFootball

Option a. From PyPi package (recommended)

python3 -m pip install gfootball

Option b. Installing from sources using GitHub repository

(On Windows you have to install additional tools and set an environment variable, see Compiling Engine for detailed instructions.)

git clone https://github.com/google-research/football.git
cd football

Optionally you can use virtual environment:

python3 -m venv football-env
source football-env/bin/activate

Next, build the game engine and install dependencies:

python3 -m pip install .

This command can run for a couple of minutes, as it compiles the C++ environment in the background. If you face any problems, first check Compiling Engine documentation and search GitHub issues.

3. Install stable-baselines3

pip install stable-baselines3==1.5.0

Special Note

Please replace the original stable_baselines3/common/offpolicyalgorithm.py and stable_baselines3/common/torch_layers.py files of the sb3 library with the files provided in the changes to_sb3 directory. I will incorporate these changes in a smarter way later instead of this brute force way. The reason behind this is that I have changed the code of the offpolicyalgorithm.py for changing the action sampling policy of DQN and the torch_layers.py file has been changed to incorporate changes such as dropout in the policy network both for DQN and PPO.

4. Install jupyter notebook

pip install notebook

Visualization with Tensorboard

pip install tensorboard

Trained IL agent checkpoints

IL agent checkpoints

  • epoch=146-step=479366.ckpt - IL agent without batch normalization

Playing around with the notebooks

  1. gfootball-stable-baselines3-DQN.ipynb - for running DQN experiments including DDQN.
  2. gfootball-stable-baselines3-PPO.ipynb - for running PPO experiments.
  3. gfootball-stable-baselines3-test-agent.ipynb - for testing how an agent performs

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.