Abstract
Neural networks have demonstrated great success; however, large amounts of labeled data are usually required for training the networks. In this work, a framework for analyzing the road and traffic situations for cyclists and pedestrians is presented, which only requires very few labeled examples. We address this problem by combining convolutional neural networks and random forests, transforming the random forest into a neural network, and generating a fully convolutional network for detecting objects. Because existing methods for transforming random forests into neural networks propose a direct mapping and produce inefficient architectures, we present neural random forest imitation—an imitation learning approach by generating training data from a random forest and learning a neural network that imitates its behavior. This implicit transformation creates very efficient neural networks that learn the decision boundaries of a random forest. The generated model is differentiable, can be used as a warm start for fine-tuning, and enables end-to-end optimization. Experiments on several real-world benchmark datasets demonstrate superior performance, especially when training with very few training examples. Compared to state-of-the-art methods, we significantly reduce the number of network parameters while achieving the same or even improved accuracy due to better generalization.
Introduction
Deep learning models, particularly Convolutional Neural Networks (CNNs), have revolutionized computer vision. However, their performance is heavily dependent on the availability of large-scale labeled datasets. In specialized domains like urban traffic analysis for cyclists and pedestrians, obtaining such data is often prohibitively expensive or logistically challenging.
Random Forests (RFs) offer a robust alternative for small-data regimes, providing excellent generalization without the need for massive datasets. Yet, RFs are non-differentiable, preventing their integration into end-to-end deep learning pipelines. Previous attempts to bridge this gap via direct mapping—where tree nodes are converted into neurons—result in "parameter explosion," creating unwieldy architectures that scale poorly with tree depth.
Neural Random Forest Imitation (NRFI)
To overcome these limitations, we propose Neural Random Forest Imitation (NRFI). Rather than attempting a structural replication of the forest, NRFI focuses on functional imitation. The process involves training a Random Forest on features extracted by a CNN backbone and then distilling the forest's decision boundaries into a compact Multi-Layer Perceptron (MLP).
The core of NRFI is a novel data generation algorithm. By traversing the trained RF trees, the authors sample synthetic feature values that represent the forest's decision space. A small MLP is then trained on this synthetic data to mimic the RF's behavior. This approach ensures the resulting network is both differentiable and highly efficient, avoiding the overhead of direct mapping. This implicit transformation creates models that learn the decision boundaries of the forest while remaining differentiable for end-to-end optimization.
Experimental Setup and Datasets
The framework was evaluated using the COVMAP Dataset, which consists of 56,000 images collected from smartphones mounted on bicycles across several European cities, including Hanover, Enschede, and Heidelberg. The dataset focuses on traffic signs and infrastructure critical for non-motorized transport.
In addition to COVMAP, the method was validated on nine standard UCI classification benchmarks (such as Car, Covertype, and Iris) to demonstrate its generalizability across different data types. For initial representation learning, the German Traffic Sign Recognition Benchmark (GTSRB) was utilized.
Key Results and Discussion
NRFI achieves remarkable parameter efficiency. Compared to existing state-of-the-art mapping techniques, NRFI reduces the number of parameters by over 99%—in one instance, reducing a model from approximately 980,000 parameters to just 2,676. This represents a 360x reduction in model size while maintaining or exceeding accuracy.
This efficiency is particularly evident in low-data scenarios. In tests with only 5 to 20 training samples per class, NRFI-trained models consistently outperformed standard RFs, Support Vector Machines (SVMs), and vanilla NNs. Furthermore, because the resulting model is a standard neural network, it can be used as a "warm start" for further fine-tuning via backpropagation, enabling the end-to-end optimization of the entire vision pipeline.
Conclusion
NRFI successfully fuses the small-data robustness of Random Forests with the architectural flexibility of Deep Learning. By shifting from structural to functional imitation, the framework creates compact, differentiable models that excel in data-scarce environments. Future work may explore the application of this framework to regression tasks and deeper integration with real-time object detection systems.
Summary updated