XB-BOX - 📥 人物分割模型加载
Load the ONNX segmentation model that the segmenter needs
- 分割模型
XB_HumanSegModelLoader is the boring-but-necessary half of the pack's human-segmentation pair. It reads a folder, hands you a dropdown, and returns an ONNX model handle that the XB_HumanSegmentation node consumes. There's no real magic here - but there is one critical fact you need before this node is anything other than an error: the model file has to exist on disk first. This loader does not download anything.
What it expects
The loader registers a rembg model folder at ComfyUI/models/rembg/ and populates its dropdown from the .onnx files there. If the dropdown is empty, that's the whole story: no model, nothing to load. The pack's source comment is explicit about where the intended model comes from - the u2net human-segmentation checkpoint (the docstring points at huggingface.co/briaai/RMBG-1.4, and the file you actually want is the u2net_human_seg.onnx variant from the rembg model zoo). So:
mkdir -p ComfyUI/models/rembg
# drop your .onnx here, e.g. u2net_human_seg.onnx
then restart ComfyUI (or reload the node list) and the file appears in the dropdown.
How it works
The loader's one job is to create an ONNX Runtime inference session from the chosen file. It picks the best provider it can find, in order: DirectML first (the pack's stated priority - this suite is tuned for AMD cards), then ROCm, then CUDA, then CPU with a warning. So on a Windows box with an AMD GPU you get DirectML acceleration, on Linux ROCm you get the ROCm execution provider, and everywhere else it falls back gracefully. That provider-ordering logic is the genuinely thoughtful part - most segmentation nodes just grab CUDA and break elsewhere.
Its single output is 分割模型 (XB_HUMANSEG_MODEL), a custom type that only XB_HumanSegmentation knows how to consume. It carries the ORT session, not the weights on the GPU.
Install and gotchas
Standard XB_ToolBox install, plus one real dependency: onnxruntime (the pack's requirements.txt asks for onnxruntime>=1.18.0). If you're on an AMD card and want GPU acceleration, onnxruntime-directml (Windows) or the ROCm-enabled build is what actually activates those providers - plain onnxruntime gets you CPU fallback, which still works but is slow on large images.
The two ways people get stuck, both predictable:
- No model in the dropdown → the
models/rembg/folder is empty. Download the.onnxand restart. - Slow CPU inference → the ORT session fell back to CPU because no GPU provider is installed. Install the platform-appropriate provider.
The segmentation itself is the next node's job - this one just gets the session ready.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | 0 options: |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| 分割模型 | XB_HUMANSEG_MODEL | — |