Sigmoidal
  • Home
  • LinkedIn
  • About me
  • Contact
No Result
View All Result
  • Português
  • Home
  • LinkedIn
  • About me
  • Contact
No Result
View All Result
Sigmoidal
No Result
View All Result

Depth Estimation on Single Camera with Depth Anything

Carlos Melo by Carlos Melo
February 23, 2024
in Blog, Computer Vision, Featured, Posts
0
85
SHARES
2.8k
VIEWS
Share on LinkedInShare on FacebookShare on Whatsapp

Monocular Depth Estimation is a Computer Vision task that involves predicting the depth information of a scene, that is, the relative distance from the camera of each pixel, given a single RGB image. This challenging task is a key prerequisite for scene understanding for applications such as 3D scene reconstruction, robotics, Spatial Computing (Apple Vision Pro and Quest 3), and autonomous navigation.

 

Depth Anything - Monocular Depth Estimation
Example of a depth map I generated using Depth Anything.

While various approaches have been developed for depth estimation, Depth Anything represents today a significant advancement in the field of monocular depth perception. In this article, we will explore some of the theoretical foundations of monocular depth perception, and we will clone the Depth Anything repository to conduct our own tests in a local development environment.

Monocular Depth Perception

Depth perception is what allows us to interpret the three-dimensional world from two-dimensional images projected on our retinas. This ability evolved as a crucial aspect for survival, enabling humans to navigate the environment, avoid predators, and locate resources.

The human brain accomplishes this feat through a series of interpretations of visual information, where the overlap of the binocular visual field provides a rich perception of depth.

In addition to binocular vision, this perception is enriched by various monocular cues (depth cues), elements in the environment that allow a single observer to infer depth even with one eye closed. Among these cues are occlusion, relative size, cast shadows, and linear perspective.

These same principles and mechanisms of perception find a parallel in Computer Vision, where the essence of estimation also lies in capturing the spatial structure of a scene to accurately represent its three-dimensional aspects.

Depth Anything for Depth Estimation

The Depth Anything model, introduced in the work “Depth Anything: Unleashing the Power of Large-Scale Unlabeled Data”, represents a significant advancement in monocular depth estimation. Based on the DPT (Dense Prediction Transformer) architecture, it was trained on a vast dataset of over 62 million unlabeled images.

YANG, Lihe et al. Depth anything: Unleashing the power of large-scale unlabeled data. 2024.

The success of this approach is attributed to two main strategies.

  1. The use of data augmentation tools to establish a more challenging optimization target.
  2. Use of auxiliary supervision to ensure the inheritance of semantic priors from pre-trained encoders.

The generalization capability of Depth Anything, tested on six public datasets and randomly captured photographs, surpassed some metrics of existing models, such as MiDaS v3.1 and ZoeDepth.

If you want to delve deeper into the materials and methods used in the research, access the original article at this link.

Depth anything: Unleashing the power of large-scale unlabeled data
Depth Anything framework, where a standard pipeline was adopted to increase the model’s power over unlabeled images.

Setting Up the Environment for “Depth Anything”

To start using Depth Anything for monocular depth estimation, it’s necessary to prepare your development environment by following some simple steps. Make sure you have Poetry installed.

To clone the repository and install dependencies, follow the steps described below:

1. Clone the Repository: First, clone the project repository using the command in the terminal:

git clone https://github.com/LiheYoung/Depth-Anything.git

2. Access the Project Directory: Next, access the project directory:

cd Depth-Anything

3. Initialize the Environment with Poetry: If it’s your first time using Poetry on this project, initialize the environment:

poetry init

4. Activate the Virtual Environment: Activate the virtual environment created by Poetry:

poetry shell

5. Install Dependencies: Install the necessary dependencies, including Gradio, PyTorch, torchvision, opencv-python, and huggingface_hub:

poetry add gradio==4.14.0 torch torchvision opencv-python huggingface_hub

6. Run the Application: Run the application using Streamlit with the command:

python app.py

With the Streamlit app running, you can upload your photos directly through the UI. If you have any difficulties installing the dependencies on your computer, you can also test Depth Anything in this official demo.

The app works only for static images. To generate depth maps from videos, execute the command below in your Terminal. As this process is costly in terms of processing, I recommend that you start your tests with short videos, between 3 and 10 seconds.

python run_video.py --encoder vitl --video-path /path/to/your/video.mov --outdir /path/to/save

Takeaways

  • Essence of Monocular Depth Perception: Monocular depth estimation is crucial for understanding the spatial structure of a scene from a single image, enabling applications such as 3D scene reconstruction.
  • Advancements with Depth Anything: Representing a significant leap in monocular depth perception, the Depth Anything model utilizes the DPT architecture and was trained on an extensive dataset, showing excellent generalization capability.
  • Environment Setup: A step-by-step guide to setting up the development environment to use Depth Anything, including installing dependencies and running applications for practical tests.
  • Practical Application: The article provides detailed instructions for testing depth estimation with images and videos, facilitating practical experimentation and visualization of the Depth Anything model’s results.
Share6Share34Send
Previous Post

Point Cloud Processing with Open3D and Python

Next Post

YOLOv9: A Step-by-Step Tutorial for Object Detection

Carlos Melo

Carlos Melo

Computer Vision Engineer with a degree in Aeronautical Sciences from the Air Force Academy (AFA), Master in Aerospace Engineering from the Technological Institute of Aeronautics (ITA), and founder of Sigmoidal.

Related Posts

Urban YOLO26 scene with one bus and four pedestrians, each outlined once to represent end-to-end object detection
Computer Vision

YOLO26: What Changed in Object Detection

by Carlos Melo
August 28, 2026
Follower drone using a four-microphone array to estimate bearing and range from the natural propeller sound of a leader drone
Aerospace Engineering

SonicFly: How Drones Pursue Each Other by Sound

by Carlos Melo
August 21, 2026
Urban intersection in which a DETR-style detector assigns one prediction box to each pedestrian, cyclist, vehicle, bus, and traffic light
Computer Vision

DETR: Object Detection as Set Prediction

by Carlos Melo
August 20, 2026
Industrial data pipeline with English-labeled stages for scaling, imputation, encoding, and modeling
Machine Learning

Scikit-Learn Pipelines: Prevent Data Leakage

by Carlos Melo
July 6, 2026
Probability surface and linear decision boundary learned by logistic regression on two overlapping classes
Data Science

Binary Cross-Entropy and Logistic Regression

by Carlos Melo
June 1, 2026
Next Post
YOLOv9 para detecção de Objetos

YOLOv9: A Step-by-Step Tutorial for Object Detection

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Trending
  • Comments
  • Latest

Real-time Human Pose Estimation using MediaPipe

September 11, 2023
ORB-SLAM 3: A Tool for 3D Mapping and Localization

ORB-SLAM 3: A Tool for 3D Mapping and Localization

April 10, 2024

Build a Surveillance System with Computer Vision and Deep Learning

1
ORB-SLAM 3: A Tool for 3D Mapping and Localization

ORB-SLAM 3: A Tool for 3D Mapping and Localization

1
Point Cloud Processing with Open3D and Python

Point Cloud Processing with Open3D and Python

1

Fundamentals of Image Formation

0
Urban YOLO26 scene with one bus and four pedestrians, each outlined once to represent end-to-end object detection

YOLO26: What Changed in Object Detection

August 28, 2026
Follower drone using a four-microphone array to estimate bearing and range from the natural propeller sound of a leader drone

SonicFly: How Drones Pursue Each Other by Sound

August 21, 2026
Urban intersection in which a DETR-style detector assigns one prediction box to each pedestrian, cyclist, vehicle, bus, and traffic light

DETR: Object Detection as Set Prediction

August 20, 2026
Industrial data pipeline with English-labeled stages for scaling, imputation, encoding, and modeling

Scikit-Learn Pipelines: Prevent Data Leakage

July 6, 2026
Instagram Youtube LinkedIn Twitter
Sigmoidal

O melhor conteúdo técnico de Data Science, com projetos práticos e exemplos do mundo real.

Seguir no Instagram

Categories

  • Aerospace Engineering
  • Blog
  • Carreira
  • Computer Vision
  • Data Science
  • Deep Learning
  • Featured
  • Iniciantes
  • Machine Learning
  • Posts
  • Tutoriais
  • tutorials

Navegar por Tags

3d 3d machine learning 3d vision bayer filter camera calibration clahe computer vision custom dataset data science deep learning depth anything depth estimation digital image processing fine-tuning grad-cam histogram histogram equalization image formation job lens machine learning machine learning engineering mediapipe object detection open3d opencv python pytorch quantization redes neurais resnet roboflow rocket sampling scikit-learn space tensorflow transfer-learning transformer tutorial vision-transformer visão computacional vit yolov8 yolov9

© 2024 Sigmoidal - Aprenda Data Science, Visão Computacional e Python na prática.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In

Add New Playlist

No Result
View All Result
  • Home
  • Mentoria
  • Cursos
  • Blog
  • Sobre Mim
  • Contato
  • Português

© 2024 Sigmoidal - Aprenda Data Science, Visão Computacional e Python na prática.