diff --git a/src/depth_pro/depth_pro.py b/src/depth_pro/depth_pro.py index f31b4e16..0cec10ed 100644 --- a/src/depth_pro/depth_pro.py +++ b/src/depth_pro/depth_pro.py @@ -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)