blur-slam-bpn-code / scripts /batch_create_blur_benchmarks.sh
zhaoshiwen's picture
Initial upload: BPN deblur pipeline code (scripts, triangle-splatting, BAGS, EVSSM forks)
c75b162 verified
Raw
History Blame Contribute Delete
2.21 kB
#!/usr/bin/env bash
# Create synthetic motion-blur benchmarks for all ScanNet scenes.
#
# For each scene this writes:
# data/scannet_blur_proto/gaus_sharp/<scene>/ sharp RGB-D for GauS-SLAM
# data/scannet_blur_proto/gaus_blur/<scene>/ blurred RGB-D for GauS-SLAM
# data/scannet_blur_proto/vddiff/test/sharp/<scene>/ VD-Diff reference
# data/scannet_blur_proto/vddiff/test/blur/<scene>/ VD-Diff input
#
# Skips scenes whose manifest already exists unless --overwrite is passed.
#
# Usage:
# conda activate comogaussian # needs pillow + numpy
# bash batch_create_blur_benchmarks.sh
# BLUR_RADIUS=5 bash batch_create_blur_benchmarks.sh --overwrite
set -euo pipefail
SCANNET_ROOT="${SCANNET_ROOT:-/home/szha0669/storage/blur_slam_exp/data/scannet}"
OUT_ROOT="${OUT_ROOT:-/home/szha0669/storage/blur_slam_exp/data/scannet_blur_proto}"
SCRIPT=/home/szha0669/storage/blur_slam_exp/scripts/create_scannet_blur_benchmark.py
START="${START:-0}"
END="${END:-120}"
STRIDE="${STRIDE:-2}"
BLUR_RADIUS="${BLUR_RADIUS:-3}"
OVERWRITE=0
POSITIONAL_SCENES=""
while [[ $# -gt 0 ]]; do
case "$1" in
--overwrite) OVERWRITE=1; shift ;;
--scenes) POSITIONAL_SCENES="$2"; shift 2 ;;
*) echo "unknown arg: $1"; exit 1 ;;
esac
done
if [ -n "$POSITIONAL_SCENES" ]; then
SCENES=($POSITIONAL_SCENES)
else
SCENES=($(ls -1 "$SCANNET_ROOT" | grep '^scene'))
fi
echo "[batch] ${#SCENES[@]} scenes blur_radius=${BLUR_RADIUS} stride=${STRIDE}"
echo ""
DONE=0; SKIP=0; FAIL=0
for SCENE in "${SCENES[@]}"; do
MANIFEST="${OUT_ROOT}/${SCENE}_manifest.json"
if [ -f "$MANIFEST" ] && [ "$OVERWRITE" -eq 0 ]; then
echo "[skip ] ${SCENE}"
SKIP=$((SKIP + 1))
continue
fi
echo "[blur ] ${SCENE}"
EXTRA=""
[ "$OVERWRITE" -eq 1 ] && EXTRA="--overwrite"
if python "$SCRIPT" \
--scene "${SCENE}" \
--src-root "${SCANNET_ROOT}" \
--out-root "${OUT_ROOT}" \
--start "${START}" \
--end "${END}" \
--stride "${STRIDE}" \
--blur-radius "${BLUR_RADIUS}" \
$EXTRA; then
DONE=$((DONE + 1))
else
echo "[FAIL ] ${SCENE}" >&2
FAIL=$((FAIL + 1))
fi
done
echo ""
echo "[done ] created=${DONE} skipped=${SKIP} failed=${FAIL}"