Paper commentary
BARF: Bundle-Adjusting Neural Radiance Fields
- Problem NeRF needs accurate camera poses, and optimizing those poses jointly with the network can settle into suboptimal solutions when positional encoding is applied naively.
- Method BARF optimizes the NeRF weights and camera poses together, and ramps positional-encoding frequency bands from low to high so that early gradients stay smooth.
- Results On the synthetic object scenes with perturbed poses, BARF reduced mean rotation error to 0.193° from 6.167° for full positional encoding.

Figure 9 : Visualization of the basin of attraction. (a) We aim to align a center box (yellow) to a target patch (red) atevery possible location within the raw image. For each target patch, we jointly optimizef and the translational warp p to analyze the final warp error and the image reconstruction loss. (b) The target offsets forms a color-coded map, where green indicates horizontal offsets and red indicates vertical offsets. The above example corresponds to the highlighted pixel. (c) The optimized warp parameters and (d) the warp error for every target patch location, where the white contours highlight the offset error threshold of 0.5 pixels. BARF effectively widens the basin of attraction (range of successful alignment) with a smoother landscape compared to naïve positional encoding. (e) Without positional encoding,f has limited capacity of representing the image details, resulting in nonzero image errors despite the registration being successful as well.
Original paper · CC BY 4.0 · Chen-Hsuan Lin, Wei-Chiu Ma, Antonio Torralba, Simon Lucey · BARF: Bundle-Adjusting Neural Radiance Fields · Original paper figure · Extracted the figure area from page 10 of the original PDF.Why NeRF depends on known camera poses
NeRF represents a scene as an MLP that maps 3D points to color and volume density, and it renders each pixel by volume rendering along a viewing ray. Every training pixel is tied to a ray from a known camera, so an error in a pose shows up directly as an error in the photometric loss that trains the network. A direct workaround is to treat the poses as learnable parameters and update them by backpropagation together with the network weights.
That workaround is sensitive to initialization, and a poor start can leave the scene representation in a suboptimal state.
Classical structure from motion and SLAM handle the same coupling in two stages: local registration first, then global bundle adjustment over structure and cameras. Those pipelines depend on the quality of local registration, and their sparse point clouds limit tasks that need dense geometry. BARF sits with the direct methods, which use photometric consistency over every pixel rather than keypoints, but it represents the scene with a coordinate network instead of explicit geometry.
The concurrent NeRF-- pipeline estimates unknown poses in two stages, whereas BARF is described as recovering the poses within a single optimization.
The central question is whether the coarse-to-fine idea that makes classical image alignment work also makes joint registration and reconstruction work for NeRF.
Coarse-to-fine registration in 2D image alignment
Planar image alignment searches for warp parameters p that minimize the photometric difference between one image warped by W(x; p) and a second image. The objective is \(\min_p \sum_x \lVert I_1(W(x;p))-I_2(x)\rVert_2^2\), summed over pixels x.
Because the problem is nonlinear, the warp is refined iteratively: an update \(\Delta p\) is formed from the Jacobian-weighted residual and added to p. The Lucas-Kanade algorithm uses Gauss-Newton optimization, with \(A(x;p)=\left(\sum_x J(x;p)^\top J(x;p)\right)^{-1}\), while first-order optimizers such as stochastic gradient descent treat A as a scalar learning rate.
The image gradients that drive these updates are estimated by finite differences, and the update is reliable only when neighbouring per-pixel predictions agree. Natural images carry high-frequency detail, so an update computed from raw pixels can be misled when the starting warp is far from the answer. Classical coarse-to-fine alignment blurs the images in early stages, which widens the basin of attraction and smooths the alignment landscape.
The two 1D signals in Figure 2 differ by an offset, and the smoother one yields more coherent displacement predictions.
The smoothness of the signal is then controlled through the network itself, not by blurring the input images. Objective (4) fits one network to both images while warping the second, and objective (5) gives each of the M images its own warp parameters.
Why positional encoding complicates pose gradients
NeRF's network is a composition of positional encoding and an MLP, and a pixel is rendered from N samples along its ray. Under a 6-DoF pose, a point in camera space is mapped to world coordinates by a rigid transform, so the synthesized color depends on the pose through the network inputs. Pose updates come from backpropagating the photometric error through this same network, which yields a steepest descent image built from the network Jacobian.
Positional encoding lets coordinate networks represent high-frequency signals and converge faster, which is why NeRF uses it for fine detail. The derivative of each frequency term scales the gradient coming from the MLP by a factor that grows with the frequency, and the direction of that factor rotates at the same frequency. The gradient signals from the sampled 3D points therefore become incoherent in direction and magnitude and can cancel one another, which makes the predicted pose update hard to use.
This makes naive positional encoding cut both ways for joint registration and reconstruction.
A frequency mask that opens up over training
BARF multiplies the sinusoidal features of each frequency band k by a weight \(w_k(\alpha)\) that depends on a control parameter \(\alpha\). The parameter \(\alpha\in[0,L]\) is proportional to optimization progress, where L is the number of frequency bands. Each weight is zero while \(\alpha<k\), rises smoothly over the interval \(0\le\alpha-k<1\) as \(w_k(\alpha)=1-\frac{\cos((\alpha-k)\pi)}{2}\), and equals one once \(\alpha-k\ge 1\).
While a band's weight is zero, its contribution to the gradient is removed, so the higher bands cannot affect the pose update until their turn. At \(\alpha=0\) the network sees the raw coordinates, and at \(\alpha=L\) the encoding is the full original NeRF encoding. The early stage therefore works from a smooth signal that can steer registration, and the later stage moves capacity toward high-fidelity scene detail.
In the NeRF experiments \(\alpha\) is adjusted linearly from iteration 20K to 100K, and all bands up to L = 10 are active after that, on both the synthetic and the LLFF scenes. The authors note that the best schedule would depend on the data and that searching for one is outside the scope of the paper.
A 2D alignment check of the frequency schedule
The test uses one ImageNet image and five patches with homography perturbations, and each patch's homography is solved together with a neural representation of the whole image. Patches start from center crops, and the warp of the first patch is fixed to identity so that the recovered image is aligned to the raw image. Warps are parameterized with the sl(3) Lie algebra.
The image network is a ReLU MLP with four 256-dimensional hidden units, optimized with Adam for 5000 iterations at a learning rate of 0.001. Three variants are compared: full positional encoding, no encoding, and BARF, which uses the schedule over the first 2000 iterations with L = 8.
Full encoding gives an sl(3) error of 0.2949 and a patch PSNR of 23.41. Without encoding the sl(3) error is 0.0641 and the patch PSNR is 24.72, while BARF reaches 0.0096 and 35.30. Full encoding leaves ghosting in the recovered image, while removing the encoding gives a decent alignment with a blurry representation. The comparison separates two failures: registration failure under full encoding and limited representational capacity without encoding.
Synthetic object scenes with perturbed poses
The experiment uses eight synthetic object-centric scenes, each with 100 rendered training images and ground-truth camera poses. The intrinsics are assumed known.
The model is a single MLP with 128 hidden units per layer and no hierarchical sampling, trained for 200K iterations with 1024 rays per step and N = 128 samples per ray. BARF adjusts its control parameter from iteration 20K to 100K and then activates all bands up to L = 10.
Because scene and cameras are defined only up to a 3D similarity transform, the optimized camera centers are Procrustes-aligned to the ground-truth centers before rotation and translation errors are measured. View synthesis is scored with PSNR, SSIM and LPIPS after a test-time photometric optimization, which removes residual pose error from the synthesis measurement.
Mean rotation error is 0.193° for BARF, 0.202° without encoding and 6.167° with full encoding. The table caption states that BARF keeps rotation error under 0.2° on the synthetic scenes. On the chair scene, BARF realigns all camera frames, while full encoding stays at a suboptimal configuration.
Mean PSNR is 27.50 for BARF, 26.78 without encoding and 22.12 with full encoding, against 29.40 for the reference NeRF trained on ground-truth poses. BARF's mean SSIM is 0.930 against 0.936 for the reference, and its mean LPIPS is 0.065 against 0.057, so it trails the reference on every mean metric.
Without encoding the rotation error is close to BARF's, but the representation is weaker, which the authors attribute to limited reconstruction fidelity. The gap between the two therefore appears in PSNR rather than in rotation error.
Real-world LLFF scenes from identity initialization
The LLFF dataset has eight forward-facing scenes of RGB images captured sequentially with hand-held cameras. All camera poses start at the identity transformation, and the intrinsics come from the dataset. The reference poses are themselves estimates from structure-from-motion packages, so pose error measures agreement with classical estimation rather than with ground truth.
The last 10% of frames in each sequence are held out for testing, which differs from the every-8th-frame split of the original NeRF paper. Table 4 lists the split sizes, for example 18 training and 2 test frames for Fern. BARF uses the same schedule as on the synthetic scenes, adjusting its control parameter from iteration 20K to 100K and then activating bands up to L = 10.
Mean rotation error is 0.573° for BARF and 84.509° for full encoding. Mean PSNR is 23.97 for BARF, 11.03 for full encoding and 22.56 for the reference NeRF trained on SfM poses. The per-scene rows follow the same pattern, for example Fern at 0.191° for BARF against 74.452° with full encoding. The authors state that full encoding diverges to incorrect localization, which accounts for its poor synthesis quality.
The table adds the no-encoding baseline: its mean rotation error is 0.699° and its mean PSNR is 23.82, against 0.573° and 23.97 for BARF. The two methods are competitive in different metrics rather than one dominating the other across the board.
On the fern scene, the poses optimized by BARF agree with the SfM trajectory after Procrustes alignment, while the full-encoding trajectory does not align.
Metric depth versus inverse-depth sampling on LLFF
The main LLFF runs sample points linearly in inverse depth, between the image plane and infinity. The additional runs sample points in metric depth between 1 and 20.
In metric depth, mean rotation error is 0.479° without encoding, 1.580° for BARF and 111.635° for full encoding. Mean PSNR is 23.26 without encoding and 23.09 for BARF, while full encoding reaches 10.54.
Under metric depth the no-encoding baseline may be slightly better than BARF. Under inverse depth the mean PSNR is 23.97 for BARF and 23.82 without encoding, and the authors report that every compared method scores better when points are sampled in inverse depth. The authors leave a full analysis of depth parametrization to future work.
Basin of attraction for a translated patch
The appendix uses a translational warp on a square box whose side is one third of the image height, initialized at the center of the raw image. The box is aligned to a target patch shifted by an offset, and offsets are searched over the whole pixel grid until the target no longer overlaps the initial box. The warp and the network are optimized jointly with objective (4).
BARF widens the basin of attraction and still reconstructs the image with high fidelity. The warp-error maps over all target locations, with a 0.5-pixel contour marked, show a wider and smoother successful region for BARF.
The authors read this as support for coarse-to-fine registration in the 3D case as well.
Limitations
BARF inherits the drawbacks of the original NeRF, including slow optimization and rendering, a rigidity assumption and sensitivity to dense 3D sampling. It also relies on heuristic coarse-to-fine scheduling strategies.
The LLFF pose reference comes from structure-from-motion, so the pose numbers measure agreement with classical estimates rather than exact ground truth. The LLFF test protocol holds out the final 10% of frames, which differs from the original NeRF split.
The schedule was not tuned per scene, and the authors state that an optimal schedule would be data-dependent. Depth parametrization is examined on LLFF with a single alternative sampling, and a full analysis is left to future work.
The planar test uses one image with five patches, and the basin study uses translational warps on one image. The reported experiments cover the eight synthetic object scenes and the eight LLFF scenes only.
Paper info
- Authors
- Chen-Hsuan Lin, Wei-Chiu Ma, Antonio Torralba, Simon Lucey
- Venue
- arXiv · Preprint
- First published
- 2021-4-13
- Added
- 2026-11-5
- Updated
- 2021-8-19
- Version
- v2
- arXiv
- 2104.06405
- Category
- cs.CV · cs.GR · cs.LG · cs.RO
- Original paper terms
- CC BY 4.0
- What we show
- Paper info, commentary and permitted figures from the original paper
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Abstract
Neural Radiance Fields (NeRF) have recently gained a surge of interest within the computer vision community for its power to synthesize photorealistic novel views of real-world scenes. One limitation of NeRF, however, is its requirement of accurate camera poses to learn the scene representations. In this paper, we propose Bundle-Adjusting Neural Radiance Fields (BARF) for training NeRF from imperfect (or even unknown) camera poses -- the joint problem of learning neural 3D representations and registering camera frames. We establish a theoretical connection to classical image alignment and show that coarse-to-fine registration is also applicable to NeRF. Furthermore, we show that naïvely applying positional encoding in NeRF has a negative impact on registration with a synthesis-based objective. Experiments on synthetic and real-world data show that BARF can effectively optimize the neural scene representations and resolve large camera pose misalignment at the same time. This enables view synthesis and localization of video sequences from unknown camera poses, opening up new avenues for visual localization systems (e.g. SLAM) and potential applications for dense 3D mapping and reconstruction.
Quote from the paper
Chen-Hsuan Lin, Wei-Chiu Ma, Antonio Torralba, Simon Lucey (2021). BARF: Bundle-Adjusting Neural Radiance Fields. arXiv:2104.06405v2. https://arxiv.org/abs/2104.06405v2
BibTeX
@misc{lin2021barf,
title = {{BARF: Bundle-Adjusting Neural Radiance Fields}},
author = {Chen-Hsuan Lin and Wei-Chiu Ma and Antonio Torralba and Simon Lucey},
year = {2021},
eprint = {2104.06405},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2104.06405v2}
}