AlbeRota commited on
Commit
32f1686
·
verified ·
1 Parent(s): 77db1ed

Upload weights, notebooks, sample images

Browse files
configs/decoder_pretrain.yaml CHANGED
@@ -14,7 +14,6 @@ parameters:
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
@@ -27,7 +26,7 @@ parameters:
27
  DECODER_LR: 5.0e-5 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
28
  NUM_FUSION_BLOCKS_TRAINABLE: null # 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
- TOKEN_INPAINTER:
31
  TOKEN_INPAINTER_CLASS: "TokenInpainter_Prior" # Token inpainter class name
32
  TOKEN_INPAINTER_MODULE: "token_inpainters" # Module name to import token inpainter from
33
  FROM_PRETRAINED: "weights/token_inpainter.pth" # Path to pretrained token inpainter weights (optional)
@@ -226,6 +225,9 @@ parameters:
226
  value: 1.0 # Weight for diffuse component reconstruction loss
227
  HIGHLIGHT_LOSS_WEIGHT:
228
  value: 0.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:
@@ -255,8 +257,6 @@ parameters:
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
- TOKEN_INPAINT_LOSS_WEIGHT:
259
- value: 0.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:
@@ -302,5 +302,5 @@ parameters:
302
  WANDB_PROJECT:
303
  value: "UnReflectAnything" # WandB project name
304
  NOTES:
305
- value: "896 Decoder Pretraining" # Notes/description for this training run
306
 
 
14
  RGB_ENCODER_LR: 0.0 # Learning rate for RGB encoder (0.0 = frozen, must be explicitly set)
15
  DECODERS:
16
  diffuse:
 
17
  FEATURE_DIM: 1024 # Feature dimension for decoder (should match encoder output)
18
  REASSEMBLE_OUT_CHANNELS: [768,1024,1536,2048] # Output channels for each decoder stage (DPT-style reassembly)
19
  REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
 
26
  DECODER_LR: 5.0e-5 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
27
  NUM_FUSION_BLOCKS_TRAINABLE: null # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
28
  TRAIN_RGB_HEAD: True # Whether to train RGB head (true/false, null = train if DECODER_LR != 0)
29
+ TOKEN_INPAINTER: # <<<<<<<<<<<< DOESNT MATTER, MODEL CLASS IS NOT TOKEN INPAINTER
30
  TOKEN_INPAINTER_CLASS: "TokenInpainter_Prior" # Token inpainter class name
31
  TOKEN_INPAINTER_MODULE: "token_inpainters" # Module name to import token inpainter from
32
  FROM_PRETRAINED: "weights/token_inpainter.pth" # Path to pretrained token inpainter weights (optional)
 
225
  value: 1.0 # Weight for diffuse component reconstruction loss
226
  HIGHLIGHT_LOSS_WEIGHT:
227
  value: 0.0 # Weight for highlight mask regression loss
228
+ TOKEN_INPAINT_LOSS_WEIGHT:
229
+ value: 0.0 # Weight for token-space inpainting loss (L1 + cosine similarity in feature space)
230
+
231
  IMAGE_RECONSTRUCTION_LOSS_WEIGHT:
232
  value: 0.0 # Weight for full image reconstruction loss
233
  SATURATION_RING_LOSS_WEIGHT:
 
257
  HLREG_FOCAL_GAMMA:
258
  value: 2.0 # Focal loss gamma parameter (0.0 = standard BCE, 1.0-2.0 helps with gradient vanishing)
259
 
 
 
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:
 
302
  WANDB_PROJECT:
303
  value: "UnReflectAnything" # WandB project name
304
  NOTES:
305
+ value: "" # Notes/description for this training run
306
 
configs/finetune_e2e.yaml ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: 896 # 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
+ FEATURE_DIM: 1024 # Feature dimension for decoder (should match encoder output)
18
+ REASSEMBLE_OUT_CHANNELS: [768,1024,1536,2048] # Output channels for each decoder stage (DPT-style reassembly)
19
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
20
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder ("ignore", "project", etc.)
21
+ FROM_PRETRAINED: "weights/diffuse_decoder.pt" # Path to pretrained decoder weights (optional)
22
+ USE_BN: False # Use batch normalization in decoder
23
+ DROPOUT: 0.1 # Dropout rate in decoder layers
24
+ OUTPUT_IMAGE_SIZE: [896,896] # Output image resolution [height, width]
25
+ OUTPUT_CHANNELS: 3 # Number of output channels (3 for RGB diffuse image)
26
+ DECODER_LR: 1.0e-5 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
27
+ NUM_FUSION_BLOCKS_TRAINABLE: 1 # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
28
+ TRAIN_RGB_HEAD: True # Whether to train RGB head (true/false, null = train if DECODER_LR != 0)
29
+ highlight:
30
+ FEATURE_DIM: 1024 # Feature dimension for highlight decoder
31
+ REASSEMBLE_OUT_CHANNELS: [96,192,384,768] # Output channels for each decoder stage
32
+ REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
33
+ READOUT_TYPE: "ignore" # Readout type for DPT decoder
34
+ USE_BN: False # Use batch normalization in decoder
35
+ DROPOUT: 0.1 # Dropout rate in decoder layers
36
+ OUTPUT_IMAGE_SIZE: [896,896] # Output image resolution [height, width]
37
+ OUTPUT_CHANNELS: 1 # Number of output channels (1 for highlight mask)
38
+ DECODER_LR: 0.0 # Custom learning rate for decoder (0.0 = frozen, 1.0 = same as base LR)
39
+ NUM_FUSION_BLOCKS_TRAINABLE: null # Number of fusion blocks to train (0-4, null = train all if DECODER_LR != 0)
40
+ TOKEN_INPAINTER:
41
+ TOKEN_INPAINTER_CLASS: "TokenInpainter_Prior" # Token inpainter class name
42
+ TOKEN_INPAINTER_MODULE: "token_inpainters" # Module name to import token inpainter from
43
+ FROM_PRETRAINED: "weights/token_inpainter.pth" # Path to pretrained token inpainter weights (optional)
44
+ TOKEN_INPAINTER_LR: 1.0e-4 # Learning rate for token inpainter (can differ from base LR)
45
+ DEPTH: 6 # Number of transformer blocks
46
+ HEADS: 16 # Number of attention heads
47
+ DROP: 0.05 # Dropout rate
48
+ USE_POSITIONAL_ENCODING: True # Enable 2D sinusoidal positional encodings
49
+ USE_FINAL_NORM: True # Enable final LayerNorm before output projection
50
+ USE_LOCAL_PRIOR: True # Blend local mean prior for masked seeds
51
+ LOCAL_PRIOR_WEIGHT: 0.25 # Weight for local prior blending (1.0 = only mask_token, 0.0 = only local mean)
52
+ LOCAL_PRIOR_KERNEL: 5 # Kernel size for local prior blending (> 1)
53
+ SEED_NOISE_STD: 0.02 # Standard deviation of noise added to masked seeds during training
54
+ INPAINT_MASK_DILATION:
55
+ value: 15 # Dilation kernel size (pixels) for inpaint mask - Must be odd
56
+ USE_TORCH_COMPILE: # Enable PyTorch 2.0 torch.compile for faster training (experimental)
57
+ value: False
58
+ DISTRIBUTE:
59
+ value: "ddp"
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: [896,896] # 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: [896,896] # 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: [896,896] # 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: [896,896] # 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: [896,896] # Target image size [height, width]
101
+ RESIZE_MODE: "resize+crop" # Image resizing mode
102
+ SAMPLE_EVERY_N: 8 # 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: [896,896] # 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 imagas 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: [896,896] # 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
+ SUNRGBD:
141
+ VAL_SCENES: ["realsense"] # Validation scene names
142
+ TARGET_SIZE: [896,896] # Target image size [height, width]
143
+ RESIZE_MODE: "resize+crop" # Image resizing mode
144
+ SAMPLE_EVERY_N: 1 # Load every Nth frame
145
+ LOAD_RGB_ONLY: True # Ignore polarization data if True
146
+ FEW_IMAGES: False # Load only first 10 images if True
147
+ HIGHLIGHT_ENABLE: False # Enable highlight detection/processing
148
+ HIGHLIGHT_BRIGHTNESS_THRESHOLD: 0.9 # Brightness threshold for highlight detection
149
+ HIGHLIGHT_RETURN_MASK: True # Return highlight mask in dataset output
150
+ HIGHLIGHT_RECT_SIZE: [800, 800] # Size of highlight rectangle region
151
+ HIGHLIGHT_RETURN_RECT_AS_RGB: False # Return highlight rectangle as RGB if True
152
+ HIGHLIGHT_RETURN_RECT: True # Return highlight rectangle region if True
153
+
154
+
155
+ FEW_IMAGES_OVERRIDE:
156
+ value: False # If True, override all datasets' FEW_IMAGES to True (for quick debugging across all datasets)
157
+
158
+ BATCH_SIZE: # Max batch size with img size 896 is 32
159
+ value: 4 # Number of samples per batch (adjust based on GPU memory)
160
+ NUM_WORKERS:
161
+ value: 16 # Number of data loading worker processes (0 = main process only, "auto" = 90% of CPU affinity)
162
+ SHUFFLE:
163
+ value: True # Shuffle training data each epoch (False for validation/test)
164
+ PIN_MEMORY:
165
+ value: True # Pin memory in DataLoader for faster GPU transfer (recommended: True)
166
+ PREFETCH_FACTOR:
167
+ value: 2 # Number of batches to prefetch per worker (higher = more memory usage)
168
+
169
+ ### HIGHLIGHTS
170
+ MOGE_MODEL:
171
+ value: "Ruicheng/moge-2-vits-normal" # MoGe model name for normal estimation (HuggingFace format)
172
+ SURFACE_ROUGHNESS:
173
+ value: 8.0 # Blinn-Phong surface roughness exponent (higher = sharper highlights)
174
+ INTENSITY:
175
+ value: 2.0 # Specular highlight intensity multiplier
176
+ LIGHT_DISTANCE_RANGE:
177
+ value: [0.0, 1] # Range for light source distance sampling [min, max] (normalized)
178
+ LIGHT_LEFT_RIGHT_ANGLE:
179
+ value: [0, 360] # Range for light source horizontal angle [min, max] in degrees
180
+ LIGHT_ABOVE_BELOW_ANGLE:
181
+ value: [0, 360] # Range for light source vertical angle [min, max] in degrees
182
+ DATASET_HIGHLIGHT_DILATION:
183
+ value: 25 # Dilation kernel size (pixels) for dataset highlight masks
184
+ DATASET_HIGHLIGHT_THRESHOLD:
185
+ value: 0.9 # Brightness/luminance threshold (0-1) for detecting highlights in dataset images
186
+ DATASET_HIGHLIGHT_USE_LUMINANCE:
187
+ 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
188
+ HIGHLIGHT_COLOR:
189
+ value: [1.0, 1.0, 1.0] # RGB color for synthetic highlights (normalized 0-1)
190
+ CLAMP_RECONSTRUCTION:
191
+ value: True # Clamp reconstructed images to [0, 1] range if True
192
+
193
+ ### OPTIMIZATION
194
+ LEARNING_RATE:
195
+ value: 1.0e-3 # Base learning rate for optimizer # DEPRECATED. SETTING LR FOR EACH MODULE ABOVE
196
+ WEIGHT_DECAY:
197
+ value: 0.0 # L2 regularization weight (0.0 = no weight decay)
198
+ EPOCHS:
199
+ value: 20 # Maximum number of training epochs
200
+ GRADIENT_ACCUMULATION_STEPS:
201
+ value: 1 # Number of steps to accumulate gradients before optimizer step (1 = no accumulation)
202
+ WARMUP:
203
+ value: 100 # Number of warmup steps for learning rate schedule (linear warmup from 0 to LR)
204
+ GRADIENT_CLIPPING_MAX_NORM:
205
+ value: 8 # Maximum gradient norm for clipping (set to -1 to disable clipping)
206
+ LR_SCHEDULER:
207
+ value:
208
+ ONPLATEAU: # ReduceLROnPlateau scheduler (reduces LR when validation metric plateaus)
209
+ PATIENCE: 5 # Number of epochs to wait before reducing LR
210
+ FACTOR: 0.1 # Factor by which LR is reduced (new_lr = old_lr * factor)
211
+ # COSINE: # CosineAnnealingLR scheduler (cosine annealing schedule)
212
+ # N_PERIODS: 5 # Number of cosine periods over training
213
+ STEPWISE: # StepLR scheduler (reduces LR at fixed step intervals)
214
+ N_STEPS: 4 # Number of times to reduce LR during training
215
+ GAMMA: 0.5 # Factor by which LR is reduced at each step (new_lr = old_lr * gamma)
216
+ # EXPONENTIAL: # ExponentialLR scheduler (exponential decay)
217
+ # GAMMA: 0.5 # Multiplicative factor for exponential decay
218
+
219
+ SWITCH_OPTIMIZER_EPOCH:
220
+ value: null # Epoch number to switch from bootstrap to refining optimizer (null = no switch)
221
+ OPTIMIZER_BOOTSTRAP_NAME:
222
+ value: "AdamW" # Optimizer name for initial training phase ("Adam", "SGD", etc.)
223
+ OPTIMIZER_REFINING_NAME:
224
+ value: "AdamW" # Optimizer name for refining phase (used after SWITCH_OPTIMIZER_EPOCH)
225
+ EARLY_STOPPING_PATIENCE:
226
+ value: 10 # Number of epochs without improvement before stopping training
227
+ SAVE_INTERVAL:
228
+ value: 1000 # Number of training steps between model checkpoints
229
+
230
+ DATASET_HIGHLIGHT_SUPERVISION_THRESHOLD:
231
+ value: 0.1 # Pixel highlights above this threshold (should be low) are excluded from supervision
232
+
233
+ ### LOSS WEIGHTS (relative to the total loss, NOT NORMALIZED LATER)
234
+ SPECULAR_LOSS_WEIGHT:
235
+ value: 0.0 # Weight for specular component reconstruction loss
236
+ DIFFUSE_LOSS_WEIGHT:
237
+ value: 0.0 # Weight for diffuse component reconstruction loss
238
+ HIGHLIGHT_LOSS_WEIGHT:
239
+ value: 1.0 # Weight for highlight mask regression loss
240
+ TOKEN_INPAINT_LOSS_WEIGHT:
241
+ value: 1.0 # Weight for token-space inpainting loss (L1 + cosine similarity in feature space)
242
+
243
+ IMAGE_RECONSTRUCTION_LOSS_WEIGHT:
244
+ value: 0.0 # Weight for full image reconstruction loss
245
+ SATURATION_RING_LOSS_WEIGHT:
246
+ value: 0.0 # Weight for saturation ring consistency loss (around highlight regions)
247
+ WEIGHT_CONTEXT_IDENTITY:
248
+ value: 0.0 # LEAVE TO 0.0: Weight for L1 loss on context (non-masked) regions (identity preservation)
249
+ WEIGHT_TV_IN_HOLE:
250
+ value: 0.0 # LEAVE TO 0.0: Weight for total variation loss inside masked/hole regions
251
+
252
+ RING_KERNEL_SIZE:
253
+ value: 11 # Kernel size (odd number) for saturation ring dilation around highlights
254
+ RING_VAR_WEIGHT:
255
+ value: 0.5 # Weight for variance matching in saturation ring loss (vs mean matching)
256
+ RING_TEXTURE_WEIGHT:
257
+ value: 1.0 # Weight for texture consistency term in saturation ring loss
258
+ HLREG_W_L1:
259
+ value: 1.0 # Weight for L1 loss in highlight regression
260
+ HLREG_USE_CHARB:
261
+ value: True # Use Charbonnier loss (smooth L1) instead of standard L1 if True
262
+ HLREG_W_DICE:
263
+ value: 0.2 # Weight for Dice loss in highlight regression (for mask overlap)
264
+ HLREG_W_SSIM:
265
+ value: 0.0 # Weight for SSIM loss in highlight regression
266
+ HLREG_W_GRAD:
267
+ value: 0.0 # Weight for gradient loss in highlight regression
268
+ HLREG_W_TV:
269
+ value: 0.0 # Weight for total variation loss in highlight regression
270
+ HLREG_BALANCE_MODE:
271
+ value: "auto" # Class balancing mode for highlight regression: 'none' | 'auto' | 'pos_weight'
272
+ HLREG_POS_WEIGHT:
273
+ value: 1.0 # Positive class weight (used only if BALANCE_MODE == 'pos_weight')
274
+ HLREG_FOCAL_GAMMA:
275
+ value: 2.0 # Focal loss gamma parameter (0.0 = standard BCE, 1.0-2.0 helps with gradient vanishing)
276
+
277
+
278
+ RING_DILATE_KERNEL:
279
+ value: 17 # Dilation kernel size (odd number) for creating ring mask around highlights
280
+ WEIGHT_SEAM:
281
+ value: 0.5 # Weight for gradient matching loss on saturation ring
282
+ SEAM_USE_CHARB:
283
+ value: True # Use Charbonnier loss instead of L1 in seam loss (smooth L1 for boundary consistency)
284
+ SEAM_WEIGHT_GRAD:
285
+ value: 0.0 # Weight for gradient matching term inside seam loss (0.0 = disable gradient term)
286
+ TOKEN_FEAT_ALPHA:
287
+ value: 0.5 # Mixing factor for token feature loss: alpha * L1 + (1-alpha) * (1-cosine_sim)
288
+
289
+ ### DIFFUSE HIGHLIGHT PENALTY
290
+ WEIGHT_DIFFUSE_HIGHLIGHT_PENALTY:
291
+ value: 0.1 # Weight for penalty loss on highlights in diffuse decoder output (0.0 = disabled)
292
+ DIFFUSE_HL_THRESHOLD:
293
+ value: 0.85 # Brightness/luminance threshold for detecting highlights in diffuse (0.0-1.0)
294
+ DIFFUSE_HL_USE_CHARB:
295
+ value: True # Use Charbonnier loss instead of L1 for diffuse highlight penalty
296
+ DIFFUSE_HL_PENALTY_MODE:
297
+ value: "brightness" # Penalty mode: "brightness" (penalize brightness/luminance above threshold) or "pixel" (penalize RGB values directly)
298
+ DIFFUSE_HL_TARGET_BRIGHTNESS:
299
+ value: null # Target brightness/luminance for penalized pixels (null = use threshold value)
300
+ DIFFUSE_HL_USE_LUMINANCE:
301
+ value: False # If True, use perceptually-weighted luminance (0.299*R + 0.587*G + 0.114*B); if False, use simple mean brightness
302
+
303
+ ### LOGGING, RESULTS AND WANDB
304
+ LOG_INTERVAL:
305
+ value: 1 # Number of training steps between console log outputs
306
+ WANDB_LOG_INTERVAL:
307
+ value: 1 # Number of training steps between WandB metric logs
308
+ IMAGE_LOG_INTERVAL:
309
+ value: 5 # Number of training steps between image logging to WandB
310
+ NO_WANDB:
311
+ value: False # Disable WandB logging if True (useful for local debugging)
312
+ MODEL_WATCHER_FREQ_WANDB:
313
+ value: 50 # Frequency (in steps) for logging model parameter histograms to WandB
314
+ WANDB_ENTITY:
315
+ value: "unreflect-anything" # WandB organization/entity name
316
+ WANDB_PROJECT:
317
+ value: "UnReflectAnything" # WandB project name
318
+ NOTES:
319
+ value: "" # Notes/description for this training run
configs/pretrained_config.yaml CHANGED
@@ -18,7 +18,7 @@ parameters:
18
  REASSEMBLE_OUT_CHANNELS: [768,1024,1536,2048] # Output channels for each decoder stage (DPT-style reassembly)
19
  REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
20
  READOUT_TYPE: "ignore" # Readout type for DPT decoder ("ignore", "project", etc.)
21
- # FROM_PRETRAINED: "weights/decoder_896.pth" # Path to pretrained decoder weights (optional)
22
  USE_BN: False # Use batch normalization in decoder
23
  DROPOUT: 0.1 # Dropout rate in decoder layers
24
  OUTPUT_IMAGE_SIZE: [896,896] # Output image resolution [height, width]
 
18
  REASSEMBLE_OUT_CHANNELS: [768,1024,1536,2048] # Output channels for each decoder stage (DPT-style reassembly)
19
  REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
20
  READOUT_TYPE: "ignore" # Readout type for DPT decoder ("ignore", "project", etc.)
21
+ # FROM_PRETRAINED: "weights/diffuse_decoder.pt" # Path to pretrained decoder weights (optional)
22
  USE_BN: False # Use batch normalization in decoder
23
  DROPOUT: 0.1 # Dropout rate in decoder layers
24
  OUTPUT_IMAGE_SIZE: [896,896] # Output image resolution [height, width]
configs/tokeninp_preatrain.yaml CHANGED
@@ -18,7 +18,7 @@ parameters:
18
  REASSEMBLE_OUT_CHANNELS: [768,1024,1536,2048] # Output channels for each decoder stage (DPT-style reassembly)
19
  REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
20
  READOUT_TYPE: "ignore" # Readout type for DPT decoder ("ignore", "project", etc.)
21
- FROM_PRETRAINED: "weights/decoder_896.pth" # Path to pretrained decoder weights (optional)
22
  USE_BN: False # Use batch normalization in decoder
23
  DROPOUT: 0.1 # Dropout rate in decoder layers
24
  OUTPUT_IMAGE_SIZE: [896,896] # Output image resolution [height, width]
@@ -48,11 +48,11 @@ parameters:
48
  USE_POSITIONAL_ENCODING: True # Enable 2D sinusoidal positional encodings
49
  USE_FINAL_NORM: True # Enable final LayerNorm before output projection
50
  USE_LOCAL_PRIOR: True # Blend local mean prior for masked seeds
51
- LOCAL_PRIOR_WEIGHT: 0.5 # Weight for local prior blending (1.0 = only mask_token, 0.0 = only local mean)
52
  LOCAL_PRIOR_KERNEL: 5 # Kernel size for local prior blending (> 1)
53
  SEED_NOISE_STD: 0.02 # Standard deviation of noise added to masked seeds during training
54
  INPAINT_MASK_DILATION:
55
- value: 3 # Dilation kernel size (pixels) for inpaint mask - Must be odd
56
  USE_TORCH_COMPILE: # Enable PyTorch 2.0 torch.compile for faster training (experimental)
57
  value: False
58
  DISTRIBUTE:
@@ -158,7 +158,7 @@ parameters:
158
  BATCH_SIZE: # Max batch size with img size 896 is 32
159
  value: 4 # Number of samples per batch (adjust based on GPU memory)
160
  NUM_WORKERS:
161
- value: 16 # Number of data loading worker processes (0 = main process only, "auto" = 90% of CPU affinity)
162
  SHUFFLE:
163
  value: True # Shuffle training data each epoch (False for validation/test)
164
  PIN_MEMORY:
 
18
  REASSEMBLE_OUT_CHANNELS: [768,1024,1536,2048] # Output channels for each decoder stage (DPT-style reassembly)
19
  REASSEMBLE_FACTORS: [4.0, 2.0, 1.0, 0.5] # Spatial upsampling factors for each stage
20
  READOUT_TYPE: "ignore" # Readout type for DPT decoder ("ignore", "project", etc.)
21
+ FROM_PRETRAINED: "weights/diffuse_decoder.pt" # Path to pretrained decoder weights (optional)
22
  USE_BN: False # Use batch normalization in decoder
23
  DROPOUT: 0.1 # Dropout rate in decoder layers
24
  OUTPUT_IMAGE_SIZE: [896,896] # Output image resolution [height, width]
 
48
  USE_POSITIONAL_ENCODING: True # Enable 2D sinusoidal positional encodings
49
  USE_FINAL_NORM: True # Enable final LayerNorm before output projection
50
  USE_LOCAL_PRIOR: True # Blend local mean prior for masked seeds
51
+ LOCAL_PRIOR_WEIGHT: 0.25 # Weight for local prior blending (1.0 = only mask_token, 0.0 = only local mean)
52
  LOCAL_PRIOR_KERNEL: 5 # Kernel size for local prior blending (> 1)
53
  SEED_NOISE_STD: 0.02 # Standard deviation of noise added to masked seeds during training
54
  INPAINT_MASK_DILATION:
55
+ value: 15 # Dilation kernel size (pixels) for inpaint mask - Must be odd
56
  USE_TORCH_COMPILE: # Enable PyTorch 2.0 torch.compile for faster training (experimental)
57
  value: False
58
  DISTRIBUTE:
 
158
  BATCH_SIZE: # Max batch size with img size 896 is 32
159
  value: 4 # Number of samples per batch (adjust based on GPU memory)
160
  NUM_WORKERS:
161
+ value: 4 # Number of data loading worker processes (0 = main process only, "auto" = 90% of CPU affinity)
162
  SHUFFLE:
163
  value: True # Shuffle training data each epoch (False for validation/test)
164
  PIN_MEMORY: