Nodes/ComfyUI Impact Pack/CoreMLDetailerHookProvider
ComfyUI Node Runs on cloud

CoreMLDetailerHookProvider

Pin detailer crops to CoreML's fixed sizes

By ltdrdata·Created 3 years ago·Updated 4 months ago· 3,242
CoreMLDetailerHookProvider
    • DETAILER_HOOK
    mode

    This one's for a specific crowd: people running CoreML-converted models on Apple Silicon. CoreML models are compiled for a fixed set of input resolutions and won't accept arbitrary sizes, which is a problem for a detailer - detailers normally upscale each detected crop to whatever size the region needs. This hook forces every crop to snap to one of CoreML's four supported sizes, so the detail pass actually runs instead of erroring on a resolution the model can't handle.

    If you're not on CoreML, you don't need this node and shouldn't add it - it deliberately overrides the detailer's sizing, which you only want when the model demands it.

    How it works

    CoreML supports only 512x512, 512x768, 768x512, and 768x768 sampling. This provider outputs a DETAILER_HOOK that fixes the upscale of each crop region to exactly the size you pick. That override is total: whatever the detailer's own guide_size says, the crop is forced to the selected CoreML size instead - the hook always wins. There's one escape valve baked in: if a detected region is too small, the detailer skips it rather than blowing it up to 512+ and wasting the pass. So the practical behavior is "every region that's big enough gets sampled at your chosen fixed size; tiny ones are skipped."

    The input and output

    • mode (enum, one of 512x512, 768x768, 512x768, 768x512) - the fixed size every crop is forced to. Pick the aspect that best matches what you're detailing (square for faces, a portrait/landscape ratio for other regions).

    Output is a DETAILER_HOOK. Wire it into the detailer_hook input of your detailer node. It combines with other hooks through DetailerHookCombine if needed.

    How to install it

    Part of Impact Pack. ComfyUI Manager: search ComfyUI Impact Pack, Install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack
    

    then pip install -r requirements.txt in ComfyUI's Python environment - on Mac that's your active venv/conda env - and restart. Pack's by ltdrdata, the ComfyUI-Manager author. Note the hook doesn't provide a CoreML model; you supply that separately through whatever CoreML pipeline you're running, and this just makes the detailer play nice with it.

    Common issues & troubleshooting

    If regions are being silently skipped, that's the "too small" rule - a detection smaller than the forced size gets passed over rather than upscaled, which is intended; loosen your detector or accept that tiny hits won't be detailed under CoreML. If you're getting resolution errors despite this hook, double-check the mode you picked is actually one your specific CoreML model was compiled for - the four sizes are what CoreML supports in general, but a given converted model may only ship a subset. And the obvious one: on a normal CUDA or MPS-without-CoreML setup, don't use this - it clamps your detailer to 512/768 crops for no reason and you lose the adaptive sizing that makes detailing good. This is a compatibility shim for a constrained runtime, not a quality feature.

    CategoryImpactPack/Detailer

    Inputs (1)

    NameTypeDefaultDescription
    modeCOMBO4 options: 512x512, 768x768, 512x768, 768x512

    Outputs (1)

    NameTypeDescription
    DETAILER_HOOKDETAILER_HOOK