ComfyUI SAM2(Segment Anything 2)

By neverbiasuView on GitHub →

This project adapts the SAM2 to incorporate functionalities from [a/comfyui_segment_anything](https://github.com/storyicon/comfyui_segment_anything). Many thanks to continue-revolution for their foundational work.

How much VRAM does ComfyUI SAM2(Segment Anything 2) require?

Direct Answer: The ComfyUI node ComfyUI SAM2(Segment Anything 2) requires a minimum base VRAM of 128MB and is optimized for GPUs with at least 4GB of VRAM. Low VRAM mode is fully supported for resource-constrained setups.

High (2-4GB)
Base VRAM:
128MB (0.1GB)
Recommended GPU:
4GB+ VRAM
Low VRAM Mode:
✓ Supported
Estimation Confidence:
MEDIUM

Interactive VRAM Compatibility Estimator

Estimated Total VRAM: 3.00 GBTarget: 8 GB
✅ Comfortable Fit

Your GPU has plenty of headroom. You can run this node safely with your active configurations!

Deploy on High-Performance GPUs

Need more VRAM to run ComfyUI with this node? Rent low-cost, high-performance GPUs on Vast.ai instantly.

🚀 Deploy on Vast.ai

Deploy on Cloud GPUs

Need more VRAM to run ComfyUI with this node? Rent low-cost, high-performance cloud GPUs on RunPod instantly.

🚀 Deploy on RunPod

What Python packages are required for ComfyUI SAM2(Segment Anything 2)?

Direct Answer: Running ComfyUI SAM2(Segment Anything 2) requires installing the following Python package dependencies: addict, hydra-core>=1.3.2, iopath>=0.1.10, matplotlib>=3.9.1, numpy<2, opencv-python>=4.7.0, pillow>=9.4.0, timm, tqdm>=4.66.1, yapf. Ensure your ComfyUI environment has these packages active before launching.

requirements.txt
addict
hydra-core>=1.3.2
iopath>=0.1.10
matplotlib>=3.9.1
numpy<2
opencv-python>=4.7.0
pillow>=9.4.0
timm
tqdm>=4.66.1
yapf

Interactive Setup & Dependency Resolver

Operating System:
Environment Type:
Run this terminal command in your ComfyUI root folder:
# Loading command...

Frequently Asked Questions

How much VRAM does ComfyUI SAM2(Segment Anything 2) require?

ComfyUI SAM2(Segment Anything 2) requires a minimum of 128MB (0.1GB) of VRAM for base operation. For optimal performance, a GPU with at least 4GB of VRAM is recommended. This node supports low VRAM mode for resource-constrained setups.

Can I run ComfyUI SAM2(Segment Anything 2) on an RTX 3060, RTX 4070, or RTX 4090?

✅ RTX 3060 (12GB): Yes, fully compatible with 10.7GB headroom. ✅ RTX 4070 (12GB): Yes, fully compatible with 10.7GB headroom. ✅ RTX 4070 Ti (16GB): Yes, fully compatible with 14.3GB headroom. ✅ RTX 4090 (24GB): Yes, fully compatible with 21.5GB headroom

What Python packages are required for ComfyUI SAM2(Segment Anything 2)?

To run ComfyUI SAM2(Segment Anything 2), you need to install: addict, hydra-core>=1.3.2, iopath>=0.1.10, matplotlib>=3.9.1, numpy<2, opencv-python>=4.7.0, pillow>=9.4.0, timm, tqdm>=4.66.1, yapf. You can install these using pip or add them to your requirements.txt file.

How can I reduce VRAM usage when running ComfyUI SAM2(Segment Anything 2)?

ComfyUI SAM2(Segment Anything 2) supports low VRAM mode. To reduce memory usage: (1) Enable --lowvram or --medvram flags in ComfyUI, (2) Reduce batch size to 1, (3) Use fp16 or fp8 precision if supported, (4) Close other GPU applications.

How do I install ComfyUI SAM2(Segment Anything 2) in ComfyUI?

To install ComfyUI SAM2(Segment Anything 2): (1) Navigate to your ComfyUI/custom_nodes directory, (2) Clone the repository: git clone https://github.com/neverbiasu/ComfyUI-SAM2, (3) Install dependencies: pip install -r requirements.txt (if present), (4) Restart ComfyUI. Alternatively, use ComfyUI Manager for one-click installation.