File size: 3,253 Bytes
cfc7a54 | 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | #!/usr/bin/env bash
# v31 training β raw DINOv2-ViTS/14 teacher (replaces MDGT)
#
# Goal: Benchmark DINOv2 raw as teacher for L_mat.
# - DINOv2-ViTS/14 is public (Meta, ICLR 2024), cite-able, fully reproducible
# - Replaces unpublished MDGT checkpoint β paper can be submitted without IP issues
# - Expected Pearson ~0.55β0.70 (vs 0.80 with MDGT) β establish baseline
#
# Key change vs v29:
# --teacher dinov2_raw : frozen DINOv2-ViTS/14 CLS token [B,384] as L_mat teacher
# (v29 used --no-mat entirely; v31 restores L_mat with public teacher)
# remove --no-mat : L_mat is re-enabled
# --no-mat-stats : raw cosine targets (no per-identity tanh stats) β v14 behaviour
# avoids FVC/SD302 asymmetry that caused collapse in v16/v17
# --proto-max-batches 0: full dataset prototypes (avoid sensor-biased partial prototypes)
#
# Inherited from v29 (validated):
# --spread-weight 4.0
# --concept-deg-gamma 2.0
# --ortho-weight 3.0
# --k-cross 0
# --deg-every-n-steps 2
#
# Expected dynamics:
# S1 (ep 0-9): q_std rises 0β15+; l_mat decreases (DINOv2 cosine varies with quality)
# S2 (ep 20+): l_pair decreases; l_mat converging; q_std stable 15β22
# Target: KS β€ 0.20, Pearson β₯ 0.55, q_std β₯ 15
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
export PATH="/home/aiserver/miniconda3/bin:$PATH"
VERSION="v31"
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/nist302a/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" \
--teacher dinov2_raw \
--dinov2-model dinov2_vits14 \
--no-mat-stats \
--proto-max-batches 0 \
--epochs 60 \
--batch-size 96 \
--image-size 224 \
--lr 1e-4 \
--spread-mode uniform \
--spread-weight 4.0 \
--concept-deg-gamma 2.0 \
--sd302-concept-weight 0.0 \
--deg-every-n-steps 2 \
--k-cross 0 \
--max-train-samples -1 \
--num-workers 8 \
--gpus 0 \
--save-dir "${SAVE_DIR}" \
--wandb \
--wandb-offline \
--wandb-project "sifq" \
--wandb-run-name "${VERSION}" \
2>&1 | tee "${LOG_FILE}"
echo "[auto-eval] Training done. Starting eval ${VERSION}..."
bash "${EVAL_SCRIPT}" >> "${LOG_FILE}" 2>&1
# ββ Compact epoch log ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
EPOCH_LOG="${REPO_ROOT}/sifq/logs/train_${VERSION}_epochs.log"
{
grep -E "^(Device:|SD302|FVC|PolyU|Excluded|AMP|Sensor|Stage|Pre-cach|Teacher)" "${LOG_FILE}" | head -10
echo "---"
grep "^Epoch" "${LOG_FILE}"
} > "${EPOCH_LOG}" 2>/dev/null || true
echo "[done] Compact epoch log: ${EPOCH_LOG}"
|