Slide 36
Slide 36 text
def _init_graph(self, image, batch_size):
reshaped_image = np.array(image.getdata()).reshape(image.height, image.width, 3).astype(
np.float32)
graph = tf.Graph()
with graph.as_default() as g:
queue = tf.FIFOQueue(3000, tf.int32, shapes=[4])
region = queue.dequeue()
whitten_image = self._load_image(reshaped_image, region)
image_batch, region_batch = tf.train.batch(
[whitten_image, region],
batch_size=batch_size,
capacity=10000)
logits = tf.nn.softmax(model.inference(image_batch, tf.constant(1.0), batch_size))
top_k_values, top_k_indices = tf.nn.top_k(logits, 2, sorted=True)
return graph, queue, top_k_indices, top_k_values, region_batch