stzhao's picture
download
raw
2.74 kB
#!/usr/bin/env bash
# Extract FLUX.2 AE latents for the full UCF101 dataset (train + test, split 1).
#
# Default output layout:
# ${OUT_ROOT}/ucf101_train_split1_flux2_ae/<class>/<video>_patch_tokens.npz
# ${OUT_ROOT}/ucf101_test_split1_flux2_ae/<class>/<video>_patch_tokens.npz
# ${RECON_ROOT}/ucf101_train_split1_flux2_ae/<class>/<video>.mp4 (if not SKIP_RECON)
# ${RECON_ROOT}/ucf101_test_split1_flux2_ae/<class>/<video>.mp4 (if not SKIP_RECON)
#
# Env knobs:
# OUT_ROOT feature root directory (override default below)
# RECON_ROOT reconstruction-mp4 root directory
# SKIP_RECON=1 skip mp4 reconstruction (latent-only)
# OVERWRITE=1 recompute outputs that already exist
# DEVICE pin a torch device, e.g. cuda:0
# MAX_VIDEOS cap the number of videos per split (debug)
# PYTHON_BIN python interpreter to use
set -euo pipefail
SKIP_RECON=1
PYTHON_BIN=./.venv/bin/python
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "${REPO_ROOT}"
PYTHON_BIN="${PYTHON_BIN:-python3}"
BACKBONE="flux2_ae"
SPLITS=("trainlist01.txt" "testlist01.txt")
OUT_ROOT="${OUT_ROOT:-/mnt/posttrain/zhaoshitian/datasets/ucf101/manifold-analysis-preprocessed/video_features}"
RECON_ROOT="${RECON_ROOT:-/mnt/posttrain/zhaoshitian/datasets/ucf101/manifold-analysis-preprocessed/video_reconstructions}"
EXTRA_ARGS=()
if [[ "${SKIP_RECON:-0}" == "1" ]]; then
EXTRA_ARGS+=("--skip-reconstruction")
fi
if [[ "${OVERWRITE:-0}" == "1" ]]; then
EXTRA_ARGS+=("--overwrite")
fi
if [[ -n "${DEVICE:-}" ]]; then
EXTRA_ARGS+=("--device" "${DEVICE}")
fi
if [[ -n "${MAX_VIDEOS:-}" ]]; then
EXTRA_ARGS+=("--max-videos" "${MAX_VIDEOS}")
fi
for split in "${SPLITS[@]}"; do
case "${split}" in
trainlist0*.txt) tag="train_split${split:9:1}" ;;
testlist0*.txt) tag="test_split${split:8:1}" ;;
*) tag="$(basename "${split}" .txt)" ;;
esac
out_dir="${OUT_ROOT}/ucf101_${tag}_${BACKBONE}"
SPLIT_ARGS=("--output-dir" "${out_dir}")
if [[ "${SKIP_RECON:-0}" != "1" ]]; then
recon_dir="${RECON_ROOT}/ucf101_${tag}_${BACKBONE}"
SPLIT_ARGS+=("--reconstruction-dir" "${recon_dir}")
fi
echo "============================================================"
echo "[run.sh] backbone=${BACKBONE} split=${split}"
echo "[run.sh] features -> ${out_dir}"
if [[ "${SKIP_RECON:-0}" != "1" ]]; then
echo "[run.sh] reconstructions -> ${recon_dir}"
fi
echo "============================================================"
"${PYTHON_BIN}" data_processing/forward.py \
--rae-backbone "${BACKBONE}" \
--split-name "${split}" \
"${SPLIT_ARGS[@]}" \
"${EXTRA_ARGS[@]}"
done
echo "[run.sh] done."

Xet Storage Details

Size:
2.74 kB
·
Xet hash:
ada26ba04d1fbd35415da055554b514b8f934678dca12f897a066fe013a94251

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.