Datasets:
Modalities:
Image
Formats:
imagefolder
Languages:
English
Size:
10K - 100K
Tags:
agriculture
computer-vision
fruit-detection
instance-segmentation
precision-agriculture
ripeness-assessment
License:
| license: mit | |
| task_categories: | |
| - object-detection | |
| - image-segmentation | |
| - image-classification | |
| language: | |
| - en | |
| tags: | |
| - agriculture | |
| - computer-vision | |
| - fruit-detection | |
| - instance-segmentation | |
| - precision-agriculture | |
| - ripeness-assessment | |
| - agricultural-robotics | |
| size_categories: | |
| - 1K<n<10K | |
| # SmartHarvest: Multi-Species Fruit Ripeness Detection Dataset | |
| ## Dataset Description | |
| **SmartHarvest** is a comprehensive multi-species fruit ripeness detection and segmentation dataset designed for precision agriculture applications. The dataset contains high-resolution images of fruits in natural garden environments with detailed polygon-based instance segmentation annotations and ripeness classifications. | |
| ### Key Features | |
| - **8 fruit species**: Apple, cherry, cucumber, strawberry, tomato, plum, raspberry, pepper | |
| - **Multi-class ripeness**: Ripe, unripe, spoiled, plus obscured category | |
| - **Instance segmentation**: Polygon annotations with 3-126 vertices per instance | |
| - **Real-world conditions**: Natural lighting, occlusion, and clustering challenges | |
| - **Expert validation**: Agricultural specialist annotation review and quality control | |
| ### Dataset Statistics | |
| - **Total images**: 486 high-resolution images | |
| - **Total annotations**: 6,984 individual fruit instances | |
| - **Average annotations per image**: 14.4 instances | |
| - **Polygon complexity**: 14.1 ± 9.8 vertices per annotation | |
| - **Occlusion coverage**: 53.8% partially obscured instances | |
| - **Image resolution**: Resized and padded to 1200×1200 pixels | |
| ## Supported Tasks | |
| ### Primary Tasks | |
| - **Object Detection**: Fruit localization with species and ripeness classification | |
| - **Instance Segmentation**: Pixel-level fruit boundary delineation | |
| - **Multi-class Classification**: Combined species and ripeness state prediction | |
| ### Agricultural Applications | |
| - **Robotic Harvesting**: Automated fruit picking with quality assessment | |
| - **Yield Prediction**: Crop monitoring and harvest optimization | |
| - **Quality Control**: Post-harvest sorting and grading | |
| - **Precision Agriculture**: Species-specific crop management | |
| ## Dataset Structure | |
| ### Data Fields | |
| Each sample contains: | |
| ```python | |
| { | |
| 'image': PIL.Image, # Original fruit image | |
| 'image_id': int, # Unique image identifier | |
| 'annotations': [ | |
| { | |
| 'id': int, # Unique annotation ID | |
| 'category_id': int, # Species-ripeness category | |
| 'species': str, # Fruit species name | |
| 'ripeness': str, # Ripeness state | |
| 'bbox': [x, y, width, height], # Bounding box coordinates | |
| 'segmentation': [[x1,y1, ...]], # Polygon vertices | |
| 'area': float, # Annotation area in pixels² | |
| 'iscrowd': bool, # Multiple objects flag | |
| 'visibility': str # Occlusion status | |
| } | |
| ], | |
| 'metadata': { | |
| 'source': str, # Image source information | |
| 'capture_conditions': str, # Lighting and environment | |
| 'quality_score': float # Annotation quality metric | |
| } | |
| } | |
| ``` | |
| ### Category Mapping | |
| | Category ID | Species | Ripeness | Description | | |
| |-------------|---------|-----------|-------------| | |
| | 0 | background | - | Background class | | |
| | 1 | apple | unripe | Green/immature apples | | |
| | 2 | apple | ripe | Harvest-ready apples | | |
| | 3 | apple | spoiled | Overripe/damaged apples | | |
| | 4 | cherry | unripe | Immature cherries | | |
| | 5 | cherry | ripe | Harvest-ready cherries | | |
| | 6 | cherry | spoiled | Overripe cherries | | |
| | 7 | cucumber | unripe | Small/immature cucumbers | | |
| | 8 | cucumber | ripe | Harvest-ready cucumbers | | |
| | 9 | cucumber | spoiled | Overripe cucumbers | | |
| | 10 | strawberry | unripe | White/green strawberries | | |
| | 11 | strawberry | ripe | Red strawberries | | |
| | 12 | strawberry | spoiled | Overripe strawberries | | |
| | 13 | tomato | unripe | Green tomatoes | | |
| | 14 | tomato | ripe | Red tomatoes | | |
| | 15 | tomato | spoiled | Overripe tomatoes | | |
| *Additional species (plums, raspberries, peppers) in development* | |
| ## Dataset Splits | |
| ### Current Distribution | |
| - **Total**: 486 images with 6,984 annotations | |
| - **Apple subset**: 98 images, 2,582 annotations | |
| - **Cherry subset**: 86 images, 969 annotations | |
| - **Tomato subset**: 94 images, 1,572 annotations | |
| - **Strawberry subset**: 111 images, 1,397 annotations | |
| - **Cucumber subset**: 97 images, 464 annotations | |
| ### Recommended Splits | |
| For reproducible experiments, we recommend: | |
| - **Training**: 80% (389 images) | |
| - **Validation**: 20% (97 images) | |
| - **Stratification**: Balanced across species and ripeness states | |
| ## Data Collection and Annotation | |
| ### Collection Methodology | |
| - **Sources**: Natural garden environments, orchard partnerships | |
| - **Geographic coverage**: Multiple growing regions to reduce bias | |
| - **Temporal coverage**: Different seasons and growth stages | |
| - **Lighting conditions**: Natural outdoor lighting with time-of-day variation | |
| - **Image quality**: High-resolution captures with professional equipment | |
| ### Annotation Protocol | |
| - **Tool**: VGG Image Annotator (VIA) with custom configuration | |
| - **Annotators**: Trained computer vision researchers with agricultural consultation | |
| - **Quality control**: 25% overlap for inter-annotator agreement (κ > 0.85) | |
| - **Expert review**: 10% agricultural specialist validation | |
| - **Polygon precision**: Minimum 8 vertices, detailed boundary delineation | |
| ### Species-Specific Criteria | |
| #### Color-Based Ripeness (Apples, Tomatoes, Cherries, Peppers) | |
| - **Ripe**: >75% characteristic color coverage | |
| - **Unripe**: <25% color development | |
| - **Spoiled**: Brown/black discoloration, visible mold | |
| #### Size-Based Ripeness (Cucumbers, Pears) | |
| - **Ripe**: 80-100% of variety-specific size range | |
| - **Unripe**: <80% expected size | |
| - **Spoiled**: Yellowing, soft spots, wrinkled skin | |
| #### Texture-Based Ripeness (Strawberries, Raspberries) | |
| - **Ripe**: Uniform color, firm but yielding texture | |
| - **Unripe**: White/green areas, hard texture | |
| - **Spoiled**: Soft spots, mold, collapsed structure | |
| ## Usage Examples | |
| ### Loading the Dataset | |
| ```python | |
| from datasets import load_dataset | |
| # Load complete dataset | |
| dataset = load_dataset("TheCoffeeAddict/SmartHarvest") | |
| # Load specific split | |
| train_data = load_dataset("TheCoffeeAddict/SmartHarvest", split="train") | |
| # Access sample | |
| sample = dataset['train'][0] | |
| image = sample['image'] | |
| annotations = sample['annotations'] | |
| ``` | |
| ### PyTorch Integration | |
| ```python | |
| import torch | |
| from torch.utils.data import Dataset | |
| from torchvision import transforms | |
| from datasets import load_dataset | |
| class SmartHarvestDataset(Dataset): | |
| def __init__(self, split="train", transform=None): | |
| self.dataset = load_dataset("TheCoffeeAddict/SmartHarvest", split=split) | |
| self.transform = transform | |
| def __len__(self): | |
| return len(self.dataset) | |
| def __getitem__(self, idx): | |
| sample = self.dataset[idx] | |
| image = sample['image'] | |
| target = { | |
| 'boxes': torch.tensor(sample['bboxes']), | |
| 'labels': torch.tensor(sample['labels']), | |
| 'masks': torch.tensor(sample['masks']) | |
| } | |
| if self.transform: | |
| image = self.transform(image) | |
| return image, target | |
| # Usage | |
| transform = transforms.Compose([ | |
| transforms.Resize((800, 800)), | |
| transforms.ToTensor(), | |
| ]) | |
| dataset = SmartHarvestDataset(split="train", transform=transform) | |
| ``` | |
| ### Data Visualization | |
| ```python | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| def visualize_sample(sample): | |
| image = sample['image'] | |
| annotations = sample['annotations'] | |
| fig, ax = plt.subplots(1, 1, figsize=(12, 8)) | |
| ax.imshow(image) | |
| for ann in annotations: | |
| # Draw bounding box | |
| x, y, w, h = ann['bbox'] | |
| rect = plt.Rectangle((x, y), w, h, fill=False, color='red', linewidth=2) | |
| ax.add_patch(rect) | |
| # Add label | |
| species = ann['species'] | |
| ripeness = ann['ripeness'] | |
| ax.text(x, y-5, f"{species}-{ripeness}", color='red', fontsize=10) | |
| ax.set_title("SmartHarvest Sample Annotation") | |
| plt.show() | |
| # Visualize first sample | |
| sample = dataset['train'][0] | |
| visualize_sample(sample) | |
| ``` | |
| ## Baseline Results | |
| ### Model Performance (Apple-Cherry Subset) | |
| Trained Mask R-CNN with ResNet-50 backbone: | |
| | Metric | Value | Description | | |
| |--------|-------|-------------| | |
| | **AP@0.5** | **22.49%** | Average precision at IoU=0.5 | | |
| | **AP@0.75** | **7.98%** | Average precision at IoU=0.75 | | |
| | **COCO mAP** | **60.63%** | Mean AP across IoU 0.5-0.95 | | |
| ### Per-Class Performance | |
| | Class | AP@0.5 | Notes | | |
| |-------|--------|--------| | |
| | Apple-Ripe | 10.45% | Challenging due to color variation | | |
| | Apple-Unripe | 25.00% | Better defined characteristics | | |
| | Apple-Spoiled | **32.60%** | Distinctive visual features | | |
| | Cherry-Ripe | 18.20% | Small size challenges | | |
| | Cherry-Unripe | 17.10% | Consistent with apple pattern | | |
| | Cherry-Spoiled | **31.56%** | Best performance per species | | |
| *Code available at: https://github.com/Maksim3l/SmartHarvest* | |
| ## Considerations for Use | |
| ### Strengths | |
| - **Real-world applicability**: Natural garden conditions with authentic challenges | |
| - **Multi-species coverage**: Broad agricultural applicability | |
| - **Expert validation**: Agricultural specialist involvement in annotation | |
| - **Detailed annotations**: Polygon-level segmentation for precise localization | |
| - **Ripeness granularity**: Practical quality assessment categories | |
| ### Limitations | |
| - **Geographic bias**: Limited to specific growing regions | |
| - **Seasonal bias**: Collection timing affects ripeness distribution | |
| - **Equipment bias**: Single camera system characteristics | |
| - **Scale limitations**: Limited images per species for production deployment | |
| - **Class imbalance**: Varying representation across ripeness states | |
| ### Recommended Applications | |
| - **Research benchmarking**: Computer vision method evaluation | |
| - **Algorithm development**: Detection and segmentation model training | |
| - **Educational use**: Agricultural computer vision teaching | |
| - **Prototype development**: Proof-of-concept agricultural systems | |
| ### Usage Considerations | |
| - **Data augmentation**: Recommended for training robustness | |
| - **Cross-validation**: Stratified splits to maintain species balance | |
| - **Evaluation metrics**: Use agricultural-relevant metrics beyond standard CV measures | |
| - **Deployment testing**: Validate on target agricultural environments | |
| ## Ethical Considerations | |
| ### Data Privacy | |
| - **Image sources**: Publicly available images or consent-obtained private collections | |
| - **Location privacy**: No GPS coordinates or specific farm identifiers included | |
| - **Farmer consent**: Proper permissions obtained for orchard data collection | |
| ### Bias and Fairness | |
| - **Geographic diversity**: Active efforts to include multiple growing regions | |
| - **Seasonal representation**: Multiple collection periods to reduce temporal bias | |
| - **Equipment standardization**: Documentation of capture conditions for bias awareness | |
| ### Environmental Impact | |
| - **Sustainable agriculture**: Supporting precision farming for reduced resource use | |
| - **Technology access**: Open-source approach for global accessibility | |
| - **Local adaptation**: Encouragement of regional dataset development | |
| ## Citation | |
| If you use this dataset in your research, please cite: | |
| ```bibtex | |
| @inproceedings{loknar2025comprehensive, | |
| title={Comprehensive Multi-Species Fruit Ripeness Dataset Construction: From Eight-Species Collection to Focused Apple-Cherry Detection}, | |
| author={Loknar, Maksim and Mlakar, Uroš}, | |
| booktitle={Student Computing Research Symposium}, | |
| year={2025}, | |
| organization={University of Maribor}, | |
| url={https://huggingface.co/datasets/TheCoffeeAddict/SmartHarvest} | |
| } | |
| ``` | |
| ## Dataset Card Contact | |
| **Authors**: Maksim Loknar, Uroš Mlakar | |
| **Institution**: Faculty of Electrical Engineering and Computer Science, University of Maribor, Slovenia | |
| **Email**: maksim.loknar@student.um.si, uros.mlakar@um.si | |
| **Project Page**: https://github.com/Maksim3l/SmartHarvest | |
| For questions about dataset usage, additional species requests, or collaboration opportunities, please open an issue in the GitHub repository or contact the authors directly. |