File size: 6,476 Bytes
c986fff
 
 
 
765260b
 
 
 
 
 
 
c986fff
8e0d41a
 
 
 
ec76e4d
c986fff
 
ec76e4d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c986fff
 
 
 
765260b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
be162db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
765260b
 
 
 
 
 
 
 
 
 
 
 
 
 
be162db
 
 
 
 
 
 
 
 
 
 
 
 
765260b
be162db
 
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
---
license: other
license_name: per-source-terms
pretty_name: Pretext-270K
language:
- en
size_categories:
- 100K<n<1M
task_categories:
- image-to-image
- any-to-any
configs:
- config_name: jigsaw
  data_files:
  - split: train
    path: preview/jigsaw.parquet
- config_name: orthogonal_transform
  data_files:
  - split: train
    path: preview/orthogonal_transform.parquet
- config_name: deformation_recovery
  data_files:
  - split: train
    path: preview/deformation_recovery.parquet
- config_name: super_resolution
  data_files:
  - split: train
    path: preview/super_resolution.parquet
- config_name: colorization
  data_files:
  - split: train
    path: preview/colorization.parquet
- config_name: denoising
  data_files:
  - split: train
    path: preview/denoising.parquet
- config_name: masked_inpainting
  data_files:
  - split: train
    path: preview/masked_inpainting.parquet
---

# Pretext-270K

Pretext-270K is the first-stage training data of
[ThinkMorph-SSL-Base](https://huggingface.co/ThinkMorph/ThinkMorph-SSL-Base). It holds 270,896 training traces
and 1,600 validation traces. Each trace starts from a corrupted input image. A description
follows, then the restored image, then a further description. There is no question and no
answer.

The traces are grouped into seven tasks, one per corruption that the model undoes.

## Tasks

| Task | Input image | Restored image | Train rows | Val rows | Of these, text only |
| --- | --- | --- | ---: | ---: | ---: |
| `jigsaw` | shuffled tiles: one image cut into tiles, or separate tile images | reassembled image | 52,975 | 571 | 10,266 |
| `orthogonal_transform` | rotated or flipped image | upright image | 36,763 | 183 | — |
| `deformation_recovery` | geometrically warped image | unwarped image | 36,672 | 189 | — |
| `super_resolution` | low-resolution image | high-resolution image | 36,409 | 179 | — |
| `colorization` | grayscale image | colored image | 36,104 | 168 | — |
| `denoising` | noisy image | clean image | 36,023 | 155 | — |
| `masked_inpainting` | image with masked regions | completed image | 35,950 | 155 | — |
| **Total** | | | **270,896** | **1,600** | **10,266** |

Stage 1 trained on the train rows only. Choose a task in the Dataset Viewer to see examples.

## Files

| Path | Content |
| --- | --- |
| `shards/annotations.tar` | `MANIFEST.json` and every task file: all rows, no images |
| `shards/data-*.tar` | the 533,366 images (141 GB) in 133 tar shards |
| `shards/SHARDS.json` | size and SHA256 of every shard |
| `text_only/` | 10,266 rows whose images (Matterport3D) are not distributed here; see [Rows without images](#rows-without-images) |
| `preview/` | the Dataset Viewer examples, one file per task |

## Download

```bash
hf download ThinkMorph/Pretext-270K --repo-type dataset --include "shards/*" --local-dir Pretext-270K
mkdir -p data
for f in Pretext-270K/shards/*.tar; do tar -xf "$f" -C data; done
```

- `shards/SHARDS.json` gives each shard's SHA256, and `MANIFEST.json` each extracted file's.
- To read the rows without the images, download and extract `shards/annotations.tar` only.

## Layout and row format

After extracting the shards:

```text
data/
  MANIFEST.json
  images/<sha256>.<ext>          shared by all tasks
  colorization/train.jsonl
  colorization/val.jsonl
  ...                            one folder per task
```

```json
{"id": "<sha256>", "task": "colorization", "images": ["../images/<sha256>.jpg"],
 "reasoning_thought_0": "...", "reasoning_image_0": "../images/<sha256>.jpg",
 "reasoning_thought_1": "..."}
```

- `images` is the corrupted input. `reasoning_image_0` is the restored image.
- Image paths are relative to the row's file. `id` is a stable public id.

## Reading the data

A trace reads in this order: the input images, then
`reasoning_thought_0`, `reasoning_image_0`, `reasoning_thought_1`, and so on.

```python
import json
from pathlib import Path
from PIL import Image

folder = Path("data/colorization")                      # one task folder of the extracted release
with open(folder / "train.jsonl") as f:
    row = json.loads(next(f))
inputs = [Image.open(folder / p) for p in row["images"]]
steps, i = [], 0
while f"reasoning_thought_{i}" in row:
    image = row.get(f"reasoning_image_{i}")
    steps.append((row[f"reasoning_thought_{i}"], Image.open(folder / image) if image else None))
    i += 1
print(row["task"], len(steps), "steps")
```

## Rows without images

`text_only/` holds the rows of the `jigsaw` task whose images come from Matterport3D. It has the same task folders as the main release.
The terms of their image sources do not allow us to redistribute the images.

- `text_only/images.jsonl` names every image. For each one it gives the upstream identifiers,
  how the image was derived, and the size and MD5 of the file used in training.
- Put the images you obtain in `text_only/images/`; the rows refer to them as `../images/<name>`.

To obtain the source data:

- **Matterport3D:** sign the Matterport3D Terms of Use. The form is at
  <https://niessner.github.io/Matterport/>; send it to matterport3d@googlegroups.com.

## Sources and licenses

Images keep the terms of the dataset they come from; check them before you use the data.
Several sources allow non-commercial research use only. Licenses below are as stated by each
source.

| Image source | Tasks | Terms |
| --- | --- | --- |
| [SA-1B](https://ai.meta.com/datasets/segment-anything/) | all seven | SA-1B Dataset Research License |
| [PixMo-Cap](https://huggingface.co/datasets/allenai/pixmo-cap) | all seven | ODC-BY 1.0; the images are web images under their own terms |
| [VSI-590K](https://huggingface.co/datasets/nyu-visionx/VSI-590K), [LLaVA-OneVision-1.5](https://huggingface.co/datasets/mvp-lab/LLaVA-OneVision-1.5-Instruct-Data), [DeepVision-103K](https://huggingface.co/datasets/skylenage-ai/DeepVision-103K) | all seven | Apache-2.0, Apache-2.0, MIT; their images keep the terms of the original datasets (for example YouTube room tours, Hypersim: CC BY-SA 3.0, ScanNet and ARKitScenes: their terms of use, COCO: Flickr terms) |
| [Realsee3D](https://doi.org/10.5281/zenodo.17826243), [360+x](https://x360dataset.github.io/) | `jigsaw` | CC BY 4.0; CC BY-NC-SA 4.0 |
| [Matterport3D](https://niessner.github.io/Matterport/) (text only) | `jigsaw` | Matterport3D Terms of Use |

The reasoning text, the intermediate images and the release layout are ours. There is no
blanket license over the images.