Tool Sharing#
FastSAM is a CNN Segment Anything model trained using only 2% of the SA-1B dataset. FastSAM achieves performance comparable to the SAM method at 50 times the speed.
Features#
FastSAM is officially introduced as being 50 times faster than SAM while achieving the same performance. The model is based on the YoloV8 architecture and has much lower training costs compared to SAM.
Deployment#
-
Installation
git clone https://github.com/CASIA-IVA-Lab/FastSAM.git && cd FastSAM pip install git+https://github.com/openai/CLIP.git conda create -n FastSAM python=3.9 conda activate FastSAM pip install -r requirements.txt
-
Usage
# Everything mode python Inference.py --model_path ./weights/FastSAM.pt --img_path ./images/dogs.jpg # Text prompt segmentation with CLIP assistance python Inference.py --model_path ./weights/FastSAM.pt --img_path ./images/dogs.jpg --text_prompt "the yellow dog" # Box prompt mode python Inference.py --model_path ./weights/FastSAM.pt --img_path ./images/dogs.jpg --box_prompt "[570,200,230,400]" # Click mode python Inference.py --model_path ./weights/FastSAM.pt --img_path ./images/dogs.jpg --point_prompt "[[520,360],[620,300]]" --point_label "[1,0]"
Platform#
Disclaimer#
This article is solely for the purpose of sharing tools.
This article is synchronized with HBlog.