Skip to content

woctezuma/steam-DINOv2

Repository files navigation

Steam DINOv2: match banners with Meta AI's DINOv2

This repository contains Python code to retrieve Steam games with similar store banners, using Meta AI's DINOv2.

Image similarity is assessed by the cosine similarity between image features encoded by DINOv2.

Similar vertical banners

Data

Data consists of vertical Steam banners (library_600x900.jpg at 300x450 resolution).

Pre-processing

DINOv2 follows torchvision's pre-processing pipeline for classification:

  • resize to 256 resolution, i.e. the smallest edge of the image will match this number,
  • center-crop at 224 resolution, i.e. a square crop is made,
  • normalize intensity.
transforms_list = [
    transforms.Resize(resize_size, interpolation=interpolation),
    transforms.CenterCrop(crop_size),
    MaybeToTensor(),
    make_normalize_transform(mean=mean, std=std),
]

Therefore, downloaded images can be resized to 256x384 resolution before being stored to disk.

As discussed in this Github issue, the crop of DINOv2 can be made less agressive by resizing to 224 instead of 256 resolution. In this case, downloaded images can be resized to 224x336 resolution before being stored to disk.

Snapshot

A snapshot of image data was downloaded on July 20, 2023 and stored as a Github release.

If you wish to re-create this data snapshot, run download_steam_images.ipynb. Open In Colab

Filtering (optional)

If you wish to filter the image dataset, identify issues with find_dataset_issues.ipynb. Open In Colab

Usage

Run match_steam_images.ipynb. Open In Colab

Note

For the same appID, there can exist some differences between matches computed on the fly and pre-computed matches, because matches are obtained based on features extracted from images resized with different interpolation algorithms:

Results

For each game in the top 100 most played games in the past 2 weeks, the 10 most similar games are retrieved with:

AppIDs for all these apps can be found in JSON files in data/similar_to_top_100/.

Note

The linked pages contain a lot of images and might be slow to load depending on your Internet bandwidth.

Examples obtained with ViT-L

Same visual theme

Basket ball:

NBA

Cartoony monsters:

Binding of Isaac

Colorful:

Fall Guys

Far West:

Red Dead Redemption

Paladins in anime style:

Paladins

Same character

Armed persons with helmets:

Counter-Strike Global Offensive

Dinosaurs:

Dinosaurs

Knights:

Terraria

Robots:

Robocraft

Same item

Bows:

Bow

Cars:

Rocket League

Castles:

Hogwarts

Farms:

Stardew Valley

Tanks:

World of Tanks

Tools:

Raft

Same franchise

Borderlands:

Borderlands

Cities (with skyscrapers):

Skyscrapers

Hollow Knight:

Hollow Knight

Left 4 Dead (with hands):

Left 4 Dead

Monster Hunter (with dragons):

Monster Hunter

Mount & Blade (with horses):

Mount & Blade

Naraka:

Naraka

Payday:

Payday

The Witcher (with Geralt of Rivia):

The Witcher 3

Truck simulators:

EuroTruck

War planes:

Warplanes

War vehicles:

Warthunder

Comparison of ViT-S, ViT-B and ViT-L

Each model performs reasonably well in terms of image retrieval.

ViT-S

The following results are obtained with ViT-S.

Cars in Rocket League:

Rocket League

Cars in Wallpaper Engine:

Wallpaper Engine

Dinosaurs:

Ark

Farms:

Stardew Valley

Persons standing in a forest:

Stardew Valley

Robots:

Robocraft

Sailing:

Raft

Tanks:

War Thunder

Interestingly, the results for The Binding of Isaac may be better than with ViT-L.

Binding of Isaac

The first match for Sekiro reveals a similarity between Wolf in Sekiro and Mitsurugi in Soul Calibur.

Sekiro

Most matches for Naraka include a sword-like weapon with a blue glow:

Naraka

ViT-B

The following results are obtained with ViT-B.

Bows:

Tomb Raider

Cartoon characters with a white mask:

Hollow Knight

Colorful:

Fall Guys

Dinosaurs:

Ark

Interestingly, the first match for Monster Hunter is correctly in the same franchise.

Monster Hunter

References