fix sam2 hopefully

This commit is contained in:
2025-07-26 08:03:37 -07:00
parent 1bec8113de
commit eeed9ee578
6 changed files with 187 additions and 17 deletions

View File

@@ -29,12 +29,35 @@ mkdir -p models
# Download YOLOv8 models
python -c "from ultralytics import YOLO; YOLO('yolov8n.pt'); YOLO('yolov8m.pt')"
# Download SAM2 checkpoint
# Download SAM2 checkpoints
cd models
echo "📥 Downloading SAM2 models..."
# Try different SAM2 model versions
if [ ! -f "sam2_hiera_large.pt" ]; then
echo "Downloading SAM2 model weights..."
wget -q --show-progress https://dl.fbaipublicfiles.com/segment_anything_2/sam2_hiera_large.pt
echo "Trying SAM2 checkpoint version 1..."
wget -q --show-progress https://dl.fbaipublicfiles.com/segment_anything_2/sam2_hiera_large.pt || true
fi
if [ ! -f "sam2.1_hiera_large.pt" ]; then
echo "Trying SAM2.1 checkpoint (latest)..."
wget -q --show-progress https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_large.pt || true
fi
# Download SAM2 config files
cd ..
mkdir -p sam2_configs
cd sam2_configs
echo "📥 Downloading SAM2 configuration files..."
wget -q --show-progress https://raw.githubusercontent.com/facebookresearch/segment-anything-2/main/sam2_configs/sam2_hiera_b+.yaml
wget -q --show-progress https://raw.githubusercontent.com/facebookresearch/segment-anything-2/main/sam2_configs/sam2_hiera_l.yaml
wget -q --show-progress https://raw.githubusercontent.com/facebookresearch/segment-anything-2/main/sam2_configs/sam2_hiera_s.yaml
wget -q --show-progress https://raw.githubusercontent.com/facebookresearch/segment-anything-2/main/sam2_configs/sam2_hiera_t.yaml
wget -q --show-progress https://raw.githubusercontent.com/facebookresearch/segment-anything-2/main/sam2_configs/sam2.1_hiera_b+.yaml
wget -q --show-progress https://raw.githubusercontent.com/facebookresearch/segment-anything-2/main/sam2_configs/sam2.1_hiera_l.yaml
wget -q --show-progress https://raw.githubusercontent.com/facebookresearch/segment-anything-2/main/sam2_configs/sam2.1_hiera_s.yaml
wget -q --show-progress https://raw.githubusercontent.com/facebookresearch/segment-anything-2/main/sam2_configs/sam2.1_hiera_t.yaml
cd ..
# Create working directories
@@ -45,6 +68,18 @@ echo ""
echo "🧪 Testing installation..."
python test_installation.py
# Check which SAM2 model is available
echo ""
echo "📊 SAM2 Models available:"
if [ -f "models/sam2_hiera_large.pt" ]; then
echo " ✅ sam2_hiera_large.pt"
echo " Use in config: sam2_checkpoint: 'models/sam2_hiera_large.pt'"
fi
if [ -f "models/sam2.1_hiera_large.pt" ]; then
echo " ✅ sam2.1_hiera_large.pt (recommended)"
echo " Use in config: sam2_checkpoint: 'models/sam2.1_hiera_large.pt'"
fi
echo ""
echo "✅ Setup complete!"
echo ""