Y0_com_img = misc.imread(args.ref) Y1_raw_img = misc.imread(args.raw) Y0_com_img = np.expand_dims(Y0_com_img, 0) Y1_raw_img = np.expand_dims(Y1_raw_img, 0) Height = np.size(Y1_raw_img, 1) Width = np.size(Y1_raw_img, 2) Y0_com = tf.placeholder(tf.float32, [batch_size, Height, Width, Channel]) Y1_raw = tf.placeholder(tf.float32, [batch_size, Height, Width, Channel]) with tf.variable_scope("flow_motion"): flow_tensor, _, _, _, _, _ = motion.optical_flow(Y0_com, Y1_raw, batch_size, Height, Width) # Y1_warp_0 = tf.contrib.image.dense_image_warp(Y0_com, flow_tensor) # Encode flow flow_latent = CNN_img.MV_analysis(flow_tensor, args.N, args.M) entropy_bottleneck_mv = tfc.EntropyBottleneck() string_mv = entropy_bottleneck_mv.compress(flow_latent) string_mv = tf.squeeze(string_mv, axis=0) flow_latent_hat, MV_likelihoods = entropy_bottleneck_mv(flow_latent, training=False) flow_hat = CNN_img.MV_synthesis(flow_latent_hat, args.N) # Motion Compensation Y1_warp = tf.contrib.image.dense_image_warp(Y0_com, flow_hat)
Y2_raw_img = misc.imread(args.raw_2) Y0_com_img = np.expand_dims(Y0_com_img, 0) Y1_raw_img = np.expand_dims(Y1_raw_img, 0) Y2_raw_img = np.expand_dims(Y2_raw_img, 0) Height = np.size(Y1_raw_img, 1) Width = np.size(Y1_raw_img, 2) Y0_com = tf.placeholder(tf.float32, [batch_size, Height, Width, Channel]) Y1_raw = tf.placeholder(tf.float32, [batch_size, Height, Width, Channel]) Y2_raw = tf.placeholder(tf.float32, [batch_size, Height, Width, Channel]) with tf.variable_scope("flow_motion", reuse=False): flow_20, _, _, _, _, _ = motion.optical_flow(Y0_com, Y2_raw, batch_size, Height, Width) # Y2_warp_0 = tf.contrib.image.dense_image_warp(Y0_com_tensor, flow_20) with tf.variable_scope("motion_compression", reuse=False): flow_latent = CNN_img.MV_analysis(flow_20, num_filters=args.N, M=args.M) entropy_mv = tfc.EntropyBottleneck() string_mv = entropy_mv.compress(flow_latent) string_mv = tf.squeeze(string_mv, axis=0) flow_latent_hat, MV_likelihoods = entropy_mv(flow_latent, training=False) flow_20_hat = CNN_img.MV_synthesis(flow_latent_hat, num_filters=args.N) with tf.variable_scope("motion_estimation", reuse=False):