Update all files for SegEarth-OV
Browse files- test_pipelines.py +35 -0
test_pipelines.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Test all SegEarth pipelines load correctly. Run: conda activate ifedit && python test_pipelines.py [OV|OV-2|OV-3]"""
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
def main():
|
| 6 |
+
from pipeline import SegEarthPipeline
|
| 7 |
+
|
| 8 |
+
device = sys.argv[2] if len(sys.argv) > 2 else "cuda"
|
| 9 |
+
variants = [("OV", device), ("OV-2", device), ("OV-3", device)]
|
| 10 |
+
if len(sys.argv) > 1:
|
| 11 |
+
want = sys.argv[1]
|
| 12 |
+
variants = [(v, d) for v, d in variants if v == want]
|
| 13 |
+
if not variants:
|
| 14 |
+
print(f"Unknown variant: {want}")
|
| 15 |
+
sys.exit(1)
|
| 16 |
+
|
| 17 |
+
for variant, device in variants:
|
| 18 |
+
print(f"Loading {variant}...", end=" ", flush=True)
|
| 19 |
+
try:
|
| 20 |
+
pipe = SegEarthPipeline(variant=variant, device=device)
|
| 21 |
+
print("OK")
|
| 22 |
+
except ImportError as e:
|
| 23 |
+
if "sam3" in str(e) and variant == "OV-3":
|
| 24 |
+
print("SKIP (sam3 not installed)")
|
| 25 |
+
else:
|
| 26 |
+
print(f"FAIL: {e}")
|
| 27 |
+
raise
|
| 28 |
+
except Exception as e:
|
| 29 |
+
print(f"FAIL: {e}")
|
| 30 |
+
raise
|
| 31 |
+
|
| 32 |
+
print("All pipelines loaded successfully.")
|
| 33 |
+
|
| 34 |
+
if __name__ == "__main__":
|
| 35 |
+
main()
|