UFR-Fing / scripts /archive /run_train_v11.sh
anbinh39's picture
Add files using upload-large-folder tool
b33e5eb verified
Raw
History Blame Contribute Delete
2.15 kB
#!/usr/bin/env bash
# v11 training — PolyU back in L_sens (contact vs contactless pairs).
#
# Changes vs v10:
# 1. PolyU RE-INCLUDED in CrossSensorBatchSampler + build_pair_indices.
# PolyU contact vs contactless = strongest cross-modal sensor signal → L_sens.
# 2. PolyU EXCLUDED from L_mat (no prototype / teacher loss for PolyU images).
# 3. PolyU EXCLUDED from L_deg (degradation ranking not applicable to PolyU).
# → PolyU contributes ONLY to L_sens per original design.
# 4. New β/α schedule: β ramps FASTER than α so β/α → 1.0 at S2 entry (ep20).
# α: 0.10→0.30 β: 0.00→0.30 γ: 1.00→0.60 over ep10-19.
# S2 full: α=0.30 β=0.30 γ=0.60 (β/α=1.0).
# S3: α=0.25 β=0.35 γ=0.50 (β/α=1.4).
#
# Root cause of v9 failure: β/α=0.50 in S2 (α=0.40, β=0.20) → GRL too weak
# to override L_mat's sensor-correlated gradients → L_sens stuck at 2-3 all S2/S3.
#
# Total dataset: SD302-A/B/D (30,567) + FVC2002+2004 (7,040) + PolyU (5,952)
# = 43,559 images
# L_sens anchors: SD302 (~2,276 groups) + PolyU (336 cross-modal groups)
# L_mat: SD302 + FVC only (PolyU masked)
# L_deg: FVC only (SD302 + PolyU masked)
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" \
--epochs 80 \
--batch-size 96 \
--image-size 224 \
--lr 1e-4 \
--spread-mode uniform \
--spread-weight 2.0 \
--deg-every-n-steps 2 \
--max-train-samples -1 \
--num-workers 8 \
--gpus 0,1 \
--save-dir "${REPO_ROOT}/sifq/checkpoints_full_v11"