"How to Detect Objects with YOLO-World": not quite correct

For anyone struggling with the code outlined in this article, I just want to point out what I had to do to avoid a list assignment index out of range error in the yolo_world.py file in the inference pip package in the get_cls_conf_array function.

The

classes = [“person”, “backpack”, “dog”, “eye”, “nose”, “ear”, “tongue”]
model.set_classes(classes)

Portion of the code in this blog post should not be the search text but should be the expected class list.

The text search should be set like so:

results = model.infer(
img,
text=[“person”, “backpack”, “dog”, “eye”, “nose”, “ear”, “tongue”],
confidence=0.003
)

I am sure it is clear now why this mistake causes the index out of range error. The search will bring back results by finding nearest matches in the expected class list and return the index. By not setting text=[“person”, “backpack”, “dog”, “eye”, “nose”, “ear”, “tongue”] you can get back a much bigger index from the COCO dataset by default.