Try Pro FREE for 2 weeksGet Started

image-masker-by-class — Masking AI Model

Image Masker by Class turns a segmentation or detection result into a clean black-and-white mask from the class names you pick — pixel-precise for segmentation, box-shaped for detectors. Feeds inpainting. CPU, instant.

Details

  • CategoryMasking
  • Year-1
  • License

Inputs & Outputs

ImageInputimage

Upstream model's output image. For segmentation models (SAM2/SAM3/Maskformer/Segformer/DeepLabV3Plus), this is the colored overlay — its pixels are matched against the per-class colors in the text input to produce a pixel-precise mask. For object detectors (DETR/YOLO), only its width/height are used as the mask canvas size.

TextInputstring

Line-separated metadata from an upstream segmentation or detection model. Each line carries a class label and (depending on the upstream) optional color tuple, score, and bbox — the parser auto-detects the format.

ImageOutputimage

Generated mask image by detected class

Parameters

target_classesstringdefault

Class names (comma-separated)

Comma-separated class names to include in the mask. Must match labels emitted by the upstream model's text output — e.g. 'object_0' from SAM2/3, 'subject' from BiRefNet, 'person' / 'car' from DETR/YOLOS, 'dog' from RF-DETR-Seg (80 COCO classes). Multiple classes are unioned into a single mask. Leave empty to mask nothing (typically a mistake).

dilationintegerdefault 0range 0–100advanced

Bbox dilation (0-100 px)

Expand each bbox outward by N pixels. Bbox mode only — used with object detectors to avoid edge artifacts when inpainting (e.g. add 10-20px around a removed object). Has no effect when upstream is a segmentation model (pixel-precise output).

duplication_handlingstringdefault Individualsoptions: Individuals, Merge, Left Most, Top Most, Right Most, +2 moreadvanced

Multi-instance handling

How to combine multiple bboxes of the same class (bbox mode only). 'Individuals' (default) keeps each as a separate mask rectangle. 'Merge' unions them into one rectangle. 'Left/Top/Right/Bottom/Center Most' pick a single instance by position. Use a positional rule when only one instance should be masked.

Tags

  • mask-creation
  • detection-post-process
  • class-based

Alternatives in Image Masking

All AI models