zhyever / PatchFusion

[CVPR 2024] An End-to-End Tile-Based Framework for High-Resolution Monocular Metric Depth Estimation
https://zhyever.github.io/patchfusion/
MIT License
958 stars 64 forks source link

Pytorch 2 support #8

Closed dlazares closed 6 months ago

dlazares commented 9 months ago

I was able to hack it to work by changing midas.py and using timm==0.6.12

+++ b/zoedepth/models/base_models/midas.py
@@ -170,7 +170,8 @@ class Resize(object):

     def __call__(self, x):
         width, height = self.get_size(*x.shape[-2:][::-1])
-        return nn.functional.interpolate(x, (height, width), mode='bilinear', align_corners=True)
+        return nn.functional.interpolate(x, (height.item(), width.item()), mode='bilinear', align_corners=True)

and also changed the cached model code at ~/.cache/torch/hub/intel-isl_MiDaS_master/midas/backbones/beit.py to new_sub_table = F.interpolate(old_sub_table, size=(new_height.item(), new_width.item()), mode="bilinear")

is there a better way to do this?

mr-lab commented 9 months ago

in zoedepth\models\base_models\midas.py i changed the line 341: midas = torch.hub.load("intel-isl/MiDaS", midas_model_type, pretrained=use_pretrained_midas, force_reload=force_reload)

to : midas = torch.hub.load("AyaanShah2204/MiDaS", midas_model_type, pretrained=use_pretrained_midas, force_reload=force_reload)

zhyever commented 8 months ago

We're currently doing something about this. Thanks for your interest!

zhyever commented 6 months ago

Torch2.0 has been supported. Thanks