softmax_tensor = self.sess.graph.get_tensor_by_name("final_result:0")
answers = []
for image in image_array_list:
predictions = self.sess.run(softmax_tensor, {"DecodeJpeg:0": image})
predictions = np.squeeze(predictions)
answer = {}
for node_id in range(len(predictions)):
answer[self.labels[node_id]] = predictions[node_id]
After Change
with tf.device("/gpu:0"):
softmax_tensor = self.sess.graph.get_tensor_by_name("final_result:0")
threads = [pool.apply_async(operation, args=(self.sess, softmax_tensor, image_array_list[i],)) for i in
range(10)]
results = []
for x in threads:
results.append(x.get())
return results
@staticmethod
def _pil_to_tf(image):