Skip to content
Open
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
7 changes: 7 additions & 0 deletions keras_rcnn/preprocessing/_object_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ def next(self):
label[self.classes[b["class"]]] = 1
labels = numpy.append(labels, [[label]], axis=1)

# check of all boxes are valid, i.e. x1 < x2 and y1 < y2
for i, b in enumerate(self.dictionary[image_index]["boxes"]):
if ( b["x1"] >= b["x2"] ) or ( b["x1"] >= b["x2"] ):
raise Exception(
"invalid bounding boxes (x1 > x2 or y1 > y2"
)

# Scale the ground truth boxes to the selected image scale.
boxes[batch_index, :, :4] *= self.scale

Expand Down