File size: 1,916 Bytes
9843ba6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
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)