BiliSakura commited on
Commit
02bdd46
·
verified ·
1 Parent(s): de228d2

Update all files for SegEarth-OV

Browse files
Files changed (1) hide show
  1. OV-3/pipeline.py +30 -0
OV-3/pipeline.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ SegEarth OV-3 pipeline. Self-contained; uses config.json. No featup (SAM3 native resolution).
3
+ """
4
+ import json
5
+ from pathlib import Path
6
+
7
+ import sys
8
+ _parent = Path(__file__).resolve().parent.parent
9
+ if str(_parent) not in sys.path:
10
+ sys.path.insert(0, str(_parent))
11
+ from pipeline import SegEarthPipelineSAM3
12
+
13
+
14
+ def load(config_path: Path = None, model_id: str = None, **kwargs):
15
+ """Load OV-3 pipeline with config from this folder."""
16
+ repo_dir = Path(__file__).parent
17
+ cfg_path = config_path or repo_dir / "config.json"
18
+ with open(cfg_path) as f:
19
+ cfg = json.load(f)
20
+ kwargs.setdefault("model_id", model_id or cfg["model_id"])
21
+ local_ckpt = cfg.get("local_checkpoint")
22
+ if local_ckpt:
23
+ local_path = repo_dir / local_ckpt
24
+ if local_path.exists():
25
+ kwargs.setdefault("local_checkpoint", local_path)
26
+ kwargs.setdefault("class_names_path", repo_dir / "configs" / "cls_openearthmap_sar.txt")
27
+ return SegEarthPipelineSAM3(**kwargs)
28
+
29
+
30
+ SegEarthPipeline = load