test.py --task test updates
parent
f1678ba8f4
commit
aa08b2bd6f
2
test.py
2
test.py
|
@ -165,7 +165,7 @@ def test(data,
|
|||
|
||||
# Compute statistics
|
||||
stats = [np.concatenate(x, 0) for x in zip(*stats)] # to numpy
|
||||
if len(stats):
|
||||
if len(stats) and stats[0].any():
|
||||
p, r, ap, f1, ap_class = ap_per_class(*stats)
|
||||
p, r, ap50, ap = p[:, 0], r[:, 0], ap[:, 0], ap.mean(1) # [P, R, AP@0.5, AP@0.5:0.95]
|
||||
mp, mr, map50, map = p.mean(), r.mean(), ap50.mean(), ap.mean()
|
||||
|
|
|
@ -416,7 +416,10 @@ class LoadImagesAndLabels(Dataset): # for training/testing
|
|||
|
||||
pbar.desc = 'Scanning labels %s (%g found, %g missing, %g empty, %g duplicate, for %g images)' % (
|
||||
cache_path, nf, nm, ne, nd, n)
|
||||
assert nf > 0, 'No labels found in %s. See %s' % (os.path.dirname(file) + os.sep, help_url)
|
||||
if nf == 0:
|
||||
s = 'WARNING: No labels found in %s. See %s' % (os.path.dirname(file) + os.sep, help_url)
|
||||
print(s)
|
||||
assert not augment, '%s. Can not train without labels.' % s
|
||||
|
||||
# Cache images into memory for faster training (WARNING: large datasets may exceed system RAM)
|
||||
self.imgs = [None] * n
|
||||
|
|
Loading…
Reference in New Issue