M3Net Interface
An academic saliency net doing background removal
- image
- m3net
- image
- mask
This is the node that actually cuts the subject out. Feed it an image plus a loaded M3Net model and it returns a transparent-background cutout and a mask. It's a faithful wrapper around M3Net, an academic salient object detection network from I2-Multimedia-Lab, pointed at a job it wasn't strictly built for - and in a few spots that shows. The pack author (leeguandong) ships his own e-commerce-tuned weights with it, and his README's pitch is that M3Net beats "many models" on product shots. Whether that's true on your product shots is a five-minute test.
Where it sits in the wider landscape
Before you build a workflow around this, know the context. Background removal is the most commoditized operation in this ecosystem, and the quality bar moved years ago from "can it find the subject" to "can it survive hair, fur and semi-transparency." BiRefNet is the default and has shipped inside ComfyUI core since May 2026; InSPyReNet is one node away and still wins some head-to-heads. M3Net is an older salient-object network in the same family as rembg's u2net - fast, light, fine on a solid subject against a plain background, weaker on flyaway hair and thin structures. Use it because a workflow demands it, or because you specifically want the e-commerce weights, not because it's the state of the art. That isn't a knock - it just sets expectations.
How it works
The Interface node takes your image, resizes it to 384×384, normalizes with ImageNet statistics, and runs the network forward. The model's saliency output passes through a sigmoid to become a foreground mask, which is resized back to your original dimensions. Then the original image is pasted onto a transparent canvas with that mask as the alpha - so the image output is an RGBA cutout, and the mask output is the resized saliency mask itself. It loops over the batch dimension, so a batch of inputs becomes a batch of cutouts in one pass.
Inputs and outputs that matter
Only two inputs, and one of them is obvious:
image(IMAGE) - whatever you want cut out. Feed it from Load Image or straight off a generation pipeline; post-generation removal doesn't care what produced the image.m3net(M3NET) - the model object fromM3Net_ModelLoader. This is why the two nodes travel together: you can't run the Interface without the loader upstream.
Outputs:
image(IMAGE) - the cutout, in RGBA. Note it's a 4-channel tensor; ComfyUI's default preview renders it flattened, so if you need the transparency to survive to a file, save through a node that respects alpha.mask(MASK) - the saliency mask at your original resolution. This is the useful half for compositing: it wires straight into IC-Light for relighting the cutout to match a new scene, into inpainting, or into a composite/overlay to place the subject on a generated background.
Install
Same as the loader - this is a two-node pack:
cd ComfyUI/custom_nodes
git clone https://github.com/leeguandong/ComfyUI_M3Net.git
then restart ComfyUI (or find it in ComfyUI Manager as ComfyUI_M3Net, if the registry listing has landed). The checkpoint is not in the repo and there's no requirements.txt; you'll download a .pth from the README's Baidu pan links (extraction code vi01 for the author's e-commerce weight) into custom_nodes/ComfyUI_M3Net/weights/M3Net-S.pth, and if timm isn't already installed you'll install it (pip install timm). Full detail lives in the M3Net Model Loader article; it's the same install either way.
Common issues
- Crash on CPU-only machines. The loader politely falls back to
cpu, but the Interface node hardcodesimages.cuda(). No CUDA GPU, no cutout - the node errors at the forward pass. If your machine is CPU-only, don't fight it; reach for rembg's u2net instead, which runs happily on CPU. - It runs before you've loaded the model. An empty
m3netinput (you dragged the Interface in but skipped the loader) fails immediately. Loader upstream, always. - Edges that look wrong on hair or thin detail. That's the salient-object network's limitation, not a broken install. If it matters, compare against BiRefNet or InSPyReNet on your own three hardest images before standardising - that's the advice for every background remover, this one included.
- Don't strip backgrounds from a LoRA training set with this. It's the same trap as every segmentation model: it teaches the LoRA to generate blank backgrounds. Weight the background down or keep originals, don't remove them.
Reach for this when a workflow pins you to it, or when the e-commerce-tuned weight genuinely beats the alternatives on your product line. For a general "just cut it out" habit, ComfyUI already has better, native options.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| m3net | M3NET | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |