[Paper Review] Fast Segment Anything
FastSAM proposes a real-time, CNN-based alternative to SAM for the segment-anything task by performing all-instance segmentation with YOLOv8-seg and then prompting-guided selection, achieving comparable performance at ~50x speedups.
The recently proposed segment anything model (SAM) has made a significant influence in many computer vision tasks. It is becoming a foundation step for many high-level tasks, like image segmentation, image caption, and image editing. However, its huge computation costs prevent it from wider applications in industry scenarios. The computation mainly comes from the Transformer architecture at high-resolution inputs. In this paper, we propose a speed-up alternative method for this fundamental task with comparable performance. By reformulating the task as segments-generation and prompting, we find that a regular CNN detector with an instance segmentation branch can also accomplish this task well. Specifically, we convert this task to the well-studied instance segmentation task and directly train the existing instance segmentation method using only 1/50 of the SA-1B dataset published by SAM authors. With our method, we achieve a comparable performance with the SAM method at 50 times higher run-time speed. We give sufficient experimental results to demonstrate its effectiveness. The codes and demos will be released at https://github.com/CASIA-IVA-Lab/FastSAM.
Motivation & Objective
- Motivate real-time segment-anything applications in industry by reducing computational demands.
- Explore whether a CNN-based detector can match SAM's performance on the segment-anything task.
- Demonstrate the two-stage FastSAM framework (all-instance segmentation and prompt-guided selection) with significantly faster inference.
- Evaluate FastSAM on zero-shot tasks including edge detection, object proposal, and text-guided segmentation to test generalization.
Proposed method
- Reformulate segment-anything as a two-stage process: all-instance segmentation (AIS) followed by prompt-guided selection (PGS).
- Use YOLOv8-seg with an instance segmentation branch (YOLACT-style prototypes) for AIS to segment all objects in an image.
- Train on 2% (1/50) of the SA-1B dataset to learn robust masks with a CNN detector.
- Employ prompt-guided selection using point prompts, box prompts, and text prompts (via CLIP) to identify the target object(s) from the AIS masks.
- Leverage simple prompt encoders/decoders to map prompts to mask selections without end-to-end transformer-based segmentation.
- Provide speed comparisons showing 50x faster inference than SAM on RTX 3090 under various prompt settings.
Experimental results
Research questions
- RQ1Can a CNN-based detector with an instance segmentation branch achieve comparable segmentation performance to SAM on the segment-anything task while offering real-time speed?
- RQ2How does FastSAM perform on zero-shot tasks such as edge detection, object proposal generation, and text-guided segmentation compared to SAM?
- RQ3What are the strengths and limitations of decoupling segment-anything into AIS and PGS versus end-to-end transformer approaches?
- RQ4Can training on a fraction of SA-1B suffice to achieve competitive results in real-world applications?
Key findings
- FastSAM runs about 50x faster than SAM (32×32 prompt mode) on a single RTX 3090 while maintaining comparable performance.
- FastSAM achieves competitive edge detection results on BSDS500 in a zero-shot setup, with higher R50 and similar AP compared to SAM.
- For object proposals on COCO, FastSAM attains AR1000 of 63.7, slightly outperforming SAM with 32×32 prompts while being significantly faster.
- On LVIS v1, FastSAM shows strong AR@1000 for bbox and competitive mask AR@1000 against SAM, especially in zero-shot settings.
- FastSAM demonstrates robust zero-shot instance segmentation using ViTDet-provided boxes as prompts, though its AP on COCO/LVIS is lower than fully supervised methods and SAM in some settings.
- Text-prompt-based segmentation with CLIP is capable but slower due to CLIP embedding throughput, highlighting a trade-off between flexibility and speed.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.