Files
icassp2027-experiment/run_prepare_all_5fps.sh

64 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
PROJECT_ROOT="${PROJECT_ROOT:-/data1/yfzx/wangx/Code/icassp2027-experiment}"
VIDEO_ROOT="${VIDEO_ROOT:-/data1/yfzx/wangx/Datasets/easycom/extracted_easycom/Main/Video_Compressed}"
TARGET_ROOT="${TARGET_ROOT:-${PROJECT_ROOT}/target_frame}"
PREP_ROOT="${PREP_ROOT:-/data1/yfzx/wangx/Datasets/easycom/omni_prepared}"
LOG_ROOT="${LOG_ROOT:-${PROJECT_ROOT}/logs/prepare_5fps}"
mkdir -p "${LOG_ROOT}"
cd "${PROJECT_ROOT}"
prepare_worker() {
local sid session session_dir target output_dir log
for sid in "$@"; do
session="Session_${sid}"
session_dir="${VIDEO_ROOT}/${session}"
target="${TARGET_ROOT}/${session}.npy"
output_dir="${PREP_ROOT}/${session}"
log="${LOG_ROOT}/${session}.log"
if [[ ! -d "${session_dir}" ]]; then
echo "Missing source session: ${session_dir}" >&2
return 1
fi
if [[ ! -s "${target}" ]]; then
echo "Missing target: ${target}" >&2
return 1
fi
{
echo "$(date): preparing ${session}"
python prepare_easycom_session.py \
--session-dir "${session_dir}" \
--output-dir "${output_dir}" \
--target "${target}" \
--fps 2 5 \
--reuse-existing
echo "$(date): completed ${session}"
} >"${log}" 2>&1
done
}
# FFmpeg/libx264 is already multithreaded. Two session workers generally make
# better use of a many-core host without overwhelming storage or the CPU.
prepare_worker 1 3 5 7 9 11 </dev/null &
pid1=$!
prepare_worker 2 4 6 8 10 12 </dev/null &
pid2=$!
status=0
wait "${pid1}" || status=1
wait "${pid2}" || status=1
if [[ "${status}" -ne 0 ]]; then
echo "At least one preparation worker failed. Check ${LOG_ROOT}." >&2
exit 1
fi
echo "ALL 12 SESSIONS PREPARED AT 2 FPS AND 5 FPS"