Skip to content

Latest commit

 

History

History
104 lines (67 loc) · 3.51 KB

README.md

File metadata and controls

104 lines (67 loc) · 3.51 KB

DepthAnything-ROS

DepthAnything-ROS is a ROS2 wrapper for Depth-Anything.

nuscenes_demo.mp4

Environment

  • Ubuntu 22.04.01, ROS2 Humble
  • CUDA 12.3, cuDNN 8.9.5.29-1+cuda12.2, TensorRT 8.6.1.6-1+cuda12.0

Get Started

Set Up the Environment

    1. Install ROS2

See the ROS2 installation documentation for detailed instructions. To install ROS2 easily, I recommend using the Ansible script from Autoware. For more details, refer to the installation guide.

    1. Install dependencies
sudo apt install libgflags-dev libboost-all-dev
    1. Prepare your rosbag

If you don't have a rosbag, I recommend using rosbag for Nuscenes dataset.

  • Set ONNX Files

Place the ONNX files in the DepthAnything-ROS/data directory, or set the onnx_path parameter in the launch file.

<arg name="onnx_path" default="$(find-pkg-share depth_anything)/data/depth_anything_vitb14.onnx" />

To download the ONNX files for the pre-trained model, run the following commands:

# Install gdown
pip install gdown

# Download ONNX file
mkdir -p data && cd data
gdown 1jFTCJv0uJovPAww9PHCYAoek-KfeajK_

If you prefer to create the ONNX files yourself, you can use depth-anything-tensorrt.

Launch the node

ros2 launch depth_anything depth_anything.launch.xml

Interface

Input

  • input/image (sensor_msgs::msg::Image)
    • The input image.

Output

  • ~/output/depth_image (sensor_msgs::msg::Image)
    • The depth image generated by DepthAnything.

Parameters

  • onnx_path (string)
    • Default: $(find-pkg-share depth_anything)/data/depth_anything_vitb14.onnx
    • The path to the ONNX file.
  • precision (string)
    • Default: "fp32"
    • The precision mode to use for quantization. DepthAnything-ROS supports "fp32" or "fp16" (#2).

Notes

Building the TensorRT Engine

The first time you run the system, you may need to wait for about 5 minutes for the build process to complete.

Performance

  • Performance data is based on results from an RTX4090 and RTX2070.
Model Params RTX4090 TensorRT RTX2070 TensorRT
Depth-Anything-Small 24.8M 3 ms 27 ms, VRAM 300MB
Depth-Anything-Base 97.5M 6 ms 65 ms, VRAM 700MB
Depth-Anything-Large 335.3M 12 ms 200 ms, VRAM 1750MB

References