View on Hugging Face
Source dataset card and downloadable files for
lance-format/handwriting-ocr.[!NOTE] Training note: The same samples appear repeatedly because a model (during training) should learn from multiple different handwritten crops of the same medicine, because they capture different writers, pen strokes, sizes, and image quality. The dataset would need to be shuffled and sampled appropriately before running downstream training tasks
Key features
- Original inline PNG bytes in
image, with no image folders or sidecar files required. - Three preserved splits: 3,120 training, 780 validation, and 780 test examples.
- Medicine annotations: 78 medicine names mapped to 15 generic names.
- Built-in text retrieval over
searchable_summary, with scalar indices matching the companion OCR retrieval project.
Splits
| Split | Rows | Source directory |
|---|---|---|
train | 3,120 | Training |
validation | 780 | Validation |
test | 780 | Testing |
Schema
| Column | Type | Notes |
|---|---|---|
id | string | Stable split-qualified row identifier |
image | large_binary | Original inline PNG bytes |
medicine_name | string | Source medicine-name label |
generic_name | string | Source generic-name label |
normalized_text | string | Deterministic normalization of medicine_name |
category | string | medication for every source row |
is_medical | bool | true for every source row |
needs_human_review | bool | false; this conversion does not run OCR confidence assessment |
searchable_summary | string | Label-derived text: Medication mention: <medicine> (<generic>) |
source_dataset | string | Upstream Kaggle dataset identifier |
split | string | Original source split name: Training, Validation, or Testing |
image_filename | string | Original PNG filename within the source split |
normalized_text, category, is_medical, needs_human_review, and searchable_summary are deterministic conversion metadata. They are not OCR or clinical-model predictions.
Pre-built indices
INVERTED(FTS) onsearchable_summaryBTREEonidBITMAPoncategoryBITMAPonneeds_human_review
Why Lance?
- Blazing Fast Random Access: Optimized for fetching scattered rows, making it ideal for random sampling, real-time ML serving, and interactive applications without performance degradation.
- Native Multimodal Support: Store text, embeddings, and other data types together in a single file. Large binary objects are loaded lazily, and vectors are optimized for fast similarity search.
- Native Index Support: Lance comes with fast, on-disk, scalable vector and FTS indexes that sit right alongside the dataset on the Hub, so you can share not only your data but also your embeddings and indexes without your users needing to recompute them.
- Efficient Data Evolution: Add new columns and backfill data without rewriting the entire dataset. This is perfect for evolving ML features, adding new embeddings, or introducing moderation tags over time.
- Versatile Querying: Supports combining vector similarity search, full-text search, and SQL-style filtering in a single query, accelerated by on-disk indexes.
- Data Versioning: Every mutation commits a new version; previous versions remain intact on disk. Tags pin a snapshot by name, so retrieval systems and training runs can reproduce against an exact slice of history.
Load with datasets.load_dataset
You can load Lance datasets through the standard Hugging Face datasets interface when you want a streaming sample or your pipeline already uses Dataset / IterableDataset.
Load with LanceDB
LanceDB is the embedded retrieval library built on top of the Lance format (docs), and is the interface most users interact with. It wraps the downloaded dataset as a queryable table with search and filter builders, and is the entry point used by the Search, Curate, Evolve, and Versioning examples below.Load with Lance
pylance is the Python binding for the Lance format and works directly with lower-level APIs. Use it to inspect the schema, fragments, and pre-built indices.
Tip - for production use, download locally first. Streaming from the Hub works for exploration, but repeated random access and training are faster against a local copy:Then run the examples below from./handwriting-ocr, where./datacontains the downloaded Lance splits.
Search
The bundled full-text index makes medicine and generic-name lookups efficient without an embedding model.searchable_summary combines the two labels, so a text query can return the matching word image and its annotations in one bounded result set.
Curate
Filters produce small, explicit candidate sets for experiments. The example selects a bounded set of Paracetamol examples while avoiding image bytes until a later step needs them.Evolve
Lance can append new columns without rewriting the original images or annotations. For example, a local copy can add a flag for a specific generic name using a SQL expression, then merge independently produced labels byid.
Note: Mutations require a local copy. The examples in this card assume the dataset was downloaded into the current directory, as shown above.
Train
Projection lets a training loop read only the columns it needs. The image bytes and medicine label below are projected through a standard PyTorchDataLoader; fields added later do not add read cost unless selected.
Versioning
Every Lance mutation creates a version, so the table history can identify the exact split and annotation state used by a retrieval service or experiment. The downloaded dataset can list its history and create tags for reproducible local workflows.Materialize a subset
Use a filtered query to materialize a compact local LanceDB table for writes or intensive training. The query streams matching rows and projected columns without materializing the full result set in Python memory../data in the Evolve, Train, and Versioning examples when a compact writable subset is sufficient.