Abstract
This study evaluates the relative performance of Neural Networks (NNs) and Random Forests (RFs) for dense scene coordinate regression in camera localization. We introduce "ForestNets," a novel architecture that maps trained RFs into differentiable neural networks, enabling fine-tuning via backpropagation. While deep NNs achieve significantly higher accuracy in scene coordinate prediction, our findings reveal a surprising disconnect: this increased precision does not necessarily lead to superior 6D camera pose estimates. Our results suggest that fast, memory-efficient RFs remain the practical choice for real-time robotics applications.
Introduction: The Camera Localization Challenge
Camera localization—determining a camera's 6D pose from a single RGB image—is a cornerstone of robotics and augmented reality. The current state-of-the-art pipeline involves two distinct stages: dense scene coordinate regression followed by robust pose estimation.
In the first stage, the system predicts a 3D coordinate for every pixel in the 2D image. These correspondences are then processed by a RANSAC-based optimizer to compute the final camera pose. While Random Forests (RFs) are traditionally favored for their speed and low memory footprint, Neural Networks (NNs) have become the standard for regression tasks. This research investigates whether NNs should replace RFs in this specific pipeline.
Methodology: Bridging RFs and NNs
To compare these architectures fairly, we developed ForestNets, a hybrid approach that transforms a trained RF into a mathematically equivalent two-hidden-layer neural network.
ForestNet Architecture
The mapping process makes the previously non-differentiable RF fully differentiable. We explored several variants:
- fNET-L: Fine-tuning only the leaf weights, allowing the model to be mapped back to a fast RF for inference.
- fNET-LS/LST: Learning split thresholds and tree topology, which increases flexibility but prevents back-mapping to RFs.
Robust Averaging
Since RFs are ensembles, ForestNets are also ensembles of parallel networks. We introduced a differentiable Robust Geometric Median (GM) module to average these predictions. This module can be applied post-hoc (pGM) or integrated into end-to-end training (eGM).
Key Insights and Results
Our experiments on the 7-Scenes dataset yielded several critical insights:
- The Accuracy-Pose Disconnect: A deep CNN (D-NET) achieved a 45.3% inlier rate for scene coordinates, far surpassing the 18.3% of the RF. However, the D-NET's final camera pose error (4.6cm / 2.1°) was actually higher than the RF's.
- RANSAC as the Equalizer: The robustness of the RANSAC optimizer means it only requires a small set of accurate correspondences to find the correct pose. The massive volume of accurate predictions from the deep NN is largely redundant for the final pose calculation.
- Efficiency Wins: The optimized RF with post-hoc geometric median averaging (RF2-pGM) outperformed the previous state-of-the-art by 9.3% in pose accuracy while maintaining a tiny memory footprint (~250MB) and extremely fast inference (5-10ms).
Conclusion
While deep learning excels at many computer vision tasks, the specific constraints and downstream processing of camera localization favor the efficiency of Random Forests. ForestNets provide a valuable bridge, allowing for the optimization benefits of neural networks while preserving the deployment advantages of forests. Future work involving differentiable RANSAC modules may eventually allow NNs to overcome the current bottleneck and leverage their superior regression capabilities more effectively.
Summary updated