updates
This commit is contained in:
parent
11ce877bdf
commit
3e5b007e3a
4
test.py
4
test.py
|
@ -158,8 +158,8 @@ def test(cfg,
|
||||||
stats = [np.concatenate(x, 0) for x in list(zip(*stats))] # to numpy
|
stats = [np.concatenate(x, 0) for x in list(zip(*stats))] # to numpy
|
||||||
if len(stats):
|
if len(stats):
|
||||||
p, r, ap, f1, ap_class = ap_per_class(*stats)
|
p, r, ap, f1, ap_class = ap_per_class(*stats)
|
||||||
# if niou > 1:
|
if niou > 1:
|
||||||
# p, r, ap, f1 = p[:, 0], r[:, 0], ap[:, 0], ap.mean(1) # average across ious
|
p, r, ap, f1 = p[:, 0], r[:, 0], ap.mean(1), ap[:, 0] # [P, R, AP@0.5:0.95, AP@0.5]
|
||||||
mp, mr, map, mf1 = p.mean(), r.mean(), ap.mean(), f1.mean()
|
mp, mr, map, mf1 = p.mean(), r.mean(), ap.mean(), f1.mean()
|
||||||
nt = np.bincount(stats[3].astype(np.int64), minlength=nc) # number of targets per class
|
nt = np.bincount(stats[3].astype(np.int64), minlength=nc) # number of targets per class
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -863,7 +863,8 @@ def apply_classifier(x, model, img, im0):
|
||||||
|
|
||||||
def fitness(x):
|
def fitness(x):
|
||||||
# Returns fitness (for use with results.txt or evolve.txt)
|
# Returns fitness (for use with results.txt or evolve.txt)
|
||||||
return x[:, 2] * 0.3 + x[:, 3] * 0.7 # weighted combination of x=[p, r, mAP@0.5, F1 or mAP@0.5:0.95]
|
w = [0.1, 0.1, 0.6, 0.2] # weights for [P, R, mAP, F1]@0.5 or [P, R, mAP@0.5:0.95, mAP@0.5]
|
||||||
|
return (x[:, :4] * np.array([w])).sum(1)
|
||||||
|
|
||||||
|
|
||||||
# Plotting functions ---------------------------------------------------------------------------------------------------
|
# Plotting functions ---------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue