naazimsnh02's picture
Update Readme.md
b27c8c0 verified
|
Raw
History Blame Contribute Delete
9.59 kB
---
license: cc0-1.0
language:
- en
task_categories:
- image-to-text
tags:
- invoice
- ocr
- indian-fmcg
- kirana
- product-normalization
- synthetic
- gst
- document-understanding
pretty_name: Kirana Invoice Training Data Indian FMCG
size_categories:
- n<1K
dataset_info:
features:
- name: image
dtype: image
- name: response
dtype: string
splits:
- name: train
num_bytes: 176899166
num_examples: 450
- name: test
num_bytes: 19655462
num_examples: 50
download_size: 195416645
dataset_size: 196554628
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
- split: test
path: data/test-*
---
# Kirana Invoice Training Data — Indian FMCG
Training dataset for the **Kirana Detective** project — an AI pipeline that audits distributor invoices for Indian kirana (grocery) stores. The repository contains two distinct sub-datasets used to fine-tune two separate models.
---
## Dataset Summary
| Sub-dataset | Purpose | Size | Format |
|---|---|---|---|
| `synthetic_invoices/` | OCR fine-tuning (MiniCPM-V) | 500 images + annotations | PNG + JSONL |
| `fmcg_catalog.json` | Product name normalization (MiniCPM5-1B) | 200 SKUs → 2,000 pairs | JSON |
Both sub-datasets are fully synthetic — generated programmatically from a hand-curated SKU catalog. No real customer or business data is included.
---
## Sub-dataset 1: Synthetic Invoice Images
### Overview
500 invoice images rendered in pure Python (Pillow) across four realistic formats. Designed to teach MiniCPM-V to extract structured JSON from invoice photos regardless of format, quality, or layout.
### Invoice Formats (125 images each)
| Format | Description | Simulated Noise |
|---|---|---|
| `printed_gst/` | GST-compliant printed invoices (A4, 96 DPI) | None |
| `tally_pdf/` | Tally ERP-style export layout | Monospace fonts, box borders |
| `handwritten/` | Handwritten invoice photos | Gaussian blur, ink texture, skew |
| `whatsapp/` | WhatsApp-forwarded invoice screenshots | JPEG compression, timestamp overlay, dark mode |
### Invoice Contents
Each invoice contains:
- **5–14 line items** randomly sampled from the 200-SKU FMCG catalog
- **Supplier** (1 of 10 major Indian FMCG distributors) with GSTIN
- **Buyer** (1 of 8 kirana store archetypes) with GSTIN
- **Invoice number** in formats: `INV/2024-25/XXXXX`, `TAX/...`, `GST/...`, `BILL/...`
- **Date** between April 2024 and March 2025
- **Pricing** in range ₹8–₹480 per item (15% anomaly rate for training diversity)
- **GST calculations** at 0%, 5%, 12%, 18%, or 28% depending on product category
**Suppliers represented:**
| Company | GSTIN State | City |
|---|---|---|
| Hindustan Unilever Ltd | Maharashtra | Mumbai |
| Nestle India Ltd | Delhi | Delhi |
| Parle Products Pvt Ltd | Maharashtra | Mumbai |
| Britannia Industries Ltd | Karnataka | Bengaluru |
| ITC Limited | Tamil Nadu | Chennai |
| Amul (GCMMF) | Gujarat | Anand |
| Dabur India Ltd | Uttar Pradesh | Ghaziabad |
| Marico Limited | Maharashtra | Mumbai |
| Emami Limited | West Bengal | Kolkata |
| Godrej Consumer Products | Maharashtra | Mumbai |
### HF Dataset Schema
The dataset on HuggingFace Hub is stored as Parquet with two columns:
| Column | dtype | Description |
|---|---|---|
| `image` | `Image` | Embedded invoice image (PIL-compatible) |
| `response` | `string` | Serialized JSON string with extracted invoice fields |
The `response` string follows this structure:
```json
{
"supplier": "Nestle India Ltd",
"gstin_supplier": "07AAACN0032R1ZX",
"buyer": "Ravi Provision Store",
"gstin_buyer": "33AABCR5678K1ZQ",
"invoice_number": "INV/2024-25/04821",
"date": "2024-09-14",
"line_items": [
{
"raw_name": "MAGGI NDL 70GM",
"quantity": 12,
"unit_price": 45.50,
"gst_rate": 18,
"total": 546.00
}
],
"subtotal": 3840.00,
"gst_total": 691.20,
"invoice_total": 4531.20
}
```
### Data Splits
| Split | Examples | Size |
|---|---|---|
| Train | 450 | ~169 MB |
| Test | 50 | ~18.7 MB |
| **Total** | **500** | **~188 MB** |
---
## Sub-dataset 2: FMCG Product Name Normalization Pairs
### Overview
A structured catalog of 200 Indian FMCG SKUs with known abbreviations and aliases, used to generate 2,000 synthetic (raw, canonical) training pairs for MiniCPM5-1B.
### Catalog Structure (`fmcg_catalog.json`)
Each entry:
```json
{
"product_id": "maggi_masala_70g",
"canonical_name": "Nestle Maggi Masala Noodles 70g",
"hsn_code": "1902",
"gst_rate": 18,
"category": "noodles",
"brand": "Nestle",
"common_aliases": [
"MAGGI 70G",
"MAGGI NDL 70",
"MAGGI MSL 70G",
"MAGGI MASALA 70",
"MGI 70G",
"MAGGI 70GM"
]
}
```
### SKU Breakdown by Category
| Category | SKUs | GST Rate | Example Brands |
|---|---|---|---|
| Personal Care | 50 | 18% | Colgate, Dettol, Parachute, Head & Shoulders, Dove |
| Beverages | 45 | 0–28% | Coca-Cola, Tata Tea, Nescafe, Horlicks, Amul |
| Home Care | 35 | 18% | Surf Excel, Harpic, Lizol, Vim, Dettol |
| Biscuits | 30 | 18% | Parle-G, Britannia, ITC Sunfeast, Cadbury Oreo |
| Dairy | 20 | 0–12% | Amul, Mother Dairy |
| Atta / Flour | 10 | 5% | Aashirvaad, Annapurna, Fortune, Patanjali |
| Noodles | 10 | 18% | Maggi, ITC Yippee, Top Ramen, Wai Wai |
| **Total** | **200** | — | 10 major Indian FMCG distributors |
### Augmentation Strategy
Each canonical SKU name is transformed into realistic raw invoice variants using rule-based augmentation:
| Technique | Example |
|---|---|
| Known aliases (hand-curated) | `"SURF XL 1K"``Surf Excel Washing Powder 1kg` |
| Uppercase conversion | `"AMUL BUTTER 100G"``Amul Butter 100g` |
| Unit abbreviation rules | `"500GM"``"500G"``"500GRM"` |
| Product abbreviation rules | `"NDL"``Noodles`, `"TPASTE"``Toothpaste` |
| Common typo injection | `"Colgat"``Colgate`, `"Britania"``Britannia` |
| Random truncation | `"AASHIRVAAD ATT"` (3-word truncation) |
| Regional shorthand | `"PARLEG"``Parle-G`, `"H&S"``Head & Shoulders` |
### Normalization Pair Format
Each training sample follows a chat template:
```json
{
"messages": [
{
"role": "system",
"content": "You are an Indian FMCG product name normalizer. Given a raw product name from a distributor invoice, return ONLY the canonical product name. No explanation, no punctuation — just the canonical name."
},
{
"role": "user",
"content": "Invoice product name: \"MAGGI NDL 70GM\""
},
{
"role": "assistant",
"content": "Nestle Maggi Masala Noodles 70g"
}
]
}
```
### Data Splits
| Split | Pairs |
|---|---|
| Train | 1,800 |
| Eval | 200 |
| **Total** | **2,000** |
---
## Downstream Models
This dataset is used to fine-tune two models in the Kirana Detective pipeline:
| Model | Task | HF Hub |
|---|---|---|
| MiniCPM-V 4.6 | Invoice OCR & JSON extraction | [`build-small-hackathon/minicpm-v-4-6-indian-invoice-extraction`](https://huggingface.co/build-small-hackathon/minicpm-v-4-6-indian-invoice-extraction) |
| MiniCPM5-1B | Product name normalization | [`build-small-hackathon/minicpm5-1b-indian-fmcg-normalizer`](https://huggingface.co/build-small-hackathon/minicpm5-1b-indian-fmcg-normalizer) |
---
## Known Limitations & Biases
| Limitation | Impact | Mitigation |
|---|---|---|
| Fully synthetic — no real invoice images | May not capture real-world degradation (stains, folds, lighting) | Collect real invoices post-hackathon; add augmentation (blur, noise, shadows) |
| 10 suppliers only | Models may fail on invoices from unrepresented regional distributors | Expand supplier coverage after deployment |
| English-only product names and labels | Non-English invoices (Hindi, Tamil, Marathi) will fail | Add regional language templates |
| 200 SKUs | Out-of-catalog products will not normalize correctly | Expand catalog to 2,000+ SKUs |
| Rule-based typo augmentation | Real-world typos and OCR errors may differ from simulated patterns | Collect 200+ real invoice samples for retraining |
| GST rates hardcoded (0%, 5%, 12%, 18%, 28%) | Uncommon or product-specific rates may be misclassified | Parameterize rate extraction |
| Brand bias toward premium national brands | May underperform on regional / private-label products | Collect data from regional distributors |
---
### Load from HuggingFace Hub
```python
from datasets import load_dataset
import json
ds = load_dataset("build-small-hackathon/kirana-invoice-train-data")
sample = ds["train"][0]
image = sample["image"] # PIL Image — ready for model input
data = json.loads(sample["response"]) # parse the JSON string
print(data["supplier"])
print(data["line_items"])
```
---
## Citation
```bibtex
@misc{kirana_invoice_train_data_2026,
author = {Syed Naazim hussain},
title = {Kirana Invoice Training Data: Synthetic Indian FMCG Invoices for OCR and Product Normalization},
year = {2026},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/datasets/build-small-hackathon/kirana-invoice-train-data}},
note = {Part of the Kirana Detective project}
}
```
---
## License
**CC0 1.0 Universal (Public Domain Dedication)**
All data in this repository — synthetic invoice images, annotations, and the SKU catalog — is released to the public domain. No attribution required.
The generation scripts (`generate_invoices.py`, `build_catalog.py`) are licensed under MIT.
---
**Version**: 1.0
**Last Updated**: June 10, 2026