Nodes/ComfyUI_YOLO_Classifiers/YOLO Classifier Model Loader
ComfyUI Node

YOLO Classifier Model Loader

Five tiny weights, one dropdown — the loader that feeds ComfyUI's image classifier

By SuperMasterBlasterLaser·Created 2 years ago·Updated about a year ago· 1
YOLO Classifier Model Loader
    • YOLO classifier model
    model_name

    Why a loader node gets its own article

    YOLO Classifier Model Loader is the boring half of the two-node ComfyUI_YOLO_Classifiers pack - and the one you'll hit first, because nothing else in the pack works without it. Its entire job is to produce the YOLO_CLASSIFIER_MODEL handle that YOLO Classify requires. One dropdown, one output, done. It reads as trivial, and it mostly is. But there's one real trap buried in it, and it's the models.

    What it does

    Pick a model name and the loader resolves it against a folder ComfyUI registers as models/ultralytics/classifiers/, builds an Ultralytics YOLO(...) instance from the weights file, and passes that handle out. The five choices are the stock YOLOv8 classification checkpoints, from tiny to big:

    • yolov8n-cls.pt - nano, a few MB, fast
    • yolov8s-cls.pt
    • yolov8m-cls.pt
    • yolov8l-cls.pt
    • yolov8x-cls.pt - extra-large, slowest, up to ~100 MB

    For most routing jobs the nano or small is all you need. These are image classifiers, not diffusion checkpoints - a few MB to ~100 MB is the whole range, and bigger buys a bit of ImageNet accuracy that rarely matters for "is this a cat or not."

    The one input, the one output

    • model_name - the only input, an enum dropdown of those five .pt files. If a file isn't in the folder, it won't appear in the list.
    • Output: "YOLO classifier model", a custom YOLO_CLASSIFIER_MODEL type. Wire it into the yolo_classifier_model input on YOLO Classify. There's nowhere else this type goes - the two nodes are a matched set.

    Installing it

    Same pack install as YOLO Classify: in ComfyUI Manager, search "YOLO Classifiers", or clone it:

    cd ComfyUI/custom_nodes
    git clone https://github.com/SuperMasterBlasterLaser/ComfyUI_YOLO_Classifiers
    

    then restart. The pack pins ultralytics==8.2.32, so first launch runs a pip install.

    The trap: nothing downloads itself

    The dropdown is populated by scanning a folder - there's no "download model" button, and no model manifest for Manager to install either. You place the weights yourself:

    mkdir -p ComfyUI/models/ultralytics/classifiers
    cd ComfyUI/models/ultralytics/classifiers
    wget https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n-cls.pt
    

    then restart ComfyUI and the dropdown fills in. The source comment points at the Ultralytics classify docs as the download reference, and all five -cls files live in the same release.

    Two ways this bites you. First, if the selected file is missing, the loader doesn't fail gracefully - it hands Ultralytics an empty path, which Ultralytics tries to interpret as its own default model, usually producing a confusing error. Put the file there first. Second, make sure it's the -cls variant. A plain detection yolov8n.pt will load into this node fine, but YOLO Classify reads r.probs, which detection models don't have, so it dies with an attribute error the moment you run it.

    One more honesty note: the dropdown is hardcoded to those five names. No custom models, no extra knobs - that's the whole ceiling of this pack. For its one job, it does it cleanly; if you need custom classes or confidence scores, look elsewhere.

    CategorySuperMasterBlasterLaser/ComfyUI_YOLO_Classifiers

    Inputs (1)

    NameTypeDefaultDescription
    model_nameCOMBO5 options: yolov8n-cls.pt, yolov8s-cls.pt, yolov8m-cls.pt, yolov8l-cls.pt, yolov8x-cls.pt

    Outputs (1)

    NameTypeDescription
    YOLO classifier modelYOLO_CLASSIFIER_MODEL