ImageSegmentationCustom
Run your own ONNX cutout model in ComfyUI
- images
- IMAGE
The Allor Plugin's plain ImageSegmentation node ships with rembg's standard models. ImageSegmentationCustom is the unlocked version: it runs any ONNX segmentation model you drop into models/onnx. That's the difference between "cut out with u2net" and "cut out with whatever ONNX export you converted or downloaded today" - a BiRefNet export, an InSPyReNet weight, a specialized model, anything that speaks ONNX. If you've got a model file and the community's current best cutout is two downloads away, this is the node that lets you run it without writing Python.
How it works
Everything routes through rembg, but with a custom session. Allor registers an onnx folder type and points rembg's model directory at ComfyUI/models/onnx (via U2NET_HOME), so the model dropdown simply lists every .onnx file sitting there. Pick one and the node wraps it in a rembg session that:
- Normalizes the image with the
meanandstdyou provide (ImageNet-ish defaults: 0.485 and 1.0). - Resizes to
size(default 1024, stepped by 8). - Runs the ONNX model through onnxruntime and rescales the predicted mask back to the original resolution.
The mask then feeds rembg's remove() pipeline, which is where the quality knobs live. alpha_matting (true/false) toggles the pymatting refinement pass that cleans up hair and soft edges - when on, alpha_matting_foreground_threshold (default 240), alpha_matting_background_threshold (default 20), and alpha_matting_erode_size (default 10) control how aggressively the matte is rebuilt. post_process_mask (true/false) applies rembg's final mask cleanup.
Output is an RGBA IMAGE with the background transparent. That's the pack's whole philosophy: unlike many nodes, it keeps alpha, so the cutout composites cleanly downstream.
Inputs and outputs
images(IMAGE) - one image or a batch.model- dropdown of.onnxfiles inmodels/onnx. Empty until you add one.alpha_matting,alpha_matting_foreground_threshold,alpha_matting_background_threshold,alpha_matting_erode_size,post_process_mask- the rembg quality controls.mean(FLOAT, default 0.485),std(FLOAT, default 1.0) - normalization for the model.size(INT, default 1024, step 8) - inference resolution.
Output: IMAGE, RGBA, background removed.
Installing it and getting a model
Install the pack the usual way - ComfyUI Manager → "Allor Plugin", or:
cd ComfyUI/custom_nodes
git clone https://github.com/Nourepide/ComfyUI-Allor
Then restart. This node is why the pack lists rembg and onnx as its main dependencies. Drop your model in:
mkdir -p ComfyUI/models/onnx
# e.g. a BiRefNet or InSPyReNet ONNX export
Restart (or reload) so the dropdown picks it up. On the model side: the community's default-recommended cutouts as of mid-2026 are BiRefNet and InSPyReNet, and both can be exported to ONNX - that's exactly the gap this node fills. rembg itself has also absorbed BiRefNet weights, so if you'd rather not hunt down an ONNX file, the pack's plain ImageSegmentation node with birefnet-general is a one-line fallback. Choosing u2net from the dropdown is choosing the 2020 quality floor; it works, and hair will betray it.
Where people get burned
Three classic failure modes. First, the empty dropdown - no .onnx in models/onnx, nothing to pick. Second, wrong normalization → garbage masks: if a model was trained with different mean/std, the defaults will give you noise, not a matte; that's exactly what the Advanced sibling node is for. Third, alpha_matting is slow - it's a pymatting pass on CPU and can turn a fast cutout into a seconds-per-image crawl; try it off first, and only enable it on the frames that actually need hair work. Also remember onnxruntime defaults to CPU; the requirements.txt notes the GPU build is optional (onnxruntime[gpu]), and you'll feel the difference on large images or batches.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| model | COMBO | 0 options: | |
| alpha_matting | COMBO | 2 options: true, false | |
| alpha_matting_foreground_threshold | INT | 240 | — |
| alpha_matting_background_threshold | INT | 20 | — |
| alpha_matting_erode_size | INT | 10 | — |
| post_process_mask | COMBO | 2 options: false, true | |
| mean | FLOAT | 0.48 | — |
| std | FLOAT | 1.00 | — |
| size | INT | 1024 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |