Skip to content

The repo for "Distill Any Depth: Distillation Creates a Stronger Monocular Depth Estimator"

License

Notifications You must be signed in to change notification settings

Westlake-AGI-Lab/Distill-Any-Depth

Repository files navigation

Distill Any Depth: Distillation Creates a Stronger Monocular Depth Estimator

Xiankang He1*,2 · Dongyan Guo1* · Hongji Li2,3
Ruibo Li4 · Ying Cui1 · Chi Zhang2✉

1ZJUT   2WestLake University   3LZU   4NTU
✉ Corresponding author
*Equal Contribution. This work was done while Xiankang He was visiting Westlake University.

Paper PDF Project Page

PWC PWC PWC

We present Distill-Any-Depth, a new SOTA monocular depth estimation model trained with our proposed knowledge distillation algorithms. Models with various seizes are available in this repo.

teaser

News

  • 2025-02-26:🔥🔥🔥 Paper, project page, code, models, and demos are released.

TODO

  • Release training code.
  • Release additional models in various sizes.

Pre-trained Models

We provide two models of varying scales for robust relative depth estimation:

Model Architecture Params Checkpoint
Distill-Any-Depth-Multi-Teacher-Base Dav2-base 97.5M Download
Distill-Any-Depth-Multi-Teacher-Large Dav2-large 335.3M Download

Getting Started

We recommend setting up a virtual environment to ensure package compatibility. You can use miniconda to set up the environment. The following steps show how to create and activate the environment, and install dependencies:

# Create a new conda environment with Python 3.10
conda create -n distill-any-depth -y python=3.10

# Activate the created environment
conda activate distill-any-depth

# Install the required Python packages
pip install -r requirements.txt

# Navigate to the Detectron2 directory and install it
cd detectron2
pip install -e .

cd ..
pip install -e .

To download pre-trained checkpoints follow the code snippet below:

Running from commandline

We provide a helper script to run the model on a single image directly:

# Run prediction on a single image using the helper script
source scripts/00_infer.sh
# you should download the pretrained model and input the path on the '--checkpoint'

# Define the GPU ID and models you wish to run
GPU_ID=0
model_list=('xxx')  # List of models you want to test

# Loop through each model and run inference
for model in "${model_list[@]}"; do
    # Run the model inference with specified parameters
    CUDA_VISIBLE_DEVICES=${GPU_ID} \
    python tools/testers/infer.py \
        --seed 1234 \  # Set random seed for reproducibility
        --checkpoint 'checkpoint/large/model.safetensors' \  # Path to the pre-trained model checkpoint
        --processing_res 0 \  # Resolution for processing (0 to keep original resolution)
        --output_dir output/${model} \  # Directory to save the output results
        --arch_name 'depthanything-large' \  # Model architecture name (must match the pre-trained model)
done

More Results

teaser

Citation

If you find our work useful, please cite the following paper:

@article{he2025distill,
  title   = {Distill Any Depth: Distillation Creates a Stronger Monocular Depth Estimator},
  author  = {Xiankang He and Dongyan Guo and Hongji Li and Ruibo Li and Ying Cui and Chi Zhang},
  year    = {2025},
  journal = {arXiv preprint arXiv: 2502.19204}
}

Related Projects

License

This sample code is released under the MIT license. See LICENSE for more details.

About

The repo for "Distill Any Depth: Distillation Creates a Stronger Monocular Depth Estimator"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published