wondervictor commited on
Commit
0221ae2
·
verified ·
1 Parent(s): 86bd2b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
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 = '/home/yongkangli/Mask-Adapter/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,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 = '/home/yongkangli/Mask-Adapter/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,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 = '/home/yongkangli/segment-anything-2/checkpoints/sam2.1_hiera_large.pt'
110
  adapter_pth = './model_0279999_with_sem_new.pth'
111
- cfg = '/home/yongkangli/Mask-Adapter/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)
 
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)