arnavgrao's picture
Upload LegalMetrologyDataset (ImageFolder + YOLO-OBB layout)
9308295 verified
|
Raw History Blame Contribute Delete
3.46 kB
metadata
license: mit
task_categories:
  - object-detection
language:
  - en
tags:
  - legal-metrology
  - ocr
  - obb
  - yolo
  - imagefolder
  - computer-vision
size_categories:
  - n<1K
configs:
  - config_name: default
    data_files:
      - split: train
        path: images/train/**
      - split: validation
        path: images/val/**

Legal Metrology Dataset

Annotated product packaging image dataset for detecting mandatory Legal Metrology declarations using Oriented Bounding Boxes (OBB) and axis-aligned bounding boxes.

Dataset Summary

  • Total images: 794 (.jpg)
  • Total annotations: 4,760 labeled regions across 9 classes
  • Splits: 80/20 deterministic split (seed=42)
    • train: 635 images, 3,799 annotations
    • validation (images/val / labels/val): 159 images, 961 annotations

Classes

ID Class Name Train Validation Total
0 CONSUMER_CARE 515 123 638
1 COUNTRY_OF_ORIGIN 119 40 159
2 EXPIRY_DATE 481 120 601
3 GENERIC_NAME 413 114 527
4 MANUFACTURER_DETAILS 494 118 612
5 MANUFACTURING_DATE 527 134 661
6 MRP_BLOCK 586 142 728
7 NET_QUANTITY 574 140 714
8 UNIT_SALE_PRICE 90 30 120

Repository Layout

.
├── .gitattributes
├── README.md
├── data.yaml                  # Ultralytics YOLO-OBB config
├── images/
│   ├── train/
│   │   ├── metadata.jsonl     # Hugging Face ImageFolder annotations
│   │   └── *.jpg              # 635 training images
│   └── val/
│       ├── metadata.jsonl     # Hugging Face ImageFolder annotations
│       └── *.jpg              # 159 validation images
└── labels/
    ├── train/
    │   └── *.txt              # 635 YOLO-OBB label files
    └── val/
        └── *.txt              # 159 YOLO-OBB label files

Annotation Formats

  • Hugging Face ImageFolder (images/*/metadata.jsonl):
    • file_name: image filename relative to the split directory
    • width, height: image dimensions in pixels
    • objects.bbox: axis-aligned COCO-style [x_min, y_min, width, height] in pixels
    • objects.categories: integer class IDs (0–8)
    • objects.category_names: string class names
    • objects.obb_polygons: normalized 4-point oriented bounding box polygons [x1, y1, x2, y2, x3, y3, x4, y4]
  • YOLO-OBB (labels/*/*.txt + data.yaml):
    • One annotation per line: <class_id> <x1> <y1> <x2> <y2> <x3> <y3> <x4> <y4> (normalized [0, 1] coordinates).

Usage

Hugging Face datasets

from datasets import load_dataset

ds = load_dataset("arnavgrao/LegalMetrologyDataset")

Ultralytics YOLO-OBB

yolo obb train data=data.yaml model=yolo11n-obb.pt imgsz=1024

Dataset Curators

Citation

@dataset{rao2026legalmetrology,
  author       = {Rao, Arnav G and Sardar, Kaninika and C A, Nidhi},
  title        = {Legal Metrology Dataset},
  year         = {2026},
  publisher    = {Hugging Face},
  howpublished = {\url{https://huggingface.co/datasets/arnavgrao/LegalMetrologyDataset}}
}