HY2333 commited on
Commit
d647fb6
·
verified ·
1 Parent(s): bc391b4

Add optional target physical-range mapping: README.md

Browse files
Files changed (1) hide show
  1. README.md +47 -0
README.md CHANGED
@@ -175,6 +175,53 @@ Important encoding note:
175
  - Mueller matrix tensors are stored as measured/processed values, not forcibly
176
  clipped to `[-1, 1]`.
177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  ## Reference Label Generation
179
 
180
  The target modalities are generated using Lu-Chipman decomposition from measured
 
175
  - Mueller matrix tensors are stored as measured/processed values, not forcibly
176
  clipped to `[-1, 1]`.
177
 
178
+ ### Optional Mapping From Grayscale Targets to Physical Ranges
179
+
180
+ For rows whose `target_encoding` is
181
+ `png_uint8_normalized_to_float32_0_1`, the stored target tensor is a normalized
182
+ grayscale representation in `[0, 1]`. To map these values back to the nominal
183
+ physical parameter ranges used in the paper, apply:
184
+
185
+ ```python
186
+ import numpy as np
187
+
188
+ TARGET_CHANNELS = ["D", "Delta", "eta", "theta", "psi", "R"]
189
+
190
+
191
+ def normalized_modalities_to_physical(target, channel_axis=0, clip=False):
192
+ """Map normalized grayscale modalities to nominal physical ranges.
193
+
194
+ Use this only for targets encoded as
195
+ ``png_uint8_normalized_to_float32_0_1``. If a split already stores physical
196
+ Lu-Chipman values, do not apply this conversion again.
197
+ """
198
+ target = np.asarray(target, dtype=np.float32)
199
+ values = np.moveaxis(target, channel_axis, 0)
200
+ if values.shape[0] != 6:
201
+ raise ValueError(f"Expected 6 target channels, got shape {target.shape}")
202
+
203
+ g = np.clip(values, 0.0, 1.0) if clip else values
204
+ physical = np.empty_like(g, dtype=np.float32)
205
+ physical[0] = g[0] # D: [0, 1]
206
+ physical[1] = g[1] # Delta: [0, 1]
207
+ physical[2] = np.pi * g[2] # eta: [0, pi)
208
+ physical[3] = np.pi * (g[3] - 0.5) # theta: [-pi/2, pi/2)
209
+ physical[4] = np.pi * (g[4] - 0.5) # psi: [-pi/2, pi/2)
210
+ physical[5] = np.pi * g[5] # R: [0, pi)
211
+ return np.moveaxis(physical, 0, channel_axis)
212
+ ```
213
+
214
+ The inverse mapping is:
215
+
216
+ ```text
217
+ D_gray = D
218
+ Delta_gray = Delta
219
+ eta_gray = eta / pi
220
+ theta_gray = theta / pi + 0.5
221
+ psi_gray = psi / pi + 0.5
222
+ R_gray = R / pi
223
+ ```
224
+
225
  ## Reference Label Generation
226
 
227
  The target modalities are generated using Lu-Chipman decomposition from measured