File size: 3,589 Bytes
b33e5eb | 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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | #!/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"
|