From 620ca71da36e5769f40e3410eb4d279ea42d421a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=92=E9=BE=8D=E8=81=96=E8=80=85=40bdsqlsz?= Date: Wed, 1 Nov 2023 23:28:41 +0800 Subject: [PATCH] fix int --- annotator/zoe/zoedepth/models/base_models/midas.py | 2 +- .../models/base_models/midas_repo/midas/backbones/beit.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/annotator/zoe/zoedepth/models/base_models/midas.py b/annotator/zoe/zoedepth/models/base_models/midas.py index 861730e94..380c34974 100644 --- a/annotator/zoe/zoedepth/models/base_models/midas.py +++ b/annotator/zoe/zoedepth/models/base_models/midas.py @@ -171,7 +171,7 @@ def get_size(self, width, height): 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, (int(height), int(width)), mode='bilinear', align_corners=True) class PrepForMidas(object): def __init__(self, resize_mode="minimal", keep_aspect_ratio=True, img_size=384, do_resize=True): diff --git a/annotator/zoe/zoedepth/models/base_models/midas_repo/midas/backbones/beit.py b/annotator/zoe/zoedepth/models/base_models/midas_repo/midas/backbones/beit.py index ef8c68186..aadc019b6 100644 --- a/annotator/zoe/zoedepth/models/base_models/midas_repo/midas/backbones/beit.py +++ b/annotator/zoe/zoedepth/models/base_models/midas_repo/midas/backbones/beit.py @@ -44,7 +44,7 @@ def _get_rel_pos_bias(self, window_size): old_sub_table = old_relative_position_bias_table[:old_num_relative_distance - 3] old_sub_table = old_sub_table.reshape(1, old_width, old_height, -1).permute(0, 3, 1, 2) - new_sub_table = F.interpolate(old_sub_table, size=(new_height, new_width), mode="bilinear") + new_sub_table = F.interpolate(old_sub_table, size=(int(new_height), int(new_width)), mode="bilinear") new_sub_table = new_sub_table.permute(0, 2, 3, 1).reshape(new_num_relative_distance - 3, -1) new_relative_position_bias_table = torch.cat(