#!/usr/bin/env bash # # Single-scene overfit smoke test on ARKitScenes (scene 40958756, idx 0). # # ARKitScenes analog of finetune_wildrgbd_overfit.sh. Loads DFoT_RE10K.ckpt + # re10k.ckpt as initialization (same as train.sh / train_re10k.sh / the WildRGBD # overfit) then finetunes the encoder on a single ARKitScenes (ctxt, trgt, intm) # sample with overfit_to_index=0 so we can verify the loss actually drops. # # Camera convention: verify_arkitscenes_pose_convention.py confirms CUT3R's # preprocessed ARKitScenes camera_pose is c2w OpenCV (x right, y down, z fwd) — # the convention the Cut3rAdapter assumes. Multi-view consistency at 94% <5cm # for the OpenCV hypothesis vs 53% for the OpenGL flip. NO pose flip needed. # # Depth: ARKitScenes ships per-frame metric iPad-LiDAR depth (lowres_depth, mm, # 0=invalid). Depth supervision + the depth mask are ENABLED (use_depth_supervision # + model.encoder.use_depth_mask=true), per the SPOC-style setup. # # Required env vars (with sensible defaults): # DATASET_ROOT - path to processed_arkitscenes/ (the dir with Training/) # CKPT_DIR - directory with DFoT_RE10K.ckpt + re10k.ckpt # CUDA_VISIBLE_DEVICES - which GPU (default: 3) set -e # ---- environment ---- # NOTE: use the `3d-belief` env (torch 2.11), NOT `3d-belief-release`. The # release env's diff_gaussian_rasterization _C.so is stale (built against an # older libtorch) and fails with `undefined symbol ...decref_pyobject`. The # `3d-belief` env has a working rasterizer build. (quaternion is broken there # under numpy 2.x but is only needed by the CUT3R *preprocessing* scripts, not # the dataloader/training path.) eval "$(conda shell.bash hook)" conda activate 3d-belief nvidia-smi REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" cd "$REPO_ROOT" # Avoid PYTHONPATH shadowing by an older splat_belief copy # (see memory: 3d-belief-training-script-gotchas). export PYTHONPATH="${REPO_ROOT}:${PYTHONPATH}" DATASET_ROOT="${DATASET_ROOT:-/home/ubuntu/tianmin-neurips/zwen19/data/ARKitScenes/processed_arkitscenes}" CKPT_DIR="${CKPT_DIR:-${REPO_ROOT}/checkpoints}" STAGE="${STAGE:-train}" export MASTER_PORT=$((12000 + RANDOM % 1000)) export PATH=$CONDA_PREFIX/bin:$PATH export CUDA_HOME=$CONDA_PREFIX export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH export CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-3}" export TORCH_CUDA_ARCH_LIST="8.6;9.0" # Tunables for the smoke test — override in the env to scale up. RESULTS_FOLDER="${RESULTS_FOLDER:-outputs/training/arkitscenes_overfit_scene0}" TRAIN_NUM_STEPS="${TRAIN_NUM_STEPS:-500}" SAMPLE_EVERY="${SAMPLE_EVERY:-100}" SAVE_EVERY="${SAVE_EVERY:-500}" # wandb_every must divide sample_every (assert in diffusion.py:1514). WANDB_EVERY="${WANDB_EVERY:-${SAMPLE_EVERY}}" NUM_INTERMEDIATE="${NUM_INTERMEDIATE:-3}" OVERFIT_TO_INDEX="${OVERFIT_TO_INDEX:-0}" # idx 0 -> scene 40958756, group 0 # The base config warmup_period=10000 (with lr=2e-5 => +2e-9/step). That keeps # the LR near-zero for a short overfit, so the loss can't move. Use a short # warmup for the overfit smoke (the multi-scene training script keeps the # canonical 10000). WARMUP_PERIOD="${WARMUP_PERIOD:-200}" LR="${LR:-2e-5}" mkdir -p "${RESULTS_FOLDER}" # DFoT init (same as train.sh / train_re10k.sh / WildRGBD overfit). CKPT_PATH="${CKPT_PATH:-${CKPT_DIR}/DFoT_RE10K.ckpt}" LOAD_ENC="${LOAD_ENC:-true}" ENCODER_CKPT="${ENCODER_CKPT:-${CKPT_DIR}/re10k.ckpt}" DATASET_VIZ_TYPE="${DATASET_VIZ_TYPE:-}" # leave empty to keep YAML default (interpolation) CUDA_LAUNCH_BLOCKING=1 torchrun --nnodes 1 --nproc_per_node 1 --master_port $MASTER_PORT \ splat_belief/experiment/train.py \ dataset=arkitscenes_cut3r \ dataset.root_dir="${DATASET_ROOT}" \ dataset.vggt_alignment_loss_weight=2.0 \ dataset.intermediate_weight=5.0 \ dataset.depth_smooth_loss_weight=0.1 \ setting_name=debug \ stage="${STAGE}" \ use_depth_supervision=true \ results_folder="${RESULTS_FOLDER}" \ semantic_config=splat_belief/config/semantic/onehot.yaml \ checkpoint_path="${CKPT_PATH}" \ $( [ -n "${DATASET_VIZ_TYPE}" ] && echo "dataset.viz_type=${DATASET_VIZ_TYPE}" ) \ ngpus=1 \ image_size=128 \ train_num_steps=${TRAIN_NUM_STEPS} \ warmup_period=${WARMUP_PERIOD} \ lr=${LR} \ sample_every=${SAMPLE_EVERY} \ save_every=${SAVE_EVERY} \ wandb_every=${WANDB_EVERY} \ overfit_to_index=${OVERFIT_TO_INDEX} \ ctxt_min=5 \ ctxt_max=15 \ model/encoder=uvitmvsplat \ model.encoder.use_image_condition=true \ model.encoder.depth_predictor_time_embed=true \ model.encoder.use_camera_pose=true \ model.encoder.use_semantic=false \ model.encoder.use_reg_model=false \ model.encoder.d_semantic=512 \ model.encoder.d_semantic_reg=384 \ model.encoder.gaussians_per_pixel=1 \ model.encoder.evolve_ctxt=false \ model.encoder.use_depth_mask=true \ model.encoder.encoder_ckpt="${ENCODER_CKPT}" \ model.encoder.freeze_depth_predictor=false \ model/encoder/backbone=u_vit3d_pose \ model.encoder.backbone.use_vggt_alignment=true \ model.encoder.backbone.use_repa=true \ model.encoder.backbone.input_size='[128, 128]' \ alignment.latents_info=-1 \ ctxt_losses_factor=0.9 \ repa_encoder_resolution=512 \ model_type=uvit_pose \ name=arkitscenes_overfit \ wandb=local \ clean_target=false \ use_identity=true \ intermediate=true \ num_intermediate=${NUM_INTERMEDIATE} \ load_optimizer=false \ load_enc=${LOAD_ENC} \ finetune_component=encoder \ finetune_steps=5 \ use_depth_smoothness=true \ adjacent_angle=0.785 \ adjacent_distance=1.0