π [Update] getitem with removing -1 cls padding
Browse files
yolo/tools/data_loader.py
CHANGED
@@ -145,8 +145,9 @@ class YoloDataset(Dataset):
|
|
145 |
|
146 |
def get_data(self, idx):
|
147 |
img_path, bboxes = self.img_paths[idx], self.bboxes[idx]
|
|
|
148 |
img = Image.open(img_path).convert("RGB")
|
149 |
-
return img, bboxes, img_path
|
150 |
|
151 |
def get_more_data(self, num: int = 1):
|
152 |
indices = torch.randint(0, len(self), (num,))
|
|
|
145 |
|
146 |
def get_data(self, idx):
|
147 |
img_path, bboxes = self.img_paths[idx], self.bboxes[idx]
|
148 |
+
valid_mask = bboxes[:, 0] != -1
|
149 |
img = Image.open(img_path).convert("RGB")
|
150 |
+
return img, bboxes[valid_mask], img_path
|
151 |
|
152 |
def get_more_data(self, num: int = 1):
|
153 |
indices = torch.randint(0, len(self), (num,))
|