Datasets:
id int64 0 60k | image imagewidth (px) 28 28 | label int32 0 9 | label_name stringclasses 10
values | image_emb list |
|---|---|---|---|---|
0 | 5 | 5 | [
0.014190673828125,
-0.05462646484375,
0.0016145706176757812,
0.0137939453125,
-0.004344940185546875,
-0.023345947265625,
0.035614013671875,
0.01502227783203125,
-0.0142059326171875,
-0.02117919921875,
-0.023193359375,
-0.01251220703125,
0.0060882568359375,
0.05279541015625,
-0.0002149343... | |
1 | 0 | 0 | [
0.049102783203125,
-0.143310546875,
-0.00635528564453125,
-0.040740966796875,
-0.020416259765625,
-0.00949859619140625,
0.026153564453125,
0.00743865966796875,
-0.031280517578125,
-0.0029392242431640625,
-0.001739501953125,
-0.0199127197265625,
0.0038433074951171875,
0.03857421875,
-0.00... | |
2 | 4 | 4 | [
0.004230499267578125,
0.0038928985595703125,
0.004276275634765625,
0.0213623046875,
-0.01378631591796875,
-0.004726409912109375,
0.046173095703125,
0.0016183853149414062,
0.002780914306640625,
0.0110931396484375,
-0.004119873046875,
-0.0071563720703125,
0.0027408599853515625,
0.04473876953... | |
3 | 1 | 1 | [
0.0236663818359375,
-0.04583740234375,
-0.004383087158203125,
-0.017333984375,
-0.00034880638122558594,
0.0106658935546875,
0.039520263671875,
0.04022216796875,
-0.020538330078125,
-0.025146484375,
-0.0110015869140625,
0.005954742431640625,
0.00839996337890625,
0.0290069580078125,
0.0190... | |
4 | 9 | 9 | [
0.00861358642578125,
0.00868988037109375,
0.0204925537109375,
-0.021270751953125,
-0.0014171600341796875,
-0.0156707763671875,
0.0230255126953125,
0.042694091796875,
-0.047515869140625,
0.00853729248046875,
0.007587432861328125,
-0.013397216796875,
-0.01099395751953125,
0.0273590087890625,... | |
5 | 2 | 2 | [
0.027740478515625,
-0.056793212890625,
0.0186767578125,
-0.041595458984375,
-0.006847381591796875,
0.01119232177734375,
0.015350341796875,
-0.007335662841796875,
-0.047210693359375,
0.0091705322265625,
-0.003917694091796875,
-0.04119873046875,
0.0092010498046875,
0.0145111083984375,
0.00... | |
6 | 1 | 1 | [
0.01251983642578125,
-0.08197021484375,
-0.0107269287109375,
-0.00728607177734375,
0.01062774658203125,
-0.01024627685546875,
0.009979248046875,
0.046142578125,
-0.0321044921875,
-0.024322509765625,
-0.0203704833984375,
0.0189361572265625,
0.0230712890625,
0.01155853271484375,
-0.0052108... | |
7 | 3 | 3 | [
0.0253448486328125,
-0.09222412109375,
0.0257415771484375,
-0.0047454833984375,
-0.034271240234375,
0.007389068603515625,
0.0172119140625,
0.0364990234375,
-0.01297760009765625,
0.03204345703125,
-0.0070648193359375,
-0.0044403076171875,
0.0130615234375,
0.053192138671875,
-0.00161361694... | |
8 | 1 | 1 | [
0.00930023193359375,
-0.098388671875,
-0.0185699462890625,
-0.03125,
-0.013885498046875,
-0.0228271484375,
0.0251617431640625,
0.06488037109375,
-0.0238189697265625,
-0.00891876220703125,
-0.0014619827270507812,
0.0252227783203125,
0.01074981689453125,
-0.0180511474609375,
-0.00926208496... | |
9 | 4 | 4 | [
0.01174163818359375,
-0.10394287109375,
0.00519561767578125,
-0.01447296142578125,
-0.00920867919921875,
-0.0032100677490234375,
0.0096893310546875,
0.03985595703125,
-0.03704833984375,
-0.034423828125,
-0.010223388671875,
-0.0130157470703125,
0.00853729248046875,
0.036346435546875,
0.03... | |
10 | 3 | 3 | [
0.032379150390625,
-0.0880126953125,
0.0005030632019042969,
-0.004566192626953125,
-0.0222015380859375,
0.028106689453125,
0.02789306640625,
0.0298919677734375,
-0.01201629638671875,
-0.01416778564453125,
-0.017974853515625,
-0.0033016204833984375,
0.03826904296875,
0.0328369140625,
-0.0... | |
11 | 5 | 5 | [
0.020660400390625,
-0.0347900390625,
-0.0311279296875,
-0.031524658203125,
-0.004642486572265625,
-0.0009622573852539062,
0.038726806640625,
0.0293426513671875,
-0.040374755859375,
-0.049530029296875,
-0.0184173583984375,
0.0003876686096191406,
0.0081024169921875,
0.0235595703125,
0.0249... | |
12 | 3 | 3 | [
0.031524658203125,
-0.053924560546875,
0.0121307373046875,
-0.01433563232421875,
-0.0275726318359375,
0.030242919921875,
0.01116180419921875,
0.03265380859375,
-0.005550384521484375,
0.0206298828125,
-0.01264190673828125,
0.0110015869140625,
-0.0007152557373046875,
0.07867431640625,
0.00... | |
13 | 6 | 6 | [
0.0143280029296875,
-0.06768798828125,
0.0007395744323730469,
-0.02557373046875,
-0.01153564453125,
-0.0002734661102294922,
0.062286376953125,
0.0218048095703125,
-0.01407623291015625,
-0.01119232177734375,
-0.016632080078125,
-0.0107269287109375,
0.005611419677734375,
0.01387786865234375,... | |
14 | 1 | 1 | [
-0.00689697265625,
-0.07452392578125,
-0.00969696044921875,
-0.001220703125,
-0.0247344970703125,
-0.0009655952453613281,
0.01641845703125,
0.033843994140625,
-0.0259246826171875,
0.006214141845703125,
-0.0212554931640625,
-0.002376556396484375,
0.0220184326171875,
0.0076751708984375,
0.... | |
15 | 7 | 7 | [
0.0362548828125,
-0.06884765625,
0.01242828369140625,
-0.043060302734375,
0.00669097900390625,
0.019256591796875,
0.038330078125,
0.0250244140625,
-0.029296875,
-0.0124969482421875,
0.003696441650390625,
0.004116058349609375,
0.0031490325927734375,
0.045745849609375,
0.032989501953125,
... | |
16 | 2 | 2 | [
-0.003269195556640625,
-0.0038280487060546875,
0.0141448974609375,
-0.01557159423828125,
-0.005840301513671875,
0.0002644062042236328,
0.040374755859375,
0.0217437744140625,
-0.018707275390625,
0.0080413818359375,
-0.0128021240234375,
-0.01123809814453125,
0.036346435546875,
0.000152945518... | |
17 | 8 | 8 | [
0.044097900390625,
-0.11138916015625,
0.0028858184814453125,
-0.0222015380859375,
0.0010433197021484375,
-0.0030670166015625,
0.01751708984375,
0.03759765625,
-0.0304412841796875,
-0.01218414306640625,
-0.0168914794921875,
-0.0228271484375,
0.00959014892578125,
0.03350830078125,
0.052124... | |
18 | 6 | 6 | [
-0.0033092498779296875,
0.0156707763671875,
-0.0027713775634765625,
-0.054443359375,
0.0023059844970703125,
0.03948974609375,
0.01271820068359375,
0.032867431640625,
-0.0340576171875,
0.0150604248046875,
-0.0272674560546875,
-0.00836944580078125,
-0.0186004638671875,
-0.0090789794921875,
... | |
19 | 9 | 9 | [
0.033599853515625,
-0.05169677734375,
0.010955810546875,
-0.044219970703125,
0.005947113037109375,
0.0013113021850585938,
0.025390625,
0.043243408203125,
-0.0401611328125,
0.00144195556640625,
0.011138916015625,
0.01453399658203125,
-0.0104217529296875,
0.01763916015625,
0.01258850097656... |
YAML Metadata Warning:The task_categories "image-retrieval" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
MNIST (Lance Format)
A Lance-formatted version of the classic MNIST handwritten-digit dataset with 70,000 28×28 grayscale digits stored inline alongside CLIP image embeddings and a pre-built ANN index.
Key features
- All multimodal data (image bytes + embeddings) stored inline in the same Lance dataset — no sidecar files, no external image folders.
- Pre-computed CLIP embeddings (OpenCLIP
ViT-B-32/laion2b_s34b_b79k, 512-dim, L2-normalized) shipped with anIVF_PQindex for instant similarity search. - BTREE index on
labeland BITMAP index onlabel_namefor sub-millisecond filtering. - Standard train/test splits, ready to use with
lance.dataset(...)ordatasets.load_dataset(...).
Splits
| Split | Rows |
|---|---|
train |
60,000 |
test |
10,000 |
Schema
| Column | Type | Notes |
|---|---|---|
id |
int64 |
Row index within the split |
image |
large_binary |
Inline PNG bytes (28×28 grayscale) |
label |
int32 |
Digit class id (0-9) |
label_name |
string |
Human-readable class ("0".."9") |
image_emb |
fixed_size_list<float32, 512> |
CLIP image embedding (cosine-normalized) |
Pre-built indices
IVF_PQonimage_emb— vector similarity search (metric=cosine)BTREEonlabel— fast equality / range filtersBITMAPonlabel_name— fast filters on the 10 class names
Load with datasets.load_dataset
import datasets
hf_ds = datasets.load_dataset("lance-format/mnist-lance", split="train", streaming=True)
for row in hf_ds.take(3):
print(row["label"], row["label_name"])
Load directly with Lance (recommended)
import lance
ds = lance.dataset("hf://datasets/lance-format/mnist-lance/data/train.lance")
print(ds.count_rows(), ds.schema.names)
print(ds.list_indices())
Load with LanceDB
import lancedb
db = lancedb.connect("hf://datasets/lance-format/mnist-lance/data")
tbl = db.open_table("train")
print(len(tbl))
Tip — for production use, download locally first. Streaming from the Hub works for exploration, but heavy random access and ANN search are far faster against a local copy:
hf download lance-format/mnist-lance --repo-type dataset --local-dir ./mnist-lanceThen
lance.dataset("./mnist-lance/data/train.lance").
Vector search example
import lance
import pyarrow as pa
ds = lance.dataset("hf://datasets/lance-format/mnist-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, "nprobes": 16, "refine_factor": 30},
columns=["id", "label", "label_name"],
).to_table().to_pylist()
print(neighbors)
Filter by class
ds = lance.dataset("hf://datasets/lance-format/mnist-lance/data/train.lance")
sevens = ds.scanner(filter="label = 7", columns=["id"], limit=10).to_table()
print(sevens)
Working with images
from pathlib import Path
import lance
ds = lance.dataset("hf://datasets/lance-format/mnist-lance/data/train.lance")
row = ds.take([0], columns=["image", "label"]).to_pylist()[0]
Path("digit_0.png").write_bytes(row["image"])
print("label =", row["label"])
Images are stored inline as PNG bytes; scanning columns like label does not pay the I/O cost of loading image bytes.
Why Lance?
- One dataset for images + embeddings + indices + metadata — no sidecar files to manage.
- On-disk vector and full-text indices live next to the data, so search works on both local copies and the Hub.
- Schema evolution lets you add new columns (fresh embeddings, augmentations, model predictions) without rewriting the data (docs).
Source & license
Converted from ylecun/mnist. MNIST is released under the MIT license. The original dataset is by Yann LeCun, Corinna Cortes, and Christopher J.C. Burges.
Citation
@article{lecun1998mnist,
title={The MNIST database of handwritten digits},
author={LeCun, Yann and Cortes, Corinna and Burges, CJ},
url={http://yann.lecun.com/exdb/mnist/},
year={1998}
}
- Downloads last month
- 26