Abstract
Random Forests (RF) are widely used in computer vision for pixel labeling due to their efficiency and scalability. However, they typically treat pixels as independent samples, leading to spatially incoherent results characterized by "salt-and-pepper" noise. This paper introduces Spatially Coherent Random Forests (SCRF), which integrate spatial awareness directly into the tree-splitting process. By incorporating a spatial regularization term into the node optimization objective, SCRF achieves smoother segmentations and a 10% performance improvement in contour detection on standard benchmarks without requiring expensive post-processing.
Introduction
In traditional computer vision pipelines, Random Forests serve as efficient classifiers that split data based on local appearance features. A significant drawback of this approach is the lack of spatial context; the model does not account for the relative positions of pixels. Consequently, the resulting label maps often appear jagged and noisy. To mitigate this, researchers frequently employ post-processing techniques such as Markov Random Fields (MRF) or Conditional Random Fields (CRF). While effective at smoothing results, these methods add significant computational complexity and latency.
SCRF addresses this "blind spot" by modifying the forest's training phase. Instead of relying on post-hoc smoothing, the model is incentivized to find splits that are spatially consistent from the outset.
Methodology: Baking in Spatial Coherency
The core innovation of SCRF is a modified objective function used during the training of each decision tree node. In a standard RF, a node selects a split function $f$ to maximize Information Gain ($I_n$). SCRF introduces a Spatial Coherency Term ($C_n$), resulting in a new objective:
$$G_n(f) = I_n(f) + \lambda \cdot \sum_{p \in n} C_n(f, p)$$
The term $C_n$ evaluates a small local window (e.g., $9 \times 9$) around each pixel $p$. It measures the proportion of neighboring pixels assigned to the same child node as $p$. A split that bisects a local neighborhood receives a lower coherency score, while a split that keeps local structures together is rewarded. This acts as a spatial prior, forcing the forest to prefer contiguous regions.
To further enhance contour detection, the authors utilize a hierarchical mapping approach. Rather than relying solely on leaf nodes, boundaries are extracted at every level of the tree. Splits occurring near the root—representing global structures—are weighted more heavily than those in deeper leaves, which often correspond to fine textures.
Experimental Results
The SCRF framework was evaluated on the Berkeley Segmentation Datasets (BSD300 and BSD500), which consist of natural images with human-annotated boundaries.
Performance Gains
On the BSD500 benchmark, SCRF achieved an F-measure (ODS) of 0.60, a notable improvement over the 0.55 achieved by standard Random Forests. This 10% gain highlights the effectiveness of integrating spatial constraints directly into the learning process. Qualitatively, the resulting contour maps are significantly cleaner and more aligned with human perception, successfully ignoring high-frequency noise that typically degrades pixel-wise classifiers.
The Role of Regularization
The parameter $\lambda$ serves as a crucial tuning knob for the model's "smoothness." When $\lambda = 0$, the model reverts to a standard RF. As $\lambda$ increases, the forest is increasingly penalized for spatially incoherent splits.
As shown in the performance analysis, there is an optimal range for $\lambda$ where the balance between appearance-based information gain and spatial consistency yields the best results. Beyond this point, excessive regularization may lead to over-smoothing, potentially obscuring valid boundaries.
Conclusion and Future Work
Spatially Coherent Random Forests provide a streamlined alternative to complex post-processing frameworks. By utilizing integral images, the spatial coherency term can be calculated in $O(1)$ time, maintaining the efficiency that makes Random Forests attractive for real-time applications.
While SCRF shows robust performance, it can face challenges in regions with high-contrast, repetitive textures where the spatial prior might inadvertently smooth over actual edges. Future research could explore integrating more sophisticated local features into the split functions to further improve discriminative power in complex scenes.
Summary updated