TheCoffeeAddict commited on
Commit
38a8dcf
·
verified ·
1 Parent(s): 264d927

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +340 -3
README.md CHANGED
@@ -1,3 +1,340 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ task_categories:
4
+ - object-detection
5
+ - image-segmentation
6
+ - image-classification
7
+ language:
8
+ - en
9
+ tags:
10
+ - agriculture
11
+ - computer-vision
12
+ - fruit-detection
13
+ - instance-segmentation
14
+ - precision-agriculture
15
+ - ripeness-assessment
16
+ - agricultural-robotics
17
+ size_categories:
18
+ - 1K<n<10K
19
+ ---
20
+
21
+ # SmartHarvest: Multi-Species Fruit Ripeness Detection Dataset
22
+
23
+ ## Dataset Description
24
+
25
+ **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.
26
+
27
+ ### Key Features
28
+ - **8 fruit species**: Apple, cherry, cucumber, strawberry, tomato, plum, raspberry, pepper
29
+ - **Multi-class ripeness**: Ripe, unripe, spoiled, plus obscured category
30
+ - **Instance segmentation**: Polygon annotations with 3-126 vertices per instance
31
+ - **Real-world conditions**: Natural lighting, occlusion, and clustering challenges
32
+ - **Expert validation**: Agricultural specialist annotation review and quality control
33
+
34
+ ### Dataset Statistics
35
+ - **Total images**: 486 high-resolution images
36
+ - **Total annotations**: 6,984 individual fruit instances
37
+ - **Average annotations per image**: 14.4 instances
38
+ - **Polygon complexity**: 14.1 ± 9.8 vertices per annotation
39
+ - **Occlusion coverage**: 53.8% partially obscured instances
40
+ - **Image resolution**: Resized and padded to 1200×1200 pixels
41
+
42
+ ## Supported Tasks
43
+
44
+ ### Primary Tasks
45
+ - **Object Detection**: Fruit localization with species and ripeness classification
46
+ - **Instance Segmentation**: Pixel-level fruit boundary delineation
47
+ - **Multi-class Classification**: Combined species and ripeness state prediction
48
+
49
+ ### Agricultural Applications
50
+ - **Robotic Harvesting**: Automated fruit picking with quality assessment
51
+ - **Yield Prediction**: Crop monitoring and harvest optimization
52
+ - **Quality Control**: Post-harvest sorting and grading
53
+ - **Precision Agriculture**: Species-specific crop management
54
+
55
+ ## Dataset Structure
56
+
57
+ ### Data Fields
58
+
59
+ Each sample contains:
60
+
61
+ ```python
62
+ {
63
+ 'image': PIL.Image, # Original fruit image
64
+ 'image_id': int, # Unique image identifier
65
+ 'annotations': [
66
+ {
67
+ 'id': int, # Unique annotation ID
68
+ 'category_id': int, # Species-ripeness category
69
+ 'species': str, # Fruit species name
70
+ 'ripeness': str, # Ripeness state
71
+ 'bbox': [x, y, width, height], # Bounding box coordinates
72
+ 'segmentation': [[x1,y1, ...]], # Polygon vertices
73
+ 'area': float, # Annotation area in pixels²
74
+ 'iscrowd': bool, # Multiple objects flag
75
+ 'visibility': str # Occlusion status
76
+ }
77
+ ],
78
+ 'metadata': {
79
+ 'source': str, # Image source information
80
+ 'capture_conditions': str, # Lighting and environment
81
+ 'quality_score': float # Annotation quality metric
82
+ }
83
+ }
84
+ ```
85
+
86
+ ### Category Mapping
87
+
88
+ | Category ID | Species | Ripeness | Description |
89
+ |-------------|---------|-----------|-------------|
90
+ | 0 | background | - | Background class |
91
+ | 1 | apple | unripe | Green/immature apples |
92
+ | 2 | apple | ripe | Harvest-ready apples |
93
+ | 3 | apple | spoiled | Overripe/damaged apples |
94
+ | 4 | cherry | unripe | Immature cherries |
95
+ | 5 | cherry | ripe | Harvest-ready cherries |
96
+ | 6 | cherry | spoiled | Overripe cherries |
97
+ | 7 | cucumber | unripe | Small/immature cucumbers |
98
+ | 8 | cucumber | ripe | Harvest-ready cucumbers |
99
+ | 9 | cucumber | spoiled | Overripe cucumbers |
100
+ | 10 | strawberry | unripe | White/green strawberries |
101
+ | 11 | strawberry | ripe | Red strawberries |
102
+ | 12 | strawberry | spoiled | Overripe strawberries |
103
+ | 13 | tomato | unripe | Green tomatoes |
104
+ | 14 | tomato | ripe | Red tomatoes |
105
+ | 15 | tomato | spoiled | Overripe tomatoes |
106
+
107
+ *Additional species (plums, raspberries, peppers) in development*
108
+
109
+ ## Dataset Splits
110
+
111
+ ### Current Distribution
112
+ - **Total**: 486 images with 6,984 annotations
113
+ - **Apple subset**: 98 images, 2,582 annotations
114
+ - **Cherry subset**: 86 images, 969 annotations
115
+ - **Tomato subset**: 94 images, 1,572 annotations
116
+ - **Strawberry subset**: 111 images, 1,397 annotations
117
+ - **Cucumber subset**: 97 images, 464 annotations
118
+
119
+ ### Recommended Splits
120
+ For reproducible experiments, we recommend:
121
+ - **Training**: 80% (389 images)
122
+ - **Validation**: 20% (97 images)
123
+ - **Stratification**: Balanced across species and ripeness states
124
+
125
+ ## Data Collection and Annotation
126
+
127
+ ### Collection Methodology
128
+ - **Sources**: Natural garden environments, orchard partnerships
129
+ - **Geographic coverage**: Multiple growing regions to reduce bias
130
+ - **Temporal coverage**: Different seasons and growth stages
131
+ - **Lighting conditions**: Natural outdoor lighting with time-of-day variation
132
+ - **Image quality**: High-resolution captures with professional equipment
133
+
134
+ ### Annotation Protocol
135
+ - **Tool**: VGG Image Annotator (VIA) with custom configuration
136
+ - **Annotators**: Trained computer vision researchers with agricultural consultation
137
+ - **Quality control**: 25% overlap for inter-annotator agreement (κ > 0.85)
138
+ - **Expert review**: 10% agricultural specialist validation
139
+ - **Polygon precision**: Minimum 8 vertices, detailed boundary delineation
140
+
141
+ ### Species-Specific Criteria
142
+
143
+ #### Color-Based Ripeness (Apples, Tomatoes, Cherries, Peppers)
144
+ - **Ripe**: >75% characteristic color coverage
145
+ - **Unripe**: <25% color development
146
+ - **Spoiled**: Brown/black discoloration, visible mold
147
+
148
+ #### Size-Based Ripeness (Cucumbers, Pears)
149
+ - **Ripe**: 80-100% of variety-specific size range
150
+ - **Unripe**: <80% expected size
151
+ - **Spoiled**: Yellowing, soft spots, wrinkled skin
152
+
153
+ #### Texture-Based Ripeness (Strawberries, Raspberries)
154
+ - **Ripe**: Uniform color, firm but yielding texture
155
+ - **Unripe**: White/green areas, hard texture
156
+ - **Spoiled**: Soft spots, mold, collapsed structure
157
+
158
+ ## Usage Examples
159
+
160
+ ### Loading the Dataset
161
+
162
+ ```python
163
+ from datasets import load_dataset
164
+
165
+ # Load complete dataset
166
+ dataset = load_dataset("TheCoffeeAddict/SmartHarvest")
167
+
168
+ # Load specific split
169
+ train_data = load_dataset("TheCoffeeAddict/SmartHarvest", split="train")
170
+
171
+ # Access sample
172
+ sample = dataset['train'][0]
173
+ image = sample['image']
174
+ annotations = sample['annotations']
175
+ ```
176
+
177
+ ### PyTorch Integration
178
+
179
+ ```python
180
+ import torch
181
+ from torch.utils.data import Dataset
182
+ from torchvision import transforms
183
+ from datasets import load_dataset
184
+
185
+ class SmartHarvestDataset(Dataset):
186
+ def __init__(self, split="train", transform=None):
187
+ self.dataset = load_dataset("TheCoffeeAddict/SmartHarvest", split=split)
188
+ self.transform = transform
189
+
190
+ def __len__(self):
191
+ return len(self.dataset)
192
+
193
+ def __getitem__(self, idx):
194
+ sample = self.dataset[idx]
195
+ image = sample['image']
196
+ target = {
197
+ 'boxes': torch.tensor(sample['bboxes']),
198
+ 'labels': torch.tensor(sample['labels']),
199
+ 'masks': torch.tensor(sample['masks'])
200
+ }
201
+
202
+ if self.transform:
203
+ image = self.transform(image)
204
+
205
+ return image, target
206
+
207
+ # Usage
208
+ transform = transforms.Compose([
209
+ transforms.Resize((800, 800)),
210
+ transforms.ToTensor(),
211
+ ])
212
+
213
+ dataset = SmartHarvestDataset(split="train", transform=transform)
214
+ ```
215
+
216
+ ### Data Visualization
217
+
218
+ ```python
219
+ import matplotlib.pyplot as plt
220
+ import numpy as np
221
+
222
+ def visualize_sample(sample):
223
+ image = sample['image']
224
+ annotations = sample['annotations']
225
+
226
+ fig, ax = plt.subplots(1, 1, figsize=(12, 8))
227
+ ax.imshow(image)
228
+
229
+ for ann in annotations:
230
+ # Draw bounding box
231
+ x, y, w, h = ann['bbox']
232
+ rect = plt.Rectangle((x, y), w, h, fill=False, color='red', linewidth=2)
233
+ ax.add_patch(rect)
234
+
235
+ # Add label
236
+ species = ann['species']
237
+ ripeness = ann['ripeness']
238
+ ax.text(x, y-5, f"{species}-{ripeness}", color='red', fontsize=10)
239
+
240
+ ax.set_title("SmartHarvest Sample Annotation")
241
+ plt.show()
242
+
243
+ # Visualize first sample
244
+ sample = dataset['train'][0]
245
+ visualize_sample(sample)
246
+ ```
247
+
248
+ ## Baseline Results
249
+
250
+ ### Model Performance (Apple-Cherry Subset)
251
+
252
+ Trained Mask R-CNN with ResNet-50 backbone:
253
+
254
+ | Metric | Value | Description |
255
+ |--------|-------|-------------|
256
+ | **AP@0.5** | **22.49%** | Average precision at IoU=0.5 |
257
+ | **AP@0.75** | **7.98%** | Average precision at IoU=0.75 |
258
+ | **COCO mAP** | **60.63%** | Mean AP across IoU 0.5-0.95 |
259
+
260
+ ### Per-Class Performance
261
+
262
+ | Class | AP@0.5 | Notes |
263
+ |-------|--------|--------|
264
+ | Apple-Ripe | 10.45% | Challenging due to color variation |
265
+ | Apple-Unripe | 25.00% | Better defined characteristics |
266
+ | Apple-Spoiled | **32.60%** | Distinctive visual features |
267
+ | Cherry-Ripe | 18.20% | Small size challenges |
268
+ | Cherry-Unripe | 17.10% | Consistent with apple pattern |
269
+ | Cherry-Spoiled | **31.56%** | Best performance per species |
270
+
271
+ *Code available at: https://github.com/Maksim3l/SmartHarvest*
272
+
273
+ ## Considerations for Use
274
+
275
+ ### Strengths
276
+ - **Real-world applicability**: Natural garden conditions with authentic challenges
277
+ - **Multi-species coverage**: Broad agricultural applicability
278
+ - **Expert validation**: Agricultural specialist involvement in annotation
279
+ - **Detailed annotations**: Polygon-level segmentation for precise localization
280
+ - **Ripeness granularity**: Practical quality assessment categories
281
+
282
+ ### Limitations
283
+ - **Geographic bias**: Limited to specific growing regions
284
+ - **Seasonal bias**: Collection timing affects ripeness distribution
285
+ - **Equipment bias**: Single camera system characteristics
286
+ - **Scale limitations**: Limited images per species for production deployment
287
+ - **Class imbalance**: Varying representation across ripeness states
288
+
289
+ ### Recommended Applications
290
+ - **Research benchmarking**: Computer vision method evaluation
291
+ - **Algorithm development**: Detection and segmentation model training
292
+ - **Educational use**: Agricultural computer vision teaching
293
+ - **Prototype development**: Proof-of-concept agricultural systems
294
+
295
+ ### Usage Considerations
296
+ - **Data augmentation**: Recommended for training robustness
297
+ - **Cross-validation**: Stratified splits to maintain species balance
298
+ - **Evaluation metrics**: Use agricultural-relevant metrics beyond standard CV measures
299
+ - **Deployment testing**: Validate on target agricultural environments
300
+
301
+ ## Ethical Considerations
302
+
303
+ ### Data Privacy
304
+ - **Image sources**: Publicly available images or consent-obtained private collections
305
+ - **Location privacy**: No GPS coordinates or specific farm identifiers included
306
+ - **Farmer consent**: Proper permissions obtained for orchard data collection
307
+
308
+ ### Bias and Fairness
309
+ - **Geographic diversity**: Active efforts to include multiple growing regions
310
+ - **Seasonal representation**: Multiple collection periods to reduce temporal bias
311
+ - **Equipment standardization**: Documentation of capture conditions for bias awareness
312
+
313
+ ### Environmental Impact
314
+ - **Sustainable agriculture**: Supporting precision farming for reduced resource use
315
+ - **Technology access**: Open-source approach for global accessibility
316
+ - **Local adaptation**: Encouragement of regional dataset development
317
+
318
+ ## Citation
319
+
320
+ If you use this dataset in your research, please cite:
321
+
322
+ ```bibtex
323
+ @inproceedings{loknar2025comprehensive,
324
+ title={Comprehensive Multi-Species Fruit Ripeness Dataset Construction: From Eight-Species Collection to Focused Apple-Cherry Detection},
325
+ author={Loknar, Maksim and Mlakar, Uroš},
326
+ booktitle={Student Computing Research Symposium},
327
+ year={2025},
328
+ organization={University of Maribor},
329
+ url={https://huggingface.co/datasets/TheCoffeeAddict/SmartHarvest}
330
+ }
331
+ ```
332
+
333
+ ## Dataset Card Contact
334
+
335
+ **Authors**: Maksim Loknar, Uroš Mlakar
336
+ **Institution**: Faculty of Electrical Engineering and Computer Science, University of Maribor, Slovenia
337
+ **Email**: maksim.loknar@student.um.si, uros.mlakar@um.si
338
+ **Project Page**: https://github.com/Maksim3l/SmartHarvest
339
+
340
+ For questions about dataset usage, additional species requests, or collaboration opportunities, please open an issue in the GitHub repository or contact the authors directly.