This repository is the official code implementation of the paper "Contrastive Learning of Generalized Game Representations" by Chintan Trivedi, Antonios Liapis and Georgios Yannakakis.
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).
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.
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
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.
@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}
}