How to Use Segment Anything Model for Image Segmentation (2026)

Quick answer

To use Segment Anything Model for image segmentation, install Meta's official package with pip install git+https://github.com/facebookresearch/segment-anything.git, download one official checkpoint such as sam_vit_b_01ec64.pth, then load it with sam_model_registry and prompt it with a point or a box. The software licence fee is $0 under Apache 2.0. Start with one product photo and one foreground point, pick the mask with the best predicted quality score, and inspect the edges at 100% zoom before you batch anything.

Quick Answer

To use Segment Anything Model for image segmentation, install Meta’s official package with pip install git+https://github.com/facebookresearch/segment-anything.git, download one official checkpoint such as sam_vit_b_01ec64.pth, then load it with sam_model_registry and prompt it with a point or a box. The software licence fee is $0 under Apache 2.0. Start with one product photo and one foreground point, pick the mask with the best predicted quality score, and inspect the edges at 100% zoom before you batch anything.

In this article

  • How we checked this guide
  • Read this first: what SAM is, licence, and project status
  • What SAM replaces, and what it does not
  • How SAM, prompts, and checkpoints fit together
  • Routes to use Segment Anything Model for image segmentation
  • Requirements before you install
  • Step 1: install Segment Anything Model for image segmentation
  • Step 2: download a checkpoint and make your first mask
  • Step 3: prompt with points, boxes, and automatic masks
  • Step 4: turn masks into business output safely
  • First-run security steps you must not skip
  • Backup and update routine
  • Common errors and fixes
  • Tips and tricks that save money
  • The real cost maths
  • When not to use Segment Anything Model for image segmentation
  • Pros and cons
  • Our verdict
  • FAQ
  • Strategic Pivot
  • Sources

How we checked this guide

We checked the official Segment Anything GitHub repository on December 5, 2026. That covers the Python, PyTorch, and TorchVision requirements, both install routes, the optional dependencies, the three model checkpoints, the predictor and automatic mask examples, the command-line mask script, and the ONNX export route.

For the paid comparison, we checked the official Roboflow pricing page on December 5, 2026. Every Roboflow figure below comes from that official page, including its Free Tier and Core plan, not from a roundup or review site.

Read this first: what SAM is, licence, and project status

Segment Anything official GitHub repository to use Segment Anything Model for image segmentation

The Segment Anything Model, SAM, produces high-quality object masks from input prompts such as points or boxes. In plain words, you point at the thing you want cut out, and SAM draws the outline for you. It can also generate masks for all objects in an image when you do not want to prompt one object at a time.

SAM comes from Meta AI Research, FAIR. The repository says the model was trained on a dataset of 11 million images and 1.1 billion masks, and that it has strong zero-shot performance on a variety of segmentation tasks. Zero-shot is the business point: you do not train a new model for every product, chair, shoe, or person you need to outline.

The model is licensed under the Apache 2.0 license. In plain words, the software licence fee is $0, and a business may use, copy, modify, and distribute the software, including in commercial products, subject to the Apache conditions: keep the licence and copyright notices, state significant changes you make, and respect the patent and trademark terms.

That licence covers the SAM model and code. It does not erase the separate rights attached to your input photos, client images, or any other model you combine with SAM. The training dataset is a separate matter again: downloading the SA-1B dataset means accepting the SA-1B Dataset Research License. Do not treat the dataset terms and the model terms as the same document.

Project status needs one honest sentence. The SAM repository is public and not archived, and it still provides the inference code, checkpoint links, and example notebooks. Its latest-updates section points readers to Segment Anything Model 2, SAM 2, Meta’s newer foundation model for promptable segmentation in images and videos. For still-image masks, SAM remains the simple, documented route in this guide. For video segmentation, look at SAM 2 instead of forcing SAM to do a video job.

What SAM replaces, and what it does not

SAM replaces the slow manual outline. Anyone who has traced a product edge with a pen tool, cleaned a hairline mask by hand, or paid for repeated cutouts knows the cost. SAM turns that tracing job into a prompt: one point inside the object, one box around it, or a set of points that say “this, not that.”

It also replaces the “train a segmentation model for every new object” step for many small-business jobs. A shop that photographs new products every week does not need a labelled dataset before the first mask. SAM’s zero-shot design is built for objects it was never specifically trained on by you.

SAM pairs naturally with the rest of an image workflow. A mask is the input to background removal, product cutouts, local edits, and inpainting. Our IOPaint install guide covers the editing side of that workflow, where a good mask decides what gets changed and what stays untouched.

SAM does not replace judgement about what the object is. SAM returns masks, not meaning. It will outline the shoe, the box, and the shadow if you prompt carelessly. It does not know which outline is your product, which is packaging, and which is a prop you meant to exclude. Your prompt and your inspection supply that meaning.

It does not take text prompts in this release. SAM prompts are points, boxes, and mask inputs. If a tool claims “type the object name and SAM finds it,” some other model is doing the finding and handing SAM a box. That can be a fine workflow, but it is not SAM alone, and the other model’s licence and errors come with it.

It does not replace consent or photo rights. Apache 2.0 covers the software, not the people and products in your images. Cutting out a client’s product for their own listing is ordinary work. Reusing someone else’s photo in advertising is a rights problem no mask quality solves.

How SAM, prompts, and checkpoints fit together

Think of SAM as three parts. The image encoder reads your image once and builds an internal representation. The prompt tells the model which object you mean. The mask decoder turns the image representation plus your prompt into one or more masks, with a predicted quality score for each.

The official predictor reflects that split. You call set_image once for an image, then call predict for each prompt. That matters for cost and speed: the expensive image reading happens once, and repeated prompts on the same image stay comparatively cheap.

Prompts come in three forms. A point prompt is an (X, Y) pixel coordinate labelled 1 for foreground or 0 for background. A box prompt is a length-4 XYXY array around the object. A mask input feeds a previous prediction back in for refinement.

With multimask_output=True, the predictor returns three masks. That is the right setting for an ambiguous single click, because one point on a shirt could mean the shirt, the person, or the whole outfit. The model returns a predicted quality score with each mask, and the official code says that score can be used to select the best mask. With clear, multiple prompts, multimask_output=False can give better results.

Three checkpoints are available with different backbone sizes: vit_h, the default, plus vit_l and vit_b. The backbone is the image-reading part of the model, so the choice trades model size against speed and mask quality on your hardware. The repository does not publish one universal hardware minimum, and we will not invent one. Start with vit_b on modest hardware, prove the workflow, then compare vit_h on the same images before you commit.

Automatic masks are the third mode. SamAutomaticMaskGenerator segments an entire image without a prompt, and scripts/amg.py does the same from the command line. Automatic mode is powerful for exploration and dangerous for production: filter its output before anything reaches a customer.

Mask records carry quality signals worth using: a predicted_iou score, the model’s own prediction of the mask’s quality, and a stability_score. Treat low scores as “inspect or discard,” not as decoration.

Routes to use Segment Anything Model for image segmentation

Segment Anything official project page to use Segment Anything Model for image segmentation
RouteBest forSkip ifWhat you use
pip install from the official repositoryMost technical operators who want the documented predictor in their own Python environmentYou have never used a terminal or Python environmentpip install git+https://github.com/facebookresearch/segment-anything.git, then a downloaded checkpoint
Clone and editable installOperators who want the notebooks, scripts, and code in front of themYou only need the package, not the repository filesClone the repository, then pip install -e .
Command-line automatic masksFolder-level exploration and first-pass cutoutsEvery output must be customer-ready without inspectionpython scripts/amg.py with a checkpoint, model type, input, and output path
ONNX export for browser or app useTeams embedding mask prediction in a web page or productYou are still proving mask quality on your imagesscripts/export_onnx_model.py, then an ONNX runtime
Hosted vision platformTeams that want training, labelling, deployment, and support in one subscriptionYou only need masks and can run PythonA paid platform such as Roboflow, priced in the cost maths below

The pip route is the right default for most small businesses that can run one documented command. It is the route the project documents first, it keeps private product and client photos on your own machine, and it gives you every prompt type the model supports.

The clone route earns its place when you want the example notebooks on prompts and automatic masks: correct prompt code beats guessed parameter names.

Requirements before you install

The code requires Python >= 3.8, PyTorch >= 1.7, and TorchVision >= 0.8. The repository tells you to follow the official PyTorch instructions to install PyTorch and TorchVision, and it strongly recommends installing both with CUDA support. CUDA is the NVIDIA GPU path, and it is the practical route for folders of images.

Optional dependencies cover the work around the masks. The repository lists opencv-python, pycocotools, matplotlib, onnxruntime, and onnx as necessary for mask post-processing, saving masks in COCO format, the example notebooks, and exporting the model in ONNX format. Jupyter is also required to run the example notebooks.

Hardware decides your checkpoint. Start with vit_b and one real product photo, then compare vit_h on the same photo at 100% zoom.

Step 1: install Segment Anything Model for image segmentation

Create a clean environment first. Make a dedicated Python environment for SAM and activate it, so its PyTorch and TorchVision versions stay pinned to a combination you have tested. Install PyTorch >= 1.7 and TorchVision >= 0.8 for your hardware from the official PyTorch route, with CUDA support if you have an NVIDIA GPU.

Install Segment Anything from the official repository:

pip install git+https://github.com/facebookresearch/segment-anything.git

Use that official route only. Do not grab a “Segment Anything free download” bundle from a random download portal, and do not run install scripts from a fork you have not read. The address above is the one the project’s own documentation gives.

If you want the notebooks and scripts in front of you, clone the repository and install it in editable mode instead:

git clone https://github.com/facebookresearch/segment-anything.git
cd segment-anything
pip install -e .

Then install the optional dependencies your workflow needs:

pip install opencv-python pycocotools matplotlib onnxruntime onnx

You need OpenCV for ordinary image loading and saving, pycocotools for COCO-format masks, matplotlib and Jupyter for the example notebooks, and the ONNX packages only when you export the model. Installing all five at once is harmless and saves a second trip later.

Step 2: download a checkpoint and make your first mask

Download a model checkpoint from the official links. The three official files are sam_vit_h_4b8939.pth for vit_h, sam_vit_l_0b3195.pth for vit_l, and sam_vit_b_01ec64.pth for vit_b. Start with vit_b while you prove the workflow:

wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth

On Windows, download the same file from the official checkpoint link in your browser and note the folder you saved it in. The checkpoint path and the model type must agree: a vit_b file loaded as vit_h is a self-inflicted error.

Load the model and set one test image. Choose a real example of your work: a product on a plain background first, because you are testing the install, not the model’s limits.

from segment_anything import SamPredictor, sam_model_registry

sam = sam_model_registry["vit_b"](checkpoint="sam_vit_b_01ec64.pth")
predictor = SamPredictor(sam)
predictor.set_image(your_image)

Here your_image is your loaded image in the format the predictor expects. The official code expects an image in HWC uint8 format, with pixel values in [0, 255]. If your masks look like noise, check the image format and colour order before you blame the model.

Now prompt with one foreground point inside the object. Point coordinates are (X, Y) in pixels, and the label 1 means foreground:

import numpy as np

input_point = np.array([[500, 375]])
input_label = np.array([1])

masks, scores, logits = predictor.predict(
    point_coords=input_point,
    point_labels=input_label,
    multimask_output=True,
)

Replace 500 and 375 with a point that actually sits inside your object. With multimask_output=True you get three masks back, because one click can be ambiguous. Pick the mask with the best score, then look at it overlaid on the photo at 100% zoom. Check the edges your customer will see: straps, hair, glass, shadows, and the boundary where the object meets the background.

If the best mask holds the edge and excludes the background, the install works. If it grabs too much or too little, change the prompt before you change the tool. Prompting is the skill this model rewards.

Step 3: prompt with points, boxes, and automatic masks

Segment Anything official notebooks to use Segment Anything Model for image segmentation

Point prompts improve with background points. Add a point labelled 0 on the part the model wrongly included, and keep the foreground point inside the object. Two or three well-placed points usually settle what one point leaves ambiguous. With clear multiple prompts, set multimask_output=False for a single committed mask.

Box prompts suit objects you can frame. A box is a length-4 array in XYXY format: the left, top, right, and bottom pixel coordinates around the object. A box plus one foreground point is a strong combination for products, because the box limits the search area and the point names the object inside it.

masks, scores, logits = predictor.predict(
    point_coords=np.array([[500, 375]]),
    point_labels=np.array([1]),
    box=np.array([400, 300, 700, 600]),
    multimask_output=False,
)

Automatic masks suit exploration. SamAutomaticMaskGenerator segments the whole image, and the command-line script does the same for an image or a folder:

python scripts/amg.py --checkpoint sam_vit_b_01ec64.pth --model-type vit_b --input your_image_or_folder --output your_output_folder

Use automatic mode to discover what SAM sees in a scene, to draft first-pass cutouts, or to build a review queue. Then filter. Sort masks by area and quality signals, discard the fragments, and inspect the survivors. Automatic output that skips inspection is how a shadow ends up in a product listing.

Step 4: turn masks into business output safely

A mask becomes business output in three common forms. A cutout applies the mask to the photo and keeps the object on transparency or a new background. A COCO-format record stores the mask for datasets and downstream tools, which is what pycocotools supports. A masked edit hands the mask to an editor so only the outlined region changes.

Batch discipline prevents expensive mistakes. Copy a small set of images into a test folder first. Run your prompt recipe or the automatic script. Inspect several outputs, including the worst source image, not only the best one. Only then point the workflow at the full folder.

Save outputs with a naming rule tying each mask to its source image, checkpoint, and prompt recipe. When a customer questions an edge later, you want the recipe, not a shrug.

Respect the boundary between segmentation and editing. SAM outlines; it does not clean, colour, or repair. Our GFPGAN install guide and Real-ESRGAN install guide cover neighbouring jobs in the same image pipeline. Segment first, then restore or upscale with the tool built for that step.

First-run security steps you must not skip

Download SAM only from the official GitHub repository and its official checkpoint links. Checkpoint files are large binaries your Python process loads. A .pth file from a forum attachment, a file-sharing link, or a “free download” mirror is unknown code with your photos within reach.

Verify downloads against the intended checkpoint. The file name should match the official link, such as sam_vit_b_01ec64.pth. If a file arrives with a different name, a double extension, or an installer wrapper, stop and re-download from the official route.

Separate originals from outputs. Never overwrite the only copy of a source photo. Keep an untouched originals folder, an outputs folder, and a naming rule for masks and cutouts. A bad batch should cost you a re-run, not the photos themselves.

Mind privacy with online demos. A demo is fine for a public sample image. It is the wrong place for client product photos before launch, staff photos, or customer images. Your local install exists precisely so those files stay on your machine.

Use a dedicated Python environment and only the documented install commands. Read any extra command a blog suggests before you run it in that environment. The official install is short; anything longer deserves suspicion.

Backup and update routine

Back up the working setup, not just the outputs. Your backup set is the checkpoint files, your environment definition, your prompt recipes, your scripts, and your original photos. A restore that loses the proven checkpoint is not a restore.

Record versions in plain text: Python, PyTorch, TorchVision, the SAM commit or install date, and the checkpoint file name for each recipe. When an output changes, you want to know which ingredient changed.

Update deliberately. SAM’s repository points to SAM 2 as the newer release, so treat any move to SAM 2 as a migration to test, not a silent upgrade. Run your standard test images through the new setup, compare edges and scores, and keep the previous environment until the new one passes.

Test on standard images after every change: one easy product shot, one hard edge case, one lifestyle image. You will spot a regression in one comparison instead of across a customer batch.

Common errors and fixes

The model file is not found, or the checkpoint fails to load. Confirm the checkpoint path points at the downloaded file and that the model type matches it: vit_b with sam_vit_b_01ec64.pth, vit_l with sam_vit_l_0b3195.pth, vit_h with sam_vit_h_4b8939.pth. A partial download fails the same way, so re-download from the official link if the file size looks wrong.

One click returns the wrong object. A single point is ambiguous, which is why multimask_output=True returns three masks. Pick by score, then add a background point labelled 0 on the region the model wrongly included, or add a box around the object you mean. Prompt again before you conclude the model cannot do the job.

The mask includes the shadow under the product. Add background points on the shadow and tighten the box. Some shadows are a photography problem, not a segmentation problem.

Automatic mode returns dozens of fragments. That is automatic mode doing its job on a busy scene. Filter by area and quality signals, keep the masks that match your objects, and discard the rest. If every image needs heavy filtering, prompted masks will cost you less time than automatic ones.

Masks look wrong on every image. Check the image you hand to set_image. The predictor expects HWC uint8 format with pixel values in [0, 255]. A float image, a wrong colour order, or a transposed array produces confident nonsense. Fix the input format before you change checkpoints.

The run is painfully slow. Confirm PyTorch sees your GPU and that you installed the CUDA build the repository recommends. On CPU-only hardware, stay with vit_b, prompt single images instead of folders, and treat batch work as a deliberate hardware decision with the cost maths below in front of you.

ONNX export fails. The repository recommends the latest stable version of PyTorch for ONNX export, and the export needs the onnx and onnxruntime packages. Update PyTorch in a test environment first, export there, and only then move the result into production.

Tips and tricks that save money

Set the image once, prompt many times. set_image builds the image representation, and each predict call reuses it. A workflow that reloads the image for every prompt pays the expensive step repeatedly for no benefit.

Start with vit_b, earn vit_h. Prove prompts, output format, and inspection on the smaller backbone, then compare the default vit_h on the same images. If the edges do not improve for your image type, the smaller checkpoint is the cheaper process.

Use scores as a gate. Record the score of every kept mask; when scores drop on a new batch, inspect before you ship.

Build a prompt recipe per image type. Products on white, products in lifestyle scenes, and people photos each want their own points, boxes, and filters. One page per type, kept with the scripts, turns a personal skill into a team process.

The real cost maths

Roboflow official pricing page to use Segment Anything Model for image segmentation

SAM’s software licence fee is $0 under Apache 2.0. Your real costs are the computer and GPU you may already own, electricity, disk space for checkpoints and outputs, setup time, and the human edge check every customer-facing mask needs. There is no SAM server to rent for the local workflow; the cost sits in your own machine and your own process.

The paid comparison is Roboflow, because it sells the managed version of this job: a vision platform with hosted inference, training, labelling, and deployment in one subscription. On the official Roboflow pricing page checked on December 5, 2026, the Free Tier is $0 with 10 credits included a month. The same page says those credits are enough to train about 30 models or run 80,000 inferences.

Roboflow Core is $39 per month, billed monthly. The pricing page lists Core with 10 additional credits a month beyond the Free Tier, enough to train about 60 models or run 160,000 inferences. Additional prepaid credits start at $4 and expire after one year. Additional on-demand credits are $6 each. Enterprise is custom pricing.

Take a small shop that segments 2,000 product images a month for listings and social posts. That is 24,000 images a year. On a GPU the shop already owns, SAM’s licence cost is $0. Roboflow Core at $39 a month is $468 a year, which works out to about $0.02 per image at that volume.

The break-even line is more useful than the per-image line. Against Roboflow Core at $468 a year, SAM wins on cash if your monthly cost of setup, upkeep, electricity, and extra edge checking stays below $39. The moment your team spends more than $39 a month of time fighting Python environments, the subscription starts paying for itself.

Credits change the maths at volume: Roboflow meters training, labelling, and inference in one credit pool. SAM has no meter; a local run costs electricity and time, tenth image or ten-thousandth.

Hardware changes the maths too. If your current computer has no practical CUDA path and CPU batches would eat your week, SAM is not a $0 solution until that problem is solved. Do not invent a GPU price in the comparison. Use the real price of the machine or card you would actually buy, then divide it by the $39 monthly break-even line to see how many months the purchase needs to pay back.

Honesty matters here. Roboflow is a platform, not a mask button: its page lists training, labelling, deployment, and support options SAM does not provide. If you need those, the subscription may be worth it. If your job is private, repeatable masks on hardware you own, SAM’s $0 licence fee is the whole argument.

When not to use Segment Anything Model for image segmentation

Skip SAM when nobody on the team will use Python. The install is one documented command, but the workflow after it is code: load, prompt, score, save. If staff need buttons and previews, use a hosted platform or an editor with segmentation built in, and keep SAM as the engine under it.

Skip it when you need class labels, not just outlines. SAM returns masks without names. If your job is “find every defective unit and label the defect type,” you need detection or classification on top of segmentation, with its own training and evaluation. SAM alone will outline the defect and the packaging with equal confidence.

Skip it when the object moves. SAM segments images. For promptable segmentation in videos, Meta’s repository points to SAM 2. Forcing a still-image model onto video frames gives you flickering masks and a false sense of coverage.

Skip it when the mask must be evidentially exact. SAM estimates boundaries from a learned prior. For medical images, legal evidence, measurement, or any use where a shifted edge changes the conclusion, use a validated process and human review that matches the stakes.

Skip it when you need a vendor to call. There is no SAM support desk, service-level agreement, or account manager. The repository, its notebooks, and its issue history are the support structure. If a deadline depends on someone else fixing your segmentation, buy the platform with the desk.

Pros and cons

Pros: $0 Apache 2.0 software licence fee with commercial use permitted; zero-shot masks without training a model per object; point, box, and mask prompts with foreground and background points; three checkpoint sizes for different hardware; predicted quality scores for gating output; automatic mask generation for whole images and folders; ONNX export for browser and app use; local workflow keeps private photos on your machine.

Cons: Python workflow with no graphical interface in the core project; masks carry no class labels, so meaning is your job; no text prompts in this release; CUDA strongly recommended, so CPU batches stay slow; checkpoint and model-type mismatches are easy self-inflicted errors; automatic mode needs filtering before production use; no vendor support desk; SAM 2 is Meta’s newer direction for video work.

Our verdict

Use Segment Anything Model for image segmentation when your real job is cutting out objects repeatedly, on hardware you already own, without training a model for every new product. Install from the official repository, download sam_vit_b_01ec64.pth, prompt one real product photo with a foreground point, and inspect the winning mask at 100% zoom before any batch.

The maths favors SAM on hardware you already own: $0 in licence fees against $39 a month, $468 a year, for Roboflow Core billed monthly. The break-even line is $39 a month for your time, electricity, and upkeep.

Choose vit_h when its edges beat vit_b on your own test images, not because bigger sounds better. Choose automatic masks for exploration and prompted masks for production. Choose Roboflow when you need its training, labelling, deployment, or support structure. Choose SAM 2 when the object moves.

Respect the limits either way. SAM outlines what you point at; it does not know what your product is. Prompt carefully, check the score, inspect the edge, and let the model earn each batch.

FAQ

Is Segment Anything Model free for a business?

Yes. The SAM software licence fee is $0 under Apache License 2.0, which permits commercial use, modification, and distribution subject to its notice conditions. Keep the licence and copyright notices with any redistribution. Check your photo rights separately, and note that the SA-1B training dataset carries its own research licence.

What is the easiest way to use Segment Anything Model for image segmentation?

Install the official package with pip install git+https://github.com/facebookresearch/segment-anything.git, download an official checkpoint such as sam_vit_b_01ec64.pth, load it with sam_model_registry, call set_image on one photo, then call predict with a foreground point. Pick the mask with the best score and inspect its edges before batching.

Which SAM checkpoint should I use first?

Start with vit_b, file sam_vit_b_01ec64.pth, while you prove prompts and output format on modest hardware. Compare vit_h, the default checkpoint, on the same images when edge quality matters most. Keep the model type and checkpoint file matched: vit_b, vit_l, and vit_h each load their own file.

Can SAM segment an object from a text description?

No, not in this release. SAM prompts are points, boxes, and mask inputs. A workflow that starts from typed words uses another model to find the object and hand SAM a box. That combination can work well, but the finding model brings its own licence, cost, and errors.

Why does SAM return three masks for one click?

One point can be ambiguous: a click on a shirt could mean the shirt, the person, or the outfit. With multimask_output=True, SAM returns three masks with predicted quality scores so you can pick the best. Add background points or a box, then set multimask_output=False when your prompt is clear.

Strategic Pivot

Before you rent a vision platform for a folder of product photos, run your own numbers. Our free AI Cost Calculator turns a subscription price and your monthly image volume into a break-even line you can defend. Two minutes there can show whether $39 a month is cheap, expensive, or irrelevant next to the GPU already sitting on your desk.

Sources

Price note — updated December 5, 2026: Prices in this post were checked on December 5, 2026. When you are reading this, the price may be lower or higher. Check the official pricing page before you buy.

Pros

  • $0 Apache 2.0 software licence fee with commercial use permitted
  • zero-shot masks without training a model per object
  • point, box, and mask prompts with foreground and background points
  • three checkpoint sizes for different hardware
  • predicted quality scores for gating output
  • automatic mask generation for whole images and folders
  • ONNX export for browser and app use
  • local workflow keeps private photos on your machine

Cons

  • Python workflow with no graphical interface in the core project
  • masks carry no class labels, so meaning is your job
  • no text prompts in this release
  • CUDA strongly recommended, so CPU batches stay slow
  • checkpoint and model-type mismatches are easy self-inflicted errors
  • automatic mode needs filtering before production use
  • no vendor support desk
  • SAM 2 is Meta's newer direction for video work
Our verdict

Use Segment Anything Model for image segmentation when your real job is cutting out objects repeatedly, on hardware you already own, without training a model for every new product. Install from the official repository, download sam_vit_b_01ec64.pth, prompt one real product photo with a foreground point, and inspect the winning mask at 100% zoom before any batch. The maths favors SAM on hardware you already own: $0 in licence fees against $39 a month, $468 a year, for Roboflow Core billed monthly. The break-even line is $39 a month for your time, electricity, and upkeep. Choose vit_h when its edges beat vit_b on your own test images, not because bigger sounds better. Choose automatic masks for exploration and prompted masks for production. Choose Roboflow when you need its training, labelling, deployment, or support structure. Choose SAM 2 when the object moves. Respect the limits either way: SAM outlines what you point at; it does not know what your product is. Prompt carefully, check the score, inspect the edge, and let the model earn each batch.

1 thought on “How to Use Segment Anything Model for Image Segmentation (2026)”

Leave a Comment