sroot commited on
Commit
60198d2
Β·
verified Β·
1 Parent(s): abd9c6c

Publish gen3 (current) weights + standardized card

Browse files
Files changed (4) hide show
  1. README.md +110 -0
  2. metrics.json +29 -0
  3. model.classes.json +1 -0
  4. model.onnx +3 -0
README.md ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: agpl-3.0
3
+ library_name: ultralytics
4
+ pipeline_tag: object-detection
5
+ base_model: Ultralytics/YOLO11
6
+ tags:
7
+ - object-detection
8
+ - ultralytics
9
+ - yolo11
10
+ - onnx
11
+ - onnxruntime
12
+ - playing-cards
13
+ - card-detection
14
+ - casino
15
+ - live-game-defender
16
+ model-index:
17
+ - name: lgd-cards-gen3
18
+ results:
19
+ - task:
20
+ type: object-detection
21
+ dataset:
22
+ type: lgd-poc-video-holdout
23
+ name: LGD frozen PoC table-video holdout (225 frames, private)
24
+ metrics:
25
+ - type: recall
26
+ value: 0.847
27
+ name: Pip recall @50 (code-aware)
28
+ - type: precision
29
+ value: 0.771
30
+ name: Precision proxy
31
+ ---
32
+
33
+ # LGD Cards β€” Gen 3 (day-2 video) Β· YOLO11s playing-card detector, 52 classes βœ… CURRENT
34
+
35
+ The **current** generation of the **Live Game Defender (LGD)** playing-card detector, and the model
36
+ LGD serves in production. Gen 2 further fine-tuned on a **second day of real casino-table video**
37
+ (plus a human-QA correction pass), lifting frozen-holdout recall to **0.85**. Locates every playing
38
+ card in a frame and names it by **rank + suit** (52 classes); an empty frame yields no detection
39
+ (built-in "is there a card?" gate).
40
+
41
+ ## Generations
42
+
43
+ | Gen | Repo | Trained on | Frozen real-video holdout recall | Status |
44
+ |---|---|---|---|---|
45
+ | 1 | [lgd-cards-gen1](https://huggingface.co/sroot/lgd-cards-gen1) | Roboflow `ow27d` v4 dataset | β€” (dataset-val only) | superseded |
46
+ | 2 | [lgd-cards-gen2](https://huggingface.co/sroot/lgd-cards-gen2) | + day-1 PoC table video | 0.68 | superseded |
47
+ | 3 | **lgd-cards-gen3** (this) | + day-2 PoC table video | **0.85** | βœ… current |
48
+
49
+ Chip detectors: [lgd-chips-gen1](https://huggingface.co/sroot/lgd-chips-gen1) Β· [lgd-chips-gen2](https://huggingface.co/sroot/lgd-chips-gen2).
50
+
51
+ ## Classes (52)
52
+
53
+ ```
54
+ 10C 10D 10H 10S 2C 2D 2H 2S 3C 3D 3H 3S 4C 4D 4H 4S 5C 5D 5H 5S
55
+ 6C 6D 6H 6S 7C 7D 7H 7S 8C 8D 8H 8S 9C 9D 9H 9S
56
+ AC AD AH AS JC JD JH JS KC KD KH KS QC QD QH QS
57
+ ```
58
+
59
+ `C`=Clubs, `D`=Diamonds, `H`=Hearts, `S`=Spades. Full order is in `model.classes.json`.
60
+
61
+ ## Files
62
+
63
+ - `model.onnx` β€” ONNX export (run with `onnxruntime`); this is the exact file LGD serves.
64
+ - `model.classes.json` β€” ordered class-name sidecar (index β†’ card code).
65
+ - `metrics.json` β€” training config + frozen-holdout verdict vs. the previous generation.
66
+
67
+ ## Training
68
+
69
+ - **Base:** Ultralytics `yolo11s.pt` (COCO-pretrained), `imgsz=640` (resumed once from epoch 15).
70
+ - **Data:** Roboflow `ow27d` base **+ day-1 PoC video + day-2 PoC video**, auto-labeled (detector
71
+ proposes pip boxes; an LLM verifies/names over a closed 52-code vocabulary) and materialized as
72
+ serve-matching tiles β€” **7,526 train / 1,103 val tiles**, with **14 human-QA label corrections**.
73
+ Labeling cost **$8.13**.
74
+ - **Hardware:** NVIDIA RTX 3060 (12 GB).
75
+
76
+ ## Metrics β€” frozen real-video holdout
77
+
78
+ Scored on a **frozen 225-frame holdout** of our own PoC recordings (never trained on), serve-style
79
+ auto-grid tiling, threshold 50, code-aware. Both generations scored in one run:
80
+
81
+ | Model | Recall | Precision proxy |
82
+ |---|---|---|
83
+ | **gen 3 (this)** | **0.847** | **0.771** |
84
+ | gen 2 | 0.745 | 0.759 |
85
+
86
+ Generation-over-generation on the frozen holdout: `stock 0.539 β†’ gen1 0.680 β†’ gen3 0.847`.
87
+
88
+ > ⚠️ **Not casino accuracy (rule of the project).** The holdout is our own proof-of-concept footage
89
+ > with LLM-verified (not fully human-verified) ground truth. These numbers show the detector
90
+ > *mechanism* and its improvement across generations β€” not a validated real-world full-deck accuracy
91
+ > claim on a live casino floor.
92
+
93
+ ## Usage
94
+
95
+ ```python
96
+ import json, onnxruntime as ort
97
+ sess = ort.InferenceSession("model.onnx", providers=["CPUExecutionProvider"])
98
+ names = json.load(open("model.classes.json")) # index -> "AS", "10H", ...
99
+ # 640x640 letterboxed input. The detector boxes corner PIPS (~2 per card): cluster same-code pips
100
+ # within a few box-diagonals into ONE card-level detection before consuming results.
101
+ ```
102
+
103
+ ## License & provenance
104
+
105
+ **AGPL-3.0**, a fine-tune of **Ultralytics YOLO11** (`yolo11s.pt`, AGPL-3.0) β€” these weights inherit
106
+ AGPL-3.0 and **are not an original work of ours**. Networked deployment triggers AGPL Β§13 (offer the
107
+ Corresponding Source). `onnxruntime` (MIT) keeps the inference code AGPL-free; the weights stay AGPL.
108
+
109
+ Built for **Live Game Defender (LGD)** β€” an on-prem AI integrity monitor for live casino table
110
+ games. Β© 2026 TechTools s.r.o.
metrics.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "date": "2026-07-09",
3
+ "run": "video-campaign-2",
4
+ "resumed_from_epoch": 15,
5
+ "data": {
6
+ "train_tiles": 7526,
7
+ "val_tiles": 1103,
8
+ "sources": [
9
+ "data/video_real",
10
+ "data/video_real_day2"
11
+ ],
12
+ "labeling_cost_usd": 8.13,
13
+ "human_corrections": 14
14
+ },
15
+ "test_eval": {
16
+ "holdout": "data/video_test (225 frames, 4317 boxes)",
17
+ "candidate": {
18
+ "recall": 0.847,
19
+ "precision_proxy": 0.771
20
+ },
21
+ "serving_video_campaign_1": {
22
+ "recall": 0.745,
23
+ "precision_proxy": 0.759
24
+ },
25
+ "beats_reference": true
26
+ },
27
+ "activated": true,
28
+ "activated_at": "2026-07-09T10:12"
29
+ }
model.classes.json ADDED
@@ -0,0 +1 @@
 
 
1
+ ["10C", "10D", "10H", "10S", "2C", "2D", "2H", "2S", "3C", "3D", "3H", "3S", "4C", "4D", "4H", "4S", "5C", "5D", "5H", "5S", "6C", "6D", "6H", "6S", "7C", "7D", "7H", "7S", "8C", "8D", "8H", "8S", "9C", "9D", "9H", "9S", "AC", "AD", "AH", "AS", "JC", "JD", "JH", "JS", "KC", "KD", "KH", "KS", "QC", "QD", "QH", "QS"]
model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8b767cdfed2c8e954a9134013ac3d2f2c53be048768d559675be01277a8a8fd1
3
+ size 38233687