#!/usr/bin/env bash # Foreground only. Usage: bash run_easycom_fullframe_qwen_av.sh [all|f2|f3] [seed ...] set -euo pipefail cd "$(dirname "$0")" FEATURE_ROOT=${FEATURE_ROOT:-/data1/yfzx/wangx/Datasets/easycom/omni_features/open_stream_2fps_8s_last4_stack} TARGET_ROOT=${TARGET_ROOT:-/data1/yfzx/wangx/Datasets/easycom/easycom_target_frame} FULLFRAME_ROOT=${FULLFRAME_ROOT:-/data1/yfzx/wangx/Datasets/easycom/omni_features/fullframe_qwen_av_2fps_224} CHECKPOINT_ROOT=${CHECKPOINT_ROOT:-checkpoints/easycom_fullframe_qwen_av} RESULT_ROOT=${RESULT_ROOT:-results/easycom_fullframe_qwen_av} LOCAL_PROJECTION_DIM=${LOCAL_PROJECTION_DIM:-256} ATTENTION_DIM=${ATTENTION_DIM:-256} ATTENTION_HEADS=${ATTENTION_HEADS:-4} HISTORY_FRAMES=${HISTORY_FRAMES:-2} HISTORY_MAX_GAP_SECONDS=${HISTORY_MAX_GAP_SECONDS:-0.75} TRAIN_BATCH_SIZE=${TRAIN_BATCH_SIZE:-64} INFER_BATCH_SIZE=${INFER_BATCH_SIZE:-128} export OMP_NUM_THREADS=${OMP_NUM_THREADS:-4} export MKL_NUM_THREADS=${MKL_NUM_THREADS:-4} export OPENBLAS_NUM_THREADS=${OPENBLAS_NUM_THREADS:-4} variant=${1:-all} if (( $# )); then shift; fi if (( $# )); then seeds=("$@"); else seeds=(0 1 2); fi case "$variant" in all) variants=(f2 f3) ;; f2|f3) variants=("$variant") ;; *) echo "Expected all, f2, or f3" >&2; exit 2 ;; esac for variant in "${variants[@]}"; do case "$variant" in f2) fusion=fullframe-spatial-attention ;; f3) fusion=fullframe-spatiotemporal-attention ;; esac for seed in "${seeds[@]}"; do checkpoint="$CHECKPOINT_ROOT/${variant}_seed${seed}.pth" result="$RESULT_ROOT/${variant}_seed${seed}" if [[ -e "$checkpoint" || -e "$result" ]]; then echo "Refusing to overwrite $checkpoint or $result; select new output roots." >&2 exit 1 fi python train_turn_head.py \ --feature-root "$FEATURE_ROOT" --target-root "$TARGET_ROOT" \ --local-feature-root "$FULLFRAME_ROOT" --local-modalities av \ --local-fusion "$fusion" \ --local-projection-dim "$LOCAL_PROJECTION_DIM" \ --person-attention-dim "$ATTENTION_DIM" \ --person-attention-heads "$ATTENTION_HEADS" \ --person-history-frames "$HISTORY_FRAMES" \ --person-track-max-gap-seconds "$HISTORY_MAX_GAP_SECONDS" \ --output "$checkpoint" --sessions 4 5 6 7 8 9 10 11 12 \ --epochs 4 --batch-size "$TRAIN_BATCH_SIZE" \ --learning-rate 7e-5 --weight-decay 5e-5 \ --warmup-epochs 1.6 --warmup-factor 0.3 --dropout 0.2 \ --loss lstr-mce --transition-objective none --layer-fusion concat-mlp \ --expected-mode open-stream-replay --seed "$seed" --device cuda:0 python infer_turn_head.py \ --feature-root "$FEATURE_ROOT" --target-root "$TARGET_ROOT" \ --local-feature-root "$FULLFRAME_ROOT" \ --checkpoint "$checkpoint" --output-dir "$result" --sessions 3 2 1 \ --batch-size "$INFER_BATCH_SIZE" \ --expected-mode open-stream-replay --device cuda:0 done done