Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] predicting with yolov8 model throws error "object of type 'int' has no len()" #4741

Closed
2 tasks
stevensagaert opened this issue Aug 28, 2024 · 4 comments
Closed
2 tasks
Labels
bug Bug fixes

Comments

@stevensagaert
Copy link

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")

# commands and/or screenshots here

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 22.04): Linux Ubuntu 22.04
  • Python version (python --version): 3.10.12
  • FiftyOne version (fiftyone --version): v0.25.0
  • FiftyOne installed from (pip or source): pip

Other 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?

  • [x ] Yes. I can contribute a fix for this bug independently
  • Yes. I would be willing to contribute a fix for this bug with guidance
    from the FiftyOne community
  • No. I cannot contribute a bug fix at this time
@stevensagaert stevensagaert added the bug Bug fixes label Aug 28, 2024
@swheaton
Copy link
Contributor

This PR was merged recently that does exactly what you propose. Thank you for the suggestion! It will be out in 0.25.1
#4720

@lyf6
Copy link

lyf6 commented Aug 29, 2024

@stevensagaert have you solved this problem?

@swheaton
Copy link
Contributor

@lyf6 see my comment above, it will be fixed in 0.25.1

@lyf6
Copy link

lyf6 commented Aug 29, 2024

@swheaton great! thank you for your reply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug fixes
Projects
None yet
Development

No branches or pull requests

4 participants
@swheaton @lyf6 @stevensagaert and others