Introduction
Monocular Depth Estimation (MDE)—the task of predicting distance from a single RGB image—is a foundational component for mobile robotics, augmented reality, and autonomous driving. While Vision Transformers (ViTs) have recently surpassed traditional Convolutional Neural Networks (CNNs) in accuracy due to their ability to capture long-range global context, their high computational cost typically precludes real-time deployment on edge devices.
This paper introduces the Token-Sharing Transformer (TST), a novel architecture designed to bridge the gap between high-accuracy Transformer models and the strict latency requirements of resource-constrained hardware like the NVIDIA Jetson Nano and TX2.
The Computational Bottleneck in MDE
Existing lightweight Transformer architectures for MDE generally follow one of two suboptimal design patterns:
- Hierarchy-focused designs: These process features at multiple resolutions to maintain spatial detail. While accurate, they are computationally expensive because they perform repetitive self-attention operations at every level of the feature hierarchy.
- Bottleneck-focused designs: These apply attention only to the lowest-resolution features to save power. While fast, they often lose the fine-grained details necessary for producing crisp, high-fidelity depth maps.
The TST architecture aims to provide the multi-level intelligence of a hierarchical model with the efficiency of a bottleneck design.
The Token-Sharing Transformer (TST) Architecture
The core innovation of this work is the TST module, which replaces standard self-attention with a more efficient cross-attention mechanism centered around a "Global Token."
Global Token Extraction and Sharing
The model utilizes a lightweight CNN encoder to extract multi-scale features. The highest-level feature (the lowest resolution) is designated as the Global Token, representing the overall context of the scene. Instead of recalculating global relationships at every resolution, this single Global Token is shared across multiple Transformer blocks throughout the decoder.
Efficient Cross-Attention
In each TST block, "Local Tokens" (finer-grained features from shallower layers) act as the Query, while the Shared Global Token acts as the Key and Value. This allows the model to "inject" global scene information into local features without the quadratic computational explosion associated with full self-attention (where every pixel must attend to every other pixel). This asymmetric relationship ensures that the model maintains a global perspective while refining local depth boundaries efficiently.
Hardware-Aware Optimization
To maximize throughput on embedded hardware, the authors optimized the model for inference engines like TensorRT. Standard Transformer components such as Layer Normalization and the GELU activation function—which can be slow on specialized edge hardware—were replaced with Batch Normalization and ReLU6. These primitives are highly optimized for mobile and embedded GPUs, significantly reducing latency without sacrificing accuracy.
Experimental Evaluation
The TST model was evaluated on two industry-standard benchmarks: NYU Depth V2 (indoor scenes) and KITTI (outdoor driving scenes).
Accuracy and Efficiency
On the NYU Depth V2 dataset, TST achieved an RMSE (Root Mean Square Error) of 0.447. This outperforms established models like GuidedDepth (0.449) while utilizing significantly fewer resources. Specifically, TST requires only 1.8M parameters, roughly one-third of the 5.8M parameters used by GuidedDepth.
Real-Time Performance on the Edge
The model's primary strength is its throughput on NVIDIA Jetson platforms:
- Jetson TX2: At a resolution of 480x640, TST achieved 43.8 FPS. A smaller variant, TST-S, reached 48.5 FPS at full resolution and an impressive 142.6 FPS at half-resolution.
- Jetson Nano: On this ultra-low-power device, TST-S maintained a usable 18.9 FPS at full resolution, demonstrating that high-quality, real-time depth estimation is feasible even on entry-level hardware.
Conclusion
The Token-Sharing Transformer demonstrates that global context in MDE does not require exhaustive self-attention at every scale. By broadcasting a shared global token to local feature maps, TST achieves a superior trade-off between error and throughput. This architecture provides a viable path for deploying sophisticated Transformer-based vision models on the edge, enabling more capable and responsive autonomous systems.
Summary updated