File size: 6,250 Bytes
fcce891
 
 
 
d3fa682
 
 
 
 
 
fcce891
 
 
d3fa682
fcce891
 
 
d3fa682
fcce891
d3fa682
 
 
 
 
 
 
 
 
fcce891
 
d3fa682
fcce891
d3fa682
fcce891
d3fa682
 
 
fcce891
d3fa682
 
fcce891
d3fa682
 
fcce891
d3fa682
 
 
fcce891
d3fa682
 
 
 
fcce891
d3fa682
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fcce891
d3fa682
 
 
 
fcce891
d3fa682
 
 
fcce891
d3fa682
fcce891
d3fa682
 
 
 
 
 
fcce891
d3fa682
 
fcce891
d3fa682
fcce891
d3fa682
 
fcce891
d3fa682
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3d81ad8
d3fa682
 
 
 
 
 
 
 
 
 
fcce891
 
 
d3fa682
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
---
license: cc-by-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 11 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
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 |
| `image` | `Image` | 512×512 RGB | 512×512 RGB |
| `mask` | `string` | path to a mask PNG in this repo | `null` |
| `puzzle` | `string` | `chess` / `maze` / `hanoi` | `chess` / `nqueens` |
| `image_path` | `string` | source-tree path (provenance) | source-tree path (provenance) |
| `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` is embedded in the Parquet as PNG bytes, so it renders in the viewer and
`load_dataset` hands back a `PIL.Image`. `mask` is instead a **path** to a real
file shipped under `masks/`, which keeps label maps — whose pixel values are
`0..29` and therefore look almost black — out of the preview:

```python
from huggingface_hub import hf_hub_download
import numpy as np
from PIL import Image

p = hf_hub_download("PuzzleBench/Puzzle_Perception", row["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

Masks are 8-bit PNGs whose pixel values **are** these class ids — no remapping
at load time.

| Puzzle | Class ids | Count |
|---|---|---:|
| maze | 0–7 | 8 |
| chess | 8–22 | 15 |
| hanoi | 23–29 | 7 |

| Class id | Name | Puzzle |
|---:|---|---|
| 0 | `wall` | maze |
| 1 | `path` | maze |
| 2 | `start` | maze |
| 3 | `dest_a` | maze |
| 4 | `dest_b` | maze |
| 5 | `dest_c` | maze |
| 6 | `dest_d` | maze |
| 7 | `dest_e` | maze |
| 8 | `background` | chess |
| 9 | `white_square` | chess |
| 10 | `black_square` | chess |
| 11 | `white_pawn` | chess |
| 12 | `white_knight` | chess |
| 13 | `white_bishop` | chess |
| 14 | `white_rook` | chess |
| 15 | `white_queen` | chess |
| 16 | `white_king` | chess |
| 17 | `black_pawn` | chess |
| 18 | `black_knight` | chess |
| 19 | `black_bishop` | chess |
| 20 | `black_rook` | chess |
| 21 | `black_queen` | chess |
| 22 | `black_king` | chess |
| 23 | `background` | hanoi |
| 24 | `peg` | hanoi |
| 25 | `disk_1` | hanoi |
| 26 | `disk_2` | hanoi |
| 27 | `disk_3` | hanoi |
| 28 | `disk_4` | hanoi |
| 29 | `disk_5` | hanoi |


## 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 |



## Files

| Path | Contents |
|---|---|
| `data/*.parquet` | the table — 10200 rows |
| `masks/{train,val,test}/*.png` | 9000 label maps, 8-bit, values `0..29` |
| `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 |

## License

**CC BY 4.0.** If you use this dataset, please cite the PuzzleBench project.