File size: 1,866 Bytes
7c2871f | 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 | #!/usr/bin/env bash
# Run test-only inference on the FaceForensics++ dataset.
#
# Usage:
# bash scripts/test_ffpp.sh <method> [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 <FFPP_ROOT>/manipulated_sequences/<gen>/c23/videos/*.mp4
# directly. No symlink tree is needed.
# * Real videos under <FFPP_ROOT>/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 <method> [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" \
"$@" |