File size: 2,213 Bytes
c75b162
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/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}"