File size: 1,027 Bytes
463afdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python3
"""
Quick test script to verify ONNX models work
"""
import cv2
import numpy as np
from utils.model_loader import DepthAnythingV2
from pathlib import Path

print("Testing ONNX Depth-Anything V2 models...")

# Create a test image
test_image = np.random.randint(0, 255, (480, 640, 3), dtype=np.uint8)
print(f"Test image shape: {test_image.shape}")

# Test small model
small_model_path = Path("models/cache/depth_anything_v2_vits.onnx")
print(f"\nTesting small model: {small_model_path}")
print(f"Model exists: {small_model_path.exists()}")

try:
    model = DepthAnythingV2(str(small_model_path), use_gpu=False)
    print("✓ Model loaded successfully")

    print("Running inference...")
    depth = model.predict(test_image)
    print(f"✓ Inference successful!")
    print(f"  Output shape: {depth.shape}")
    print(f"  Output range: {depth.min():.3f} to {depth.max():.3f}")

except Exception as e:
    print(f"❌ Error: {type(e).__name__}: {str(e)}")
    import traceback
    traceback.print_exc()