isl-org / ZoeDepth

Metric depth estimation from a single image
MIT License
2.33k stars 213 forks source link

Error in first sample code: Help needed. #79

Open shersoni610 opened 1 year ago

shersoni610 commented 1 year ago

Hello,

I can not resolve this issue. Can someone help?

File "/media/M2Disk/Projects/CompVis/DepthEstimation/ZDepth/zoeenv/lib/python3.11/site-packages/torch/nn/functional.py", line 3924, in interpolate raise TypeError( TypeError: expected size to be one of int or Tuple[int] or Tuple[int, int] or Tuple[int, int, int], but got size with types [<class 'numpy.int64'>, <class 'numpy.int64'>]

jagennath-hari commented 1 year ago

isl-org_ZoeDepth_main/zoedepth/models/base_models/midas.py line 173 def __call__(self, x): width, height = self.get_size(*x.shape[-2:][::-1]) return nn.functional.interpolate(x, (int(height), int(width)), mode='bilinear', align_corners=True) if using beit backbone intel-isl_MiDaS_master/midas/backbones/beit.py line 47 new_sub_table = F.interpolate(old_sub_table, size=(int(new_height), int(new_width)), mode="bilinear")

these changes fixed the deployment for me

loevlie commented 1 year ago

Hey @shersoni610 I had this exact same error. I fixed it by setting up the virtual environment like they describe in the readme.

  1. Clone the repo and cd ZoeDepth
  2. Create the virtual environment using conda:
conda env create -n zoe --file environment.yml
conda activate zoe

After that everything from the sample code worked fine.

shersoni610 commented 12 months ago

Hello Hari, I got the following error:

File "/Users/.cache/torch/hub/intel-isl_MiDaS_master/midas/backbones/beit.py", line 47, in _get_rel_pos_bias new_sub_table = F.interpolate(old_sub_table, size=(int(new_height, new_width)), mode="bilinear") ^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: int() base must be >= 2 and <= 36, or 0

shersoni610 commented 12 months ago

Hello Hari,

Sorry, my mistake. Your solution worked.

Erendrgnl commented 8 months ago

@jagennath-hari hanks for help. An extra i changed in sanity.py at 37 as: torch.hub.help("intel-isl/MiDaS", "DPT_BEiT_L_384", force_reload=False)

Otherwise, it downloads again and overwrites the changes I made in the beit.py code.