This commit is contained in:
Glenn Jocher 2019-02-18 14:03:39 +01:00
parent 03685866fd
commit 6deda82384
3 changed files with 11 additions and 10 deletions

View File

@ -111,7 +111,7 @@ def test(
classes = load_classes(data_cfg_dict['names']) # Extracts class labels from file
for i, c in enumerate(classes):
print('%15s: %-.4f' % (c, AP_accum[i] / AP_accum_count[i]))
print('%15s: %-.4f' % (c, AP_accum[i] / (AP_accum_count[i] + 1E-16)))
# Return mAP
return mean_mAP, mean_R, mean_P

View File

@ -91,13 +91,13 @@ class LoadWebcam: # for inference
class LoadImagesAndLabels: # for training
def __init__(self, path, batch_size=1, img_size=608, multi_scale=False, augment=False):
self.path = path
with open(path, 'r') as file:
self.img_files = file.readlines()
self.img_files = [x.replace('\n', '') for x in self.img_files]
self.img_files = list(filter(lambda x: len(x) > 0, self.img_files))
self.img_files = [path.replace('\n', '') for path in self.img_files]
self.label_files = [path.replace('images', 'labels').replace('.png', '.txt').replace('.jpg', '.txt')
for path in self.img_files]
self.label_files = [x.replace('images', 'labels').replace('.png', '.txt').replace('.jpg', '.txt')
for x in self.img_files]
self.nF = len(self.img_files) # number of image files
self.nB = math.ceil(self.nF / batch_size) # number of batches

View File

@ -438,13 +438,14 @@ def plot_results():
# Plot YOLO training results file 'results.txt'
import glob
import matplotlib.pyplot as plt
import numpy as np
# import os; os.system('rm -rf results.txt && wget https://storage.googleapis.com/ultralytics/results_v1_0.txt')
plt.figure(figsize=(16, 8))
s = ['X', 'Y', 'Width', 'Height', 'Objectness', 'Classification', 'Total Loss', 'Precision', 'Recall', 'mAP']
files = sorted(glob.glob('results*.txt'))
s = ['X', 'Y', 'Width', 'Height', 'Confidence', 'Classification', 'Total Loss', 'mAP', 'Recall', 'Precision']
files = sorted(glob.glob('results.txt'))
for f in files:
results = np.loadtxt(f, usecols=[2, 3, 4, 5, 6, 7, 8, 17, 18, 16]).T # column 16 is mAP
results = np.loadtxt(f, usecols=[2, 3, 4, 5, 6, 7, 8, 11, 12, 13]).T # column 13 is mAP
n = results.shape[1]
for i in range(10):
plt.subplot(2, 5, i + 1)