This commit is contained in:
Glenn Jocher 2019-05-20 14:52:14 +02:00
parent a9daf244b9
commit 8eced539e0
1 changed files with 2 additions and 0 deletions

View File

@ -195,7 +195,9 @@ class LoadImagesAndLabels(Dataset): # for training/testing
try: try:
with open(file, 'r') as f: with open(file, 'r') as f:
self.labels[i] = np.array([x.split() for x in f.read().splitlines()], dtype=np.float32) self.labels[i] = np.array([x.split() for x in f.read().splitlines()], dtype=np.float32)
assert self.labels[i].shape[1] == 5, 'corrupted labels file: %s' % file
except: except:
print('Warning: missing labels for %s' % self.img_files[i])
pass # missing label file pass # missing label file
def __len__(self): def __len__(self):