Load PDFNet model by name
Load PDFNet model by name — the one that cheats with depth
- model
- train_w
- train_h
- norm_params
PDFNet is the only loader in this pack whose model doesn't just look at the image - it also looks at a depth map. The trick: it leans on Depth Anything V2 (the TikTok/HKU model, using a DINO v2 backbone) to understand how far away everything is, and uses that as a second input to separate foreground from background. That's clever, and it comes with a price the README states plainly: about twice the inference time of similar-sized models. On the pack's RTX 3060, PDFNet Base runs 1684ms and 3.5GB at 1024px.
There are exactly two checkpoints in the dropdown, both 392 MiB and both 1024×1024: PDFNet Base and PDFNet General. The author's honest notes on this model are the useful part: it was trained on a small dataset, it's not as popular, and nobody has dumped a huge training corpus into it - but when compared fairly against other models trained only on DIS5K, it does very well. In other words, it's promising and underfed, and you may need to play with the depth handling to get the best out of it.
The thing to know before you connect it
PDFNet wants a depth map as its depths input, and this pack actually makes that painless - the processing nodes auto-compute depth for you using the included Depth Anything V2 nodes (you'll find Load Depth Anything by name and the Depth Anything V2 node under RemBG_SET). So the workflow is: this loader → Remove background (full) → leave depths empty, and the pack fills it in automatically. If you want more control, compute the map yourself with Depth Anything V2 and feed the depths socket, which is how you can tune results when the auto path underperforms.
Inputs are the standard trio - model_name, device (AUTO), dtype (AUTO; forcing float16 cuts the memory bill) - and outputs are model (SET_REMBG), train_w/train_h (both 1024), and norm_params for manual pre-processing.
Install
Standard pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/set-soft/ComfyUI-RemoveBackground_SET
pip install -r ComfyUI-RemoveBackground_SET/requirements.txt
ComfyUI 0.3.48+, seconohe >= 1.0.6 (fresh pip install git+https://github.com/set-soft/seconohe.git if it errors). The PDFNet weights download into ComfyUI/models/rembg on first use.
Who should care? Two camps. Curious types who want the depth-guided approach in their toolkit, and anyone whose subject lives in a busy, cluttered scene where spatial reasoning genuinely helps separate near and far. If your input is a clean studio shot, BiRefNet will do the same job faster and you don't need this. If you're compositing people or products out of real-world photos with depth ambiguity - overlapping objects, messy tables, layered scenes - PDFNet is the loader to experiment with, and this pack makes the "second model" problem (depth estimation) almost invisible.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| model_name | COMBO | The name of the model, from the list of known models of this type | |
| device | COMBO | Device where the model will be run | |
| dtypeopt | COMBO | AUTO | Data type used for inference. `AUTO` means the same as the model on disk.Using a smaller size will save resources, but might degradate the results. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| model | SET_REMBG | The remove background model ready to be used in a processing node |
| train_w | INT | Width of the images used to train this model |
| train_h | INT | Height of the images used to train this model |
| norm_params | NORM_PARAMS | Normalization parameters for the input images. This is needed only for advanced use when you want to manually pre-process the images. The `Arbitrary Normalize` node from `Image Misc` can use these parameters to apply the correct normalization. |