Coco to Number
Turn 'person' into the number YOLO understands
- STRING
The 80 standard COCO classes are names to us and numbers to the model: person is 0, bicycle is 1, car is 2, and so on. This node is a lookup table - pick person from a dropdown of all 80 classes and it outputs "0" as a string. That's the entire node.
Why it exists: UltralyticsInference's classes input doesn't want names, it wants comma-separated indices ("0,2,5" to detect only persons, cars and buses). Typing those from memory is exactly how you discover the order isn't what you guessed. This node removes the guesswork - chain a few of them, concatenate the outputs, and you've got a class filter you can read at a glance instead of decoding a magic number list.
For quick reference, the first ten are: person 0, bicycle 1, car 2, motorcycle 3, airplane 4, bus 5, train 6, truck 7, boat 8, traffic light 9 - which covers most of what people actually filter for.
The implementation is literally coco_classes.index(coco_label) cast to a string, so it's airtight for the 80 standard classes but knows nothing beyond them. Custom-trained models with their own class lists won't line up - for those, read the model's names yourself and type the index.
Install is the shared pack story (ComfyUI Manager, search "ComfyUI-YOLO", or clone into custom_nodes, then restart). It's a thin utility and it knows it - you won't find it in the README screenshots; it's a helper that sits between the loader and inference. Reach for it the first time you want a detector that ignores everything except people.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| coco_label | COMBO | person | 80 options: person, bicycle, car, motorcycle, airplane, bus, +74 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |