def classify_image(self, filename):
        image = caffe.io.load_image(open(filename))
        scores = self.net.predict([image], oversample=True).flatten()

        if self.bet:
            expected_infogain = numpy.dot(self.bet['probmat'], scores[self.bet['idmapping']])
            expected_infogain *= self.bet['infogain']
            infogain_sort = expected_infogain.argsort()[::-1]
            results = [
                (self.bet['words'][v], float(expected_infogain[v]))
                for v in infogain_sort
                if expected_infogain[v] > self.confidence_threshold
            ]

        else:
            indices = (-scores).argsort()
            predictions = self.labels[indices]
            results = [
                (p, float(scores[i]))
                for i, p in zip(indices, predictions)
                if scores[i] > self.confidence_threshold
            ]

        return results
dataset/ETHPy150Open agermanidis/thingscoop/thingscoop/classifier.py/ImageClassifier.classify_image/original