UR Boxes To Mask Batch
Detector handed you boxes? This turns them into a mask batch
- images
- mask
- selected_frame
- preview
Somewhere between your detector's output and your inpaint model there's a shape mismatch: detectors love to talk in bounding boxes, and inpaint models only speak masks. UR Boxes To Mask Batch is the translator. Feed it an IMAGE frame batch and a JSON list of boxes, and it draws those boxes into a MASK - one mask per frame, aligned to your batch.
It's the simpler sibling of UR Regions To Mask Batch. Where the regions node handles circles, polygons, and keyframe timing, this one is strictly rectangles: hand-boxed removal areas, or bboxes imported from an external tool like a YOLO tracker or a detection script.
How it works
The node parses your boxes_json, converts each box to pixel coordinates on the frame, and fills them white in a mask at the frame you specify. Then a broadcast_mode decides how that single frame's mask covers the whole batch. The parsing is forgiving in a useful way:
- xyxy - plain arrays like
[100, 120, 420, 220], or objects withx1/y1/x2/y2orleft/top/right/bottom. - xywh - objects with
x/y/w/h(or arrays when the format dropdown is set toxywh). - normalized - flip this on and all values are treated as 0–1 fractions of the frame, which is what a lot of tracking tools output.
Boxes that hang off the edge get clamped to the frame instead of erroring.
The inputs that matter
You'll set three of them 90% of the time:
- boxes_json - the boxes themselves. This is the payload.
- coordinate_format -
xyxyorxywh. Get this wrong and your "mask" will be gloriously wrong shapes. This is the classic gotcha. - broadcast_mode - what happens to the other frames:
repeat_to_batchputs the same mask on every frame,single_frame_onlymasks just the one frame atframe_index, andhold_after_framemasks that frame onward. For a static logo or watermark that never moves,repeat_to_batchis the one you want.
frame_index picks which frame the boxes apply to, and preview_color/preview_opacity just style the preview overlay so you can see what you're doing.
The outputs
- mask - the
MASKbatch, frame-matched to your images. This is the one that goes downstream. - selected_frame - the frame you chose, as an image.
- preview - that frame with the mask overlaid in your chosen color.
Wire the mask into UR Mask Processor for feathering, then UR Keyframe Prep, and you're on the standard remove path.
Common issues
Coordinate-format mismatch is the #1 footgun, full stop - a xywh box read as xyxy becomes a rectangle with a huge negative extent. Second: normalized boxes fed with the toggle off, or absolute pixels fed with it on, will either draw a speck or a box that covers half the frame. Third, an empty or malformed JSON array doesn't crash - it silently produces an empty mask, so if your mask is mysteriously all black, check that your detector actually returned boxes. And a real subtlety: this node gives you rectangles, which is exactly the "bbox vs segmentation" trade the detailing essay warns about - rectangular masks are the ones most likely to leave visible seams. Fine for watermarks; keep polygon masks in mind for organic shapes.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| boxes_json | STRING | [] | — |
| frame_index | INT | 00–1000000 | — |
| coordinate_format | COMBO | 2 options: xyxy, xywh | |
| broadcast_mode | COMBO | 3 options: repeat_to_batch, single_frame_only, hold_after_frame | |
| normalized | BOOLEAN | false | — |
| preview_color | STRING | #FF3B30 | — |
| preview_opacity | FLOAT | 0.350–1 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |
| selected_frame | IMAGE | — |
| preview | IMAGE | — |