UFR-Fing / scripts /archive /run_train_v12.sh
anbinh39's picture
Add files using upload-large-folder tool
b33e5eb verified
Raw
History Blame Contribute Delete
2.52 kB
#!/usr/bin/env bash
# v12 training β€” Fix score collapse + wet_press concept grounding.
#
# Changes vs v11:
# T17 β€” L_deg applied to ALL datasets (SD302 + FVC + PolyU), not FVC-only.
# Root cause of v11 score collapse: 95% of SD302 images stuck at ~58.3
# because they had no ordinal grounding from L_deg. Synthetic degradation
# on SD302 is artificial but necessary to prevent collapse on majority data.
# T18 β€” MorphologicalDilator fixed: cv2.erode instead of cv2.dilate.
# NIST fingerprints have DARK ridges. Erode expands dark ridges (wet smear).
# Previous dilate shrank ridges β†’ paradoxically increased clarity score.
# Fixes wet_press β†’ clarity = +0.219 (wrong) β†’ should be negative.
# T19 β€” DegradationRankingLoss gamma: 0.5 β†’ 1.0 (stronger concept supervision).
# Occlusion block coverage: 30% β†’ 40% at level 3.
# Fixes jpeg/occlusion concept signal near zero (rho β‰ˆ -0.05, -0.03 in v11).
#
# Training: resume from v11 last.pt (model weights only, not optimizer).
# --spread-weight 5.0 (up from 2.0) to force wider score distribution.
# --deg-every-n-steps 4 (up from 2) to keep compute balanced since L_deg
# now processes full batch (96 images) instead of ~15 FVC images.
#
# Expected improvements:
# Track 2 mean_KS: 0.5566 β†’ < 0.15 (SD302 images should spread, less sensor clustering)
# Track 4 wet_press β†’ clarity: +0.219 (❌) β†’ negative (βœ“)
# Track 4 occlusion β†’ minutiae: -0.032 (weak) β†’ < -0.2 (strong)
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_v11/last.pt" \
--epochs 80 \
--batch-size 96 \
--image-size 224 \
--lr 1e-4 \
--spread-mode uniform \
--spread-weight 5.0 \
--deg-every-n-steps 4 \
--deg-max-images 32 \
--max-train-samples -1 \
--num-workers 8 \
--gpus 0,1 \
--save-dir "${REPO_ROOT}/sifq/checkpoints_full_v12"