alexspanellis-lo commited on
Commit
4265513
·
verified ·
1 Parent(s): 3088606

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +196 -6
README.md CHANGED
@@ -1,6 +1,196 @@
1
- ---
2
- license: other
3
- license_name: lo-license
4
- license_link: >-
5
- https://customers.livingoptics.com/hubfs/Outbound/Legal/Living%20Optics%20EULA.pdf
6
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: lo-license
4
+ license_link: >-
5
+ https://customers.livingoptics.com/hubfs/Outbound/Legal/Living%20Optics%20EULA.pdf
6
+ task_categories:
7
+ - image-segmentation
8
+ - image-classification
9
+ language:
10
+ - en
11
+ tags:
12
+ - forensics
13
+ - blood detection
14
+ - blood classification
15
+ - hyperspectral
16
+ size_categories:
17
+ - 10K<n<100K
18
+ ---
19
+
20
+ # Living Optics Forensics Dataset
21
+
22
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/66aa0ad8f46d069c6339c72c/oVtV8fWMlXljp9BKQEaGq.png)
23
+
24
+ ## Overview
25
+
26
+ This dataset contains **217 images** captured during a **forensics application investigation** using the **Living Optics Camera**.
27
+
28
+ The data includes:
29
+ - **RGB images**
30
+ - **Sparse spectral samples**
31
+ - **Instance segmentation masks**
32
+
33
+ It is derived from over **200 unique raw files**, corresponding to 217 frames. The dataset has **not** been split into training/validation sets — the choice of split is left to the developer.
34
+
35
+ ### Contents
36
+ - **242 instances** of horse blood captured on various surfaces.
37
+ - **166 instances** of blood confusers (e.g., fake blood, ketchup) across **21 different surfaces**.
38
+ - A **total of 408 labeled instances**.
39
+
40
+ Additionally, the dataset contains **library spectra** captured with a spectrometer covering the wavelength range **350–1000 nm**, sampled at a higher resolution than the Living Optics camera.
41
+ These spectra can be used for:
42
+ - Spectral lookup–style algorithms
43
+ - Outlier filtering
44
+ - **Negative sampling** when spectra do not fall within labeled segmentation masks
45
+
46
+ Extra **unlabeled data** is available upon request.
47
+
48
+ ## Classes
49
+
50
+ The dataset contains **25 classes**:
51
+
52
+ | ID | Class Name |
53
+ |-------|------------|
54
+ | 104 | Horse blood (sample) |
55
+ | 103 | Tomato ketchup (sample) |
56
+ | 106 | Red food dye (sample) |
57
+ | 107 | Fake blood (sample) |
58
+ | 1015 | 100% Cotton Shirt (White) (surface) |
59
+ | 1013 | 100% Cotton Shirt (Black) (surface) |
60
+ | 1012 | Light Fabric Lined Plywood (EF64) – 3 mm (surface) |
61
+ | 1010 | PVC (EF9) Black Plywood – 3 mm (surface) |
62
+ | 1007 | PVC (EF50) Light Woodgrain Plywood – 3 mm (surface) |
63
+ | 1016 | 100% Cotton Shirt (Brown) (surface) |
64
+ | 1011 | Normal Plywood – 3 mm (surface) |
65
+ | 1008 | PVC Walnut Woodgrain Plywood (EF326) – 3 mm (surface) |
66
+ | 1006 | PVC Leather (Black) (surface) |
67
+ | 1005 | PVC Leather (White) (surface) |
68
+ | 1004 | PVC Leather (Brown) (surface) |
69
+ | 1003 | PVC Leather (Red) (surface) |
70
+ | 1019 | Skinny Jeans (Light Blue) (surface) |
71
+ | 1024 | Dri-fit Shirt (Brown) (surface) |
72
+ | 1022 | Dri-fit Shirt (White) (surface) |
73
+ | 1018 | Skinny Jeans (Black) (surface) |
74
+ | 1017 | Skinny Jeans (Grey) (surface) |
75
+ | 1021 | Dri-fit Shirt (Red) (surface) |
76
+ | 1020 | Skinny Jeans (Dark Blue) (surface) |
77
+ | 1009 | PVC White Plywood – 3 mm (surface) |
78
+ | 1023 | Dri-fit Shirt (Black) (surface) |
79
+
80
+ Unlabeled or background regions can be grouped into a single `"background"` class.
81
+
82
+ ## Visualization
83
+
84
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/668ff5cfd5298d417a272a59/CzsXVbg8dfpVC6eAhcWVN.png)
85
+
86
+ ## Requirements
87
+
88
+ - [lo-sdk](https://cloud.livingoptics.com/)
89
+ - [datareader](https://github.com/livingoptics/datareader.git)
90
+
91
+
92
+ ## Download instructions
93
+
94
+ You can access this dataset via the [Living Optics Cloud Portal](https://cloud.livingoptics.com/shared-resources?downloadFile=data%2Fannotated-datasets%2FForensics-Full-Dataset.zip).
95
+
96
+ See our [Spatial Spectral ML](https://github.com/livingoptics/spatial-spectral-ml) project for an example of how to train and run a segmentation and spectral classification algoirthm using this dataset.
97
+
98
+ ## Usage
99
+
100
+ ```python
101
+ import os
102
+ import numpy as np
103
+ import matplotlib.pyplot as plt
104
+ from lo_dataset_reader import DatasetReader, spectral_coordinate_indices_in_mask, rle_to_mask
105
+
106
+ os.environ["QT_QPA_PLATFORM"] = "xcb"
107
+
108
+ dataset_path = "/path/to/dataset"
109
+ dataset = DatasetReader(dataset_path, display_fig=True)
110
+
111
+ for idx, ((info, scene, spectra, unit, images_extern), (converted_spectra, converted_unit), annotations, library_spectra, labels) in enumerate(dataset):
112
+ for ann_idx, annotation in enumerate(annotations):
113
+ annotation["labels"] = labels
114
+
115
+ # Visualise the annotation on the scene
116
+ dataset.save_annotation_visualisation(scene, annotation, images_extern, ann_idx)
117
+
118
+ # Get spectrum stats from annotation
119
+ stats = annotation.get("extern", {}).get("stats", {})
120
+ label = stats.get("category")
121
+ mean_radiance_spectrum = stats.get("mean_radiance_spectrum")
122
+ mean_reflectance_spectrum = stats.get("mean_reflectance_spectrum")
123
+
124
+ # Get mask and spectral indices
125
+ mask = rle_to_mask(annotation["segmentation"], scene.shape)
126
+ spectral_indices = spectral_coordinate_indices_in_mask(mask, info.sampling_coordinates)
127
+
128
+ # Extract spectra and converted spectra
129
+ spec = spectra[spectral_indices, :]
130
+ if converted_spectra is not None:
131
+ conv_spec = converted_spectra[spectral_indices, :]
132
+ else:
133
+ conv_spec = None
134
+
135
+ # X-axis based on band index or wavelengths (optional)
136
+ x = np.arange(spec.shape[1])
137
+ if stats.get("wavelength_min") is not None and stats.get("wavelength_max") is not None:
138
+ x = np.linspace(stats["wavelength_min"], stats["wavelength_max"], spec.shape[1])
139
+
140
+ # Determine plot layout
141
+ if converted_spectra is not None:
142
+ fig, axs = plt.subplots(2, 2, figsize=(12, 8))
143
+ axs_top = axs[0]
144
+ axs_bottom = axs[1]
145
+ else:
146
+ fig, axs_top = plt.subplots(1, 2, figsize=(12, 4))
147
+ print(f"Warning: No converted_spectra for annotation '{label}'")
148
+
149
+ unit_label = unit.capitalize() if unit else "Radiance"
150
+
151
+ # (1,1) Individual spectra
152
+ for s in spec:
153
+ axs_top[0].plot(x, s, alpha=0.3)
154
+ axs_top[0].set_title(f"{unit_label.capitalize()} Spectra")
155
+ axs_top[0].set_xlabel("Wavelength")
156
+ axs_top[0].set_ylabel(f"{unit_label.capitalize()}")
157
+
158
+ # (1,2) Mean + Min/Max (Before conversion)
159
+ if mean_radiance_spectrum is not None:
160
+ spec_min = np.min(spec, axis=0)
161
+ spec_max = np.max(spec, axis=0)
162
+ axs_top[1].fill_between(x, spec_min, spec_max, color='lightblue', alpha=0.5, label='Min-Max Range')
163
+ axs_top[1].plot(x, mean_radiance_spectrum, color='blue', label=f'Mean {unit_label.capitalize()}')
164
+ axs_top[1].set_title(f"Extern Mean ± Range ({unit_label.capitalize()})")
165
+ axs_top[1].set_xlabel("Wavelength")
166
+ axs_top[1].set_ylabel(f"{unit_label.capitalize()}")
167
+ axs_top[1].legend()
168
+
169
+ # (2,1) and (2,2) Only if converted_spectra is available
170
+ if converted_spectra is not None and conv_spec is not None:
171
+ for s in conv_spec:
172
+ axs_bottom[0].plot(x, s, alpha=0.3)
173
+ axs_bottom[0].set_title(f"{converted_unit} Spectra")
174
+ axs_bottom[0].set_xlabel("Wavelength")
175
+ axs_bottom[0].set_ylabel(f"{converted_unit}")
176
+
177
+ if mean_reflectance_spectrum is not None:
178
+ conv_min = np.min(conv_spec, axis=0)
179
+ conv_max = np.max(conv_spec, axis=0)
180
+ axs_bottom[1].fill_between(x, conv_min, conv_max, color='lightgreen', alpha=0.5, label='Min-Max Range')
181
+ axs_bottom[1].plot(x, mean_reflectance_spectrum, color='green', label=f'Mean {converted_unit}')
182
+ axs_bottom[1].set_title(f"Extern Mean ± Range ({converted_unit})")
183
+ axs_bottom[1].set_xlabel("Wavelength")
184
+ axs_bottom[1].set_ylabel(f"{converted_unit}")
185
+ axs_bottom[1].legend()
186
+
187
+ fig.suptitle(f"Annotation {label}", fontsize=16)
188
+ plt.tight_layout()
189
+ plt.show()
190
+ ```
191
+
192
+ For more details on the dataset format and reader see: [dataset format](https://github.com/livingoptics/datareader/blob/main/docs/lo_format_dataset.md)
193
+
194
+ ## Citation
195
+
196
+ Raw data is available by request