Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/depth_pro/depth_pro.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ def infer(

canonical_inverse_depth, fov_deg = self.forward(x)
if f_px is None:
if fov_deg is None:
raise ValueError(
"f_px must be provided when use_fov_head=False, "
"as the model cannot estimate focal length without the FOV head."
)
f_px = 0.5 * W / torch.tan(0.5 * torch.deg2rad(fov_deg.to(torch.float)))

inverse_depth = canonical_inverse_depth * (W / f_px)
Expand Down