From 470ef6bc9271637e1b49137d32dbe4698e9ab478 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 12 Nov 2019 14:16:54 -0800 Subject: [PATCH] updates --- utils/datasets.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/datasets.py b/utils/datasets.py index b8dfbadc..5f7e18b0 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -579,7 +579,6 @@ def load_mosaic(self, index): with open(label_path, 'r') as f: x = np.array([x.split() for x in f.read().splitlines()], dtype=np.float32) - labels = [] if x.size > 0: # Normalized xywh to pixel xyxy format labels = x.copy() @@ -587,6 +586,8 @@ def load_mosaic(self, index): labels[:, 2] = h * (x[:, 2] - x[:, 4] / 2) + padh labels[:, 3] = w * (x[:, 1] + x[:, 3] / 2) + padw labels[:, 4] = h * (x[:, 2] + x[:, 4] / 2) + padh + else: + labels = np.zeros((0, 5), dtype=np.float32) labels4.append(labels) if len(labels4):