Skip to content

Commit

Permalink
Fix __len__ and single_cls (ultralytics#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
Laughing-q authored Jan 11, 2023
1 parent 88c9418 commit 53fa0f4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ultralytics/yolo/data/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def update_labels(self, include_class: Optional[list]):
if segments:
self.labels[i]["segments"] = segments[j]
if self.single_cls:
self.labels[i]["cls"] = 0
self.labels[i]["cls"][:, 0] = 0

def load_image(self, i):
# Loads 1 image from dataset index 'i', returns (im, resized hw)
Expand Down Expand Up @@ -191,7 +191,7 @@ def get_label_info(self, index):
return label

def __len__(self):
return len(self.im_files)
return len(self.labels)

def update_labels_info(self, label):
"""custom your label format here"""
Expand Down

0 comments on commit 53fa0f4

Please sign in to comment.