Nodes/ComfyUI-InstantStudio/HuggingFace Classify
ComfyUI Node

HuggingFace Classify

HuggingFace Classify is a one-trick node — the trick needs Impact Pack first

By InstantStudioAI·Created 2 years ago·Updated about a year ago· 5
HuggingFace Classify
  • hf_classifier_model
  • image_to_classify
  • raw_score
  • rounded_score
target_label

Here's the thing nobody warns you about with this node: it looks like a self-contained "classify my image" box, but it's really the second half of a two-node setup. The first half - the actual machine learning model - lives in ComfyUI-Impact-Pack by ltdrdata. The hf_classifier_model input on this node is a TRANSFORMERS_CLASSIFIER type, and that type simply does not exist in your ComfyUI until Impact Pack is installed. The pack README says as much, and it's telling: this is a thin wrapper around Impact Pack's Transformers Classifier provider, built by InstantStudio for their own internal pipeline and published along with it.

What it does

Feed it an image and it returns two things: raw_score (a FLOAT from 0 to 1) and rounded_score (an INT that's just raw_score rounded to 0 or 1). The mechanism is blunt: it converts your image to PIL, hands it to the Impact Pack classifier, finds the score attached to your chosen target_label, and returns it. If the classifier's output doesn't contain that label at all, the score silently defaults to 0.0. No renormalizing, no label guessing - it's a "how confident is this model that this is the thing" gate.

The catch on the label side: target_label is a hardcoded dropdown with exactly two choices, male and female. That's the whole vocabulary. This node classifies gender, full stop. Which makes sense in context - the same pack's Moondream node ships with a default prompt that asks for gender, age, hair color and hairstyle. This is InstantStudio's person-attribute pipeline leaking into the public pack.

How to actually use it

Install Impact Pack too, then in your workflow add Impact Pack's transformer classifier provider node (look for the TRANSFORMERS_CLASSIFIER output - a "load classifier" node where you pick a HuggingFace model), wire that into hf_classifier_model, plug in your image_to_classify, and pick a target label. The rounded output is effectively a boolean - wire it into a switch or a conditional to branch the workflow on "is this a man / is this a woman."

cd ComfyUI/custom_nodes
git clone https://github.com/InstantStudioAI/ComfyUI-InstantStudio
cd ComfyUI-InstantStudio && pip install -r requirements.txt
# also, from ComfyUI Manager or manually:
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack

Restart ComfyUI after both. The other two nodes in this pack don't need Impact Pack; this one hard-requires it. If you load a workflow using this node without Impact Pack, you'll get the familiar "node type not found" error.

Why you might skip it

No beating around the bush: zero Google impressions and no real community footprint. If you already have Impact Pack (and a huge share of the ecosystem does - FaceDetailer alone makes it the default detailing answer in ComfyUI), you can do this classification with its built-in tools, or just ask Moondream, which is more flexible and doesn't pin you to a gender binary. The honest place for this node is a specific automated pipeline that needs a cheap hard male/female gate. If that's you, it works. If it isn't, it's a curiosity - read the source (it's about 40 lines) and move on.

Categorysd

Inputs (3)

NameTypeDefaultDescription
hf_classifier_modelTRANSFORMERS_CLASSIFIER
image_to_classifyIMAGE
target_labelCOMBO2 options: male, female

Outputs (2)

NameTypeDescription
raw_scoreFLOAT
rounded_scoreINT