From: Steinar H. Gunderson Date: Thu, 8 Feb 2018 23:17:41 +0000 (+0100) Subject: Visualize the flow in a summary op. X-Git-Url: https://git.sesse.net/?p=voxel-flow;a=commitdiff_plain;h=e80cd1567ea62da68f3483f8f616d148478adb13 Visualize the flow in a summary op. --- diff --git a/voxel_flow_model.py b/voxel_flow_model.py index 2cca420..6193e61 100755 --- a/voxel_flow_model.py +++ b/voxel_flow_model.py @@ -66,6 +66,7 @@ class Voxel_flow_model(object): net = slim.conv2d(net, 64, [5, 5], stride=1, scope='conv6') net = slim.conv2d(net, 3, [5, 5], stride=1, activation_fn=tf.tanh, normalizer_fn=None, scope='conv7') + net_copy = net flow = net[:, :, :, 0:2] mask = tf.expand_dims(net[:, :, :, 2], 3) @@ -89,4 +90,4 @@ class Voxel_flow_model(object): mask = tf.tile(mask, [1, 1, 1, 3]) net = tf.multiply(mask, output_1) + tf.multiply(1.0 - mask, output_2) - return net + return [net, net_copy] diff --git a/voxel_flow_train.py b/voxel_flow_train.py index 19847f1..42f91af 100755 --- a/voxel_flow_train.py +++ b/voxel_flow_train.py @@ -74,7 +74,7 @@ def train(dataset_frame1, dataset_frame2, dataset_frame3): # Prepare model. model = Voxel_flow_model() - prediction = model.inference(input_placeholder) + prediction, flow = model.inference(input_placeholder) # reproduction_loss, prior_loss = model.loss(prediction, target_placeholder) reproduction_loss = model.loss(prediction, target_placeholder) # total_loss = reproduction_loss + prior_loss @@ -97,6 +97,7 @@ def train(dataset_frame1, dataset_frame2, dataset_frame3): summaries.append(tf.summary.image('Input Image (after)', input_placeholder[:, :, :, 3:6], 3)); summaries.append(tf.summary.image('Output Image', prediction, 3)) summaries.append(tf.summary.image('Target Image', target_placeholder, 3)) + summaries.append(tf.summary.image('Flow', flow, 3)) # Create a saver. saver = tf.train.Saver(tf.all_variables()) @@ -176,7 +177,7 @@ def test(dataset_frame1, dataset_frame2, dataset_frame3): # target_resized = tf.image.resize_area(target_placeholder,[128, 128]) # Prepare model. - model = Voxel_flow_model(is_train=True) + model, flow = Voxel_flow_model(is_train=True) prediction = model.inference(input_placeholder) # reproduction_loss, prior_loss = model.loss(prediction, target_placeholder) reproduction_loss = model.loss(prediction, target_placeholder)