Nodes/was-node-suite-comfyui/SAM Model Loader
ComfyUI Node Runs on cloud

SAM Model Loader

Load Segment Anything for targeted masking

By WASasquatch·Created 3 years ago·Updated about a year ago· 1,812
SAM Model Loader

      SAM Model Loader loads Meta's Segment Anything Model into your graph so the WAS masking nodes have something to segment with. On its own it does nothing visible - it's the loader that hands a SAM_MODEL to the nodes that actually cut things out (SAM Parameters and SAM Image Mask in this pack). Think of it the way you think of a checkpoint loader: necessary plumbing that feeds the node doing the work.

      Set expectations up front: SAM is for targeted masking, not plain background removal. The background-removal KB is blunt about this - SAM is the right tool when you need to mask a specific object (a face, a garment, the person on the left), and it's overkill when you just want foreground-vs-background. For a simple cut-out, rembg or BiRefNet is faster and simpler. Reach for SAM when you need to select one thing precisely, usually to feed an inpaint or a regional edit.

      How it works

      SAM is a universal segmentation model: given an image and a prompt - a point, a box, or a region - it produces a precise mask around whatever's there. The loader's job is just to get the model weights into memory and expose them as a SAM_MODEL output. You then wire that into SAM Parameters (where you define the points/boxes) and SAM Image Mask (which runs the segmentation and returns the mask).

      The typical WAS SAM chain: load an image → SAM Model Loader → define parameters → SAM Image Mask → clean the result (Mask Fill Holes, smooth) → use it for inpainting or compositing. It's more setup than a one-click remover, which is the tradeoff for precise, object-level control.

      Inputs and outputs that matter

      The input that matters is the model selection - which SAM checkpoint to load (the different ViT sizes trade quality for speed and VRAM). The output is a SAM_MODEL that feeds the downstream SAM masking nodes.

      You'll need the SAM checkpoint file present for it to load - these are Meta's sam_vit_* weights, and they live in a SAM models folder under ComfyUI. Grab the checkpoint if you haven't; the loader can't conjure weights that aren't on disk.

      How to install it

      ComfyUI Manager: search was-node-suite-comfyui, install, restart. Manually:

      cd ComfyUI/custom_nodes
      git clone https://github.com/WASasquatch/was-node-suite-comfyui
      

      then install the pack's requirements.txt in your ComfyUI venv and restart. SAM support pulls in the segment-anything machinery via the pack's requirements. You also need the actual SAM weights - download a sam_vit_h/vit_l/vit_b checkpoint and drop it in the SAM models directory so the loader can see it.

      Common issues & troubleshooting

      The dropdown is empty / it can't find a model. The SAM checkpoint isn't where it's looking. Download a SAM weight file and place it in ComfyUI's SAM models folder, then restart. Unlike newer node packs, this won't auto-download the weights for you.

      Should I be using this at all? If your goal is background removal, probably not - the KB's verdict is that SAM is the wrong reach for a plain subject cut-out; use rembg or BiRefNet and move on. SAM is for when you need a specific object masked, especially as the front half of an inpaint. Note also the ecosystem has moved on: SAM 2 and SAM 3 exist and newer masking node packs (like ComfyUI-RMBG) bundle them, so if you're building a masking pipeline fresh in 2026, WAS's SAM integration is the older path.

      It loads but segmentation is rough. Bigger SAM backbones (ViT-H) give better masks than the smaller ones, at the cost of VRAM and speed. And whatever mask you get, run it through cleanup (Mask Fill Holes, smooth) before using it - raw SAM masks often have interior holes.

      Whole pack won't import after a ComfyUI update. Standard WAS Node Suite behavior - package downgrades vs a ComfyUI bump. Re-run the pack's requirements against the activated venv, or install.bat. The suite's been maintenance-only since late 2023.

      Categoryx

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs