Datasets:

Modalities:
Image
Text
Formats:
parquet
Size:
< 1K
ArXiv:
Libraries:
Datasets
pandas
License:
Dataset Viewer
Auto-converted to Parquet Duplicate
image
imagewidth (px)
1.28k
1.28k
labels
sequencelengths
19
36
image_id
stringlengths
6
6
[ [ 2, 0.284375, 0.20375, 0.283594, 0.205, 0.282813, 0.205, 0.282031, 0.20625, 0.28125, 0.20625, 0.280469, 0.20625, 0.279687, 0.20625, 0.278906, 0.20625, 0.278125, 0.2075, 0.277344, 0.20875, 0.276562, 0.21, 0.276562, 0...
img001
[[2.0,0.519531,0.7475,0.507812,0.7625,0.507031,0.7675,0.500781,0.77875,0.496094,0.8175,0.497656,0.83(...TRUNCATED)
img002
[[2.0,0.223438,0.4475,0.223438,0.46125,0.228125,0.48875,0.236719,0.50375,0.250781,0.53625,0.267969,0(...TRUNCATED)
img003
[[2.0,0.671094,0.53875,0.671094,0.54,0.670312,0.54125,0.669531,0.5425,0.66875,0.5425,0.667969,0.5425(...TRUNCATED)
img004
[[1.0,0.19375,0.2425,0.18125,0.25875,0.170313,0.29125,0.172656,0.30875,0.184375,0.3425,0.19375,0.358(...TRUNCATED)
img005
[[5.0,0.69375,0.205,0.66875,0.1975,0.658594,0.1975,0.634375,0.205,0.625781,0.21125,0.620313,0.21875,(...TRUNCATED)
img006
[[2.0,0.707812,0.13375,0.707031,0.135,0.70625,0.13625,0.705469,0.1375,0.704688,0.1375,0.703906,0.137(...TRUNCATED)
img007
[[2.0,0.266406,0.59875,0.265625,0.6,0.264844,0.6,0.264062,0.6,0.263281,0.60125,0.2625,0.6025,0.26171(...TRUNCATED)
img008
[[1.0,0.530469,0.16625,0.529687,0.1675,0.528906,0.1675,0.528125,0.16875,0.527344,0.16875,0.526563,0.(...TRUNCATED)
img009
[[1.0,0.728125,0.445,0.727344,0.44625,0.726562,0.4475,0.725781,0.44875,0.725,0.45,0.724219,0.45,0.72(...TRUNCATED)
img010
End of preview. Expand in Data Studio

πŸ“ The RaspGrade Dataset: Towards Automatic Raspberry Ripeness Grading with Deep Learning

This research investigates the application of computer vision for rapid, accurate, and non-invasive food quality assessment, focusing on the novel challenge of real-time raspberry grading into five distinct classes within an industrial environment as the fruits move along a conveyor belt. To address this, a dedicated dataset of raspberries, namely RaspGrade, was acquired and meticulously annotated.

Instance segmentation experiments revealed that accurate fruit-level masks can be obtained; however, the classification of certain raspberry grades presents challenges due to color similarities and occlusion, while others are more readily distinguishable based on color.

πŸ€— Paper on Hugging Face | πŸ“ Paper on ArXiv

πŸ—‚οΈ Data Instances

Raspberry Example 1 Raspberry Example 2

🏷️ Annotation Format

Note that the annotations follow the YOLO instance segmentation format.

Please refer to this page for more info.

πŸ§ͺ How to read and display examples

from datasets import load_dataset
from PIL import Image, ImageDraw
import numpy as np
import random

# --- Configuration ---
DATASET_NAME = "FBK-TeV/RaspGrade"
SAMPLE_INDEX = 0  # Index of the sample to visualize from the 'valid' split
OUTPUT_IMAGE = 'annotated_hub_image_fixed_colors.png'
ALPHA = 128  # Transparency level for masks

# Define a color map for different classes
CLASS_COLORS = {
    0: (255, 0, 0, ALPHA),    # Red
    1: (0, 255, 0, ALPHA),    # Green
    2: (0, 0, 255, ALPHA),    # Blue
    3: (255, 255, 0, ALPHA),  # Yellow
    4: (255, 0, 255, ALPHA)   # Magenta
    # Add more colors for other class IDs if needed
}

def convert_normalized_polygon_to_pixels(polygon_normalized, width, height):
    polygon_pixels = (np.array(polygon_normalized).reshape(-1, 2) * np.array([width, height])).astype(int).flatten().tolist()
    return polygon_pixels

if __name__ == "__main__":
    try:
        dataset = load_dataset(DATASET_NAME)
        if 'valid' not in dataset:
            raise ValueError(f"Split 'valid' not found in dataset '{DATASET_NAME}'")
        valid_dataset = dataset['valid']
        if SAMPLE_INDEX >= len(valid_dataset):
            raise ValueError(f"Sample index {SAMPLE_INDEX} is out of bounds for the 'valid' split (size: {len(valid_dataset)})")

        sample = valid_dataset[SAMPLE_INDEX]
        original_image = sample['image'].convert("RGBA")
        width, height = original_image.size

        mask = Image.new('RGBA', (width, height), (0, 0, 0, 0))
        mask_draw = ImageDraw.Draw(mask, 'RGBA')

        labels = sample['labels']
        if isinstance(labels, list):
            for annotation in labels:
                if len(annotation) > 4:  # Assuming YOLO format includes class and polygon
                    class_id = int(annotation[0])
                    polygon_normalized = np.array(annotation[1:]).astype(float).reshape(-1, 2).flatten().tolist()
                    polygon_pixels = convert_normalized_polygon_to_pixels(polygon_normalized, width, height)
                    color = CLASS_COLORS.get(class_id, (255, 255, 255, ALPHA)) # Default to white if class_id not in map
                    mask_draw.polygon(polygon_pixels, fill=color)

        annotated_image = Image.alpha_composite(original_image, mask)

        annotated_image.save(OUTPUT_IMAGE)
        print(f"Annotated image with fixed colors saved as {OUTPUT_IMAGE}")
        annotated_image.show()

    except Exception as e:
        print(f"An error occurred: {e}")

πŸ™ Acknowledgement

AGILEHAND logo

This work is supported by European Union’s Horizon Europe research and innovation programme under grant agreement No 101092043, project AGILEHAND (Smart Grading, Handling and Packaging Solutions for Soft and Deformable Products in Agile and Reconfigurable Lines.

🀝 Partners

FBK logo Santorsola logo

πŸ“– Citation

@article{mekhalfi2025raspgrade,
  title={The RaspGrade Dataset: Towards Automatic Raspberry Ripeness Grading with Deep Learning},
  author={Mekhalfi, Mohamed Lamine and Chippendale, Paul and Poiesi, Fabio and Bonecher, Samuele and Osler, Gilberto and Zancanella, Nicola},
  journal={arXiv preprint arXiv:2505.08537},
  year={2025}
}
Downloads last month
502

Paper for FBK-TeV/RaspGrade