SegEarth-OV / test_ov3_simple.py
BiliSakura's picture
Update all files for SegEarth-OV
5c64a8f verified
#!/usr/bin/env python3
"""Simple OV-3 test. Run: conda activate rsgen && python test_ov3_simple.py
Requires: sam3, pycocotools (pip install pycocotools if missing)."""
from pathlib import Path
from PIL import Image
from pipeline import SegEarthPipeline
if __name__ == "__main__":
repo = Path(__file__).resolve().parent
img_path = repo / "demo_YESeg-OPT-SAR" / "sar.png"
if not img_path.exists():
img_path = repo / "demo.png"
if not img_path.exists():
print("No demo image found")
exit(1)
print("Loading OV-3...")
pipe = SegEarthPipeline(variant="OV-3", device="cuda")
print("Running inference...")
img = Image.open(img_path).convert("RGB")
pred = pipe(img)
print(f"OK shape={pred.shape} classes={pred.unique().tolist()}")