Image Classification
What Is This Image? Image Classification in ComfyUI
- image
- label
- score
Image Classification is the node that tells you what category an image belongs to - "tabby cat," "sports car," "mountain." It's the classic computer-vision task, and in a ComfyUI graph it's a quick way to label images, route them by content, or filter a batch by what's actually in the frame. Think of it as the keyword-driven cousin of the captioning nodes: instead of a full description, you get one label and a confidence score.
It wraps the image-classification pipeline from Hugging Face, defaulting to microsoft/resnet-50. ResNet-50 is the most-studied image classifier in existence - a 2015 architecture with 50 layers that's still the reference point for "can it tell a dog from a cat." The node converts your image's first frame to PIL, runs the classifier, and returns the top prediction.
The inputs and output
- image - the
IMAGEtensor to classify. - model_name - Hub model ID as a string, default
microsoft/resnet-50. The classifier's label set is baked into the model - whatever it was trained on (ResNet-50 uses ImageNet's 1000 categories) is all it can say.
Two outputs: label (a STRING - the predicted class) and score (a FLOAT confidence, 0–1). Wire both into display nodes; the score tells you whether the answer means anything.
How to install it
Standard pack install - ComfyUI Manager (search "ComfyUI-Transformers") or:
cd ComfyUI/custom_nodes
git clone https://github.com/kadirnar/ComfyUI-Transformers
Restart ComfyUI. ResNet-50 is about 100MB on first download, and requirements.txt covers the transformers stack.
Where people get burned
The label set is the whole game, and it's the part beginners miss. ResNet-50 only knows ImageNet's 1000 categories - no NSFW detection, no art style, no "anime" class. Ask it something outside its vocabulary and you'll get the nearest ImageNet label with low confidence. If you need a category it doesn't have, the pack's zero-shot nodes (which take free-text labels) are the better fit. Otherwise, for "give me a confidence-scored label for this image," this node is simple, fast, and does exactly what it says on the tin.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| model_name | STRING | microsoft/resnet-50 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| label | STRING | — |
| score | FLOAT | — |