59d84cd18324aa86373091c8a0c262e6536d32fe,src/detection/tensor/detector.py,Detector,detect,#Detector#,29

Before Change


        with tf.Session(graph=imported_graph) as sess:
            with tf.device("/gpu:0"):
                softmax_tensor = sess.graph.get_tensor_by_name("final_result:0")
                predictions = sess.run(softmax_tensor, {"DecodeJpeg:0": image_array})
                predictions = np.squeeze(predictions)
                answer = {}
                for node_id in range(len(predictions)):
                    answer[self.labels[node_id]] = predictions[node_id]

After Change


            return graph_def

    def detect(self, images):
        np_images = [self._pil_to_np(image) for image in images]

        pool = ThreadPool()
        with tf.Graph().as_default() as imported_graph:
            tf.import_graph_def(self.graph_def, name="")

        with tf.Session(graph=imported_graph) as sess:
            with tf.device("/gpu:0"):
                softmax_tensor = sess.graph.get_tensor_by_name("final_result:0")
                threads = [pool.apply_async(self.operation,
                                            args=(sess, softmax_tensor, np_images[image_number], image_number,)) for
                           image_number in range(len(np_images))]
                answers = []
                for thread in threads:
                    prediction, image_number = thread.get()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: geometalab/OSMDeepOD
Commit Name: 59d84cd18324aa86373091c8a0c262e6536d32fe
Time: 2016-08-12
Author: samuel.kurath@gmail.com
File Name: src/detection/tensor/detector.py
Class Name: Detector
Method Name: detect


Project Name: geometalab/OSMDeepOD
Commit Name: 285dc85691241532cd976e04a089f409e44d7493
Time: 2016-08-12
Author: samuel.kurath@gmail.com
File Name: src/detection/tensor/detector.py
Class Name: Detector
Method Name: detect_multiple


Project Name: marcoancona/DeepExplain
Commit Name: 83796ff9a1dcae49dd13f3ce67157f756d28803e
Time: 2017-11-02
Author: marco.ancona@inf.ethz.ch
File Name: example_tf.py
Class Name: DeepExplain
Method Name: explain