microsplat_benchmarking / SETUP_NOTES.md
namor2023's picture
Add files using upload-large-folder tool
166007a verified
|
Raw History Blame Contribute Delete
18.8 kB
# Benchmarking Setup Notes
Three deblurring-focused 3D Gaussian Splatting papers installed and smoke-tested
(train -> render -> eval) on real Deblur-NeRF data. Environment: RTX A4000
(sm_86, 16GB), host driver CUDA 13.2, host nvcc 12.0, gcc-13 default (gcc-12
also installed).
**Network constraint affecting all three:** `repo.anaconda.com` and
`conda.anaconda.org` both time out β€” every repo's documented conda install
path is dead here. pypi.org, download.pytorch.org, github.com,
gitlab.inria.fr, drive.google.com all work. Each repo below used a different
conda-free workaround.
**Shared dataset:** official Deblur-NeRF archive (2.81GB, all four subsets β€”
real/synthetic x defocus/motion), cached at `shared_data/deblur_dataset.zip`
and partially extracted at `shared_data/real_defocus_blur/` and
`shared_data/real_camera_motion_blur/`. Source: the Drive **file** id from the
Deblurring-3DGS README works; the Drive **folder** id linked in the
CoCoGaussian/BAGS READMEs 404s.
```
gdown --no-cookies --continue "https://drive.google.com/uc?id=1N24ipi52XXiPfqWWAxYeyaItNXrL7nSe" -O deblur_dataset.zip
```
A HuggingFace mirror (`zhaoshiwen/deblurnerf-motion10-processed-data`) also
exists but is **not interchangeable** with the official zip β€” it's been
re-undistorted, downscaled, and re-solved (different calibration, confirmed
by comparing `blurcoffee` intrinsics across sources). Use the official zip for
any numbers meant to be comparable across repos or to the papers.
**Cross-repo dataset gotcha:** don't pass `-i images_4`. Scenes ship both
`images/` (`.jpg`, full-res) and `images_4/` (`.png`, quarter-res), but COLMAP
`images.bin` records `.jpg` filenames, and each repo's loader fallback only
rewrites `.png`->`.jpg`, never the reverse β€” so `-i images_4` raises
`FileNotFoundError`. Use `-i images -r 4` instead (same resolution, no dataset
edits).
**Cross-repo dataset gotcha:** `blurcoffee` (in `real_camera_motion_blur`) is
the one scene, of 30, that isn't `SIMPLE_PINHOLE` β€” it's `SIMPLE_RADIAL` with a
small but genuinely nonzero `k1 = 0.001927328970778844` (~2px shift at the
full-res corner, ~0.5px at `-r 4`). BAGS hard-asserts on any non-pinhole model
with no fallback; see the BAGS section below for the undistortion fix
(`tools/undistort_simple_radial.py`) used instead of a source patch. Once
undistorted and rewritten as `PINHOLE`, the scene is valid for **both**
CoCoGaussian and BAGS β€” use the shared undistorted copy
(`BAGS/data/blurcoffee_undist/`, or the same output re-staged per-repo) rather
than each repo's raw `SIMPLE_RADIAL` copy:
- Raw `SIMPLE_RADIAL` copy: BAGS asserts and fails outright. CoCoGaussian
trains via a `poses_bounds.npy` fallback but then reads focal from
`poses_bounds` (1674.40) instead of `cameras.bin` (1676.45) and ignores the
distortion β€” don't quote that PSNR as a real/comparable result.
- Undistorted `PINHOLE` copy: both repos read the identical rewritten
`cameras.bin` (focal 1676.4482617963429) with no source patch to either. A
controlled 600-iteration A/B on CoCoGaussian (matched seed) showed the
undistorted copy scoring +0.68 dB test PSNR over the raw radial copy
(26.257 vs 25.576), consistent with the correction improving multi-view
geometric consistency rather than confounding results.
Iteration counts must still match for any cross-repo comparison β€” the
BAGS `blurcoffee_undist` number below (27.044 at 6100 iters) is not
comparable to CoCoGaussian's 600-iteration smoke numbers.
## Benchmark reproduction summary
All three repos were also run to their own official iteration count (not the
short smoke test) and compared against their respective paper's published
numbers, on the closest matching scene. No additional fixes were needed
beyond what's already documented per-repo below β€” same install, same source
patches (or lack thereof), same dataset. Just the smoke-test flag overrides
were dropped in favor of each repo's official config.
| Method | Scene | Iters | Paper PSNR/SSIM/LPIPS | Ours | Ξ”PSNR |
|---|---|---|---|---|---|
| CoCoGaussian | Caps | 30000 | 24.62 / 0.7472 / 0.1334 | 24.49 / 0.7406 / 0.1386 | βˆ’0.13 |
| BAGS | Caps | 12000 | 24.16 / 0.725 / 0.159 | 24.26 / 0.727 / 0.153 | +0.10 |
| BAGS | Coffee | 12000 | 31.59 / 0.908 / 0.096 | 30.63 / 0.903 / 0.117 | βˆ’0.96 |
| Deblurring-3DGS | Ball | 20000 | 28.27 / 0.8233 / 0.1413 | 28.31 / 0.8267 / 0.1492 | +0.04 |
All four are within ~1 dB of their paper, confirming each implementation
reproduces its published results. BAGS/Coffee is the outlier, plausibly
because our run used the properly-undistorted `blurcoffee` (correcting a
small but real `k1β‰ˆ0.0019` COLMAP distortion β€” see the `blurcoffee` fix
below) while the paper's original run likely used the scene as shipped,
distorted.
---
## CoCoGaussian (CVPR 2025)
`CoCoGaussian/` β€” no source patches. Python 3.10 venv via `uv` (no Docker
needed).
**Install.** Repo ships no `.gitmodules`, so `--recursive` leaves
`submodules/{diff-gaussian-rasterization,simple-knn}` empty. The gitlinks pin
stock upstream 3DGS commits, so clone those explicitly:
```bash
git clone --recursive https://github.com/Jho-Yonsei/CoCoGaussian.git CoCoGaussian
cd CoCoGaussian/submodules && rmdir diff-gaussian-rasterization simple-knn
git clone --recursive https://github.com/graphdeco-inria/diff-gaussian-rasterization.git
git clone https://gitlab.inria.fr/bkerbl/simple-knn.git
(cd diff-gaussian-rasterization && git checkout 59f5f77e3ddbac3ed9db93ec2cfe99ed6c5d121d && git submodule update --init --recursive)
(cd simple-knn && git checkout 86710c2d4b46680c02301765dd79e465819c8f19)
cd ..
uv venv --python 3.10 _venv
VIRTUAL_ENV=$PWD/_venv uv pip install --python $PWD/_venv/bin/python \
torch==2.4.1 torchvision==0.19.1 --index-url https://download.pytorch.org/whl/cu121
VIRTUAL_ENV=$PWD/_venv uv pip install --python $PWD/_venv/bin/python \
"numpy<2" "scikit-image==0.19.3" configargparse plyfile tqdm imageio imageio-ffmpeg \
opencv-python-headless lpips tensorboard matplotlib gdown
export CC=/usr/bin/gcc-12 CXX=/usr/bin/g++-12 TORCH_CUDA_ARCH_LIST="8.6" MAX_JOBS=8
VIRTUAL_ENV=$PWD/_venv uv pip install --python $PWD/_venv/bin/python --no-build-isolation \
./submodules/simple-knn ./submodules/diff-gaussian-rasterization
```
`scikit-image==0.19.3` (which forces Python 3.10) is load-bearing:
`metrics.py:85` calls `structural_similarity(..., multichannel=True)`, a kwarg
removed in 0.20+ (silently swallowed, then raises `win_size exceeds image
extent`). `gcc-12` is required β€” nvcc 12.0 rejects the default gcc-13.
**Dataset.** `defocuscaps` (34 imgs, `hold=5`) from the shared archive.
**Gotchas.**
- `metrics.py`'s `__main__` is dead code (`NameError` on unimported
`ArgumentParser` / undefined `evaluate()`). `render.py` is the actual eval
path β€” it prints PSNR/SSIM/LPIPS itself.
- No `configs/` directory ships despite a `--config` flag existing β€” pass all
args on the CLI.
- Defaults (`start_blurring=1500`, `start_weight=1500`, `pts_iter=2500`,
`densify_from_iter=500`) are tuned for 30k-iteration runs; a short smoke
test must scale them down or it silently degrades to vanilla 3DGS (no CoCo
blur kernel, no weight compositing, no point densification exercised).
- Don't relocate a dataset after training β€” `cfg_args` stores an absolute
`source_path` that `render.py` reads back.
**Reproduce (smoke test, 600/30000 iters):**
```bash
./_venv/bin/python train.py -s data/defocuscaps -i images -r 4 --expname coco_smoke \
--iterations 600 --start_blurring 100 --start_weight 200 --pts_iter 300 \
--densify_from_iter 200 --test_iterations 600 --save_iterations 600 --checkpoint_iterations 600
./_venv/bin/python render.py -m output/coco_smoke --iteration 600
```
Result: test PSNR 21.78 / SSIM 0.5596 / LPIPS 0.4924 (19,765 gaussians, ~2 min,
4.4GB VRAM). `render.py` reproduced these exactly from the saved checkpoint.
Full run: `--iterations 30000` with all defaults restored.
**Reproduce (full run, 30000 iters, official/default config):**
```bash
./_venv/bin/python train.py -s data/defocuscaps -i images -r 4 --expname coco_full30k --eval
```
No flag overrides beyond dataset path/resolution β€” all thresholds
(`start_blurring`, `start_weight`, `pts_iter`, `densify_from_iter`) at their
code defaults. Runtime ~1.5h on the RTX A4000: throughput drops from ~80 it/s
early on to ~8 it/s once the CoC multi-Gaussian rendering kicks in around
iteration 1500-2000 (each iteration renders the base Gaussians plus M CoC
Gaussian sets β€” 5 renders/iteration by default). No extra fixes needed beyond
what's documented above. Result: test PSNR 24.49 / SSIM 0.7406 / LPIPS 0.1386
(training-time eval, `[ITER 30000]` in `log.txt`), vs. paper's 24.62 / 0.7472
/ 0.1334 for Caps (arXiv 2412.16028, Table 8) β€” within noise.
---
## BAGS (ECCV 2024)
`BAGS/` β€” no source patches to BAGS itself (one added standalone tool). Docker
(`docker/Dockerfile`, `docker/Dockerfile.ext`, `docker/run.sh`).
**Install.** BAGS pins torch 1.12.1+cu113, too far from host nvcc 12.0 for a
plain venv, so this repo uses Docker instead:
```bash
git clone --recursive https://github.com/snldmt/BAGS.git
cd BAGS
cp requirements.txt docker/requirements.txt
sudo docker build -t bags:cu113 -f docker/Dockerfile docker/ # py3.8 + torch 1.12.1+cu113
sudo docker build -t bags:ready -f docker/Dockerfile.ext . # + diff-gaussian-rasterization, simple-knn @ sm_86
./docker/run.sh python train.py ... # mounts repo at /workspace, runs as host uid:gid
```
Base image is `nvidia/cuda:11.3.1-devel-ubuntu20.04`, not
`pytorch/pytorch:1.12.1-cuda11.3-cudnn8-devel` (the latter ships Python 3.7,
which has no wheels for numpy 1.24 / open3d 0.18 / scikit-image 0.19).
If pip fails inside the container with `CERTIFICATE_VERIFY_FAILED` on some
hosts but not others, a corporate TLS-intercepting root CA is trusted by the
host but not the container β€” copy the host's CA certs into `docker/certs/`
and set `PIP_CERT`/`REQUESTS_CA_BUNDLE`/`SSL_CERT_FILE`/`CURL_CA_BUNDLE`
(also needed at runtime: `metrics.py` downloads a 233MB VGG16 for LPIPS).
Upstream ships a stale prebuilt `submodules/diff-gaussian-rasterization/build/`
+ `.egg-info` β€” move it aside to force a clean sm_86 compile.
**Dataset.** `defocuscaps` (34 imgs, `hold=5`) β€” the scene in BAGS' own README
example.
**`blurcoffee` fix (no source patch β€” data fix instead).** BAGS hard-asserts
on any COLMAP camera model other than `SIMPLE_PINHOLE`/`PINHOLE`/`OPENCV`
(`scene/dataset_readers.py:95`, no `poses_bounds` fallback), and `blurcoffee`
is `SIMPLE_RADIAL` with real (if small) distortion. Rather than patch the
assert β€” which would need to correctly special-case `k1β‰ˆ0` and still risks
silently discarding distortion β€” the scene was properly undistorted instead,
added as `tools/undistort_simple_radial.py`:
```python
K = [[f,0,cx],[0,f,cy],[0,0,1]] # f=1676.4482617963429
dist = [k1, 0, 0, 0] # k1=0.001927328970778844
cv2.undistort(img, K, dist, None, K) # newCameraMatrix=K keeps intrinsics/FoV unchanged
# then rewrite sparse/0/cameras.bin as PINHOLE (f, f, cx, cy); images.bin/points3D.bin copied verbatim
```
COLMAP's SIMPLE_RADIAL term matches OpenCV's k1-only radial term exactly.
Verified genuinely radial by checking mean pixel diff rises monotonically
with distance from center (0.19 at center -> 2.49 at the edge, matching the
predicted ~2px corner shift). BAGS then runs on the undistorted copy with no
code changes:
```bash
./docker/run.sh python tools/undistort_simple_radial.py data/blurcoffee_radial_src data/blurcoffee_undist
```
**Other gotchas.**
- `--ms_steps` can't go below 6000 (`assert`, `train.py:139`) and
`upsample_iter=[3000,6000]` is hardcoded β€” 6100/6000 is the shortest run
that still exercises both resolution upsamples and the multi-scale ->
single-scale transition.
- `--llffhold` must match the scene's `hold=N` marker file (`defocuscaps`=5,
`blurcoffee`=6).
- Per-scene `scripts/<scene>.sh` use 10000-58000 iterations for full runs
(min `defocusseal` 10000, max `defocuscake` 58000), not the README's flat
46000. `defocuscaps.sh` specifically uses 12000 with `ms_steps=9000` plus
two extra self-supervised regularizers (`--use_depth_loss`,
`--use_rgbtv_loss` β€” total-variation on rendered depth/RGB, no extra data
needed) not present in the README's example command; `blurcoffee.sh` is a
clean 12000/ms_steps=6000 with no extras. Don't describe a smoke run as
"the official config at fewer iterations" for `defocuscaps` β€” it's the
README's simpler config, run short.
- Unlike CoCoGaussian, `metrics.py` here runs standalone fine.
- CoCoGaussian ships no `scripts/`/`configs/` at all, so cross-repo iteration
comparisons should disclose which budget is author-documented (BAGS' per-
scene scripts) vs. a bare code default (CoCoGaussian's `iterations=30000`
in `arguments/__init__.py`, uncorroborated by any README or config file).
**Reproduce (smoke test, 6100 iters, README example config β€” not the
per-scene official config):**
```bash
./docker/run.sh python train.py -s data/defocuscaps -m deblurdata/defocuscaps \
--init_dgt 0.0006 --iterations 6100 --ms_steps 6000 --min_opacity 0.1 \
--eval -r 4 --port 6009 --kernel_size 0.1 --llffhold 5
./docker/run.sh python render.py -m deblurdata/defocuscaps --data_device cpu --skip_train
./docker/run.sh python metrics.py -m deblurdata/defocuscaps -r 4 -t deblur-nerf
```
Results: `defocuscaps` PSNR 22.809/SSIM 0.625/LPIPS 0.307;
`blurcoffee_undist` PSNR 27.044/SSIM 0.823/LPIPS 0.295. Full run: drop the
iteration overrides and use the per-scene script's value.
**Reproduce (full runs, official per-scene configs):**
```bash
./docker/run.sh python train.py -s data/defocuscaps -m deblurdata/defocuscaps_official \
--init_dgt 0.0006 --iterations 12000 --ms_steps 9000 --min_opacity 0.1 \
--use_depth_loss --use_rgbtv_loss --eval -r 4 --port 6009 --kernel_size 0.1 --llffhold 5
./docker/run.sh python train.py -s data/blurcoffee_undist -m deblurdata/blurcoffee_undist_official \
--init_dgt 0.0006 --iterations 12000 --ms_steps 6000 --min_opacity 0.1 \
--eval -r 4 --port 6009 --kernel_size 0.1 --llffhold 6
# render.py + metrics.py exactly as above, pointed at the *_official model_path
```
No extra fixes needed beyond what's already here (Docker env, TLS certs, the
`blurcoffee` undistortion). Results vs. paper (arXiv 2403.04926, Table 1):
Caps 24.26/0.727/0.153 vs. paper's 24.16/0.725/0.159 (matches within noise);
Coffee 30.63/0.903/0.117 vs. paper's 31.59/0.908/0.096 (~1dB low, plausibly
because ours trained on the properly-undistorted scene while the paper likely
used the distorted original).
---
## Deblurring-3D-Gaussian-Splatting
`Deblurring-3D-Gaussian-Splatting/` β€” one source patch (`metrics.py`).
Python 3.12 venv via pip (no Docker needed).
**Install.**
```bash
git clone https://github.com/benhenryL/Deblurring-3D-Gaussian-Splatting.git --recursive
cd Deblurring-3D-Gaussian-Splatting
python3.12 -m venv deblurring_3dgs_env
./deblurring_3dgs_env/bin/pip install torch==2.4.1 torchvision==0.19.1 \
--index-url https://download.pytorch.org/whl/cu121
./deblurring_3dgs_env/bin/pip install "numpy<2" plyfile lpips opencv-python-headless \
scikit-image imageio configargparse tqdm
```
`numpy<2` is required β€” the cu121 wheels otherwise pull numpy 2.x, which this
codebase doesn't expect.
**CUDA_HOME must be hand-assembled.** Host CUDA (Ubuntu's
`nvidia-cuda-toolkit`, 12.0) scatters files: nvcc at `/usr/bin/nvcc`, headers
in `/usr/include`, libs in `/usr/lib/x86_64-linux-gnu`. `/usr/lib/cuda` looks
like `CUDA_HOME` but its `bin/` is empty, so the extension build fails to find
nvcc. Build a symlink tree instead:
```bash
mkdir -p cuda_home/bin
ln -s /usr/bin/nvcc cuda_home/bin/nvcc
ln -s /usr/include cuda_home/include
ln -s /usr/lib/x86_64-linux-gnu cuda_home/lib64
ln -s /usr/lib/cuda/nvvm cuda_home/nvvm
export CUDA_HOME=$PWD/cuda_home PATH=$CUDA_HOME/bin:$PATH
export CC=gcc-12 CXX=g++-12 TORCH_CUDA_ARCH_LIST=8.6 MAX_JOBS=8
./deblurring_3dgs_env/bin/pip install --no-build-isolation \
./submodules/simple-knn ./submodules/diff-gaussian-rasterization
```
`gcc-12` is required (nvcc 12.0 rejects gcc-13). `--no-build-isolation` is
required (else `ModuleNotFoundError: No module named 'torch'` β€” the
submodules' `setup.py` imports torch directly).
**Source patch β€” `metrics.py` (~line 86).** Same root cause as CoCoGaussian's
dead eval path but here it's a live crash, not dead code:
```diff
- im1[i], im2[i], multichannel=True, full=True
+ im1[i], im2[i], channel_axis=-1, data_range=2.0, full=True
```
`data_range=2.0` matches what the pinned scikit-image 0.19.3 inferred for the
[-1,1]-rescaled floats this function receives, keeping numbers comparable to
published results (omitting it lets modern skimage infer a different range
per-image, silently shifting SSIM).
**Dataset.** `real_camera_motion_blur/blurball` (27 imgs, `hold=7`) β€” the
scene in the repo's own README example.
**Reproduce (smoke test, 3000/20000 iters):**
```bash
export CUDA_HOME=$PWD/cuda_home
./deblurring_3dgs_env/bin/python train.py --expname smoke_ball \
-s data/deblur_dataset/real_camera_motion_blur/blurball --config configs/real_camera_motion.txt \
--iterations 3000 --test_iterations 200 1500 3000 --save_iterations 3000 --checkpoint_iterations 3000
./deblurring_3dgs_env/bin/python render.py -m output/smoke_ball \
-s data/deblur_dataset/real_camera_motion_blur/blurball --iteration 3000
```
3000 iters was chosen to cross both `densify_from_iter=500` and
`pts_iter=2500` (the paper's extra-point-allocation step). Result: test PSNR
26.418/SSIM 0.7479/LPIPS 0.3120, `render.py` reproduced the same PSNR to every
digit from the saved checkpoint. Full run: drop the iteration overrides
(default 20000).
**Reproduce (full run, 20000 iters, official/default config):**
```bash
export CUDA_HOME=$PWD/cuda_home
./deblurring_3dgs_env/bin/python train.py --expname full_ball \
-s data/deblur_dataset/real_camera_motion_blur/blurball --config configs/real_camera_motion.txt
```
No iteration override β€” uses the config's default 20000. No extra fixes
needed beyond the patch/env already documented above. Result: test PSNR
28.310 / SSIM 0.8267 / LPIPS 0.1492 (`psnr.txt`, `[ITER 20000]`), vs. paper's
28.27 / 0.8233 / 0.1413 for the Ball scene (arXiv 2401.00834) β€” very close
match.
**Other gotchas.**
- Don't relocate a dataset after training β€” `cfg_args` stores the absolute
`source_path`.
- `environment.yml`'s pins (Python 3.7.13, torch 1.12.1, cudatoolkit 11.6) are
unreachable via conda here and unnecessary β€” Python 3.12 + torch 2.4.1 works
fine with the patch above.