Skip to content

Commit

Permalink
introduced command line flags for the range and step size, as well as…
Browse files Browse the repository at this point in the history
… a debug mode
  • Loading branch information
StefanoWoerner committed May 22, 2018
1 parent 90a85b2 commit cb08b6e
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@

root = os.path.dirname(os.path.realpath(__file__))

# Configuration
# Config
tf.flags.DEFINE_boolean('debug', False, 'Debug mode')
tf.flags.DEFINE_string('image1', 'data/training/image_2/000055_10.png', 'Image 1')
tf.flags.DEFINE_string('image2', 'data/training/image_2/000055_11.png', 'Image 2')
tf.flags.DEFINE_integer('ymin', -64, 'Disparity range minimum in y-Direction')
tf.flags.DEFINE_integer('ymax', 64, 'Disparity range maximum in y-Direction')
tf.flags.DEFINE_integer('xmin', -64, 'Disparity range minimum in x-Direction')
tf.flags.DEFINE_integer('xmax', 64, 'Disparity range maximum in x-Direction')
tf.flags.DEFINE_integer('ystep', 16, 'Disparity block size in y-Direction')
tf.flags.DEFINE_integer('xstep', 16, 'Disparity block size in x-Direction')


def cart2pol(x, y):
Expand All @@ -25,12 +32,17 @@ def vis_flow(image):
return hsv2rgb(np.stack((phi, rho, np.ones_like(rho)), axis=-1))

def main(_):
config = tf.flags.FLAGS.__flags.copy()
FLAGS = tf.flags.FLAGS
if FLAGS.debug:
for k, v in FLAGS.__flags.items():
print("{}: {}".format(k.upper(), v.value))
print("")

model = VGG16FlowSearch()
im1 = imread(os.path.join(root, tf.flags.FLAGS.image1))
im2 = imread(os.path.join(root, tf.flags.FLAGS.image2))
flow = model.infer(im1, im2)
im1 = imread(os.path.join(root, FLAGS.image1))
im2 = imread(os.path.join(root, FLAGS.image2))
flow = model.infer(im1, im2, d_range=[[FLAGS.ymin,FLAGS.ymax],[FLAGS.xmin,FLAGS.xmax]],
step=[FLAGS.ystep,FLAGS.xstep])

plt.figure(figsize=(26, 6))
plt.subplot(1, 2, 1)
Expand Down

0 comments on commit cb08b6e

Please sign in to comment.