This repository is based on the instructions on:
https://github.com/facebookresearch/segment-anything-2
git clone https://github.com/onosAdmin/sam2-test.git
cd sam2-test
git clone https://github.com/facebookresearch/segment-anything-2
cd segment-anything-2
python3 -m venv env
source env/bin/activate
pip install -e .
pip install matplotlib opencv-python
Edit the script mask_test.py replacing your image path in: image_path = 'img0.jpg'
cd checkpoints
./download_ckpts.sh
cd ..
cp ../test.py .
cp ../mask_test.py .
Change the used checkpoints and config based on the checkpoints used inside the test.py and mask_test.py scripts
sam2_checkpoint = "./checkpoints/sam2_hiera_small.pt"
model_cfg = "sam2_hiera_s.yaml"
python test.py