### Backend Authentication Example Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Example of setting a persistent API key via environment variable and starting the backend with network-wide access. ```bash export DA3_BACKEND_API_KEY=$(openssl rand -hex 32) # or any secret string you prefer da3 backend --host 0.0.0.0 --model-dir depth-anything/DA3NESTED-GIANT-LARGE ``` -------------------------------- ### Image Mode Usage Examples Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Examples for basic image processing, backend acceleration, and feature visualization. ```bash # âœĻ Basic usage da3 image path/to/image.png --export-dir ./output # ⚡ With backend acceleration da3 image path/to/image.png \ --use-backend \ --backend-url http://localhost:8008 \ --export-dir ./output # 🔍 Export feature visualization da3 image image.jpg \ --export-format feat_vis \ --export-feat "9,19,29,39" \ --export-dir ./results ``` -------------------------------- ### Install HuggingFace CLI Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/BENCHMARK.md Install the HuggingFace CLI tool, which is required for downloading benchmark datasets. ```bash pip install -U huggingface_hub[cli] ``` -------------------------------- ### Launch Gallery Server Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Basic command to start the Depth Anything 3 gallery server. ```bash da3 gallery [OPTIONS] ``` -------------------------------- ### Auto Mode Usage Examples Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Examples for processing images, videos, and utilizing backend services in auto mode. ```bash # 🖞ïļ Auto-process an image da3 auto path/to/image.jpg --export-dir ./output # 🎎 Auto-process a video da3 auto path/to/video.mp4 --fps 2.0 --export-dir ./output # 🔧 Use backend service da3 auto path/to/input \ --export-format mini_npz-glb \ --use-backend \ --backend-url http://localhost:8008 \ --export-dir ./output ``` -------------------------------- ### Install Depth Anything 3 and Dependencies Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/README.md Installs the core library, PyTorch, xformers, and optional dependencies for Gradio UI or full features. Ensure PyTorch version is compatible. ```bash pip install xformers torch>=2 torchvision pip install -e . # Basic pip install --no-build-isolation git+https://github.com/nerfstudio-project/gsplat.git@0b4dddf04cb687367602c01196913cde6a743d70 # for gaussian head pip install -e "[app]" # Gradio, python>=3.10 pip install -e "[all]" # ALL ``` -------------------------------- ### Install Depth Anything 3 Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/notebooks/da3.ipynb Installs the required depth-anything-3 package. Run this command in your environment before proceeding. ```python # Install required packages # !pip install depth-anything-3 ``` -------------------------------- ### Start Backend Service Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Basic command to launch the backend service with a specified model directory. ```bash da3 backend [OPTIONS] ``` ```bash da3 backend --model-dir depth-anything/DA3NESTED-GIANT-LARGE ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/da3_streaming/README.md Install the necessary Python dependencies for Depth Anything 3 by running pip with the requirements file. ```bash pip install -r requirements.txt ``` -------------------------------- ### Start Backend and Process Data with CLI Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Commands to initialize the backend service and perform inference using local or backend-assisted modes. ```bash # 🔧 Start backend service (optional, keeps model resident in GPU memory) da3 backend --model-dir depth-anything/DA3NESTED-GIANT-LARGE ``` ```bash # 🚀 Use auto mode to process input (local inference, no backend involved) da3 auto path/to/input --export-dir ./workspace/scene001 ``` ```bash # â™ŧïļ Reuse backend for next job da3 auto path/to/video.mp4 \ --export-dir workspace/gallery/scene002 \ --use-backend \ --backend-url http://localhost:8008 ``` -------------------------------- ### Gallery Server Usage Examples Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Common usage patterns for the gallery server, including custom network settings and browser automation. ```bash # 🖞ïļ Basic gallery server da3 gallery --gallery-dir ./workspace # 🌐 Custom host and port da3 gallery \ --gallery-dir ./workspace \ --host 0.0.0.0 \ --port 8007 # 🚀 Auto-open browser da3 gallery --gallery-dir ./workspace --open-browser ``` -------------------------------- ### Full Evaluation Example Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/BENCHMARK.md Run a full evaluation using the specified model path. This command performs a comprehensive benchmark. ```bash MODEL=depth-anything/DA3-GIANT # Full evaluation python -m depth_anything_3.bench.evaluator model.path=$MODEL ``` -------------------------------- ### Launch Gradio Application Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Commands to start the Gradio web interface with various configuration options. ```bash da3 gradio [OPTIONS] ``` ```bash da3 gradio \ --model-dir depth-anything/DA3NESTED-GIANT-LARGE \ --workspace-dir ./workspace \ --gallery-dir ./gallery ``` ```bash da3 gradio \ --model-dir depth-anything/DA3NESTED-GIANT-LARGE \ --workspace-dir ./workspace \ --gallery-dir ./gallery \ --share \ --debug ``` ```bash da3 gradio \ --model-dir depth-anything/DA3NESTED-GIANT-LARGE \ --workspace-dir ./workspace \ --gallery-dir ./gallery \ --cache-examples \ --cache-gs-tag "dl3dv" ``` -------------------------------- ### Install libGL for OpenCV Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/da3_streaming/README.md Install the libGL system dependency if encountering errors related to libGL.so.1, often from opencv-python. ```bash sudo apt-get install -y libgl1-mesa-glx ``` -------------------------------- ### Basic Workflow Commands Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Commands for starting the backend service and processing single images, videos, or COLMAP datasets. ```bash # 🔧 Start backend service da3 backend --model-dir depth-anything/DA3NESTED-GIANT-LARGE --host 0.0.0.0 --port 8008 # 🖞ïļ Process single image da3 image image.jpg --export-dir ./output1 --use-backend # 🎎 Process video da3 video video.mp4 --fps 2.0 --export-dir ./output2 --use-backend # 📐 Process COLMAP dataset da3 colmap ./colmap_data --export-dir ./output3 --use-backend ``` -------------------------------- ### Depth Anything V3 Inference Usage Example Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Example of how to use the inference method of the Depth Anything V3 model and access its outputs. Ensure the model is loaded and images are provided as a list. ```python prediction = model.inference(image=["img1.jpg", "img2.jpg"]) # Access depth maps depth_maps = prediction.depth # shape: (2, H, W) # Access confidence if hasattr(prediction, 'conf'): confidence = prediction.conf ``` -------------------------------- ### Model Configuration Example (YAML) Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/README.md Define a custom model architecture by creating a new YAML configuration file. This specifies the network components and their parameters. ```yaml __object__: path: depth_anything_3.model.da3 name: DepthAnything3Net args: as_params net: __object__: path: depth_anything_3.model.dinov2.dinov2 name: DinoV2 args: as_params name: vitb out_layers: [5, 7, 9, 11] alt_start: 4 qknorm_start: 4 rope_start: 4 cat_token: True head: __object__: path: depth_anything_3.model.dualdpt name: DualDPT args: as_params dim_in: &head_dim_in 1536 output_dim: 2 features: &head_features 128 out_channels: &head_out_channels [96, 192, 384, 768] ``` -------------------------------- ### Basic Depth Estimation Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Quick example to initialize the DepthAnything3 model and perform basic depth estimation on a list of images. ```APIDOC ## Basic Depth Estimation ```python from depth_anything_3.api import DepthAnything3 # Initialize and run inference model = DepthAnything3.from_pretrained("depth-anything/DA3NESTED-GIANT-LARGE").to("cuda") prediction = model.inference(["image1.jpg", "image2.jpg"]) ``` ``` -------------------------------- ### Export Results Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Example showing how to export depth data and 3D visualization results to a specified directory and format. ```APIDOC ## Export Results ```python # Export depth data and 3D visualization prediction = model.inference( image=image_paths, export_dir="./output", export_format="mini_npz-glb" ) ``` ``` -------------------------------- ### Using Ray-Based Pose Estimation Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Example demonstrating the use of ray-based pose estimation as an alternative to the camera decoder. ```APIDOC ## Using Ray-Based Pose Estimation ```python # Use ray-based pose estimation instead of camera decoder prediction = model.inference( image=image_paths, export_dir="./output", export_format="glb", use_ray_pose=True, # Enable ray-based pose estimation ) ``` ``` -------------------------------- ### Reference View Selection Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Examples for selecting the reference view strategy, including 'saddle_balanced' for multi-view inputs and 'middle' for video sequences. ```APIDOC ## Reference View Selection ```python # For multi-view inputs, automatically select the best reference view prediction = model.inference( image=image_paths, ref_view_strategy="saddle_balanced", # Default: balanced selection ) # For video sequences, use middle frame as reference prediction = model.inference( image=video_frames, ref_view_strategy="middle", # Good for temporally ordered inputs ) ``` ``` -------------------------------- ### Multi-GPU Inference Setup Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/BENCHMARK.md Configure the number of GPUs for inference using the CUDA_VISIBLE_DEVICES environment variable. Defaults to all available GPUs if not specified. ```bash # Use 4 GPUs CUDA_VISIBLE_DEVICES=0,1,2,3 python -m depth_anything_3.bench.evaluator model.path=$MODEL ``` ```bash # Use all available GPUs (default) python -m depth_anything_3.bench.evaluator model.path=$MODEL ``` ```bash # Single GPU CUDA_VISIBLE_DEVICES=0 python -m depth_anything_3.bench.evaluator model.path=$MODEL ``` -------------------------------- ### Pose-Conditioned Depth Estimation Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Example demonstrating pose-conditioned depth estimation using camera extrinsics and intrinsics for improved consistency. ```APIDOC ## Pose-Conditioned Depth Estimation ```python import numpy as np # With camera parameters for better consistency prediction = model.inference( image=["image1.jpg", "image2.jpg"], extrinsics=extrinsics_array, # (N, 4, 4) intrinsics=intrinsics_array # (N, 3, 3) ) ``` ``` -------------------------------- ### Batch Processing Workflow Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Commands for managing a batch processing pipeline including backend setup, loop execution, and gallery viewing. ```bash # 🔧 Start backend da3 backend \ --model-dir depth-anything/DA3NESTED-GIANT-LARGE \ --device cuda \ --host 0.0.0.0 \ --port 8008 \ --gallery-dir ./workspace # 🔄 Batch process multiple scenes for scene in scene1 scene2 scene3; do da3 auto ./data/$scene \ --export-dir ./workspace/$scene \ --use-backend \ --auto-cleanup done # 🖞ïļ Launch gallery to view results da3 gallery --gallery-dir ./workspace --open-browser ``` -------------------------------- ### Advanced Export with Feature Visualization Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Example showcasing export with intermediate feature visualization, including specifying feature layers and frames per second for visualization. ```APIDOC ## Advanced Export with Feature Visualization ```python # Export with intermediate feature visualization prediction = model.inference( image=image_paths, export_dir="./output", export_format="mini_npz-glb-depth_vis-feat_vis", export_feat_layers=[0, 5, 10, 15, 20], feat_vis_fps=30, ) ``` ``` -------------------------------- ### Advanced Export with Gaussian Splatting Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Example for advanced export options including Gaussian Splatting (GS) formats, requiring specific models like 'da3-giant'. ```APIDOC ## Advanced Export with Gaussian Splatting ```python # Export multiple formats including Gaussian Splatting # Note: infer_gs=True requires da3-giant or da3nested-giant-large model model = DepthAnything3(model_name="da3-giant").to("cuda") prediction = model.inference( image=image_paths, extrinsics=extrinsics_array, intrinsics=intrinsics_array, export_dir="./output", export_format="npz-glb-gs_ply-gs_video", align_to_input_ext_scale=True, infer_gs=True, # Required for gs_ply and gs_video exports ) ``` ``` -------------------------------- ### Advanced Backend Configuration Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Launch the backend with a gallery directory, custom host/port, and API key authentication. ```bash da3 backend \ --model-dir depth-anything/DA3NESTED-GIANT-LARGE \ --device cuda \ --host 0.0.0.0 \ --port 8008 \ --gallery-dir ./workspace \ --api-key "$DA3_BACKEND_API_KEY" ``` ```bash da3 backend --model-dir depth-anything/DA3NESTED-GIANT-LARGE --device cpu ``` -------------------------------- ### Load Model and Set Up Device Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/notebooks/da3.ipynb Loads the Depth Anything 3 model and moves it to the appropriate device (CUDA if available, otherwise CPU). Ensure the model is in evaluation mode. ```python import os import numpy as np import matplotlib.pyplot as plt from PIL import Image import torch from depth_anything_3.api import DepthAnything3 from depth_anything_3.utils.visualize import visualize_depth device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model = DepthAnything3.from_pretrained("depth-anything/DA3NESTED-GIANT-LARGE") model = model.to(device) model.eval() print(f"Model loaded on {device}") ``` -------------------------------- ### Launch Web Application Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Command to launch the Gradio web interface for interactive usage. ```bash # ðŸŽĻ Launch Gradio application da3 gradio \ --model-dir depth-anything/DA3NESTED-GIANT-LARGE \ --workspace-dir workspace/gradio \ --gallery-dir ./gallery \ --host 0.0.0.0 \ --port 7860 \ --share ``` -------------------------------- ### Command Line Interface for Depth Anything 3 Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/funcs/ref_view_strategy.md Shows how to perform depth estimation using the Depth Anything 3 CLI with various reference view strategies. The default strategy is 'saddle_balanced'. Options include specifying strategies for auto, video, and multi-view image processing. ```bash # Default (saddle_balanced) da3 auto input/ --export-dir output/ # Explicitly specify strategy da3 auto input/ --ref-view-strategy saddle_balanced # For video processing da3 video input.mp4 --ref-view-strategy middle # For wide-baseline multi-view da3 images captures/ --ref-view-strategy saddle_sim_range ``` -------------------------------- ### Initialize and Run Basic Depth Estimation Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Initializes the DepthAnything3 model and performs basic depth estimation on a list of images. Ensure the model is moved to the appropriate device (e.g., 'cuda'). ```python from depth_anything_3.api import DepthAnything3 # Initialize and run inference model = DepthAnything3.from_pretrained("depth-anything/DA3NESTED-GIANT-LARGE").to("cuda") prediction = model.inference(["image1.jpg", "image2.jpg"]) ``` -------------------------------- ### Accessing CLI Help Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Use these commands to display help information for the main CLI tool or specific subcommands. ```bash # 📖 View main help da3 --help # 🔍 View specific command help da3 auto --help da3 image --help da3 backend --help ``` -------------------------------- ### Download Pre-trained Weights Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/da3_streaming/README.md Execute the provided bash script to download all required pre-trained model weights. ```bash bash ./scripts/download_weights.sh ``` -------------------------------- ### Process using a backend service Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Command to offload inference to a specified backend service URL. ```bash da3 colmap ./colmap_dataset \ --use-backend \ --backend-url http://localhost:8008 \ --export-dir ./output ``` -------------------------------- ### Python: Create Model from Config Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/README.md Instantiate the model using a custom configuration file. This requires the `create_object` and `load_config` functions from the `depth_anything_3.cfg` module. ```python from depth_anything_3.cfg import create_object, load_config Model = create_object(load_config("path/to/new/config")) ``` -------------------------------- ### CLI: Auto Mode with Backend Reuse Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/README.md Use the CLI in auto mode, reusing the backend for caching models to the GPU. Ensure the model directory is set. ```bash export GALLERY_DIR=workspace/gallery mkdir -p $GALLERY_DIR da3 backend --model-dir ${MODEL_DIR} --gallery-dir ${GALLERY_DIR} # Cache model to gpu da3 auto assets/examples/SOH \ --export-format glb \ --export-dir ${GALLERY_DIR}/TEST_BACKEND/SOH \ --use-backend ``` -------------------------------- ### Download Specific Benchmark Dataset Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/BENCHMARK.md Download a specific dataset, such as 'hiroom.zip', from the HuggingFace repository. This is useful if you only need a subset of the benchmark data. ```bash # Download only HiRoom hf download depth-anything/DA3-BENCH hiroom.zip \ --local-dir workspace/benchmark_dataset \ --repo-type dataset ``` -------------------------------- ### da3 gallery Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Launches the standalone Depth Anything 3 Gallery server to visualize processed scenes. ```APIDOC ## da3 gallery ### Description Launch standalone Depth Anything 3 Gallery server to view processed scenes. The gallery expects each scene folder to contain at least `scene.glb` and `scene.jpg`. ### Usage `da3 gallery [OPTIONS]` ### Parameters - **--gallery-dir** (str) - Required - Gallery root directory - **--host** (str) - Optional - Host address to bind to (default: 127.0.0.1) - **--port** (int) - Optional - Port number to bind to (default: 8007) - **--open-browser** (bool) - Optional - Open browser after launch (default: False) ### Example ```bash da3 gallery --gallery-dir ./workspace --host 0.0.0.0 --port 8007 --open-browser ``` ``` -------------------------------- ### Export Multiple Formats in Depth Anything V3 Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Demonstrates how to export multiple formats simultaneously by separating them with a hyphen. This is useful for generating various outputs from a single inference pass. ```python # Export both mini_npz and glb formats export_format = "mini_npz-glb" ``` ```python # Export multiple formats export_format = "npz-glb-gs_ply" ``` -------------------------------- ### Quick Test on HiRoom Dataset Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/BENCHMARK.md Perform a quick test focusing only on the HiRoom dataset and pose estimation mode. This is useful for rapid checks. ```bash MODEL=depth-anything/DA3-GIANT # Quick test on HiRoom only python -m depth_anything_3.bench.evaluator \ model.path=$MODEL \ eval.datasets=[hiroom] \ eval.modes=[pose] ``` -------------------------------- ### Advanced Configuration Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Commands for customizing processing resolution, point cloud density, and COLMAP-specific parameters. ```bash # ⚙ïļ Custom resolution and point cloud density da3 image image.jpg \ --process-res 1024 \ --num-max-points 2000000 \ --conf-thresh-percentile 30.0 \ --export-dir ./output # 📐 COLMAP advanced options da3 colmap ./colmap_data \ --sparse-subdir 0 \ --align-to-input-ext-scale \ --process-res 756 \ --export-dir ./output ``` -------------------------------- ### Download and Extract Benchmark Data Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/BENCHMARK.md Download all benchmark datasets from HuggingFace and extract them. This includes setting an alternative endpoint if the default download is slow. ```bash cd da3_release mkdir -p workspace/benchmark_dataset hf download depth-anything/DA3-BENCH \ --local-dir workspace/benchmark_dataset \ --repo-type dataset cd workspace/benchmark_dataset for f in *.zip; do unzip -q "$f"; done ``` -------------------------------- ### Python API for Inference with Reference View Strategies Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/funcs/ref_view_strategy.md Demonstrates how to use the DepthAnything3 model's inference method with different reference view selection strategies. The default strategy is 'saddle_balanced'. For video sequences, 'middle' is recommended, and for wide-baseline multi-view scenarios, 'saddle_sim_range' can be effective. ```python from depth_anything_3 import DepthAnything3 model = DepthAnything3.from_pretrained("depth-anything/DA3NESTED-GIANT-LARGE") # Use default (saddle_balanced) prediction = model.inference( images, ref_view_strategy="saddle_balanced" ) # For video sequences, consider using middle prediction = model.inference( video_frames, ref_view_strategy="middle" # Good for temporal sequences ) # For complex scenes with wide baselines prediction = model.inference( images, ref_view_strategy="saddle_sim_range" ) ``` -------------------------------- ### DepthAnything3 Class Initialization Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Initializes the DepthAnything3 model with a specified model name and moves it to the GPU. ```APIDOC ## DepthAnything3 Class The main API class that provides depth estimation capabilities with optional pose conditioning. ### Initialization ```python from depth_anything_3 import DepthAnything3 # Initialize the model with a model name model = DepthAnything3(model_name="da3-large") model = model.to("cuda") # Move to GPU ``` **Parameters:** - `model_name` (str, default: "da3-large"): The name of the model preset to use. - **Available models:** - ðŸĶū `"da3-giant"` - 1.15B params, any-view model with GS support - ⭐ `"da3-large"` - 0.35B params, any-view model (recommended for most use cases) - ðŸ“Ķ `"da3-base"` - 0.12B params, any-view model - ðŸŠķ `"da3-small"` - 0.08B params, any-view model - 👁ïļ `"da3mono-large"` - 0.35B params, monocular depth only - 📏 `"da3metric-large"` - 0.35B params, metric depth with sky segmentation - ðŸŽŊ `"da3nested-giant-large"` - 1.40B params, nested model with all features ``` -------------------------------- ### Multi-Format Export Options Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Commands for exporting data in specific formats like NPZ, GLB, or feature visualizations. ```bash # ðŸ“Ķ Export both NPZ and GLB formats da3 auto assets/examples/SOH \ --export-format mini_npz-glb \ --export-dir ./workspace/soh # 🔍 Export feature visualization da3 image image.jpg \ --export-format feat_vis \ --export-feat "9,19,29,39" \ --export-dir ./results ``` -------------------------------- ### Run DA3-Streaming on Images Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/da3_streaming/README.md Execute the DA3-Streaming pipeline on a directory of images. Optionally specify a configuration file and output directory. ```python python da3_streaming.py --image_dir ./path_of_images ``` ```python python da3_streaming.py --image_dir ./path_of_images --config ./configs/base_config.yaml --output_dir ${OUTPUT_DIR} ``` -------------------------------- ### Prepare Input Images for Inference Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md The `image` parameter accepts a list of inputs, which can be file paths, numpy arrays, or PIL Images. Ensure your images are loaded correctly before passing them to the inference method. ```python # From file paths image = ["image1.jpg", "image2.jpg", "image3.jpg"] ``` ```python # From numpy arrays image = [np.array(img1), np.array(img2)] ``` ```python # From PIL Images image = [Image.open("image1.jpg"), Image.open("image2.jpg")] ``` -------------------------------- ### CLI: Video Processing with Feature Visualization Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/README.md Process video files using the CLI, enabling feature visualization. Specify export formats, directories, and processing methods. ```bash da3 video assets/examples/robot_unitree.mp4 \ --fps 15 \ --use-backend \ --export-dir ${GALLERY_DIR}/TEST_BACKEND/robo \ --export-format glb-feat_vis \ --feat-vis-fps 15 \ --process-res-method lower_bound_resize \ --export-feat "11,21,31" ``` -------------------------------- ### Initialize DepthAnything3 Model Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Initializes the DepthAnything3 model with a specified model name. The model is then moved to the GPU for processing. Available models include 'da3-giant', 'da3-large', 'da3-base', 'da3-small', 'da3mono-large', 'da3metric-large', and 'da3nested-giant-large'. ```python from depth_anything_3 import DepthAnything3 # Initialize the model with a model name model = DepthAnything3(model_name="da3-large") model = model.to("cuda") # Move to GPU ``` -------------------------------- ### Clone DA3-Streaming Project Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/da3_streaming/README.md Clone the repository including submodules. Use the --recursive flag for initial cloning. ```bash git clone --recursive https://github.com/ByteDance-Seed/Depth-Anything-3.git ``` ```bash cd /Depth-Anything-3/ git submodule update --init --recursive . ``` -------------------------------- ### Export Parameters Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Configure output directory, format, and specific parameters for different export types. ```APIDOC ## Export Parameters ### `export_dir` (optional) - **Type**: `Optional[str]` - **Description**: Directory path where exported files will be saved. If not provided, no files will be exported. ### `export_format` (default: "mini_npz") - **Type**: `str` - **Description**: Format for exporting results. Supports multiple formats separated by `-`. - **Example**: `"mini_npz-glb"` exports both mini_npz and glb formats. ### GLB Export Parameters These parameters are passed directly to the `inference()` method and only apply when `export_format` includes `"glb"`. ##### `conf_thresh_percentile` (default: 40.0) - **Type**: `float` - **Description**: Lower percentile for adaptive confidence threshold. Points below this confidence percentile will be filtered out from the point cloud. ##### `num_max_points` (default: 1,000,000) - **Type**: `int` - **Description**: Maximum number of points in the exported point cloud. If the point cloud exceeds this limit, it will be downsampled. ##### `show_cameras` (default: True) - **Type**: `bool` - **Description**: Whether to include camera wireframes in the exported GLB file for visualization. ### Feature Visualization Parameters These parameters are passed directly to the `inference()` method and only apply when `export_format` includes `"feat_vis"`. ##### `feat_vis_fps` (default: 15) - **Type**: `int` - **Description**: Frame rate for the output video when visualizing features across multiple images. ### 3DGS and 3DGS Video Parameters These parameters are passed directly to the `inference()` method and only apply when `export_format` includes `"gs_ply"` or `"gs_video"`. ##### `export_kwargs` (default: `{}`) - Type: `dict[str, dict[str, Any]]` - Description: Per-format extra arguments passed to export functions, mainly for `"gs_ply"` and `"gs_video"`. - Access pattern: `export_kwargs[export_format][key] = value` - Example: ```python { "gs_ply": { "gs_views_interval": 1, }, "gs_video": { "trj_mode": "interpolate_smooth", "chunk_size": 1, "vis_depth": None, }, } ``` ``` -------------------------------- ### Evaluation Command Reference Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/BENCHMARK.md This section provides a comprehensive reference for the command-line interface used to run evaluations on various datasets. It includes configuration options, overrides, and special flags. ```APIDOC ## Command Reference ```bash python -m depth_anything_3.bench.evaluator [OPTIONS] [KEY=VALUE ...] ``` ### Configuration: `--config PATH` Config YAML file (default: bench/configs/eval_bench.yaml) ### Config Overrides (using dotlist notation): `model.path=VALUE` Model path or HuggingFace ID `workspace.work_dir=VALUE` Working directory for outputs `eval.datasets=[dataset1,dataset2]` Datasets to evaluate (eth3d,7scenes,scannetpp,hiroom,dtu,dtu64) `eval.modes=[mode1,mode2]` Evaluation modes (pose,recon_unposed,recon_posed) `eval.scenes=[scene1,scene2]` Specific scenes to evaluate (null=all) `eval.max_frames=VALUE` Max frames per scene (-1=no limit, default: 100) `eval.ref_view_strategy=VALUE` Reference view strategy (default: first) `eval.eval_only=VALUE` Only run evaluation (skip inference) (true/false) `eval.print_only=VALUE` Only print saved metrics (true/false) `inference.num_fusion_workers=VALUE` Number of parallel workers (default: 4) `inference.debug=VALUE` Enable debug mode (true/false) ### Special Flags: `--help`, `-h` Show this help message ### Multi-GPU: Use CUDA_VISIBLE_DEVICES to specify GPUs (auto-detected and distributed) ### Examples: ```bash MODEL=depth-anything/DA3-GIANT # Full evaluation python -m depth_anything_3.bench.evaluator model.path=$MODEL # Quick test on HiRoom only python -m depth_anything_3.bench.evaluator \ model.path=$MODEL \ eval.datasets=[hiroom] \ eval.modes=[pose] # Pose-only evaluation (all 5 pose datasets) python -m depth_anything_3.bench.evaluator \ model.path=$MODEL \ eval.datasets=[eth3d,7scenes,scannetpp,hiroom,dtu64] \ eval.modes=[pose] # Recon-only evaluation (all 5 recon datasets) python -m depth_anything_3.bench.evaluator \ model.path=$MODEL \ eval.datasets=[eth3d,7scenes,scannetpp,hiroom,dtu] \ eval.modes=[recon_unposed,recon_posed] # Debug specific scenes python -m depth_anything_3.bench.evaluator \ model.path=$MODEL \ eval.datasets=[eth3d] \ eval.scenes=[courtyard] \ inference.debug=true # Re-evaluate without re-running inference python -m depth_anything_3.bench.evaluator eval.eval_only=true # Just view results python -m depth_anything_3.bench.evaluator eval.print_only=true ``` ``` -------------------------------- ### Process with sparse subdirectory and scale alignment Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Advanced command specifying a sparse reconstruction subdirectory and enabling input extrinsic scale alignment. ```bash da3 colmap ./colmap_dataset \ --sparse-subdir 0 \ --align-to-input-ext-scale \ --export-dir ./output ``` -------------------------------- ### Troubleshooting Data Path Issues Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/BENCHMARK.md Guidance on resolving issues related to dataset paths by ensuring the paths in `src/depth_anything_3/utils/constants.py` are correctly configured. ```APIDOC ### Data Path Issues Ensure dataset paths in `src/depth_anything_3/utils/constants.py` are correct: ```python # Default paths (relative to project root) ETH3D_EVAL_DATA_ROOT = "workspace/benchmark_dataset/eth3d" SEVENSCENES_EVAL_DATA_ROOT = "workspace/benchmark_dataset/7scenes" SCANNETPP_EVAL_DATA_ROOT = "workspace/benchmark_dataset/scannetpp" HIROOM_EVAL_DATA_ROOT = "workspace/benchmark_dataset/hiroom/data" DTU_EVAL_DATA_ROOT = "workspace/benchmark_dataset/dtu" DTU64_EVAL_DATA_ROOT = "workspace/benchmark_dataset/dtu64" ``` ``` -------------------------------- ### Configure GLB Export Parameters Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Set parameters for GLB export, such as confidence threshold, maximum points, and camera visualization. These are passed directly to the inference method when 'glb' is included in export_format. ```python conf_thresh_percentile=40.0, num_max_points=1000000, show_cameras=True ``` -------------------------------- ### Default Dataset Paths Configuration Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/BENCHMARK.md Python code defining the default root paths for various benchmark datasets. Ensure these paths are correctly set in your project. ```python # Default paths (relative to project root) ETH3D_EVAL_DATA_ROOT = "workspace/benchmark_dataset/eth3d" SEVENSCENES_EVAL_DATA_ROOT = "workspace/benchmark_dataset/7scenes" SCANNETPP_EVAL_DATA_ROOT = "workspace/benchmark_dataset/scannetpp" HIROOM_EVAL_DATA_ROOT = "workspace/benchmark_dataset/hiroom/data" DTU_EVAL_DATA_ROOT = "workspace/benchmark_dataset/dtu" DTU64_EVAL_DATA_ROOT = "workspace/benchmark_dataset/dtu64" ``` -------------------------------- ### Configure Feature Visualization Parameters Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Set the frame rate for feature visualization videos. This parameter is used when 'feat_vis' is included in the export_format. ```python feat_vis_fps=15 ``` -------------------------------- ### Run Full Evaluation Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/BENCHMARK.md Execute the full evaluation pipeline for Depth Anything 3. This command infers depth, evaluates performance across all datasets and modes, and prints the results. The default model is 'depth-anything/DA3-GIANT'. ```bash # Set model (default: depth-anything/DA3-GIANT) MODEL=depth-anything/DA3-GIANT # Full evaluation (all datasets, all modes) python -m depth_anything_3.bench.evaluator model.path=$MODEL # View results python -m depth_anything_3.bench.evaluator eval.print_only=true ``` -------------------------------- ### Using Ray-Based Pose Estimation Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Enables ray-based pose estimation instead of the default camera decoder. This is configured by setting the `use_ray_pose` parameter to `True` during inference. ```python # Use ray-based pose estimation instead of camera decoder prediction = model.inference( image=image_paths, export_dir="./output", export_format="glb", use_ray_pose=True, # Enable ray-based pose estimation ) ``` -------------------------------- ### Process image directory via CLI Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Commands for batch processing images from a directory with various configuration options. ```bash # 📁 Process directory (defaults to png/jpg/jpeg) da3 images ./image_folder --export-dir ./output # ðŸŽŊ Custom extensions da3 images ./dataset --image-extensions "png,jpg,webp" --export-dir ./output # 🔧 Use backend service da3 images ./dataset \ --use-backend \ --backend-url http://localhost:8008 \ --export-dir ./output ``` -------------------------------- ### Render Parameters Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Optional parameters for rendering frames, including camera intrinsics and output resolution. ```APIDOC ## Render Parameters #### `render_ixts` (optional) - **Type**: `Optional[np.ndarray]` - **Shape**: `(M, 3, 3)` - **Description**: Camera intrinsics for each rendered frame. Leave `None` to reuse the input intrinsics. #### `render_hw` (optional) - **Type**: `Optional[Tuple[int, int]]` - **Description**: Explicit output resolution `(height, width)` for the rendered frames. Defaults to the input resolution when not provided. ``` -------------------------------- ### Depth Anything 3 Evaluator Command Reference Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/BENCHMARK.md Use this command to run evaluations on various datasets. Configure model path, working directory, datasets, and evaluation modes. ```bash python -m depth_anything_3.bench.evaluator [OPTIONS] [KEY=VALUE ...] ``` -------------------------------- ### Image Mode Command Syntax Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Basic command structure for processing a single image. ```bash da3 image IMAGE_PATH [OPTIONS] ``` -------------------------------- ### Export Depth Data and 3D Visualization Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Runs inference and exports the depth data along with a 3D visualization in a specified format. The output directory and format are configured via parameters. ```python # Export depth data and 3D visualization prediction = model.inference( image=image_paths, export_dir="./output", export_format="mini_npz-glb" ) ``` -------------------------------- ### Default Evaluation Configuration File Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/BENCHMARK.md This YAML file defines the default settings for evaluation, including model path, workspace directory, datasets, and evaluation modes. ```yaml # Model path model: path: depth-anything/DA3-GIANT # Workspace directory workspace: work_dir: ./workspace/evaluation # Evaluation settings eval: datasets: [eth3d, 7scenes, scannetpp, hiroom, dtu, dtu64] modes: [pose, recon_unposed, recon_posed] max_frames: 100 # Max frames per scene (-1 = no limit) scenes: null # Specific scenes (null = all) # Inference settings inference: num_fusion_workers: 4 debug: false ``` -------------------------------- ### Pose-Conditioned Depth Estimation with Camera Parameters Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Performs pose-conditioned depth estimation using provided extrinsic and intrinsic camera parameters for enhanced consistency. The input arrays should have shapes (N, 4, 4) for extrinsics and (N, 3, 3) for intrinsics. ```python import numpy as np # With camera parameters for better consistency prediction = model.inference( image=["image1.jpg", "image2.jpg"], extrinsics=extrinsics_array, # (N, 4, 4) intrinsics=intrinsics_array # (N, 3, 3) ) ``` -------------------------------- ### Transformer Feature Visualization Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Command for exporting combined numerical and transformer feature data. ```bash # 🔍 Export Transformer features # ðŸ“Ķ Combined with numerical output da3 auto video.mp4 \ --export-format glb-feat_vis \ --export-feat "11,21,31" \ --export-dir ./debug \ --use-backend ``` -------------------------------- ### Evaluate Specific Modes Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/BENCHMARK.md Use this command to evaluate the model on specific datasets and modes. Ensure the model path is correctly set. ```bash python -m depth_anything_3.bench.evaluator model.path=$MODEL eval.modes=[pose,recon_unposed] ``` ```bash python -m depth_anything_3.bench.evaluator model.path=$MODEL \ eval.datasets=[hiroom] \ eval.modes=[pose] ``` -------------------------------- ### Configure 3DGS Export Arguments Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Provide format-specific extra arguments for 3D Gaussian Splatting exports (gs_ply, gs_video). Access arguments using export_kwargs[export_format][key] = value. ```python export_kwargs={ "gs_ply": { "gs_views_interval": 1, }, "gs_video": { "trj_mode": "interpolate_smooth", "chunk_size": 1, "vis_depth": None, }, } ``` -------------------------------- ### Process video files via CLI Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Commands for extracting frames from video files for depth estimation, supporting custom sampling rates and backend processing. ```bash # âœĻ Basic video processing da3 video path/to/video.mp4 --export-dir ./output # ⚙ïļ Control frame sampling and resolution da3 video path/to/video.mp4 \ --fps 2.0 \ --process-res 1024 \ --export-dir ./output # 🔧 Use backend service da3 video path/to/video.mp4 \ --use-backend \ --backend-url http://localhost:8008 \ --export-dir ./output ``` -------------------------------- ### Reference View Selection for Multi-View Inputs Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/API.md Automatically selects the best reference view for multi-view inputs. The `ref_view_strategy` parameter can be set to 'saddle_balanced' (default) or 'middle' for video frames. ```python # For multi-view inputs, automatically select the best reference view prediction = model.inference( image=image_paths, ref_view_strategy="saddle_balanced", # Default: balanced selection ) # For video sequences, use middle frame as reference prediction = model.inference( image=video_frames, ref_view_strategy="middle", # Good for temporally ordered inputs ) ``` -------------------------------- ### Run COLMAP dataset processing Source: https://github.com/bytedance-seed/depth-anything-3/blob/main/docs/CLI.md Basic command to process a COLMAP dataset and specify an output directory. ```bash da3 colmap ./colmap_dataset --export-dir ./output ```