UFR-Fing / scripts /run_train_v26.sh
anbinh39's picture
Add files using upload-large-folder tool
6e9cb06 verified
Raw
History Blame Contribute Delete
2.76 kB
#!/usr/bin/env bash
# v26 training — Revert gamma from 1.5 back to 2.0 (root-cause fix for v25 regression).
#
# v25 post-mortem:
# v25 changed 2 things: (1) T40 concept map expansion, (2) gamma 2.0→1.5.
# The regression (KS 0.1263→0.2125, Pearson 0.800→0.620) was caused by gamma=1.5,
# NOT the concept map. With gamma=1.5 the deg loss is too weak to anchor the score
# space when mat loss is introduced during the S1→S2 ramp:
# - v24 ramp: spread stable at ~0.003, q_std grows 18→22 monotonically
# - v25 ramp: spread spikes to 0.028, q_std collapses 22→10 (epochs 13-16)
# The model partially recovered but never reached v24's equilibrium:
# - v25 final: spread=0.003, q_std=20.1 vs v24 spread=0.0017, q_std=22.5
# This permanently elevated within-sensor variance → higher cross-sensor KS.
#
# v26 changes from v25:
# 1. DEGRADATION_CONCEPT_MAP reverted to T39 state (same as v24):
# blur: [1, 2] (no blur→orient_coh from T40)
# noise: [3] (no noise→contrast_u from T40)
# jpeg: [2, 1] (no jpeg→contrast_u from T40)
# dry_skin / wet_press / occlusion: unchanged (T39 values kept)
# 2. --concept-deg-gamma 2.0 (restored from v24)
#
# Expected outcome:
# KS ≈ 0.126 (match v24), Pearson ≈ 0.80 (match v24)
# noise→noise_lv may still show +0.365 (open issue from v24 — defer to v27)
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
export PATH="/home/aiserver/miniconda3/bin:$PATH"
VERSION="v26"
SAVE_DIR="${REPO_ROOT}/sifq/checkpoints/${VERSION}"
LOG_FILE="${REPO_ROOT}/sifq/logs/train_${VERSION}.log"
EVAL_SCRIPT="${REPO_ROOT}/sifq/scripts/run_eval_${VERSION}.sh"
mkdir -p "${REPO_ROOT}/sifq/logs"
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" \
--exclude-sensor "R_1000_slap,R_500_slap,S_500_slap" \
--mdgt-checkpoint "${REPO_ROOT}/pad/TRAM-downstream/checkpoint/checkpoints_dinov2_tram/best_eer.pt" \
--epochs 60 \
--batch-size 96 \
--image-size 224 \
--lr 1e-4 \
--spread-mode uniform \
--spread-weight 3.0 \
--concept-deg-gamma 2.0 \
--sd302-concept-weight 0.0 \
--deg-every-n-steps 2 \
--no-mat-stats \
--proto-max-batches 0 \
--k-cross 0 \
--max-train-samples -1 \
--num-workers 8 \
--gpus 0 \
--save-dir "${SAVE_DIR}"
echo "[auto-eval] Training done. Starting eval ${VERSION}..."
bash "${EVAL_SCRIPT}" >> "${LOG_FILE}" 2>&1