Datasets:
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
task_categories:
|
3 |
+
- image-segmentation
|
4 |
+
- image-classification
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
tags:
|
8 |
+
- agritech
|
9 |
+
- hyperspectral
|
10 |
+
- spectroscopy
|
11 |
+
- fruit
|
12 |
+
- sub-class classification
|
13 |
+
- detection
|
14 |
+
size_categories:
|
15 |
+
- n<1K
|
16 |
+
---
|
17 |
+
# Living Optics Orchard Dataset
|
18 |
+
## Overview
|
19 |
+
This dataset contains 100 images of various fruits and vegetables captured under controlled lighting, with the [Living Optics Camera](livingoptics.com).
|
20 |
+
|
21 |
+
The data consists of RGB images, sparse spectral samples and instance segmentation masks.
|
22 |
+
|
23 |
+
From the 100 images, we extract >400,000 spectral samples, of which >83,000 belong to one of the 15 classes in the dataset. The rest of the spectra can be used for negative sampling when training classifiers.
|
24 |
+
|
25 |
+
### Classes
|
26 |
+
|
27 |
+
The dataset contains 15 classes:
|
28 |
+
- Pink Lady Apple
|
29 |
+
- Granny Smith Apple
|
30 |
+
- Royal Gala Apple
|
31 |
+
- Plastic Apple
|
32 |
+
- Cucumber
|
33 |
+
- Melon
|
34 |
+
- Yellow Pepper
|
35 |
+
- Green Pepper
|
36 |
+
- Orange Pepper
|
37 |
+
- Lemon
|
38 |
+
- Tomato
|
39 |
+
- Cherry Tomato
|
40 |
+
- Plastic Tomato
|
41 |
+
- Orange
|
42 |
+
- Easy Peeler Orange
|
43 |
+
|
44 |
+
## Requirements
|
45 |
+
|
46 |
+
- [lo-sdk](https://www.livingoptics.com/register-for-download-sdk/)
|
47 |
+
- [lo-examples](https://github.com/livingoptics/python-examples)
|
48 |
+
|
49 |
+
|
50 |
+
## Download instructions
|
51 |
+
|
52 |
+
### Command line
|
53 |
+
```commandline
|
54 |
+
huggingface-cli ...
|
55 |
+
```
|
56 |
+
|
57 |
+
### Python
|
58 |
+
```python
|
59 |
+
from huggingface_hub import hf_hub_download
|
60 |
+
...
|
61 |
+
```
|
62 |
+
|
63 |
+
## Usage
|
64 |
+
|
65 |
+
```python
|
66 |
+
import os.path as op
|
67 |
+
import numpy.typing as npt
|
68 |
+
from typing import List, Dict, Generator
|
69 |
+
from lo_data_tools import Annotation, LODataItem, LOJSONDataset, draw_annotations
|
70 |
+
from dataset_visualisation import get_object_spectra, plot_labelled_spectra
|
71 |
+
from lo.sdk.api.acquisition.io.open import open as lo_open
|
72 |
+
# Load the dataset
|
73 |
+
path_to_download = op.expanduser("~/Downloads/LivingOpticsOrchardData")
|
74 |
+
dataset = LOJSONDataset(path_to_download)
|
75 |
+
|
76 |
+
# Get the training data as an iterator
|
77 |
+
training_data: List[LODataItem] = dataset.load("train")
|
78 |
+
|
79 |
+
# Inspect the data
|
80 |
+
|
81 |
+
lo_data_item: LODataItem
|
82 |
+
for lo_data_item in training_data[:3]:
|
83 |
+
|
84 |
+
draw_annotations(lo_data_item)
|
85 |
+
|
86 |
+
ann: Annotation
|
87 |
+
for ann in lo_data_item.annotations:
|
88 |
+
print(ann.class_name, ann.category, ann.subcategories)
|
89 |
+
|
90 |
+
# Plot the spectra for each class
|
91 |
+
fig, ax = plt.subplots(1)
|
92 |
+
object_spectra_dict = {}
|
93 |
+
class_numbers_to_labels = {0: "background_class"}
|
94 |
+
for lo_data_item in training_data:
|
95 |
+
object_spectra_dict, class_numbers_to_labels = get_object_spectra(
|
96 |
+
lo_data_item, object_spectra_dict, class_numbers_to_labels
|
97 |
+
)
|
98 |
+
|
99 |
+
plot_labelled_spectra(object_spectra_dict, class_numbers_to_labels, ax)
|
100 |
+
plt.show()
|
101 |
+
|
102 |
+
```
|