Initial upload: BPN deblur pipeline code (scripts, triangle-splatting, BAGS, EVSSM forks)
c75b162 verified | # Batch-convert all extracted ScanNet scenes to CoMoGaussian COLMAP format. | |
| # | |
| # Skips scenes whose conversion_manifest.json already exists unless | |
| # --overwrite is passed. | |
| # | |
| # Usage: | |
| # conda activate comogaussian | |
| # bash batch_convert_scannet_comogaussian.sh | |
| # bash batch_convert_scannet_comogaussian.sh --overwrite | |
| # bash batch_convert_scannet_comogaussian.sh --scenes "scene0000_00 scene0001_00" | |
| # STRIDE=4 bash batch_convert_scannet_comogaussian.sh | |
| 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/comogaussian_scannet}" | |
| SCRIPT=/home/szha0669/storage/blur_slam_exp/scripts/convert_scannet_to_comogaussian.py | |
| STRIDE="${STRIDE:-2}" | |
| END="${END:-300}" | |
| DOWNSCALE="${DOWNSCALE:-1}" | |
| MAX_POINTS="${MAX_POINTS:-50000}" | |
| OVERWRITE=0 | |
| # collect flags | |
| 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 | |
| # build scene list | |
| if [ -n "$POSITIONAL_SCENES" ]; then | |
| SCENES=($POSITIONAL_SCENES) | |
| else | |
| SCENES=($(ls -1 "$SCANNET_ROOT" | grep '^scene')) | |
| fi | |
| echo "[batch] ${#SCENES[@]} scenes stride=${STRIDE} end=${END} downscale=${DOWNSCALE}" | |
| echo "" | |
| DONE=0 | |
| SKIP=0 | |
| FAIL=0 | |
| for SCENE in "${SCENES[@]}"; do | |
| MANIFEST="${OUT_ROOT}/${SCENE}/conversion_manifest.json" | |
| if [ -f "$MANIFEST" ] && [ "$OVERWRITE" -eq 0 ]; then | |
| echo "[skip ] ${SCENE} (already converted)" | |
| SKIP=$((SKIP + 1)) | |
| continue | |
| fi | |
| echo "[conv ] ${SCENE}" | |
| OVERWRITE_FLAG="" | |
| [ "$OVERWRITE" -eq 1 ] && OVERWRITE_FLAG="--overwrite" | |
| if python "$SCRIPT" \ | |
| --scene "${SCENE}" \ | |
| --input-root "${SCANNET_ROOT}" \ | |
| --output-root "${OUT_ROOT}" \ | |
| --stride "${STRIDE}" \ | |
| --end "${END}" \ | |
| --downscale "${DOWNSCALE}" \ | |
| --max-points "${MAX_POINTS}" \ | |
| $OVERWRITE_FLAG; then | |
| DONE=$((DONE + 1)) | |
| else | |
| echo "[FAIL ] ${SCENE}" >&2 | |
| FAIL=$((FAIL + 1)) | |
| fi | |
| done | |
| echo "" | |
| echo "[done ] converted=${DONE} skipped=${SKIP} failed=${FAIL}" | |