]> git.sesse.net Git - voxel-flow/commitdiff
Visualize the flow in a summary op.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 8 Feb 2018 23:17:41 +0000 (00:17 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 8 Feb 2018 23:17:41 +0000 (00:17 +0100)
voxel_flow_model.py
voxel_flow_train.py

index 2cca42054555f85e98998ca7dc67d339e77ad456..6193e612f89e94ba89be9324f79ecdbd7e83d90b 100755 (executable)
@@ -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]
index 19847f16cb56a8e7433f6a7c158410589868c2b8..42f91af8b22e6ba0b7fb96888c35c03d0fa62dd6 100755 (executable)
@@ -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)