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/stanford-cars-lance.
Lance-formatted version of the Stanford Cars dataset — 8,144 training images across 196 fine-grained car make/model/year classes — sourced from Multimodal-Fatima/StanfordCars_train.

Schema

ColumnTypeNotes
idint64Row index
imagelarge_binaryInline JPEG bytes
labelint32Class id (0-195)
blip_captionstring?BLIP-generated caption (beam=5) carried through from the source mirror
image_embfixed_size_list<float32, 512>OpenCLIP ViT-B-32 embedding (cosine-normalized)

Pre-built indices

  • IVF_PQ on image_embmetric=cosine
  • INVERTED (FTS) on blip_caption
  • BTREE on label

Quick start

import lance
ds = lance.dataset("hf://datasets/lance-format/stanford-cars-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/stanford-cars-lance/data")
tbl = db.open_table("train")
print(f"LanceDB table opened with {len(tbl)} car images")

Caption-based filtering

import lance
ds = lance.dataset("hf://datasets/lance-format/stanford-cars-lance/data/train.lance")
hits = ds.scanner(full_text_query="red sports car", columns=["id", "blip_caption"], limit=10).to_table()
import lancedb

db = lancedb.connect("hf://datasets/lance-format/stanford-cars-lance/data")
tbl = db.open_table("train")

results = (
    tbl.search("red sports car")
    .select(["id", "blip_caption"])
    .limit(10)
    .to_list()
)
import lance, pyarrow as pa
ds = lance.dataset("hf://datasets/lance-format/stanford-cars-lance/data/train.lance")
emb_field = ds.schema.field("image_emb")
ref = ds.take([0], columns=["image_emb", "blip_caption"]).to_pylist()[0]
neighbors = ds.scanner(
    nearest={"column": "image_emb", "q": pa.array([ref["image_emb"]], type=emb_field.type)[0], "k": 5},
    columns=["id", "blip_caption"],
).to_table().to_pylist()
import lancedb

db = lancedb.connect("hf://datasets/lance-format/stanford-cars-lance/data")
tbl = db.open_table("train")

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

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

Source & license

Converted from Multimodal-Fatima/StanfordCars_train, itself a parquet redistribution of the Stanford Cars test split. The original dataset license is for non-commercial research use; review the Stanford Cars terms before redistribution.

Citation

@inproceedings{krause2013collecting,
  title={Collecting a large-scale dataset of fine-grained cars},
  author={Krause, Jonathan and Stark, Michael and Deng, Jia and Fei-Fei, Li},
  booktitle={Workshop on Fine-Grained Visual Categorization (CVPR)},
  year={2013}
}