flexdepth / README.md
StarNew's picture
Update README.md
60983a4 verified
|
Raw
History Blame Contribute Delete
6.98 kB
---
license: mit
tags:
- monocular-depth-estimation
- self-supervised
- autonomous-driving
- yolo
- pytorch
- kitti
- cityscapes
library_name: pytorch
pipeline_tag: depth-estimation
---
**Towards Robust Driving Perception: A Flexible Scale-Driven Family for Self-Supervised Monocular Depth Estimation**
[![ECCV 2026](https://img.shields.io/badge/ECCV-2026-4F70F2?style=flat-square)](https://eccv.ecva.net/)
[![arXiv](https://img.shields.io/badge/arXiv-2607.00736-b31b1b?style=flat-square)](https://arxiv.org/abs/2607.00736)
[![Project Page](https://img.shields.io/badge/Project-Page-4F70F2?style=flat-square)](https://startnew.github.io/projects/flexdepth/)
[![Code](https://img.shields.io/badge/GitHub-Code-181717?style=flat-square)](https://github.com/StarNew/FlexDepth)
## Overview
FlexDepth is a family of self-supervised monocular depth estimation models designed for robust driving perception. It introduces a **Scale-Driven Decoder (SDD)** with adaptive component selection, enabling a single architecture to span five model scales β€” from ultra-lightweight (1.5M params, 0.7 GFLOPs) to high-accuracy (32.3M params, 24.6 GFLOPs).
### Key Features
- **Five model scales**: Nano (N), Small (S), Medium (M), Large (L), X-Large (X)
- **Scale-Driven Decoder (SDD)**: Adaptive component selection based on model scale
- **High-Efficiency Bottleneck (HEB)**: For small models (N, S) β€” maximizes efficiency
- **High-Performance Bottleneck (HPB)**: For large models (M, L, X) β€” maximizes accuracy
- **Dynamic upsampling**: Sharper depth boundaries via learned upsampling
- **Two-stage static-dynamic decoupled training**: Handles dynamic scenes in driving scenarios
- **YOLO11-based encoder**: Leverages rich visual representations from YOLO segmentation pretraining
## Model Zoo
### KITTI-trained Models
| Model | Params | GFLOPs | Abs Rel ↓ | Sq Rel ↓ | RMSE ↓ | RMSE log ↓ | Ξ΄<1.25 ↑ | Ξ΄<1.25Β² ↑ | Ξ΄<1.25Β³ ↑ |
|-------|--------|--------|-----------|----------|--------|------------|----------|-----------|-----------|
| Flex-Nano | 1.5M | 0.7 | 0.110 | 0.794 | 4.678 | 0.184 | 0.878 | 0.961 | 0.983 |
| Flex-Small | 6.1M | 2.8 | 0.104 | 0.713 | 4.458 | 0.179 | 0.890 | 0.964 | 0.983 |
| Flex-Medium | 12.7M | 10.0 | 0.096 | 0.639 | 4.253 | 0.172 | 0.903 | 0.968 | 0.985 |
| Flex-Large | 15.2M | 11.5 | 0.095 | 0.642 | 4.199 | 0.171 | 0.906 | 0.968 | 0.984 |
| Flex-X-Large | 32.3M | 24.6 | **0.093** | **0.605** | **4.114** | **0.167** | **0.910** | **0.969** | **0.985** |
### Cityscapes-trained Models
| Model | Params | GFLOPs | Abs Rel ↓ | Sq Rel ↓ | RMSE ↓ | RMSE log ↓ | Ξ΄<1.25 ↑ | Ξ΄<1.25Β² ↑ | Ξ΄<1.25Β³ ↑ |
|-------|--------|--------|-----------|----------|--------|------------|----------|-----------|-----------|
| Flex-Nano | 1.5M | 0.6 | 0.107 | 1.261 | 6.133 | 0.164 | 0.893 | 0.971 | 0.989 |
| Flex-Small | 6.1M | 2.2 | 0.100 | 1.078 | 5.813 | 0.153 | 0.904 | 0.975 | 0.991 |
| Flex-Medium | 12.7M | 8.0 | 0.089 | 0.885 | 5.358 | 0.143 | 0.917 | 0.979 | 0.993 |
| Flex-Large | 15.2M | 9.2 | 0.087 | 0.911 | 5.310 | 0.139 | 0.924 | 0.981 | 0.993 |
| Flex-X-Large | 32.3M | 19.7 | **0.086** | **0.877** | **5.268** | **0.137** | **0.926** | **0.982** | **0.993** |
### Efficiency
| Model | FPS (Snapdragon 8 Elite)(bs 1) | FPS (RTX 2080 Ti)(bs 16) |
|-------|--------------------------|---------------------|
| Flex-Nano | 37.6 | 547 |
| Flex-Small | 18.6 | 487 |
| Flex-Medium | 5.8 | 160 |
| Flex-Large | 5.2 | 153 |
| Flex-X-Large | 3.0 | 98 |
## Model Files
Each model consists of two weight files:
```
β”œβ”€β”€ kitti/
β”‚ β”œβ”€β”€ flex_n/
β”‚ β”‚ β”œβ”€β”€ encoder.pth # YOLO11-based encoder weights
β”‚ β”‚ └── depth.pth # Scale-Driven Decoder weights
β”‚ β”œβ”€β”€ flex_s/
β”‚ β”œβ”€β”€ flex_m/
β”‚ β”œβ”€β”€ flex_l/
β”‚ └── flex_x/
└── cs/
β”œβ”€β”€ flex_n/
β”œβ”€β”€ flex_s/
β”œβ”€β”€ flex_m/
β”œβ”€β”€ flex_l/
└── flex_x/
```
## Usage
### Installation
```bash
conda create -n flexdepth python=3.10
conda activate flexdepth
pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu118
pip install -r requirements.txt
```
### Download Weights
```python
from huggingface_hub import snapshot_download
# Download all models
snapshot_download(repo_id="StarNew/flexdepth", local_dir="./models")
# Or download a specific model
from huggingface_hub import hf_hub_download
hf_hub_download(
repo_id="StarNew/flexdepth",
filename="kitti/flex_n/encoder.pth",
local_dir="./models"
)
hf_hub_download(
repo_id="StarNew/flexdepth",
filename="kitti/flex_n/depth.pth",
local_dir="./models"
)
```
### Evaluation
```bash
# Flex-Nano on KITTI
python evaluate_depth.py --png --eval_mono --scale 4 \
--encoder_model_type yolo11n-seg --decoder_model_type flexn \
--load_weights_folder ./models/kitti/flex_n \
--data_path <kitti_data_path> --split_path <splits_path>
# Flex-X-Large on KITTI
python evaluate_depth.py --png --eval_mono --scale 4 \
--encoder_model_type yolo11x-seg --decoder_model_type flexx \
--load_weights_folder ./models/kitti/flex_x \
--data_path <kitti_data_path> --split_path <splits_path>
```
### ONNX Export
```bash
python export_onnx.py --encoder_model_type yolo11n-seg --decoder_model_type flexn \
--load_weights_folder ./models/kitti/flex_n --scales 4 --export_name flex-n
```
## Comparison with Depth Anything V2
On the KITTI Eigen benchmark with dense ground truth and least-squares alignment:
| Method | Type | Params | GFLOPs | Resolution | Abs Rel ↓ | Ξ΄<1.25 ↑ |
|--------|------|--------|--------|------------|-----------|----------|
| DA2 (ViT-L) | Zero-Shot | 335M | 1947 | 1722Γ—518 | 0.070 | **0.956** |
| DA2 (ViT-S) | Zero-Shot | 25M | 137 | 1722Γ—518 | 0.077 | 0.944 |
| DA2 (ViT-L) | Zero-Shot | 335M | 276 | 644Γ—196 | 0.092 | 0.915 |
| DA2 (ViT-S) | Zero-Shot | 25M | 19 | 644Γ—196 | 0.110 | 0.881 |
| **Flex-X-Large** | Self-Supervised | 32M | 25 | 640Γ—192 | **0.063** | 0.952 |
FlexDepth achieves comparable or better accuracy than Depth Anything V2 with **~13Γ— fewer parameters** and **~78Γ— fewer GFLOPs** at similar resolution.
## Citation
```bibtex
@misc{zhu2026robustdrivingperceptionflexible,
title={Towards Robust Driving Perception: A Flexible Scale-Driven Family for Self-Supervised Monocular Depth Estimation},
author={Zhaowen Zhu and Li Zhang and Yujie Chen and Tian Zhang and Yingjie Wang and Mingxia Zhan},
year={2026},
eprint={2607.00736},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2607.00736}
}
```
## Acknowledgment
This work is supported by the National Natural Science Foundation of China under Grant 62332016.
Our code is built upon [Monodepth2](https://github.com/nianticlabs/monodepth2), [Manydepth](https://github.com/nianticlabs/manydepth), and [Ultralytics](https://github.com/ultralytics/ultralytics).