EndoGaussian-4D / docs /formalization.md
mnunziant's picture
Add docs/formalization.md
9168f0d verified
|
Raw
History Blame Contribute Delete
9 kB

EndoGaussian-4D: Mathematical Formalization

Physics-Informed Deformation Field for Real-Time 4D Gaussian Splatting in Endoscopic Surgery

Week 1 Sprint β€” Phase 3 Deliverable


1. Preliminary: 3D Gaussian Splatting

A scene is represented as N anisotropic 3D Gaussians:

G={Gi}i=1N,Gi=(ΞΌi,qi,si,Ξ±i,ci)\mathcal{G} = \{ G_i \}_{i=1}^{N}, \quad G_i = (\boldsymbol{\mu}_i, \mathbf{q}_i, \mathbf{s}_i, \alpha_i, \mathbf{c}_i)

where:

  • ΞΌα΅’ ∈ ℝ³: Mean (center position)
  • qα΅’ ∈ ℝ⁴: Unit quaternion (rotation)
  • sα΅’ ∈ ℝ³: Log-scale vector (anisotropic scaling)
  • Ξ±α΅’ ∈ ℝ: Logit-opacity
  • cα΅’ ∈ ℝᴷˣ³: Spherical harmonics coefficients (K = (β„“+1)Β² for degree β„“)

Covariance in world space:

Ξ£i=R(qi) S(si) S(si)βŠ€β€‰R(qi)⊀\Sigma_i = R(\mathbf{q}_i) \, S(\mathbf{s}_i) \, S(\mathbf{s}_i)^\top \, R(\mathbf{q}_i)^\top

Pixel color via Ξ±-compositing (front-to-back):

C(p)=βˆ‘i∈Nci σi∏j=1iβˆ’1(1βˆ’Οƒj),Οƒi=Ξ±iβ‹…giβ€²(p)C(\mathbf{p}) = \sum_{i \in \mathcal{N}} c_i \, \sigma_i \prod_{j=1}^{i-1} (1 - \sigma_j), \quad \sigma_i = \alpha_i \cdot g'_i(\mathbf{p})


2. Physics-Informed Deformation Field

2.1 Core Formulation

The key equation:

$$\boxed{G_i(t) = G_i^{(0)} + \boldsymbol{\Delta}_\theta(\boldsymbol{\mu}_i, t)}$$

where Gβ‚€ is the canonical (rest-state) Gaussian and Ξ”_ΞΈ is the learned deformation:

Δθ(ΞΌi,t)=(Δμi(t)∈R3Ξ”qi(t)∈R4Ξ”si(t)∈R3Δαi(t)∈R)\boldsymbol{\Delta}_\theta(\boldsymbol{\mu}_i, t) = \begin{pmatrix} \Delta\boldsymbol{\mu}_i(t) \in \mathbb{R}^3 \\ \Delta\mathbf{q}_i(t) \in \mathbb{R}^4 \\ \Delta\mathbf{s}_i(t) \in \mathbb{R}^3 \\ \Delta\alpha_i(t) \in \mathbb{R} \end{pmatrix}

Deformed parameters:

Parameter Equation
Position ΞΌα΅’(t) = μᡒ⁰ + Δμᡒ(t)
Rotation qα΅’(t) = normalize(qᡒ⁰ + Ξ”qα΅’(t))
Scale sα΅’(t) = sᡒ⁰ + Ξ”sα΅’(t)
Opacity Ξ±α΅’(t) = αᡒ⁰ + Δαᡒ(t)

2.2 HexPlane Spatio-Temporal Encoding

The 4D input (ΞΌα΅’, t) ∈ ℝ⁴ is factorized into 6 learnable 2D feature planes:

P={(XY),(XZ),(YZ),(XT),(YT),(ZT)}\mathcal{P} = \{(XY), (XZ), (YZ), (XT), (YT), (ZT)\}

Each plane F_l^(d₁,dβ‚‚) ∈ ℝ^{C Γ— R_{d₁} Γ— R_{dβ‚‚}} stores C-dimensional features.

The encoded feature:

E(ΞΌi,t)=⨁l=1L⨁(d1,d2)∈PBilinearSample ⁣(Fl(d1,d2),[ΞΌid1,ΞΌid2])E(\boldsymbol{\mu}_i, t) = \bigoplus_{l=1}^{L} \bigoplus_{(d_1, d_2) \in \mathcal{P}} \text{BilinearSample}\!\left(F_l^{(d_1, d_2)}, [\mu_i^{d_1}, \mu_i^{d_2}]\right)

Memory complexity: O(6LRΒ²) vs O(R⁴) for dense 4D grid. With R=64 spatial, R_t=75 temporal, L=2 levels, C=32: β‰ˆ12 MB (vs 20M entries dense).

2.3 Deformation Decoder

Shared MLP backbone β†’ 4 output heads (all zero-initialized):

hβ‚€ = E(ΞΌα΅’, t)                        # HexPlane features
hβ‚– = ReLU(Wβ‚–Β·hₖ₋₁ + bβ‚–)             # K shared layers
Δμ = W_ΞΌ Β· hβ‚–    (zero-init)          # Position displacement
Ξ”q = W_q Β· hβ‚–    (zero-init)          # Rotation perturbation
Ξ”s = W_s Β· hβ‚–    (zero-init)          # Scale adjustment
Δα = W_Ξ± Β· hβ‚–    (zero-init)          # Opacity adjustment

Zero initialization is critical: At startup, Ξ”_ΞΈ = 0, so the model begins from canonical Gaussians and gradually learns displacements. This prevents early-training instability.


3. Physics-Informed Priors

3.1 Tissue Biomechanics Motivation

Soft surgical tissue (liver, colon, uterus) has physical properties that constrain valid deformations:

  1. Locally smooth: Tissue displacement fields are continuous and slowly varying in space
  2. Temporally coherent: Tissue velocity changes smoothly over time
  3. Volume-preserving: Biological tissue is nearly incompressible
  4. Bounded strain: Tissue stretches/compresses within physiological limits

3.2 Temporal Smoothness Prior

Lsmooth=1Nβˆ‘i=1Nβˆ₯Δθ(ΞΌi,t)βˆ’Ξ”ΞΈ(ΞΌi,t+Ξ΄)βˆ₯22\mathcal{L}_{\text{smooth}} = \frac{1}{N} \sum_{i=1}^{N} \left\| \boldsymbol{\Delta}_\theta(\boldsymbol{\mu}_i, t) - \boldsymbol{\Delta}_\theta(\boldsymbol{\mu}_i, t + \delta) \right\|_2^2

Physical interpretation: Approximates a penalty on tissue acceleration:

Lsmoothβ‰ˆΞ΄2β‹…1Nβˆ‘i=1Nβˆ₯βˆ‚Ξ”ΞΈβˆ‚t(ΞΌi,t)βˆ₯22\mathcal{L}_{\text{smooth}} \approx \delta^2 \cdot \frac{1}{N} \sum_{i=1}^{N} \left\| \frac{\partial \boldsymbol{\Delta}_\theta}{\partial t}(\boldsymbol{\mu}_i, t) \right\|_2^2

This is Tikhonov regularization on the velocity field β€” standard in biomechanical simulation.

3.3 Total Variation on HexPlane Features

LTV=16Lβˆ‘l=1Lβˆ‘(d1,d2)∈P(βˆ₯βˆ‡hFl(d1,d2)βˆ₯1+βˆ₯βˆ‡vFl(d1,d2)βˆ₯1)\mathcal{L}_{\text{TV}} = \frac{1}{6L} \sum_{l=1}^{L} \sum_{(d_1,d_2) \in \mathcal{P}} \left( \left\| \nabla_{h} F_l^{(d_1,d_2)} \right\|_1 + \left\| \nabla_{v} F_l^{(d_1,d_2)} \right\|_1 \right)

Physical interpretation: TV on temporal planes (XT, YT, ZT) enforces that nearby Gaussians undergo similar deformations β€” encoding that tissue is a continuum, not independent particles.


4. Complete Loss Function

4.1 Full Objective

L=(1βˆ’Ξ»1)L1+Ξ»1LD-SSIM⏟appearance+Ξ»2Ldepth⏟geometry+Ξ»3Lsmooth+Ξ»4LTV⏟regularization\boxed{\mathcal{L} = \underbrace{(1-\lambda_1)\mathcal{L}_1 + \lambda_1 \mathcal{L}_{\text{D-SSIM}}}_{\text{appearance}} + \underbrace{\lambda_2 \mathcal{L}_{\text{depth}}}_{\text{geometry}} + \underbrace{\lambda_3 \mathcal{L}_{\text{smooth}} + \lambda_4 \mathcal{L}_{\text{TV}}}_{\text{regularization}}}

Hyperparameters: λ₁ = 0.2, Ξ»β‚‚ = 0.1, λ₃ = 0.01, Ξ»β‚„ = 0.001

4.2 Appearance Loss Terms

L1 Photometric (tool-masked): L1=1∣Vtβˆ£βˆ‘p∈Vt∣I^(p)βˆ’Iβˆ—(p)∣\mathcal{L}_1 = \frac{1}{|\mathcal{V}_t|} \sum_{\mathbf{p} \in \mathcal{V}_t} \left| \hat{I}(\mathbf{p}) - I^*(\mathbf{p}) \right|

D-SSIM: LD-SSIM=1βˆ’SSIM(I^βŠ™Mt,β€…β€ŠIβˆ—βŠ™Mt)2\mathcal{L}_{\text{D-SSIM}} = \frac{1 - \text{SSIM}(\hat{I} \odot M_t, \; I^* \odot M_t)}{2}

4.3 Scale-Invariant Depth Loss

Ldepth=1∣Vβˆ£βˆ‘p∈Vdp2βˆ’0.5∣V∣2(βˆ‘p∈Vdp)2\mathcal{L}_{\text{depth}} = \frac{1}{|\mathcal{V}|} \sum_{\mathbf{p} \in \mathcal{V}} d_\mathbf{p}^2 - \frac{0.5}{|\mathcal{V}|^2} \left( \sum_{\mathbf{p} \in \mathcal{V}} d_\mathbf{p} \right)^2

where d_p = log DΜ‚(p) - log D*(p). Scale-invariant formulation handles both known-scale (C3VD structured-light) and unknown-scale (Depth-Anything monocular) depth.

4.4 Tool Occlusion Handling

Three-stage masking:

  1. Initialization: Tools excluded from HGI point cloud $$P = \bigcup_{t} K^{-1} T_t D_t (I_t \odot M_t)$$

  2. Loss: All terms computed on tissue pixels only (V_t = {p : M_t(p) = 1})

  3. Densification: Gradient signals from tool boundaries excluded from split/clone decisions


5. Holistic Gaussian Initialization (HGI)

P=Subsample0.1% ⁣(⋃t=1TΞ tβˆ’1(Dt,Mt))\boxed{P = \text{Subsample}_{0.1\%}\!\left( \bigcup_{t=1}^{T} \Pi_t^{-1}(D_t, M_t) \right)}

Backprojection operator: Ξ tβˆ’1(Dt,Mt)={Ttβ‹…Kβˆ’1(uv1)Dt(u,v)β€…β€Š|β€…β€ŠMt(u,v)=1,β€…β€ŠDt(u,v)>0}\Pi_t^{-1}(D_t, M_t) = \left\{ T_t \cdot K^{-1} \begin{pmatrix} u \\ v \\ 1 \end{pmatrix} D_t(u,v) \;\middle|\; M_t(u,v) = 1, \; D_t(u,v) > 0 \right\}

Scale initialization from KNN: si(0)=log⁑ ⁣(1kβˆ‘j∈kNN(i)βˆ₯ΞΌiβˆ’ΞΌjβˆ₯),k=3s_i^{(0)} = \log\!\left( \frac{1}{k} \sum_{j \in \text{kNN}(i)} \|\boldsymbol{\mu}_i - \boldsymbol{\mu}_j\| \right), \quad k=3


6. Training Schedule

Phase Iterations What's Optimized Density Control
Warmup 0 β†’ 1000 Canonical Gaussians only Active (500-1000)
Deformation 1000 β†’ 3000 Gaussians + HexPlane + Decoder Active (1000-2500)

Learning rates (Adam, exponential decay Ξ³ = 0.01^{1/3000}):

Parameter lrβ‚€
Means ΞΌ 1.6Γ—10⁻⁴
Scales s 5Γ—10⁻³
Quaternions q 1Γ—10⁻³
Opacities Ξ± 5Γ—10⁻²
SH coefficients 2.5Γ—10⁻³
Deformation ΞΈ 1.6Γ—10⁻³

7. Adaptive Density Control

absgrad-based (absolute gradient values, not norms):

gΛ‰i=1∣Tvis(i)βˆ£βˆ‘t∈Tvis(i)max⁑dβˆ£βˆ‚Lβˆ‚ΞΌiβ€²(d)∣\bar{g}_i = \frac{1}{|T_{\text{vis}}(i)|} \sum_{t \in T_{\text{vis}}(i)} \max_d \left| \frac{\partial \mathcal{L}}{\partial \mu'^{(d)}_i} \right|

Operation Condition Action
Split αΈ‘α΅’ > 0.0002 AND max scale > 0.01 Split into 2, shrink by log(1.6)
Clone αΈ‘α΅’ > 0.0002 AND max scale ≀ 0.01 Duplicate at same position
Prune Οƒ(Ξ±α΅’) < 0.005 OR max scale > 0.1 Remove Gaussian

8. Expected Performance

Method PSNR ↑ SSIM ↑ FPS Train Time
Static 3DGS 30-32 0.90 200+ 2 min
EndoNeRF 35.8 0.96 0.2 12 hr
Endo-4DGS 36.6 0.96 100 4-7 min
EndoGaussian (target) 37.9 0.97 195 2 min

References

  1. Kerbl et al. "3D Gaussian Splatting for Real-Time Radiance Field Rendering." SIGGRAPH 2023.
  2. Liu et al. "EndoGaussian: Real-time Gaussian Splatting for Dynamic Endoscopic Scene Reconstruction." arXiv:2401.12561, 2024.
  3. Huang et al. "Endo-4DGS: Endoscopic Monocular Scene Reconstruction with 4D Gaussian Splatting." MICCAI 2024.
  4. Cao & Johnson. "HexPlane: A Fast Representation for Dynamic Scenes." CVPR 2023.
  5. Eigen et al. "Depth Map Prediction from a Single Image using a Multi-Scale Deep Network." NeurIPS 2014.
  6. Wang et al. "Neural Rendering for Stereo 3D Reconstruction of Deformable Tissues in Robotic Surgery." MICCAI 2022.
  7. Ye et al. "gsplat: An Open-Source Library for Gaussian Splatting." arXiv:2409.06765, 2024.
  8. Yang et al. "Depth Anything: Unleashing the Power of Large-Scale Unlabeled Data." CVPR 2024.