Efficient NeRF Optimization - Not All Samples Remain Equally Hard

Juuso Korhonen, Rangu Goutham, Hamed R. Tavakoli, Juho Kannala

Abstract

Training Neural Radiance Fields (NeRF) is notoriously slow because models spend significant resources processing "easy" samples—such as empty space or regions already well-learned—that contribute little to model improvement. We present an online hard sample mining strategy that utilizes a computationally inexpensive inference pass to identify the most informative points. This method results in a 2x training speedup, approximately 40% memory savings, and a 1 dB improvement in quality (PSNR) compared to the Instant-NGP baseline.

Introduction

Neural Radiance Fields represent 3D scenes by sampling millions of points along rays. While existing methods use occupancy grids or guided sampling to focus on surfaces, they often fail to account for the learning progress of the model. Even surface samples become "easy" once the network has mastered them. The primary computational bottleneck in NeRF training is the backward pass, where gradients are calculated and computational graphs are constructed. Standard training treats every point equally, wasting GPU memory and compute time on points with near-zero gradients.

Methodology: Online Hard Sample Mining

The core of the proposed method is a two-forward-one-backward-pass approach designed to "mine" for hard samples dynamically during training.

Overview of the proposed hard sample mining pipeline.

The process follows four distinct steps as illustrated in the pipeline above:

  1. Search Pass: An initial forward pass is performed in inference mode (e.g., using torch.no_grad). This pass is cheap as it avoids storing intermediate tensors for backpropagation.
  2. Hardness Evaluation: The loss for rendered pixels is calculated and backpropagated only to the network's pre-activation outputs. The "hardness" of a point is defined by the $L_2$ norm of this gradient ($|dY/dZ|$).
  3. Importance Sampling: Using these hardness values, a smaller subset (minibatch $b$) of "hard" samples is selected from the original large batch ($B$).
  4. Training Pass: A second forward pass and a full backward pass are executed only for the selected hard samples. This significantly reduces the size of the computational graph.

This method is hyperparameter-free, utilizing a dynamic algorithm to adjust the hard minibatch size ($b$) based on the "Variance of Gradient" (VoG) to maintain convergence quality.

Experimental Results

The method was evaluated using the Synthetic NeRF and Mip-NeRF-360 datasets, integrated into a PyTorch implementation of Instant-NGP.

  • Efficiency: Average iteration times were reduced to approximately 53-54% of the baseline when the hard sample fraction was set to 10-15%. This translated to a 2x speedup to reach target PSNR levels.
  • Memory Usage: Network memory consumption dropped from ~1 GB to ~570 MB (a 40% reduction), enabling training on lower-end hardware or with larger batch sizes.
  • Quality: When trained for the same duration as the baseline, the proposed method achieved a ~1 dB PSNR improvement.

Discussion and Insights

The "Inference as a Filter" strategy proves highly effective. Although the forward pass is run twice for hard samples, the memory and compute savings from skipping the backward pass for easy samples far outweigh the overhead. Unlike occupancy grids, this method naturally ignores occluded points and regions the model has already learned.

However, limitations exist. If the hard minibatch size becomes too small, GPU utilization may drop, potentially negating the speed benefits. Additionally, incorrect camera poses can lead to "impossible to learn" points that persistently appear hard, potentially saturating the minibatch with noise.

Conclusion

By focusing computation on the most informative samples, this hard sample mining strategy significantly enhances NeRF training efficiency. Future work includes integration into NeRFStudio and adaptation for 3D Gaussian Splatting to address its high memory demands during training.

Summary updated

BibTeX
@inproceedings{korhonen2024efficient,
  author = {Juuso Korhonen and Rangu Goutham and Hamed R. Tavakoli and Juho Kannala},
  title = {{Efficient NeRF Optimization - Not All Samples Remain Equally Hard}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-72764-1\_12},
}
Figure