Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -35,7 +35,7 @@ def setup_cfg(config_file):
|
|
35 |
|
36 |
def inference_automatic(input_img, class_names):
|
37 |
mp.set_start_method("spawn", force=True)
|
38 |
-
config_file = '
|
39 |
cfg = setup_cfg(config_file)
|
40 |
|
41 |
demo = SAMVisualizationDemo(cfg, 0.8, sam2_model, clip_model,mask_adapter)
|
@@ -51,12 +51,12 @@ def inference_point(input_img, evt: gr.SelectData,):
|
|
51 |
# In point mode, implement the logic to process points from the user click (x, y)
|
52 |
# You can adjust your segmentation logic based on clicked points.
|
53 |
x, y = evt.index[0], evt.index[1]
|
54 |
-
points = [[x, y]]
|
55 |
print(f"Selected point: {points}")
|
56 |
import time
|
57 |
start_time = time.time()
|
58 |
mp.set_start_method("spawn", force=True)
|
59 |
-
config_file = '
|
60 |
cfg = setup_cfg(config_file)
|
61 |
|
62 |
demo = SAMPointVisualizationDemo(cfg, 0.8, sam2_model, clip_model,mask_adapter)
|
@@ -106,9 +106,9 @@ def initialize_models(sam_path, adapter_pth, model_cfg, cfg):
|
|
106 |
|
107 |
# 初始化配置和模型
|
108 |
model_cfg = "configs/sam2.1/sam2.1_hiera_l.yaml"
|
109 |
-
sam_path = '
|
110 |
adapter_pth = './model_0279999_with_sem_new.pth'
|
111 |
-
cfg = '
|
112 |
|
113 |
# 调用初始化函数
|
114 |
initialize_models(sam_path, adapter_pth, model_cfg, cfg)
|
|
|
35 |
|
36 |
def inference_automatic(input_img, class_names):
|
37 |
mp.set_start_method("spawn", force=True)
|
38 |
+
config_file = './configs/ground-truth-warmup/mask-adapter/mask_adapter_convnext_large_cocopan_eval_ade20k.yaml'
|
39 |
cfg = setup_cfg(config_file)
|
40 |
|
41 |
demo = SAMVisualizationDemo(cfg, 0.8, sam2_model, clip_model,mask_adapter)
|
|
|
51 |
# In point mode, implement the logic to process points from the user click (x, y)
|
52 |
# You can adjust your segmentation logic based on clicked points.
|
53 |
x, y = evt.index[0], evt.index[1]
|
54 |
+
points = [[x, y]]
|
55 |
print(f"Selected point: {points}")
|
56 |
import time
|
57 |
start_time = time.time()
|
58 |
mp.set_start_method("spawn", force=True)
|
59 |
+
config_file = './configs/ground-truth-warmup/mask-adapter/mask_adapter_convnext_large_cocopan_eval_ade20k.yaml'
|
60 |
cfg = setup_cfg(config_file)
|
61 |
|
62 |
demo = SAMPointVisualizationDemo(cfg, 0.8, sam2_model, clip_model,mask_adapter)
|
|
|
106 |
|
107 |
# 初始化配置和模型
|
108 |
model_cfg = "configs/sam2.1/sam2.1_hiera_l.yaml"
|
109 |
+
sam_path = './sam2.1_hiera_large.pt'
|
110 |
adapter_pth = './model_0279999_with_sem_new.pth'
|
111 |
+
cfg = './configs/ground-truth-warmup/mask-adapter/mask_adapter_convnext_large_cocopan_eval_ade20k.yaml'
|
112 |
|
113 |
# 调用初始化函数
|
114 |
initialize_models(sam_path, adapter_pth, model_cfg, cfg)
|