hyperspectral-fruit / README.md
Eli-S's picture
Create README.md
ad182f3 verified
|
raw
history blame
2.49 kB
---
task_categories:
- image-segmentation
- image-classification
language:
- en
tags:
- agritech
- hyperspectral
- spectroscopy
- fruit
- sub-class classification
- detection
size_categories:
- n<1K
---
# Living Optics Orchard Dataset
## Overview
This dataset contains 100 images of various fruits and vegetables captured under controlled lighting, with the [Living Optics Camera](livingoptics.com).
The data consists of RGB images, sparse spectral samples and instance segmentation masks.
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.
### Classes
The dataset contains 15 classes:
- Pink Lady Apple
- Granny Smith Apple
- Royal Gala Apple
- Plastic Apple
- Cucumber
- Melon
- Yellow Pepper
- Green Pepper
- Orange Pepper
- Lemon
- Tomato
- Cherry Tomato
- Plastic Tomato
- Orange
- Easy Peeler Orange
## Requirements
- [lo-sdk](https://www.livingoptics.com/register-for-download-sdk/)
- [lo-examples](https://github.com/livingoptics/python-examples)
## Download instructions
### Command line
```commandline
huggingface-cli ...
```
### Python
```python
from huggingface_hub import hf_hub_download
...
```
## Usage
```python
import os.path as op
import numpy.typing as npt
from typing import List, Dict, Generator
from lo_data_tools import Annotation, LODataItem, LOJSONDataset, draw_annotations
from dataset_visualisation import get_object_spectra, plot_labelled_spectra
from lo.sdk.api.acquisition.io.open import open as lo_open
# Load the dataset
path_to_download = op.expanduser("~/Downloads/LivingOpticsOrchardData")
dataset = LOJSONDataset(path_to_download)
# Get the training data as an iterator
training_data: List[LODataItem] = dataset.load("train")
# Inspect the data
lo_data_item: LODataItem
for lo_data_item in training_data[:3]:
draw_annotations(lo_data_item)
ann: Annotation
for ann in lo_data_item.annotations:
print(ann.class_name, ann.category, ann.subcategories)
# Plot the spectra for each class
fig, ax = plt.subplots(1)
object_spectra_dict = {}
class_numbers_to_labels = {0: "background_class"}
for lo_data_item in training_data:
object_spectra_dict, class_numbers_to_labels = get_object_spectra(
lo_data_item, object_spectra_dict, class_numbers_to_labels
)
plot_labelled_spectra(object_spectra_dict, class_numbers_to_labels, ax)
plt.show()
```