Datasets:
The dataset viewer is not available for this split.
Error code: TooBigContentError
Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
A Image Dataset of Pre-Roast Robusta Coffee Beans with Polygon Annotations for Automated Grading
Abstract
Automated quality assessment of raw agricultural products is critical for ensuring fair trade and supply chain efficiency. This dataset presents 3,877 high-resolution images of pre-roast Arabica coffee beans, collected from farms in **Coorg, Karnataka (India)**—a major coffee-producing region. Each bean is categorized into one of four quality grades:
| Grade | Description |
|---|---|
| A | Premium |
| B | Good |
| C | Standard |
| D | Defective |
A total of 2,284 beans are annotated using polygon masks and grade labels in LabelMe JSON format, supporting research in classification, instance segmentation, automated grading, and defect detection. A YOLOv11 multi-class instance segmentation baseline was trained to validate annotation quality and demonstrate practical model performance.
Dataset Structure
/
├── CGA/ # Grade A (Premium)
│ ├── CGA_images/
│ └── CGA_json/
├── CGB/ # Grade B (Good)
├── CGC/ # Grade C (Standard)
└── CGD/ # Grade D (Defective)
Distribution Summary
| Grade | Quality | Images | Polygon Annotations |
|---|---|---|---|
| A | Premium | 1000 | 600 |
| B | Good | 1000 | 600 |
| C | Standard | 1002 | 487 |
| D | Defective | 875 | 597 |
| Total | — | 3,877 | 2,284 |
Data Collection and Annotation
| Attribute | Details |
|---|---|
| Coffee Variety | Coffea robusta |
| Region | Coorg (Kodagu), Karnataka, India |
| Imaging Setup | Controlled indoor lighting with a white backdrop |
| Devices Used | iPhone 15 Pro, Samsung 2023/24 models, Google Pixel 7, Poco X Series |
| Annotation Tool | LabelMe (Polygon Mode) |
| Data Format | .jpg images + .json polygon annotation files |
Each annotation file contains:
"label": "grade_a" | "grade_b" | "grade_c" | "grade_d""points": [ [x1,y1], [x2,y2], ... ]
Annotations were reviewed by trained annotators to ensure precision.
Recommended Use Cases
- Multi-class instance segmentation training
- Automated grading and sorting systems
- Agricultural defect detection research
- Food quality assurance studies
- Robust low-cost supply chain inspection systems
Out-of-Scope Use
- Personal identification
- Medical or biometric inference (dataset contains no personal data)
Baseline Experiment (YOLOv11 Segmentation)
To validate the dataset's quality and visual separability, a baseline instance segmentation model (YOLOv11) was trained. The model was trained for 150 epochs, with the best-performing checkpoint saved for evaluation.
The results confirm that the dataset supports strong performance for automated grading, achieving a mean Average Precision (mAP) of 0.93 for object detection and 0.91 for instance segmentation.
Final Metrics (from best.pt model)
| Metric | Grade A | Grade B | Grade C | Grade D | Mean (All Classes) |
|---|---|---|---|---|---|
| Box mAP@0.5 | 0.94 | 0.90 | 0.91 | 0.97 | 0.93 |
| Mask mAP@0.5 | 0.92 | 0.88 | 0.88 | 0.96 | 0.91 |
Note: The high precision on Grade D (Defective) is particularly valuable, as it demonstrates the model's reliability in identifying and sorting out low-quality beans, which is a primary goal of automated grading systems.
How to Use
Load JSON Annotation Example
import json
import glob
# Example for Grade A
files = glob.glob("CGA/CGA_json/*.json")
with open(files[0], "r") as f:
ann = json.load(f)
print(ann["shapes"][0]["points"]) # Polygon coordinates
print(ann["shapes"][0]["label"]) # Grade label
Value of the Dataset
- First publicly available polygon-annotated dataset of pre-roast coffee beans.
- Enables end-to-end automated grading using segmentation + classification.
- Facilitates fair pricing and quality transparency in the coffee supply chain.
- Robust for deployment in low-cost rural environments using consumer smartphones.
Contributors
| Name | ORCID | Role |
|---|---|---|
| Samruddh K | 0009-0008-3588-9272 | Research, Dataset Preparation & Documentation |
| Abhay Varun S | 0009-0003-1299-724X | Research, Dataset Collection & Annotation |
| Bopanna K N | 0009-0008-0432-3196 | Annotation Support & Verification |
| H A Dheemanth Gowda | 0009-0001-1891-632X | Annotation Support & Verification |
Citation
If you use this dataset, please cite:
@dataset{pre_roast_coffee_grading_2025, title = {A Image Dataset of Pre-Roast Arabica Coffee Beans with Polygon Annotations for Automated Grading}, author = {Samruddh K and Bopanna K N and H A Dheemanth Gowda and Abhay Varun S}, year = {2025}, publisher = {Hugging Face Datasets}, license = {MIT}, url = {https://huggingface.co/datasets/SamruddhK/coffee-bean-grading-dataset} }
Contact
For questions, collaborations, or research use:
- Dataset Maintainer: Samruddh K & Abhay Varun S
- Hugging Face: https://huggingface.co/SamruddhK
- GitHub Samruddh K: https://github.com/SAMRUDDH15
- GitHub Abhay Varun S: https://github.com/abhay-error
- Email: [samruddh.k52@gmail.com & Abhayvarun618@gmail.com]
- Downloads last month
- 5