modaux: mlsd
MLSD for architecture and interiors
- image
- IMAGE
Most preprocessors try to capture everything about a scene. MLSD does the opposite: it detects straight line segments and nothing else, which makes it weirdly perfect for architecture, interiors, and anything built out of right angles. modaux: mlsd from the ControlNet Auxiliar pack wraps the M-LSD (Mobile Line Segment Detection) model and outputs exactly that - a map of crisp straight lines that a ControlNet can use to hold the geometry of a room while you regenerate everything else.
That's the classic interior-design workflow: snap a photo of a space, let MLSD extract the wall/floor/ceiling lines, then prompt a new style and the ControlNet keeps the perspective and layout honest. It also shines for architectural visualizations and blueprint-to-render passes. The flip side is the honest limitation: MLSD produces almost nothing for organic subjects. Curved, soft, or cluttered scenes give you a nearly empty map, so don't reach for it on people, plants, or anything you'd describe as "flowing."
How it works
The node instantiates MLSDdetector from controlnet-aux==0.0.7 and loads its weights from the lllyasviel/Annotators Hugging Face repo on the first run (a one-time download into your cache, no manual step). M-LSD is a lightweight model from 2021 designed to run on mobile, so it's quick and cheap on VRAM - the nice side effect of being a specialist.
The inputs that matter
The standard trio of image, detect_resolution (512), and image_resolution (512), plus the two thresholds that tune how much line it sees:
- thr_v (default 0.1, range 0.01–1) - the value threshold: how strong a line segment has to be before the model reports it. Raise it to drop faint or noisy detections.
- thr_d (default 0.1) - the distance threshold for merging. Nearby segment fragments get stitched into longer lines; raising it fuses more aggressively.
The defaults are a sensible starting point. If your map looks like static, nudge thr_v up; if lines look broken and fragmentary, raise thr_d a little.
The output IMAGE feeds a ControlNet Apply node paired with an MLSD ControlNet - control_sd15_mlsd on SD 1.5, and MLSD is still on the menu for the modern union checkpoints (the Z-Image and Flux 2 unions include it), so the map transfers forward if you're on a newer base.
Install
Same pack, same steps as the siblings:
cd ComfyUI/custom_nodes
git clone https://github.com/madtunebk/ComfyUI-ControlnetAux.git
cd ComfyUI-ControlnetAux
pip install -r requirements.txt
Or search "ControlNet Auxiliar" in ComfyUI Manager, then restart. First execution waits on the weight download; after that it's quick.
The honest take
MLSD is a niche tool and you'll either need it constantly (architecture people) or almost never (everyone else). That's fine - when you need it, nothing else does the job. Two practical notes: keep the working resolutions near 512 as the README recommends, since non-standard sizes can shift output dimensions, and remember the model is a line finder, not an edge detector - a canny map will include curves and texture, MLSD gives you the skeleton of the space. That specificity is the entire point.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| detect_resolution | INT | 512256–1024 | — |
| image_resolution | INT | 512256–1024 | — |
| thr_vopt | FLOAT | 0.100.01–1 | — |
| thr_dopt | FLOAT | 0.100.01–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |