File size: 11,190 Bytes
1c2aa3a
58a36d7
 
 
 
 
 
 
 
 
 
 
 
1d13042
e6a59c3
1d13042
 
 
 
 
 
 
97cb0bc
58a36d7
 
 
97cb0bc
 
47dd952
 
 
 
 
 
1c2aa3a
58a36d7
 
 
 
 
b89bc2a
 
 
 
58a36d7
b89bc2a
 
 
 
e6a59c3
b89bc2a
1d13042
 
b89bc2a
1d13042
b89bc2a
 
58a36d7
 
 
b89bc2a
 
58a36d7
 
 
 
 
 
 
1d13042
 
b89bc2a
1d13042
b89bc2a
 
 
 
58a36d7
 
 
 
 
 
b89bc2a
 
 
1d13042
 
 
 
b89bc2a
 
 
1d13042
 
b89bc2a
 
 
58a36d7
 
 
 
b89bc2a
58a36d7
 
 
 
 
 
1d13042
 
 
b89bc2a
58a36d7
 
b89bc2a
 
 
 
 
 
 
 
 
 
 
 
58a36d7
 
 
1d13042
47dd952
b89bc2a
 
 
 
 
 
 
 
 
1d13042
 
b89bc2a
 
 
58a36d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b89bc2a
 
58a36d7
 
 
6d95837
 
 
 
 
 
 
b89bc2a
58a36d7
 
 
 
 
 
 
b89bc2a
 
 
1d13042
 
6d95837
 
58a36d7
d647fb6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
abe0499
 
 
 
 
 
 
 
b89bc2a
58a36d7
b89bc2a
 
 
 
58a36d7
 
 
b89bc2a
 
1d13042
 
 
b89bc2a
 
 
 
58a36d7
b89bc2a
58a36d7
1d13042
58a36d7
1d13042
 
 
b89bc2a
1d13042
b89bc2a
 
58a36d7
b89bc2a
58a36d7
b89bc2a
58a36d7
b89bc2a
 
 
58a36d7
b89bc2a
58a36d7
 
 
b89bc2a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58a36d7
 
b89bc2a
 
58a36d7
b89bc2a
58a36d7
1d13042
b89bc2a
 
58a36d7
 
b89bc2a
 
 
 
58a36d7
 
1d13042
 
 
b89bc2a
 
 
 
58a36d7
6d95837
 
 
 
 
58a36d7
 
b89bc2a
58a36d7
 
 
b89bc2a
58a36d7
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
---
pretty_name: MMPD-Bench
license: cc-by-nc-4.0
tags:
- polarimetry
- mueller-matrix
- biomedical-imaging
- healthy-bone-cell
- scientific-computing
- parquet
task_categories:
- image-to-image
configs:
- config_name: healthy_bone_cell
  default: true
  data_files:
  - split: train
    path: data/train-*.parquet
  - split: validation
    path: data/validation-*.parquet
  - split: test
    path: data/test-*.parquet
- config_name: external_waveplate
  data_files:
  - split: external_waveplate
    path: data/external_waveplate-*.parquet
- config_name: external_spectral
  data_files:
  - split: external_spectral_610
    path: data/external_spectral_610-*.parquet
  - split: external_spectral_650
    path: data/external_spectral_650-*.parquet
  - split: external_spectral_690
    path: data/external_spectral_690-*.parquet
---

# MMPD-Bench

## Dataset Summary

MMPD-Bench is a polarimetric imaging benchmark for learning mappings from
Mueller matrix observations to polarimetric decomposition modalities. Each
sample contains a channel-first Mueller matrix tensor and a channel-first target
tensor with six Lu-Chipman reference modalities.

Current Hugging Face release status:

- Uploaded: external waveplate test data at 633 nm.
- Uploaded: external spectral test data at 610, 650, and 690 nm.
- Uploaded: healthy bone cell `train`, `validation`, and `test` splits.

Because the waveplate tensors are 200 x 200 while the healthy bone cell and
spectral tensors are 256 x 256, the data is published as separate configs:

- `healthy_bone_cell`
- `external_waveplate`
- `external_spectral`

## Task Definition

The task is modality fission from a Mueller matrix tensor to six polarimetric
target modalities. It is not a segmentation or classification dataset.

- Input: Mueller matrix tensor, shape `[16, H, W]`, channel-first.
- Output: target modality tensor, shape `[6, H, W]`, channel-first.
- Target channel order: `D`, `Delta`, `eta`, `theta`, `psi`, `R`.

## Data Sources

This release contains healthy bone cell data from `polarization_v2` and external
test data from `polarization_v3`:

- Healthy bone cell data: source-provided patch splits from 53 sample folders.
- Waveplate data: `hwp633` and `qwp633`, measured at 633 nm.
- Multi-wavelength spectral data: selected wavelengths from `mwl_530_690`,
  currently 610, 650, and 690 nm.

## File Structure

```text
MMPD-Bench/
├── README.md
├── data/
│   ├── external_waveplate-00000-of-00001.parquet
│   ├── external_spectral_610-00000-of-00001.parquet
│   ├── external_spectral_650-00000-of-00001.parquet
│   ├── external_spectral_690-00000-of-00001.parquet
│   ├── train-00000-of-00094.parquet
│   ├── validation-00000-of-00012.parquet
│   └── test-00000-of-00011.parquet
└── metadata/
    ├── acquisition_info.json
    ├── channel_order.json
    ├── healthy_bone_cell_manifest.jsonl
    ├── healthy_bone_cell_manifest_summary.json
    ├── parameter_ranges.json
    ├── schema.json
    └── split_summary.json
```

## Tensor Schema

Common columns:

```python
{
    "sample_id": str,
    "source_id": str,
    "split": str,
    "subset": str,          # healthy_bone_cell, waveplate, or spectral
    "specimen_type": str,   # healthy_bone_cell, waveplate, or spectral
    "wavelength_nm": int | None,
    "source_path": str,
    "mueller_shape": list[int],
    "target_shape": list[int],
    "mueller": array,       # float32, channel-first
    "target": array,        # float32, channel-first
}
```

Waveplate-specific columns:

```python
{
    "plate_type": str,      # hwp or qwp
    "angle_label": str,     # e.g. 0deg, n22, p45
    "angle_deg": float,
}
```

Patch-based columns for healthy bone cell and spectral rows:

```python
{
    "patch_id": str,
    "target_encoding": str, # png_uint8_normalized_to_float32_0_1
}
```

Current tensor shapes:

- `healthy_bone_cell`: `mueller = [16, 256, 256]`,
  `target = [6, 256, 256]`.
- `external_waveplate`: `mueller = [16, 200, 200]`, `target = [6, 200, 200]`.
- `external_spectral_*`: `mueller = [16, 256, 256]`,
  `target = [6, 256, 256]`.

## Channel Conventions

Mueller channel order:

```text
M11, M12, M13, M14,
M21, M22, M23, M24,
M31, M32, M33, M34,
M41, M42, M43, M44
```

Target channel order:

```text
D, Delta, eta, theta, psi, R
```

Local source files may use names such as `Ita`, `ita`, or `Eta`; the public
channel name is normalized to `eta`.

## Physical Parameter Definitions

Mueller matrix elements are generally expected to lie within `[-1, 1]` after
normalization. In measured data, small deviations outside this range may occur
because of acquisition noise, calibration differences, numerical processing, or
normalization error. Users should inspect the value distribution for their split
and apply task-appropriate preprocessing before training, such as clipping,
standardization, or normalization based on the training set.

The target tensor follows this channel order and nominal parameter range:

```text
D, Delta: [0, 1]
eta, R: [0, pi)
theta, psi: [-pi/2, pi/2)
```

Important encoding note:

- Waveplate target arrays are stored from the source `.npy` files as float32.
- Healthy bone cell and spectral target arrays were converted from grayscale PNG
  files to float32 values normalized to `[0, 1]`; see `target_encoding`.
- Mueller matrix tensors are stored as measured/processed values, not forcibly
  clipped to `[-1, 1]`.

### Optional Mapping From Grayscale Targets to Physical Ranges

For rows whose `target_encoding` is
`png_uint8_normalized_to_float32_0_1`, the stored target tensor is a normalized
grayscale representation in `[0, 1]`. To map these values back to the nominal
physical parameter ranges used in the paper, apply:

```python
import numpy as np

TARGET_CHANNELS = ["D", "Delta", "eta", "theta", "psi", "R"]


def normalized_modalities_to_physical(target, channel_axis=0, clip=False):
    """Map normalized grayscale modalities to nominal physical ranges.

    Use this only for targets encoded as
    ``png_uint8_normalized_to_float32_0_1``. If a split already stores physical
    Lu-Chipman values, do not apply this conversion again.
    """
    target = np.asarray(target, dtype=np.float32)
    values = np.moveaxis(target, channel_axis, 0)
    if values.shape[0] != 6:
        raise ValueError(f"Expected 6 target channels, got shape {target.shape}")

    g = np.clip(values, 0.0, 1.0) if clip else values
    physical = np.empty_like(g, dtype=np.float32)
    physical[0] = g[0]                      # D: [0, 1]
    physical[1] = g[1]                      # Delta: [0, 1]
    physical[2] = np.pi * g[2]              # eta: [0, pi)
    physical[3] = np.pi * (g[3] - 0.5)      # theta: [-pi/2, pi/2)
    physical[4] = np.pi * (g[4] - 0.5)      # psi: [-pi/2, pi/2)
    physical[5] = np.pi * g[5]              # R: [0, pi)
    return np.moveaxis(physical, 0, channel_axis)
```

The inverse mapping is:

```text
D_gray = D
Delta_gray = Delta
eta_gray = eta / pi
theta_gray = theta / pi + 0.5
psi_gray = psi / pi + 0.5
R_gray = R / pi
```

Visualization note: after applying this optional physical-range mapping, use the
nominal physical ranges for color scales when comparing samples or models:
`D/Delta` in `[0, 1]`, `eta/R` in `[0, pi]`, and `theta/psi` in
`[-pi/2, pi/2]`. Per-sample min/max color scales are useful for inspection, but
they can make cross-sample or cross-modality comparisons visually misleading.
The helper script `scripts/test2.py` demonstrates both normalized targets and
physical targets with fixed physical colorbar ranges.

## Reference Label Generation

The target modalities are generated using Lu-Chipman decomposition from measured
Mueller matrices. They should be interpreted as physics-solver reference labels
for benchmarking surrogate models and physics consistency, not as direct human
annotations or absolute biological ground truth.

## Splits

| Split | Config | Subset | Samples | Shape | Notes |
|---|---|---:|---:|---|---|
| train | healthy_bone_cell | healthy_bone_cell | 6006 | `[16, 256, 256] -> [6, 256, 256]` | 94 shards |
| validation | healthy_bone_cell | healthy_bone_cell | 713 | `[16, 256, 256] -> [6, 256, 256]` | 12 shards |
| test | healthy_bone_cell | healthy_bone_cell | 643 | `[16, 256, 256] -> [6, 256, 256]` | 11 shards |
| external_waveplate | external_waveplate | waveplate | 18 | `[16, 200, 200] -> [6, 200, 200]` | 633 nm HWP/QWP |
| external_spectral_610 | external_spectral | spectral | 165 | `[16, 256, 256] -> [6, 256, 256]` | 610 nm |
| external_spectral_650 | external_spectral | spectral | 165 | `[16, 256, 256] -> [6, 256, 256]` | 650 nm |
| external_spectral_690 | external_spectral | spectral | 165 | `[16, 256, 256] -> [6, 256, 256]` | 690 nm |

## Benchmark Protocols

Evaluation configs:

1. Healthy bone cell benchmark: use config `healthy_bone_cell`, splits `train`,
   `validation`, and `test`.
2. External waveplate evaluation: use config `external_waveplate`, split
   `external_waveplate`.
3. External spectral evaluation: use config `external_spectral`, then evaluate
   `external_spectral_610`, `external_spectral_650`, and
   `external_spectral_690`.

## Loading Instructions

Install the Hugging Face datasets package:

```bash
pip install datasets
```

Load one external spectral split:

```python
from datasets import load_dataset
import numpy as np

ds = load_dataset(
    "parquet",
    data_files={
        "external_spectral_610": (
            "hf://datasets/HY2333/MMPD_Bench/"
            "data/external_spectral_610-*.parquet"
        )
    },
    split="external_spectral_610",
)

row = ds[0]
mueller = np.array(row["mueller"], dtype=np.float32)
target = np.array(row["target"], dtype=np.float32)

print(row["sample_id"])
print(mueller.shape)
print(target.shape)
```

Load via dataset config:

```python
from datasets import load_dataset

healthy = load_dataset("HY2333/MMPD_Bench", "healthy_bone_cell")
spectral = load_dataset("HY2333/MMPD_Bench", "external_spectral")
waveplate = load_dataset("HY2333/MMPD_Bench", "external_waveplate")
```

Note: in some environments, streaming reads of large nested Parquet tensors can
trigger a PyArrow shutdown issue after successful iteration. For a stable smoke
test, use non-streaming loading on a single split as shown above.

## Ethics and Limitations

The current public release focuses on healthy bone cell and external
physical/spectral evaluation data. Diseased biological samples are not included
in this release.

The targets are Lu-Chipman reference outputs. Evaluation should be interpreted
as agreement with a physics-solver reference and related physics consistency,
not as proof of absolute biological ground truth.

Measured Mueller matrix entries may be slightly outside the nominal `[-1, 1]`
range. This is expected for real acquisition pipelines; users should decide
whether to clip, standardize, or otherwise normalize values according to their
training protocol.

## License

This dataset is released under CC BY-NC 4.0.

## Citation

TODO: Add the MMPD-Bench paper citation and BibTeX entry.

## Contact

TODO: Add maintainer contact details.