Skip to content
Snippets Groups Projects
Commit 200c532d authored by Ulysse Darmet's avatar Ulysse Darmet
Browse files

Add the PSNR metrics computed directly by the encoder

parent ddce9da8
Branches master
No related tags found
No related merge requests found
...@@ -153,7 +153,12 @@ class profile: ...@@ -153,7 +153,12 @@ class profile:
def get_metrics_set(self, metric): def get_metrics_set(self, metric):
bitrates_list = np.sum(self.dict['Bitrates'], axis = 0) 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']) y_psnr = np.array(self.dict['mPSNRY'])
u_psnr = np.array(self.dict['mPSNRU']) u_psnr = np.array(self.dict['mPSNRU'])
v_psnr = np.array(self.dict['mPSNRV']) v_psnr = np.array(self.dict['mPSNRV'])
...@@ -207,25 +212,26 @@ if __name__ == '__main__': ...@@ -207,25 +212,26 @@ if __name__ == '__main__':
for metric in metrics: for metric in metrics:
x = [] x = []
y = [] y = []
for ratio in sorted(profiles1.keys()): try:
try: for ratio in sorted(profiles1.keys()):
metrics_set1 = profiles1[ratio].get_metrics_set(metric) metrics_set1 = profiles1[ratio].get_metrics_set(metric)
metrics_set2 = profiles2[ratio].get_metrics_set(metric) metrics_set2 = profiles2[ratio].get_metrics_set(metric)
except KeyError: x.append(ratio)
continue y.append(func(metrics_set1, metrics_set2))
x.append(ratio) except KeyError:
y.append(func(metrics_set1, metrics_set2)) continue
plt.plot(x, y, label = metric) else:
plt.plot(x, y, label = metric)
# Show # Show
plt.title(title) plt.title(title)
plt.xlabel(r'$\tau$') plt.xlabel(r'$\tau = \frac{EL}{EL + BL}$')
plt.ylabel(ylabel) plt.ylabel(ylabel)
plt.legend() plt.legend()
return fig return fig
# Main function # 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)$', rate_figure = plot_bjontegaard(r'BD(SHM, HM) = $f(\tau)$',
scalables, simulcast, scalables, simulcast,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment