AlbeRota commited on
Commit
6ca6737
·
verified ·
1 Parent(s): e4a56e4

Upload weights, notebooks, sample images

Browse files
configs/pretrained_config.yaml CHANGED
@@ -56,251 +56,4 @@ parameters:
56
  INPAINT_MASK_DILATION:
57
  value: 1 # Dilation kernel size (pixels) for inpaint mask - Must be odd
58
  USE_TORCH_COMPILE: # Enable PyTorch 2.0 torch.compile for faster training (experimental)
59
- value: False
60
-
61
- # ### DATA
62
- # DATASETS:
63
- # value:
64
- # SCRREAM:
65
- # VAL_SCENES: ["scene10_full_00","scene11_full_00","scene044_full_00","scene04_reduced_00","scene04_reduced_01","scene04_reduced_02"] # List of validation scene names
66
- # TARGET_SIZE: [448,448] # Target image size [height, width] in pixels
67
- # RESIZE_MODE: "resize+crop" # Image resizing mode: "resize", "crop", "resize+crop", or "pad"
68
- # FEW_IMAGES: False # If True, load only first 10 images per scene (for quick debugging)
69
- # SAMPLE_EVERY_N: 2 # Load every Nth frame from each scene (1 = all frames, 4 = every 4th frame)
70
- # LOAD_RGB_ONLY: True # If True, ignore polarization data and load only RGB images
71
-
72
- # HOUSECAT6D:
73
- # VAL_SCENES: ["val_scene1","val_scene2"] # Validation scene names
74
- # TARGET_SIZE: [448,448] # Target image size [height, width]
75
- # RESIZE_MODE: "resize+crop" # Image resizing mode
76
- # FEW_IMAGES: False # Load only first 10 images if True
77
- # SAMPLE_EVERY_N: 2 # Load every Nth frame
78
- # LOAD_RGB_ONLY: True # Ignore polarization data if True
79
-
80
- # CROMO:
81
- # TRAIN_SCENES: ["kitchen"] # Training scene names (list or string)
82
- # # VAL_SCENES: "station" # Validation scene names (optional)
83
- # TARGET_SIZE: [448,448] # Target image size [height, width]
84
- # RESIZE_MODE: "resize" # Image resizing mode
85
- # FEW_IMAGES: False # Load only first 10 images if True
86
- # SAMPLE_EVERY_N: 2 # Load every Nth frame
87
- # LOAD_RGB_ONLY: True # Ignore polarization data if True
88
-
89
- # PSD:
90
- # TRAIN_SCENES: "PSD_Train" # Training scene name (string or list)
91
- # VAL_SCENES: "PSD_Val" # Validation scene name (string or list)
92
- # TARGET_SIZE: [448,448] # Target image size [height, width]
93
- # RESIZE_MODE: "resize+crop" # Image resizing mode
94
- # FEW_IMAGES: False # Load only first 10 images if True
95
- # SAMPLE_EVERY_N: 1 # Load every Nth frame (1 = all frames)
96
- # LOAD_RGB_ONLY: True # Ignore polarization data if True
97
-
98
- # SCARED:
99
- # VAL_SCENES: ["v22","v23","v24","v25","v26","v27","v28","v29","v30","v31","v32","v33","v34"] # Validation scene names
100
- # TARGET_SIZE: [448,448] # Target image size [height, width]
101
- # RESIZE_MODE: "resize" #"resize+crop" # Image resizing mode
102
- # SAMPLE_EVERY_N: 4 # Load every Nth frame
103
- # LOAD_RGB_ONLY: True # Ignore polarization data if True
104
- # FEW_IMAGES: False # Load only first 10 images if True
105
- # HIGHLIGHT_ENABLE: False # Enable highlight detection/processing in dataset
106
- # HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection (0-1)
107
- # HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
108
- # HIGHLIGHT_RECT_SIZE: [1000, 1000] # Size of highlight rectangle region [height, width]
109
- # HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
110
- # HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
111
-
112
- # STEREOMIS_TRACKING:
113
- # VAL_SCENES: ["P2_2"] # Validation scene names
114
- # TARGET_SIZE: [448,448] # Target image size [height, width]
115
- # RESIZE_MODE: "resize+crop" # Image resizing mode
116
- # SAMPLE_EVERY_N: 4 # Load every Nth frame
117
- # LOAD_RGB_ONLY: True # Ignore polarization data if True
118
- # FEW_IMAGES: False # Load only first 10 images if True
119
- # HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
120
- # HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
121
- # HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
122
- # HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
123
- # HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
124
- # HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
125
-
126
- # CHOLEC80:
127
- # VAL_SCENES: ["val"] # Validation scene names
128
- # TARGET_SIZE: [448,448] # Target image size [height, width]
129
- # RESIZE_MODE: "resize+crop" # Image resizing mode
130
- # SAMPLE_EVERY_N: 10 # Load every Nth frame
131
- # LOAD_RGB_ONLY: True # Ignore polarization data if True
132
- # FEW_IMAGES: False # Load only first 10 images if True
133
- # HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
134
- # HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
135
- # HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
136
- # HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
137
- # HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
138
- # HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
139
-
140
- # # POLARGB:
141
- # # TRAIN_SCENES: "train"
142
- # # VAL_SCENES: "test"
143
- # # TARGET_SIZE: [448,448]
144
- # # RESIZE_MODE: "resize+crop"
145
- # # SAMPLE_EVERY_N: 1
146
- # # LOAD_RGB_ONLY: True
147
-
148
- # BATCH_SIZE: # Max batch size with img size 448 is 32
149
- # value: 16 # Number of samples per batch (adjust based on GPU memory)
150
- # NUM_WORKERS:
151
- # value: 8 # Number of data loading worker processes (0 = main process only)
152
- # SHUFFLE:
153
- # value: True # Shuffle training data each epoch (False for validation/test)
154
- # PIN_MEMORY:
155
- # value: True # Pin memory in DataLoader for faster GPU transfer (recommended: True)
156
- # PREFETCH_FACTOR:
157
- # value: 2 # Number of batches to prefetch per worker (higher = more memory usage)
158
-
159
- # ### HIGHLIGHTS
160
- # MOGE_MODEL:
161
- # value: "Ruicheng/moge-2-vits-normal" # MoGe model name for normal estimation (HuggingFace format)
162
- # SURFACE_ROUGHNESS:
163
- # value: 8.0 # Blinn-Phong surface roughness exponent (higher = sharper highlights)
164
- # INTENSITY:
165
- # value: 2.0 # Specular highlight intensity multiplier
166
- # LIGHT_DISTANCE_RANGE:
167
- # value: [0.0, 1] # Range for light source distance sampling [min, max] (normalized)
168
- # LIGHT_LEFT_RIGHT_ANGLE:
169
- # value: [0, 360] # Range for light source horizontal angle [min, max] in degrees
170
- # LIGHT_ABOVE_BELOW_ANGLE:
171
- # value: [0, 360] # Range for light source vertical angle [min, max] in degrees
172
- # DATASET_HIGHLIGHT_DILATION:
173
- # value: 25 # Dilation kernel size (pixels) for dataset highlight masks
174
- # DATASET_HIGHLIGHT_THRESHOLD:
175
- # value: 0.9 # Brightness/luminance threshold (0-1) for detecting highlights in dataset images
176
- # DATASET_HIGHLIGHT_USE_LUMINANCE:
177
- # value: True # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B) for dataset highlights; if False, use simple mean brightness
178
- # HIGHLIGHT_COLOR:
179
- # value: [1.0, 1.0, 1.0] # RGB color for synthetic highlights (normalized 0-1)
180
- # CLAMP_RECONSTRUCTION:
181
- # value: True # Clamp reconstructed images to [0, 1] range if True
182
-
183
- # ### OPTIMIZATION
184
- # LEARNING_RATE:
185
- # value: 1.0e-3 # Base learning rate for optimizer
186
- # WEIGHT_DECAY:
187
- # value: 0.0 # L2 regularization weight (0.0 = no weight decay)
188
- # EPOCHS:
189
- # value: 25 # Maximum number of training epochs
190
- # GRADIENT_ACCUMULATION_STEPS:
191
- # value: 1 # Number of steps to accumulate gradients before optimizer step (1 = no accumulation)
192
- # WARMUP:
193
- # value: 200 # Number of warmup steps for learning rate schedule (linear warmup from 0 to LR)
194
- # GRADIENT_CLIPPING_MAX_NORM:
195
- # value: 8 # Maximum gradient norm for clipping (set to -1 to disable clipping)
196
- # LR_SCHEDULER:
197
- # value:
198
- # ONPLATEAU: # ReduceLROnPlateau scheduler (reduces LR when validation metric plateaus)
199
- # PATIENCE: 5 # Number of epochs to wait before reducing LR
200
- # FACTOR: 0.1 # Factor by which LR is reduced (new_lr = old_lr * factor)
201
- # COSINE: # CosineAnnealingLR scheduler (cosine annealing schedule)
202
- # N_PERIODS: 1 # Number of cosine periods over training
203
- # # STEPWISE: # StepLR scheduler (reduces LR at fixed step intervals)
204
- # # N_STEPS: 4 # Number of times to reduce LR during training
205
- # # GAMMA: 0.5 # Factor by which LR is reduced at each step (new_lr = old_lr * gamma)
206
- # # EXPONENTIAL: # ExponentialLR scheduler (exponential decay)
207
- # # GAMMA: 0.5 # Multiplicative factor for exponential decay
208
-
209
- # SWITCH_OPTIMIZER_EPOCH:
210
- # value: null # Epoch number to switch from bootstrap to refining optimizer (null = no switch)
211
- # OPTIMIZER_BOOTSTRAP_NAME:
212
- # value: "AdamW" # Optimizer name for initial training phase ("Adam", "SGD", etc.)
213
- # OPTIMIZER_REFINING_NAME:
214
- # value: "AdamW" # Optimizer name for refining phase (used after SWITCH_OPTIMIZER_EPOCH)
215
- # EARLY_STOPPING_PATIENCE:
216
- # value: 10 # Number of epochs without improvement before stopping training
217
- # SAVE_INTERVAL:
218
- # value: 1000 # Number of training steps between model checkpoints
219
-
220
- # DATASET_HIGHLIGHT_SUPERVISION_THRESHOLD:
221
- # value: 0.1 # Pixel highlights above this threshold (should be low) are excluded from supervision
222
-
223
- # ### LOSS WEIGHTS (relative to the total loss, NOT NORMALIZED LATER)
224
- # SPECULAR_LOSS_WEIGHT:
225
- # value: 0.0 # Weight for specular component reconstruction loss
226
- # DIFFUSE_LOSS_WEIGHT:
227
- # value: 1.0 # Weight for diffuse component reconstruction loss
228
- # HIGHLIGHT_LOSS_WEIGHT:
229
- # value: 1.0 # Weight for highlight mask regression loss
230
- # IMAGE_RECONSTRUCTION_LOSS_WEIGHT:
231
- # value: 0.0 # Weight for full image reconstruction loss
232
- # SATURATION_RING_LOSS_WEIGHT:
233
- # value: 0.0 # Weight for saturation ring consistency loss (around highlight regions)
234
- # RING_KERNEL_SIZE:
235
- # value: 11 # Kernel size (odd number) for saturation ring dilation around highlights
236
- # RING_VAR_WEIGHT:
237
- # value: 0.5 # Weight for variance matching in saturation ring loss (vs mean matching)
238
- # RING_TEXTURE_WEIGHT:
239
- # value: 1.0 # Weight for texture consistency term in saturation ring loss
240
- # HLREG_W_L1:
241
- # value: 1.0 # Weight for L1 loss in highlight regression
242
- # HLREG_USE_CHARB:
243
- # value: True # Use Charbonnier loss (smooth L1) instead of standard L1 if True
244
- # HLREG_W_DICE:
245
- # value: 0.2 # Weight for Dice loss in highlight regression (for mask overlap)
246
- # HLREG_W_SSIM:
247
- # value: 0.0 # Weight for SSIM loss in highlight regression
248
- # HLREG_W_GRAD:
249
- # value: 0.0 # Weight for gradient loss in highlight regression
250
- # HLREG_W_TV:
251
- # value: 0.0 # Weight for total variation loss in highlight regression
252
- # HLREG_BALANCE_MODE:
253
- # value: "auto" # Class balancing mode for highlight regression: 'none' | 'auto' | 'pos_weight'
254
- # HLREG_POS_WEIGHT:
255
- # value: 1.0 # Positive class weight (used only if BALANCE_MODE == 'pos_weight')
256
- # HLREG_FOCAL_GAMMA:
257
- # value: 2.0 # Focal loss gamma parameter (0.0 = standard BCE, 1.0-2.0 helps with gradient vanishing)
258
-
259
- # WEIGHT_TOKEN_INPAINT:
260
- # value: 1.0 # Weight for token-space inpainting loss (L1 + cosine similarity in feature space)
261
- # WEIGHT_CONTEXT_IDENTITY:
262
- # value: 0.0 # LEAVE TO 0.0: Weight for L1 loss on context (non-masked) regions (identity preservation)
263
- # WEIGHT_TV_IN_HOLE:
264
- # value: 0.0 # LEAVE TO 0.0: Weight for total variation loss inside masked/hole regions
265
- # RING_DILATE_KERNEL:
266
- # value: 17 # Dilation kernel size (odd number) for creating ring mask around highlights
267
- # WEIGHT_SEAM:
268
- # value: 0.5 # Weight for gradient matching loss on saturation ring
269
- # SEAM_USE_CHARB:
270
- # value: True # Use Charbonnier loss instead of L1 in seam loss (smooth L1 for boundary consistency)
271
- # SEAM_WEIGHT_GRAD:
272
- # value: 0.0 # Weight for gradient matching term inside seam loss (0.0 = disable gradient term)
273
- # TOKEN_FEAT_ALPHA:
274
- # value: 0.5 # Mixing factor for token feature loss: alpha * L1 + (1-alpha) * (1-cosine_sim)
275
-
276
- # ### DIFFUSE HIGHLIGHT PENALTY
277
- # WEIGHT_DIFFUSE_HIGHLIGHT_PENALTY:
278
- # value: 0.1 # Weight for penalty loss on highlights in diffuse decoder output (0.0 = disabled)
279
- # DIFFUSE_HL_THRESHOLD:
280
- # value: 0.8 # Brightness/luminance threshold for detecting highlights in diffuse (0.0-1.0)
281
- # DIFFUSE_HL_USE_CHARB:
282
- # value: True # Use Charbonnier loss instead of L1 for diffuse highlight penalty
283
- # DIFFUSE_HL_PENALTY_MODE:
284
- # value: "brightness" # Penalty mode: "brightness" (penalize brightness/luminance above threshold) or "pixel" (penalize RGB values directly)
285
- # DIFFUSE_HL_TARGET_BRIGHTNESS:
286
- # value: null # Target brightness/luminance for penalized pixels (null = use threshold value)
287
- # DIFFUSE_HL_USE_LUMINANCE:
288
- # value: False # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B); if False, use simple mean brightness
289
-
290
- # ### LOGGING, RESULTS AND WANDB
291
- # LOG_INTERVAL:
292
- # value: 1 # Number of training steps between console log outputs
293
- # WANDB_LOG_INTERVAL:
294
- # value: 1 # Number of training steps between WandB metric logs
295
- # IMAGE_LOG_INTERVAL:
296
- # value: 10 # Number of training steps between image logging to WandB
297
- # NO_WANDB:
298
- # value: False # Disable WandB logging if True (useful for local debugging)
299
- # MODEL_WATCHER_FREQ_WANDB:
300
- # value: 50 # Frequency (in steps) for logging model parameter histograms to WandB
301
- # WANDB_ENTITY:
302
- # value: "unreflect-anything" # WandB organization/entity name
303
- # WANDB_PROJECT:
304
- # value: "UnReflectAnything" # WandB project name
305
- # NOTES:
306
- # value: "448 Test" # Notes/description for this training run
 
56
  INPAINT_MASK_DILATION:
57
  value: 1 # Dilation kernel size (pixels) for inpaint mask - Must be odd
58
  USE_TORCH_COMPILE: # Enable PyTorch 2.0 torch.compile for faster training (experimental)
59
+ value: False
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
configs/rebuttal/ablate_DWConv.yaml ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### BASELINE: CONVERGES AFTER LONG
2
+
3
+ parameters:
4
+
5
+ ### MODEL ARCHITECTURE
6
+ MODEL:
7
+ value:
8
+ MODEL_CLASS: "UnReflect_Model_TokenInpainter" # Main model class name (must match class in models.py)
9
+ MODEL_MODULE: "models" # Module name to import model classes from (default: "models")
10
+ RGB_ENCODER:
11
+ ENCODER: "facebook/dinov3-vitl16-pretrain-lvd1689m" # DINOv3 encoder model name (HuggingFace format)
12
+ IMAGE_SIZE: 448 # Input image size (height and width in pixels)
13
+ RETURN_SELECTED_LAYERS: [3, 6, 9, 12] # Transformer layer indices to extract features from (0-indexed)
14
+ RGB_ENCODER_LR: 0.0 # Learning rate for RGB encoder (0.0 = frozen, must be explicitly set)
15
+ DECODERS:
16
+ diffuse:
17
+ USE_FILM: False # Enable FiLM (Feature-wise Linear Modulation) conditioning in decoder
18
+ FEATURE_DIM: 1024 # Feature dimension for decoder (should match encoder output)
19
+ REASSEMBLE_OUT_CHANNELS: [768,1024,1536,2048] # Output channels for each decoder stage (DPT-style reassembly)
20
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
21
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder ("ignore", "project", etc.)
22
+ FROM_PRETRAINED: "weights/rgb_decoder.pth" # Path to pretrained decoder weights (optional)
23
+ USE_BN: False # Use batch normalization in decoder
24
+ DROPOUT: 0.1 # Dropout rate in decoder layers
25
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
26
+ OUTPUT_CHANNELS: 3 # Number of output channels (3 for RGB diffuse image)
27
+ DECODER_LR: 1.0e-5 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
28
+ NUM_FUSION_BLOCKS_TRAINABLE: 1 # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
29
+ TRAIN_RGB_HEAD: True # Whether to train RGB head (true/false, null = train if DECODER_LR != 0)
30
+ highlight:
31
+ USE_FILM: False # Enable FiLM conditioning in highlight decoder
32
+ FEATURE_DIM: 1024 # Feature dimension for highlight decoder
33
+ REASSEMBLE_OUT_CHANNELS: [96,192,384,768] # Output channels for each decoder stage
34
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
35
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder
36
+ USE_BN: False # Use batch normalization in decoder
37
+ DROPOUT: 0.1 # Dropout rate in decoder layers
38
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
39
+ OUTPUT_CHANNELS: 1 # Number of output channels (1 for highlight mask)
40
+ DECODER_LR: 5.0e-4 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
41
+ NUM_FUSION_BLOCKS_TRAINABLE: null # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
42
+ TOKEN_INPAINTER:
43
+ TOKEN_INPAINTER_CLASS: "TokenInpainter_Prior" # Token inpainter class name
44
+ TOKEN_INPAINTER_MODULE: "token_inpainters" # Module name to import token inpainter from
45
+ FROM_PRETRAINED: "weights/token_inpainter.pth" # Path to pretrained token inpainter weights
46
+ TOKEN_INPAINTER_LR: 1.0e-5 # Learning rate for token inpainter (can differ from base LR)
47
+ DEPTH: 6 # Number of transformer blocks
48
+ HEADS: 16 # Number of attention heads
49
+ DROP: 0 # Dropout rate
50
+ USE_POSITIONAL_ENCODING: True # Enable 2D sinusoidal positional encodings
51
+ USE_FINAL_NORM: True # Enable final LayerNorm before output projection
52
+ USE_LOCAL_PRIOR: True # Blend local mean prior for masked seeds
53
+ ### ABLATION =======================================================================
54
+ LOCAL_PRIOR_WEIGHT: 0.0 # Weight for local prior blending (1.0 = only mask_token, 0.0 = only local mean)
55
+ ###=================================================================================
56
+ LOCAL_PRIOR_KERNEL: 5 # Kernel size for local prior blending (> 1)
57
+ SEED_NOISE_STD: 0.02 # Standard deviation of noise added to masked seeds during training
58
+ INPAINT_MASK_DILATION:
59
+ value: 1 # Dilation kernel size (pixels) for inpaint mask - Must be odd
60
+ USE_TORCH_COMPILE: # Enable PyTorch 2.0 torch.compile for faster training (experimental)
61
+ value: False
62
+
63
+ ### DATA
64
+ DATASETS:
65
+ value:
66
+ SCRREAM:
67
+ VAL_SCENES: ["scene10_full_00","scene11_full_00","scene044_full_00","scene04_reduced_00","scene04_reduced_01","scene04_reduced_02"] # List of validation scene names
68
+ TARGET_SIZE: [448,448] # Target image size [height, width] in pixels
69
+ RESIZE_MODE: "resize+crop" # Image resizing mode: "resize", "crop", "resize+crop", or "pad"
70
+ FEW_IMAGES: False # If True, load only first 10 images per scene (for quick debugging)
71
+ SAMPLE_EVERY_N: 2 # Load every Nth frame from each scene (1 = all frames, 4 = every 4th frame)
72
+ LOAD_RGB_ONLY: True # If True, ignore polarization data and load only RGB images
73
+
74
+ HOUSECAT6D:
75
+ VAL_SCENES: ["val_scene1","val_scene2"] # Validation scene names
76
+ TARGET_SIZE: [448,448] # Target image size [height, width]
77
+ RESIZE_MODE: "resize+crop" # Image resizing mode
78
+ FEW_IMAGES: False # Load only first 10 images if True
79
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
80
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
81
+
82
+ CROMO:
83
+ TRAIN_SCENES: ["kitchen"] # Training scene names (list or string)
84
+ # VAL_SCENES: "station" # Validation scene names (optional)
85
+ TARGET_SIZE: [448,448] # Target image size [height, width]
86
+ RESIZE_MODE: "resize" # Image resizing mode
87
+ FEW_IMAGES: False # Load only first 10 images if True
88
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
89
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
90
+
91
+ PSD:
92
+ TRAIN_SCENES: "PSD_Train" # Training scene name (string or list)
93
+ VAL_SCENES: "PSD_Val" # Validation scene name (string or list)
94
+ TARGET_SIZE: [448,448] # Target image size [height, width]
95
+ RESIZE_MODE: "resize+crop" # Image resizing mode
96
+ FEW_IMAGES: False # Load only first 10 images if True
97
+ SAMPLE_EVERY_N: 1 # Load every Nth frame (1 = all frames)
98
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
99
+
100
+ SCARED:
101
+ VAL_SCENES: ["v22","v23","v24","v25","v26","v27","v28","v29","v30","v31","v32","v33","v34"] # Validation scene names
102
+ TARGET_SIZE: [448,448] # Target image size [height, width]
103
+ RESIZE_MODE: "resize" #"resize+crop" # Image resizing mode
104
+ SAMPLE_EVERY_N: 1 # Load every Nth frame
105
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
106
+ FEW_IMAGES: False # Load only first 10 images if True
107
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing in dataset
108
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection (0-1)
109
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
110
+ HIGHLIGHT_RECT_SIZE: [1000, 1000] # Size of highlight rectangle region [height, width]
111
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
112
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
113
+
114
+ STEREOMIS_TRACKING:
115
+ VAL_SCENES: ["P2_2"] # Validation scene names
116
+ TARGET_SIZE: [448,448] # Target image size [height, width]
117
+ RESIZE_MODE: "resize+crop" # Image resizing mode
118
+ SAMPLE_EVERY_N: 4 # Load every Nth frame
119
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
120
+ FEW_IMAGES: False # Load only first 10 images if True
121
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
122
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
123
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
124
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
125
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
126
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
127
+
128
+ CHOLEC80:
129
+ VAL_SCENES: ["val"] # Validation scene names
130
+ TARGET_SIZE: [448,448] # Target image size [height, width]
131
+ RESIZE_MODE: "resize+crop" # Image resizing mode
132
+ SAMPLE_EVERY_N: 10 # Load every Nth frame
133
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
134
+ FEW_IMAGES: False # Load only first 10 images if True
135
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
136
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
137
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
138
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
139
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
140
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
141
+
142
+ # POLARGB:
143
+ # TRAIN_SCENES: "train"
144
+ # VAL_SCENES: "test"
145
+ # TARGET_SIZE: [448,448]
146
+ # RESIZE_MODE: "resize+crop"
147
+ # SAMPLE_EVERY_N: 1
148
+ # LOAD_RGB_ONLY: True
149
+
150
+ BATCH_SIZE: # Max batch size with img size 448 is 32
151
+ value: 16 # Number of samples per batch (adjust based on GPU memory)
152
+ NUM_WORKERS:
153
+ value: 8 # Number of data loading worker processes (0 = main process only)
154
+ SHUFFLE:
155
+ value: True # Shuffle training data each epoch (False for validation/test)
156
+ PIN_MEMORY:
157
+ value: True # Pin memory in DataLoader for faster GPU transfer (recommended: True)
158
+ PREFETCH_FACTOR:
159
+ value: 2 # Number of batches to prefetch per worker (higher = more memory usage)
160
+
161
+ ### HIGHLIGHTS
162
+ MOGE_MODEL:
163
+ value: "Ruicheng/moge-2-vits-normal" # MoGe model name for normal estimation (HuggingFace format)
164
+ SURFACE_ROUGHNESS:
165
+ value: 8.0 # Blinn-Phong surface roughness exponent (higher = sharper highlights)
166
+ INTENSITY:
167
+ value: 2.0 # Specular highlight intensity multiplier
168
+ LIGHT_DISTANCE_RANGE:
169
+ value: [0.0, 1] # Range for light source distance sampling [min, max] (normalized)
170
+ LIGHT_LEFT_RIGHT_ANGLE:
171
+ value: [0, 360] # Range for light source horizontal angle [min, max] in degrees
172
+ LIGHT_ABOVE_BELOW_ANGLE:
173
+ value: [0, 360] # Range for light source vertical angle [min, max] in degrees
174
+ DATASET_HIGHLIGHT_DILATION:
175
+ value: 25 # Dilation kernel size (pixels) for dataset highlight masks
176
+ DATASET_HIGHLIGHT_THRESHOLD:
177
+ value: 0.9 # Brightness/luminance threshold (0-1) for detecting highlights in dataset images
178
+ DATASET_HIGHLIGHT_USE_LUMINANCE:
179
+ value: True # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B) for dataset highlights; if False, use simple mean brightness
180
+ HIGHLIGHT_COLOR:
181
+ value: [1.0, 1.0, 1.0] # RGB color for synthetic highlights (normalized 0-1)
182
+ CLAMP_RECONSTRUCTION:
183
+ value: True # Clamp reconstructed images to [0, 1] range if True
184
+
185
+ ### OPTIMIZATION
186
+ LEARNING_RATE:
187
+ value: 1.0e-3 # Base learning rate for optimizer
188
+ WEIGHT_DECAY:
189
+ value: 0.0 # L2 regularization weight (0.0 = no weight decay)
190
+ EPOCHS:
191
+ value: 25 # Maximum number of training epochs
192
+ GRADIENT_ACCUMULATION_STEPS:
193
+ value: 1 # Number of steps to accumulate gradients before optimizer step (1 = no accumulation)
194
+ WARMUP:
195
+ value: 200 # Number of warmup steps for learning rate schedule (linear warmup from 0 to LR)
196
+ GRADIENT_CLIPPING_MAX_NORM:
197
+ value: 8 # Maximum gradient norm for clipping (set to -1 to disable clipping)
198
+ LR_SCHEDULER:
199
+ value:
200
+ ONPLATEAU: # ReduceLROnPlateau scheduler (reduces LR when validation metric plateaus)
201
+ PATIENCE: 5 # Number of epochs to wait before reducing LR
202
+ FACTOR: 0.1 # Factor by which LR is reduced (new_lr = old_lr * factor)
203
+ COSINE: # CosineAnnealingLR scheduler (cosine annealing schedule)
204
+ N_PERIODS: 1 # Number of cosine periods over training
205
+ # STEPWISE: # StepLR scheduler (reduces LR at fixed step intervals)
206
+ # N_STEPS: 4 # Number of times to reduce LR during training
207
+ # GAMMA: 0.5 # Factor by which LR is reduced at each step (new_lr = old_lr * gamma)
208
+ # EXPONENTIAL: # ExponentialLR scheduler (exponential decay)
209
+ # GAMMA: 0.5 # Multiplicative factor for exponential decay
210
+
211
+ SWITCH_OPTIMIZER_EPOCH:
212
+ value: null # Epoch number to switch from bootstrap to refining optimizer (null = no switch)
213
+ OPTIMIZER_BOOTSTRAP_NAME:
214
+ value: "AdamW" # Optimizer name for initial training phase ("Adam", "SGD", etc.)
215
+ OPTIMIZER_REFINING_NAME:
216
+ value: "AdamW" # Optimizer name for refining phase (used after SWITCH_OPTIMIZER_EPOCH)
217
+ EARLY_STOPPING_PATIENCE:
218
+ value: 10 # Number of epochs without improvement before stopping training
219
+ SAVE_INTERVAL:
220
+ value: 1000 # Number of training steps between model checkpoints
221
+
222
+ DATASET_HIGHLIGHT_SUPERVISION_THRESHOLD:
223
+ value: 0.1 # Pixel highlights above this threshold (should be low) are excluded from supervision
224
+
225
+ ### LOSS WEIGHTS (relative to the total loss, NOT NORMALIZED LATER)
226
+ SPECULAR_LOSS_WEIGHT:
227
+ value: 0.0 # Weight for specular component reconstruction loss
228
+ DIFFUSE_LOSS_WEIGHT:
229
+ value: 1.0 # Weight for diffuse component reconstruction loss
230
+ HIGHLIGHT_LOSS_WEIGHT:
231
+ value: 1.0 # Weight for highlight mask regression loss
232
+ IMAGE_RECONSTRUCTION_LOSS_WEIGHT:
233
+ value: 0.0 # Weight for full image reconstruction loss
234
+ SATURATION_RING_LOSS_WEIGHT:
235
+ value: 0.0 # Weight for saturation ring consistency loss (around highlight regions)
236
+ RING_KERNEL_SIZE:
237
+ value: 11 # Kernel size (odd number) for saturation ring dilation around highlights
238
+ RING_VAR_WEIGHT:
239
+ value: 0.5 # Weight for variance matching in saturation ring loss (vs mean matching)
240
+ RING_TEXTURE_WEIGHT:
241
+ value: 1.0 # Weight for texture consistency term in saturation ring loss
242
+ HLREG_W_L1:
243
+ value: 1.0 # Weight for L1 loss in highlight regression
244
+ HLREG_USE_CHARB:
245
+ value: True # Use Charbonnier loss (smooth L1) instead of standard L1 if True
246
+ HLREG_W_DICE:
247
+ value: 0.2 # Weight for Dice loss in highlight regression (for mask overlap)
248
+ HLREG_W_SSIM:
249
+ value: 0.0 # Weight for SSIM loss in highlight regression
250
+ HLREG_W_GRAD:
251
+ value: 0.0 # Weight for gradient loss in highlight regression
252
+ HLREG_W_TV:
253
+ value: 0.0 # Weight for total variation loss in highlight regression
254
+ HLREG_BALANCE_MODE:
255
+ value: "auto" # Class balancing mode for highlight regression: 'none' | 'auto' | 'pos_weight'
256
+ HLREG_POS_WEIGHT:
257
+ value: 1.0 # Positive class weight (used only if BALANCE_MODE == 'pos_weight')
258
+ HLREG_FOCAL_GAMMA:
259
+ value: 2.0 # Focal loss gamma parameter (0.0 = standard BCE, 1.0-2.0 helps with gradient vanishing)
260
+
261
+ WEIGHT_TOKEN_INPAINT:
262
+ value: 1.0 # Weight for token-space inpainting loss (L1 + cosine similarity in feature space)
263
+ WEIGHT_CONTEXT_IDENTITY:
264
+ value: 0.0 # LEAVE TO 0.0: Weight for L1 loss on context (non-masked) regions (identity preservation)
265
+ WEIGHT_TV_IN_HOLE:
266
+ value: 0.0 # LEAVE TO 0.0: Weight for total variation loss inside masked/hole regions
267
+ RING_DILATE_KERNEL:
268
+ value: 17 # Dilation kernel size (odd number) for creating ring mask around highlights
269
+ WEIGHT_SEAM:
270
+ value: 0.5 # Weight for gradient matching loss on saturation ring
271
+ SEAM_USE_CHARB:
272
+ value: True # Use Charbonnier loss instead of L1 in seam loss (smooth L1 for boundary consistency)
273
+ SEAM_WEIGHT_GRAD:
274
+ value: 0.0 # Weight for gradient matching term inside seam loss (0.0 = disable gradient term)
275
+ TOKEN_FEAT_ALPHA:
276
+ value: 0.5 # Mixing factor for token feature loss: alpha * L1 + (1-alpha) * (1-cosine_sim)
277
+
278
+ ### DIFFUSE HIGHLIGHT PENALTY
279
+ WEIGHT_DIFFUSE_HIGHLIGHT_PENALTY:
280
+ value: 0.1 # Weight for penalty loss on highlights in diffuse decoder output (0.0 = disabled)
281
+ DIFFUSE_HL_THRESHOLD:
282
+ value: 0.8 # Brightness/luminance threshold for detecting highlights in diffuse (0.0-1.0)
283
+ DIFFUSE_HL_USE_CHARB:
284
+ value: True # Use Charbonnier loss instead of L1 for diffuse highlight penalty
285
+ DIFFUSE_HL_PENALTY_MODE:
286
+ value: "brightness" # Penalty mode: "brightness" (penalize brightness/luminance above threshold) or "pixel" (penalize RGB values directly)
287
+ DIFFUSE_HL_TARGET_BRIGHTNESS:
288
+ value: null # Target brightness/luminance for penalized pixels (null = use threshold value)
289
+ DIFFUSE_HL_USE_LUMINANCE:
290
+ value: False # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B); if False, use simple mean brightness
291
+
292
+ ### LOGGING, RESULTS AND WANDB
293
+ LOG_INTERVAL:
294
+ value: 1 # Number of training steps between console log outputs
295
+ WANDB_LOG_INTERVAL:
296
+ value: 1 # Number of training steps between WandB metric logs
297
+ IMAGE_LOG_INTERVAL:
298
+ value: 10 # Number of training steps between image logging to WandB
299
+ NO_WANDB:
300
+ value: False # Disable WandB logging if True (useful for local debugging)
301
+ MODEL_WATCHER_FREQ_WANDB:
302
+ value: 50 # Frequency (in steps) for logging model parameter histograms to WandB
303
+ WANDB_ENTITY:
304
+ value: "unreflect-anything" # WandB organization/entity name
305
+ WANDB_PROJECT:
306
+ value: "UnReflectAnything" # WandB project name
307
+ NOTES:
308
+ value: "DWConv ablation - Rebuttal" # Notes/description for this training run
configs/rebuttal/ablate_Dice.yaml ADDED
@@ -0,0 +1,309 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### BASELINE: CONVERGES AFTER LONG
2
+
3
+ parameters:
4
+
5
+ ### MODEL ARCHITECTURE
6
+ MODEL:
7
+ value:
8
+ MODEL_CLASS: "UnReflect_Model_TokenInpainter" # Main model class name (must match class in models.py)
9
+ MODEL_MODULE: "models" # Module name to import model classes from (default: "models")
10
+ RGB_ENCODER:
11
+ ENCODER: "facebook/dinov3-vitl16-pretrain-lvd1689m" # DINOv3 encoder model name (HuggingFace format)
12
+ IMAGE_SIZE: 448 # Input image size (height and width in pixels)
13
+ RETURN_SELECTED_LAYERS: [3, 6, 9, 12] # Transformer layer indices to extract features from (0-indexed)
14
+ RGB_ENCODER_LR: 0.0 # Learning rate for RGB encoder (0.0 = frozen, must be explicitly set)
15
+ DECODERS:
16
+ diffuse:
17
+ USE_FILM: False # Enable FiLM (Feature-wise Linear Modulation) conditioning in decoder
18
+ FEATURE_DIM: 1024 # Feature dimension for decoder (should match encoder output)
19
+ REASSEMBLE_OUT_CHANNELS: [768,1024,1536,2048] # Output channels for each decoder stage (DPT-style reassembly)
20
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
21
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder ("ignore", "project", etc.)
22
+ FROM_PRETRAINED: "weights/rgb_decoder.pth" # Path to pretrained decoder weights (optional)
23
+ USE_BN: False # Use batch normalization in decoder
24
+ DROPOUT: 0.1 # Dropout rate in decoder layers
25
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
26
+ OUTPUT_CHANNELS: 3 # Number of output channels (3 for RGB diffuse image)
27
+ DECODER_LR: 1.0e-5 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
28
+ NUM_FUSION_BLOCKS_TRAINABLE: 1 # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
29
+ TRAIN_RGB_HEAD: True # Whether to train RGB head (true/false, null = train if DECODER_LR != 0)
30
+ highlight:
31
+ USE_FILM: False # Enable FiLM conditioning in highlight decoder
32
+ FEATURE_DIM: 1024 # Feature dimension for highlight decoder
33
+ REASSEMBLE_OUT_CHANNELS: [96,192,384,768] # Output channels for each decoder stage
34
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
35
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder
36
+ USE_BN: False # Use batch normalization in decoder
37
+ DROPOUT: 0.1 # Dropout rate in decoder layers
38
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
39
+ OUTPUT_CHANNELS: 1 # Number of output channels (1 for highlight mask)
40
+ DECODER_LR: 5.0e-4 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
41
+ NUM_FUSION_BLOCKS_TRAINABLE: null # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
42
+ TOKEN_INPAINTER:
43
+ TOKEN_INPAINTER_CLASS: "TokenInpainter_Prior" # Token inpainter class name
44
+ TOKEN_INPAINTER_MODULE: "token_inpainters" # Module name to import token inpainter from
45
+ FROM_PRETRAINED: "weights/token_inpainter.pth" # Path to pretrained token inpainter weights
46
+ TOKEN_INPAINTER_LR: 1.0e-5 # Learning rate for token inpainter (can differ from base LR)
47
+ DEPTH: 6 # Number of transformer blocks
48
+ HEADS: 16 # Number of attention heads
49
+ DROP: 0 # Dropout rate
50
+ USE_POSITIONAL_ENCODING: True # Enable 2D sinusoidal positional encodings
51
+ USE_FINAL_NORM: True # Enable final LayerNorm before output projection
52
+ USE_LOCAL_PRIOR: True # Blend local mean prior for masked seeds
53
+ LOCAL_PRIOR_WEIGHT: 0.5 # Weight for local prior blending (1.0 = only mask_token, 0.0 = only local mean)
54
+ LOCAL_PRIOR_KERNEL: 5 # Kernel size for local prior blending (> 1)
55
+ SEED_NOISE_STD: 0.02 # Standard deviation of noise added to masked seeds during training
56
+ INPAINT_MASK_DILATION:
57
+ value: 1 # Dilation kernel size (pixels) for inpaint mask - Must be odd
58
+ USE_TORCH_COMPILE: # Enable PyTorch 2.0 torch.compile for faster training (experimental)
59
+ value: False
60
+
61
+ ### DATA
62
+ DATASETS:
63
+ value:
64
+ SCRREAM:
65
+ VAL_SCENES: ["scene10_full_00","scene11_full_00","scene044_full_00","scene04_reduced_00","scene04_reduced_01","scene04_reduced_02"] # List of validation scene names
66
+ TARGET_SIZE: [448,448] # Target image size [height, width] in pixels
67
+ RESIZE_MODE: "resize+crop" # Image resizing mode: "resize", "crop", "resize+crop", or "pad"
68
+ FEW_IMAGES: False # If True, load only first 10 images per scene (for quick debugging)
69
+ SAMPLE_EVERY_N: 2 # Load every Nth frame from each scene (1 = all frames, 4 = every 4th frame)
70
+ LOAD_RGB_ONLY: True # If True, ignore polarization data and load only RGB images
71
+
72
+ HOUSECAT6D:
73
+ VAL_SCENES: ["val_scene1","val_scene2"] # Validation scene names
74
+ TARGET_SIZE: [448,448] # Target image size [height, width]
75
+ RESIZE_MODE: "resize+crop" # Image resizing mode
76
+ FEW_IMAGES: False # Load only first 10 images if True
77
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
78
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
79
+
80
+ CROMO:
81
+ TRAIN_SCENES: ["kitchen"] # Training scene names (list or string)
82
+ # VAL_SCENES: "station" # Validation scene names (optional)
83
+ TARGET_SIZE: [448,448] # Target image size [height, width]
84
+ RESIZE_MODE: "resize" # Image resizing mode
85
+ FEW_IMAGES: False # Load only first 10 images if True
86
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
87
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
88
+
89
+ PSD:
90
+ TRAIN_SCENES: "PSD_Train" # Training scene name (string or list)
91
+ VAL_SCENES: "PSD_Val" # Validation scene name (string or list)
92
+ TARGET_SIZE: [448,448] # Target image size [height, width]
93
+ RESIZE_MODE: "resize+crop" # Image resizing mode
94
+ FEW_IMAGES: False # Load only first 10 images if True
95
+ SAMPLE_EVERY_N: 1 # Load every Nth frame (1 = all frames)
96
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
97
+
98
+ SCARED:
99
+ VAL_SCENES: ["v22","v23","v24","v25","v26","v27","v28","v29","v30","v31","v32","v33","v34"] # Validation scene names
100
+ TARGET_SIZE: [448,448] # Target image size [height, width]
101
+ RESIZE_MODE: "resize" #"resize+crop" # Image resizing mode
102
+ SAMPLE_EVERY_N: 1 # Load every Nth frame
103
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
104
+ FEW_IMAGES: False # Load only first 10 images if True
105
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing in dataset
106
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection (0-1)
107
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
108
+ HIGHLIGHT_RECT_SIZE: [1000, 1000] # Size of highlight rectangle region [height, width]
109
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
110
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
111
+
112
+ STEREOMIS_TRACKING:
113
+ VAL_SCENES: ["P2_2"] # Validation scene names
114
+ TARGET_SIZE: [448,448] # Target image size [height, width]
115
+ RESIZE_MODE: "resize+crop" # Image resizing mode
116
+ SAMPLE_EVERY_N: 4 # Load every Nth frame
117
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
118
+ FEW_IMAGES: False # Load only first 10 images if True
119
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
120
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
121
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
122
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
123
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
124
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
125
+
126
+ CHOLEC80:
127
+ VAL_SCENES: ["val"] # Validation scene names
128
+ TARGET_SIZE: [448,448] # Target image size [height, width]
129
+ RESIZE_MODE: "resize+crop" # Image resizing mode
130
+ SAMPLE_EVERY_N: 10 # Load every Nth frame
131
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
132
+ FEW_IMAGES: False # Load only first 10 images if True
133
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
134
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
135
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
136
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
137
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
138
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
139
+
140
+ # POLARGB:
141
+ # TRAIN_SCENES: "train"
142
+ # VAL_SCENES: "test"
143
+ # TARGET_SIZE: [448,448]
144
+ # RESIZE_MODE: "resize+crop"
145
+ # SAMPLE_EVERY_N: 1
146
+ # LOAD_RGB_ONLY: True
147
+
148
+ BATCH_SIZE: # Max batch size with img size 448 is 32
149
+ value: 12 # Number of samples per batch (adjust based on GPU memory)
150
+ NUM_WORKERS:
151
+ value: 8 # Number of data loading worker processes (0 = main process only)
152
+ SHUFFLE:
153
+ value: True # Shuffle training data each epoch (False for validation/test)
154
+ PIN_MEMORY:
155
+ value: True # Pin memory in DataLoader for faster GPU transfer (recommended: True)
156
+ PREFETCH_FACTOR:
157
+ value: 2 # Number of batches to prefetch per worker (higher = more memory usage)
158
+
159
+ ### HIGHLIGHTS
160
+ MOGE_MODEL:
161
+ value: "Ruicheng/moge-2-vits-normal" # MoGe model name for normal estimation (HuggingFace format)
162
+ SURFACE_ROUGHNESS:
163
+ value: 8.0 # Blinn-Phong surface roughness exponent (higher = sharper highlights)
164
+ INTENSITY:
165
+ value: 2.0 # Specular highlight intensity multiplier
166
+ LIGHT_DISTANCE_RANGE:
167
+ value: [0.0, 1] # Range for light source distance sampling [min, max] (normalized)
168
+ LIGHT_LEFT_RIGHT_ANGLE:
169
+ value: [0, 360] # Range for light source horizontal angle [min, max] in degrees
170
+ LIGHT_ABOVE_BELOW_ANGLE:
171
+ value: [0, 360] # Range for light source vertical angle [min, max] in degrees
172
+ DATASET_HIGHLIGHT_DILATION:
173
+ value: 25 # Dilation kernel size (pixels) for dataset highlight masks
174
+ DATASET_HIGHLIGHT_THRESHOLD:
175
+ value: 0.9 # Brightness/luminance threshold (0-1) for detecting highlights in dataset images
176
+ DATASET_HIGHLIGHT_USE_LUMINANCE:
177
+ value: True # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B) for dataset highlights; if False, use simple mean brightness
178
+ HIGHLIGHT_COLOR:
179
+ value: [1.0, 1.0, 1.0] # RGB color for synthetic highlights (normalized 0-1)
180
+ CLAMP_RECONSTRUCTION:
181
+ value: True # Clamp reconstructed images to [0, 1] range if True
182
+
183
+ ### OPTIMIZATION
184
+ LEARNING_RATE:
185
+ value: 1.0e-3 # Base learning rate for optimizer
186
+ WEIGHT_DECAY:
187
+ value: 0.0 # L2 regularization weight (0.0 = no weight decay)
188
+ EPOCHS:
189
+ value: 25 # Maximum number of training epochs
190
+ GRADIENT_ACCUMULATION_STEPS:
191
+ value: 1 # Number of steps to accumulate gradients before optimizer step (1 = no accumulation)
192
+ WARMUP:
193
+ value: 200 # Number of warmup steps for learning rate schedule (linear warmup from 0 to LR)
194
+ GRADIENT_CLIPPING_MAX_NORM:
195
+ value: 8 # Maximum gradient norm for clipping (set to -1 to disable clipping)
196
+ LR_SCHEDULER:
197
+ value:
198
+ ONPLATEAU: # ReduceLROnPlateau scheduler (reduces LR when validation metric plateaus)
199
+ PATIENCE: 5 # Number of epochs to wait before reducing LR
200
+ FACTOR: 0.1 # Factor by which LR is reduced (new_lr = old_lr * factor)
201
+ COSINE: # CosineAnnealingLR scheduler (cosine annealing schedule)
202
+ N_PERIODS: 1 # Number of cosine periods over training
203
+ # STEPWISE: # StepLR scheduler (reduces LR at fixed step intervals)
204
+ # N_STEPS: 4 # Number of times to reduce LR during training
205
+ # GAMMA: 0.5 # Factor by which LR is reduced at each step (new_lr = old_lr * gamma)
206
+ # EXPONENTIAL: # ExponentialLR scheduler (exponential decay)
207
+ # GAMMA: 0.5 # Multiplicative factor for exponential decay
208
+
209
+ SWITCH_OPTIMIZER_EPOCH:
210
+ value: null # Epoch number to switch from bootstrap to refining optimizer (null = no switch)
211
+ OPTIMIZER_BOOTSTRAP_NAME:
212
+ value: "AdamW" # Optimizer name for initial training phase ("Adam", "SGD", etc.)
213
+ OPTIMIZER_REFINING_NAME:
214
+ value: "AdamW" # Optimizer name for refining phase (used after SWITCH_OPTIMIZER_EPOCH)
215
+ EARLY_STOPPING_PATIENCE:
216
+ value: 10 # Number of epochs without improvement before stopping training
217
+ SAVE_INTERVAL:
218
+ value: 1000 # Number of training steps between model checkpoints
219
+
220
+ DATASET_HIGHLIGHT_SUPERVISION_THRESHOLD:
221
+ value: 0.1 # Pixel highlights above this threshold (should be low) are excluded from supervision
222
+
223
+ ### LOSS WEIGHTS (relative to the total loss, NOT NORMALIZED LATER)
224
+ SPECULAR_LOSS_WEIGHT:
225
+ value: 0.0 # Weight for specular component reconstruction loss
226
+ DIFFUSE_LOSS_WEIGHT:
227
+ value: 1.0 # Weight for diffuse component reconstruction loss
228
+ HIGHLIGHT_LOSS_WEIGHT:
229
+ value: 1.0 # Weight for highlight mask regression loss
230
+ IMAGE_RECONSTRUCTION_LOSS_WEIGHT:
231
+ value: 0.0 # Weight for full image reconstruction loss
232
+ SATURATION_RING_LOSS_WEIGHT:
233
+ value: 0.0 # Weight for saturation ring consistency loss (around highlight regions)
234
+ RING_KERNEL_SIZE:
235
+ value: 11 # Kernel size (odd number) for saturation ring dilation around highlights
236
+ RING_VAR_WEIGHT:
237
+ value: 0.5 # Weight for variance matching in saturation ring loss (vs mean matching)
238
+ RING_TEXTURE_WEIGHT:
239
+ value: 1.0 # Weight for texture consistency term in saturation ring loss
240
+ HLREG_W_L1:
241
+ value: 1.0 # Weight for L1 loss in highlight regression
242
+ HLREG_USE_CHARB:
243
+ value: True # Use Charbonnier loss (smooth L1) instead of standard L1 if True
244
+
245
+ ### ABLATION =======================================================================
246
+ HLREG_W_DICE:
247
+ value: 0.0 # Weight for Dice loss in highlight regression (for mask overlap)
248
+ ###=================================================================================
249
+ HLREG_W_SSIM:
250
+ value: 0.0 # Weight for SSIM loss in highlight regression
251
+ HLREG_W_GRAD:
252
+ value: 0.0 # Weight for gradient loss in highlight regression
253
+ HLREG_W_TV:
254
+ value: 0.0 # Weight for total variation loss in highlight regression
255
+ HLREG_BALANCE_MODE:
256
+ value: "auto" # Class balancing mode for highlight regression: 'none' | 'auto' | 'pos_weight'
257
+ HLREG_POS_WEIGHT:
258
+ value: 1.0 # Positive class weight (used only if BALANCE_MODE == 'pos_weight')
259
+ HLREG_FOCAL_GAMMA:
260
+ value: 2.0 # Focal loss gamma parameter (0.0 = standard BCE, 1.0-2.0 helps with gradient vanishing)
261
+
262
+ WEIGHT_TOKEN_INPAINT:
263
+ value: 1.0 # Weight for token-space inpainting loss (L1 + cosine similarity in feature space)
264
+ WEIGHT_CONTEXT_IDENTITY:
265
+ value: 0.0 # LEAVE TO 0.0: Weight for L1 loss on context (non-masked) regions (identity preservation)
266
+ WEIGHT_TV_IN_HOLE:
267
+ value: 0.0 # LEAVE TO 0.0: Weight for total variation loss inside masked/hole regions
268
+ RING_DILATE_KERNEL:
269
+ value: 17 # Dilation kernel size (odd number) for creating ring mask around highlights
270
+ WEIGHT_SEAM:
271
+ value: 0.5 # Weight for gradient matching loss on saturation ring
272
+ SEAM_USE_CHARB:
273
+ value: True # Use Charbonnier loss instead of L1 in seam loss (smooth L1 for boundary consistency)
274
+ SEAM_WEIGHT_GRAD:
275
+ value: 0.0 # Weight for gradient matching term inside seam loss (0.0 = disable gradient term)
276
+ TOKEN_FEAT_ALPHA:
277
+ value: 0.5 # Mixing factor for token feature loss: alpha * L1 + (1-alpha) * (1-cosine_sim)
278
+
279
+ ### DIFFUSE HIGHLIGHT PENALTY
280
+ WEIGHT_DIFFUSE_HIGHLIGHT_PENALTY:
281
+ value: 0.1 # Weight for penalty loss on highlights in diffuse decoder output (0.0 = disabled)
282
+ DIFFUSE_HL_THRESHOLD:
283
+ value: 0.8 # Brightness/luminance threshold for detecting highlights in diffuse (0.0-1.0)
284
+ DIFFUSE_HL_USE_CHARB:
285
+ value: True # Use Charbonnier loss instead of L1 for diffuse highlight penalty
286
+ DIFFUSE_HL_PENALTY_MODE:
287
+ value: "brightness" # Penalty mode: "brightness" (penalize brightness/luminance above threshold) or "pixel" (penalize RGB values directly)
288
+ DIFFUSE_HL_TARGET_BRIGHTNESS:
289
+ value: null # Target brightness/luminance for penalized pixels (null = use threshold value)
290
+ DIFFUSE_HL_USE_LUMINANCE:
291
+ value: False # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B); if False, use simple mean brightness
292
+
293
+ ### LOGGING, RESULTS AND WANDB
294
+ LOG_INTERVAL:
295
+ value: 1 # Number of training steps between console log outputs
296
+ WANDB_LOG_INTERVAL:
297
+ value: 1 # Number of training steps between WandB metric logs
298
+ IMAGE_LOG_INTERVAL:
299
+ value: 10 # Number of training steps between image logging to WandB
300
+ NO_WANDB:
301
+ value: False # Disable WandB logging if True (useful for local debugging)
302
+ MODEL_WATCHER_FREQ_WANDB:
303
+ value: 50 # Frequency (in steps) for logging model parameter histograms to WandB
304
+ WANDB_ENTITY:
305
+ value: "unreflect-anything" # WandB organization/entity name
306
+ WANDB_PROJECT:
307
+ value: "UnReflectAnything" # WandB project name
308
+ NOTES:
309
+ value: "Dice ablation - Rebuttal" # Notes/description for this training run
configs/rebuttal/ablate_L1.yaml ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### BASELINE: CONVERGES AFTER LONG
2
+
3
+ parameters:
4
+
5
+ ### MODEL ARCHITECTURE
6
+ MODEL:
7
+ value:
8
+ MODEL_CLASS: "UnReflect_Model_TokenInpainter" # Main model class name (must match class in models.py)
9
+ MODEL_MODULE: "models" # Module name to import model classes from (default: "models")
10
+ RGB_ENCODER:
11
+ ENCODER: "facebook/dinov3-vitl16-pretrain-lvd1689m" # DINOv3 encoder model name (HuggingFace format)
12
+ IMAGE_SIZE: 448 # Input image size (height and width in pixels)
13
+ RETURN_SELECTED_LAYERS: [3, 6, 9, 12] # Transformer layer indices to extract features from (0-indexed)
14
+ RGB_ENCODER_LR: 0.0 # Learning rate for RGB encoder (0.0 = frozen, must be explicitly set)
15
+ DECODERS:
16
+ diffuse:
17
+ USE_FILM: False # Enable FiLM (Feature-wise Linear Modulation) conditioning in decoder
18
+ FEATURE_DIM: 1024 # Feature dimension for decoder (should match encoder output)
19
+ REASSEMBLE_OUT_CHANNELS: [768,1024,1536,2048] # Output channels for each decoder stage (DPT-style reassembly)
20
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
21
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder ("ignore", "project", etc.)
22
+ FROM_PRETRAINED: "weights/rgb_decoder.pth" # Path to pretrained decoder weights (optional)
23
+ USE_BN: False # Use batch normalization in decoder
24
+ DROPOUT: 0.1 # Dropout rate in decoder layers
25
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
26
+ OUTPUT_CHANNELS: 3 # Number of output channels (3 for RGB diffuse image)
27
+ DECODER_LR: 1.0e-5 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
28
+ NUM_FUSION_BLOCKS_TRAINABLE: 1 # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
29
+ TRAIN_RGB_HEAD: True # Whether to train RGB head (true/false, null = train if DECODER_LR != 0)
30
+ highlight:
31
+ USE_FILM: False # Enable FiLM conditioning in highlight decoder
32
+ FEATURE_DIM: 1024 # Feature dimension for highlight decoder
33
+ REASSEMBLE_OUT_CHANNELS: [96,192,384,768] # Output channels for each decoder stage
34
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
35
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder
36
+ USE_BN: False # Use batch normalization in decoder
37
+ DROPOUT: 0.1 # Dropout rate in decoder layers
38
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
39
+ OUTPUT_CHANNELS: 1 # Number of output channels (1 for highlight mask)
40
+ DECODER_LR: 5.0e-4 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
41
+ NUM_FUSION_BLOCKS_TRAINABLE: null # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
42
+ TOKEN_INPAINTER:
43
+ TOKEN_INPAINTER_CLASS: "TokenInpainter_Prior" # Token inpainter class name
44
+ TOKEN_INPAINTER_MODULE: "token_inpainters" # Module name to import token inpainter from
45
+ FROM_PRETRAINED: "weights/token_inpainter.pth" # Path to pretrained token inpainter weights
46
+ TOKEN_INPAINTER_LR: 1.0e-5 # Learning rate for token inpainter (can differ from base LR)
47
+ DEPTH: 6 # Number of transformer blocks
48
+ HEADS: 16 # Number of attention heads
49
+ DROP: 0 # Dropout rate
50
+ USE_POSITIONAL_ENCODING: True # Enable 2D sinusoidal positional encodings
51
+ USE_FINAL_NORM: True # Enable final LayerNorm before output projection
52
+ USE_LOCAL_PRIOR: True # Blend local mean prior for masked seeds
53
+ LOCAL_PRIOR_WEIGHT: 0.5 # Weight for local prior blending (1.0 = only mask_token, 0.0 = only local mean)
54
+ LOCAL_PRIOR_KERNEL: 5 # Kernel size for local prior blending (> 1)
55
+ SEED_NOISE_STD: 0.02 # Standard deviation of noise added to masked seeds during training
56
+ INPAINT_MASK_DILATION:
57
+ value: 1 # Dilation kernel size (pixels) for inpaint mask - Must be odd
58
+ USE_TORCH_COMPILE: # Enable PyTorch 2.0 torch.compile for faster training (experimental)
59
+ value: False
60
+
61
+ ### DATA
62
+ DATASETS:
63
+ value:
64
+ SCRREAM:
65
+ VAL_SCENES: ["scene10_full_00","scene11_full_00","scene044_full_00","scene04_reduced_00","scene04_reduced_01","scene04_reduced_02"] # List of validation scene names
66
+ TARGET_SIZE: [448,448] # Target image size [height, width] in pixels
67
+ RESIZE_MODE: "resize+crop" # Image resizing mode: "resize", "crop", "resize+crop", or "pad"
68
+ FEW_IMAGES: False # If True, load only first 10 images per scene (for quick debugging)
69
+ SAMPLE_EVERY_N: 2 # Load every Nth frame from each scene (1 = all frames, 4 = every 4th frame)
70
+ LOAD_RGB_ONLY: True # If True, ignore polarization data and load only RGB images
71
+
72
+ HOUSECAT6D:
73
+ VAL_SCENES: ["val_scene1","val_scene2"] # Validation scene names
74
+ TARGET_SIZE: [448,448] # Target image size [height, width]
75
+ RESIZE_MODE: "resize+crop" # Image resizing mode
76
+ FEW_IMAGES: False # Load only first 10 images if True
77
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
78
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
79
+
80
+ CROMO:
81
+ TRAIN_SCENES: ["kitchen"] # Training scene names (list or string)
82
+ # VAL_SCENES: "station" # Validation scene names (optional)
83
+ TARGET_SIZE: [448,448] # Target image size [height, width]
84
+ RESIZE_MODE: "resize" # Image resizing mode
85
+ FEW_IMAGES: False # Load only first 10 images if True
86
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
87
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
88
+
89
+ PSD:
90
+ TRAIN_SCENES: "PSD_Train" # Training scene name (string or list)
91
+ VAL_SCENES: "PSD_Val" # Validation scene name (string or list)
92
+ TARGET_SIZE: [448,448] # Target image size [height, width]
93
+ RESIZE_MODE: "resize+crop" # Image resizing mode
94
+ FEW_IMAGES: False # Load only first 10 images if True
95
+ SAMPLE_EVERY_N: 1 # Load every Nth frame (1 = all frames)
96
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
97
+
98
+ SCARED:
99
+ VAL_SCENES: ["v22","v23","v24","v25","v26","v27","v28","v29","v30","v31","v32","v33","v34"] # Validation scene names
100
+ TARGET_SIZE: [448,448] # Target image size [height, width]
101
+ RESIZE_MODE: "resize" #"resize+crop" # Image resizing mode
102
+ SAMPLE_EVERY_N: 1 # Load every Nth frame
103
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
104
+ FEW_IMAGES: False # Load only first 10 images if True
105
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing in dataset
106
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection (0-1)
107
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
108
+ HIGHLIGHT_RECT_SIZE: [1000, 1000] # Size of highlight rectangle region [height, width]
109
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
110
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
111
+
112
+ STEREOMIS_TRACKING:
113
+ VAL_SCENES: ["P2_2"] # Validation scene names
114
+ TARGET_SIZE: [448,448] # Target image size [height, width]
115
+ RESIZE_MODE: "resize+crop" # Image resizing mode
116
+ SAMPLE_EVERY_N: 4 # Load every Nth frame
117
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
118
+ FEW_IMAGES: False # Load only first 10 images if True
119
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
120
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
121
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
122
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
123
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
124
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
125
+
126
+ CHOLEC80:
127
+ VAL_SCENES: ["val"] # Validation scene names
128
+ TARGET_SIZE: [448,448] # Target image size [height, width]
129
+ RESIZE_MODE: "resize+crop" # Image resizing mode
130
+ SAMPLE_EVERY_N: 10 # Load every Nth frame
131
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
132
+ FEW_IMAGES: False # Load only first 10 images if True
133
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
134
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
135
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
136
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
137
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
138
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
139
+
140
+ # POLARGB:
141
+ # TRAIN_SCENES: "train"
142
+ # VAL_SCENES: "test"
143
+ # TARGET_SIZE: [448,448]
144
+ # RESIZE_MODE: "resize+crop"
145
+ # SAMPLE_EVERY_N: 1
146
+ # LOAD_RGB_ONLY: True
147
+
148
+ BATCH_SIZE: # Max batch size with img size 448 is 32
149
+ value: 12 # Number of samples per batch (adjust based on GPU memory)
150
+ NUM_WORKERS:
151
+ value: 8 # Number of data loading worker processes (0 = main process only)
152
+ SHUFFLE:
153
+ value: True # Shuffle training data each epoch (False for validation/test)
154
+ PIN_MEMORY:
155
+ value: True # Pin memory in DataLoader for faster GPU transfer (recommended: True)
156
+ PREFETCH_FACTOR:
157
+ value: 2 # Number of batches to prefetch per worker (higher = more memory usage)
158
+
159
+ ### HIGHLIGHTS
160
+ MOGE_MODEL:
161
+ value: "Ruicheng/moge-2-vits-normal" # MoGe model name for normal estimation (HuggingFace format)
162
+ SURFACE_ROUGHNESS:
163
+ value: 8.0 # Blinn-Phong surface roughness exponent (higher = sharper highlights)
164
+ INTENSITY:
165
+ value: 2.0 # Specular highlight intensity multiplier
166
+ LIGHT_DISTANCE_RANGE:
167
+ value: [0.0, 1] # Range for light source distance sampling [min, max] (normalized)
168
+ LIGHT_LEFT_RIGHT_ANGLE:
169
+ value: [0, 360] # Range for light source horizontal angle [min, max] in degrees
170
+ LIGHT_ABOVE_BELOW_ANGLE:
171
+ value: [0, 360] # Range for light source vertical angle [min, max] in degrees
172
+ DATASET_HIGHLIGHT_DILATION:
173
+ value: 25 # Dilation kernel size (pixels) for dataset highlight masks
174
+ DATASET_HIGHLIGHT_THRESHOLD:
175
+ value: 0.9 # Brightness/luminance threshold (0-1) for detecting highlights in dataset images
176
+ DATASET_HIGHLIGHT_USE_LUMINANCE:
177
+ value: True # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B) for dataset highlights; if False, use simple mean brightness
178
+ HIGHLIGHT_COLOR:
179
+ value: [1.0, 1.0, 1.0] # RGB color for synthetic highlights (normalized 0-1)
180
+ CLAMP_RECONSTRUCTION:
181
+ value: True # Clamp reconstructed images to [0, 1] range if True
182
+
183
+ ### OPTIMIZATION
184
+ LEARNING_RATE:
185
+ value: 1.0e-3 # Base learning rate for optimizer
186
+ WEIGHT_DECAY:
187
+ value: 0.0 # L2 regularization weight (0.0 = no weight decay)
188
+ EPOCHS:
189
+ value: 25 # Maximum number of training epochs
190
+ GRADIENT_ACCUMULATION_STEPS:
191
+ value: 1 # Number of steps to accumulate gradients before optimizer step (1 = no accumulation)
192
+ WARMUP:
193
+ value: 200 # Number of warmup steps for learning rate schedule (linear warmup from 0 to LR)
194
+ GRADIENT_CLIPPING_MAX_NORM:
195
+ value: 8 # Maximum gradient norm for clipping (set to -1 to disable clipping)
196
+ LR_SCHEDULER:
197
+ value:
198
+ ONPLATEAU: # ReduceLROnPlateau scheduler (reduces LR when validation metric plateaus)
199
+ PATIENCE: 5 # Number of epochs to wait before reducing LR
200
+ FACTOR: 0.1 # Factor by which LR is reduced (new_lr = old_lr * factor)
201
+ COSINE: # CosineAnnealingLR scheduler (cosine annealing schedule)
202
+ N_PERIODS: 1 # Number of cosine periods over training
203
+ # STEPWISE: # StepLR scheduler (reduces LR at fixed step intervals)
204
+ # N_STEPS: 4 # Number of times to reduce LR during training
205
+ # GAMMA: 0.5 # Factor by which LR is reduced at each step (new_lr = old_lr * gamma)
206
+ # EXPONENTIAL: # ExponentialLR scheduler (exponential decay)
207
+ # GAMMA: 0.5 # Multiplicative factor for exponential decay
208
+
209
+ SWITCH_OPTIMIZER_EPOCH:
210
+ value: null # Epoch number to switch from bootstrap to refining optimizer (null = no switch)
211
+ OPTIMIZER_BOOTSTRAP_NAME:
212
+ value: "AdamW" # Optimizer name for initial training phase ("Adam", "SGD", etc.)
213
+ OPTIMIZER_REFINING_NAME:
214
+ value: "AdamW" # Optimizer name for refining phase (used after SWITCH_OPTIMIZER_EPOCH)
215
+ EARLY_STOPPING_PATIENCE:
216
+ value: 10 # Number of epochs without improvement before stopping training
217
+ SAVE_INTERVAL:
218
+ value: 1000 # Number of training steps between model checkpoints
219
+
220
+ DATASET_HIGHLIGHT_SUPERVISION_THRESHOLD:
221
+ value: 0.1 # Pixel highlights above this threshold (should be low) are excluded from supervision
222
+
223
+ ### LOSS WEIGHTS (relative to the total loss, NOT NORMALIZED LATER)
224
+ SPECULAR_LOSS_WEIGHT:
225
+ value: 0.0 # Weight for specular component reconstruction loss
226
+ DIFFUSE_LOSS_WEIGHT:
227
+ value: 1.0 # Weight for diffuse component reconstruction loss
228
+ HIGHLIGHT_LOSS_WEIGHT:
229
+ value: 1.0 # Weight for highlight mask regression loss
230
+ IMAGE_RECONSTRUCTION_LOSS_WEIGHT:
231
+ value: 0.0 # Weight for full image reconstruction loss
232
+ SATURATION_RING_LOSS_WEIGHT:
233
+ value: 0.0 # Weight for saturation ring consistency loss (around highlight regions)
234
+ RING_KERNEL_SIZE:
235
+ value: 11 # Kernel size (odd number) for saturation ring dilation around highlights
236
+ RING_VAR_WEIGHT:
237
+ value: 0.5 # Weight for variance matching in saturation ring loss (vs mean matching)
238
+ RING_TEXTURE_WEIGHT:
239
+ value: 1.0 # Weight for texture consistency term in saturation ring loss
240
+ ### ABLATION =======================================================================
241
+ HLREG_W_L1:
242
+ value: 0.0 # Weight for L1 loss in highlight regression
243
+ ###=================================================================================
244
+ HLREG_USE_CHARB:
245
+ value: True # Use Charbonnier loss (smooth L1) instead of standard L1 if True
246
+ HLREG_W_DICE:
247
+ value: 0.2 # Weight for Dice loss in highlight regression (for mask overlap)
248
+ HLREG_W_SSIM:
249
+ value: 0.0 # Weight for SSIM loss in highlight regression
250
+ HLREG_W_GRAD:
251
+ value: 0.0 # Weight for gradient loss in highlight regression
252
+ HLREG_W_TV:
253
+ value: 0.0 # Weight for total variation loss in highlight regression
254
+ HLREG_BALANCE_MODE:
255
+ value: "auto" # Class balancing mode for highlight regression: 'none' | 'auto' | 'pos_weight'
256
+ HLREG_POS_WEIGHT:
257
+ value: 1.0 # Positive class weight (used only if BALANCE_MODE == 'pos_weight')
258
+ HLREG_FOCAL_GAMMA:
259
+ value: 2.0 # Focal loss gamma parameter (0.0 = standard BCE, 1.0-2.0 helps with gradient vanishing)
260
+
261
+ WEIGHT_TOKEN_INPAINT:
262
+ value: 1.0 # Weight for token-space inpainting loss (L1 + cosine similarity in feature space)
263
+ WEIGHT_CONTEXT_IDENTITY:
264
+ value: 0.0 # LEAVE TO 0.0: Weight for L1 loss on context (non-masked) regions (identity preservation)
265
+ WEIGHT_TV_IN_HOLE:
266
+ value: 0.0 # LEAVE TO 0.0: Weight for total variation loss inside masked/hole regions
267
+ RING_DILATE_KERNEL:
268
+ value: 17 # Dilation kernel size (odd number) for creating ring mask around highlights
269
+ WEIGHT_SEAM:
270
+ value: 0.5 # Weight for gradient matching loss on saturation ring
271
+ SEAM_USE_CHARB:
272
+ value: True # Use Charbonnier loss instead of L1 in seam loss (smooth L1 for boundary consistency)
273
+ SEAM_WEIGHT_GRAD:
274
+ value: 0.0 # Weight for gradient matching term inside seam loss (0.0 = disable gradient term)
275
+ TOKEN_FEAT_ALPHA:
276
+ value: 0.5 # Mixing factor for token feature loss: alpha * L1 + (1-alpha) * (1-cosine_sim)
277
+
278
+ ### DIFFUSE HIGHLIGHT PENALTY
279
+ WEIGHT_DIFFUSE_HIGHLIGHT_PENALTY:
280
+ value: 0.1 # Weight for penalty loss on highlights in diffuse decoder output (0.0 = disabled)
281
+ DIFFUSE_HL_THRESHOLD:
282
+ value: 0.8 # Brightness/luminance threshold for detecting highlights in diffuse (0.0-1.0)
283
+ DIFFUSE_HL_USE_CHARB:
284
+ value: True # Use Charbonnier loss instead of L1 for diffuse highlight penalty
285
+ DIFFUSE_HL_PENALTY_MODE:
286
+ value: "brightness" # Penalty mode: "brightness" (penalize brightness/luminance above threshold) or "pixel" (penalize RGB values directly)
287
+ DIFFUSE_HL_TARGET_BRIGHTNESS:
288
+ value: null # Target brightness/luminance for penalized pixels (null = use threshold value)
289
+ DIFFUSE_HL_USE_LUMINANCE:
290
+ value: False # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B); if False, use simple mean brightness
291
+
292
+ ### LOGGING, RESULTS AND WANDB
293
+ LOG_INTERVAL:
294
+ value: 1 # Number of training steps between console log outputs
295
+ WANDB_LOG_INTERVAL:
296
+ value: 1 # Number of training steps between WandB metric logs
297
+ IMAGE_LOG_INTERVAL:
298
+ value: 10 # Number of training steps between image logging to WandB
299
+ NO_WANDB:
300
+ value: False # Disable WandB logging if True (useful for local debugging)
301
+ MODEL_WATCHER_FREQ_WANDB:
302
+ value: 50 # Frequency (in steps) for logging model parameter histograms to WandB
303
+ WANDB_ENTITY:
304
+ value: "unreflect-anything" # WandB organization/entity name
305
+ WANDB_PROJECT:
306
+ value: "UnReflectAnything" # WandB project name
307
+ NOTES:
308
+ value: "L1 ablation - Rebuttal" # Notes/description for this training run
configs/rebuttal/ablate_LMasktoken.yaml ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### BASELINE: CONVERGES AFTER LONG
2
+
3
+ parameters:
4
+
5
+ ### MODEL ARCHITECTURE
6
+ MODEL:
7
+ value:
8
+ MODEL_CLASS: "UnReflect_Model_TokenInpainter" # Main model class name (must match class in models.py)
9
+ MODEL_MODULE: "models" # Module name to import model classes from (default: "models")
10
+ RGB_ENCODER:
11
+ ENCODER: "facebook/dinov3-vitl16-pretrain-lvd1689m" # DINOv3 encoder model name (HuggingFace format)
12
+ IMAGE_SIZE: 448 # Input image size (height and width in pixels)
13
+ RETURN_SELECTED_LAYERS: [3, 6, 9, 12] # Transformer layer indices to extract features from (0-indexed)
14
+ RGB_ENCODER_LR: 0.0 # Learning rate for RGB encoder (0.0 = frozen, must be explicitly set)
15
+ DECODERS:
16
+ diffuse:
17
+ USE_FILM: False # Enable FiLM (Feature-wise Linear Modulation) conditioning in decoder
18
+ FEATURE_DIM: 1024 # Feature dimension for decoder (should match encoder output)
19
+ REASSEMBLE_OUT_CHANNELS: [768,1024,1536,2048] # Output channels for each decoder stage (DPT-style reassembly)
20
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
21
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder ("ignore", "project", etc.)
22
+ FROM_PRETRAINED: "weights/rgb_decoder.pth" # Path to pretrained decoder weights (optional)
23
+ USE_BN: False # Use batch normalization in decoder
24
+ DROPOUT: 0.1 # Dropout rate in decoder layers
25
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
26
+ OUTPUT_CHANNELS: 3 # Number of output channels (3 for RGB diffuse image)
27
+ DECODER_LR: 1.0e-5 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
28
+ NUM_FUSION_BLOCKS_TRAINABLE: 1 # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
29
+ TRAIN_RGB_HEAD: True # Whether to train RGB head (true/false, null = train if DECODER_LR != 0)
30
+ highlight:
31
+ USE_FILM: False # Enable FiLM conditioning in highlight decoder
32
+ FEATURE_DIM: 1024 # Feature dimension for highlight decoder
33
+ REASSEMBLE_OUT_CHANNELS: [96,192,384,768] # Output channels for each decoder stage
34
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
35
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder
36
+ USE_BN: False # Use batch normalization in decoder
37
+ DROPOUT: 0.1 # Dropout rate in decoder layers
38
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
39
+ OUTPUT_CHANNELS: 1 # Number of output channels (1 for highlight mask)
40
+ DECODER_LR: 5.0e-4 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
41
+ NUM_FUSION_BLOCKS_TRAINABLE: null # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
42
+ TOKEN_INPAINTER:
43
+ TOKEN_INPAINTER_CLASS: "TokenInpainter_Prior" # Token inpainter class name
44
+ TOKEN_INPAINTER_MODULE: "token_inpainters" # Module name to import token inpainter from
45
+ FROM_PRETRAINED: "weights/token_inpainter.pth" # Path to pretrained token inpainter weights
46
+ TOKEN_INPAINTER_LR: 1.0e-5 # Learning rate for token inpainter (can differ from base LR)
47
+ DEPTH: 6 # Number of transformer blocks
48
+ HEADS: 16 # Number of attention heads
49
+ DROP: 0 # Dropout rate
50
+ USE_POSITIONAL_ENCODING: True # Enable 2D sinusoidal positional encodings
51
+ USE_FINAL_NORM: True # Enable final LayerNorm before output projection
52
+ USE_LOCAL_PRIOR: True # Blend local mean prior for masked seeds
53
+ ### ABLATION =======================================================================
54
+ LOCAL_PRIOR_WEIGHT: 1.0 # Weight for local prior blending (1.0 = only mask_token, 0.0 = only local mean)
55
+ ###=================================================================================
56
+ LOCAL_PRIOR_KERNEL: 5 # Kernel size for local prior blending (> 1)
57
+ SEED_NOISE_STD: 0.02 # Standard deviation of noise added to masked seeds during training
58
+ INPAINT_MASK_DILATION:
59
+ value: 1 # Dilation kernel size (pixels) for inpaint mask - Must be odd
60
+ USE_TORCH_COMPILE: # Enable PyTorch 2.0 torch.compile for faster training (experimental)
61
+ value: False
62
+
63
+ ### DATA
64
+ DATASETS:
65
+ value:
66
+ SCRREAM:
67
+ VAL_SCENES: ["scene10_full_00","scene11_full_00","scene044_full_00","scene04_reduced_00","scene04_reduced_01","scene04_reduced_02"] # List of validation scene names
68
+ TARGET_SIZE: [448,448] # Target image size [height, width] in pixels
69
+ RESIZE_MODE: "resize+crop" # Image resizing mode: "resize", "crop", "resize+crop", or "pad"
70
+ FEW_IMAGES: False # If True, load only first 10 images per scene (for quick debugging)
71
+ SAMPLE_EVERY_N: 2 # Load every Nth frame from each scene (1 = all frames, 4 = every 4th frame)
72
+ LOAD_RGB_ONLY: True # If True, ignore polarization data and load only RGB images
73
+
74
+ HOUSECAT6D:
75
+ VAL_SCENES: ["val_scene1","val_scene2"] # Validation scene names
76
+ TARGET_SIZE: [448,448] # Target image size [height, width]
77
+ RESIZE_MODE: "resize+crop" # Image resizing mode
78
+ FEW_IMAGES: False # Load only first 10 images if True
79
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
80
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
81
+
82
+ CROMO:
83
+ TRAIN_SCENES: ["kitchen"] # Training scene names (list or string)
84
+ # VAL_SCENES: "station" # Validation scene names (optional)
85
+ TARGET_SIZE: [448,448] # Target image size [height, width]
86
+ RESIZE_MODE: "resize" # Image resizing mode
87
+ FEW_IMAGES: False # Load only first 10 images if True
88
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
89
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
90
+
91
+ PSD:
92
+ TRAIN_SCENES: "PSD_Train" # Training scene name (string or list)
93
+ VAL_SCENES: "PSD_Val" # Validation scene name (string or list)
94
+ TARGET_SIZE: [448,448] # Target image size [height, width]
95
+ RESIZE_MODE: "resize+crop" # Image resizing mode
96
+ FEW_IMAGES: False # Load only first 10 images if True
97
+ SAMPLE_EVERY_N: 1 # Load every Nth frame (1 = all frames)
98
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
99
+
100
+ SCARED:
101
+ VAL_SCENES: ["v22","v23","v24","v25","v26","v27","v28","v29","v30","v31","v32","v33","v34"] # Validation scene names
102
+ TARGET_SIZE: [448,448] # Target image size [height, width]
103
+ RESIZE_MODE: "resize" #"resize+crop" # Image resizing mode
104
+ SAMPLE_EVERY_N: 1 # Load every Nth frame
105
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
106
+ FEW_IMAGES: False # Load only first 10 images if True
107
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing in dataset
108
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection (0-1)
109
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
110
+ HIGHLIGHT_RECT_SIZE: [1000, 1000] # Size of highlight rectangle region [height, width]
111
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
112
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
113
+
114
+ STEREOMIS_TRACKING:
115
+ VAL_SCENES: ["P2_2"] # Validation scene names
116
+ TARGET_SIZE: [448,448] # Target image size [height, width]
117
+ RESIZE_MODE: "resize+crop" # Image resizing mode
118
+ SAMPLE_EVERY_N: 4 # Load every Nth frame
119
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
120
+ FEW_IMAGES: False # Load only first 10 images if True
121
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
122
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
123
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
124
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
125
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
126
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
127
+
128
+ CHOLEC80:
129
+ VAL_SCENES: ["val"] # Validation scene names
130
+ TARGET_SIZE: [448,448] # Target image size [height, width]
131
+ RESIZE_MODE: "resize+crop" # Image resizing mode
132
+ SAMPLE_EVERY_N: 10 # Load every Nth frame
133
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
134
+ FEW_IMAGES: False # Load only first 10 images if True
135
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
136
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
137
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
138
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
139
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
140
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
141
+
142
+ # POLARGB:
143
+ # TRAIN_SCENES: "train"
144
+ # VAL_SCENES: "test"
145
+ # TARGET_SIZE: [448,448]
146
+ # RESIZE_MODE: "resize+crop"
147
+ # SAMPLE_EVERY_N: 1
148
+ # LOAD_RGB_ONLY: True
149
+
150
+ BATCH_SIZE: # Max batch size with img size 448 is 32
151
+ value: 16 # Number of samples per batch (adjust based on GPU memory)
152
+ NUM_WORKERS:
153
+ value: 8 # Number of data loading worker processes (0 = main process only)
154
+ SHUFFLE:
155
+ value: True # Shuffle training data each epoch (False for validation/test)
156
+ PIN_MEMORY:
157
+ value: True # Pin memory in DataLoader for faster GPU transfer (recommended: True)
158
+ PREFETCH_FACTOR:
159
+ value: 2 # Number of batches to prefetch per worker (higher = more memory usage)
160
+
161
+ ### HIGHLIGHTS
162
+ MOGE_MODEL:
163
+ value: "Ruicheng/moge-2-vits-normal" # MoGe model name for normal estimation (HuggingFace format)
164
+ SURFACE_ROUGHNESS:
165
+ value: 8.0 # Blinn-Phong surface roughness exponent (higher = sharper highlights)
166
+ INTENSITY:
167
+ value: 2.0 # Specular highlight intensity multiplier
168
+ LIGHT_DISTANCE_RANGE:
169
+ value: [0.0, 1] # Range for light source distance sampling [min, max] (normalized)
170
+ LIGHT_LEFT_RIGHT_ANGLE:
171
+ value: [0, 360] # Range for light source horizontal angle [min, max] in degrees
172
+ LIGHT_ABOVE_BELOW_ANGLE:
173
+ value: [0, 360] # Range for light source vertical angle [min, max] in degrees
174
+ DATASET_HIGHLIGHT_DILATION:
175
+ value: 25 # Dilation kernel size (pixels) for dataset highlight masks
176
+ DATASET_HIGHLIGHT_THRESHOLD:
177
+ value: 0.9 # Brightness/luminance threshold (0-1) for detecting highlights in dataset images
178
+ DATASET_HIGHLIGHT_USE_LUMINANCE:
179
+ value: True # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B) for dataset highlights; if False, use simple mean brightness
180
+ HIGHLIGHT_COLOR:
181
+ value: [1.0, 1.0, 1.0] # RGB color for synthetic highlights (normalized 0-1)
182
+ CLAMP_RECONSTRUCTION:
183
+ value: True # Clamp reconstructed images to [0, 1] range if True
184
+
185
+ ### OPTIMIZATION
186
+ LEARNING_RATE:
187
+ value: 1.0e-3 # Base learning rate for optimizer
188
+ WEIGHT_DECAY:
189
+ value: 0.0 # L2 regularization weight (0.0 = no weight decay)
190
+ EPOCHS:
191
+ value: 25 # Maximum number of training epochs
192
+ GRADIENT_ACCUMULATION_STEPS:
193
+ value: 1 # Number of steps to accumulate gradients before optimizer step (1 = no accumulation)
194
+ WARMUP:
195
+ value: 200 # Number of warmup steps for learning rate schedule (linear warmup from 0 to LR)
196
+ GRADIENT_CLIPPING_MAX_NORM:
197
+ value: 8 # Maximum gradient norm for clipping (set to -1 to disable clipping)
198
+ LR_SCHEDULER:
199
+ value:
200
+ ONPLATEAU: # ReduceLROnPlateau scheduler (reduces LR when validation metric plateaus)
201
+ PATIENCE: 5 # Number of epochs to wait before reducing LR
202
+ FACTOR: 0.1 # Factor by which LR is reduced (new_lr = old_lr * factor)
203
+ COSINE: # CosineAnnealingLR scheduler (cosine annealing schedule)
204
+ N_PERIODS: 1 # Number of cosine periods over training
205
+ # STEPWISE: # StepLR scheduler (reduces LR at fixed step intervals)
206
+ # N_STEPS: 4 # Number of times to reduce LR during training
207
+ # GAMMA: 0.5 # Factor by which LR is reduced at each step (new_lr = old_lr * gamma)
208
+ # EXPONENTIAL: # ExponentialLR scheduler (exponential decay)
209
+ # GAMMA: 0.5 # Multiplicative factor for exponential decay
210
+
211
+ SWITCH_OPTIMIZER_EPOCH:
212
+ value: null # Epoch number to switch from bootstrap to refining optimizer (null = no switch)
213
+ OPTIMIZER_BOOTSTRAP_NAME:
214
+ value: "AdamW" # Optimizer name for initial training phase ("Adam", "SGD", etc.)
215
+ OPTIMIZER_REFINING_NAME:
216
+ value: "AdamW" # Optimizer name for refining phase (used after SWITCH_OPTIMIZER_EPOCH)
217
+ EARLY_STOPPING_PATIENCE:
218
+ value: 10 # Number of epochs without improvement before stopping training
219
+ SAVE_INTERVAL:
220
+ value: 1000 # Number of training steps between model checkpoints
221
+
222
+ DATASET_HIGHLIGHT_SUPERVISION_THRESHOLD:
223
+ value: 0.1 # Pixel highlights above this threshold (should be low) are excluded from supervision
224
+
225
+ ### LOSS WEIGHTS (relative to the total loss, NOT NORMALIZED LATER)
226
+ SPECULAR_LOSS_WEIGHT:
227
+ value: 0.0 # Weight for specular component reconstruction loss
228
+ DIFFUSE_LOSS_WEIGHT:
229
+ value: 1.0 # Weight for diffuse component reconstruction loss
230
+ HIGHLIGHT_LOSS_WEIGHT:
231
+ value: 1.0 # Weight for highlight mask regression loss
232
+ IMAGE_RECONSTRUCTION_LOSS_WEIGHT:
233
+ value: 0.0 # Weight for full image reconstruction loss
234
+ SATURATION_RING_LOSS_WEIGHT:
235
+ value: 0.0 # Weight for saturation ring consistency loss (around highlight regions)
236
+ RING_KERNEL_SIZE:
237
+ value: 11 # Kernel size (odd number) for saturation ring dilation around highlights
238
+ RING_VAR_WEIGHT:
239
+ value: 0.5 # Weight for variance matching in saturation ring loss (vs mean matching)
240
+ RING_TEXTURE_WEIGHT:
241
+ value: 1.0 # Weight for texture consistency term in saturation ring loss
242
+ HLREG_W_L1:
243
+ value: 1.0 # Weight for L1 loss in highlight regression
244
+ HLREG_USE_CHARB:
245
+ value: True # Use Charbonnier loss (smooth L1) instead of standard L1 if True
246
+ HLREG_W_DICE:
247
+ value: 0.2 # Weight for Dice loss in highlight regression (for mask overlap)
248
+ HLREG_W_SSIM:
249
+ value: 0.0 # Weight for SSIM loss in highlight regression
250
+ HLREG_W_GRAD:
251
+ value: 0.0 # Weight for gradient loss in highlight regression
252
+ HLREG_W_TV:
253
+ value: 0.0 # Weight for total variation loss in highlight regression
254
+ HLREG_BALANCE_MODE:
255
+ value: "auto" # Class balancing mode for highlight regression: 'none' | 'auto' | 'pos_weight'
256
+ HLREG_POS_WEIGHT:
257
+ value: 1.0 # Positive class weight (used only if BALANCE_MODE == 'pos_weight')
258
+ HLREG_FOCAL_GAMMA:
259
+ value: 2.0 # Focal loss gamma parameter (0.0 = standard BCE, 1.0-2.0 helps with gradient vanishing)
260
+
261
+ WEIGHT_TOKEN_INPAINT:
262
+ value: 1.0 # Weight for token-space inpainting loss (L1 + cosine similarity in feature space)
263
+ WEIGHT_CONTEXT_IDENTITY:
264
+ value: 0.0 # LEAVE TO 0.0: Weight for L1 loss on context (non-masked) regions (identity preservation)
265
+ WEIGHT_TV_IN_HOLE:
266
+ value: 0.0 # LEAVE TO 0.0: Weight for total variation loss inside masked/hole regions
267
+ RING_DILATE_KERNEL:
268
+ value: 17 # Dilation kernel size (odd number) for creating ring mask around highlights
269
+ WEIGHT_SEAM:
270
+ value: 0.5 # Weight for gradient matching loss on saturation ring
271
+ SEAM_USE_CHARB:
272
+ value: True # Use Charbonnier loss instead of L1 in seam loss (smooth L1 for boundary consistency)
273
+ SEAM_WEIGHT_GRAD:
274
+ value: 0.0 # Weight for gradient matching term inside seam loss (0.0 = disable gradient term)
275
+ TOKEN_FEAT_ALPHA:
276
+ value: 0.5 # Mixing factor for token feature loss: alpha * L1 + (1-alpha) * (1-cosine_sim)
277
+
278
+ ### DIFFUSE HIGHLIGHT PENALTY
279
+ WEIGHT_DIFFUSE_HIGHLIGHT_PENALTY:
280
+ value: 0.1 # Weight for penalty loss on highlights in diffuse decoder output (0.0 = disabled)
281
+ DIFFUSE_HL_THRESHOLD:
282
+ value: 0.8 # Brightness/luminance threshold for detecting highlights in diffuse (0.0-1.0)
283
+ DIFFUSE_HL_USE_CHARB:
284
+ value: True # Use Charbonnier loss instead of L1 for diffuse highlight penalty
285
+ DIFFUSE_HL_PENALTY_MODE:
286
+ value: "brightness" # Penalty mode: "brightness" (penalize brightness/luminance above threshold) or "pixel" (penalize RGB values directly)
287
+ DIFFUSE_HL_TARGET_BRIGHTNESS:
288
+ value: null # Target brightness/luminance for penalized pixels (null = use threshold value)
289
+ DIFFUSE_HL_USE_LUMINANCE:
290
+ value: False # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B); if False, use simple mean brightness
291
+
292
+ ### LOGGING, RESULTS AND WANDB
293
+ LOG_INTERVAL:
294
+ value: 1 # Number of training steps between console log outputs
295
+ WANDB_LOG_INTERVAL:
296
+ value: 1 # Number of training steps between WandB metric logs
297
+ IMAGE_LOG_INTERVAL:
298
+ value: 10 # Number of training steps between image logging to WandB
299
+ NO_WANDB:
300
+ value: False # Disable WandB logging if True (useful for local debugging)
301
+ MODEL_WATCHER_FREQ_WANDB:
302
+ value: 50 # Frequency (in steps) for logging model parameter histograms to WandB
303
+ WANDB_ENTITY:
304
+ value: "unreflect-anything" # WandB organization/entity name
305
+ WANDB_PROJECT:
306
+ value: "UnReflectAnything" # WandB project name
307
+ NOTES:
308
+ value: "Learned mask token ablation - Rebuttal" # Notes/description for this training run
configs/rebuttal/ablate_PosEnc.yaml ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### BASELINE: CONVERGES AFTER LONG
2
+
3
+ parameters:
4
+
5
+ ### MODEL ARCHITECTURE
6
+ MODEL:
7
+ value:
8
+ MODEL_CLASS: "UnReflect_Model_TokenInpainter" # Main model class name (must match class in models.py)
9
+ MODEL_MODULE: "models" # Module name to import model classes from (default: "models")
10
+ RGB_ENCODER:
11
+ ENCODER: "facebook/dinov3-vitl16-pretrain-lvd1689m" # DINOv3 encoder model name (HuggingFace format)
12
+ IMAGE_SIZE: 448 # Input image size (height and width in pixels)
13
+ RETURN_SELECTED_LAYERS: [3, 6, 9, 12] # Transformer layer indices to extract features from (0-indexed)
14
+ RGB_ENCODER_LR: 0.0 # Learning rate for RGB encoder (0.0 = frozen, must be explicitly set)
15
+ DECODERS:
16
+ diffuse:
17
+ USE_FILM: False # Enable FiLM (Feature-wise Linear Modulation) conditioning in decoder
18
+ FEATURE_DIM: 1024 # Feature dimension for decoder (should match encoder output)
19
+ REASSEMBLE_OUT_CHANNELS: [768,1024,1536,2048] # Output channels for each decoder stage (DPT-style reassembly)
20
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
21
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder ("ignore", "project", etc.)
22
+ FROM_PRETRAINED: "weights/rgb_decoder.pth" # Path to pretrained decoder weights (optional)
23
+ USE_BN: False # Use batch normalization in decoder
24
+ DROPOUT: 0.1 # Dropout rate in decoder layers
25
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
26
+ OUTPUT_CHANNELS: 3 # Number of output channels (3 for RGB diffuse image)
27
+ DECODER_LR: 1.0e-5 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
28
+ NUM_FUSION_BLOCKS_TRAINABLE: 1 # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
29
+ TRAIN_RGB_HEAD: True # Whether to train RGB head (true/false, null = train if DECODER_LR != 0)
30
+ highlight:
31
+ USE_FILM: False # Enable FiLM conditioning in highlight decoder
32
+ FEATURE_DIM: 1024 # Feature dimension for highlight decoder
33
+ REASSEMBLE_OUT_CHANNELS: [96,192,384,768] # Output channels for each decoder stage
34
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
35
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder
36
+ USE_BN: False # Use batch normalization in decoder
37
+ DROPOUT: 0.1 # Dropout rate in decoder layers
38
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
39
+ OUTPUT_CHANNELS: 1 # Number of output channels (1 for highlight mask)
40
+ DECODER_LR: 5.0e-4 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
41
+ NUM_FUSION_BLOCKS_TRAINABLE: null # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
42
+ TOKEN_INPAINTER:
43
+ TOKEN_INPAINTER_CLASS: "TokenInpainter_Prior" # Token inpainter class name
44
+ TOKEN_INPAINTER_MODULE: "token_inpainters" # Module name to import token inpainter from
45
+ FROM_PRETRAINED: "weights/token_inpainter.pth" # Path to pretrained token inpainter weights
46
+ TOKEN_INPAINTER_LR: 1.0e-5 # Learning rate for token inpainter (can differ from base LR)
47
+ DEPTH: 6 # Number of transformer blocks
48
+ HEADS: 16 # Number of attention heads
49
+ DROP: 0 # Dropout rate
50
+ ### ABLATION =======================================================================
51
+ USE_POSITIONAL_ENCODING: False # Enable 2D sinusoidal positional encodings
52
+ ###=================================================================================
53
+ USE_FINAL_NORM: True # Enable final LayerNorm before output projection
54
+ USE_LOCAL_PRIOR: True # Blend local mean prior for masked seeds
55
+ LOCAL_PRIOR_WEIGHT: 0.5 # Weight for local prior blending (1.0 = only mask_token, 0.0 = only local mean)
56
+ LOCAL_PRIOR_KERNEL: 5 # Kernel size for local prior blending (> 1)
57
+ SEED_NOISE_STD: 0.02 # Standard deviation of noise added to masked seeds during training
58
+ INPAINT_MASK_DILATION:
59
+ value: 1 # Dilation kernel size (pixels) for inpaint mask - Must be odd
60
+ USE_TORCH_COMPILE: # Enable PyTorch 2.0 torch.compile for faster training (experimental)
61
+ value: False
62
+
63
+ ### DATA
64
+ DATASETS:
65
+ value:
66
+ SCRREAM:
67
+ VAL_SCENES: ["scene10_full_00","scene11_full_00","scene044_full_00","scene04_reduced_00","scene04_reduced_01","scene04_reduced_02"] # List of validation scene names
68
+ TARGET_SIZE: [448,448] # Target image size [height, width] in pixels
69
+ RESIZE_MODE: "resize+crop" # Image resizing mode: "resize", "crop", "resize+crop", or "pad"
70
+ FEW_IMAGES: False # If True, load only first 10 images per scene (for quick debugging)
71
+ SAMPLE_EVERY_N: 2 # Load every Nth frame from each scene (1 = all frames, 4 = every 4th frame)
72
+ LOAD_RGB_ONLY: True # If True, ignore polarization data and load only RGB images
73
+
74
+ HOUSECAT6D:
75
+ VAL_SCENES: ["val_scene1","val_scene2"] # Validation scene names
76
+ TARGET_SIZE: [448,448] # Target image size [height, width]
77
+ RESIZE_MODE: "resize+crop" # Image resizing mode
78
+ FEW_IMAGES: False # Load only first 10 images if True
79
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
80
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
81
+
82
+ CROMO:
83
+ TRAIN_SCENES: ["kitchen"] # Training scene names (list or string)
84
+ # VAL_SCENES: "station" # Validation scene names (optional)
85
+ TARGET_SIZE: [448,448] # Target image size [height, width]
86
+ RESIZE_MODE: "resize" # Image resizing mode
87
+ FEW_IMAGES: False # Load only first 10 images if True
88
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
89
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
90
+
91
+ PSD:
92
+ TRAIN_SCENES: "PSD_Train" # Training scene name (string or list)
93
+ VAL_SCENES: "PSD_Val" # Validation scene name (string or list)
94
+ TARGET_SIZE: [448,448] # Target image size [height, width]
95
+ RESIZE_MODE: "resize+crop" # Image resizing mode
96
+ FEW_IMAGES: False # Load only first 10 images if True
97
+ SAMPLE_EVERY_N: 1 # Load every Nth frame (1 = all frames)
98
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
99
+
100
+ SCARED:
101
+ VAL_SCENES: ["v22","v23","v24","v25","v26","v27","v28","v29","v30","v31","v32","v33","v34"] # Validation scene names
102
+ TARGET_SIZE: [448,448] # Target image size [height, width]
103
+ RESIZE_MODE: "resize" #"resize+crop" # Image resizing mode
104
+ SAMPLE_EVERY_N: 1 # Load every Nth frame
105
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
106
+ FEW_IMAGES: False # Load only first 10 images if True
107
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing in dataset
108
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection (0-1)
109
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
110
+ HIGHLIGHT_RECT_SIZE: [1000, 1000] # Size of highlight rectangle region [height, width]
111
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
112
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
113
+
114
+ STEREOMIS_TRACKING:
115
+ VAL_SCENES: ["P2_2"] # Validation scene names
116
+ TARGET_SIZE: [448,448] # Target image size [height, width]
117
+ RESIZE_MODE: "resize+crop" # Image resizing mode
118
+ SAMPLE_EVERY_N: 4 # Load every Nth frame
119
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
120
+ FEW_IMAGES: False # Load only first 10 images if True
121
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
122
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
123
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
124
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
125
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
126
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
127
+
128
+ CHOLEC80:
129
+ VAL_SCENES: ["val"] # Validation scene names
130
+ TARGET_SIZE: [448,448] # Target image size [height, width]
131
+ RESIZE_MODE: "resize+crop" # Image resizing mode
132
+ SAMPLE_EVERY_N: 10 # Load every Nth frame
133
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
134
+ FEW_IMAGES: False # Load only first 10 images if True
135
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
136
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
137
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
138
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
139
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
140
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
141
+
142
+ # POLARGB:
143
+ # TRAIN_SCENES: "train"
144
+ # VAL_SCENES: "test"
145
+ # TARGET_SIZE: [448,448]
146
+ # RESIZE_MODE: "resize+crop"
147
+ # SAMPLE_EVERY_N: 1
148
+ # LOAD_RGB_ONLY: True
149
+
150
+ BATCH_SIZE: # Max batch size with img size 448 is 32
151
+ value: 16 # Number of samples per batch (adjust based on GPU memory)
152
+ NUM_WORKERS:
153
+ value: 8 # Number of data loading worker processes (0 = main process only)
154
+ SHUFFLE:
155
+ value: True # Shuffle training data each epoch (False for validation/test)
156
+ PIN_MEMORY:
157
+ value: True # Pin memory in DataLoader for faster GPU transfer (recommended: True)
158
+ PREFETCH_FACTOR:
159
+ value: 2 # Number of batches to prefetch per worker (higher = more memory usage)
160
+
161
+ ### HIGHLIGHTS
162
+ MOGE_MODEL:
163
+ value: "Ruicheng/moge-2-vits-normal" # MoGe model name for normal estimation (HuggingFace format)
164
+ SURFACE_ROUGHNESS:
165
+ value: 8.0 # Blinn-Phong surface roughness exponent (higher = sharper highlights)
166
+ INTENSITY:
167
+ value: 2.0 # Specular highlight intensity multiplier
168
+ LIGHT_DISTANCE_RANGE:
169
+ value: [0.0, 1] # Range for light source distance sampling [min, max] (normalized)
170
+ LIGHT_LEFT_RIGHT_ANGLE:
171
+ value: [0, 360] # Range for light source horizontal angle [min, max] in degrees
172
+ LIGHT_ABOVE_BELOW_ANGLE:
173
+ value: [0, 360] # Range for light source vertical angle [min, max] in degrees
174
+ DATASET_HIGHLIGHT_DILATION:
175
+ value: 25 # Dilation kernel size (pixels) for dataset highlight masks
176
+ DATASET_HIGHLIGHT_THRESHOLD:
177
+ value: 0.9 # Brightness/luminance threshold (0-1) for detecting highlights in dataset images
178
+ DATASET_HIGHLIGHT_USE_LUMINANCE:
179
+ value: True # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B) for dataset highlights; if False, use simple mean brightness
180
+ HIGHLIGHT_COLOR:
181
+ value: [1.0, 1.0, 1.0] # RGB color for synthetic highlights (normalized 0-1)
182
+ CLAMP_RECONSTRUCTION:
183
+ value: True # Clamp reconstructed images to [0, 1] range if True
184
+
185
+ ### OPTIMIZATION
186
+ LEARNING_RATE:
187
+ value: 1.0e-3 # Base learning rate for optimizer
188
+ WEIGHT_DECAY:
189
+ value: 0.0 # L2 regularization weight (0.0 = no weight decay)
190
+ EPOCHS:
191
+ value: 25 # Maximum number of training epochs
192
+ GRADIENT_ACCUMULATION_STEPS:
193
+ value: 1 # Number of steps to accumulate gradients before optimizer step (1 = no accumulation)
194
+ WARMUP:
195
+ value: 200 # Number of warmup steps for learning rate schedule (linear warmup from 0 to LR)
196
+ GRADIENT_CLIPPING_MAX_NORM:
197
+ value: 8 # Maximum gradient norm for clipping (set to -1 to disable clipping)
198
+ LR_SCHEDULER:
199
+ value:
200
+ ONPLATEAU: # ReduceLROnPlateau scheduler (reduces LR when validation metric plateaus)
201
+ PATIENCE: 5 # Number of epochs to wait before reducing LR
202
+ FACTOR: 0.1 # Factor by which LR is reduced (new_lr = old_lr * factor)
203
+ COSINE: # CosineAnnealingLR scheduler (cosine annealing schedule)
204
+ N_PERIODS: 1 # Number of cosine periods over training
205
+ # STEPWISE: # StepLR scheduler (reduces LR at fixed step intervals)
206
+ # N_STEPS: 4 # Number of times to reduce LR during training
207
+ # GAMMA: 0.5 # Factor by which LR is reduced at each step (new_lr = old_lr * gamma)
208
+ # EXPONENTIAL: # ExponentialLR scheduler (exponential decay)
209
+ # GAMMA: 0.5 # Multiplicative factor for exponential decay
210
+
211
+ SWITCH_OPTIMIZER_EPOCH:
212
+ value: null # Epoch number to switch from bootstrap to refining optimizer (null = no switch)
213
+ OPTIMIZER_BOOTSTRAP_NAME:
214
+ value: "AdamW" # Optimizer name for initial training phase ("Adam", "SGD", etc.)
215
+ OPTIMIZER_REFINING_NAME:
216
+ value: "AdamW" # Optimizer name for refining phase (used after SWITCH_OPTIMIZER_EPOCH)
217
+ EARLY_STOPPING_PATIENCE:
218
+ value: 10 # Number of epochs without improvement before stopping training
219
+ SAVE_INTERVAL:
220
+ value: 1000 # Number of training steps between model checkpoints
221
+
222
+ DATASET_HIGHLIGHT_SUPERVISION_THRESHOLD:
223
+ value: 0.1 # Pixel highlights above this threshold (should be low) are excluded from supervision
224
+
225
+ ### LOSS WEIGHTS (relative to the total loss, NOT NORMALIZED LATER)
226
+ SPECULAR_LOSS_WEIGHT:
227
+ value: 0.0 # Weight for specular component reconstruction loss
228
+ DIFFUSE_LOSS_WEIGHT:
229
+ value: 1.0 # Weight for diffuse component reconstruction loss
230
+ HIGHLIGHT_LOSS_WEIGHT:
231
+ value: 1.0 # Weight for highlight mask regression loss
232
+ IMAGE_RECONSTRUCTION_LOSS_WEIGHT:
233
+ value: 0.0 # Weight for full image reconstruction loss
234
+ SATURATION_RING_LOSS_WEIGHT:
235
+ value: 0.0 # Weight for saturation ring consistency loss (around highlight regions)
236
+ RING_KERNEL_SIZE:
237
+ value: 11 # Kernel size (odd number) for saturation ring dilation around highlights
238
+ RING_VAR_WEIGHT:
239
+ value: 0.5 # Weight for variance matching in saturation ring loss (vs mean matching)
240
+ RING_TEXTURE_WEIGHT:
241
+ value: 1.0 # Weight for texture consistency term in saturation ring loss
242
+ HLREG_W_L1:
243
+ value: 1.0 # Weight for L1 loss in highlight regression
244
+ HLREG_USE_CHARB:
245
+ value: True # Use Charbonnier loss (smooth L1) instead of standard L1 if True
246
+ HLREG_W_DICE:
247
+ value: 0.2 # Weight for Dice loss in highlight regression (for mask overlap)
248
+ HLREG_W_SSIM:
249
+ value: 0.0 # Weight for SSIM loss in highlight regression
250
+ HLREG_W_GRAD:
251
+ value: 0.0 # Weight for gradient loss in highlight regression
252
+ HLREG_W_TV:
253
+ value: 0.0 # Weight for total variation loss in highlight regression
254
+ HLREG_BALANCE_MODE:
255
+ value: "auto" # Class balancing mode for highlight regression: 'none' | 'auto' | 'pos_weight'
256
+ HLREG_POS_WEIGHT:
257
+ value: 1.0 # Positive class weight (used only if BALANCE_MODE == 'pos_weight')
258
+ HLREG_FOCAL_GAMMA:
259
+ value: 2.0 # Focal loss gamma parameter (0.0 = standard BCE, 1.0-2.0 helps with gradient vanishing)
260
+
261
+ WEIGHT_TOKEN_INPAINT:
262
+ value: 1.0 # Weight for token-space inpainting loss (L1 + cosine similarity in feature space)
263
+ WEIGHT_CONTEXT_IDENTITY:
264
+ value: 0.0 # LEAVE TO 0.0: Weight for L1 loss on context (non-masked) regions (identity preservation)
265
+ WEIGHT_TV_IN_HOLE:
266
+ value: 0.0 # LEAVE TO 0.0: Weight for total variation loss inside masked/hole regions
267
+ RING_DILATE_KERNEL:
268
+ value: 17 # Dilation kernel size (odd number) for creating ring mask around highlights
269
+ WEIGHT_SEAM:
270
+ value: 0.5 # Weight for gradient matching loss on saturation ring
271
+ SEAM_USE_CHARB:
272
+ value: True # Use Charbonnier loss instead of L1 in seam loss (smooth L1 for boundary consistency)
273
+ SEAM_WEIGHT_GRAD:
274
+ value: 0.0 # Weight for gradient matching term inside seam loss (0.0 = disable gradient term)
275
+ TOKEN_FEAT_ALPHA:
276
+ value: 0.5 # Mixing factor for token feature loss: alpha * L1 + (1-alpha) * (1-cosine_sim)
277
+
278
+ ### DIFFUSE HIGHLIGHT PENALTY
279
+ WEIGHT_DIFFUSE_HIGHLIGHT_PENALTY:
280
+ value: 0.1 # Weight for penalty loss on highlights in diffuse decoder output (0.0 = disabled)
281
+ DIFFUSE_HL_THRESHOLD:
282
+ value: 0.8 # Brightness/luminance threshold for detecting highlights in diffuse (0.0-1.0)
283
+ DIFFUSE_HL_USE_CHARB:
284
+ value: True # Use Charbonnier loss instead of L1 for diffuse highlight penalty
285
+ DIFFUSE_HL_PENALTY_MODE:
286
+ value: "brightness" # Penalty mode: "brightness" (penalize brightness/luminance above threshold) or "pixel" (penalize RGB values directly)
287
+ DIFFUSE_HL_TARGET_BRIGHTNESS:
288
+ value: null # Target brightness/luminance for penalized pixels (null = use threshold value)
289
+ DIFFUSE_HL_USE_LUMINANCE:
290
+ value: False # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B); if False, use simple mean brightness
291
+
292
+ ### LOGGING, RESULTS AND WANDB
293
+ LOG_INTERVAL:
294
+ value: 1 # Number of training steps between console log outputs
295
+ WANDB_LOG_INTERVAL:
296
+ value: 1 # Number of training steps between WandB metric logs
297
+ IMAGE_LOG_INTERVAL:
298
+ value: 10 # Number of training steps between image logging to WandB
299
+ NO_WANDB:
300
+ value: False # Disable WandB logging if True (useful for local debugging)
301
+ MODEL_WATCHER_FREQ_WANDB:
302
+ value: 50 # Frequency (in steps) for logging model parameter histograms to WandB
303
+ WANDB_ENTITY:
304
+ value: "unreflect-anything" # WandB organization/entity name
305
+ WANDB_PROJECT:
306
+ value: "UnReflectAnything" # WandB project name
307
+ NOTES:
308
+ value: "Positional encoding ablation - Rebuttal" # Notes/description for this training run
configs/rebuttal/ablate_RGB.yaml ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### BASELINE: CONVERGES AFTER LONG
2
+
3
+ parameters:
4
+
5
+ ### MODEL ARCHITECTURE
6
+ MODEL:
7
+ value:
8
+ MODEL_CLASS: "UnReflect_Model_TokenInpainter" # Main model class name (must match class in models.py)
9
+ MODEL_MODULE: "models" # Module name to import model classes from (default: "models")
10
+ RGB_ENCODER:
11
+ ENCODER: "facebook/dinov3-vitl16-pretrain-lvd1689m" # DINOv3 encoder model name (HuggingFace format)
12
+ IMAGE_SIZE: 448 # Input image size (height and width in pixels)
13
+ RETURN_SELECTED_LAYERS: [3, 6, 9, 12] # Transformer layer indices to extract features from (0-indexed)
14
+ RGB_ENCODER_LR: 0.0 # Learning rate for RGB encoder (0.0 = frozen, must be explicitly set)
15
+ DECODERS:
16
+ diffuse:
17
+ USE_FILM: False # Enable FiLM (Feature-wise Linear Modulation) conditioning in decoder
18
+ FEATURE_DIM: 1024 # Feature dimension for decoder (should match encoder output)
19
+ REASSEMBLE_OUT_CHANNELS: [768,1024,1536,2048] # Output channels for each decoder stage (DPT-style reassembly)
20
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
21
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder ("ignore", "project", etc.)
22
+ FROM_PRETRAINED: "weights/rgb_decoder.pth" # Path to pretrained decoder weights (optional)
23
+ USE_BN: False # Use batch normalization in decoder
24
+ DROPOUT: 0.1 # Dropout rate in decoder layers
25
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
26
+ OUTPUT_CHANNELS: 3 # Number of output channels (3 for RGB diffuse image)
27
+ DECODER_LR: 1.0e-5 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
28
+ NUM_FUSION_BLOCKS_TRAINABLE: 1 # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
29
+ TRAIN_RGB_HEAD: True # Whether to train RGB head (true/false, null = train if DECODER_LR != 0)
30
+ highlight:
31
+ USE_FILM: False # Enable FiLM conditioning in highlight decoder
32
+ FEATURE_DIM: 1024 # Feature dimension for highlight decoder
33
+ REASSEMBLE_OUT_CHANNELS: [96,192,384,768] # Output channels for each decoder stage
34
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
35
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder
36
+ USE_BN: False # Use batch normalization in decoder
37
+ DROPOUT: 0.1 # Dropout rate in decoder layers
38
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
39
+ OUTPUT_CHANNELS: 1 # Number of output channels (1 for highlight mask)
40
+ DECODER_LR: 5.0e-4 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
41
+ NUM_FUSION_BLOCKS_TRAINABLE: null # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
42
+ TOKEN_INPAINTER:
43
+ TOKEN_INPAINTER_CLASS: "TokenInpainter_Prior" # Token inpainter class name
44
+ TOKEN_INPAINTER_MODULE: "token_inpainters" # Module name to import token inpainter from
45
+ FROM_PRETRAINED: "weights/token_inpainter.pth" # Path to pretrained token inpainter weights
46
+ TOKEN_INPAINTER_LR: 1.0e-5 # Learning rate for token inpainter (can differ from base LR)
47
+ DEPTH: 6 # Number of transformer blocks
48
+ HEADS: 16 # Number of attention heads
49
+ DROP: 0 # Dropout rate
50
+ USE_POSITIONAL_ENCODING: True # Enable 2D sinusoidal positional encodings
51
+ USE_FINAL_NORM: True # Enable final LayerNorm before output projection
52
+ USE_LOCAL_PRIOR: True # Blend local mean prior for masked seeds
53
+ LOCAL_PRIOR_WEIGHT: 0.5 # Weight for local prior blending (1.0 = only mask_token, 0.0 = only local mean)
54
+ LOCAL_PRIOR_KERNEL: 5 # Kernel size for local prior blending (> 1)
55
+ SEED_NOISE_STD: 0.02 # Standard deviation of noise added to masked seeds during training
56
+ INPAINT_MASK_DILATION:
57
+ value: 1 # Dilation kernel size (pixels) for inpaint mask - Must be odd
58
+ USE_TORCH_COMPILE: # Enable PyTorch 2.0 torch.compile for faster training (experimental)
59
+ value: False
60
+
61
+ ### DATA
62
+ DATASETS:
63
+ value:
64
+ SCRREAM:
65
+ VAL_SCENES: ["scene10_full_00","scene11_full_00","scene044_full_00","scene04_reduced_00","scene04_reduced_01","scene04_reduced_02"] # List of validation scene names
66
+ TARGET_SIZE: [448,448] # Target image size [height, width] in pixels
67
+ RESIZE_MODE: "resize+crop" # Image resizing mode: "resize", "crop", "resize+crop", or "pad"
68
+ FEW_IMAGES: False # If True, load only first 10 images per scene (for quick debugging)
69
+ SAMPLE_EVERY_N: 2 # Load every Nth frame from each scene (1 = all frames, 4 = every 4th frame)
70
+ LOAD_RGB_ONLY: True # If True, ignore polarization data and load only RGB images
71
+
72
+ HOUSECAT6D:
73
+ VAL_SCENES: ["val_scene1","val_scene2"] # Validation scene names
74
+ TARGET_SIZE: [448,448] # Target image size [height, width]
75
+ RESIZE_MODE: "resize+crop" # Image resizing mode
76
+ FEW_IMAGES: False # Load only first 10 images if True
77
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
78
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
79
+
80
+ CROMO:
81
+ TRAIN_SCENES: ["kitchen"] # Training scene names (list or string)
82
+ # VAL_SCENES: "station" # Validation scene names (optional)
83
+ TARGET_SIZE: [448,448] # Target image size [height, width]
84
+ RESIZE_MODE: "resize" # Image resizing mode
85
+ FEW_IMAGES: False # Load only first 10 images if True
86
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
87
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
88
+
89
+ PSD:
90
+ TRAIN_SCENES: "PSD_Train" # Training scene name (string or list)
91
+ VAL_SCENES: "PSD_Val" # Validation scene name (string or list)
92
+ TARGET_SIZE: [448,448] # Target image size [height, width]
93
+ RESIZE_MODE: "resize+crop" # Image resizing mode
94
+ FEW_IMAGES: False # Load only first 10 images if True
95
+ SAMPLE_EVERY_N: 1 # Load every Nth frame (1 = all frames)
96
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
97
+
98
+ SCARED:
99
+ VAL_SCENES: ["v22","v23","v24","v25","v26","v27","v28","v29","v30","v31","v32","v33","v34"] # Validation scene names
100
+ TARGET_SIZE: [448,448] # Target image size [height, width]
101
+ RESIZE_MODE: "resize" #"resize+crop" # Image resizing mode
102
+ SAMPLE_EVERY_N: 1 # Load every Nth frame
103
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
104
+ FEW_IMAGES: False # Load only first 10 images if True
105
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing in dataset
106
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection (0-1)
107
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
108
+ HIGHLIGHT_RECT_SIZE: [1000, 1000] # Size of highlight rectangle region [height, width]
109
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
110
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
111
+
112
+ STEREOMIS_TRACKING:
113
+ VAL_SCENES: ["P2_2"] # Validation scene names
114
+ TARGET_SIZE: [448,448] # Target image size [height, width]
115
+ RESIZE_MODE: "resize+crop" # Image resizing mode
116
+ SAMPLE_EVERY_N: 4 # Load every Nth frame
117
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
118
+ FEW_IMAGES: False # Load only first 10 images if True
119
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
120
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
121
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
122
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
123
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
124
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
125
+
126
+ CHOLEC80:
127
+ VAL_SCENES: ["val"] # Validation scene names
128
+ TARGET_SIZE: [448,448] # Target image size [height, width]
129
+ RESIZE_MODE: "resize+crop" # Image resizing mode
130
+ SAMPLE_EVERY_N: 10 # Load every Nth frame
131
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
132
+ FEW_IMAGES: False # Load only first 10 images if True
133
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
134
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
135
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
136
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
137
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
138
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
139
+
140
+ # POLARGB:
141
+ # TRAIN_SCENES: "train"
142
+ # VAL_SCENES: "test"
143
+ # TARGET_SIZE: [448,448]
144
+ # RESIZE_MODE: "resize+crop"
145
+ # SAMPLE_EVERY_N: 1
146
+ # LOAD_RGB_ONLY: True
147
+
148
+ BATCH_SIZE: # Max batch size with img size 448 is 32
149
+ value: 12 # Number of samples per batch (adjust based on GPU memory)
150
+ NUM_WORKERS:
151
+ value: 8 # Number of data loading worker processes (0 = main process only)
152
+ SHUFFLE:
153
+ value: True # Shuffle training data each epoch (False for validation/test)
154
+ PIN_MEMORY:
155
+ value: True # Pin memory in DataLoader for faster GPU transfer (recommended: True)
156
+ PREFETCH_FACTOR:
157
+ value: 2 # Number of batches to prefetch per worker (higher = more memory usage)
158
+
159
+ ### HIGHLIGHTS
160
+ MOGE_MODEL:
161
+ value: "Ruicheng/moge-2-vits-normal" # MoGe model name for normal estimation (HuggingFace format)
162
+ SURFACE_ROUGHNESS:
163
+ value: 8.0 # Blinn-Phong surface roughness exponent (higher = sharper highlights)
164
+ INTENSITY:
165
+ value: 2.0 # Specular highlight intensity multiplier
166
+ LIGHT_DISTANCE_RANGE:
167
+ value: [0.0, 1] # Range for light source distance sampling [min, max] (normalized)
168
+ LIGHT_LEFT_RIGHT_ANGLE:
169
+ value: [0, 360] # Range for light source horizontal angle [min, max] in degrees
170
+ LIGHT_ABOVE_BELOW_ANGLE:
171
+ value: [0, 360] # Range for light source vertical angle [min, max] in degrees
172
+ DATASET_HIGHLIGHT_DILATION:
173
+ value: 25 # Dilation kernel size (pixels) for dataset highlight masks
174
+ DATASET_HIGHLIGHT_THRESHOLD:
175
+ value: 0.9 # Brightness/luminance threshold (0-1) for detecting highlights in dataset images
176
+ DATASET_HIGHLIGHT_USE_LUMINANCE:
177
+ value: True # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B) for dataset highlights; if False, use simple mean brightness
178
+ HIGHLIGHT_COLOR:
179
+ value: [1.0, 1.0, 1.0] # RGB color for synthetic highlights (normalized 0-1)
180
+ CLAMP_RECONSTRUCTION:
181
+ value: True # Clamp reconstructed images to [0, 1] range if True
182
+
183
+ ### OPTIMIZATION
184
+ LEARNING_RATE:
185
+ value: 1.0e-3 # Base learning rate for optimizer
186
+ WEIGHT_DECAY:
187
+ value: 0.0 # L2 regularization weight (0.0 = no weight decay)
188
+ EPOCHS:
189
+ value: 25 # Maximum number of training epochs
190
+ GRADIENT_ACCUMULATION_STEPS:
191
+ value: 1 # Number of steps to accumulate gradients before optimizer step (1 = no accumulation)
192
+ WARMUP:
193
+ value: 200 # Number of warmup steps for learning rate schedule (linear warmup from 0 to LR)
194
+ GRADIENT_CLIPPING_MAX_NORM:
195
+ value: 8 # Maximum gradient norm for clipping (set to -1 to disable clipping)
196
+ LR_SCHEDULER:
197
+ value:
198
+ ONPLATEAU: # ReduceLROnPlateau scheduler (reduces LR when validation metric plateaus)
199
+ PATIENCE: 5 # Number of epochs to wait before reducing LR
200
+ FACTOR: 0.1 # Factor by which LR is reduced (new_lr = old_lr * factor)
201
+ COSINE: # CosineAnnealingLR scheduler (cosine annealing schedule)
202
+ N_PERIODS: 1 # Number of cosine periods over training
203
+ # STEPWISE: # StepLR scheduler (reduces LR at fixed step intervals)
204
+ # N_STEPS: 4 # Number of times to reduce LR during training
205
+ # GAMMA: 0.5 # Factor by which LR is reduced at each step (new_lr = old_lr * gamma)
206
+ # EXPONENTIAL: # ExponentialLR scheduler (exponential decay)
207
+ # GAMMA: 0.5 # Multiplicative factor for exponential decay
208
+
209
+ SWITCH_OPTIMIZER_EPOCH:
210
+ value: null # Epoch number to switch from bootstrap to refining optimizer (null = no switch)
211
+ OPTIMIZER_BOOTSTRAP_NAME:
212
+ value: "AdamW" # Optimizer name for initial training phase ("Adam", "SGD", etc.)
213
+ OPTIMIZER_REFINING_NAME:
214
+ value: "AdamW" # Optimizer name for refining phase (used after SWITCH_OPTIMIZER_EPOCH)
215
+ EARLY_STOPPING_PATIENCE:
216
+ value: 10 # Number of epochs without improvement before stopping training
217
+ SAVE_INTERVAL:
218
+ value: 1000 # Number of training steps between model checkpoints
219
+ DATASET_HIGHLIGHT_SUPERVISION_THRESHOLD:
220
+ value: 0.1 # Pixel highlights above this threshold (should be low) are excluded from supervision
221
+
222
+ ### LOSS WEIGHTS (relative to the total loss, NOT NORMALIZED LATER)
223
+ SPECULAR_LOSS_WEIGHT:
224
+ value: 0.0 # Weight for specular component reconstruction loss
225
+ DIFFUSE_LOSS_WEIGHT:
226
+ value: 0.7 # Weight for diffuse component reconstruction loss
227
+ HIGHLIGHT_LOSS_WEIGHT:
228
+ value: 1.0 # Weight for highlight mask regression loss
229
+ IMAGE_RECONSTRUCTION_LOSS_WEIGHT:
230
+ value: 0.0 # Weight for full image reconstruction loss
231
+ SATURATION_RING_LOSS_WEIGHT:
232
+ value: 0.0 # Weight for saturation ring consistency loss (around highlight regions)
233
+ RING_KERNEL_SIZE:
234
+ value: 11 # Kernel size (odd number) for saturation ring dilation around highlights
235
+ RING_VAR_WEIGHT:
236
+ value: 0.5 # Weight for variance matching in saturation ring loss (vs mean matching)
237
+ RING_TEXTURE_WEIGHT:
238
+ value: 1.0 # Weight for texture consistency term in saturation ring loss
239
+ HLREG_W_L1:
240
+ value: 1.0 # Weight for L1 loss in highlight regression
241
+ HLREG_USE_CHARB:
242
+ value: True # Use Charbonnier loss (smooth L1) instead of standard L1 if True
243
+ HLREG_W_DICE:
244
+ value: 0.2 # Weight for Dice loss in highlight regression (for mask overlap)
245
+ HLREG_W_SSIM:
246
+ value: 0.0 # Weight for SSIM loss in highlight regression
247
+ HLREG_W_GRAD:
248
+ value: 0.0 # Weight for gradient loss in highlight regression
249
+ HLREG_W_TV:
250
+ value: 0.0 # Weight for total variation loss in highlight regression
251
+ HLREG_BALANCE_MODE:
252
+ value: "auto" # Class balancing mode for highlight regression: 'none' | 'auto' | 'pos_weight'
253
+ HLREG_POS_WEIGHT:
254
+ value: 1.0 # Positive class weight (used only if BALANCE_MODE == 'pos_weight')
255
+ HLREG_FOCAL_GAMMA:
256
+ value: 2.0 # Focal loss gamma parameter (0.0 = standard BCE, 1.0-2.0 helps with gradient vanishing)
257
+
258
+ WEIGHT_TOKEN_INPAINT:
259
+ value: 1.0 # Weight for token-space inpainting loss (L1 + cosine similarity in feature space)
260
+ WEIGHT_CONTEXT_IDENTITY:
261
+ value: 0.0 # LEAVE TO 0.0: Weight for L1 loss on context (non-masked) regions (identity preservation)
262
+ WEIGHT_TV_IN_HOLE:
263
+ value: 0.0 # LEAVE TO 0.0: Weight for total variation loss inside masked/hole regions
264
+ RING_DILATE_KERNEL:
265
+ value: 17 # Dilation kernel size (odd number) for creating ring mask around highlights
266
+ WEIGHT_SEAM:
267
+ value: 0.5 # Weight for gradient matching loss on saturation ring
268
+ SEAM_USE_CHARB:
269
+ value: True # Use Charbonnier loss instead of L1 in seam loss (smooth L1 for boundary consistency)
270
+ SEAM_WEIGHT_GRAD:
271
+ value: 0.0 # Weight for gradient matching term inside seam loss (0.0 = disable gradient term)
272
+ TOKEN_FEAT_ALPHA:
273
+ value: 0.5 # Mixing factor for token feature loss: alpha * L1 + (1-alpha) * (1-cosine_sim)
274
+
275
+ ### DIFFUSE HIGHLIGHT PENALTY
276
+ ### ABLATION =======================================================================
277
+ WEIGHT_DIFFUSE_HIGHLIGHT_PENALTY:
278
+ value: 0.0 # Weight for penalty loss on highlights in diffuse decoder output (0.0 = disabled)
279
+ ###=================================================================================
280
+ DIFFUSE_HL_THRESHOLD:
281
+ value: 0.8 # Brightness/luminance threshold for detecting highlights in diffuse (0.0-1.0)
282
+ DIFFUSE_HL_USE_CHARB:
283
+ value: True # Use Charbonnier loss instead of L1 for diffuse highlight penalty
284
+ DIFFUSE_HL_PENALTY_MODE:
285
+ value: "brightness" # Penalty mode: "brightness" (penalize brightness/luminance above threshold) or "pixel" (penalize RGB values directly)
286
+ DIFFUSE_HL_TARGET_BRIGHTNESS:
287
+ value: null # Target brightness/luminance for penalized pixels (null = use threshold value)
288
+ DIFFUSE_HL_USE_LUMINANCE:
289
+ value: False # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B); if False, use simple mean brightness
290
+
291
+ ### LOGGING, RESULTS AND WANDB
292
+ LOG_INTERVAL:
293
+ value: 1 # Number of training steps between console log outputs
294
+ WANDB_LOG_INTERVAL:
295
+ value: 1 # Number of training steps between WandB metric logs
296
+ IMAGE_LOG_INTERVAL:
297
+ value: 10 # Number of training steps between image logging to WandB
298
+ NO_WANDB:
299
+ value: False # Disable WandB logging if True (useful for local debugging)
300
+ MODEL_WATCHER_FREQ_WANDB:
301
+ value: 50 # Frequency (in steps) for logging model parameter histograms to WandB
302
+ WANDB_ENTITY:
303
+ value: "unreflect-anything" # WandB organization/entity name
304
+ WANDB_PROJECT:
305
+ value: "UnReflectAnything" # WandB project name
306
+ NOTES:
307
+ value: "RGB ablation - Rebuttal" # Notes/description for this training run
configs/rebuttal/ablate_Seam.yaml ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### BASELINE: CONVERGES AFTER LONG
2
+
3
+ parameters:
4
+
5
+ ### MODEL ARCHITECTURE
6
+ MODEL:
7
+ value:
8
+ MODEL_CLASS: "UnReflect_Model_TokenInpainter" # Main model class name (must match class in models.py)
9
+ MODEL_MODULE: "models" # Module name to import model classes from (default: "models")
10
+ RGB_ENCODER:
11
+ ENCODER: "facebook/dinov3-vitl16-pretrain-lvd1689m" # DINOv3 encoder model name (HuggingFace format)
12
+ IMAGE_SIZE: 448 # Input image size (height and width in pixels)
13
+ RETURN_SELECTED_LAYERS: [3, 6, 9, 12] # Transformer layer indices to extract features from (0-indexed)
14
+ RGB_ENCODER_LR: 0.0 # Learning rate for RGB encoder (0.0 = frozen, must be explicitly set)
15
+ DECODERS:
16
+ diffuse:
17
+ USE_FILM: False # Enable FiLM (Feature-wise Linear Modulation) conditioning in decoder
18
+ FEATURE_DIM: 1024 # Feature dimension for decoder (should match encoder output)
19
+ REASSEMBLE_OUT_CHANNELS: [768,1024,1536,2048] # Output channels for each decoder stage (DPT-style reassembly)
20
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
21
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder ("ignore", "project", etc.)
22
+ FROM_PRETRAINED: "weights/rgb_decoder.pth" # Path to pretrained decoder weights (optional)
23
+ USE_BN: False # Use batch normalization in decoder
24
+ DROPOUT: 0.1 # Dropout rate in decoder layers
25
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
26
+ OUTPUT_CHANNELS: 3 # Number of output channels (3 for RGB diffuse image)
27
+ DECODER_LR: 1.0e-5 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
28
+ NUM_FUSION_BLOCKS_TRAINABLE: 1 # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
29
+ TRAIN_RGB_HEAD: True # Whether to train RGB head (true/false, null = train if DECODER_LR != 0)
30
+ highlight:
31
+ USE_FILM: False # Enable FiLM conditioning in highlight decoder
32
+ FEATURE_DIM: 1024 # Feature dimension for highlight decoder
33
+ REASSEMBLE_OUT_CHANNELS: [96,192,384,768] # Output channels for each decoder stage
34
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
35
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder
36
+ USE_BN: False # Use batch normalization in decoder
37
+ DROPOUT: 0.1 # Dropout rate in decoder layers
38
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
39
+ OUTPUT_CHANNELS: 1 # Number of output channels (1 for highlight mask)
40
+ DECODER_LR: 5.0e-4 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
41
+ NUM_FUSION_BLOCKS_TRAINABLE: null # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
42
+ TOKEN_INPAINTER:
43
+ TOKEN_INPAINTER_CLASS: "TokenInpainter_Prior" # Token inpainter class name
44
+ TOKEN_INPAINTER_MODULE: "token_inpainters" # Module name to import token inpainter from
45
+ FROM_PRETRAINED: "weights/token_inpainter.pth" # Path to pretrained token inpainter weights
46
+ TOKEN_INPAINTER_LR: 1.0e-5 # Learning rate for token inpainter (can differ from base LR)
47
+ DEPTH: 6 # Number of transformer blocks
48
+ HEADS: 16 # Number of attention heads
49
+ DROP: 0 # Dropout rate
50
+ USE_POSITIONAL_ENCODING: True # Enable 2D sinusoidal positional encodings
51
+ USE_FINAL_NORM: True # Enable final LayerNorm before output projection
52
+ USE_LOCAL_PRIOR: True # Blend local mean prior for masked seeds
53
+ LOCAL_PRIOR_WEIGHT: 0.5 # Weight for local prior blending (1.0 = only mask_token, 0.0 = only local mean)
54
+ LOCAL_PRIOR_KERNEL: 5 # Kernel size for local prior blending (> 1)
55
+ SEED_NOISE_STD: 0.02 # Standard deviation of noise added to masked seeds during training
56
+ INPAINT_MASK_DILATION:
57
+ value: 1 # Dilation kernel size (pixels) for inpaint mask - Must be odd
58
+ USE_TORCH_COMPILE: # Enable PyTorch 2.0 torch.compile for faster training (experimental)
59
+ value: False
60
+
61
+ ### DATA
62
+ DATASETS:
63
+ value:
64
+ SCRREAM:
65
+ VAL_SCENES: ["scene10_full_00","scene11_full_00","scene044_full_00","scene04_reduced_00","scene04_reduced_01","scene04_reduced_02"] # List of validation scene names
66
+ TARGET_SIZE: [448,448] # Target image size [height, width] in pixels
67
+ RESIZE_MODE: "resize+crop" # Image resizing mode: "resize", "crop", "resize+crop", or "pad"
68
+ FEW_IMAGES: False # If True, load only first 10 images per scene (for quick debugging)
69
+ SAMPLE_EVERY_N: 2 # Load every Nth frame from each scene (1 = all frames, 4 = every 4th frame)
70
+ LOAD_RGB_ONLY: True # If True, ignore polarization data and load only RGB images
71
+
72
+ HOUSECAT6D:
73
+ VAL_SCENES: ["val_scene1","val_scene2"] # Validation scene names
74
+ TARGET_SIZE: [448,448] # Target image size [height, width]
75
+ RESIZE_MODE: "resize+crop" # Image resizing mode
76
+ FEW_IMAGES: False # Load only first 10 images if True
77
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
78
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
79
+
80
+ CROMO:
81
+ TRAIN_SCENES: ["kitchen"] # Training scene names (list or string)
82
+ # VAL_SCENES: "station" # Validation scene names (optional)
83
+ TARGET_SIZE: [448,448] # Target image size [height, width]
84
+ RESIZE_MODE: "resize" # Image resizing mode
85
+ FEW_IMAGES: False # Load only first 10 images if True
86
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
87
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
88
+
89
+ PSD:
90
+ TRAIN_SCENES: "PSD_Train" # Training scene name (string or list)
91
+ VAL_SCENES: "PSD_Val" # Validation scene name (string or list)
92
+ TARGET_SIZE: [448,448] # Target image size [height, width]
93
+ RESIZE_MODE: "resize+crop" # Image resizing mode
94
+ FEW_IMAGES: False # Load only first 10 images if True
95
+ SAMPLE_EVERY_N: 1 # Load every Nth frame (1 = all frames)
96
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
97
+
98
+ SCARED:
99
+ VAL_SCENES: ["v22","v23","v24","v25","v26","v27","v28","v29","v30","v31","v32","v33","v34"] # Validation scene names
100
+ TARGET_SIZE: [448,448] # Target image size [height, width]
101
+ RESIZE_MODE: "resize" #"resize+crop" # Image resizing mode
102
+ SAMPLE_EVERY_N: 1 # Load every Nth frame
103
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
104
+ FEW_IMAGES: False # Load only first 10 images if True
105
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing in dataset
106
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection (0-1)
107
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
108
+ HIGHLIGHT_RECT_SIZE: [1000, 1000] # Size of highlight rectangle region [height, width]
109
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
110
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
111
+
112
+ STEREOMIS_TRACKING:
113
+ VAL_SCENES: ["P2_2"] # Validation scene names
114
+ TARGET_SIZE: [448,448] # Target image size [height, width]
115
+ RESIZE_MODE: "resize+crop" # Image resizing mode
116
+ SAMPLE_EVERY_N: 4 # Load every Nth frame
117
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
118
+ FEW_IMAGES: False # Load only first 10 images if True
119
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
120
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
121
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
122
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
123
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
124
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
125
+
126
+ CHOLEC80:
127
+ VAL_SCENES: ["val"] # Validation scene names
128
+ TARGET_SIZE: [448,448] # Target image size [height, width]
129
+ RESIZE_MODE: "resize+crop" # Image resizing mode
130
+ SAMPLE_EVERY_N: 10 # Load every Nth frame
131
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
132
+ FEW_IMAGES: False # Load only first 10 images if True
133
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
134
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
135
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
136
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
137
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
138
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
139
+
140
+ # POLARGB:
141
+ # TRAIN_SCENES: "train"
142
+ # VAL_SCENES: "test"
143
+ # TARGET_SIZE: [448,448]
144
+ # RESIZE_MODE: "resize+crop"
145
+ # SAMPLE_EVERY_N: 1
146
+ # LOAD_RGB_ONLY: True
147
+
148
+ BATCH_SIZE: # Max batch size with img size 448 is 32
149
+ value: 12 # Number of samples per batch (adjust based on GPU memory)
150
+ NUM_WORKERS:
151
+ value: 8 # Number of data loading worker processes (0 = main process only)
152
+ SHUFFLE:
153
+ value: True # Shuffle training data each epoch (False for validation/test)
154
+ PIN_MEMORY:
155
+ value: True # Pin memory in DataLoader for faster GPU transfer (recommended: True)
156
+ PREFETCH_FACTOR:
157
+ value: 2 # Number of batches to prefetch per worker (higher = more memory usage)
158
+
159
+ ### HIGHLIGHTS
160
+ MOGE_MODEL:
161
+ value: "Ruicheng/moge-2-vits-normal" # MoGe model name for normal estimation (HuggingFace format)
162
+ SURFACE_ROUGHNESS:
163
+ value: 8.0 # Blinn-Phong surface roughness exponent (higher = sharper highlights)
164
+ INTENSITY:
165
+ value: 2.0 # Specular highlight intensity multiplier
166
+ LIGHT_DISTANCE_RANGE:
167
+ value: [0.0, 1] # Range for light source distance sampling [min, max] (normalized)
168
+ LIGHT_LEFT_RIGHT_ANGLE:
169
+ value: [0, 360] # Range for light source horizontal angle [min, max] in degrees
170
+ LIGHT_ABOVE_BELOW_ANGLE:
171
+ value: [0, 360] # Range for light source vertical angle [min, max] in degrees
172
+ DATASET_HIGHLIGHT_DILATION:
173
+ value: 25 # Dilation kernel size (pixels) for dataset highlight masks
174
+ DATASET_HIGHLIGHT_THRESHOLD:
175
+ value: 0.9 # Brightness/luminance threshold (0-1) for detecting highlights in dataset images
176
+ DATASET_HIGHLIGHT_USE_LUMINANCE:
177
+ value: True # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B) for dataset highlights; if False, use simple mean brightness
178
+ HIGHLIGHT_COLOR:
179
+ value: [1.0, 1.0, 1.0] # RGB color for synthetic highlights (normalized 0-1)
180
+ CLAMP_RECONSTRUCTION:
181
+ value: True # Clamp reconstructed images to [0, 1] range if True
182
+
183
+ ### OPTIMIZATION
184
+ LEARNING_RATE:
185
+ value: 1.0e-3 # Base learning rate for optimizer
186
+ WEIGHT_DECAY:
187
+ value: 0.0 # L2 regularization weight (0.0 = no weight decay)
188
+ EPOCHS:
189
+ value: 25 # Maximum number of training epochs
190
+ GRADIENT_ACCUMULATION_STEPS:
191
+ value: 1 # Number of steps to accumulate gradients before optimizer step (1 = no accumulation)
192
+ WARMUP:
193
+ value: 200 # Number of warmup steps for learning rate schedule (linear warmup from 0 to LR)
194
+ GRADIENT_CLIPPING_MAX_NORM:
195
+ value: 8 # Maximum gradient norm for clipping (set to -1 to disable clipping)
196
+ LR_SCHEDULER:
197
+ value:
198
+ ONPLATEAU: # ReduceLROnPlateau scheduler (reduces LR when validation metric plateaus)
199
+ PATIENCE: 5 # Number of epochs to wait before reducing LR
200
+ FACTOR: 0.1 # Factor by which LR is reduced (new_lr = old_lr * factor)
201
+ COSINE: # CosineAnnealingLR scheduler (cosine annealing schedule)
202
+ N_PERIODS: 1 # Number of cosine periods over training
203
+ # STEPWISE: # StepLR scheduler (reduces LR at fixed step intervals)
204
+ # N_STEPS: 4 # Number of times to reduce LR during training
205
+ # GAMMA: 0.5 # Factor by which LR is reduced at each step (new_lr = old_lr * gamma)
206
+ # EXPONENTIAL: # ExponentialLR scheduler (exponential decay)
207
+ # GAMMA: 0.5 # Multiplicative factor for exponential decay
208
+
209
+ SWITCH_OPTIMIZER_EPOCH:
210
+ value: null # Epoch number to switch from bootstrap to refining optimizer (null = no switch)
211
+ OPTIMIZER_BOOTSTRAP_NAME:
212
+ value: "AdamW" # Optimizer name for initial training phase ("Adam", "SGD", etc.)
213
+ OPTIMIZER_REFINING_NAME:
214
+ value: "AdamW" # Optimizer name for refining phase (used after SWITCH_OPTIMIZER_EPOCH)
215
+ EARLY_STOPPING_PATIENCE:
216
+ value: 10 # Number of epochs without improvement before stopping training
217
+ SAVE_INTERVAL:
218
+ value: 1000 # Number of training steps between model checkpoints
219
+
220
+ DATASET_HIGHLIGHT_SUPERVISION_THRESHOLD:
221
+ value: 0.1 # Pixel highlights above this threshold (should be low) are excluded from supervision
222
+
223
+ ### LOSS WEIGHTS (relative to the total loss, NOT NORMALIZED LATER)
224
+ SPECULAR_LOSS_WEIGHT:
225
+ value: 0.0 # Weight for specular component reconstruction loss
226
+ DIFFUSE_LOSS_WEIGHT:
227
+ value: 1.0 # Weight for diffuse component reconstruction loss
228
+ HIGHLIGHT_LOSS_WEIGHT:
229
+ value: 1.0 # Weight for highlight mask regression loss
230
+ IMAGE_RECONSTRUCTION_LOSS_WEIGHT:
231
+ value: 0.0 # Weight for full image reconstruction loss
232
+ SATURATION_RING_LOSS_WEIGHT:
233
+ value: 0.0 # Weight for saturation ring consistency loss (around highlight regions)
234
+ RING_KERNEL_SIZE:
235
+ value: 11 # Kernel size (odd number) for saturation ring dilation around highlights
236
+ RING_VAR_WEIGHT:
237
+ value: 0.5 # Weight for variance matching in saturation ring loss (vs mean matching)
238
+ RING_TEXTURE_WEIGHT:
239
+ value: 1.0 # Weight for texture consistency term in saturation ring loss
240
+ HLREG_W_L1:
241
+ value: 1.0 # Weight for L1 loss in highlight regression
242
+ HLREG_USE_CHARB:
243
+ value: True # Use Charbonnier loss (smooth L1) instead of standard L1 if True
244
+ HLREG_W_DICE:
245
+ value: 0.2 # Weight for Dice loss in highlight regression (for mask overlap)
246
+ HLREG_W_SSIM:
247
+ value: 0.0 # Weight for SSIM loss in highlight regression
248
+ HLREG_W_GRAD:
249
+ value: 0.0 # Weight for gradient loss in highlight regression
250
+ HLREG_W_TV:
251
+ value: 0.0 # Weight for total variation loss in highlight regression
252
+ HLREG_BALANCE_MODE:
253
+ value: "auto" # Class balancing mode for highlight regression: 'none' | 'auto' | 'pos_weight'
254
+ HLREG_POS_WEIGHT:
255
+ value: 1.0 # Positive class weight (used only if BALANCE_MODE == 'pos_weight')
256
+ HLREG_FOCAL_GAMMA:
257
+ value: 2.0 # Focal loss gamma parameter (0.0 = standard BCE, 1.0-2.0 helps with gradient vanishing)
258
+
259
+ WEIGHT_TOKEN_INPAINT:
260
+ value: 1.0 # Weight for token-space inpainting loss (L1 + cosine similarity in feature space)
261
+ WEIGHT_CONTEXT_IDENTITY:
262
+ value: 0.0 # LEAVE TO 0.0: Weight for L1 loss on context (non-masked) regions (identity preservation)
263
+ WEIGHT_TV_IN_HOLE:
264
+ value: 0.0 # LEAVE TO 0.0: Weight for total variation loss inside masked/hole regions
265
+ RING_DILATE_KERNEL:
266
+ value: 17 # Dilation kernel size (odd number) for creating ring mask around highlights
267
+ ### ABLATION =======================================================================
268
+ WEIGHT_SEAM:
269
+ value: 0.0 # Weight for gradient matching loss on saturation ring
270
+ ###=================================================================================
271
+ SEAM_USE_CHARB:
272
+ value: True # Use Charbonnier loss instead of L1 in seam loss (smooth L1 for boundary consistency)
273
+ SEAM_WEIGHT_GRAD:
274
+ value: 0.0 # Weight for gradient matching term inside seam loss (0.0 = disable gradient term)
275
+ TOKEN_FEAT_ALPHA:
276
+ value: 0.5 # Mixing factor for token feature loss: alpha * L1 + (1-alpha) * (1-cosine_sim)
277
+
278
+ ### DIFFUSE HIGHLIGHT PENALTY
279
+ WEIGHT_DIFFUSE_HIGHLIGHT_PENALTY:
280
+ value: 0.1 # Weight for penalty loss on highlights in diffuse decoder output (0.0 = disabled)
281
+ DIFFUSE_HL_THRESHOLD:
282
+ value: 0.8 # Brightness/luminance threshold for detecting highlights in diffuse (0.0-1.0)
283
+ DIFFUSE_HL_USE_CHARB:
284
+ value: True # Use Charbonnier loss instead of L1 for diffuse highlight penalty
285
+ DIFFUSE_HL_PENALTY_MODE:
286
+ value: "brightness" # Penalty mode: "brightness" (penalize brightness/luminance above threshold) or "pixel" (penalize RGB values directly)
287
+ DIFFUSE_HL_TARGET_BRIGHTNESS:
288
+ value: null # Target brightness/luminance for penalized pixels (null = use threshold value)
289
+ DIFFUSE_HL_USE_LUMINANCE:
290
+ value: False # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B); if False, use simple mean brightness
291
+
292
+ ### LOGGING, RESULTS AND WANDB
293
+ LOG_INTERVAL:
294
+ value: 1 # Number of training steps between console log outputs
295
+ WANDB_LOG_INTERVAL:
296
+ value: 1 # Number of training steps between WandB metric logs
297
+ IMAGE_LOG_INTERVAL:
298
+ value: 10 # Number of training steps between image logging to WandB
299
+ NO_WANDB:
300
+ value: False # Disable WandB logging if True (useful for local debugging)
301
+ MODEL_WATCHER_FREQ_WANDB:
302
+ value: 50 # Frequency (in steps) for logging model parameter histograms to WandB
303
+ WANDB_ENTITY:
304
+ value: "unreflect-anything" # WandB organization/entity name
305
+ WANDB_PROJECT:
306
+ value: "UnReflectAnything" # WandB project name
307
+ NOTES:
308
+ value: "Seam ablation - Rebuttal" # Notes/description for this training run
configs/rebuttal/ablate_SoftTHR.yaml ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### BASELINE: CONVERGES AFTER LONG
2
+
3
+ parameters:
4
+
5
+ ### MODEL ARCHITECTURE
6
+ MODEL:
7
+ value:
8
+ MODEL_CLASS: "UnReflect_Model_TokenInpainter" # Main model class name (must match class in models.py)
9
+ MODEL_MODULE: "models" # Module name to import model classes from (default: "models")
10
+ RGB_ENCODER:
11
+ ENCODER: "facebook/dinov3-vitl16-pretrain-lvd1689m" # DINOv3 encoder model name (HuggingFace format)
12
+ IMAGE_SIZE: 448 # Input image size (height and width in pixels)
13
+ RETURN_SELECTED_LAYERS: [3, 6, 9, 12] # Transformer layer indices to extract features from (0-indexed)
14
+ RGB_ENCODER_LR: 0.0 # Learning rate for RGB encoder (0.0 = frozen, must be explicitly set)
15
+ DECODERS:
16
+ diffuse:
17
+ USE_FILM: False # Enable FiLM (Feature-wise Linear Modulation) conditioning in decoder
18
+ FEATURE_DIM: 1024 # Feature dimension for decoder (should match encoder output)
19
+ REASSEMBLE_OUT_CHANNELS: [768,1024,1536,2048] # Output channels for each decoder stage (DPT-style reassembly)
20
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
21
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder ("ignore", "project", etc.)
22
+ FROM_PRETRAINED: "weights/rgb_decoder.pth" # Path to pretrained decoder weights (optional)
23
+ USE_BN: False # Use batch normalization in decoder
24
+ DROPOUT: 0.1 # Dropout rate in decoder layers
25
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
26
+ OUTPUT_CHANNELS: 3 # Number of output channels (3 for RGB diffuse image)
27
+ DECODER_LR: 1.0e-5 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
28
+ NUM_FUSION_BLOCKS_TRAINABLE: 1 # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
29
+ TRAIN_RGB_HEAD: True # Whether to train RGB head (true/false, null = train if DECODER_LR != 0)
30
+ highlight:
31
+ USE_FILM: False # Enable FiLM conditioning in highlight decoder
32
+ FEATURE_DIM: 1024 # Feature dimension for highlight decoder
33
+ REASSEMBLE_OUT_CHANNELS: [96,192,384,768] # Output channels for each decoder stage
34
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
35
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder
36
+ USE_BN: False # Use batch normalization in decoder
37
+ DROPOUT: 0.1 # Dropout rate in decoder layers
38
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
39
+ OUTPUT_CHANNELS: 1 # Number of output channels (1 for highlight mask)
40
+ DECODER_LR: 5.0e-4 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
41
+ NUM_FUSION_BLOCKS_TRAINABLE: null # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
42
+ TOKEN_INPAINTER:
43
+ TOKEN_INPAINTER_CLASS: "TokenInpainter_Blended" # Token inpainter class name
44
+ TOKEN_INPAINTER_MODULE: "token_inpainters" # Module name to import token inpainter from
45
+ FROM_PRETRAINED: "weights/token_inpainter.pth" # Path to pretrained token inpainter weights
46
+ TOKEN_INPAINTER_LR: 1.0e-5 # Learning rate for token inpainter (can differ from base LR)
47
+ DEPTH: 6 # Number of transformer blocks
48
+ HEADS: 16 # Number of attention heads
49
+ DROP: 0 # Dropout rate
50
+ USE_POSITIONAL_ENCODING: True # Enable 2D sinusoidal positional encodings
51
+ USE_FINAL_NORM: True # Enable final LayerNorm before output projection
52
+ USE_LOCAL_PRIOR: True # Blend local mean prior for masked seeds
53
+ LOCAL_PRIOR_WEIGHT: 0.5 # Weight for local prior blending (1.0 = only mask_token, 0.0 = only local mean)
54
+ LOCAL_PRIOR_KERNEL: 5 # Kernel size for local prior blending (> 1)
55
+ SEED_NOISE_STD: 0.02 # Standard deviation of noise added to masked seeds during training
56
+ INPAINT_MASK_DILATION:
57
+ value: 1 # Dilation kernel size (pixels) for inpaint mask - Must be odd
58
+ USE_TORCH_COMPILE: # Enable PyTorch 2.0 torch.compile for faster training (experimental)
59
+ value: False
60
+
61
+ ### DATA
62
+ DATASETS:
63
+ value:
64
+ SCRREAM:
65
+ VAL_SCENES: ["scene10_full_00","scene11_full_00","scene044_full_00","scene04_reduced_00","scene04_reduced_01","scene04_reduced_02"] # List of validation scene names
66
+ TARGET_SIZE: [448,448] # Target image size [height, width] in pixels
67
+ RESIZE_MODE: "resize+crop" # Image resizing mode: "resize", "crop", "resize+crop", or "pad"
68
+ FEW_IMAGES: False # If True, load only first 10 images per scene (for quick debugging)
69
+ SAMPLE_EVERY_N: 2 # Load every Nth frame from each scene (1 = all frames, 4 = every 4th frame)
70
+ LOAD_RGB_ONLY: True # If True, ignore polarization data and load only RGB images
71
+
72
+ HOUSECAT6D:
73
+ VAL_SCENES: ["val_scene1","val_scene2"] # Validation scene names
74
+ TARGET_SIZE: [448,448] # Target image size [height, width]
75
+ RESIZE_MODE: "resize+crop" # Image resizing mode
76
+ FEW_IMAGES: False # Load only first 10 images if True
77
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
78
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
79
+
80
+ CROMO:
81
+ TRAIN_SCENES: ["kitchen"] # Training scene names (list or string)
82
+ # VAL_SCENES: "station" # Validation scene names (optional)
83
+ TARGET_SIZE: [448,448] # Target image size [height, width]
84
+ RESIZE_MODE: "resize" # Image resizing mode
85
+ FEW_IMAGES: False # Load only first 10 images if True
86
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
87
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
88
+
89
+ PSD:
90
+ TRAIN_SCENES: "PSD_Train" # Training scene name (string or list)
91
+ VAL_SCENES: "PSD_Val" # Validation scene name (string or list)
92
+ TARGET_SIZE: [448,448] # Target image size [height, width]
93
+ RESIZE_MODE: "resize+crop" # Image resizing mode
94
+ FEW_IMAGES: False # Load only first 10 images if True
95
+ SAMPLE_EVERY_N: 1 # Load every Nth frame (1 = all frames)
96
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
97
+
98
+ SCARED:
99
+ VAL_SCENES: ["v22","v23","v24","v25","v26","v27","v28","v29","v30","v31","v32","v33","v34"] # Validation scene names
100
+ TARGET_SIZE: [448,448] # Target image size [height, width]
101
+ RESIZE_MODE: "resize" #"resize+crop" # Image resizing mode
102
+ SAMPLE_EVERY_N: 1 # Load every Nth frame
103
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
104
+ FEW_IMAGES: False # Load only first 10 images if True
105
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing in dataset
106
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection (0-1)
107
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
108
+ HIGHLIGHT_RECT_SIZE: [1000, 1000] # Size of highlight rectangle region [height, width]
109
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
110
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
111
+
112
+ STEREOMIS_TRACKING:
113
+ VAL_SCENES: ["P2_2"] # Validation scene names
114
+ TARGET_SIZE: [448,448] # Target image size [height, width]
115
+ RESIZE_MODE: "resize+crop" # Image resizing mode
116
+ SAMPLE_EVERY_N: 4 # Load every Nth frame
117
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
118
+ FEW_IMAGES: False # Load only first 10 images if True
119
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
120
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
121
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
122
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
123
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
124
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
125
+
126
+ CHOLEC80:
127
+ VAL_SCENES: ["val"] # Validation scene names
128
+ TARGET_SIZE: [448,448] # Target image size [height, width]
129
+ RESIZE_MODE: "resize+crop" # Image resizing mode
130
+ SAMPLE_EVERY_N: 10 # Load every Nth frame
131
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
132
+ FEW_IMAGES: False # Load only first 10 images if True
133
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
134
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
135
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
136
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
137
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
138
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
139
+
140
+ # POLARGB:
141
+ # TRAIN_SCENES: "train"
142
+ # VAL_SCENES: "test"
143
+ # TARGET_SIZE: [448,448]
144
+ # RESIZE_MODE: "resize+crop"
145
+ # SAMPLE_EVERY_N: 1
146
+ # LOAD_RGB_ONLY: True
147
+
148
+ BATCH_SIZE: # Max batch size with img size 448 is 32
149
+ value: 12 # Number of samples per batch (adjust based on GPU memory)
150
+ NUM_WORKERS:
151
+ value: 8 # Number of data loading worker processes (0 = main process only)
152
+ SHUFFLE:
153
+ value: True # Shuffle training data each epoch (False for validation/test)
154
+ PIN_MEMORY:
155
+ value: True # Pin memory in DataLoader for faster GPU transfer (recommended: True)
156
+ PREFETCH_FACTOR:
157
+ value: 2 # Number of batches to prefetch per worker (higher = more memory usage)
158
+
159
+ ### HIGHLIGHTS
160
+ MOGE_MODEL:
161
+ value: "Ruicheng/moge-2-vits-normal" # MoGe model name for normal estimation (HuggingFace format)
162
+ SURFACE_ROUGHNESS:
163
+ value: 8.0 # Blinn-Phong surface roughness exponent (higher = sharper highlights)
164
+ INTENSITY:
165
+ value: 2.0 # Specular highlight intensity multiplier
166
+ LIGHT_DISTANCE_RANGE:
167
+ value: [0.0, 1] # Range for light source distance sampling [min, max] (normalized)
168
+ LIGHT_LEFT_RIGHT_ANGLE:
169
+ value: [0, 360] # Range for light source horizontal angle [min, max] in degrees
170
+ LIGHT_ABOVE_BELOW_ANGLE:
171
+ value: [0, 360] # Range for light source vertical angle [min, max] in degrees
172
+ DATASET_HIGHLIGHT_DILATION:
173
+ value: 25 # Dilation kernel size (pixels) for dataset highlight masks
174
+ DATASET_HIGHLIGHT_THRESHOLD:
175
+ value: 0.9 # Brightness/luminance threshold (0-1) for detecting highlights in dataset images
176
+ DATASET_HIGHLIGHT_USE_LUMINANCE:
177
+ value: True # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B) for dataset highlights; if False, use simple mean brightness
178
+ HIGHLIGHT_COLOR:
179
+ value: [1.0, 1.0, 1.0] # RGB color for synthetic highlights (normalized 0-1)
180
+ CLAMP_RECONSTRUCTION:
181
+ value: True # Clamp reconstructed images to [0, 1] range if True
182
+
183
+ ### OPTIMIZATION
184
+ LEARNING_RATE:
185
+ value: 1.0e-3 # Base learning rate for optimizer
186
+ WEIGHT_DECAY:
187
+ value: 0.0 # L2 regularization weight (0.0 = no weight decay)
188
+ EPOCHS:
189
+ value: 25 # Maximum number of training epochs
190
+ GRADIENT_ACCUMULATION_STEPS:
191
+ value: 1 # Number of steps to accumulate gradients before optimizer step (1 = no accumulation)
192
+ WARMUP:
193
+ value: 200 # Number of warmup steps for learning rate schedule (linear warmup from 0 to LR)
194
+ GRADIENT_CLIPPING_MAX_NORM:
195
+ value: 8 # Maximum gradient norm for clipping (set to -1 to disable clipping)
196
+ LR_SCHEDULER:
197
+ value:
198
+ ONPLATEAU: # ReduceLROnPlateau scheduler (reduces LR when validation metric plateaus)
199
+ PATIENCE: 5 # Number of epochs to wait before reducing LR
200
+ FACTOR: 0.1 # Factor by which LR is reduced (new_lr = old_lr * factor)
201
+ COSINE: # CosineAnnealingLR scheduler (cosine annealing schedule)
202
+ N_PERIODS: 1 # Number of cosine periods over training
203
+ # STEPWISE: # StepLR scheduler (reduces LR at fixed step intervals)
204
+ # N_STEPS: 4 # Number of times to reduce LR during training
205
+ # GAMMA: 0.5 # Factor by which LR is reduced at each step (new_lr = old_lr * gamma)
206
+ # EXPONENTIAL: # ExponentialLR scheduler (exponential decay)
207
+ # GAMMA: 0.5 # Multiplicative factor for exponential decay
208
+
209
+ SWITCH_OPTIMIZER_EPOCH:
210
+ value: null # Epoch number to switch from bootstrap to refining optimizer (null = no switch)
211
+ OPTIMIZER_BOOTSTRAP_NAME:
212
+ value: "AdamW" # Optimizer name for initial training phase ("Adam", "SGD", etc.)
213
+ OPTIMIZER_REFINING_NAME:
214
+ value: "AdamW" # Optimizer name for refining phase (used after SWITCH_OPTIMIZER_EPOCH)
215
+ EARLY_STOPPING_PATIENCE:
216
+ value: 10 # Number of epochs without improvement before stopping training
217
+ SAVE_INTERVAL:
218
+ value: 1000 # Number of training steps between model checkpoints
219
+
220
+ DATASET_HIGHLIGHT_SUPERVISION_THRESHOLD:
221
+ value: 0.1 # Pixel highlights above this threshold (should be low) are excluded from supervision
222
+
223
+ ### LOSS WEIGHTS (relative to the total loss, NOT NORMALIZED LATER)
224
+ SPECULAR_LOSS_WEIGHT:
225
+ value: 0.0 # Weight for specular component reconstruction loss
226
+ DIFFUSE_LOSS_WEIGHT:
227
+ value: 1.0 # Weight for diffuse component reconstruction loss
228
+ HIGHLIGHT_LOSS_WEIGHT:
229
+ value: 1.0 # Weight for highlight mask regression loss
230
+ IMAGE_RECONSTRUCTION_LOSS_WEIGHT:
231
+ value: 0.0 # Weight for full image reconstruction loss
232
+ SATURATION_RING_LOSS_WEIGHT:
233
+ value: 0.0 # Weight for saturation ring consistency loss (around highlight regions)
234
+ RING_KERNEL_SIZE:
235
+ value: 11 # Kernel size (odd number) for saturation ring dilation around highlights
236
+ RING_VAR_WEIGHT:
237
+ value: 0.5 # Weight for variance matching in saturation ring loss (vs mean matching)
238
+ RING_TEXTURE_WEIGHT:
239
+ value: 1.0 # Weight for texture consistency term in saturation ring loss
240
+ HLREG_W_L1:
241
+ value: 1.0 # Weight for L1 loss in highlight regression
242
+ HLREG_USE_CHARB:
243
+ value: True # Use Charbonnier loss (smooth L1) instead of standard L1 if True
244
+ HLREG_W_DICE:
245
+ value: 0.2 # Weight for Dice loss in highlight regression (for mask overlap)
246
+ HLREG_W_SSIM:
247
+ value: 0.0 # Weight for SSIM loss in highlight regression
248
+ HLREG_W_GRAD:
249
+ value: 0.0 # Weight for gradient loss in highlight regression
250
+ HLREG_W_TV:
251
+ value: 0.0 # Weight for total variation loss in highlight regression
252
+ HLREG_BALANCE_MODE:
253
+ value: "auto" # Class balancing mode for highlight regression: 'none' | 'auto' | 'pos_weight'
254
+ HLREG_POS_WEIGHT:
255
+ value: 1.0 # Positive class weight (used only if BALANCE_MODE == 'pos_weight')
256
+ HLREG_FOCAL_GAMMA:
257
+ value: 2.0 # Focal loss gamma parameter (0.0 = standard BCE, 1.0-2.0 helps with gradient vanishing)
258
+
259
+ WEIGHT_TOKEN_INPAINT:
260
+ value: 1.0 # Weight for token-space inpainting loss (L1 + cosine similarity in feature space)
261
+ WEIGHT_CONTEXT_IDENTITY:
262
+ value: 0.0 # LEAVE TO 0.0: Weight for L1 loss on context (non-masked) regions (identity preservation)
263
+ WEIGHT_TV_IN_HOLE:
264
+ value: 0.0 # LEAVE TO 0.0: Weight for total variation loss inside masked/hole regions
265
+ RING_DILATE_KERNEL:
266
+ value: 17 # Dilation kernel size (odd number) for creating ring mask around highlights
267
+ WEIGHT_SEAM:
268
+ value: 0.5 # Weight for gradient matching loss on saturation ring
269
+ SEAM_USE_CHARB:
270
+ value: True # Use Charbonnier loss instead of L1 in seam loss (smooth L1 for boundary consistency)
271
+ SEAM_WEIGHT_GRAD:
272
+ value: 0.0 # Weight for gradient matching term inside seam loss (0.0 = disable gradient term)
273
+ TOKEN_FEAT_ALPHA:
274
+ value: 0.5 # Mixing factor for token feature loss: alpha * L1 + (1-alpha) * (1-cosine_sim)
275
+
276
+ ### DIFFUSE HIGHLIGHT PENALTY
277
+ WEIGHT_DIFFUSE_HIGHLIGHT_PENALTY:
278
+ value: 0.1 # Weight for penalty loss on highlights in diffuse decoder output (0.0 = disabled)
279
+ DIFFUSE_HL_THRESHOLD:
280
+ value: 0.8 # Brightness/luminance threshold for detecting highlights in diffuse (0.0-1.0)
281
+ DIFFUSE_HL_USE_CHARB:
282
+ value: True # Use Charbonnier loss instead of L1 for diffuse highlight penalty
283
+ DIFFUSE_HL_PENALTY_MODE:
284
+ value: "pixel" # Penalty mode: "brightness" (penalize brightness/luminance above threshold) or "pixel" (penalize RGB values directly)
285
+ DIFFUSE_HL_TARGET_BRIGHTNESS:
286
+ value: null # Target brightness/luminance for penalized pixels (null = use threshold value)
287
+ DIFFUSE_HL_USE_LUMINANCE:
288
+ value: False # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B); if False, use simple mean brightness
289
+
290
+ ### LOGGING, RESULTS AND WANDB
291
+ LOG_INTERVAL:
292
+ value: 1 # Number of training steps between console log outputs
293
+ WANDB_LOG_INTERVAL:
294
+ value: 1 # Number of training steps between WandB metric logs
295
+ IMAGE_LOG_INTERVAL:
296
+ value: 10 # Number of training steps between image logging to WandB
297
+ NO_WANDB:
298
+ value: False # Disable WandB logging if True (useful for local debugging)
299
+ MODEL_WATCHER_FREQ_WANDB:
300
+ value: 50 # Frequency (in steps) for logging model parameter histograms to WandB
301
+ WANDB_ENTITY:
302
+ value: "unreflect-anything" # WandB organization/entity name
303
+ WANDB_PROJECT:
304
+ value: "UnReflectAnything" # WandB project name
305
+ NOTES:
306
+ value: "SoftTHR ablation - Rebuttal" # Notes/description for this training run
configs/rebuttal/ablate_Spec.yaml ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### BASELINE: CONVERGES AFTER LONG
2
+
3
+ parameters:
4
+
5
+ ### MODEL ARCHITECTURE
6
+ MODEL:
7
+ value:
8
+ MODEL_CLASS: "UnReflect_Model_TokenInpainter" # Main model class name (must match class in models.py)
9
+ MODEL_MODULE: "models" # Module name to import model classes from (default: "models")
10
+ RGB_ENCODER:
11
+ ENCODER: "facebook/dinov3-vitl16-pretrain-lvd1689m" # DINOv3 encoder model name (HuggingFace format)
12
+ IMAGE_SIZE: 448 # Input image size (height and width in pixels)
13
+ RETURN_SELECTED_LAYERS: [3, 6, 9, 12] # Transformer layer indices to extract features from (0-indexed)
14
+ RGB_ENCODER_LR: 0.0 # Learning rate for RGB encoder (0.0 = frozen, must be explicitly set)
15
+ DECODERS:
16
+ diffuse:
17
+ USE_FILM: False # Enable FiLM (Feature-wise Linear Modulation) conditioning in decoder
18
+ FEATURE_DIM: 1024 # Feature dimension for decoder (should match encoder output)
19
+ REASSEMBLE_OUT_CHANNELS: [768,1024,1536,2048] # Output channels for each decoder stage (DPT-style reassembly)
20
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
21
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder ("ignore", "project", etc.)
22
+ FROM_PRETRAINED: "weights/rgb_decoder.pth" # Path to pretrained decoder weights (optional)
23
+ USE_BN: False # Use batch normalization in decoder
24
+ DROPOUT: 0.1 # Dropout rate in decoder layers
25
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
26
+ OUTPUT_CHANNELS: 3 # Number of output channels (3 for RGB diffuse image)
27
+ DECODER_LR: 1.0e-5 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
28
+ NUM_FUSION_BLOCKS_TRAINABLE: 1 # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
29
+ TRAIN_RGB_HEAD: True # Whether to train RGB head (true/false, null = train if DECODER_LR != 0)
30
+ highlight:
31
+ USE_FILM: False # Enable FiLM conditioning in highlight decoder
32
+ FEATURE_DIM: 1024 # Feature dimension for highlight decoder
33
+ REASSEMBLE_OUT_CHANNELS: [96,192,384,768] # Output channels for each decoder stage
34
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
35
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder
36
+ USE_BN: False # Use batch normalization in decoder
37
+ DROPOUT: 0.1 # Dropout rate in decoder layers
38
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
39
+ OUTPUT_CHANNELS: 1 # Number of output channels (1 for highlight mask)
40
+ DECODER_LR: 5.0e-4 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
41
+ NUM_FUSION_BLOCKS_TRAINABLE: null # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
42
+ TOKEN_INPAINTER:
43
+ TOKEN_INPAINTER_CLASS: "TokenInpainter_Prior" # Token inpainter class name
44
+ TOKEN_INPAINTER_MODULE: "token_inpainters" # Module name to import token inpainter from
45
+ FROM_PRETRAINED: "weights/token_inpainter.pth" # Path to pretrained token inpainter weights
46
+ TOKEN_INPAINTER_LR: 1.0e-5 # Learning rate for token inpainter (can differ from base LR)
47
+ DEPTH: 6 # Number of transformer blocks
48
+ HEADS: 16 # Number of attention heads
49
+ DROP: 0 # Dropout rate
50
+ USE_POSITIONAL_ENCODING: True # Enable 2D sinusoidal positional encodings
51
+ USE_FINAL_NORM: True # Enable final LayerNorm before output projection
52
+ USE_LOCAL_PRIOR: True # Blend local mean prior for masked seeds
53
+ LOCAL_PRIOR_WEIGHT: 0.5 # Weight for local prior blending (1.0 = only mask_token, 0.0 = only local mean)
54
+ LOCAL_PRIOR_KERNEL: 5 # Kernel size for local prior blending (> 1)
55
+ SEED_NOISE_STD: 0.02 # Standard deviation of noise added to masked seeds during training
56
+ INPAINT_MASK_DILATION:
57
+ value: 1 # Dilation kernel size (pixels) for inpaint mask - Must be odd
58
+ USE_TORCH_COMPILE: # Enable PyTorch 2.0 torch.compile for faster training (experimental)
59
+ value: False
60
+
61
+ ### DATA
62
+ DATASETS:
63
+ value:
64
+ SCRREAM:
65
+ VAL_SCENES: ["scene10_full_00","scene11_full_00","scene044_full_00","scene04_reduced_00","scene04_reduced_01","scene04_reduced_02"] # List of validation scene names
66
+ TARGET_SIZE: [448,448] # Target image size [height, width] in pixels
67
+ RESIZE_MODE: "resize+crop" # Image resizing mode: "resize", "crop", "resize+crop", or "pad"
68
+ FEW_IMAGES: False # If True, load only first 10 images per scene (for quick debugging)
69
+ SAMPLE_EVERY_N: 2 # Load every Nth frame from each scene (1 = all frames, 4 = every 4th frame)
70
+ LOAD_RGB_ONLY: True # If True, ignore polarization data and load only RGB images
71
+
72
+ HOUSECAT6D:
73
+ VAL_SCENES: ["val_scene1","val_scene2"] # Validation scene names
74
+ TARGET_SIZE: [448,448] # Target image size [height, width]
75
+ RESIZE_MODE: "resize+crop" # Image resizing mode
76
+ FEW_IMAGES: False # Load only first 10 images if True
77
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
78
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
79
+
80
+ CROMO:
81
+ TRAIN_SCENES: ["kitchen"] # Training scene names (list or string)
82
+ # VAL_SCENES: "station" # Validation scene names (optional)
83
+ TARGET_SIZE: [448,448] # Target image size [height, width]
84
+ RESIZE_MODE: "resize" # Image resizing mode
85
+ FEW_IMAGES: False # Load only first 10 images if True
86
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
87
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
88
+
89
+ PSD:
90
+ TRAIN_SCENES: "PSD_Train" # Training scene name (string or list)
91
+ VAL_SCENES: "PSD_Val" # Validation scene name (string or list)
92
+ TARGET_SIZE: [448,448] # Target image size [height, width]
93
+ RESIZE_MODE: "resize+crop" # Image resizing mode
94
+ FEW_IMAGES: False # Load only first 10 images if True
95
+ SAMPLE_EVERY_N: 1 # Load every Nth frame (1 = all frames)
96
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
97
+
98
+ SCARED:
99
+ VAL_SCENES: ["v22","v23","v24","v25","v26","v27","v28","v29","v30","v31","v32","v33","v34"] # Validation scene names
100
+ TARGET_SIZE: [448,448] # Target image size [height, width]
101
+ RESIZE_MODE: "resize" #"resize+crop" # Image resizing mode
102
+ SAMPLE_EVERY_N: 1 # Load every Nth frame
103
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
104
+ FEW_IMAGES: False # Load only first 10 images if True
105
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing in dataset
106
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection (0-1)
107
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
108
+ HIGHLIGHT_RECT_SIZE: [1000, 1000] # Size of highlight rectangle region [height, width]
109
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
110
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
111
+
112
+ STEREOMIS_TRACKING:
113
+ VAL_SCENES: ["P2_2"] # Validation scene names
114
+ TARGET_SIZE: [448,448] # Target image size [height, width]
115
+ RESIZE_MODE: "resize+crop" # Image resizing mode
116
+ SAMPLE_EVERY_N: 4 # Load every Nth frame
117
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
118
+ FEW_IMAGES: False # Load only first 10 images if True
119
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
120
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
121
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
122
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
123
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
124
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
125
+
126
+ CHOLEC80:
127
+ VAL_SCENES: ["val"] # Validation scene names
128
+ TARGET_SIZE: [448,448] # Target image size [height, width]
129
+ RESIZE_MODE: "resize+crop" # Image resizing mode
130
+ SAMPLE_EVERY_N: 10 # Load every Nth frame
131
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
132
+ FEW_IMAGES: False # Load only first 10 images if True
133
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
134
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
135
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
136
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
137
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
138
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
139
+
140
+ # POLARGB:
141
+ # TRAIN_SCENES: "train"
142
+ # VAL_SCENES: "test"
143
+ # TARGET_SIZE: [448,448]
144
+ # RESIZE_MODE: "resize+crop"
145
+ # SAMPLE_EVERY_N: 1
146
+ # LOAD_RGB_ONLY: True
147
+
148
+ BATCH_SIZE: # Max batch size with img size 448 is 32
149
+ value: 12 # Number of samples per batch (adjust based on GPU memory)
150
+ NUM_WORKERS:
151
+ value: 8 # Number of data loading worker processes (0 = main process only)
152
+ SHUFFLE:
153
+ value: True # Shuffle training data each epoch (False for validation/test)
154
+ PIN_MEMORY:
155
+ value: True # Pin memory in DataLoader for faster GPU transfer (recommended: True)
156
+ PREFETCH_FACTOR:
157
+ value: 2 # Number of batches to prefetch per worker (higher = more memory usage)
158
+
159
+ ### HIGHLIGHTS
160
+ MOGE_MODEL:
161
+ value: "Ruicheng/moge-2-vits-normal" # MoGe model name for normal estimation (HuggingFace format)
162
+ SURFACE_ROUGHNESS:
163
+ value: 8.0 # Blinn-Phong surface roughness exponent (higher = sharper highlights)
164
+ INTENSITY:
165
+ value: 2.0 # Specular highlight intensity multiplier
166
+ LIGHT_DISTANCE_RANGE:
167
+ value: [0.0, 1] # Range for light source distance sampling [min, max] (normalized)
168
+ LIGHT_LEFT_RIGHT_ANGLE:
169
+ value: [0, 360] # Range for light source horizontal angle [min, max] in degrees
170
+ LIGHT_ABOVE_BELOW_ANGLE:
171
+ value: [0, 360] # Range for light source vertical angle [min, max] in degrees
172
+ DATASET_HIGHLIGHT_DILATION:
173
+ value: 25 # Dilation kernel size (pixels) for dataset highlight masks
174
+ DATASET_HIGHLIGHT_THRESHOLD:
175
+ value: 0.9 # Brightness/luminance threshold (0-1) for detecting highlights in dataset images
176
+ DATASET_HIGHLIGHT_USE_LUMINANCE:
177
+ value: True # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B) for dataset highlights; if False, use simple mean brightness
178
+ HIGHLIGHT_COLOR:
179
+ value: [1.0, 1.0, 1.0] # RGB color for synthetic highlights (normalized 0-1)
180
+ CLAMP_RECONSTRUCTION:
181
+ value: True # Clamp reconstructed images to [0, 1] range if True
182
+
183
+ ### OPTIMIZATION
184
+ LEARNING_RATE:
185
+ value: 1.0e-3 # Base learning rate for optimizer
186
+ WEIGHT_DECAY:
187
+ value: 0.0 # L2 regularization weight (0.0 = no weight decay)
188
+ EPOCHS:
189
+ value: 25 # Maximum number of training epochs
190
+ GRADIENT_ACCUMULATION_STEPS:
191
+ value: 1 # Number of steps to accumulate gradients before optimizer step (1 = no accumulation)
192
+ WARMUP:
193
+ value: 200 # Number of warmup steps for learning rate schedule (linear warmup from 0 to LR)
194
+ GRADIENT_CLIPPING_MAX_NORM:
195
+ value: 8 # Maximum gradient norm for clipping (set to -1 to disable clipping)
196
+ LR_SCHEDULER:
197
+ value:
198
+ ONPLATEAU: # ReduceLROnPlateau scheduler (reduces LR when validation metric plateaus)
199
+ PATIENCE: 5 # Number of epochs to wait before reducing LR
200
+ FACTOR: 0.1 # Factor by which LR is reduced (new_lr = old_lr * factor)
201
+ COSINE: # CosineAnnealingLR scheduler (cosine annealing schedule)
202
+ N_PERIODS: 1 # Number of cosine periods over training
203
+ # STEPWISE: # StepLR scheduler (reduces LR at fixed step intervals)
204
+ # N_STEPS: 4 # Number of times to reduce LR during training
205
+ # GAMMA: 0.5 # Factor by which LR is reduced at each step (new_lr = old_lr * gamma)
206
+ # EXPONENTIAL: # ExponentialLR scheduler (exponential decay)
207
+ # GAMMA: 0.5 # Multiplicative factor for exponential decay
208
+
209
+ SWITCH_OPTIMIZER_EPOCH:
210
+ value: null # Epoch number to switch from bootstrap to refining optimizer (null = no switch)
211
+ OPTIMIZER_BOOTSTRAP_NAME:
212
+ value: "AdamW" # Optimizer name for initial training phase ("Adam", "SGD", etc.)
213
+ OPTIMIZER_REFINING_NAME:
214
+ value: "AdamW" # Optimizer name for refining phase (used after SWITCH_OPTIMIZER_EPOCH)
215
+ EARLY_STOPPING_PATIENCE:
216
+ value: 10 # Number of epochs without improvement before stopping training
217
+ SAVE_INTERVAL:
218
+ value: 1000 # Number of training steps between model checkpoints
219
+
220
+ DATASET_HIGHLIGHT_SUPERVISION_THRESHOLD:
221
+ value: 0.1 # Pixel highlights above this threshold (should be low) are excluded from supervision
222
+
223
+ ### LOSS WEIGHTS (relative to the total loss, NOT NORMALIZED LATER)
224
+ ### ABLATION =======================================================================
225
+ SPECULAR_LOSS_WEIGHT:
226
+ value: 0.0 # Weight for specular component reconstruction loss
227
+ ###=================================================================================
228
+ DIFFUSE_LOSS_WEIGHT:
229
+ value: 1.0 # Weight for diffuse component reconstruction loss
230
+ HIGHLIGHT_LOSS_WEIGHT:
231
+ value: 1.0 # Weight for highlight mask regression loss
232
+ IMAGE_RECONSTRUCTION_LOSS_WEIGHT:
233
+ value: 0.0 # Weight for full image reconstruction loss
234
+ SATURATION_RING_LOSS_WEIGHT:
235
+ value: 0.0 # Weight for saturation ring consistency loss (around highlight regions)
236
+ RING_KERNEL_SIZE:
237
+ value: 11 # Kernel size (odd number) for saturation ring dilation around highlights
238
+ RING_VAR_WEIGHT:
239
+ value: 0.5 # Weight for variance matching in saturation ring loss (vs mean matching)
240
+ RING_TEXTURE_WEIGHT:
241
+ value: 1.0 # Weight for texture consistency term in saturation ring loss
242
+ HLREG_W_L1:
243
+ value: 1.0 # Weight for L1 loss in highlight regression
244
+ HLREG_USE_CHARB:
245
+ value: True # Use Charbonnier loss (smooth L1) instead of standard L1 if True
246
+ HLREG_W_DICE:
247
+ value: 0.2 # Weight for Dice loss in highlight regression (for mask overlap)
248
+ HLREG_W_SSIM:
249
+ value: 0.0 # Weight for SSIM loss in highlight regression
250
+ HLREG_W_GRAD:
251
+ value: 0.0 # Weight for gradient loss in highlight regression
252
+ HLREG_W_TV:
253
+ value: 0.0 # Weight for total variation loss in highlight regression
254
+ HLREG_BALANCE_MODE:
255
+ value: "auto" # Class balancing mode for highlight regression: 'none' | 'auto' | 'pos_weight'
256
+ HLREG_POS_WEIGHT:
257
+ value: 1.0 # Positive class weight (used only if BALANCE_MODE == 'pos_weight')
258
+ HLREG_FOCAL_GAMMA:
259
+ value: 2.0 # Focal loss gamma parameter (0.0 = standard BCE, 1.0-2.0 helps with gradient vanishing)
260
+
261
+ WEIGHT_TOKEN_INPAINT:
262
+ value: 1.0 # Weight for token-space inpainting loss (L1 + cosine similarity in feature space)
263
+ WEIGHT_CONTEXT_IDENTITY:
264
+ value: 0.0 # LEAVE TO 0.0: Weight for L1 loss on context (non-masked) regions (identity preservation)
265
+ WEIGHT_TV_IN_HOLE:
266
+ value: 0.0 # LEAVE TO 0.0: Weight for total variation loss inside masked/hole regions
267
+ RING_DILATE_KERNEL:
268
+ value: 17 # Dilation kernel size (odd number) for creating ring mask around highlights
269
+ WEIGHT_SEAM:
270
+ value: 0.5 # Weight for gradient matching loss on saturation ring
271
+ SEAM_USE_CHARB:
272
+ value: True # Use Charbonnier loss instead of L1 in seam loss (smooth L1 for boundary consistency)
273
+ SEAM_WEIGHT_GRAD:
274
+ value: 0.0 # Weight for gradient matching term inside seam loss (0.0 = disable gradient term)
275
+ TOKEN_FEAT_ALPHA:
276
+ value: 0.5 # Mixing factor for token feature loss: alpha * L1 + (1-alpha) * (1-cosine_sim)
277
+
278
+ ### DIFFUSE HIGHLIGHT PENALTY
279
+ WEIGHT_DIFFUSE_HIGHLIGHT_PENALTY:
280
+ value: 0.1 # Weight for penalty loss on highlights in diffuse decoder output (0.0 = disabled)
281
+ DIFFUSE_HL_THRESHOLD:
282
+ value: 0.8 # Brightness/luminance threshold for detecting highlights in diffuse (0.0-1.0)
283
+ DIFFUSE_HL_USE_CHARB:
284
+ value: True # Use Charbonnier loss instead of L1 for diffuse highlight penalty
285
+ DIFFUSE_HL_PENALTY_MODE:
286
+ value: "brightness" # Penalty mode: "brightness" (penalize brightness/luminance above threshold) or "pixel" (penalize RGB values directly)
287
+ DIFFUSE_HL_TARGET_BRIGHTNESS:
288
+ value: null # Target brightness/luminance for penalized pixels (null = use threshold value)
289
+ DIFFUSE_HL_USE_LUMINANCE:
290
+ value: False # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B); if False, use simple mean brightness
291
+
292
+ ### LOGGING, RESULTS AND WANDB
293
+ LOG_INTERVAL:
294
+ value: 1 # Number of training steps between console log outputs
295
+ WANDB_LOG_INTERVAL:
296
+ value: 1 # Number of training steps between WandB metric logs
297
+ IMAGE_LOG_INTERVAL:
298
+ value: 10 # Number of training steps between image logging to WandB
299
+ NO_WANDB:
300
+ value: False # Disable WandB logging if True (useful for local debugging)
301
+ MODEL_WATCHER_FREQ_WANDB:
302
+ value: 50 # Frequency (in steps) for logging model parameter histograms to WandB
303
+ WANDB_ENTITY:
304
+ value: "unreflect-anything" # WandB organization/entity name
305
+ WANDB_PROJECT:
306
+ value: "UnReflectAnything" # WandB project name
307
+ NOTES:
308
+ value: "Spec ablation - Rebuttal" # Notes/description for this training run
configs/rebuttal/ablate_TV.yaml ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### BASELINE: CONVERGES AFTER LONG
2
+
3
+ parameters:
4
+
5
+ ### MODEL ARCHITECTURE
6
+ MODEL:
7
+ value:
8
+ MODEL_CLASS: "UnReflect_Model_TokenInpainter" # Main model class name (must match class in models.py)
9
+ MODEL_MODULE: "models" # Module name to import model classes from (default: "models")
10
+ RGB_ENCODER:
11
+ ENCODER: "facebook/dinov3-vitl16-pretrain-lvd1689m" # DINOv3 encoder model name (HuggingFace format)
12
+ IMAGE_SIZE: 448 # Input image size (height and width in pixels)
13
+ RETURN_SELECTED_LAYERS: [3, 6, 9, 12] # Transformer layer indices to extract features from (0-indexed)
14
+ RGB_ENCODER_LR: 0.0 # Learning rate for RGB encoder (0.0 = frozen, must be explicitly set)
15
+ DECODERS:
16
+ diffuse:
17
+ USE_FILM: False # Enable FiLM (Feature-wise Linear Modulation) conditioning in decoder
18
+ FEATURE_DIM: 1024 # Feature dimension for decoder (should match encoder output)
19
+ REASSEMBLE_OUT_CHANNELS: [768,1024,1536,2048] # Output channels for each decoder stage (DPT-style reassembly)
20
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
21
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder ("ignore", "project", etc.)
22
+ FROM_PRETRAINED: "weights/rgb_decoder.pth" # Path to pretrained decoder weights (optional)
23
+ USE_BN: False # Use batch normalization in decoder
24
+ DROPOUT: 0.1 # Dropout rate in decoder layers
25
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
26
+ OUTPUT_CHANNELS: 3 # Number of output channels (3 for RGB diffuse image)
27
+ DECODER_LR: 1.0e-5 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
28
+ NUM_FUSION_BLOCKS_TRAINABLE: 1 # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
29
+ TRAIN_RGB_HEAD: True # Whether to train RGB head (true/false, null = train if DECODER_LR != 0)
30
+ highlight:
31
+ USE_FILM: False # Enable FiLM conditioning in highlight decoder
32
+ FEATURE_DIM: 1024 # Feature dimension for highlight decoder
33
+ REASSEMBLE_OUT_CHANNELS: [96,192,384,768] # Output channels for each decoder stage
34
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
35
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder
36
+ USE_BN: False # Use batch normalization in decoder
37
+ DROPOUT: 0.1 # Dropout rate in decoder layers
38
+ OUTPUT_IMAGE_SIZE: [448,448] # Output image resolution [height, width]
39
+ OUTPUT_CHANNELS: 1 # Number of output channels (1 for highlight mask)
40
+ DECODER_LR: 5.0e-4 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
41
+ NUM_FUSION_BLOCKS_TRAINABLE: null # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
42
+ TOKEN_INPAINTER:
43
+ TOKEN_INPAINTER_CLASS: "TokenInpainter_Prior" # Token inpainter class name
44
+ TOKEN_INPAINTER_MODULE: "token_inpainters" # Module name to import token inpainter from
45
+ FROM_PRETRAINED: "weights/token_inpainter.pth" # Path to pretrained token inpainter weights
46
+ TOKEN_INPAINTER_LR: 1.0e-5 # Learning rate for token inpainter (can differ from base LR)
47
+ DEPTH: 6 # Number of transformer blocks
48
+ HEADS: 16 # Number of attention heads
49
+ DROP: 0 # Dropout rate
50
+ USE_POSITIONAL_ENCODING: True # Enable 2D sinusoidal positional encodings
51
+ USE_FINAL_NORM: True # Enable final LayerNorm before output projection
52
+ USE_LOCAL_PRIOR: True # Blend local mean prior for masked seeds
53
+ LOCAL_PRIOR_WEIGHT: 0.5 # Weight for local prior blending (1.0 = only mask_token, 0.0 = only local mean)
54
+ LOCAL_PRIOR_KERNEL: 5 # Kernel size for local prior blending (> 1)
55
+ SEED_NOISE_STD: 0.02 # Standard deviation of noise added to masked seeds during training
56
+ INPAINT_MASK_DILATION:
57
+ value: 1 # Dilation kernel size (pixels) for inpaint mask - Must be odd
58
+ USE_TORCH_COMPILE: # Enable PyTorch 2.0 torch.compile for faster training (experimental)
59
+ value: False
60
+
61
+ ### DATA
62
+ DATASETS:
63
+ value:
64
+ SCRREAM:
65
+ VAL_SCENES: ["scene10_full_00","scene11_full_00","scene044_full_00","scene04_reduced_00","scene04_reduced_01","scene04_reduced_02"] # List of validation scene names
66
+ TARGET_SIZE: [448,448] # Target image size [height, width] in pixels
67
+ RESIZE_MODE: "resize+crop" # Image resizing mode: "resize", "crop", "resize+crop", or "pad"
68
+ FEW_IMAGES: False # If True, load only first 10 images per scene (for quick debugging)
69
+ SAMPLE_EVERY_N: 2 # Load every Nth frame from each scene (1 = all frames, 4 = every 4th frame)
70
+ LOAD_RGB_ONLY: True # If True, ignore polarization data and load only RGB images
71
+
72
+ HOUSECAT6D:
73
+ VAL_SCENES: ["val_scene1","val_scene2"] # Validation scene names
74
+ TARGET_SIZE: [448,448] # Target image size [height, width]
75
+ RESIZE_MODE: "resize+crop" # Image resizing mode
76
+ FEW_IMAGES: False # Load only first 10 images if True
77
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
78
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
79
+
80
+ CROMO:
81
+ TRAIN_SCENES: ["kitchen"] # Training scene names (list or string)
82
+ # VAL_SCENES: "station" # Validation scene names (optional)
83
+ TARGET_SIZE: [448,448] # Target image size [height, width]
84
+ RESIZE_MODE: "resize" # Image resizing mode
85
+ FEW_IMAGES: False # Load only first 10 images if True
86
+ SAMPLE_EVERY_N: 2 # Load every Nth frame
87
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
88
+
89
+ PSD:
90
+ TRAIN_SCENES: "PSD_Train" # Training scene name (string or list)
91
+ VAL_SCENES: "PSD_Val" # Validation scene name (string or list)
92
+ TARGET_SIZE: [448,448] # Target image size [height, width]
93
+ RESIZE_MODE: "resize+crop" # Image resizing mode
94
+ FEW_IMAGES: False # Load only first 10 images if True
95
+ SAMPLE_EVERY_N: 1 # Load every Nth frame (1 = all frames)
96
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
97
+
98
+ SCARED:
99
+ VAL_SCENES: ["v22","v23","v24","v25","v26","v27","v28","v29","v30","v31","v32","v33","v34"] # Validation scene names
100
+ TARGET_SIZE: [448,448] # Target image size [height, width]
101
+ RESIZE_MODE: "resize" #"resize+crop" # Image resizing mode
102
+ SAMPLE_EVERY_N: 1 # Load every Nth frame
103
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
104
+ FEW_IMAGES: False # Load only first 10 images if True
105
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing in dataset
106
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection (0-1)
107
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
108
+ HIGHLIGHT_RECT_SIZE: [1000, 1000] # Size of highlight rectangle region [height, width]
109
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
110
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
111
+
112
+ STEREOMIS_TRACKING:
113
+ VAL_SCENES: ["P2_2"] # Validation scene names
114
+ TARGET_SIZE: [448,448] # Target image size [height, width]
115
+ RESIZE_MODE: "resize+crop" # Image resizing mode
116
+ SAMPLE_EVERY_N: 4 # Load every Nth frame
117
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
118
+ FEW_IMAGES: False # Load only first 10 images if True
119
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
120
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
121
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
122
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
123
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
124
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
125
+
126
+ CHOLEC80:
127
+ VAL_SCENES: ["val"] # Validation scene names
128
+ TARGET_SIZE: [448,448] # Target image size [height, width]
129
+ RESIZE_MODE: "resize+crop" # Image resizing mode
130
+ SAMPLE_EVERY_N: 10 # Load every Nth frame
131
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
132
+ FEW_IMAGES: False # Load only first 10 images if True
133
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
134
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
135
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
136
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
137
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
138
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
139
+
140
+ # POLARGB:
141
+ # TRAIN_SCENES: "train"
142
+ # VAL_SCENES: "test"
143
+ # TARGET_SIZE: [448,448]
144
+ # RESIZE_MODE: "resize+crop"
145
+ # SAMPLE_EVERY_N: 1
146
+ # LOAD_RGB_ONLY: True
147
+
148
+ BATCH_SIZE: # Max batch size with img size 448 is 32
149
+ value: 12 # Number of samples per batch (adjust based on GPU memory)
150
+ NUM_WORKERS:
151
+ value: 8 # Number of data loading worker processes (0 = main process only)
152
+ SHUFFLE:
153
+ value: True # Shuffle training data each epoch (False for validation/test)
154
+ PIN_MEMORY:
155
+ value: True # Pin memory in DataLoader for faster GPU transfer (recommended: True)
156
+ PREFETCH_FACTOR:
157
+ value: 2 # Number of batches to prefetch per worker (higher = more memory usage)
158
+
159
+ ### HIGHLIGHTS
160
+ MOGE_MODEL:
161
+ value: "Ruicheng/moge-2-vits-normal" # MoGe model name for normal estimation (HuggingFace format)
162
+ SURFACE_ROUGHNESS:
163
+ value: 8.0 # Blinn-Phong surface roughness exponent (higher = sharper highlights)
164
+ INTENSITY:
165
+ value: 2.0 # Specular highlight intensity multiplier
166
+ LIGHT_DISTANCE_RANGE:
167
+ value: [0.0, 1] # Range for light source distance sampling [min, max] (normalized)
168
+ LIGHT_LEFT_RIGHT_ANGLE:
169
+ value: [0, 360] # Range for light source horizontal angle [min, max] in degrees
170
+ LIGHT_ABOVE_BELOW_ANGLE:
171
+ value: [0, 360] # Range for light source vertical angle [min, max] in degrees
172
+ DATASET_HIGHLIGHT_DILATION:
173
+ value: 25 # Dilation kernel size (pixels) for dataset highlight masks
174
+ DATASET_HIGHLIGHT_THRESHOLD:
175
+ value: 0.9 # Brightness/luminance threshold (0-1) for detecting highlights in dataset images
176
+ DATASET_HIGHLIGHT_USE_LUMINANCE:
177
+ value: True # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B) for dataset highlights; if False, use simple mean brightness
178
+ HIGHLIGHT_COLOR:
179
+ value: [1.0, 1.0, 1.0] # RGB color for synthetic highlights (normalized 0-1)
180
+ CLAMP_RECONSTRUCTION:
181
+ value: True # Clamp reconstructed images to [0, 1] range if True
182
+
183
+ ### OPTIMIZATION
184
+ LEARNING_RATE:
185
+ value: 1.0e-3 # Base learning rate for optimizer
186
+ WEIGHT_DECAY:
187
+ value: 0.0 # L2 regularization weight (0.0 = no weight decay)
188
+ EPOCHS:
189
+ value: 25 # Maximum number of training epochs
190
+ GRADIENT_ACCUMULATION_STEPS:
191
+ value: 1 # Number of steps to accumulate gradients before optimizer step (1 = no accumulation)
192
+ WARMUP:
193
+ value: 200 # Number of warmup steps for learning rate schedule (linear warmup from 0 to LR)
194
+ GRADIENT_CLIPPING_MAX_NORM:
195
+ value: 8 # Maximum gradient norm for clipping (set to -1 to disable clipping)
196
+ LR_SCHEDULER:
197
+ value:
198
+ ONPLATEAU: # ReduceLROnPlateau scheduler (reduces LR when validation metric plateaus)
199
+ PATIENCE: 5 # Number of epochs to wait before reducing LR
200
+ FACTOR: 0.1 # Factor by which LR is reduced (new_lr = old_lr * factor)
201
+ COSINE: # CosineAnnealingLR scheduler (cosine annealing schedule)
202
+ N_PERIODS: 1 # Number of cosine periods over training
203
+ # STEPWISE: # StepLR scheduler (reduces LR at fixed step intervals)
204
+ # N_STEPS: 4 # Number of times to reduce LR during training
205
+ # GAMMA: 0.5 # Factor by which LR is reduced at each step (new_lr = old_lr * gamma)
206
+ # EXPONENTIAL: # ExponentialLR scheduler (exponential decay)
207
+ # GAMMA: 0.5 # Multiplicative factor for exponential decay
208
+
209
+ SWITCH_OPTIMIZER_EPOCH:
210
+ value: null # Epoch number to switch from bootstrap to refining optimizer (null = no switch)
211
+ OPTIMIZER_BOOTSTRAP_NAME:
212
+ value: "AdamW" # Optimizer name for initial training phase ("Adam", "SGD", etc.)
213
+ OPTIMIZER_REFINING_NAME:
214
+ value: "AdamW" # Optimizer name for refining phase (used after SWITCH_OPTIMIZER_EPOCH)
215
+ EARLY_STOPPING_PATIENCE:
216
+ value: 10 # Number of epochs without improvement before stopping training
217
+ SAVE_INTERVAL:
218
+ value: 1000 # Number of training steps between model checkpoints
219
+
220
+ DATASET_HIGHLIGHT_SUPERVISION_THRESHOLD:
221
+ value: 0.1 # Pixel highlights above this threshold (should be low) are excluded from supervision
222
+
223
+ ### LOSS WEIGHTS (relative to the total loss, NOT NORMALIZED LATER)
224
+ SPECULAR_LOSS_WEIGHT:
225
+ value: 0.0 # Weight for specular component reconstruction loss
226
+ DIFFUSE_LOSS_WEIGHT:
227
+ value: 1.0 # Weight for diffuse component reconstruction loss
228
+ HIGHLIGHT_LOSS_WEIGHT:
229
+ value: 1.0 # Weight for highlight mask regression loss
230
+ IMAGE_RECONSTRUCTION_LOSS_WEIGHT:
231
+ value: 0.0 # Weight for full image reconstruction loss
232
+ SATURATION_RING_LOSS_WEIGHT:
233
+ value: 0.0 # Weight for saturation ring consistency loss (around highlight regions)
234
+ RING_KERNEL_SIZE:
235
+ value: 11 # Kernel size (odd number) for saturation ring dilation around highlights
236
+ RING_VAR_WEIGHT:
237
+ value: 0.5 # Weight for variance matching in saturation ring loss (vs mean matching)
238
+ RING_TEXTURE_WEIGHT:
239
+ value: 1.0 # Weight for texture consistency term in saturation ring loss
240
+ HLREG_W_L1:
241
+ value: 1.0 # Weight for L1 loss in highlight regression
242
+ HLREG_USE_CHARB:
243
+ value: True # Use Charbonnier loss (smooth L1) instead of standard L1 if True
244
+ HLREG_W_DICE:
245
+ value: 0.2 # Weight for Dice loss in highlight regression (for mask overlap)
246
+ HLREG_W_SSIM:
247
+ value: 0.0 # Weight for SSIM loss in highlight regression
248
+ HLREG_W_GRAD:
249
+ value: 0.0 # Weight for gradient loss in highlight regression
250
+ ### ABLATION =======================================================================
251
+ HLREG_W_TV:
252
+ value: 0.0 # Weight for total variation loss in highlight regression
253
+ ###=================================================================================
254
+ HLREG_BALANCE_MODE:
255
+ value: "auto" # Class balancing mode for highlight regression: 'none' | 'auto' | 'pos_weight'
256
+ HLREG_POS_WEIGHT:
257
+ value: 1.0 # Positive class weight (used only if BALANCE_MODE == 'pos_weight')
258
+ HLREG_FOCAL_GAMMA:
259
+ value: 2.0 # Focal loss gamma parameter (0.0 = standard BCE, 1.0-2.0 helps with gradient vanishing)
260
+
261
+ WEIGHT_TOKEN_INPAINT:
262
+ value: 1.0 # Weight for token-space inpainting loss (L1 + cosine similarity in feature space)
263
+ WEIGHT_CONTEXT_IDENTITY:
264
+ value: 0.0 # LEAVE TO 0.0: Weight for L1 loss on context (non-masked) regions (identity preservation)
265
+ WEIGHT_TV_IN_HOLE:
266
+ value: 0.0 # LEAVE TO 0.0: Weight for total variation loss inside masked/hole regions
267
+ RING_DILATE_KERNEL:
268
+ value: 17 # Dilation kernel size (odd number) for creating ring mask around highlights
269
+ WEIGHT_SEAM:
270
+ value: 0.5 # Weight for gradient matching loss on saturation ring
271
+ SEAM_USE_CHARB:
272
+ value: True # Use Charbonnier loss instead of L1 in seam loss (smooth L1 for boundary consistency)
273
+ SEAM_WEIGHT_GRAD:
274
+ value: 0.0 # Weight for gradient matching term inside seam loss (0.0 = disable gradient term)
275
+ TOKEN_FEAT_ALPHA:
276
+ value: 0.5 # Mixing factor for token feature loss: alpha * L1 + (1-alpha) * (1-cosine_sim)
277
+
278
+ ### DIFFUSE HIGHLIGHT PENALTY
279
+ WEIGHT_DIFFUSE_HIGHLIGHT_PENALTY:
280
+ value: 0.1 # Weight for penalty loss on highlights in diffuse decoder output (0.0 = disabled)
281
+ DIFFUSE_HL_THRESHOLD:
282
+ value: 0.8 # Brightness/luminance threshold for detecting highlights in diffuse (0.0-1.0)
283
+ DIFFUSE_HL_USE_CHARB:
284
+ value: True # Use Charbonnier loss instead of L1 for diffuse highlight penalty
285
+ DIFFUSE_HL_PENALTY_MODE:
286
+ value: "pixel" # Penalty mode: "brightness" (penalize brightness/luminance above threshold) or "pixel" (penalize RGB values directly)
287
+ DIFFUSE_HL_TARGET_BRIGHTNESS:
288
+ value: null # Target brightness/luminance for penalized pixels (null = use threshold value)
289
+ DIFFUSE_HL_USE_LUMINANCE:
290
+ value: False # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B); if False, use simple mean brightness
291
+
292
+ ### LOGGING, RESULTS AND WANDB
293
+ LOG_INTERVAL:
294
+ value: 1 # Number of training steps between console log outputs
295
+ WANDB_LOG_INTERVAL:
296
+ value: 1 # Number of training steps between WandB metric logs
297
+ IMAGE_LOG_INTERVAL:
298
+ value: 10 # Number of training steps between image logging to WandB
299
+ NO_WANDB:
300
+ value: False # Disable WandB logging if True (useful for local debugging)
301
+ MODEL_WATCHER_FREQ_WANDB:
302
+ value: 50 # Frequency (in steps) for logging model parameter histograms to WandB
303
+ WANDB_ENTITY:
304
+ value: "unreflect-anything" # WandB organization/entity name
305
+ WANDB_PROJECT:
306
+ value: "UnReflectAnything" # WandB project name
307
+ NOTES:
308
+ value: "TV ablation - Rebuttal" # Notes/description for this training run