Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/apple/ml-depth-pro
/ functions
Functions
49 in github.com/apple/ml-depth-pro
⨍
Functions
49
◇
Types & classes
8
↓ 4 callers
Method
merge
Merge the patched input into a image with sliding window.
src/depth_pro/network/encoder.py:190
↓ 4 callers
Method
reshape_feature
Discard class token and reshape 1D feature map to a 2D grid.
src/depth_pro/network/encoder.py:219
↓ 3 callers
Function
create_backbone_model
Create and load a backbone model given a config. Args: ---- preset: A backbone preset to load pre-defind configs. Returns: -
src/depth_pro/depth_pro.py:49
↓ 3 callers
Function
invert_depth
Inverts a depth map with numerical stability. Args: ---- depth (np.ndarray): Depth map to be inverted. eps (float): Minimum v
src/depth_pro/eval/boundary_metrics.py:245
↓ 3 callers
Function
nms_horizontal
Apply Non-Maximum Suppression (NMS) horizontally on the given ratio matrix. Args: ---- ratio (np.ndarray): Input ratio matrix.
src/depth_pro/eval/boundary_metrics.py:29
↓ 3 callers
Method
split
Split the input into small patches with sliding window.
src/depth_pro/network/encoder.py:170
↓ 2 callers
Method
__init__
Initialize ResidualBlock.
src/depth_pro/network/decoder.py:105
↓ 2 callers
Method
_residual_block
Create a residual block.
src/depth_pro/network/decoder.py:183
↓ 2 callers
Function
fgbg_depth
Find foreground-background relations between neighboring pixels. Args: ---- d (np.ndarray): Depth matrix. t (float): Threshol
src/depth_pro/eval/boundary_metrics.py:69
↓ 2 callers
Function
get_thresholds_and_weights
Generate thresholds and weights for the given range. Args: ---- t_min (float): Minimum threshold. t_max (float): Maximum thre
src/depth_pro/eval/boundary_metrics.py:224
↓ 2 callers
Function
nms_vertical
Apply Non-Maximum Suppression (NMS) vertically on the given ratio matrix. Args: ---- ratio (np.ndarray): Input ratio matrix.
src/depth_pro/eval/boundary_metrics.py:53
↓ 1 callers
Method
_create_pyramid
Create a 3-level image pyramid.
src/depth_pro/network/encoder.py:151
↓ 1 callers
Function
boundary_f1
Calculate Boundary F1 score. Args: ---- pr (np.ndarray): Predicted depth matrix. gt (np.ndarray): Ground truth depth matrix.
src/depth_pro/eval/boundary_metrics.py:178
↓ 1 callers
Function
connected_component
Find connected components in the given row and column indices. Args: ---- r (np.ndarray): Row indices. c (np.ndarray): Column
src/depth_pro/eval/boundary_metrics.py:6
↓ 1 callers
Function
create_model_and_transforms
Create a DepthPro model and load weights from `config.checkpoint_uri`. Args: ---- config: The configuration for the DPT model archite
src/depth_pro/depth_pro.py:72
↓ 1 callers
Function
create_vit
Create and load a VIT backbone module. Args: ---- preset: The VIT preset to load the pre-defined config. use_pretrained: Load
src/depth_pro/network/vit_factory.py:68
↓ 1 callers
Function
edge_recall_matting
Calculate edge recall for image matting. Args: ---- pr (np.ndarray): Predicted depth matrix. gt (np.ndarray): Ground truth bi
src/depth_pro/eval/boundary_metrics.py:153
↓ 1 callers
Function
extract_exif
Return exif information as a dictionary. Args: ---- img_pil: A Pillow image. Returns: ------- A dictionary with extr
src/depth_pro/utils.py:16
↓ 1 callers
Function
fgbg_binary_mask
Find foreground-background relations between neighboring pixels in binary masks. Args: ---- d (np.ndarray): Binary depth matrix.
src/depth_pro/eval/boundary_metrics.py:125
↓ 1 callers
Function
fgbg_depth_thinned
Find foreground-background relations between neighboring pixels with Non-Maximum Suppression. Args: ---- d (np.ndarray): Depth matrix
src/depth_pro/eval/boundary_metrics.py:97
↓ 1 callers
Method
forward
Decode by projection and fusion of multi-resolution encodings. Args: ---- x (torch.Tensor): Input image. Returns
src/depth_pro/depth_pro.py:218
↓ 1 callers
Function
fpx_from_f35
Convert a focal length given in mm (35mm film equivalent) to pixels.
src/depth_pro/utils.py:42
↓ 1 callers
Function
get_torch_device
Get the Torch device.
src/depth_pro/cli/run.py:23
↓ 1 callers
Method
infer
Infer depth and fov for a given image. If the image is not at network resolution, it is resized to 1536x1536 and the estimated depth
src/depth_pro/depth_pro.py:244
↓ 1 callers
Function
load_rgb
Load an RGB image. Args: ---- path: The url to the image to load. auto_rotate: Rotate the image based on the EXIF data, defau
src/depth_pro/utils.py:47
↓ 1 callers
Function
main
Run DepthPro inference example.
src/depth_pro/cli/run.py:120
↓ 1 callers
Function
make_vit_b16_backbone
Make a ViTb16 backbone for the DPT model.
src/depth_pro/network/vit.py:13
↓ 1 callers
Function
resize_patch_embed
Resample the ViT patch size to the given one.
src/depth_pro/network/vit.py:70
↓ 1 callers
Function
resize_vit
Resample the ViT module to the given size.
src/depth_pro/network/vit.py:51
↓ 1 callers
Function
run
Run Depth Pro on a sample image.
src/depth_pro/cli/run.py:33
Function
SI_boundary_F1
Calculate Scale-Invariant Boundary F1 Score for depth-based ground-truth. Args: ---- predicted_depth (np.ndarray): Predicted depth ma
src/depth_pro/eval/boundary_metrics.py:262
Function
SI_boundary_Recall
Calculate Scale-Invariant Boundary Recall Score for mask-based ground-truth. Args: ---- predicted_depth (np.ndarray): Predicted depth
src/depth_pro/eval/boundary_metrics.py:295
Method
__init__
Initialize DepthPro. Args: ---- encoder: The DepthProEncoder backbone. decoder: The MultiresConvDecoder decod
src/depth_pro/depth_pro.py:157
Method
__init__
Initialize multiresolution convolutional decoder. Args: ---- dims_encoder: Expected dims at each level from the encoder.
src/depth_pro/network/decoder.py:19
Method
__init__
Initialize feature fusion block. Args: ---- num_features: Input and output dimensions. deconv: Whether to use
src/depth_pro/network/decoder.py:124
Method
__init__
Initialize the Field of View estimation block. Args: ---- num_features: Number of features used. fov_encoder:
src/depth_pro/network/fov.py:14
Method
__init__
Initialize DepthProEncoder. The framework 1. creates an image pyramid, 2. generates overlapping patches with a slidin
src/depth_pro/network/encoder.py:20
Method
_create_block
(dim: int, batch_norm: bool)
src/depth_pro/network/decoder.py:186
Method
_create_project_upsample_block
( dim_in: int, dim_out: int, upsample_layers: int, dim_int: Op
src/depth_pro/network/encoder.py:60
Method
_hook0
(self, model, input, output)
src/depth_pro/network/encoder.py:140
Method
_hook1
(self, model, input, output)
src/depth_pro/network/encoder.py:143
Method
forward
Decode the multi-resolution encodings.
src/depth_pro/network/decoder.py:74
Method
forward
Apply residual block.
src/depth_pro/network/decoder.py:111
Method
forward
Process and fuse input features.
src/depth_pro/network/decoder.py:166
Method
forward
Forward the fov network. Args: ---- x (torch.Tensor): Input image. lowres_feature (torch.Tensor): Low resolut
src/depth_pro/network/fov.py:56
Method
forward
Encode input at multiple resolutions. Args: ---- x (torch.Tensor): Input image. Returns: -------
src/depth_pro/network/encoder.py:233
Function
forward_features_eva_fixed
Encode features.
src/depth_pro/network/vit.py:38
Method
img_size
Return the internal image size of the network.
src/depth_pro/depth_pro.py:214
Method
img_size
Return the full image size of the SPN network.
src/depth_pro/network/encoder.py:147