Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.lancedb.com/llms.txt

Use this file to discover all available pages before exploring further.

https://mintcdn.com/lancedb-bcbb4faf/6L0IRVkfdlgMU1Pw/static/assets/logo/huggingface-logo.svg?fit=max&auto=format&n=6L0IRVkfdlgMU1Pw&q=85&s=da940a105a40440f0cd1224d3fa4ae52

View on Hugging Face

Source dataset card and downloadable files for lance-format/pascal-voc-2012-segmentation-lance.
A Lance-formatted version of the Pascal VOC 2012 semantic segmentation split (sourced from nateraw/pascal-voc-2012) — 2,913 image / mask pairs with CLIP image embeddings stored inline and a pre-built IVF_PQ ANN index.

Why segmentation?

VOC 2012 ships several tasks (classification, detection, segmentation, action). We focus on the semantic segmentation subset because every row carries a paired mask image and the dataset is small enough to convert quickly with full embeddings — useful as a smoke test or a small benchmark.

Splits

SplitRows
train.lance1,464
validation.lance1,449

Schema

ColumnTypeNotes
idint64Row index within the split
imagelarge_binaryInline JPEG bytes
masklarge_binaryInline PNG bytes — class id per pixel (0=background, 1-20=VOC classes, 255=void)
image_embfixed_size_list<float32, 512>OpenCLIP ViT-B-32 image embedding (cosine-normalized)
The 20 Pascal VOC classes are: aeroplane, bicycle, bird, boat, bottle, bus, car, cat, chair, cow, diningtable, dog, horse, motorbike, person, pottedplant, sheep, sofa, train, tvmonitor.

Pre-built indices

  • IVF_PQ on image_embmetric=cosine
Note: the small dataset size (≤1,464 rows per split) is below Lance’s default partition count, so the helper falls back to a smaller num_partitions automatically. For higher recall, build the index with num_partitions=16 against a local copy.

Quick start

import lance

ds = lance.dataset("hf://datasets/lance-format/pascal-voc-2012-segmentation-lance/data/train.lance")
print(ds.count_rows(), ds.schema.names, ds.list_indices())

Load with LanceDB

These tables can also be consumed by LanceDB, the multimodal lakehouse and embedded search library built on top of Lance, for simplified vector search and other queries.
import lancedb

db = lancedb.connect("hf://datasets/lance-format/pascal-voc-2012-segmentation-lance/data")
tbl = db.open_table("train")
print(f"LanceDB table opened with {len(tbl)} image-mask pairs")

Working with images and masks

from pathlib import Path
import lance
from PIL import Image
import io

ds = lance.dataset("hf://datasets/lance-format/pascal-voc-2012-segmentation-lance/data/train.lance")
row = ds.take([0], columns=["image", "mask"]).to_pylist()[0]
Path("img.jpg").write_bytes(row["image"])
Path("mask.png").write_bytes(row["mask"])

import numpy as np
mask = np.array(Image.open(io.BytesIO(row["mask"])))
print("classes present:", np.unique(mask).tolist())

Vector search example

import lance
import pyarrow as pa

ds = lance.dataset("hf://datasets/lance-format/pascal-voc-2012-segmentation-lance/data/train.lance")
emb_field = ds.schema.field("image_emb")
ref = ds.take([0], columns=["image_emb"]).to_pylist()[0]["image_emb"]
query = pa.array([ref], type=emb_field.type)

neighbors = ds.scanner(
    nearest={"column": "image_emb", "q": query[0], "k": 5},
    columns=["id"],
).to_table().to_pylist()
import lancedb

db = lancedb.connect("hf://datasets/lance-format/pascal-voc-2012-segmentation-lance/data")
tbl = db.open_table("train")

ref = tbl.search().limit(1).select(["image_emb"]).to_list()[0]
query_embedding = ref["image_emb"]

results = (
    tbl.search(query_embedding)
    .metric("cosine")
    .select(["id"])
    .limit(5)
    .to_list()
)

Why Lance?

  • One dataset carries images + masks + embeddings + indices — no sidecar files.
  • On-disk vector and full-text indices live next to the data, so search works on local copies and on the Hub.
  • Schema evolution: add columns (instance masks, alternate embeddings, model predictions) without rewriting the data.

Source & license

Converted from nateraw/pascal-voc-2012. The Pascal VOC dataset is released under its own custom license — please review before redistribution.

Citation

@misc{everingham2012pascal,
  title={The Pascal Visual Object Classes Challenge: A Retrospective},
  author={Everingham, Mark and Eslami, S. M. Ali and Van Gool, Luc and Williams, Christopher K. I. and Winn, John and Zisserman, Andrew},
  journal={International Journal of Computer Vision},
  year={2015}
}