From b10609fe6b6dc2718cc8932ba00fb2b2f0bdf57d Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sun, 31 May 2020 15:07:04 -0700 Subject: [PATCH] updates --- README.md | 1 + models/yolov5m.yaml | 1 - utils/utils.py | 25 +++++++++++++++---------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 15cce34..6d6b384 100755 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@   This repository represents Ultralytics open-source research into future object detection methods, and incorporates our lessons learned and best practices evolved over training thousands of models on custom client datasets with our previous YOLO repository https://github.com/ultralytics/yolov3. **All code and models are under active development, and are subject to modification or deletion without notice.** Use at your own risk. + ** GPU Latency measures end-to-end latency per image averaged over 5000 COCO val2017 images using a V100 GPU and includes image preprocessing, inference, postprocessing and NMS. diff --git a/models/yolov5m.yaml b/models/yolov5m.yaml index 51f91b0..f05697c 100644 --- a/models/yolov5m.yaml +++ b/models/yolov5m.yaml @@ -43,4 +43,3 @@ head: [[], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5) ] - diff --git a/utils/utils.py b/utils/utils.py index 8d557df..40432fe 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -983,7 +983,11 @@ def plot_study_txt(f='study.txt', x=None): # from utils.utils import *; plot_st fig, ax = plt.subplots(2, 4, figsize=(10, 6), tight_layout=True) ax = ax.ravel() - for f in glob.glob('study*.txt'): + fig2, ax2 = plt.subplots(1, 1, figsize=(8, 4), tight_layout=True) + ax2.plot(1E3 / np.array([209, 140, 97, 58, 35, 18][:-1]), [33.5, 39.1, 42.5, 45.9, 49., 50.5][:-1], + '.-', linewidth=2, markersize=8, alpha=0.3, label='EfficientDet') + + for f in sorted(glob.glob('study*.txt')): y = np.loadtxt(f, dtype=np.float32, usecols=[0, 1, 2, 3, 7, 8, 9], ndmin=2).T x = np.arange(y.shape[1]) if x is None else np.array(x) s = ['P', 'R', 'mAP@.5', 'mAP@.5:.95', 't_inference (ms/img)', 't_NMS (ms/img)', 't_total (ms/img)'] @@ -992,15 +996,16 @@ def plot_study_txt(f='study.txt', x=None): # from utils.utils import *; plot_st ax[i].set_title(s[i]) j = y[3].argmax() + 1 - ax[7].plot(y[6, :j], y[3, :j] * 1E2, '.-', linewidth=2, markersize=8, label=Path(f).stem) - - ax[7].plot(1E3 / np.array([209, 140, 97, 58, 35, 18]), [33.5, 39.1, 42.5, 45.9, 49., 50.5], - '.-', linewidth=2, markersize=8, label='EfficientDet') - ax[7].set_xlim(0) - ax[7].set_xlabel('Latency (ms)') - ax[7].set_ylabel('COCO AP val') - ax[7].legend() - + ax2.plot(y[6, :j], y[3, :j] * 1E2, '.-', linewidth=2, markersize=8, + label=Path(f).stem.replace('study_coco_', '').replace('yolo', 'YOLO')) + + ax2.set_xlim(0) + ax2.set_ylim(23, 50) + ax2.set_xlabel('GPU Latency (ms)') + ax2.set_ylabel('COCO AP val') + ax2.legend(loc='lower right') + ax2.grid() + plt.savefig('study_mAP_latency.png', dpi=300) plt.savefig(f.replace('.txt', '.png'), dpi=200)