Models
Grounded SAM vs. FastSAM

Grounded SAM vs. FastSAM

Both Grounded SAM and FastSAM are commonly used in computer vision projects. Below, we compare and contrast Grounded SAM and FastSAM.

Models

icon-model

Grounded SAM

GroundedSAM combines Grounding DINO with the Segment Anything Model to identify and segment objects in an image given text captions.
icon-model

FastSAM

FastSAM is an image segmentation model trained using 2% of the data in the Segment Anything Model SA-1B dataset.
Model Type
Instance Segmentation
--
Instance Segmentation
--
Model Features
Item 1 Info
Item 2 Info
Architecture
Combination of Grounding DINO and Segment Anything
--
--
Frameworks
--
PyTorch
--
Annotation Format
Instance Segmentation
Instance Segmentation
GitHub Stars
14.0k
--
7.1k+
--
License
Apache 2.0
--
AGPL-3.0
--
Training Notebook
Compare Alternatives
--
Compare with...
--
Compare with...

Compare Grounded SAM and FastSAM with Autodistill

Using Autodistill, you can compare Grounded SAM and FastSAM on your own images in a few lines of code.

Here is an example comparison:

To start a comparison, first install the required dependencies:


pip install autodistill autodistill-grounded-sam autodistill-fastsam

Next, create a new Python file and add the following code:


from autodistill_grounded_sam import GroundedSAM
from autodistill_fastsam import FastSAM

from autodistill.detection import CaptionOntology
from autodistill.utils import compare

ontology = CaptionOntology(
    {
        "solar panel": "solar panel",
    }
)

models = [
    GroundedSAM(ontology=ontology),
    FastSAM(ontology=ontology)
]

images = [
    "/home/user/autodistill/solarpanel1.jpg",
    "/home/user/autodistill/solarpanel2.jpg"
]

compare(
    models=models,
    images=images
)

Above, replace the images in the `images` directory with the images you want to use.

The images must be absolute paths.

Then, run the script.

You should see a model comparison like this:

When you have chosen a model that works best for your use case, you can auto label a folder of images using the following code:


base_model.label(
  input_folder="./images",
  output_folder="./dataset",
  extension=".jpg"
)

Compare Grounded SAM vs. FastSAM

Provide your own image below to test YOLOv8 and YOLOv9 model checkpoints trained on the Microsoft COCO dataset.

COCO can detect 80 common objects, including cats, cell phones, and cars.