Skip to content

The code provides python code for performing segmentation using Facebook's recent Segment Anything Model (SAM). You can also used anaconda prompt to perform command-line inference.

Notifications You must be signed in to change notification settings

sander-ali/SAM_inference

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

SAM_inference

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.

image

image

Figure_1

About

The code provides python code for performing segmentation using Facebook's recent Segment Anything Model (SAM). You can also used anaconda prompt to perform command-line inference.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages