Skip to content

Learn Generalized Representations of Video Games from Pixels | New Sports10 Dataset (175 games)

License

Notifications You must be signed in to change notification settings

ChintanTrivedi/contrastive-game-representations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PWC PWC

Contrastive Learning of Generalized Game Representations

This repository is the official code implementation of the paper "Contrastive Learning of Generalized Game Representations" by Chintan Trivedi, Antonios Liapis and Georgios Yannakakis.

Installation

git clone git@github.com:ChintanTrivedi/contrastive-game-representations.git
cd contrastive-game-representations
pip install -r requirements.txt

Note that this code has been developed/tested with a single NVIDIA GPU using CUDA 10.1 and Tensorflow 2.3 on Windows platform. It is expected to work as-is on Linux/Colab platforms (untested).

Download Sports10 Dataset

We present a new dataset containing 100,000 Gameplay Images of 175 Video Games across 10 Sports Genres. The games are also divided into three visual styling categories: RETRO (arcade-style, 1990s and earlier), MODERN (roughly 2000s) and PHOTOREAL (roughly late 2010s).

  • Download the full dataset (~10GB) from google drive and extract the zip file's contents to the datasets directory in the project.
  • Meta-data is also available with the full list of games.
  • For more information on the dataset, please refer our paper.

Training models from scratch

After downloading and unzipping the dataset, learn game representations with a ResNet50 encoder by running the following commands on your terminal.

1. Plain Supervised Learning

python train_fulsup.py --dataset_directory="./datasets/Sports10" --epochs=10 --img_shape=224 --batch_size=64

2. Supervised Contrastive Learning

python train_supcon.py --dataset_directory="./datasets/Sports10" --epochs=10 --img_shape=224 --batch_size=64

For additional training arguments, check train_fulsup.py or train_supcon.py

Download Pre-Trained Model

Alternatively, you can download our pre-trained models from this google drive link. Models can be loaded using tensorflow.keras.models.load_model('$MODEL_FILENAME.h5') and fine-tuned for any downstream task involving RL or GANs.

Citation

@inproceedings{trivedi2021contrastive,
  title={Contrastive Learning of Generalized Game Representations},
  author={Trivedi, Chintan and Liapis, Antonios and Yannakakis, Georgios N},
  booktitle={2021 IEEE Conference on Games (CoG)},
  year={2021},
  organization={IEEE}
}

Acknowledgements

  1. Improving Image Classifiers With Supervised Contrastive Learning by Sayak Paul
  2. Contrastive Loss Functions by Zichen Wang

About

Learn Generalized Representations of Video Games from Pixels | New Sports10 Dataset (175 games)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages