Nodes/ComfyUI-LASED-mask/LASED Food Map
ComfyUI Node

LASED Food Map

Steering LASED contours with a painted mask

By MushroomFleet·Created 3 months ago·Updated 3 months ago· 0
LASED Food Map
  • image
  • food
  • edge_map
  • mask
seed_x0
seed_y0
food_amount5.0
tolerance40.0
ants250
steps600
color_spacergb
handboth
beta4.0
epsilon0.05
seed0
modemasking
mask_threshold0.15
sticky_threshold0.20
freeze_after0
no_decayfalse
max_side512

LASED finds the boundary of a color region - but what if the contour you actually want isn't that region's natural boundary? Uneven lighting, noisy texture, a boundary that the color blob just doesn't cleanly express. That's the gap LASED Food Map exists for. Instead of only following color, the ants get fed.

You give the node a food MASK, painted bright exactly where you want the contour rewarded. Every tick of the simulation, standing food is laid under that mask, so ants are biased toward it and their trails get reinforced there. The pack calls it "the offline analogue of success clicks" - the interactive version where a user keeps clicking to tell the system "yes, here" - except here you paint your "yes" once, in advance, and the swarm steers toward it for the whole run.

The inputs that matter

  • food - a MASK where brightness marks reward. Paint bright where you want the learned edge strengthened. Feed it from a second LoadImageMask; the example workflow lased_food_map.json shows the exact hookup.
  • food_amount - the food potential at fully-masked cells, default 5. This is how hard you bribe. Too low and the swarm ignores your mask; too high and the whole field around your painted line lights up and the contour bloats.
  • seed_x / seed_y - the usual spawn click, still in input-image pixels, still needs to be inside the region whose boundary you're tracing.
  • The rest is the standard LASED swarm set - tolerance, color_space, ants, steps, mode, max_side, seed.

Mechanically it's simple under the hood: the food mask is resampled to the simulation grid, scaled by food_amount, and merged into the swarm's food field with a maximum every tick - a standing field that never depletes below the level you authored. The swarm's normal color-driven behavior keeps running underneath; the food just biases where the boundary settles.

Outputs

Same two as the rest of the family: edge_map (IMAGE) and mask (MASK). Use the mask for anything you need to be binary - inpainting, compositing, a ControlNet scribble/edge condition - and the edge map if you want the soft field or a glowing preview via LASED Overlay.

When to reach for it

  • Your color region's natural boundary is wrong or partial, and a plain Swarm Edge run comes back with a contour that misses what you wanted.
  • The texture is noisy enough that color tolerance alone can't hold a clean line - the food mask pins the contour where your eye says it should be.
  • You're making a ControlNet condition and want to strengthen a specific edge over everything the swarm would otherwise find on its own.

Don't bother with it when the color blob is clean and well-lit - Swarm Edge will give you the same contour for less setup. Food Map is the steering wheel, and steering is only worth it when the default drive is going somewhere you don't want.

Install and gotchas

Same as every node in this pack: ComfyUI Manager search for ComfyUI-LASED-mask, or clone https://github.com/MushroomFleet/ComfyUI-LASED-mask into custom_nodes and restart. No model downloads; numpy-only core with an optional scipy speed-up. Don't overdo food_amount - start at the default 5 and tune down; the mask gets resampled to simulation resolution automatically, so a resolution mismatch with your image isn't something you need to fix by hand.

CategoryLASED

Inputs (19)

NameTypeDefaultDescription
imageIMAGE
foodMASKWhere to reward: standing food is laid under this mask every tick — the offline analogue of 'success clicks'.
seed_xINT00–16384
seed_yINT00–16384
food_amountFLOAT5.00.1–50Food potential at fully-masked cells.
toleranceFLOAT40.01–250Colour tolerance (tau). Lower = tighter region. Lab distances run smaller; try 10-25 there.
antsINT2501–5000
stepsINT6001–20000Simulation ticks. More steps = cleaner, more complete contours.
color_spaceCOMBOrgb3 options: rgb, weighted, lab
handCOMBObothWall-following handedness; 'both' splits the swarm into clockwise and counter-clockwise cohorts.
betaFLOAT4.00.1–12Softmax temperature. Higher = greedier edge following.
epsilonFLOAT0.050–0.5Random-move floor; prevents the swarm freezing.
seedINT00–18446744073709550000
modeCOMBOmaskingclassic: MASK = thresholded edge pheromone. masking (Stage 2): MASK = sticky-latched, gap-closed, despeckled contour.
mask_thresholdFLOAT0.150.01–0.95classic mode only: threshold on the normalised edge map for the MASK output.
sticky_thresholdFLOAT0.200.05–0.6masking mode: latch a cell when its edge pheromone crosses this fraction of the field maximum.
freeze_afterINT00–20000masking mode: freeze (and clean) the mask after this many ticks. 0 = run all steps, then freeze.
no_decayBOOLEANfalsemasking mode: stop edge-pheromone evaporation entirely.
max_sideINT5120–4096Downsample the longest side to this for simulation (0 = full resolution). Outputs are resampled back.

Outputs (2)

NameTypeDescription
edge_mapIMAGE
maskMASK