## Depth Diffusion

This repo is for Stanford EE367 final project work on depth reconstruction from RGB and sparse LiDAR, with both baseline UNet and diffusion-based methods. The general idea is that we take sparse lidar measurements, with an RGB image, and recreate a depth map of the given scene. Making the ill-posed problem
easier to solve using the generative diffusion model as a prior in a Bayesian framework. 



### Script Guide

- `datagen.py`: Generates RGB/depth datasets from Habitat scenes and saves frames, poses, and intrinsics.
- `dataset.py`: Defines `RGBDepthDataset` for loading paired RGB and depth files.
- `diffusion_utils.py`: Implements diffusion timestep schedules and forward noising utilities.
- `model_baseline_unet.py`: Defines the supervised baseline UNet architecture.
- `model_diffusion_unet.py`: Defines the diffusion prior UNet architecture.
- `train.py`: Quick dataset sanity check that visualizes one RGB/depth batch.
- `train_unet.py`: Trains the baseline UNet (`unet_depth_model.pth`).
- `train_diffusion.py`: Trains the diffusion prior model (`diffusion_simpleprior_checkpoint.pth` and periodic checkpoints).
- `inference_unet.py`: Runs inference with the trained baseline UNet and saves visualizations plus MAE.
- `inference.py`: Runs diffusion inference with sparse LiDAR constraints and saves a sweep visualization.
- `inference-2.py`: Runs modality ablation visuals for three settings: RGB+LiDAR, LiDAR-only, and RGB-only.
- `inference-2-metrics.py`: Computes quantitative camera/LiDAR ablation metrics over a validation split.
- `metrics.py`: Compares diffusion model vs baseline UNet on MAE/RMSE/PSNR/SSIM and saves aggregated metrics.
- `test.py`: Displays a selected RGB/depth pair from disk for quick inspection.
- `viewer_test.py`: Simple Habitat simulator viewer test script for interactive visual checks.
- `vis.py`: Visualization helper script for inspecting saved outputs and qualitative behavior.
- `create_sequence.py`: Utility script for creating frame sequences for demos/visualizations.
