-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_same2.py
More file actions
85 lines (72 loc) · 2.39 KB
/
test_same2.py
File metadata and controls
85 lines (72 loc) · 2.39 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import sys
import os
# Add SAM2 paths
sys.path.insert(0, r'C:\Users\user\Codings\sam2davis\sam2')
sys.path.insert(0, r'C:\Users\user\Codings\sam2davis')
print("=== SAM2 Installation Verification ===")
# Test PyTorch and CUDA
try:
import torch
print(f"✓ PyTorch: {torch.__version__}")
print(f"✓ CUDA Available: {torch.cuda.is_available()}")
if torch.cuda.is_available():
print(f"✓ GPU: {torch.cuda.get_device_name(0)}")
print(f"✓ CUDA Version: {torch.version.cuda}")
except ImportError as e:
print(f"✗ PyTorch import failed: {e}")
# Test SAM2 imports
try:
import sam2
print("✓ SAM2 package imported")
except ImportError as e:
print(f"✗ SAM2 import failed: {e}")
try:
from sam2.build_sam import build_sam2
print("✓ SAM2 build_sam imported")
except ImportError as e:
print(f"✗ SAM2 build_sam import failed: {e}")
try:
from sam2.sam2_image_predictor import SAM2ImagePredictor
print("✓ SAM2ImagePredictor imported")
except ImportError as e:
print(f"✗ SAM2ImagePredictor import failed: {e}")
# Test training dependencies
training_deps = [
'hydra', 'omegaconf', 'tensordict', 'pycocotools',
'tensorboard', 'pandas', 'cv2', 'matplotlib'
]
print("\n=== Training Dependencies ===")
for dep in training_deps:
try:
__import__(dep)
print(f"✓ {dep}")
except ImportError:
print(f"✗ {dep} - MISSING")
# Test Grounded-SAM-2 dependencies
grounded_deps = ['transformers', 'supervision', 'timm']
print("\n=== Grounded-SAM-2 Dependencies ===")
for dep in grounded_deps:
try:
__import__(dep)
print(f"✓ {dep}")
except ImportError:
print(f"✗ {dep} - MISSING")
print("\n=== Checkpoint Verification ===")
checkpoint_path = r'C:\Users\user\Codings\sam2davis\checkpoints\sam2.1_hiera_base_plus.pt'
if os.path.exists(checkpoint_path):
size_mb = os.path.getsize(checkpoint_path) / 1024**2
print(f"✓ SAM2 checkpoint: {size_mb:.1f} MB")
else:
print("✗ SAM2 checkpoint missing")
print("\n=== Directory Structure ===")
required_dirs = [
r'C:\Users\user\Codings\sam2davis\sam2',
r'C:\Users\user\Codings\sam2davis\Grounded-SAM-2',
r'C:\Users\user\Codings\sam2-onnx'
]
for dir_path in required_dirs:
if os.path.exists(dir_path):
print(f"✓ {dir_path}")
else:
print(f"✗ {dir_path} - MISSING")
print("\n=== Installation Verification Complete ===")