# DUTS Training Configuration - Native Resolution (Variable Resolution with FluxResizer) # Uses FLUX.1-dev and FluxResizer for optimal native resolutions (no padding) # Experiment settings experiment: name: "duts_native_resolution" description: "DUTS with FLUX.1-dev at native resolutions using FluxResizer" # Concept configurations (same as original) concepts: basic: ["object", "background", "detail", "edges"] expanded: ["background", "object", "edges", "salient", "contour"] meta: ["living", "vehicle", "furniture", "object", "background"] combined: ["object", "background", "living", "vehicle", "furniture", "detail", "edges"] combined_expanded: ["object", "background", "living", "vehicle", "furniture", "detail", "edges", "salient", "contour"] with_classes: ["object", "background", "detail", "edges", "airplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat", "chair", "cow", "table", "dog", "horse", "motorbike", "person", "plant", "sheep", "sofa", "train", "television"] all_comprehensive: ["living", "vehicle", "furniture", "object", "background", "detail", "edges", "airplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat", "chair", "cow", "table", "dog", "horse", "motorbike", "person", "plant", "sheep", "sofa", "train", "television"] # Training settings training: concept_config: "expanded" # Which concept configuration to use epochs: 100 # Match baseline training duration (was 20) learning_rate: 1e-5 # Reduced from 5e-5 for stability (gradient explosion fix) batch_size: 1 # REQUIRED: Must be 1 for variable resolution accumulate_grad_batches: 4 # Effective batch size = 4 gradient_clip_val: 0.1 # Very aggressive clipping for gradient explosion (was 0.5) precision: "32-true" # FP32 for maximum stability (gradient explosion with FP16) # Data settings data: dataset: "duts" num_classes: 1 # Root of the DUTS dataset. Expected layout: # /DUTS-TR/DUTS-TR-Image, /DUTS-TR/DUTS-TR-Mask # /DUTS-TE/DUTS-TE-Image, /DUTS-TE/DUTS-TE-Mask data_root: "${DUTS_ROOT}" # env var; e.g. export DUTS_ROOT=/datasets/.../DUTS # NOTE: No target_size! FluxResizer selects optimal resolution per image # Model settings model: flux_model: "black-forest-labs/FLUX.1-dev" # Changed from schnell to dev dtype: "float32" # Match training precision (was float16) dino_model: "dinov3_vitb16" # DINOv3 base model feature_locations: transformer_blocks: [4, 9, 13, 18] single_transformer_blocks: [4, 15, 26, 37] decoder: features: 256 hyperfeature_fusion: num_timesteps: 4 fusion_type: "transformer" hidden_dim: 768 num_transformer_layers: 3 layer_scale_init: 1e-6 # FLUX settings flux: timesteps: 28 guidance_scale: 3.5 num_inference_steps: 1 concept_timesteps: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27] concept_layers: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17] # FluxResizer settings flux_resizer: # Optimal resolutions (all divisible by 32 for FLUX/DINO compatibility) # FluxResizer will automatically select the closest resolution based on aspect ratio optimal_resolutions: - [1024, 1024] # 1:1 - [896, 1152] # ~0.78:1 - [1152, 896] # ~1.29:1 - [768, 1344] # ~0.57:1 - [1344, 768] # ~1.75:1 - [832, 1216] # ~0.68:1 - [1216, 832] # ~1.46:1 - [704, 1408] # 0.5:1 - [1408, 704] # 2:1 - [960, 1088] # ~0.88:1 - [1088, 960] # ~1.13:1 # Hardware settings hardware: devices: 1 # Use 2 GPUs for faster training #strategy: "ddp_find_unused_parameters_true" # Multi-GPU strategy num_sanity_val_steps: 1 detect_anomaly: true accelerator: "gpu" # Paths (timestamps will be automatically added) paths: # All outputs live under ${MMDIFF_OUTPUT} (set it to a writable dir, e.g. /work//mmdiff_out). cache_base_dir: "${MMDIFF_OUTPUT}/cache" log_base_dir: "${MMDIFF_OUTPUT}/logs" checkpoint_base_dir: "${MMDIFF_OUTPUT}/checkpoints" use_timestamp: true # Add timestamp to folder names permanent_cache_dir: "${MMDIFF_OUTPUT}/cache/duts_flux_cache" # Native resolution feature cache # Logging logging: log_every_n_steps: 10 save_top_k: 3 monitor: "val_loss" mode: "min" # HuggingFace huggingface: token: "" # Leave empty and authenticate via `huggingface-cli login` or the HF_TOKEN env var