### Set up conda environment and install depth_pro Source: https://github.com/apple-aiml-research/ml-depth-pro/blob/main/README.md Creates a conda virtual environment named 'depth-pro' with Python 3.9, activates it, and installs the depth_pro package in editable mode. Use this to set up the environment before running the model. ```bash conda create -n depth-pro -y python=3.9 conda activate depth-pro pip install -e . ``` -------------------------------- ### Download pretrained checkpoints Source: https://github.com/apple-aiml-research/ml-depth-pro/blob/main/README.md Downloads pretrained checkpoints to the 'checkpoints' directory. Run this after installing the package to obtain the model weights. ```bash source get_pretrained_models.sh # Files will be downloaded to `checkpoints` directory. ``` -------------------------------- ### Run depth-pro-run on a single image Source: https://github.com/apple-aiml-research/ml-depth-pro/blob/main/README.md Runs the depth-pro-run helper script on a single image. Use -h to see available options. ```bash # Run prediction on a single image: depth-pro-run -i ./data/example.jpg # Run `depth-pro-run -h` for available options. ``` -------------------------------- ### Run Depth Pro inference from Python Source: https://github.com/apple-aiml-research/ml-depth-pro/blob/main/README.md Loads the Depth Pro model and preprocessing transform, loads and preprocesses an RGB image, then runs inference to obtain depth in meters and focal length in pixels. The variable 'image_path' must be defined beforehand. ```python from PIL import Image import depth_pro # Load model and preprocessing transform model, transform = depth_pro.create_model_and_transforms() model.eval() # Load and preprocess an image. image, _, f_px = depth_pro.load_rgb(image_path) image = transform(image) # Run inference. prediction = model.infer(image, f_px=f_px) depth = prediction["depth"] # Depth in [m]. focallength_px = prediction["focallength_px"] # Focal length in pixels. ``` -------------------------------- ### Evaluate boundary metrics with SI_boundary_F1 and SI_boundary_Recall Source: https://github.com/apple-aiml-research/ml-depth-pro/blob/main/README.md Computes boundary metrics: SI_boundary_F1 for depth-based datasets and SI_boundary_Recall for mask-based datasets (image matting/segmentation). These functions are available in eval/boundary_metrics.py. ```python # for a depth-based dataset boundary_f1 = SI_boundary_F1(predicted_depth, target_depth) # for a mask-based dataset (image matting / segmentation) boundary_recall = SI_boundary_Recall(predicted_depth, target_mask) ``` -------------------------------- ### Cite the Depth Pro paper Source: https://github.com/apple-aiml-research/ml-depth-pro/blob/main/README.md BibTeX entry for citing the Depth Pro paper in academic publications. ```bibtex @inproceedings{Bochkovskii2024:arxiv, author = {Aleksei Bochkovskii and Ama"{e}l Delaunoy and Hugo Germain and Marcel Santos and Yichao Zhou and Stephan R. Richter and Vladlen Koltun}, title = {Depth Pro: Sharp Monocular Metric Depth in Less Than a Second}, booktitle = {International Conference on Learning Representations}, year = {2025}, url = {https://arxiv.org/abs/2410.02073}, } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.