Puzzle_Perception / README.md
deboincepai's picture
Update README.md
9c95539 verified
|
Raw
History Blame Contribute Delete
10 kB
---
license: cc-by-nc-sa-4.0
language:
- en
pretty_name: Puzzle Perception (Segmentation + pVQA)
size_categories:
- 10K<n<100K
task_categories:
- image-segmentation
- visual-question-answering
tags:
- puzzle-perception
- segmentation
- pvqa
- chess
- maze
- tower-of-hanoi
- nqueens
- synthetic
configs:
- config_name: default
data_files:
- split: train
path: data/train-*.parquet
- split: val
path: data/val-*.parquet
- split: test
path: data/test-*.parquet
---
# Puzzle Perception — Segmentation + pVQA
A single table over two tasks on synthetic puzzle images:
- **Segmentation** — per-pixel masks over chess, maze and tower-of-hanoi under one
unified 30-class label space.
- **pVQA** — multiple-choice perception probes over chess and N-Queens boards.
Every row carries the same 13 columns; the `type` column says which task it
belongs to, and columns that do not apply are `null`.
```python
from datasets import load_dataset
ds = load_dataset("PuzzleBench/Puzzle_Perception", split="test")
pvqa = ds.filter(lambda r: r["type"] == "pvqa")
seg = ds.filter(lambda r: r["type"] == "segmentation")
row = seg[0]
row["image"] # PIL.Image, 512x512 RGB — the puzzle photo
row["mask"] # PIL.Image, 512x512 RGB — colorized label map
row["segmentation_labels"] # e.g. ['black_square', 'white_queen', ...]
```
## Columns
| Column | Type | Segmentation rows | pVQA rows |
|---|---|---|---|
| `id` | `int64` | unique, contiguous from 0 | unique, contiguous from 0 |
| `puzzle` | `string` | `chess` / `maze` / `hanoi` | `chess` / `nqueens` |
| `image` | `Image` | 512×512 RGB — the puzzle photo | 512×512 RGB |
| `image_path` | `string` | source-tree path (provenance) | source-tree path (provenance) |
| `mask` | `Image` | 512×512 RGB — **colorized** label map | `null` |
| `mask_path` | `string` | path to that same colorized PNG in this repo | `null` |
| `raw_mask` | `string` | path to the raw single-channel PNG, values `0..29` | `null` |
| `type` | `string` | `segmentation` | `pvqa` |
| `segmentation_labels` | `list<string>` | class names present in the mask | `null` |
| `question` | `string` | `null` | probe question text |
| `answer` | `string` | `null` | correct option, as text |
| `question_id` | `string` | `null` | `q1``q8`, joins `pvqa_questions.yaml` |
| `options` | `list<string>` | `null` | the full answer space |
`image` and `mask` are both embedded in the Parquet as PNG bytes, so both render in
the viewer and `load_dataset` hands back a `PIL.Image` for each. `mask` is a
**colorized** render — one fixed color per class (see the palette below) — not the
raw class-id values, which are almost black on their own and uninformative to look
at directly.
Training needs the raw values, not the colors, so they are published separately as
**paths** to real files under `raw_masks/` — resolvable, but never decoded inline:
```python
from huggingface_hub import hf_hub_download
import numpy as np
from PIL import Image
p = hf_hub_download("PuzzleBench/Puzzle_Perception", row["raw_mask"], repo_type="dataset")
mask = np.array(Image.open(p)) # (512, 512) uint8, values in [0, 29]
```
## Splits
| Split | Total | Segmentation | pVQA | Per-puzzle |
|---|---:|---:|---:|---|
| `train` | 6000 | 6000 | 0 | seg: chess 2000, hanoi 2000, maze 2000 |
| `val` | 1500 | 1500 | 0 | seg: chess 500, hanoi 500, maze 500 |
| `test` | 2700 | 1500 | 1200 | seg: chess 500, hanoi 500, maze 500 · pVQA: chess 800, nqueens 400 |
| **total** | **10200** | **9000** | **1200** | |
pVQA appears **only** in `test`, and its rows are written before the
segmentation rows of that split.
## Segmentation labels
`raw_mask` files are 8-bit PNGs whose pixel values **are** these class ids — no
remapping at load time. `mask` recolors those same values one-for-one using the
`Color` column below (also shipped as `palette.yaml`): each id's hue is stepped
by the golden angle (~137.5°) around the wheel, deterministically, so a rebuild
always reproduces the same colors — and so that classes with adjacent ids (e.g.
the five Hanoi disks) land far apart in hue instead of clustering, since linear
spacing would otherwise squeeze every class of one puzzle into a narrow slice of
the wheel (ids are grouped contiguously by puzzle).
| Puzzle | Class ids | Count |
|---|---|---:|
| maze | 0–7 | 8 |
| chess | 8–22 | 15 |
| hanoi | 23–29 | 7 |
| Class id | Name | Puzzle | Color |
|---:|---|---|---|
| 0 | `wall` | maze | `#f25555` |
| 1 | `path` | maze | `#55f283` |
| 2 | `start` | maze | `#b155f2` |
| 3 | `dest_a` | maze | `#f2df55` |
| 4 | `dest_b` | maze | `#55d8f2` |
| 5 | `dest_c` | maze | `#f255aa` |
| 6 | `dest_d` | maze | `#7cf255` |
| 7 | `dest_e` | maze | `#5b55f2` |
| 8 | `background` | chess | `#f28955` |
| 9 | `white_square` | chess | `#55f2b7` |
| 10 | `black_square` | chess | `#e555f2` |
| 11 | `white_pawn` | chess | `#d1f255` |
| 12 | `white_knight` | chess | `#55a3f2` |
| 13 | `white_bishop` | chess | `#f25575` |
| 14 | `white_rook` | chess | `#55f262` |
| 15 | `white_queen` | chess | `#9055f2` |
| 16 | `white_king` | chess | `#f2be55` |
| 17 | `black_pawn` | chess | `#55f2ec` |
| 18 | `black_knight` | chess | `#f255cb` |
| 19 | `black_bishop` | chess | `#9df255` |
| 20 | `black_rook` | chess | `#556ff2` |
| 21 | `black_queen` | chess | `#f26955` |
| 22 | `black_king` | chess | `#55f297` |
| 23 | `background` | hanoi | `#c555f2` |
| 24 | `peg` | hanoi | `#f2f255` |
| 25 | `disk_1` | hanoi | `#55c4f2` |
| 26 | `disk_2` | hanoi | `#f25596` |
| 27 | `disk_3` | hanoi | `#68f255` |
| 28 | `disk_4` | hanoi | `#7055f2` |
| 29 | `disk_5` | hanoi | `#f29e55` |
Note `background` appears twice — chess id 8 and hanoi id 23 are distinct
classes in this unified namespace, **and get distinct colors** — so
`segmentation_labels` names should be read together with `puzzle`. Per-class loss
weights live in `classes.yaml`, not here — they are training hyperparameters, not
label definitions.
## pVQA answer spaces
| Puzzle | `question_id` | Question | `options` | Rows |
|---|---|---|---|---:|
| chess | `q1` | Which quarter of the board is the white queen in? A=top-left B=top-right C=bottom-left D=bottom-right. | `[A, B, C, D]` | 100 |
| chess | `q2` | Which quarter of the board is the white bishop in? A=top-left B=top-right C=bottom-left D=bottom-right. | `[A, B, C, D]` | 100 |
| chess | `q3` | Is the leftmost white pawn in the top half or the bottom half of the board? | `[top, bottom]` | 100 |
| chess | `q4` | Is the white king above or below the black knight? | `[above, below]` | 100 |
| chess | `q5` | Are the white rook and the black king in the same row or the same column? | `[Yes, No]` | 100 |
| chess | `q6` | Are the white king and the black king on adjacent (touching) squares? | `[Yes, No]` | 100 |
| chess | `q7` | Is the white queen on the same rank, file, or diagonal as the black king? | `[Yes, No]` | 100 |
| chess | `q8` | Is there a white queen on the board? | `[Yes, No]` | 100 |
| nqueens | `q1` | Is the leftmost queen in the top half or the bottom half of the board? | `[top, bottom]` | 100 |
| nqueens | `q2` | Is the topmost queen in the left half or the right half of the board? | `[left, right]` | 100 |
| nqueens | `q3` | Is the leftmost queen above or below the rightmost queen? | `[above, below]` | 100 |
| nqueens | `q4` | Is the leftmost queen in the top, middle, or bottom third of the board? | `[top, middle, bottom]` | 100 |
Answer spaces are not uniform: 2-way, 3-way, 4-way all occur, with `chess/q1`, `chess/q2` and `nqueens/q4` non-binary.
That is why `options` is a column rather than an assumed `[Yes, No]`.
Questions are deliberately coordinate-free ("the leftmost queen", not "the queen
at row 4"), so a model must locate the referenced piece before it can answer.
Full specs, including how each answer was derived from the board, are in
`pvqa_questions.yaml`.
## Notes and caveats
- **The two tasks do not share images.** pVQA chess boards are separately
rendered, not the segmentation chess images, and N-Queens is not part of the
30-class label space. No image currently carries both a mask and a question.
- **`image_path` repeats for N-Queens pVQA.** Each of the 100 boards is asked 4
questions, so 4 rows share an `image_path` with distinct `id`s. Chess pVQA asks
one question per board.
- **Published N-Queens images are a derived render.** The sources are 1600×1600
JPEG, downscaled here to 512×512 with `PIL` `thumbnail(..., BILINEAR)` — the
same call the evaluation code applies, so these are the pixels models actually
saw. The originals remain the reference copy in the project repository.
- Segmentation splits are sampled from the source datasets with a fixed seed
(`42`) and are reproducible.
- `manifest.csv` maps `unified_id` to source task and split; `classes.yaml`
carries the class map and loss weights.
## Files
| Path | Contents |
|---|---|
| `data/*.parquet` | the table — 10200 rows |
| `masks/{train,val,test}/*.png` | 9000 **colorized** RGB renders — the `mask_path` targets |
| `raw_masks/{train,val,test}/*.png` | 9000 raw label maps, 8-bit, values `0..29` — the `raw_mask` targets |
| `classes.yaml` | 30-class map + per-class loss weights |
| `manifest.csv` | `unified_id,source_task,source_id,split` |
| `pvqa_questions.yaml` | published question specs, nested by task |
| `palette.yaml` | id → name → RGB/hex used to colorize `mask` |
## License
**CC-BY-NC-SA 4.0.** If you use this dataset, please cite the PuzzleBench project.
## Citation
```bibtex
@article{patnala2026tddn,
title={{TDDN}: {T}ext-aligned {D}iffused {D}INO {N}etwork for Puzzle Understanding},
author={Harsha Patnala and Debopriyo Banerjee and Ayush Sunil Munot and Somak Aditya},
year={2026},
journal={arXiv:2609.07937}
eprint={2609.07937},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2609.07937},
}