diff --git a/analysis/analysis.py b/analysis/analysis.py index b08cbe8..ce7284e 100644 --- a/analysis/analysis.py +++ b/analysis/analysis.py @@ -27,6 +27,8 @@ def filestring_to_hardware(filestring): hardware = 'CPU' elif 'gpu' in filestring: hardware = 'GPU' + elif 'ncs2' in filestring: + hardware = 'NCS2' elif 'movidius' in filestring: hardware = 'MOVIDIUS' elif 'loihi' in filestring: diff --git a/analysis/summary.py b/analysis/summary.py index 5694915..b6947c7 100644 --- a/analysis/summary.py +++ b/analysis/summary.py @@ -64,7 +64,7 @@ def set_legend_title(ax): all_samples = idle_samples + run_samples dframe = pandas.DataFrame(all_samples) -order = ['CPU', 'GPU', 'JETSON', 'MOVIDIUS', 'LOIHI'] +order = ['CPU', 'GPU', 'JETSON', 'NCS2', 'MOVIDIUS', 'LOIHI'] # TABLE 1: Power, energy cost for all hardware devices @@ -76,20 +76,21 @@ def set_legend_title(ax): # compute means over all samples for each hardware device mean_loihi = joules_dframe.loc[joules_dframe['hardware'] == 'LOIHI'].mean() +mean_ncs2 = joules_dframe.loc[joules_dframe['hardware'] == 'NCS2'].mean() mean_movidius = joules_dframe.loc[joules_dframe['hardware'] == 'MOVIDIUS'].mean() mean_jetson = joules_dframe.loc[joules_dframe['hardware'] == 'JETSON'].mean() mean_cpu = joules_dframe.loc[joules_dframe['hardware'] == 'CPU'].mean() mean_gpu = joules_dframe.loc[joules_dframe['hardware'] == 'GPU'].mean() # print out mean values for populating table in summary document -prefixes = ['loihi', 'movidius', 'jetson', 'cpu', 'gpu'] +prefixes = ['loihi', 'movidius', 'ncs2', 'jetson', 'cpu', 'gpu'] print('Idle Power') for prefix in prefixes: print(prefix + ': %4f' % average_idle_power(idle_samples, prefix)) print('') -means = [mean_loihi, mean_movidius, mean_jetson, mean_cpu, mean_gpu] +means = [mean_loihi, mean_movidius, mean_ncs2, mean_jetson, mean_cpu, mean_gpu] for data, prefix in zip(means, prefixes): print(prefix + ':') print('Total Power: %4f' % data['total_power']) @@ -100,6 +101,7 @@ def set_legend_title(ax): # compute ratios for energy costs for plotting numbers alongside bars movidius_x = mean_movidius['dynamic_joules_per_inf'] / mean_loihi['dynamic_joules_per_inf'] +ncs_x = mean_ncs2['dynamic_joules_per_inf'] / mean_loihi['dynamic_joules_per_inf'] jetson_x = mean_jetson['dynamic_joules_per_inf'] / mean_loihi['dynamic_joules_per_inf'] cpu_x = mean_cpu['dynamic_joules_per_inf'] / mean_loihi['dynamic_joules_per_inf'] gpu_x = mean_gpu['dynamic_joules_per_inf'] / mean_loihi['dynamic_joules_per_inf'] @@ -110,17 +112,19 @@ def set_legend_title(ax): plot = sns.barplot( 'hardware', 'dynamic_joules_per_inf', data=joules_dframe, - order=['LOIHI', 'MOVIDIUS', 'JETSON', 'CPU', 'GPU']) + order=['LOIHI', 'MOVIDIUS', 'NCS2', 'JETSON', 'CPU', 'GPU']) # add ratios of power consumption to plot plt.gcf().text( 0.18, 0.17, str(1) + 'x', fontsize=15, fontweight='bold') plt.gcf().text( - 0.33, 0.17, str(round(movidius_x, 1)) + 'x', fontsize=15, fontweight='bold') + 0.28, 0.17, str(round(movidius_x, 1)) + 'x', fontsize=15, fontweight='bold') plt.gcf().text( - 0.47, 0.17, str(round(jetson_x, 1)) + 'x', fontsize=15, fontweight='bold') + 0.41, 0.17, str(round(ncs_x, 1)) + 'x', fontsize=15, fontweight='bold') plt.gcf().text( - 0.62, 0.17, str(round(cpu_x, 1)) + 'x', fontsize=15, fontweight='bold') + 0.52, 0.17, str(round(jetson_x, 1)) + 'x', fontsize=15, fontweight='bold') +plt.gcf().text( + 0.65, 0.17, str(round(cpu_x, 1)) + 'x', fontsize=15, fontweight='bold') plt.gcf().text( 0.77, 0.17, str(round(gpu_x, 1)) + 'x', fontsize=15, fontweight='bold') @@ -131,7 +135,6 @@ def set_legend_title(ax): plot.figure.savefig("./paper/figures/per_inf_comparison.png") plt.show() - # PLOT 2. Batchsize comparison fig, ax = plt.subplots(1, 2, figsize=(12, 6)) fig.subplots_adjust(hspace=0.9) diff --git a/models.py b/models.py index 56c43d4..d4feea0 100644 --- a/models.py +++ b/models.py @@ -1,7 +1,7 @@ import string import warnings import numpy as np -# import tensorflow as tf +import tensorflow as tf # attempt to import movidius V1 api, won't work in conda environment try: @@ -34,9 +34,6 @@ input_blob = next(iter(network.inputs)) output_blob = next(iter(network.outputs)) - print(network.batch_size) - print(network.precision) - except ImportError: warnings.warn('NCS OpenVino API not installed', UserWarning)