-
Notifications
You must be signed in to change notification settings - Fork 595
Open
Description
TLDR: Does anyone have minimal code to load the metric depth models from local files???
It appears impossible to load the pretrained metric models from weights stored in a local directory. Here is my code:
from zoedepth.models.builder import build_model
from zoedepth.utils.config import get_config
config = get_config("zoedepth", mode="eval")
config.pretrained_resource = "/home/meee/code/Depth-Anything/checkpoints/depth_anything_metric_depth_indoor.pt"
model = build_model(config)First off, I had to replace the following in zoedepth.models.base_models.dpt_dinov2.DPT_DINOv2:
from depth_anything_v2.dinov2 import DINOv2
self.pretrained = DINOv2(model_name=encoder)
# self.pretrained = torch.hub.load('../torchhub/facebookresearch_dinov2_main', 'dinov2_{:}14'.format(encoder), source='local', pretrained=False)Using the implementation from DAv2.
Then, for some inexplicable reason, I also have to load the relative depth model weights in zoedepth.models.base_models.depth_anything in the build method?!
Oh yeah, and last but not least, we finally call the zoedepth build method where I have to change load_state_from_resource to a classic load_state_dict(torch.load()) only to receive a bunch of weight mismatches.
Metadata
Metadata
Assignees
Labels
No labels