From 200c532d2980e38456a8520c824833fda332636e Mon Sep 17 00:00:00 2001 From: Ulysse Darmet <ulysse.darmet@insa-rennes.fr> Date: Fri, 23 Sep 2016 10:40:06 +0200 Subject: [PATCH] Add the PSNR metrics computed directly by the encoder --- metricsmanager.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/metricsmanager.py b/metricsmanager.py index 81a96dc..43aa40c 100755 --- a/metricsmanager.py +++ b/metricsmanager.py @@ -153,7 +153,12 @@ class profile: def get_metrics_set(self, metric): bitrates_list = np.sum(self.dict['Bitrates'], axis = 0) - if metric == 'mPSNR': + if metric == 'PSNR': + y_psnr = np.array(self.dict['PSNR-Y']) + u_psnr = np.array(self.dict['PSNR-U']) + v_psnr = np.array(self.dict['PSNR-V']) + + elif metric == 'mPSNR': y_psnr = np.array(self.dict['mPSNRY']) u_psnr = np.array(self.dict['mPSNRU']) v_psnr = np.array(self.dict['mPSNRV']) @@ -207,25 +212,26 @@ if __name__ == '__main__': for metric in metrics: x = [] y = [] - for ratio in sorted(profiles1.keys()): - try: + try: + for ratio in sorted(profiles1.keys()): metrics_set1 = profiles1[ratio].get_metrics_set(metric) metrics_set2 = profiles2[ratio].get_metrics_set(metric) - except KeyError: - continue - x.append(ratio) - y.append(func(metrics_set1, metrics_set2)) - plt.plot(x, y, label = metric) + x.append(ratio) + y.append(func(metrics_set1, metrics_set2)) + except KeyError: + continue + else: + plt.plot(x, y, label = metric) # Show plt.title(title) - plt.xlabel(r'$\tau$') + plt.xlabel(r'$\tau = \frac{EL}{EL + BL}$') plt.ylabel(ylabel) plt.legend() return fig # Main function - metrics = ['mPSNR', 'tPSNR', 'PSNR_DE0100', 'HDR-VQM'] + metrics = ['PSNR', 'mPSNR', 'tPSNR', 'PSNR_DE0100', 'HDR-VQM'] rate_figure = plot_bjontegaard(r'BD(SHM, HM) = $f(\tau)$', scalables, simulcast, -- GitLab