#!/usr/bin/env bash # Run test-only inference on the FaceForensics++ dataset. # # Usage: # bash scripts/test_ffpp.sh [checkpoint_path] [extra hydra overrides...] # # Examples: # bash scripts/test_ffpp.sh cta # bash scripts/test_ffpp.sh psm outputs/psm/checkpoints/last.ckpt # bash scripts/test_ffpp.sh radr /path/to/custom.ckpt backbone=timesformer # # Notes: # * Uses the standalone FFPPTestDataset (configs/data/fairtalking_ffpp.yaml), # which scans /manipulated_sequences//c23/videos/*.mp4 # directly. No symlink tree is needed. # * Real videos under /original_sequences/youtube/c23/videos # are picked up automatically if present (for AUC). set -eo pipefail cd "$(dirname "$0")/.." # load .env if present [ -f .env ] && set -a && . ./.env && set +a if [ $# -lt 1 ]; then echo "Usage: $0 [checkpoint_path] [extra hydra overrides...]" echo "Available methods: cta, psm, radr" exit 1 fi METHOD="$1" shift CKPT="${1:-outputs/${METHOD}/checkpoints/last.ckpt}" if [ $# -ge 1 ]; then shift; fi case "$METHOD" in cta|psm|radr) ;; *) echo "Error: Invalid method '$METHOD'. Available: cta, psm, radr" exit 1 ;; esac if [ ! -f "$CKPT" ]; then echo "[test_ffpp] checkpoint not found: $CKPT" echo "[test_ffpp] Please train the model first or provide a valid checkpoint path." exit 1 fi FFPP_ROOT_RESOLVED="${FFPP_ROOT:-/apdcephfs_gy4/share_303628665/joywu/dataset/FF++}" echo "[test_ffpp] Method: $METHOD" echo "[test_ffpp] Dataset: fairtalking_ffpp (FaceForensics++)" echo "[test_ffpp] Checkpoint: $CKPT" echo "[test_ffpp] FFPP_ROOT: $FFPP_ROOT_RESOLVED" python3 src/train.py \ method="$METHOD" \ data=fairtalking_ffpp \ trainer=ddp \ backbone=timesformer \ +test_only=true \ +test_ckpt="$CKPT" \ "$@"