|
|
--- |
|
|
license: mit |
|
|
tags: |
|
|
- object-detection |
|
|
- image-classification |
|
|
- yolo |
|
|
- set-game |
|
|
- card-game |
|
|
- computer-vision |
|
|
--- |
|
|
|
|
|
# Set Solver Models |
|
|
|
|
|
Trained models for the [Set card game](https://www.setgame.com/) solver. |
|
|
|
|
|
**Live demo**: [huggingface.co/spaces/wangtianthu/set-solver](https://huggingface.co/spaces/wangtianthu/set-solver) |
|
|
|
|
|
## Models |
|
|
|
|
|
### Detector — YOLOv11n |
|
|
|
|
|
Detects individual Set cards on a board image. |
|
|
|
|
|
| Metric | Value | |
|
|
|--------|-------| |
|
|
| mAP50 | 99.5% | |
|
|
| mAP50-95 | 97.4% | |
|
|
| Architecture | YOLOv11n | |
|
|
| Input size | 640x640 | |
|
|
| Epochs | 10 | |
|
|
| Training data | 4000 synthetic board images | |
|
|
|
|
|
**Files**: `detector/weights/best.pt` (PyTorch), `detector/weights/best.onnx` (ONNX) |
|
|
|
|
|
### Classifier — MobileNetV3 |
|
|
|
|
|
Classifies each card's 4 attributes: shape, color, number, and fill. |
|
|
|
|
|
| Metric | Value | |
|
|
|--------|-------| |
|
|
| Overall accuracy | 99.9% | |
|
|
| Number accuracy | 100% | |
|
|
| Color accuracy | 100% | |
|
|
| Shape accuracy | 99.9% | |
|
|
| Fill accuracy | 99.8% | |
|
|
| Architecture | MobileNetV3-Small | |
|
|
| Input size | 224x224 | |
|
|
| Training data | ~9500 cropped card images (81 classes) | |
|
|
|
|
|
**File**: `classifier/classifier_best.pt` |
|
|
|
|
|
## Usage |
|
|
|
|
|
```python |
|
|
from ultralytics import YOLO |
|
|
from PIL import Image |
|
|
|
|
|
# Load detector |
|
|
detector = YOLO("detector/weights/best.pt") |
|
|
results = detector("board_photo.jpg", conf=0.25) |
|
|
|
|
|
# Load classifier |
|
|
import torch |
|
|
from src.train.classifier import SetCardClassifier |
|
|
|
|
|
classifier = SetCardClassifier(pretrained=False) |
|
|
checkpoint = torch.load("classifier/classifier_best.pt", map_location="cpu") |
|
|
classifier.load_state_dict(checkpoint["model_state_dict"]) |
|
|
classifier.eval() |
|
|
``` |
|
|
|
|
|
## Training |
|
|
|
|
|
Both models were trained on synthetic data generated by a custom board generator that produces realistic Set game layouts with varied backgrounds, perspective transforms, and noise objects. |
|
|
|
|
|
Source code: [github.com/wangtian24/set-solver](https://github.com/wangtian24/set-solver) |
|
|
|