BiliSakura commited on
Commit
5c64a8f
·
verified ·
1 Parent(s): 9fd5afd

Update all files for SegEarth-OV

Browse files
Files changed (1) hide show
  1. test_ov3_simple.py +24 -0
test_ov3_simple.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Simple OV-3 test. Run: conda activate rsgen && python test_ov3_simple.py
3
+ Requires: sam3, pycocotools (pip install pycocotools if missing)."""
4
+ from pathlib import Path
5
+
6
+ from PIL import Image
7
+
8
+ from pipeline import SegEarthPipeline
9
+
10
+ if __name__ == "__main__":
11
+ repo = Path(__file__).resolve().parent
12
+ img_path = repo / "demo_YESeg-OPT-SAR" / "sar.png"
13
+ if not img_path.exists():
14
+ img_path = repo / "demo.png"
15
+ if not img_path.exists():
16
+ print("No demo image found")
17
+ exit(1)
18
+
19
+ print("Loading OV-3...")
20
+ pipe = SegEarthPipeline(variant="OV-3", device="cuda")
21
+ print("Running inference...")
22
+ img = Image.open(img_path).convert("RGB")
23
+ pred = pipe(img)
24
+ print(f"OK shape={pred.shape} classes={pred.unique().tolist()}")