summaryrefslogtreecommitdiff
path: root/Codes/flownet2/src/flownet_css/test.py
diff options
context:
space:
mode:
authorStevenLiuWen <liuwen@shanghaitech.edu.cn>2018-03-13 03:28:06 -0400
committerStevenLiuWen <liuwen@shanghaitech.edu.cn>2018-03-13 03:28:06 -0400
commitfede6ca1dd0077ff509d84bd24028cc7a93bb119 (patch)
treeaf7f6e759b5dec4fc2964daed09e903958b919ed /Codes/flownet2/src/flownet_css/test.py
first commit
Diffstat (limited to 'Codes/flownet2/src/flownet_css/test.py')
-rw-r--r--Codes/flownet2/src/flownet_css/test.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/Codes/flownet2/src/flownet_css/test.py b/Codes/flownet2/src/flownet_css/test.py
new file mode 100644
index 0000000..9d1249e
--- /dev/null
+++ b/Codes/flownet2/src/flownet_css/test.py
@@ -0,0 +1,51 @@
+import argparse
+import os
+from ..net import Mode
+from .flownet_css import FlowNetCSS
+
+FLAGS = None
+
+
+def main():
+ # Create a new network
+ net = FlowNetCSS(mode=Mode.TEST)
+
+ # Train on the data
+ net.test(
+ checkpoint='./checkpoints/FlowNetCSS/flownet-CSS.ckpt-0',
+ input_a_path=FLAGS.input_a,
+ input_b_path=FLAGS.input_b,
+ out_path=FLAGS.out,
+ )
+
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ parser.add_argument(
+ '--input_a',
+ type=str,
+ required=True,
+ help='Path to first image'
+ )
+ parser.add_argument(
+ '--input_b',
+ type=str,
+ required=True,
+ help='Path to second image'
+ )
+ parser.add_argument(
+ '--out',
+ type=str,
+ required=True,
+ help='Path to output flow result'
+ )
+ FLAGS = parser.parse_args()
+
+ # Verify arguments are valid
+ if not os.path.exists(FLAGS.input_a):
+ raise ValueError('image_a path must exist')
+ if not os.path.exists(FLAGS.input_b):
+ raise ValueError('image_b path must exist')
+ if not os.path.isdir(FLAGS.out):
+ raise ValueError('out directory must exist')
+ main()