Update profile_idetection() (#1727)
parent
d5289b54c4
commit
49abc722fc
|
@ -330,9 +330,8 @@ def plot_evolution(yaml_file='data/hyp.finetune.yaml'): # from utils.plots impo
|
||||||
|
|
||||||
|
|
||||||
def profile_idetection(start=0, stop=0, labels=(), save_dir=''):
|
def profile_idetection(start=0, stop=0, labels=(), save_dir=''):
|
||||||
# Plot iDetection '*.txt' per-image logs. from . import *; profile_idetection()
|
# Plot iDetection '*.txt' per-image logs. from utils.plots import *; profile_idetection()
|
||||||
fig, ax = plt.subplots(2, 4, figsize=(12, 6), tight_layout=True)
|
ax = plt.subplots(2, 4, figsize=(12, 6), tight_layout=True)[1].ravel()
|
||||||
ax = ax.ravel()
|
|
||||||
s = ['Images', 'Free Storage (GB)', 'RAM Usage (GB)', 'Battery', 'dt_raw (ms)', 'dt_smooth (ms)', 'real-world FPS']
|
s = ['Images', 'Free Storage (GB)', 'RAM Usage (GB)', 'Battery', 'dt_raw (ms)', 'dt_smooth (ms)', 'real-world FPS']
|
||||||
files = list(Path(save_dir).glob('frames*.txt'))
|
files = list(Path(save_dir).glob('frames*.txt'))
|
||||||
for fi, f in enumerate(files):
|
for fi, f in enumerate(files):
|
||||||
|
@ -340,17 +339,17 @@ def profile_idetection(start=0, stop=0, labels=(), save_dir=''):
|
||||||
results = np.loadtxt(f, ndmin=2).T[:, 90:-30] # clip first and last rows
|
results = np.loadtxt(f, ndmin=2).T[:, 90:-30] # clip first and last rows
|
||||||
n = results.shape[1] # number of rows
|
n = results.shape[1] # number of rows
|
||||||
x = np.arange(start, min(stop, n) if stop else n)
|
x = np.arange(start, min(stop, n) if stop else n)
|
||||||
|
results = results[:, x]
|
||||||
t = (results[0] - results[0].min()) # set t0=0s
|
t = (results[0] - results[0].min()) # set t0=0s
|
||||||
results[0] = x
|
results[0] = x
|
||||||
for i, a in enumerate(ax):
|
for i, a in enumerate(ax):
|
||||||
if i < len(results):
|
if i < len(results):
|
||||||
y = results[i, x]
|
|
||||||
label = labels[fi] if len(labels) else f.stem.replace('frames_', '')
|
label = labels[fi] if len(labels) else f.stem.replace('frames_', '')
|
||||||
a.plot(t, y, marker='.', label=label, linewidth=1, markersize=5)
|
a.plot(t, results[i], marker='.', label=label, linewidth=1, markersize=5)
|
||||||
a.set_title(s[i])
|
a.set_title(s[i])
|
||||||
a.set_xlabel('time (s)')
|
a.set_xlabel('time (s)')
|
||||||
# if fi == len(files) - 1:
|
# if fi == len(files) - 1:
|
||||||
# a.set_ylim(bottom=0)
|
# a.set_ylim(bottom=0)
|
||||||
for side in ['top', 'right']:
|
for side in ['top', 'right']:
|
||||||
a.spines[side].set_visible(False)
|
a.spines[side].set_visible(False)
|
||||||
else:
|
else:
|
||||||
|
@ -359,7 +358,7 @@ def profile_idetection(start=0, stop=0, labels=(), save_dir=''):
|
||||||
print('Warning: Plotting error for %s; %s' % (f, e))
|
print('Warning: Plotting error for %s; %s' % (f, e))
|
||||||
|
|
||||||
ax[1].legend()
|
ax[1].legend()
|
||||||
fig.savefig(Path(save_dir) / 'idetection_profile.png', dpi=200)
|
plt.savefig(Path(save_dir) / 'idetection_profile.png', dpi=200)
|
||||||
|
|
||||||
|
|
||||||
def plot_results_overlay(start=0, stop=0): # from utils.plots import *; plot_results_overlay()
|
def plot_results_overlay(start=0, stop=0): # from utils.plots import *; plot_results_overlay()
|
||||||
|
|
Loading…
Reference in New Issue