[BUG] predicting with yolov8 model throws error "object of type 'int' has no len()" #4741
Closed
2 tasks
Labels
bug
Bug fixes
Instructions
Describe the problem
running predictions an a dataset with an ultralytics yolo model gives error "object of type 'int' has no len()"
Code to reproduce issue
#load a dataset (custom or from zoo)
dataset=...
import fiftyone.zoo as foz
#either of these models gives the same error
model = foz.load_zoo_model("yolov8m-seg-coco-torch")
#model = foz.load_zoo_model("yolov8m-coco-torch")
dataset.apply_model(model, label_field="predictions")
System information
python --version
): 3.10.12fiftyone --version
): v0.25.0Other info/logs
this is the fix:
in utils/ultralytics.py:
def _extract_track_ids(result):
"""Get ultralytics track ids if present, else use Nones"""
return (
result.boxes.id.detach().cpu().numpy().astype(int)
if result.boxes.is_track
else [None] * result.boxes.conf.size(0) #removed len()
)
Willingness to contribute
The FiftyOne Community encourages bug fix contributions. Would you or another
member of your organization be willing to contribute a fix for this bug to the
FiftyOne codebase?
from the FiftyOne community
The text was updated successfully, but these errors were encountered: