CS2-HUD-OCR-Crops / README.md
ybashir's picture
Add files using upload-large-folder tool
85ee99a verified
---
license: cc-by-4.0
task_categories:
- image-to-text
language:
- en
tags:
- ocr
- cs2
- counter-strike
- hud
- video-games
- crnn-training
pretty_name: CS2 HUD OCR Crops
size_categories:
- 10K<n<100K
---
# CS2 HUD OCR Crops
Per-region HUD crops sliced from three Counter-Strike 2 match recordings,
labelled where possible from the demo file's `parse_ticks` state. Built
to train a specialist CRNN that replaces the EasyOCR killfeed reader
(currently ~6 s p95 on CPU) with a sub-30 ms specialist.
## Source
Three matches by the same POV player (`farouqqq`), recorded in CS2's
built-in DVR + the corresponding `.dem` files:
| sample | map | dem | rounds | resolution | fps |
|---------|----------|----------------|--------|-------------|-----|
| sample1 | Ancient | ancent.dem | 8 | 1280 × 1024 | 60 |
| sample2 | Dust 2 | dust_2.dem | 10 | 1280 × 1024 | 60 |
| sample3 | Overpass | overpass.dem | 9 | 1280 × 1024 | 60 |
Frames sampled at 5 fps. Per-region ROIs slice via the
[`hud_extractor`](https://github.com/bashiryounis/coach-api) package's
calibrated `hud_template.json`.
## Signals + label sources
| signal | label source | gate |
|-----------------|-------------------------------------------|---------------------------------------------------------------|
| `hp` | dem `health` (POV-filtered, alive only) | v_mask brightness + phash dedupe |
| `money` | dem `balance` | v_mask brightness + phash dedupe |
| `ammo` | dem `m_iClip1` (alive only) | v_mask brightness + phash dedupe |
| `timer` | tesserocr text (≥ 0.70 conf) — optional | v_mask brightness + phash dedupe |
| `killcam` | tesserocr binary (≥ 0.50 conf) — optional | v_mask + phash + ±5 s POV death window |
| `killfeed` | **unlabeled** in this v1 (use Colab GPU) | v_mask brightness + phash dedupe; one crop per row slot |
| `friendly_chat` | **unlabeled** in this v1 (use Colab GPU) | v_mask brightness + phash dedupe; one crop per row slot |
`killfeed` and `friendly_chat` are saved without text labels in this
release because the EasyOCR teacher (~600 ms / row on CPU) made a single
pass impractical. The crops are ready for a GPU-side labeling sweep
(EasyOCR `gpu=True` is ~10× faster on a single T4).
## File layout
```
dataset/cs2_ocr/
├── crops/ # PNG, one per labeled crop
│ ├── hp_sample1_r07_f000048.png
│ ├── money_sample2_r03_f000132.png
│ ├── killfeed_sample3_r05_f000240_row2.png
│ ├── friendly_chat_sample1_r10_f000600_row3.png
│ └── ...
├── train.parquet
├── val.parquet
├── test.parquet
└── manifest.json
```
Split key = `(sample, round)`, so no frame leak across splits.
| split | composition |
|-------|-----------------------------------------------------------------------------------------------------------|
| train | sample1 r07-r10 · sample2 r01-r07 · sample3 r01-r06 |
| val | sample1 r11 · sample2 r08 · sample3 r07 |
| test | sample1 r12-r14 · sample2 r09-r10 · sample3 r08-r09 |
## Parquet schema
| column | type | notes |
|-----------------|--------|------------------------------------------------------------------------------------|
| `crop_path` | str | relative to dataset root, e.g. `crops/hp_sample1_r07_f000048.png` |
| `signal` | str | one of `hp` `money` `ammo` `timer` `killcam` `killfeed` `friendly_chat` |
| `label` | str | ground-truth string; `""` for unlabeled rows |
| `teacher_engine`| str | `dem` / `tesserocr` / `easyocr` / `unlabeled` |
| `teacher_conf` | float | 0-1; `1.0` for `dem`, `0.0` for `unlabeled` |
| `dem_verified` | bool | `True` iff label came from the dem (the dem is ground truth) |
| `clip_id` | str | source clip, e.g. `sample1_r07` |
| `frame_idx` | int | original frame ordinal inside the clip |
| `width_px` | int | crop width in pixels |
| `height_px` | int | crop height in pixels |
## How to load
```python
from datasets import load_dataset
ds = load_dataset("ybashir/CS2-HUD-OCR-Crops")
```
To get an actual image rather than a path you'll need to join the
`crop_path` column with the downloaded `crops/` directory.
## Build details
- Frame extractor + dem alignment + ROI slicer:
[`scripts/build_crnn_dataset.py`](https://github.com/bashiryounis/coach-api)
- Clip cutter (per-round mp4s):
[`scripts/cut_clips.py`](https://github.com/bashiryounis/coach-api)
- HUD template (calibrated ROIs + row slots):
[`hud_extractor/hud_extractor/config/hud_template.json`](https://github.com/bashiryounis/coach-api)
## Known limitations
- POV-only labels. The `dem` ground truth applies to `farouqqq`'s state;
other players' HUDs are not in scope.
- `sample3` round 1 begins before the dem started recording. Its
`dem_freeze_s` is negative — the dem-truth labels begin partway into
the clip.
- `parse_event` is broken on these dem files (`EntityNotFound` across
every version of `demoparser2`), so `player_death` correlations for
killfeed verification are not available. EasyOCR remains the only
signal source for killfeed/chat.
- Re-encoded clips (`-c libx264 -crf 20`) lose a few decibels vs. the
source DVR; not visible at HUD resolution but flagged for transparency.
## License
CC-BY-4.0. The underlying gameplay footage is captured from a personal
Counter-Strike 2 session (Valve Corp.) — the dataset is published for
non-commercial research on HUD-region OCR distillation.