num_input int64 | num_after_dedup int64 | num_after_clip int64 | num_sharded int64 | exact_dups int64 | near_dups int64 | dedup_rate float64 | num_shards int64 | num_workers int64 | hash_kind string | elapsed_sec float64 | images_per_sec float64 | band_pairs_checked int64 | clip_ran bool | extra dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3,840 | 3,000 | 2,536 | 2,536 | 637 | 203 | 0.21875 | 3 | 8 | dhash | 14.826966 | 258.987579 | 556,812 | true | {
"clip_threshold": 0.1,
"clip_score_min": 0.036224767565727234,
"clip_score_max": 0.3183661103248596
} |
parallel-image-text-dataset-builder (sample)
A small representative sample from the parallel-image-text-dataset-builder pipeline: it ingests image-text pairs, removes near-duplicates with perceptual-hash (dhash) LSH-style bucketing, filters weak pairs by CLIP image-text similarity, and writes fixed-size WebDataset-style tar shards.
Contents
shard-00002.tar- one WebDataset-style shard (536 samples). Each sample is two members sharing a key:{key}.jpg(image) and{key}.txt(caption).stats.json- machine-readable statistics from the full run that produced this sample.
Generation method
Fully synthetic. Base images are procedural RGB patterns built from a sum of
random low-frequency plane waves plus a bright blob and a per-image color tint,
so each base image has a distinctive perceptual hash while a planted
resize + JPEG-recompress copy hashes close to it. Captions are templated
(a {color} {shape} over a {scene}) and only loosely tied to the abstract
images, so absolute CLIP scores are low by construction.
The published shard is the output of the full pipeline:
- Perceptual hashing (dhash, 9x8 grid, 64-bit) over all inputs.
- Near-duplicate removal via banded LSH bucketing + union-find (5-bit hamming threshold, 8 bands).
- CLIP image-text similarity filtering (open_clip
ViT-B-32laion2b_s34b_b79k) at score threshold 0.10. - Fixed-size tar sharding (1000 samples/shard).
Run this sample came from
Measured on a single NVIDIA RTX 5090 (24 GB). Input: 3840 synthetic pairs (3000 unique base images + 840 planted near-duplicates).
| stage | value |
|---|---|
| input pairs | 3840 |
| after dedup | 3000 (removed 840: 637 exact, 203 near) |
| dedup rate | 0.2188 (equals the planted duplicate fraction) |
| after CLIP filter (threshold 0.10) | 2536 |
| shards written | 3 (this repo ships shard 2, 536 samples) |
| band pairs checked | 556,812 vs 7,370,880 all-pairs |
This is a small-scale run that exercises the full path end to end; the numbers are real measurements, not a large-corpus benchmark.
Reading a shard
import tarfile
with tarfile.open("shard-00002.tar") as tar:
jpgs = [n for n in tar.getnames() if n.endswith(".jpg")]
print(len(jpgs), "images")
License
MIT.
- Downloads last month
- 12