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

Before Change


            // _ = tf.import_graph_def(graph_def, name="")

    def detect(self, image):
        image_array = self._pil_to_tf(image)

        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")
                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


                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()
                    prediction = np.squeeze(prediction)
                    answer = {"image_number": image_number}
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

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: THUNLP-MT/THUMT
Commit Name: 410992318552115d2e3de84844bf523012e3e98e
Time: 2019-11-26
Author: cg847519328@163.com
File Name: thumt/utils/hooks.py
Class Name:
Method Name: _evaluate


Project Name: pytorch/audio
Commit Name: 9690e8e185eacc3c81b285ac9f250e07a9c3a61f
Time: 2021-01-08
Author: 855818+mthrok@users.noreply.github.com
File Name: build_tools/setup_helpers/extension.py
Class Name:
Method Name: _build_third_party


Project Name: opencv/opencv_extra
Commit Name: 537fa61786b167655298cbd91717496c6588c3e3
Time: 2019-06-11
Author: dmitry.kurtaev+github@gmail.com
File Name: testdata/dnn/tensorflow/generate_tf_models.py
Class Name:
Method Name: