def reshape_and_perm(x): x_reshaped = np.reshape(x, [x.shape[0], -1, 3]) x_reshaped = np.reshape(x, [x.shape[0], -1, 3]) channel1 = x_reshaped[:, :, 0] channel1 = x_reshaped[:, :, 0] channel1 = np.squeeze(channel1) print("channel1 shape: {}".format(channel1.shape)) channel1_perm = perm_data(channel1, perm) channel2 = x_reshaped[:, :, 1] channel2 = x_reshaped[:, :, 1] channel2 = np.squeeze(channel2) print("channel2 shape: {}".format(channel2.shape)) channel2_perm = perm_data(channel2, perm) channel3 = x_reshaped[:, :, 1] channel3 = x_reshaped[:, :, 1] channel3 = np.squeeze(channel3) print("channel3 shape: {}".format(channel3.shape)) channel3_perm = perm_data(channel3, perm) stacked_data = np.dstack((channel1_perm, channel2_perm, channel3_perm)) print("stacked data shape: {}".format(stacked_data.shape)) # stacked_data = np.reshape(stacked_data, [stacked_data.shape[0], -1]) return stacked_data
def reshape_and_perm(x): #testing if removing the sqeeze function fies the error for checking on individual images x_reshaped = np.reshape(x, [x.shape[0], -1, 3]) #x_reshaped = np.reshape(x, [x.shape[0], -1, 3]) channel1 = x_reshaped[:, :, 0] #channel1 = x_reshaped[:,:,0] #channel1 = np.squeeze(channel1) print("channel1 shape: {}".format(channel1.shape)) channel1_perm = perm_data(channel1, perm) channel2 = x_reshaped[:, :, 1] #channel2 = x_reshaped[:,:,1] #channel2 = np.squeeze(channel2) print("channel2 shape: {}".format(channel2.shape)) channel2_perm = perm_data(channel2, perm) channel3 = x_reshaped[:, :, 2] #channel3 = x_reshaped[:,:,1] #channel3 = np.squeeze(channel3) print("channel3 shape: {}".format(channel3.shape)) channel3_perm = perm_data(channel3, perm) stacked_data = np.dstack((channel1_perm, channel2_perm, channel3_perm)) print("stacked data shape: {}".format(stacked_data.shape)) # stacked_data = np.reshape(stacked_data, [stacked_data.shape[0], -1]) return stacked_data
# Compute coarsened graphs coarsening_levels = 4 num_vertices, L, perm = coarsen(A, coarsening_levels) # Compute max eigenvalue of graph Laplacians lmax = [] for i in range(coarsening_levels): lmax.append(lmaxX(L[i])) print('lmax: ' + str([lmax[i] for i in range(coarsening_levels)])) train_data = tf.Session().run(train_data) #comment this line for non rotated test images test_data = tf.Session().run(test_data) # Reindex nodes to satisfy a binary tree structure train_data = perm_data(train_data, perm) val_data = perm_data(val_data, perm) test_data = perm_data(test_data, perm) print(train_data.shape) print(val_data.shape) print(test_data.shape) print('Execution time: {:.2f}s'.format(time.time() - t_start)) del perm class Graph_ConvNet_LeNet5(object): # Constructor def __init__(self, net_parameters):