glenn-jocher
commited on
Commit
•
aa08b2b
1
Parent(s):
f1678ba
test.py --task test updates
Browse files- test.py +1 -1
- utils/datasets.py +4 -1
test.py
CHANGED
@@ -165,7 +165,7 @@ def test(data,
|
|
165 |
|
166 |
# Compute statistics
|
167 |
stats = [np.concatenate(x, 0) for x in zip(*stats)] # to numpy
|
168 |
-
if len(stats):
|
169 |
p, r, ap, f1, ap_class = ap_per_class(*stats)
|
170 |
p, r, ap50, ap = p[:, 0], r[:, 0], ap[:, 0], ap.mean(1) # [P, R, AP@0.5, AP@0.5:0.95]
|
171 |
mp, mr, map50, map = p.mean(), r.mean(), ap50.mean(), ap.mean()
|
|
|
165 |
|
166 |
# Compute statistics
|
167 |
stats = [np.concatenate(x, 0) for x in zip(*stats)] # to numpy
|
168 |
+
if len(stats) and stats[0].any():
|
169 |
p, r, ap, f1, ap_class = ap_per_class(*stats)
|
170 |
p, r, ap50, ap = p[:, 0], r[:, 0], ap[:, 0], ap.mean(1) # [P, R, AP@0.5, AP@0.5:0.95]
|
171 |
mp, mr, map50, map = p.mean(), r.mean(), ap50.mean(), ap.mean()
|
utils/datasets.py
CHANGED
@@ -416,7 +416,10 @@ class LoadImagesAndLabels(Dataset): # for training/testing
|
|
416 |
|
417 |
pbar.desc = 'Scanning labels %s (%g found, %g missing, %g empty, %g duplicate, for %g images)' % (
|
418 |
cache_path, nf, nm, ne, nd, n)
|
419 |
-
|
|
|
|
|
|
|
420 |
|
421 |
# Cache images into memory for faster training (WARNING: large datasets may exceed system RAM)
|
422 |
self.imgs = [None] * n
|
|
|
416 |
|
417 |
pbar.desc = 'Scanning labels %s (%g found, %g missing, %g empty, %g duplicate, for %g images)' % (
|
418 |
cache_path, nf, nm, ne, nd, n)
|
419 |
+
if nf == 0:
|
420 |
+
s = 'WARNING: No labels found in %s. See %s' % (os.path.dirname(file) + os.sep, help_url)
|
421 |
+
print(s)
|
422 |
+
assert not augment, '%s. Can not train without labels.' % s
|
423 |
|
424 |
# Cache images into memory for faster training (WARNING: large datasets may exceed system RAM)
|
425 |
self.imgs = [None] * n
|