INNER CODE UNIT · Python
build_infer_graph
zuruoke/watermark-removal · inpaint_model.py:215
def build_infer_graph(self, FLAGS, batch_data, bbox=None, name='val'):
"""
"""
if FLAGS.guided:
batch_data, edge = batch_data
edge = edge[:, :, :, 0:1] / 255.
edge = tf.cast(edge > FLAGS.edge_threshold, tf.float32)
regular_mask = bbox2mask(FLAGS, bbox, name='mask_c')
irregular_mask = brush_stroke_mask(FLAGS, name='mask_c')
mask = tf.cast(
tf.logical_or(
tf.cast(irregular_mask, tf.bool),
tf.cast(regular_mask, tf.bool),
),
tf.float32
)
batch_pos = batch_data / 127.5 - 1.