-
-
Notifications
You must be signed in to change notification settings - Fork 16.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
59595c1
commit 1df732c
Showing
1 changed file
with
3 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,7 +182,7 @@ def run( | |
|
||
seen = 0 | ||
confusion_matrix = ConfusionMatrix(nc=nc) | ||
names = {k: v for k, v in enumerate(model.names if hasattr(model, 'names') else model.module.names)} | ||
names = dict(enumerate(model.names if hasattr(model, 'names') else model.module.names)) | ||
class_map = coco80_to_coco91_class() if is_coco else list(range(1000)) | ||
s = ('%20s' + '%11s' * 6) % ('Class', 'Images', 'Labels', 'P', 'R', '[email protected]', '[email protected]:.95') | ||
dt, p, r, f1, mp, mr, map50, map = [0.0, 0.0, 0.0], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 | ||
|
@@ -250,7 +250,7 @@ def run( | |
|
||
# Save/log | ||
if save_txt: | ||
save_one_txt(predn, save_conf, shape, file=save_dir / 'labels' / (path.stem + '.txt')) | ||
save_one_txt(predn, save_conf, shape, file=save_dir / 'labels' / f'{path.stem}.txt') | ||
if save_json: | ||
save_one_json(predn, jdict, path, class_map) # append to COCO-JSON dictionary | ||
callbacks.run('on_val_image_end', pred, predn, path, names, im[si]) | ||
|
@@ -268,9 +268,7 @@ def run( | |
tp, fp, p, r, f1, ap, ap_class = ap_per_class(*stats, plot=plots, save_dir=save_dir, names=names) | ||
ap50, ap = ap[:, 0], ap.mean(1) # [email protected], [email protected]:0.95 | ||
mp, mr, map50, map = p.mean(), r.mean(), ap50.mean(), ap.mean() | ||
nt = np.bincount(stats[3].astype(int), minlength=nc) # number of targets per class | ||
else: | ||
nt = torch.zeros(1) | ||
nt = np.bincount(stats[3].astype(int), minlength=nc) # number of targets per class | ||
|
||
# Print results | ||
pf = '%20s' + '%11i' * 2 + '%11.3g' * 4 # print format | ||
|