File size: 4,821 Bytes
1d97a85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: cc-by-4.0
task_categories:
  - image-to-text
  - visual-question-answering
language:
  - en
tags:
  - jigsaw-puzzle
  - spatial-reasoning
  - vlm-benchmark
  - geometric-reasoning
  - vision-language
  - fine-tuning
size_categories:
  - 10K<n<100K
pretty_name: "JigShape Train & Eval"
---

# JigShape: Train & Evaluation Splits

This repository contains the **training** and **evaluation** splits of the [JigShape benchmark](https://huggingface.co/datasets/ShawnLi02/JigShape) for fine-tuning and evaluating Vision-Language Models on geometric jigsaw puzzle solving.

> The held-out **test split** is available separately at [ShawnLi02/JigShape](https://huggingface.co/datasets/ShawnLi02/JigShape).

## Overview

JigShape is a benchmark that evaluates **joint visual-geometric reasoning** in VLMs. Unlike traditional jigsaw benchmarks that use rectangular cuts (which create ambiguous ground truth in repeated-texture regions), JigShape features **tab-and-blank interlocking pieces** where geometric constraints ensure every puzzle has a unique solution.

Models must predict the correct grid position for each labeled piece by reasoning about both visual content (texture, color, object boundaries) and geometric constraints (tab-blank edge compatibility).

## Dataset Statistics

| Split | 4x4 | 8x8 | 12x12 | 16x16 | Total |
|:------|----:|----:|------:|------:|------:|
| **Train** | 22,992 | 22,992 | 22,992 | 22,992 | **91,968** |
| **Eval** | 250 | 250 | 250 | 250 | **1,000** |

- **Source images**: 23,742 unique high-resolution images from DIV2K, DIV8K, and Unsplash
- **No overlap**: Train and eval splits are partitioned by source image; the same image never appears in both

## Directory Structure

```
train/
  grid_4x4/
    DIV2K_0001/
      layout.png          # Shuffled pieces displayed on a grid, labeled with piece IDs
      source.png          # Original image (ground truth reference)
      ground_truth.json   # Piece-to-position mapping and edge signatures
    DIV2K_0002/
    ...
  grid_8x8/
  grid_12x12/
  grid_16x16/

validation/
  grid_4x4/
  grid_8x8/
  grid_12x12/
  grid_16x16/

split_index.json          # Canonical list of image IDs per split
```

## Instance Format

Each instance directory contains three files:

### `layout.png`
The model input: all N x N pieces arranged in ID order (not solution order) on a display board. Each piece is labeled with its numeric ID and shows its tab/blank/flat edge shapes.

### `source.png`
The original uncut image, provided for reference and visualization.

### `ground_truth.json`
```json
{
  "instance_id": "DIV2K_0001",
  "grid_size": 4,
  "n_pieces": 16,
  "id_to_position": {
    "7": [0, 0],
    "9": [0, 1],
    "5": [0, 2],
    "...": "..."
  },
  "edge_signatures": {
    "7": {"top": "flat", "right": "tab", "bottom": "blank", "left": "flat"},
    "9": {"top": "flat", "right": "tab", "bottom": "tab", "left": "blank"},
    "...": "..."
  }
}
```

**Fields:**
- `id_to_position`: Maps each piece ID to its correct `[row, col]` position in the solved puzzle
- `edge_signatures`: Each piece's four edges typed as `tab` (convex), `blank` (concave), or `flat` (border)

## Edge Types & Compatibility Rules

| Edge Type | Description | Constraint |
|:----------|:------------|:-----------|
| **Tab** | Convex semicircular protrusion | Must pair with a **blank** on the adjacent piece |
| **Blank** | Concave semicircular indentation | Must pair with a **tab** on the adjacent piece |
| **Flat** | Straight edge | Only on puzzle borders (corners have 2, edges have 1, interior pieces have 0) |

## Evaluation Metrics

| Metric | Description |
|:-------|:------------|
| **Piece Accuracy (PA)** | Fraction of pieces placed in their correct position |
| **Exact Match (EM)** | Whether the entire puzzle is solved correctly (all pieces correct) |

## Quick Start

```python
from huggingface_hub import snapshot_download

# Download eval split only (~5 GB)
snapshot_download(
    repo_id="ShawnLi02/JigShape-Train",
    repo_type="dataset",
    allow_patterns="validation/**",
    local_dir="./JigShape"
)

# Download a specific grid size for training (~120 GB for 16x16)
snapshot_download(
    repo_id="ShawnLi02/JigShape-Train",
    repo_type="dataset",
    allow_patterns="train/grid_4x4/**",
    local_dir="./JigShape"
)
```

## Related Resources

- **Test split** (held-out for competition): [ShawnLi02/JigShape](https://huggingface.co/datasets/ShawnLi02/JigShape)
- **Paper**: *JigShape: Can Vision-Language Models Solve Jigsaw Puzzles?* (under review)

## Citation

```bibtex
@article{jigshape2025,
  title={JigShape: Can Vision-Language Models Solve Jigsaw Puzzles?},
  author={Anonymous},
  year={2025}
}
```

## License

This dataset is released under the [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) license.