#!/usr/bin/env bash # v13 training — Fix SD302 score anchoring + noise concept + occlusion. # # Root cause analysis of v12 failures: # # T20 (new) — SD302 scores anchored at ~28 instead of spread [10,90]. # T17 fix (L_deg on all datasets) used synthetic degradation as # ordinal anchor for SD302. But SD302 images look like "level 1-2 # degraded FVC" to the model → they anchor at ~28 (near degraded floor). # Per-sensor data: R/S slap (non-segmented) std=0.0 (fully collapsed), # roll sensors mean=27-28 std=6-7, flat sensors mean=35-40 std=10-15. # KS still 0.51 (target <0.10) because sensors differ by capture TYPE. # # T21 (new) — Non-segmented slap images (R_*_slap, S_*_slap) std=0.0. # Full-hand slap images are visually homogeneous → same score. # Not fixable by ordinal grounding — they genuinely have no variation. # # T22 (new) — Noise concept regression: noise_level: +0.188 (v11) → -0.168 (v12). # Old c_idx==3 special case pushed noise_level to INCREASE with noise. # But ScoreAggregator (unconstrained MLP) can satisfy L_rank by # making noise_level DECREASE + assigning positive weight → conflict # resolved by inverting the concept direction. # Fix: remove special case, noise_level decreases with noise like others. # # T23 (T19 insufficient) — Occlusion still dead (contin=+0.023, minutiae=+0.075). # 40% coverage insufficient; only minutiae supervised (not continuity). # Fix: add continuity (c_idx=2) to occlusion map; increase coverage 55%. # # Code changes (v13): # T27 — Revert T17: L_deg back to FVC-only. # Per-dataset L_spread for SD302 subset added to force SD302 images # to span [10,90] within each batch, preventing collapse without synthetic # degradation on SD302. Both global L_spread and per-dataset L_spread # run with --spread-weight each step. # T25 — Remove c_idx==3 special case in DegradationRankingLoss. # All concepts now decrease with degradation (high = better quality). # T26 — Occlusion: add continuity (c_idx=2) to DEGRADATION_CONCEPT_MAP. # Coverage: 40% → 55% at level 3. # # Training: resume from v12 last.pt (T18/T19 concept fixes already internalized). # --spread-weight 3.0 (reduced from 5.0 since two spread terms are now summed). # --deg-every-n-steps 2 (back to 2; FVC-only L_deg = ~15 images, not 96). # No --deg-max-images needed (FVC-only is small enough, no OOM risk). set -euo pipefail REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)" source "${REPO_ROOT}/.venv/bin/activate" python "${REPO_ROOT}/sifq/scripts/train_sifq.py" \ --root-302a "${REPO_ROOT}/dataset/302a/images/challengers" \ --root-302b "${REPO_ROOT}/dataset/302b/images/baseline" \ --root-302d "${REPO_ROOT}/dataset/nist_302d/images/auxiliary" \ --root-fvc2002 "${REPO_ROOT}/dataset/FVC_Dataset/FVC2002" \ --root-fvc2004 "${REPO_ROOT}/dataset/FVC_Dataset/FVC2004" \ --root-polyu "${REPO_ROOT}/dataset/PolyU" \ --mdgt-checkpoint "${REPO_ROOT}/pad/TRAM-downstream/checkpoint/checkpoints_dinov2_tram/best_eer.pt" \ --resume "${REPO_ROOT}/sifq/checkpoints_full_v12/last.pt" \ --epochs 80 \ --batch-size 96 \ --image-size 224 \ --lr 1e-4 \ --spread-mode uniform \ --spread-weight 3.0 \ --deg-every-n-steps 2 \ --max-train-samples -1 \ --num-workers 8 \ --gpus 0,1 \ --save-dir "${REPO_ROOT}/sifq/checkpoints_full_v13"