ComfyUI Node

Get background mask

Computes the foreground mask. It normalizes the input images, scales them to the model size, computes the masks and then scales the masks to the image size. No background removal/replacement is done. See the `Remove background (full)`.

By set-soft·Created 12 months ago·Updated 8 months ago· 18
Get background mask
  • model
  • images
  • depths
  • masks
  • depths
  • edges
width1024
height1024
upscale_methodbicubic
mask_threshold0.000
batch_size1
out_dtypeAUTO
CategoryRemBG_SET/Basic

Inputs (9)

NameTypeDefaultDescription
modelSET_REMBGThe remove background model from `Load RemBG model by file` or any of the `Load XXXXXX model by name` nodes
imagesIMAGEOne or more images to process, will be scaled to a size that is good for the model.
widthINT10240–16384The width of the pre-processing image, does not affect the final output image size
heightINT10240–16384The height of the pre-processing image, does not affect the final output image size
upscale_methodCOMBObicubicInterpolation method for pre-processing image and post-processing mask
mask_thresholdFLOAT0.0000–1Most models generates masks that contain a value from 0 to 1, but can be any value in between. Matte models can estimate transparency using it. If you need to make the mask 0 or 1, but nothing in between, you can provide a threshold here. Values above it will become 1 and the rest 0.
batch_sizeINT11–256How many images to process at once
depthsoptMASKFor models that starts with a depth map
out_dtypeoptCOMBOAUTOData type used for the outputs. `AUTO` means the same as the input.Using `float16` can help when processing videos.

Outputs (3)

NameTypeDescription
masksMASKThe estimated masks, where a higher value means the model estimates it belongs to the foreground with more confidence.
depthsMASKThe estimated depth map. Either from the `depths` input or computed. Note this applies only to PDFNet. This is the map generated by `Depth Anything V2`
edgesMASKThe estimated edges. This is only generated by the DiffDIS model.