LASED Food Map
Steering LASED contours with a painted mask
- image
- food
- edge_map
- mask
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 secondLoadImageMask; the example workflowlased_food_map.jsonshows 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.
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| food | MASK | Where to reward: standing food is laid under this mask every tick — the offline analogue of 'success clicks'. | |
| seed_x | INT | 00–16384 | — |
| seed_y | INT | 00–16384 | — |
| food_amount | FLOAT | 5.00.1–50 | Food potential at fully-masked cells. |
| tolerance | FLOAT | 40.01–250 | Colour tolerance (tau). Lower = tighter region. Lab distances run smaller; try 10-25 there. |
| ants | INT | 2501–5000 | — |
| steps | INT | 6001–20000 | Simulation ticks. More steps = cleaner, more complete contours. |
| color_space | COMBO | rgb | 3 options: rgb, weighted, lab |
| hand | COMBO | both | Wall-following handedness; 'both' splits the swarm into clockwise and counter-clockwise cohorts. |
| beta | FLOAT | 4.00.1–12 | Softmax temperature. Higher = greedier edge following. |
| epsilon | FLOAT | 0.050–0.5 | Random-move floor; prevents the swarm freezing. |
| seed | INT | 00–18446744073709550000 | — |
| mode | COMBO | masking | classic: MASK = thresholded edge pheromone. masking (Stage 2): MASK = sticky-latched, gap-closed, despeckled contour. |
| mask_threshold | FLOAT | 0.150.01–0.95 | classic mode only: threshold on the normalised edge map for the MASK output. |
| sticky_threshold | FLOAT | 0.200.05–0.6 | masking mode: latch a cell when its edge pheromone crosses this fraction of the field maximum. |
| freeze_after | INT | 00–20000 | masking mode: freeze (and clean) the mask after this many ticks. 0 = run all steps, then freeze. |
| no_decay | BOOLEAN | false | masking mode: stop edge-pheromone evaporation entirely. |
| max_side | INT | 5120–4096 | Downsample the longest side to this for simulation (0 = full resolution). Outputs are resampled back. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| edge_map | IMAGE | — |
| mask | MASK | — |