From 6e04b94fa9fb12ff66b2329660de8a5a8e5f1b1d Mon Sep 17 00:00:00 2001 From: Peter van Lunteren Date: Mon, 22 May 2023 14:12:10 +0200 Subject: [PATCH] add smoothing line to results.png to improve readability (#11536) Signed-off-by: Peter van Lunteren Co-authored-by: Glenn Jocher --- utils/plots.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/plots.py b/utils/plots.py index d1284b9..754fabb 100644 --- a/utils/plots.py +++ b/utils/plots.py @@ -18,6 +18,7 @@ import pandas as pd import seaborn as sn import torch from PIL import Image, ImageDraw, ImageFont +from scipy.ndimage.filters import gaussian_filter1d from utils import TryExcept, threaded from utils.general import (CONFIG_DIR, FONT, LOGGER, check_font, check_requirements, clip_boxes, increment_path, @@ -500,7 +501,8 @@ def plot_results(file='path/to/results.csv', dir=''): for i, j in enumerate([1, 2, 3, 4, 5, 8, 9, 10, 6, 7]): y = data.values[:, j].astype('float') # y[y == 0] = np.nan # don't show zero values - ax[i].plot(x, y, marker='.', label=f.stem, linewidth=2, markersize=8) + ax[i].plot(x, y, marker='.', label=f.stem, linewidth=2, markersize=8) # actual results + ax[i].plot(x, gaussian_filter1d(y, sigma=3), ':', label='smooth', linewidth=2) # smoothing line ax[i].set_title(s[j], fontsize=12) # if j in [8, 9, 10]: # share train and val loss y axes # ax[i].get_shared_y_axes().join(ax[i], ax[i - 5])