Nodes/ComfyUI-BGPSeg/Load BGPSeg Models
ComfyUI Node

Load BGPSeg Models

The boring loader with the slow first run

By PozzettiAndrea-archive·Created 9 months ago·Updated 7 months ago· 0
Load BGPSeg Models
    • models
    • model_info
    model_variantBGPSeg (ABC Dataset)
    auto_downloadtrue
    devicecuda

    Load BGPSeg Models is the front half of the BGPSeg pack, and on paper it's the dullest node imaginable: a loader that fetches weights. In practice it's where your first run goes to die, because "load" here means a Google Drive download plus a CUDA JIT compile, in sequence. Patience pays; the second run is instant.

    What it loads Two checkpoints, pulled from Google Drive via gdown and cached in ComfyUI/models/cadrecon/bgpseg/: Boundary_model.pth (the BoundaryNet that finds the seams between primitives) and BGPSeg_model.pth (BGFE, the main segmentation model). Both are trained on the ABC Primitive dataset, which covers ten primitive types - plane, sphere, cylinder, cone, torus and friends. The node loads them onto the device you pick, strips off the module. DataParallel prefixes so the state dicts line up, and hands you the BGPSEG_MODELS wire that BGPSegSegmentation wants. Nothing runs here - this is strictly setup, which is why you can fire it once and keep the result wired across the whole graph.

    The inputs are few model_variant is a dropdown with exactly one entry today ("BGPSeg (ABC Dataset)") - it's scaffolding for future checkpoints, not a decision you need to make. auto_download (on by default) decides whether missing weights get fetched over the internet or the node just throws a file-not-found and prints a manual-download URL. device defaults to cuda; if CUDA isn't available it falls back to cpu with a printed warning that inference will be very slow. That warning undersells it. And device also decides whether the custom point-cloud CUDA ops even get built - those are CUDA-only, so CPU mode is a slow fallback with a weaker segmentation guarantee, not a real option for heavy meshes.

    The outputs models is the real one - feed it into the segmentation node's models input and forget about it. model_info is a STRING containing the variant, the device, the primitive list and the models directory; wire it to a text preview node if you want to sanity-check what got loaded.

    What actually happens on first run Three things, in order: it checks the local cache, downloads the two .pth files if missing (gdown against a Drive folder - this can take a while and occasionally stalls), then kicks off the JIT compile of the pointops and boundaryops CUDA extensions. That compile is the "first run may take a few minutes" the code warns about, and it needs a working CUDA toolkit (nvcc on PATH). Everything after that is cached, so later runs are a quick disk read.

    Install Same as the rest of the pack: ComfyUI Manager, search "BGPSeg", or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/PozzettiAndrea/ComfyUI-BGPSeg
    pip install -r ComfyUI-BGPSeg/requirements.txt
    

    That installs torch, numpy, trimesh and gdown. Restart ComfyUI, drop the node in, and let it do its thing.

    Where people get burned Impatience, mostly - the first run looks hung while it downloads and compiles, and the console only prints progress line by line. If the download fails partway, flip auto_download off, grab both files from the Drive folder ID the node prints, drop them into models/cadrecon/bgpseg/, and re-enable. And don't panic at the "Building CUDA extensions" line: that's normal, once, on a CUDA machine. If you're on CPU-only, this pack is going to be a rough ride no matter what you do.

    CategoryBGPSeg

    Inputs (3)

    NameTypeDefaultDescription
    model_variantCOMBOBGPSeg (ABC Dataset)BGPSeg pretrained on ABC Primitive dataset (10 primitive types: plane, sphere, cylinder, cone, torus, etc.)
    auto_downloadoptBOOLEANtrueAutomatically download models from Google Drive if not found locally.
    deviceoptCOMBOcudaDevice for model inference. CUDA strongly recommended for performance. Note: CUDA required for custom point cloud operations.

    Outputs (2)

    NameTypeDescription
    modelsBGPSEG_MODELS
    model_infoSTRING