Depth Pro 2-focal: Apple's focal length estimator
2 min readupdated
The DepthPro2-focal model is a specialized component from Apple's new Depth Pro 2 lineup, designed to predict focal length in pixels for individual photos and video frames. Its compact size of 23.5M parameters allows for quick integration of focus estimation into image and video processing pipelines. The model helps recover metric depth and scene geometry even when the original frame metadata is lost. The tool is useful for computer vision developers, researchers, and multimedia creators working with spatial analysis.
Key features
- Compact size: Only 23.5 million parameters for fast performance.
- Specialization: Precise determination of focal length in pixels for photos and videos.
- Easy integration: Simple launch via the official library with PyTorch and CUDA support.
What you can do
- Frame analysis: Embed focus estimation into video pipelines to process clips frame by frame.
- Photo processing: Recover focal length for images without EXIF data.
- Research projects: Use the component in computer vision and depth recovery tasks.
Example
from functools import partial
import torch
from depth_pro_2 import load_rgb
from depth_pro_2.model import to_normalized_tensor
from depth_pro_2.network.fov import FOVEstimator
fov = FOVEstimator.from_pretrained("apple/DepthPro2-focal").to("cuda").eval()
transform = partial(to_normalized_tensor, device=torch.device("cuda"))
image, _ = load_rgb("photo.jpg")
with torch.no_grad():
f_px = fov.focal_length_px(transform(image)[None])
Read more
DetailsParameters: 23.5M
Library: depth-pro-2
License: Apple Machine Learning Research Model license (non-commercial scientific and academic research only)










Comments