narinzar's picture
Upload README.md with huggingface_hub
8dd961f verified
|
Raw
History Blame Contribute Delete
2.61 kB
---
license: mit
task_categories:
- image-to-text
- other
tags:
- image-text
- deduplication
- perceptual-hash
- clip
- webdataset
- synthetic
size_categories:
- n<1K
pretty_name: Parallel Image-Text Dataset Builder (sample shard)
---
# parallel-image-text-dataset-builder (sample)
A small representative sample from the
[parallel-image-text-dataset-builder](https://github.com/narinzar/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:
1. Perceptual hashing (dhash, 9x8 grid, 64-bit) over all inputs.
2. Near-duplicate removal via banded LSH bucketing + union-find (5-bit hamming
threshold, 8 bands).
3. CLIP image-text similarity filtering (open_clip `ViT-B-32`
`laion2b_s34b_b79k`) at score threshold 0.10.
4. 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
```python
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.