ForkSiliconFlowSiliconFlowpublished Oct 30, 2026seen 9h

siliconflow/ComfyUI-TBG-SAM3

forked from Ltamann/ComfyUI-TBG-SAM3

Open original ↗

Captured source

source ↗
published Oct 30, 2026seen 9hcaptured 9hhttp 200method plain

siliconflow/ComfyUI-TBG-SAM3

Description: ComfyUI-TBG-SAM3 A plug-and-play ComfyUI extension providing production-ready nodes for Meta’s SAM3 (Segment Anything Model 3) for text- or point-based segmentation, exhaustive mask generation, and per-segment or global depth mapping. All outputs are compatible with advanced segmentation packs such as Impact Pack SEGS and TBG-ETUR Upscaler Pro

License: MIT

Stars: 0

Forks: 0

Open issues: 0

Created: 2026-10-30T03:29:55Z

Pushed: 2026-10-30T03:47:26Z

Default branch: main

Fork: yes

Parent repository: Ltamann/ComfyUI-TBG-SAM3

Archived: no

README: Updated Release: ComfyUI-TBG-SAM3 — Now we can plug a cleaned-up SAM3 segment straight into TBG Enhanced Refiner or any SEGS-ready input, like the Impact Pack effortlessly! So whats new. Visit TBG enhanced tiled upscaler and refiner pro

ComfyUI-TBG-SAM3

A ComfyUI custom-node extension that integrates Meta’s Segment Anything Model 3 (SAM-3) for advanced image segmentation. It supports unified point and box selection, text-prompt segmentation, point-guided masks, and mask-driven refinement. Features include an Instance Selection toggle, compatibility with tile-based upscalers such as TBG-ETUR, and full support for Impact Pack SEGS formats.

The ComfyUI-TBG-SAM3 update focuses on making SAM3 segmentation easier to use, more compatible with common workflows, and cleaner in its final output. The node set still uses the same three core nodes — TBG SAM3 ModelLoader & Downloader, TBG SAM3 Segmentation, and TBG SAM3 Selector — but each one has been improved.

Key Improvements

  • Unified Point-and-Box Selector

The TBG SAM3 Selector now combines point and box selection into a single, streamlined tool. It supports both positive and negative prompts and keeps everything connected cleanly, making interactive segmentation much easier.

  • Enhanced Segmentation Logic + Instance Toggle

The TBG SAM3 Segmentation node now uses the official SAM3 segmentation workflow and includes a new switch that lets you turn off instance generation when you don’t need it.

  • Tile-Based TBG-ETUR Compatibility

Special output formats were added for full compatibility with TBG-ETUR’s tile-based upscaling workflow. This ensures stable, per-tile segmentation masks for high-resolution refinement.

  • Impact Pack SEGS Support

The node now works directly with Impact Pack SEGS, making SAM3 usable in automated and multi-stage SEGS pipelines.

  • Unified Model folder with other SAM3 nodes

model at models/sam3/sam3.pt

  • New Cleanup Tools

Min-Size Filter: Removes tiny or unwanted segments below a defined size. Fill Holes: Automatically fills empty gaps inside segmented regions.

This update makes the TBG-SAM3 node set fully usable inside ComfyUI, adding better compatibility, improved segmentation handling, and practical cleanup features for all of us.

Nodes

  • TBG SAM3 Model Loader

Loads the SAM3 model

  • TBGSAM3ModelLoaderAdvanced

Loads and downloads the SAM3 model

  • TBG SAM3 Segmentation

Point and Box Segmentation for single image input

  • TBG SAM3 Selector

Single Images selector with Impactpack optimized output (Impactpack does not handle batch segmentation)

  • TBG SAM3 Batch Selector

Node for batch image processing without Impactpack

  • TBG SAM3 Depth Map

Node for depth estimation; simple implementation, and there are more advanced depth map methods available.

Features

  • SAM3 Model Loader and Downloader: Simple loader for local, cached models plus an advanced loader that can auto-download sam3.pt from Hugging Face into models/sam3 and reuse it across sessions.
  • SAM3 Instance Filtering Switch: Optional instances toggle to either return all SAM3 detections or keep only detections that overlap positive boxes / contain positive points, giving clean “instance‑aware” outputs when needed.
  • Min-Size Filter: Removes segments smaller than a specified size to clean up the final result.
  • Fill Holes: Automatically fills in empty regions within segmented areas.
  • Unified Prompt Segmentation: Segmentation driven by text, interactive points, and boxes via a single prompt pipeline
  • Text-Prompt Segmentation: Semantic segmentation using flexible open vocabulary text prompts.
  • Point, Box & Mask Guidance: Support for positive/negative points, positive/negative boxes, and optional input masks to refine or restrict SAM3 predictions.
  • TBG‑ETUR Upscaler Compatibility: SEGS format and shapes are aligned with TBG‑ETUR’s tiler/upscaler (no zero‑sized masks, consistent SEG.cropped_mask and SEG.crop_region), so SAM3 segments can be passed straight into the Upscaler/Refiner workflows. ComfyUI-TBG-ETUR
  • Impact Pack Compatible SEGS Outputs: Per-instance SEGS built via mask_to_segs (one SEG per contour / detection). Combined full-image mask plus combined SEGS using the same Impact-Pack SEG structure for seamless use with detailers and other SEGS nodes. ComfyUI-Impact-Pack
  • Configurable Crop Factor for SEGS: User-controlled crop_factor input to tune how tightly Impact-Pack SEG crop regions wrap around their masks, matching Impact Pack behavior.
  • Flexible Pipeline Modes: Switch between all prompts, boxes-only, points-only, positive-only, negative-only (and variants) to control how selectors influence segmentation.
  • Interactive Prompt Collector Node: Web‑UI node that displays the image, lets you draw points and boxes, and normalizes them into a reusable SAM3 prompt pipeline.
  • CUDA and CPU Support: Efficient usage of available GPU or fallback to CPU.
  • Automatic Dependency Management: Installs all necessary Python packages and handles Python 3.13+ specific issues.
  • Hugging Face Auth Friendly: Integrated guidance and automated support for model access token handling.

Installation

1. Clone or copy this repository into your ComfyUI custom_nodes directory:

git clone https://github.com/your-username/ComfyUI-TBG-SAM3.git

2. Change directory and install required Python dependencies:

cd ComfyUI-TBG-SAM3 pip install -r requirements.txt

3. If the nodes do not appear after installation, then SAM3 is likely not installed correctly in your environment. Check the installation logs and verify that the auto installation steps were completed properly inside your Python...

Excerpt shown — open the source for the full document.