Description
When creating a model with use_fov_head=False and calling infer() without
providing f_px, the code crashes with an unhelpful AttributeError.
Steps to Reproduce
from depth_pro.depth_pro import DepthProConfig, create_model_and_transforms
import torch
config = DepthProConfig(
patch_encoder_preset="dinov2l16_384",
image_encoder_preset="dinov2l16_384",
decoder_features=256,
use_fov_head=False,
checkpoint_uri=None,
)
model, transform = create_model_and_transforms(config=config)
model.eval()
image = torch.rand(1, 3, 256, 256)
model.infer(image)
Error
Traceback (most recent call last):
File "<stdin>", line 26, in <module>
File "<stdin>", line 23, in infer
AttributeError: 'NoneType' object has no attribute 'to'
Root Cause
When use_fov_head=False, forward() returns fov_deg=None.
The code unconditionally calls fov_deg.to() with no None guard.
Expected Behaviour
A clear ValueError telling the user that f_px must be provided
when use_fov_head=False.
Description
When creating a model with
use_fov_head=Falseand callinginfer()withoutproviding
f_px, the code crashes with an unhelpfulAttributeError.Steps to Reproduce
Error
Root Cause
When
use_fov_head=False,forward()returnsfov_deg=None.The code unconditionally calls
fov_deg.to()with no None guard.Expected Behaviour
A clear
ValueErrortelling the user thatf_pxmust be providedwhen
use_fov_head=False.