Nodes/ComfyUI DAM Object Extractor/DAM Object Name Extractor
ComfyUI Node

DAM Object Name Extractor

What's in this mask? A 3B vision model answers in one word

By Irsalistic·Created about a year ago·Updated about a year ago· 6
DAM Object Name Extractor
  • image
  • mask
  • STRING
temperature0.10
max_tokens10
invert_maskFalse
threshold0.010
prompt_modename_only

You've got a mask - from SAM, from a load-image mask, from whatever segmentation tool you like - and you genuinely don't know what's inside the white blobby region. Maybe it's a weird object in a dataset you're curating, maybe a detector flagged a region and you want to know what it actually found before you build a prompt around it. DAM Object Name Extractor (class DAMObjectNameNode) is the node that answers: feed it an image, feed it a mask, and it asks NVIDIA's DAM model what that region is and hands you back a string.

What it actually is

Under the hood it's not doing anything clever with masks at all. It loads NVIDIA's DAM-3B-Self-Contained - a "Description and Masking" vision-language model, about 6GB of weights - and turns your mask into a question: "What is the name of this object? Answer with a single word." The model has already been trained to take an image plus a segmentation mask as context, so it's not hallucinating a region you didn't draw; it's literally looking at the pixels you outlined.

The model loads lazily on the first run, so your first execution pays the download cost and takes 10–15 seconds. Every run after that is fast, assuming it's still in VRAM. The pack's requirements.txt pins transformers>=4.52.0.dev0 (a dev build) alongside torch, timm and accelerate, so this is a heavier install than the average single-node pack - ComfyUI Manager will sort it out, but don't be surprised if the install takes a minute.

The inputs that matter

Most of them you'll set once and forget:

  • image and mask - the obvious pair. The mask gets thresholded into binary (white/nothing) before it's sent to the model, so faint masks from Load Image still work.
  • prompt_mode - the real toggle. name_only asks for a single word; full_description swaps to "Describe the masked region in detail." Pick name_only if you're building prompts or tagging data.
  • invert_mask - flip it to True when your mask is backwards (white background, black object).
  • threshold - how aggressively pixels count as "masked". The default 0.01 is fine; raise it if background noise keeps leaking in, lower it if the mask comes back empty.
  • temperature and max_tokens - generation settings. One honest gotcha: in name_only mode the node silently caps tokens at 10 no matter what you type, which is exactly what you want from a one-word answer and vaguely annoying if you expected full control.

The output

A single STRING - either the cleaned-up object name (articles and punctuation stripped) or the longer description. Wire it into any text display (Show Text from ComfyUI-Custom-Scripts) to read it, or feed it into prompt assembly if you're automating workflows. There's no separate "this failed" output: if the mask is empty or the model errors, the node returns the error message as the string, so keep an eye on the text if your results look like an exception handler wrote them.

Where it fits in a workflow

It's a companion to the segmentation side of your graph, not a replacement for it. If you're already running Impact Pack's SAM detectors or a grounding model to find regions, this node sits downstream and answers "okay, but what is that region?" That makes it genuinely handy for dataset labeling, or for taking a single reference image and turning a selection into a usable prompt - the kind of thing the KB's inpainting notes keep circling back to, where the mask is the interface but words are what you actually need out of it.

Troubleshooting

The two failure modes you'll actually hit are both mask problems. "Mask is empty" means your thresholded mask had zero white pixels - lower the threshold, make sure the mask isn't all-black, or try invert_mask. Dimension errors are rarer; the node has a lot of defensive code for weird mask shapes, so check the console if one escapes. And if the model fails to load on first use, it's almost always disk space or a dropped connection during that 6GB download. The node also writes a dam_debug_mask.png into its own folder on every run to show you exactly what it saw - handy for debugging, slightly annoying if you notice a mystery file appearing in your custom_nodes directory.

It's a quiet, single-author pack with zero reddit chatter, so you're early to it. The model is the whole show, and the node is a thin but honest wrapper - for a niche "name what I masked" task, it does the job without ceremony.

Categoryimage/analysis

Inputs (7)

NameTypeDefaultDescription
imageIMAGE
maskMASK
temperatureFLOAT0.100.01–1
max_tokensINT101–512
invert_maskCOMBOFalse2 options: False, True
thresholdFLOAT0.0100.001–0.999
prompt_modeCOMBOname_only2 options: name_only, full_description

Outputs (1)

NameTypeDescription
STRINGSTRING