Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions gluoncv/data/pascal_voc/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ def _load_label(self, idx):
label.append([xmin, ymin, xmax, ymax, cls_id, difficult])
except AssertionError as e:
logging.warning("Invalid label at %s, %s", anno_path, e)
if not label:
# dummy invalid labels if no valid objects are found
label.append([-1, -1, -1, -1, -1, -1])
return np.array(label)

def _validate_label(self, xmin, ymin, xmax, ymax, width, height):
Expand Down
2 changes: 2 additions & 0 deletions gluoncv/model_zoo/yolo/yolo_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ def forward(self, img, xs, anchors, offsets, gt_boxes, gt_ids, gt_mixratio=None)
for m in range(matches.shape[1]):
if valid_gts[b, m] < 1:
break
if np_gt_ids[b, m, 0] < 0: # ignore fake bbox
break
match = int(matches[b, m])
nlayer = np.nonzero(num_anchors > match)[0][0]
height = xs[nlayer].shape[2]
Expand Down