glenn-jocher commited on
Commit
64bce3c
1 Parent(s): 1542cca

Update labels.png with rectangles fix (#1432)

Browse files
Files changed (1) hide show
  1. utils/plots.py +15 -15
utils/plots.py CHANGED
@@ -268,8 +268,21 @@ def plot_labels(labels, save_dir=''):
268
  nc = int(c.max() + 1) # number of classes
269
  colors = color_list()
270
 
271
- fig, ax = plt.subplots(2, 2, figsize=(8, 8), tight_layout=True)
272
- ax = ax.ravel()
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  ax[0].hist(c, bins=np.linspace(0, nc, nc + 1) - 0.5, rwidth=0.8)
274
  ax[0].set_xlabel('classes')
275
  ax[2].scatter(b[0], b[1], c=hist2d(b[0], b[1], 90), cmap='jet')
@@ -294,19 +307,6 @@ def plot_labels(labels, save_dir=''):
294
  plt.savefig(Path(save_dir) / 'labels.png', dpi=200)
295
  plt.close()
296
 
297
- # seaborn correlogram
298
- try:
299
- import seaborn as sns
300
- import pandas as pd
301
- x = pd.DataFrame(b.transpose(), columns=['x', 'y', 'width', 'height'])
302
- sns.pairplot(x, corner=True, diag_kind='hist', kind='scatter', markers='o',
303
- plot_kws=dict(s=3, edgecolor=None, linewidth=1, alpha=0.02),
304
- diag_kws=dict(bins=50))
305
- plt.savefig(Path(save_dir) / 'labels_correlogram.png', dpi=200)
306
- plt.close()
307
- except Exception as e:
308
- pass
309
-
310
 
311
  def plot_evolution(yaml_file='data/hyp.finetune.yaml'): # from utils.plots import *; plot_evolution()
312
  # Plot hyperparameter evolution results in evolve.txt
 
268
  nc = int(c.max() + 1) # number of classes
269
  colors = color_list()
270
 
271
+ # seaborn correlogram
272
+ try:
273
+ import seaborn as sns
274
+ import pandas as pd
275
+ x = pd.DataFrame(b.transpose(), columns=['x', 'y', 'width', 'height'])
276
+ sns.pairplot(x, corner=True, diag_kind='hist', kind='scatter', markers='o',
277
+ plot_kws=dict(s=3, edgecolor=None, linewidth=1, alpha=0.02),
278
+ diag_kws=dict(bins=50))
279
+ plt.savefig(Path(save_dir) / 'labels_correlogram.png', dpi=200)
280
+ plt.close()
281
+ except Exception as e:
282
+ pass
283
+
284
+ # matplotlib labels
285
+ ax = plt.subplots(2, 2, figsize=(8, 8), tight_layout=True)[1].ravel()
286
  ax[0].hist(c, bins=np.linspace(0, nc, nc + 1) - 0.5, rwidth=0.8)
287
  ax[0].set_xlabel('classes')
288
  ax[2].scatter(b[0], b[1], c=hist2d(b[0], b[1], 90), cmap='jet')
 
307
  plt.savefig(Path(save_dir) / 'labels.png', dpi=200)
308
  plt.close()
309
 
 
 
 
 
 
 
 
 
 
 
 
 
 
310
 
311
  def plot_evolution(yaml_file='data/hyp.finetune.yaml'): # from utils.plots import *; plot_evolution()
312
  # Plot hyperparameter evolution results in evolve.txt