Spaces:
Running
on
Zero
Running
on
Zero
wondervictor
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -25,16 +25,10 @@ from mask_adapter.modeling.meta_arch.mask_adapter_head import build_mask_adapter
|
|
25 |
from mask_adapter.data.datasets import openseg_classes
|
26 |
|
27 |
COCO_CATEGORIES_pan = openseg_classes.get_coco_categories_with_prompt_eng()
|
28 |
-
thing_classes = [k["name"] for k in COCO_CATEGORIES_pan if k["isthing"] == 1]
|
29 |
stuff_classes = [k["name"] for k in COCO_CATEGORIES_pan]
|
30 |
ADE20K_150_CATEGORIES_ = openseg_classes.get_ade20k_categories_with_prompt_eng()
|
31 |
-
ade20k_thing_classes = [k["name"] for k in ADE20K_150_CATEGORIES_ if k["isthing"] == 1]
|
32 |
ade20k_stuff_classes = [k["name"] for k in ADE20K_150_CATEGORIES_]
|
33 |
-
class_names_coco_ade20k =
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
|
39 |
|
40 |
def setup_cfg(config_file):
|
@@ -125,7 +119,7 @@ def inference_point(input_img, img_state,class_names_input):
|
|
125 |
class_names_input = class_names_coco_ade20k
|
126 |
|
127 |
if class_names_input == class_names_coco_ade20k:
|
128 |
-
text_features = torch.from_numpy(np.load("./text_embedding/
|
129 |
_, visualized_output = demo.run_on_image_with_points(img_state.img, points,text_features)
|
130 |
else:
|
131 |
class_names_input = class_names_input.split(',')
|
@@ -167,7 +161,7 @@ def inference_box(input_img, img_state,class_names_input):
|
|
167 |
class_names_input = class_names_coco_ade20k
|
168 |
|
169 |
if class_names_input == class_names_coco_ade20k:
|
170 |
-
text_features = torch.from_numpy(np.load("./text_embedding/
|
171 |
_, visualized_output = demo.run_on_image_with_boxes(img_state.img, bbox,text_features)
|
172 |
else:
|
173 |
class_names_input = class_names_input.split(',')
|
|
|
25 |
from mask_adapter.data.datasets import openseg_classes
|
26 |
|
27 |
COCO_CATEGORIES_pan = openseg_classes.get_coco_categories_with_prompt_eng()
|
|
|
28 |
stuff_classes = [k["name"] for k in COCO_CATEGORIES_pan]
|
29 |
ADE20K_150_CATEGORIES_ = openseg_classes.get_ade20k_categories_with_prompt_eng()
|
|
|
30 |
ade20k_stuff_classes = [k["name"] for k in ADE20K_150_CATEGORIES_]
|
31 |
+
class_names_coco_ade20k = stuff_classes + ade20k_stuff_classes
|
|
|
|
|
|
|
|
|
32 |
|
33 |
|
34 |
def setup_cfg(config_file):
|
|
|
119 |
class_names_input = class_names_coco_ade20k
|
120 |
|
121 |
if class_names_input == class_names_coco_ade20k:
|
122 |
+
text_features = torch.from_numpy(np.load("./text_embedding/coco_ade20k_text_embedding_new.npy")).cuda()
|
123 |
_, visualized_output = demo.run_on_image_with_points(img_state.img, points,text_features)
|
124 |
else:
|
125 |
class_names_input = class_names_input.split(',')
|
|
|
161 |
class_names_input = class_names_coco_ade20k
|
162 |
|
163 |
if class_names_input == class_names_coco_ade20k:
|
164 |
+
text_features = torch.from_numpy(np.load("./text_embedding/coco_ade20k_text_embedding_new.npy")).cuda()
|
165 |
_, visualized_output = demo.run_on_image_with_boxes(img_state.img, bbox,text_features)
|
166 |
else:
|
167 |
class_names_input = class_names_input.split(',')
|