The code provides python script for performing segmentation using Facebook's recent Segment Anything Model (SAM). You can also used anaconda prompt to perform command-line inference.
The code heavily borrows from original SAM repository. Follow the instructions to perform the segmentation
First install segment anything throup pip using following command:
pip install git+https://github.com/facebookresearch/segment-anything.git
Make sure to install relevant packages such as
pip install opencv-python pycocotools matplotlib onnxruntime onnx
Download pre-trained model checkpoint from https://github.com/facebookresearch/segment-anything#model-checkpoints
The code is annotated so if you want to play with the parameters, you can modify them, accordingly.
Make sure you keep the model and test image in the same directory and run the following command
python segment_SAM.py
Sample Results.