| # v27 training — SpatialConceptHead: ConceptHead now operates on 14×14 spatial | |
| # token map [B, 196, 320] instead of globally-pooled vector [B, 320]. | |
| # | |
| # Architecture change (relative to v26): | |
| # ConceptHead (legacy): Linear(320→256)→LN→GELU→Linear(256→6)→Sigmoid | |
| # - input: [B, 320] globally-pooled backbone output | |
| # - loses spatial information entirely | |
| # SpatialConceptHead (v27+): | |
| # Shared trunk : Linear(320→128)→LN→GELU → [B, 196, 128] | |
| # Per-concept : 6 × Linear(128→1) → mean over 196 → [B, 6] | |
| # Activation : Sigmoid → (0, 1) | |
| # - input: [B, 196, 320] backbone.forward_spatial() output | |
| # - each concept attends to different spatial regions | |
| # - separate proj weights per concept → reduced entanglement | |
| # | |
| # Why this matters: | |
| # orientation_coherence: needs local ridge flow consistency across patches | |
| # continuity: needs to detect ridge break locations spatially | |
| # minutiae_reliability: needs to localise bifurcation / ending regions | |
| # | |
| # BREAKING CHANGE: incompatible with v16–v26 checkpoints. | |
| # | |
| # All other hyperparameters identical to v26 (gamma=2.0, spread-weight=3.0). | |
| # After confirming spatial head matches or exceeds v26 on KS/Pearson, the | |
| # noise→noise_lv supervision mismatch (+0.365 in v24/v26) can be addressed. | |
| set -euo pipefail | |
| REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)" | |
| export PATH="/home/aiserver/miniconda3/bin:$PATH" | |
| VERSION="v27" | |
| 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 | |