Downloads · 30 days
0
Seym0n/video-game-identification-sleuth
video-game-identification-sleuth is a image classification model from Seym0n. Use it when you need a label for an image. The card lists the license as mit.
Sleuth is an EfficientNet-B0-based image classifier that identifies which video game a gameplay screenshot is from. This is the first iteration of the model.
Downloads · 30 days
0
Access
Public
Updated Aug 21, 2026
Repo size
48.9 MB
Likes
0
Public
Click a slice to open those files.
.pth48.9 MB · 100%
From the Hugging Face model README
Sleuth is an EfficientNet-B0-based image classifier that identifies which video game a gameplay screenshot is from. This is the first iteration of the model.
import torch
from torchvision.transforms import Compose, ToTensor, Normalize, Pad
from efficientnet_pytorch import EfficientNet
from PIL import Image
class ResizeAndPad:
def __init__(self, target_size=224):
self.target_size = target_size
def __call__(self, img):
w, h = img.size
if w > h:
new_w = self.target_size
new_h = int(h * self.target_size / w)
else:
new_h = self.target_size
new_w = int(w * self.target_size / h)
img = img.resize((new_w, new_h), Image.BILINEAR)
pad_w = self.target_size - new_w
pad_h = self.target_size - new_h
padding = (pad_w // 2, pad_h // 2, pad_w - pad_w // 2, pad_h - pad_h // 2)
return Pad(padding, fill=0)(img)
transform = Compose([
ResizeAndPad(224),
ToTensor(),
Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])
mapping_steamdbid_game = {
570: 'DOTA 2',
730: 'Counter-Strike 2',
105600: 'Terraria',
252490: 'Rust',
381210: 'Dead by Daylight',
418370: 'Resident Evil 7 Biohazard',
578080: 'PUBG: BATTLEGROUNDS',
883710: 'Resident Evil 2 Remake',
952060: 'Resident Evil 3 Remake',
1196590: 'Resident Evil Village',
1671340: 'Fears to Fathom - Home Alone (Episode 1)',
1763050: 'Fears to Fathom - Norwood Hitchhiker (Episode 2)',
1808500: 'ARC Raiders',
2050650: 'Resident Evil 4 Remake',
2120900: 'Fears to Fathom - Carson House (Episode 3)',
2506160: 'Fears to Fathom - Ironbark Lookout (Episode 4)',
2507950: 'Delta Force',
2961530: 'Fears to Fathom - Woodbury Getaway (Episode 5)',
3240220: 'Grand Theft Auto V',
3764200: 'Resident Evil Requiem',
}
checkpoint = torch.load("game_classifier_best_new.pth", map_location="cpu")
steamdb_to_idx = {steamdb_id: idx for idx, steamdb_id in enumerate(mapping_steamdbid_game.keys())}
idx_to_steamdb = {idx: steamdb_id for steamdb_id, idx in steamdb_to_idx.items()}
model = EfficientNet.from_name("efficientnet-b0", num_classes=checkpoint["num_classes"])
model.load_state_dict(checkpoint["model_state_dict"])
model.eval()
image = Image.open("screenshot_videogame.png").convert("RGB")
input_tensor = transform(image).unsqueeze(0)
with torch.no_grad():
outputs = model(input_tensor)
probabilities = torch.softmax(outputs, dim=1)[0]
top_prob, top_idx = probabilities.max(0)
steamdb_id = idx_to_steamdb[top_idx.item()]
print(f"{mapping_steamdbid_game[steamdb_id]}: {top_prob.item() * 100:.2f}%")