def plot_output(fname, x, y): num_ex = y.shape[0] num_items = 2 num_row, num_col, calc = pu.calc_row_col( num_ex, num_items, max_items_per_row=9) f1, axarr = plt.subplots(num_row, num_col, figsize=(10, num_row)) pu.set_axis_off(axarr, num_row, num_col) for ii in xrange(num_ex): for jj in xrange(num_items): row, col = calc(ii, jj) if jj % 2 == 0: axarr[row, col].imshow(cv2.resize(x[ii], (448, 128))) else: axarr[row, col].imshow(cv2.resize(y[ii], (448, 128))) plt.tight_layout(pad=2.0, w_pad=0.0, h_pad=0.0) plt.savefig(fname, dpi=150) plt.close('all')
def plot_output(fname, x1, x2, y_gt, y_out): num_ex = y_out.shape[0] num_items = 2 num_row, num_col, calc = pu.calc_row_col( num_ex, num_items, max_items_per_row=9) f1, axarr = plt.subplots(num_row, num_col, figsize=(10, num_row)) pu.set_axis_off(axarr, num_row, num_col) for ii in xrange(num_ex): for jj in xrange(num_items): row, col = calc(ii, jj) if jj == 0: axarr[row, col].imshow(x1[ii]) else: axarr[row, col].imshow(x2[ii]) axarr[row, col].text(0, 0, '{:.2f} {:.2f}'.format( y_gt[ii], y_out[ii]), color=(0, 0, 0), size=8) plt.tight_layout(pad=2.0, w_pad=0.0, h_pad=0.0) plt.savefig(fname, dpi=150) plt.close('all')