def _create_loss1(self): pass x = tf.layers.conv2d(self.lr_input, self.hidden_size, 1, activation=None, name='in') #self.test=tf.reduce_mean(x) #low resolution for i in range(6): x = utils.crop_by_pixel(x, 1) + self.conv( x, self.hidden_size, self.bottleneck_size, 'lr_conv' + str(i)) temp = tf.nn.relu(x) #up sampling x = tf.image.resize_nearest_neighbor( x, tf.shape(x)[1:3] * 2) + tf.layers.conv2d_transpose( temp, self.hidden_size, 2, strides=2, name='up_sampling') #high resolution for i in range(4): x = utils.crop_by_pixel(x, 1) + self.conv( x, self.hidden_size, self.bottleneck_size, 'hr_conv' + str(i)) x = tf.nn.relu(x) self.prediction = tf.layers.conv2d(x, 3, 1, name='out') self.target_crop = utils.crop_center(self.target, tf.shape(self.prediction)[1:3]) #self.test=tf.reduce_mean(self.prediction) #self.test=tf.reduce_mean(self.prediction) self.loss = tf.losses.mean_squared_error(self.target_crop, self.prediction)
def _create_struct_without_padding(self): x = tf.layers.conv2d(self.lr_input, self.hidden_size, 1, activation=None, name='in') #self.test=tf.reduce_mean(x) #low resolution for i in range(6): x = utils.crop_by_pixel(x, 1) + self.conv( x, self.hidden_size, self.bottleneck_size, 'lr_conv' + str(i)) temp = tf.nn.relu(x) #up sampling x = tf.image.resize_nearest_neighbor( x, tf.shape(x)[1:3] * 2) + tf.layers.conv2d_transpose( temp, self.hidden_size, 2, strides=2, name='up_sampling') #high resolution for i in range(4): x = utils.crop_by_pixel(x, 1) + self.conv( x, self.hidden_size, self.bottleneck_size, 'hr_conv' + str(i)) x = tf.nn.relu(x) x = tf.layers.conv2d(x, 3, 1, name='out') bicubic = tf.image.resize_bicubic(self.lr_input + 128, tf.shape(self.lr_input)[1:3] * 2, name='bicubic') bicubic = utils.crop_center(bicubic, tf.shape(x)[1:3]) self.bmp_prediction = x + bicubic self.bmp_prediction_cast = tf.saturate_cast(self.bmp_prediction, tf.uint8)
def _create_loss_without_padding(self): self.target_crop = utils.crop_center( self.target, tf.shape(self.bmp_prediction)[1:3]) self.loss = tf.losses.mean_squared_error(self.target_crop, self.bmp_prediction)
def zero_filled(kspace): fourier_op = FFT2(np.ones_like(kspace)) im_recon = np.abs(fourier_op.adj_op(kspace)) im_cropped = crop_center(im_recon, 320) return im_cropped