glenn-jocher commited on
Commit
9646ca4
·
unverified ·
1 Parent(s): be9edff

Update plot_study() (#2112)

Browse files
models/hub/yolov5l6.yaml CHANGED
@@ -54,7 +54,7 @@ head:
54
 
55
  [ -1, 1, Conv, [ 768, 3, 2 ] ],
56
  [ [ -1, 12 ], 1, Concat, [ 1 ] ], # cat head P6
57
- [ -1, 3, C3, [ 1024, False ] ], # 32 (P5/64-xlarge)
58
 
59
  [ [ 23, 26, 29, 32 ], 1, Detect, [ nc, anchors ] ], # Detect(P3, P4, P5, P6)
60
  ]
 
54
 
55
  [ -1, 1, Conv, [ 768, 3, 2 ] ],
56
  [ [ -1, 12 ], 1, Concat, [ 1 ] ], # cat head P6
57
+ [ -1, 3, C3, [ 1024, False ] ], # 32 (P6/64-xlarge)
58
 
59
  [ [ 23, 26, 29, 32 ], 1, Detect, [ nc, anchors ] ], # Detect(P3, P4, P5, P6)
60
  ]
models/hub/yolov5m6.yaml CHANGED
@@ -54,7 +54,7 @@ head:
54
 
55
  [ -1, 1, Conv, [ 768, 3, 2 ] ],
56
  [ [ -1, 12 ], 1, Concat, [ 1 ] ], # cat head P6
57
- [ -1, 3, C3, [ 1024, False ] ], # 32 (P5/64-xlarge)
58
 
59
  [ [ 23, 26, 29, 32 ], 1, Detect, [ nc, anchors ] ], # Detect(P3, P4, P5, P6)
60
  ]
 
54
 
55
  [ -1, 1, Conv, [ 768, 3, 2 ] ],
56
  [ [ -1, 12 ], 1, Concat, [ 1 ] ], # cat head P6
57
+ [ -1, 3, C3, [ 1024, False ] ], # 32 (P6/64-xlarge)
58
 
59
  [ [ 23, 26, 29, 32 ], 1, Detect, [ nc, anchors ] ], # Detect(P3, P4, P5, P6)
60
  ]
models/hub/yolov5s6.yaml CHANGED
@@ -54,7 +54,7 @@ head:
54
 
55
  [ -1, 1, Conv, [ 768, 3, 2 ] ],
56
  [ [ -1, 12 ], 1, Concat, [ 1 ] ], # cat head P6
57
- [ -1, 3, C3, [ 1024, False ] ], # 32 (P5/64-xlarge)
58
 
59
  [ [ 23, 26, 29, 32 ], 1, Detect, [ nc, anchors ] ], # Detect(P3, P4, P5, P6)
60
  ]
 
54
 
55
  [ -1, 1, Conv, [ 768, 3, 2 ] ],
56
  [ [ -1, 12 ], 1, Concat, [ 1 ] ], # cat head P6
57
+ [ -1, 3, C3, [ 1024, False ] ], # 32 (P6/64-xlarge)
58
 
59
  [ [ 23, 26, 29, 32 ], 1, Detect, [ nc, anchors ] ], # Detect(P3, P4, P5, P6)
60
  ]
models/hub/yolov5x6.yaml CHANGED
@@ -54,7 +54,7 @@ head:
54
 
55
  [ -1, 1, Conv, [ 768, 3, 2 ] ],
56
  [ [ -1, 12 ], 1, Concat, [ 1 ] ], # cat head P6
57
- [ -1, 3, C3, [ 1024, False ] ], # 32 (P5/64-xlarge)
58
 
59
  [ [ 23, 26, 29, 32 ], 1, Detect, [ nc, anchors ] ], # Detect(P3, P4, P5, P6)
60
  ]
 
54
 
55
  [ -1, 1, Conv, [ 768, 3, 2 ] ],
56
  [ [ -1, 12 ], 1, Concat, [ 1 ] ], # cat head P6
57
+ [ -1, 3, C3, [ 1024, False ] ], # 32 (P6/64-xlarge)
58
 
59
  [ [ 23, 26, 29, 32 ], 1, Detect, [ nc, anchors ] ], # Detect(P3, P4, P5, P6)
60
  ]
utils/plots.py CHANGED
@@ -226,16 +226,17 @@ def plot_targets_txt(): # from utils.plots import *; plot_targets_txt()
226
  def plot_study_txt(path='', x=None): # from utils.plots import *; plot_study_txt()
227
  # Plot study.txt generated by test.py
228
  fig, ax = plt.subplots(2, 4, figsize=(10, 6), tight_layout=True)
229
- ax = ax.ravel()
230
 
231
  fig2, ax2 = plt.subplots(1, 1, figsize=(8, 4), tight_layout=True)
232
- for f in [Path(path) / f'study_coco_{x}.txt' for x in ['yolov5s', 'yolov5m', 'yolov5l', 'yolov5x']]:
 
233
  y = np.loadtxt(f, dtype=np.float32, usecols=[0, 1, 2, 3, 7, 8, 9], ndmin=2).T
234
  x = np.arange(y.shape[1]) if x is None else np.array(x)
235
  s = ['P', 'R', '[email protected]', '[email protected]:.95', 't_inference (ms/img)', 't_NMS (ms/img)', 't_total (ms/img)']
236
- for i in range(7):
237
- ax[i].plot(x, y[i], '.-', linewidth=2, markersize=8)
238
- ax[i].set_title(s[i])
239
 
240
  j = y[3].argmax() + 1
241
  ax2.plot(y[6, :j], y[3, :j] * 1E2, '.-', linewidth=2, markersize=8,
@@ -244,14 +245,14 @@ def plot_study_txt(path='', x=None): # from utils.plots import *; plot_study_tx
244
  ax2.plot(1E3 / np.array([209, 140, 97, 58, 35, 18]), [34.6, 40.5, 43.0, 47.5, 49.7, 51.5],
245
  'k.-', linewidth=2, markersize=8, alpha=.25, label='EfficientDet')
246
 
247
- ax2.grid()
248
- ax2.set_yticks(np.arange(30, 60, 5))
249
  ax2.set_xlim(0, 30)
250
- ax2.set_ylim(29, 51)
251
  ax2.set_xlabel('GPU Speed (ms/img)')
252
  ax2.set_ylabel('COCO AP val')
253
  ax2.legend(loc='lower right')
254
- plt.savefig('test_study.png', dpi=300)
255
 
256
 
257
  def plot_labels(labels, save_dir=Path(''), loggers=None):
 
226
  def plot_study_txt(path='', x=None): # from utils.plots import *; plot_study_txt()
227
  # Plot study.txt generated by test.py
228
  fig, ax = plt.subplots(2, 4, figsize=(10, 6), tight_layout=True)
229
+ # ax = ax.ravel()
230
 
231
  fig2, ax2 = plt.subplots(1, 1, figsize=(8, 4), tight_layout=True)
232
+ # for f in [Path(path) / f'study_coco_{x}.txt' for x in ['yolov5s', 'yolov5m', 'yolov5l', 'yolov5x']]:
233
+ for f in sorted(Path(path).glob('study*.txt')):
234
  y = np.loadtxt(f, dtype=np.float32, usecols=[0, 1, 2, 3, 7, 8, 9], ndmin=2).T
235
  x = np.arange(y.shape[1]) if x is None else np.array(x)
236
  s = ['P', 'R', '[email protected]', '[email protected]:.95', 't_inference (ms/img)', 't_NMS (ms/img)', 't_total (ms/img)']
237
+ # for i in range(7):
238
+ # ax[i].plot(x, y[i], '.-', linewidth=2, markersize=8)
239
+ # ax[i].set_title(s[i])
240
 
241
  j = y[3].argmax() + 1
242
  ax2.plot(y[6, :j], y[3, :j] * 1E2, '.-', linewidth=2, markersize=8,
 
245
  ax2.plot(1E3 / np.array([209, 140, 97, 58, 35, 18]), [34.6, 40.5, 43.0, 47.5, 49.7, 51.5],
246
  'k.-', linewidth=2, markersize=8, alpha=.25, label='EfficientDet')
247
 
248
+ ax2.grid(alpha=0.2)
249
+ ax2.set_yticks(np.arange(20, 60, 5))
250
  ax2.set_xlim(0, 30)
251
+ ax2.set_ylim(30, 55)
252
  ax2.set_xlabel('GPU Speed (ms/img)')
253
  ax2.set_ylabel('COCO AP val')
254
  ax2.legend(loc='lower right')
255
+ plt.savefig(str(Path(path).name) + '.png', dpi=300)
256
 
257
 
258
  def plot_labels(labels, save_dir=Path(''), loggers=None):