Mask Maker Processor

Overview

The Mask Maker processor automatically finds and segments objects in your image, producing one mask per object and optional Boolean-composite masks. Simply tell it what to look for and where to save the results.


Example Usage

- processor:
    processor: "mask_maker"
    inputs:
      source: "input/car_photo.png"
    params:
      cache_json: "cache/car_masks.json" # optional: caches full JSON response
      mask_prompt: "car., window, license plate"
      threshold: 0.2 # detection confidence cutoff
      mask_output: > # compose new masks
        body:  car - window;
        plate: body AND license_plate
    outputs:
      body: "cache/mask_body.png" # <mask> key corresponds to the 'body' mask from mask_output
      plate: "cache/mask_plate.png" # <mask> key corresponds to the 'plate' mask from mask_output
      annotated: "output/annotated_car.png"
    assigns:
      left: "masks_left" # global bounding box key for all masks
      top: "masks_top"
      right: "masks_right"
      bottom: "masks_bottom"
      width: "masks_width"
      height: "masks_height"
      body_left: "body_left" # per-mask bounding box key: '{mask}_left' becomes 'body_left'
      body_top: "body_top"
      plate_left: "plate_left" # per-mask bounding box key: '{mask}_left' becomes 'plate_left'
      plate_top: "plate_top"

Parameters

Key Type Req’d Default Description
cache_json str No If provided, caches & reuses the full JSON response
mask_prompt str Yes Comma-separated object names; suffix . → keep only the top-scoring instance per term
threshold float No 0.2 Confidence cutoff for object detection
mask_output str No identity map Single-line infix DSL to define composite masks; overrides the one-per-term defaults

**Default **mask_output (when omitted) Produces one mask per prompt term: car:car; window:window; license_plate:license_plate


Mask-Output DSL

Compose new masks by combining existing masks using Boolean operators. Use the following syntax:

{new_mask}: {mask_definition}; {new_mask2}: {mask_definition2}; ...

Examples:

mask_output: "rider: person & horse; background: !rider;"
Syntax Alias Meaning Example
A & B AND intersection 1 & 0 → 0
A + B or A | B OR union union: a + b
A - B difference (A & !B) 1 - 1 → 0
A ^ B XOR exclusive or 1 ^ 1 → 0
!A NOT complement !1 → 0

Outputs

Key Required Description
{mask} Yes Path to each generated mask PNG. Replace {mask} with the name defined in mask_output or default terms.
annotated No Path to auto-annotated image PNG

Assigns

After processing, you’ll receive:

Replace {mask} with the exact mask name key used in your mask_output (e.g., body_left, plate_width).


Just declare:

  1. What to detect (mask_prompt)
  2. How to compose them (mask_output DSL)
  3. Where to save each mask (outputs)