PuzzleBench commited on
Commit
fcce891
·
verified ·
1 Parent(s): 1eb6667

Upload folder using huggingface_hub

Browse files
Files changed (6) hide show
  1. README.md +112 -0
  2. classes.yaml +57 -0
  3. manifest.csv +0 -0
  4. test.tar +3 -0
  5. train.tar +3 -0
  6. val.tar +3 -0
README.md ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ task_categories:
4
+ - image-segmentation
5
+ language:
6
+ - en
7
+ tags:
8
+ - puzzle-perception
9
+ - segmentation
10
+ - chess
11
+ - maze
12
+ - tower-of-hanoi
13
+ - synthetic
14
+ pretty_name: Puzzle Perception Segmentation
15
+ size_categories:
16
+ - 1K<n<10K
17
+ ---
18
+
19
+ # Puzzle Perception Segmentation
20
+
21
+ A combined per-pixel segmentation dataset over three puzzle domains —
22
+ chess, maze, and tower-of-hanoi — under a single unified 30-class label
23
+ space. The published split is a deterministically sampled subset of three
24
+ larger raw source datasets, sized to match a standard
25
+ segmentation-probe training recipe.
26
+
27
+ This dataset is used by the **PuzzleBench** project. The loader and full
28
+ project code live at the project's repository; this HuggingFace repo
29
+ ships only the bulk image + mask payload plus the class definitions.
30
+
31
+ ## Splits
32
+
33
+ | Split | Per source task | Total |
34
+ |---|---:|---:|
35
+ | `train` | 2000 | 6000 |
36
+ | `val` | 500 | 1500 |
37
+ | `test` | 500 | 1500 |
38
+
39
+ Splits are produced from the source datasets with a fixed seed (`42`),
40
+ so the subset is reproducible.
41
+
42
+ ## Class space
43
+
44
+ Masks are 8-bit PNGs with pixel values in `[0, 29]`. The mapping (also
45
+ shipped as `classes.yaml`):
46
+
47
+ | Source task | Class ids | Count |
48
+ |---|---|---:|
49
+ | maze | 0..7 | 8 |
50
+ | chess | 8..22 | 15 |
51
+ | hanoi | 23..29 | 7 |
52
+
53
+ Per-class names and loss weights (cross-entropy and mIoU) are documented
54
+ in [`classes.yaml`](./classes.yaml).
55
+
56
+ ## Layout
57
+
58
+ This repository ships each split as a single uncompressed `.tar` archive
59
+ (PNGs are already compressed). After extraction the on-disk layout is::
60
+
61
+ data/
62
+ ├── classes.yaml
63
+ ├── manifest.csv # unified_id, source_task, source_id, split
64
+ ├── train/
65
+ │ ├── images/<task>_<id>.png # source image (512×512 RGB)
66
+ │ └── masks/<task>_<id>.png # mask (512×512, uint8, values 0..29)
67
+ ├── val/{images,masks}/
68
+ └── test/{images,masks}/
69
+
70
+ Repo contents:
71
+
72
+ | File | Notes |
73
+ |---|---|
74
+ | `README.md`, `classes.yaml`, `manifest.csv` | Documentation + class map + per-sample index |
75
+ | `train.tar` | 6000 (image, mask) pairs, ~2.1 GB |
76
+ | `val.tar` | 1500 (image, mask) pairs, ~520 MB |
77
+ | `test.tar` | 1500 (image, mask) pairs, ~510 MB |
78
+
79
+ Each sample's filename encodes its source task (e.g. `chess_000625.png`,
80
+ `maze_00012.png`, `hanoi_00042.png`).
81
+
82
+ ## Usage
83
+
84
+ ```python
85
+ from huggingface_hub import snapshot_download
86
+ from pathlib import Path
87
+ import tarfile, numpy as np
88
+ from PIL import Image
89
+
90
+ root = Path("Puzzle_Perception_data")
91
+ snapshot_download(
92
+ repo_id="PuzzleBench/Puzzle_Perception",
93
+ repo_type="dataset",
94
+ local_dir=str(root),
95
+ )
96
+
97
+ for split in ("train", "val", "test"):
98
+ with tarfile.open(root / f"{split}.tar") as tf:
99
+ tf.extractall(root)
100
+
101
+ img = np.array(Image.open(root / "train/images/chess_000625.png")) # (512, 512, 3) uint8
102
+ mask = np.array(Image.open(root / "train/masks/chess_000625.png")) # (512, 512) uint8, in [8..22] for chess
103
+ ```
104
+
105
+ The PuzzleBench project ships a `download.py` helper that does the
106
+ snapshot + extract in one step, plus a `CombinedSegmentationDataset`
107
+ PyTorch wrapper.
108
+
109
+ ## License
110
+
111
+ This dataset is released under **CC BY 4.0**. If you use it, please cite
112
+ the PuzzleBench project.
classes.yaml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Unified 30-class label space for the combined puzzle-perception segmentation
2
+ # dataset. Class ids 0..29 are the values found in every mask PNG under data/.
3
+ #
4
+ # Source-task offsets:
5
+ # maze → 0 ( 8 classes, ids 0.. 7)
6
+ # chess → 8 (15 classes, ids 8..22)
7
+ # hanoi → 23 ( 7 classes, ids 23..29)
8
+ #
9
+ # `weight_ce` — per-class cross-entropy weight (handles class imbalance).
10
+ # `weight_miou` — per-class weighting for mIoU evaluation.
11
+ # Both are inherited from the per-task definitions in the source datasets.
12
+ #
13
+ # `background` appears twice (chess id 8 and hanoi id 23). The two are distinct
14
+ # classes in this unified namespace because they originate from different
15
+ # source tasks.
16
+
17
+ classes:
18
+ # ---- maze (offset 0) ----
19
+ - {id: 0, name: wall, source_task: maze, weight_ce: 12.0, weight_miou: 6.0}
20
+ - {id: 1, name: path, source_task: maze, weight_ce: 0.2, weight_miou: 0.3}
21
+ - {id: 2, name: start, source_task: maze, weight_ce: 6.0, weight_miou: 1.0}
22
+ - {id: 3, name: dest_a, source_task: maze, weight_ce: 6.0, weight_miou: 1.0}
23
+ - {id: 4, name: dest_b, source_task: maze, weight_ce: 6.0, weight_miou: 1.0}
24
+ - {id: 5, name: dest_c, source_task: maze, weight_ce: 6.0, weight_miou: 1.0}
25
+ - {id: 6, name: dest_d, source_task: maze, weight_ce: 6.0, weight_miou: 1.0}
26
+ - {id: 7, name: dest_e, source_task: maze, weight_ce: 6.0, weight_miou: 1.0}
27
+
28
+ # ---- chess (offset 8) ----
29
+ - {id: 8, name: background, source_task: chess, weight_ce: 0.5, weight_miou: 0.5}
30
+ - {id: 9, name: white_square, source_task: chess, weight_ce: 0.3, weight_miou: 0.5}
31
+ - {id: 10, name: black_square, source_task: chess, weight_ce: 0.3, weight_miou: 0.5}
32
+ - {id: 11, name: white_pawn, source_task: chess, weight_ce: 2.0, weight_miou: 1.0}
33
+ - {id: 12, name: white_knight, source_task: chess, weight_ce: 4.0, weight_miou: 1.0}
34
+ - {id: 13, name: white_bishop, source_task: chess, weight_ce: 4.0, weight_miou: 1.0}
35
+ - {id: 14, name: white_rook, source_task: chess, weight_ce: 4.0, weight_miou: 1.0}
36
+ - {id: 15, name: white_queen, source_task: chess, weight_ce: 6.0, weight_miou: 1.0}
37
+ - {id: 16, name: white_king, source_task: chess, weight_ce: 6.0, weight_miou: 1.0}
38
+ - {id: 17, name: black_pawn, source_task: chess, weight_ce: 2.0, weight_miou: 1.0}
39
+ - {id: 18, name: black_knight, source_task: chess, weight_ce: 4.0, weight_miou: 1.0}
40
+ - {id: 19, name: black_bishop, source_task: chess, weight_ce: 4.0, weight_miou: 1.0}
41
+ - {id: 20, name: black_rook, source_task: chess, weight_ce: 4.0, weight_miou: 1.0}
42
+ - {id: 21, name: black_queen, source_task: chess, weight_ce: 6.0, weight_miou: 1.0}
43
+ - {id: 22, name: black_king, source_task: chess, weight_ce: 6.0, weight_miou: 1.0}
44
+
45
+ # ---- hanoi (offset 23) ----
46
+ - {id: 23, name: background, source_task: hanoi, weight_ce: 0.5, weight_miou: 0.5}
47
+ - {id: 24, name: peg, source_task: hanoi, weight_ce: 4.0, weight_miou: 1.0}
48
+ - {id: 25, name: disk_1, source_task: hanoi, weight_ce: 3.0, weight_miou: 1.0}
49
+ - {id: 26, name: disk_2, source_task: hanoi, weight_ce: 3.0, weight_miou: 1.0}
50
+ - {id: 27, name: disk_3, source_task: hanoi, weight_ce: 3.0, weight_miou: 1.0}
51
+ - {id: 28, name: disk_4, source_task: hanoi, weight_ce: 3.0, weight_miou: 1.0}
52
+ - {id: 29, name: disk_5, source_task: hanoi, weight_ce: 3.0, weight_miou: 1.0}
53
+
54
+ label_offsets:
55
+ maze: 0
56
+ chess: 8
57
+ hanoi: 23
manifest.csv ADDED
The diff for this file is too large to render. See raw diff
 
test.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:107f02cff3d43838d53f4289f8598b56211659f171586e8eb1ffdb3a69d19786
3
+ size 531671040
train.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d16dd80b5347827b0a38d284f9e282802776c5f728ebe326c3f1e772661de2f
3
+ size 2218414080
val.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:90cd8cafe864b6141ef8b4bc5b23d31b58f0ddb00f4bc7dea67559808adaf39b
3
+ size 547921920