Spaces:
Runtime error
Runtime error
fixed resize
Browse files
app.py
CHANGED
@@ -24,7 +24,7 @@ from segmentation.evaluation import (GROUP_PALETTE, build_seg_demo_pipeline,
|
|
24 |
from utils import get_config, load_checkpoint
|
25 |
|
26 |
os.chdir('GroupViT')
|
27 |
-
# checkpoint_url = 'https://github.com/xvjiarui/GroupViT/releases/download/v1.0.0/group_vit_gcc_yfcc_30e-74d335e6.pth'
|
28 |
checkpoint_url = 'https://github.com/xvjiarui/GroupViT/releases/download/v1.0.0/group_vit_gcc_yfcc_30e-879422e0.pth'
|
29 |
cfg_path = 'configs/group_vit_gcc_yfcc_30e.yml'
|
30 |
output_dir = 'demo/output'
|
@@ -100,7 +100,7 @@ def inference(dataset, additional_classes, input_img):
|
|
100 |
else:
|
101 |
data['img_metas'] = [i.data[0] for i in data['img_metas']]
|
102 |
with torch.no_grad():
|
103 |
-
result = seg_model(return_loss=False, rescale=
|
104 |
|
105 |
img_tensor = data['img'][0]
|
106 |
img_metas = data['img_metas'][0]
|
@@ -112,8 +112,15 @@ def inference(dataset, additional_classes, input_img):
|
|
112 |
h, w, _ = img_meta['img_shape']
|
113 |
img_show = img[:h, :w, :]
|
114 |
|
115 |
-
ori_h, ori_w = img_meta['ori_shape'][:-1]
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
for vis_mode in vis_modes:
|
119 |
out_file = osp.join(output_dir, 'vis_imgs', vis_mode,
|
|
|
24 |
from utils import get_config, load_checkpoint
|
25 |
|
26 |
os.chdir('GroupViT')
|
27 |
+
# checkpoint_url = 'https://github.com/xvjiarui/GroupViT-1/releases/download/v1.0.0/group_vit_gcc_yfcc_30e-74d335e6.pth'
|
28 |
checkpoint_url = 'https://github.com/xvjiarui/GroupViT/releases/download/v1.0.0/group_vit_gcc_yfcc_30e-879422e0.pth'
|
29 |
cfg_path = 'configs/group_vit_gcc_yfcc_30e.yml'
|
30 |
output_dir = 'demo/output'
|
|
|
100 |
else:
|
101 |
data['img_metas'] = [i.data[0] for i in data['img_metas']]
|
102 |
with torch.no_grad():
|
103 |
+
result = seg_model(return_loss=False, rescale=False, **data)
|
104 |
|
105 |
img_tensor = data['img'][0]
|
106 |
img_metas = data['img_metas'][0]
|
|
|
112 |
h, w, _ = img_meta['img_shape']
|
113 |
img_show = img[:h, :w, :]
|
114 |
|
115 |
+
# ori_h, ori_w = img_meta['ori_shape'][:-1]
|
116 |
+
|
117 |
+
# short_side = 448
|
118 |
+
# if ori_h > ori_w:
|
119 |
+
# new_h, new_w = ori_h * short_side//ori_w , short_side
|
120 |
+
# else:
|
121 |
+
# new_w, new_h = ori_w * short_side//ori_h , short_side
|
122 |
+
|
123 |
+
# img_show = mmcv.imresize(img_show, (new_w, new_h))
|
124 |
|
125 |
for vis_mode in vis_modes:
|
126 |
out_file = osp.join(output_dir, 'vis_imgs', vis_mode,
|