GBC-1M-webmix
The files and examples call this dataset by its working name, web1m-gbc.
Dataset summary
1,020,000 web images, half from COYO and half from LAION-COCO, each with a GBC graph (Graph-Based Captioning): an image caption, the entities and compositions in the image with a box and captions of their own, and the relations between them, linked as one graph. Captioned with LFM3-2B + SAM 3 + GBC-Nest.
The images come in two AVIF variants, 1024-avif-q75 and 512-avif-q60, which plain
Pillow decodes on Linux, Windows and macOS. The data is in the GBC dataset format, read
with kohakugbc-data.
| samples | 1,020,000: train 1,000,000 · val 10,000 · test 10,000 (test: no graphs, see Splits) |
| image sources | coyo-hd-11m 510,000 · laion-coco-13m 510,000; each split about 50/50 |
1024-avif-q75 |
the captioned image at its own size (short edge <= 1024), AVIF q75: 98.0 GiB, mean 103 KB |
512-avif-q60 |
short edge <= 512 (Lanczos, no crop, never upscaled), AVIF q60: 33.6 GiB, mean 35 KB |
| graphs | mean 13.9 vertices (8.4 entities, 3.75 relations, 0.76 compositions), 26.5 edges, 26.8 captions, depth 2.15; 97.7% have a relation |
| shards | 50,000 samples each: train 20, val 1, test 1 per variant |
Uses: training and evaluating dense, grounded and relational captioners; text-to-image training with structured prompts; region-text grounding.
Benchmark: predicted graphs are scored against the ground truth by the metric code in
eval/:
- Structure track: boxes, vertex types, edges and relations. It is the best any vertex pairing reaches, averaged over IoU 0.50-0.95.
- Full track: the structure track plus text compared by meaning.
Develop on val; the test graphs are held out. See Evaluation.
Use
pip install "kohakugbc-data>=0.2.0" # Python 3.11+; Linux, Windows, macOS
from kohakugbc_data.dataset import GbcDataset, read_info, split
root = "web1m-gbc/512-avif-q60/train"
ds = GbcDataset(root, image="pil") # image="bytes" for the AVIF file, None to skip it
s = ds["coyo-8267732"] # or ds[i]
s.image # PIL RGB image, s.w x s.h
s.graph.prompt(width=s.w, height=s.h) # the graph as GBC prompt text
s.graph.to_json() # the full graph
s.meta["url"], s.meta["selection"]["aesthetic"]
# a training view
ds = GbcDataset(root, image="pil",
transform=lambda s: (s.image, s.graph.prompt(width=s.w, height=s.h)))
# multi-node: each rank reads whole shards
names = [x["name"] for x in read_info(root)["shards"]]
ds = GbcDataset(root, shards=split(names, rank, world))
# filter on the manifest (a pyarrow table)
import pyarrow.compute as pc
rich = ds.manifest.filter(pc.greater_equal(ds.manifest["relations"], 5))
# the test split has no graphs
test = GbcDataset("web1m-gbc/512-avif-q60/test", image="pil", graphs=False)
GbcDataset works as a PyTorch map-style dataset, and its files open lazily in each worker.
AVIF decodes through the libavif built into recent Pillow wheels (checked with Pillow 13.0
on Linux and Windows), so no other image library is needed.
Download only the variant you train on. Each variant folder carries its own graphs and
metadata, so 512-avif-q60/ alone is a complete dataset.
Dataset structure
web1m-gbc/
README.md this card
export_report.json every count of the export
splits/{train,val,test}.txt the keys of each split, in shard order
eval/ the evaluation: metric code, scorer, guide, examples
graphs/graphs.kvault key -> graph (GbcGraph msgpack, zstd); train and val
graphs/graphs.parquet key, set, split, graph counts, repair counts; train and val
1024-avif-q75/{train,val,test}/ one GBC dataset per variant and split
512-avif-q60/{train,val,test}/
dataset.json format, shard list, header (source, caption run, encoding)
shards/shard_XXXXX/
images.zip <key>.avif: a stored zip with an index
graphs.db key -> graph (the same bytes as graphs/graphs.kvault)
meta.db key -> metadata dict
manifest.parquet one row per sample
The .db and .kvault files are SQLite files in the KohakuVault layout, which
kohakugbc-data reads. Keys are coyo-<id> or laion-<id> and are the same in every
variant, split list and store.
Graphs
A GBC graph has these vertices:
image: the root, with a short caption and a detailed caption.entity: an object, with a box and captions.composition: a group of entities, with a box and a caption.relation: a caption about two or more named entities, with the box around them.
Edges link each vertex to the vertices its captions name. Boxes are fractions [0, 1] of
the image, so they hold for both variants. In the graph JSON, img_size is the captioned
image's size, img_path is the member name (<key>.avif) and img_url is the source URL.
graph.prompt(width, height) renders the graph as text, with boxes in that canvas's pixels.
Metadata (meta.db)
| field | holds |
|---|---|
key, set, source_id, split |
the key; coyo or laion; the id in the source set; the split |
url, sha256 |
the source image URL, and the source set's sha256 of the original download |
original_size |
the original image's size, as the source set's metadata lists it |
captioned_size |
the size of the captioned image (= the graph's img_size) |
selection |
the selection features: aesthetic, clip_sim, nsfw, watermark, num_faces (COYO's own scores, null for LAION-COCO), n_objects, n_classes (object detections), quoted_chars, brief_len, desc_len (from an earlier caption), wd_n_tags, wd_no_humans, score (the richness score of the selection) |
wd |
WD-tagger probabilities of the filtered tags: text_focus, watermark, logo, comic, screenshot, chart, infographic, simple_background, white_background, english_text, web_address |
rating |
WD-tagger rating probabilities: general, sensitive, questionable, explicit |
graph |
the graph's counts: vertices, labels, edges, captions, depth, roots, leaves (train and val) |
Manifest (manifest.parquet)
- Format columns:
key,index,w,h(the stored image's size),codec(avif),image_bytes,graph_bytes. - Dataset columns:
set,split,source_w,source_h(the captioned image's size). - Graph counts (train and val only):
vertices,entities,relations,compositions,edges,captions,depth.
Splits
| split | samples | COYO / LAION-COCO | graphs |
|---|---|---|---|
| train | 1,000,000 | 500,005 / 499,995 | yes |
| val | 10,000 | 4,997 / 5,003 | yes |
| test | 10,000 | 4,998 / 5,002 | held out |
The test split holds images and metadata only. It has no graphs.db, no graph counts, and
no test keys in graphs/, so it can serve as a held-out evaluation set. The three splits
come from one seeded shuffle of the selection.
Dataset creation
Source data
The images, and the source scores that the selection uses, come from two sets on the Hugging Face Hub:
- coyo-hd-11m (CaptionEmporium/coyo-hd-11m-llavanext): 11,397,137 images, a high-resolution subset of COYO-700M. Its rows carry the URL, sha256, sizes, and COYO's CLIP, NSFW, watermark and aesthetic scores.
- laion-coco-13m: 11,089,579 images from LAION-COCO.
- The images: KBlueLeaf/laion-coco-13m-tar.
- The metadata, including the object detections behind
n_objects/n_classes: CaptionEmporium/laion-coco-13m-molmo-d-7b.
From each image we used a 1024 px rendition (short edge <= 1024, WebP), together with the source's scores, an earlier caption and a WD-tagger run.
Selection
Each set is selected on its own:
- Size: short edge >= 512 px and aspect ratio <= 2.5.
- Content filters:
- NSFW score < 0.1;
- WD rating
questionable< 0.15 andexplicit< 0.05; - watermark score < 0.5 and WD
watermark< 0.35; - fewer than 20 quoted characters in the earlier caption;
- WD
text_focus,screenshot,chart,infographic< 0.35, andcomic,logo< 0.5; - not a product shot (WD
simple_backgroundandwhite_backgroundboth > 0.5).
- Deduplication by sha256 and by URL, across both sets.
- Richness: each image is scored by the mean percentile rank of the earlier caption's length, the WD tag count and the object count. For COYO, the score is 0.75 × that plus 0.25 × the aesthetic rank. The top half of each set is kept.
- Draw: 510,000 per set, at random from that top half.
| step | COYO | LAION-COCO |
|---|---|---|
| rows | 11,397,137 | 11,089,579 |
| size and aspect | 11,335,263 | 10,998,066 |
| content filters | 6,361,460 | 4,489,976 |
| deduplication | 6,153,868 | 4,424,944 |
| richness, top half | 3,076,934 | 2,212,472 |
| drawn | 510,000 | 510,000 |
Captioning
Each image was captioned at its 1024 px rendition, all run by the GBC-Nest captioning program:
- LFM3-2B (LFM3-VL 2B, MXFP8) wrote every caption, under a grammar that forces the output into the graph's form on every call.
- SAM 3 grounded the entities.
- EmbeddingGemma-300m merged duplicate entities.
Repair
Every graph was repaired before packing. The repaired graph passes a check against the captioned one: no vertex is changed except the removed relations.
| repair | count | graphs |
|---|---|---|
| relations naming an entity the graph does not hold, removed | 136,530 | 82,171 (8.1%) |
| edges removed with them | 338,460 | 82,227 |
| cycle-closing edges removed | 57 | 57 |
| mask references to absent vertices, dropped | 21,265,502 | 704,580 |
After the removals, the remaining relations' boxes, in-edges and masks are recomputed.
Entity and composition vertices, their boxes and every caption stay as captioned.
graphs/graphs.parquet holds the repair counts per graph.
Images
Both variants are AVIF re-encodes of the captioned image (Pillow 13.0, libavif 1.4.2, speed 6), converted to RGB; the 2,919 sources with alpha have it dropped.
1024-avif-q75: the captioned image's own size.512-avif-q60: resized to short edge 512 where it was larger (99.2% of images).
The manifest's w and h are the stored image's size; source_w and source_h are the
captioned image's size.
Checks
Every sample of every variant and split was checked against the selection, the caption run and the captioned files:
Graphs: each stored graph is typed, renders a prompt and equals the caption run's graph after repair. It passes the repair check against that graph, and the shard's graph bytes equal
graphs/.Metadata: each dict equals one rebuilt from its selection row, its graph and its captioned file.
Images: each image decodes with Pillow as AVIF, at its manifest size and at the size the variant's rule gives from the captioned file.
PSNR against the captioned image (resized like the variant), on 100 samples per shard (2,200 per variant):
variant median p05 min 1024-avif-q7541.5 dB 37.8 dB 33.6 dB 512-avif-q6036.6 dB 32.1 dB 28.2 dB Keys: both variants hold the same keys in the same order as
splits/, with every selected key exactly once.Reading:
GbcDataset(image="pil")reads samples and renders their prompts on Linux and Windows, withkohakugbc-data0.2.0 from PyPI and no other image library.
Evaluation
eval/ scores predicted graphs against this dataset's ground truth. It needs Python with
numpy and scipy, plus sentence-transformers for the full track. Its
guide covers:
- the protocol and the prediction format;
- the metric's definition;
- tools for exporting the ground truth and converting prompt-text predictions;
- worked examples with their reports.
The task: for each image, predict a GBC graph (boxes in [0, 1], typed entity /
composition vertices, parent-child edges, relations as sets of vertices, and optionally
names and descriptions).
cd web1m-gbc/eval
python export_gt.py ../512-avif-q60/val GT_val.jsonl
python score_graphs.py GT_val.jsonl PRED.jsonl --out report.json \
--text-model google/embeddinggemma-300m
- Structure track (the headline score): text is never read. It is the best score any one-to-one pairing of predicted with ground-truth vertices reaches, with a pair allowed when IoU >= τ and the types agree. The score is the mean F1 of vertices, edges and relations, averaged over τ = 0.50, 0.55, ..., 0.95 and over images.
- Full track: half that structure score and half text similarity. Texts are compared by sentence embeddings, rescaled so that unrelated text scores 0.
Each track's maximum is found exactly by an integer program, so vertex ids, order and wording cannot change a score. On 300 val images, examples of what errors cost:
| prediction | structure | full |
|---|---|---|
| the ground truth, renamed and shuffled | 1.000 | 1.000 |
| the same without any text | 1.000 | 0.500 |
| the ground truth as prompt text, read back | 0.989 | 0.922 |
| boxes shifted by 5% of their size | 0.724 | 0.763 |
| no relations | 0.678 | 0.718 |
| boxes shifted by 15% | 0.281 | 0.379 |
| another image's graph | 0.029 | 0.057 |
Score every image of a split (a missing prediction scores 0), and keep the default thresholds and text model. Test predictions are scored by the dataset maintainers.
Considerations
- Content: the filters remove most NSFW, watermarked, text-heavy, chart, comic, logo and product-shot images, but they are automatic scores, and some such images remain.
- People: many images show people (COYO's
num_facesis in the metadata). The graphs describe what is visible and do not name anyone, but captions come from a 2B vision-language model and can be wrong. They may hallucinate objects or attributes, and their boxes come from automatic grounding. - Bias: the images are what COYO and LAION-COCO crawled from the web, ranked toward rich scenes. Their distribution of places, people and objects follows the web, not the world.
- Image size: the captioned rendition is at most 1024 px on the short edge. Some
captioned images are smaller than the size the source metadata lists (
captioned_sizeandsource_w/source_hgive the true size). - Rights: the images belong to their owners. Use them as the source sets' terms and your jurisdiction allow.
License
The graphs, metadata and packing in this dataset are released under the MIT license. The images are copyrighted by their owners and are included for research. The image sources (coyo-hd-11m from COYO-700M, and laion-coco-13m from LAION-COCO; see Source data) publish their URLs and metadata under CC-BY-4.0. Their own terms apply to what this dataset takes from them.
Citation
@misc{gbc1m-webmix,
title = {GBC-1M-webmix: one million web images with graph-based captions},
author = {Kohaku-Blueleaf},
year = {2026},
url = {https://huggingface.co/datasets/KBlueLeaf/GBC-1M-webmix},
}
@article{hsieh2024gbc,
title = {Graph-Based Captioning: Enhancing Visual Descriptions by Interconnecting Region Captions},
author = {Hsieh, Yu-Guan and others},
journal = {arXiv preprint arXiv:2407.06723},
year = {2024},
}
Image sources (please credit them too):
- CaptionEmporium/coyo-hd-11m-llavanext (coyo-hd-11m), from COYO-700M (Byeon et al., 2022);
- KBlueLeaf/laion-coco-13m-tar and CaptionEmporium/laion-coco-13m-molmo-d-7b (laion-coco-13m), from LAION-COCO (LAION, 2022).
- Downloads last month
- 457
