DepthAnything-ROS is a ROS2 wrapper for Depth-Anything.
nuscenes_demo.mp4
- 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
-
- 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.
-
- Install dependencies
sudo apt install libgflags-dev libboost-all-dev-
- 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.
ros2 launch depth_anything depth_anything.launch.xmlinput/image(sensor_msgs::msg::Image)- The input image.
~/output/depth_image(sensor_msgs::msg::Image)- The depth image generated by DepthAnything.
onnx_path(string)- Default:
$(find-pkg-share depth_anything)/data/depth_anything_vitb14.onnx - The path to the ONNX file.
- Default:
precision(string)- Default:
"fp32" - The precision mode to use for quantization. DepthAnything-ROS supports
"fp32"or"fp16"(#2).
- Default:
The first time you run the system, you may need to wait for about 5 minutes for the build process to complete.
- 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 |
- Depth-Anything
- trt-depth-anything – Use for TensorRT inference
- depth-anything-tensorrt – Use for converting from PTH files to ONNX files
- tensorrt_common – Utility library
- cuda_utils – Utility library
- gdown – Tool for downloading files from Google Drive