true_br = br_pairs[0] true_wf = wf_pairs[0] waveform_max = int(true_wf.size / waveform_reduction_factor) # true_wf = true_wf[::waveform_reduction_factor] true_wf = true_wf[:waveform_max] # reshape for mono waveforms true_wf = true_wf.reshape((-1, 1)) # ################ # MODEL DEFINITION # ################ bits_per_second = true_wf.size / 10 train_flag, x, model = deep_residual_network(true_wf.dtype, true_wf.shape, tensorboard_output=False) # placeholder for the truth label y_true = tf.placeholder(true_wf.dtype, shape=x.get_shape()) # ################ # ################ # ############# # LOSS FUNCTION # ############# with tf.name_scope('waveform_mse'): waveform_mse = tf.reduce_mean(tf.square(tf.subtract(y_true, model))) tf.summary.scalar('waveform_mse', waveform_mse)
if END_OFFSET == 0: true_wf = true_wf[BEGIN_OFFSET * true_br:] ds_wf = ds_wf[BEGIN_OFFSET * true_br:] else: true_wf = true_wf[BEGIN_OFFSET * true_br:END_OFFSET * true_br] ds_wf = ds_wf[BEGIN_OFFSET * true_br:END_OFFSET * true_br] true_wf = true_wf[:int(true_wf.size / INPUT_SIZE) * INPUT_SIZE] ds_wf = ds_wf[:int(ds_wf.size / INPUT_SIZE) * INPUT_SIZE] number_of_reco_iterations = int(ds_wf.size / INPUT_SIZE) # ################ # MODEL DEFINITION # ################ train_flag, x, model = deep_residual_network(true_wf.dtype, true_wf.shape, **model_settings) # ################ # ################ # Add ops to restore all the variables. saver = tf.train.Saver() # create session sess = tf.Session() # restore model from checkpoint file saver.restore(sess, model_checkpoint_file_name)