SegEarth-OV / OV-3 /pipeline.py
BiliSakura's picture
Update all files for SegEarth-OV
02bdd46 verified
"""
SegEarth OV-3 pipeline. Self-contained; uses config.json. No featup (SAM3 native resolution).
"""
import json
from pathlib import Path
import sys
_parent = Path(__file__).resolve().parent.parent
if str(_parent) not in sys.path:
sys.path.insert(0, str(_parent))
from pipeline import SegEarthPipelineSAM3
def load(config_path: Path = None, model_id: str = None, **kwargs):
"""Load OV-3 pipeline with config from this folder."""
repo_dir = Path(__file__).parent
cfg_path = config_path or repo_dir / "config.json"
with open(cfg_path) as f:
cfg = json.load(f)
kwargs.setdefault("model_id", model_id or cfg["model_id"])
local_ckpt = cfg.get("local_checkpoint")
if local_ckpt:
local_path = repo_dir / local_ckpt
if local_path.exists():
kwargs.setdefault("local_checkpoint", local_path)
kwargs.setdefault("class_names_path", repo_dir / "configs" / "cls_openearthmap_sar.txt")
return SegEarthPipelineSAM3(**kwargs)
SegEarthPipeline = load