0db94786a7a463fed49825811fac903f1f1fc3c8,python/caffe/classifier.py,Classifier,predict,#Classifier#Any#Any#,49

Before Change


                     for N images and C classes.
        
        // Scale to standardize input dimensions.
        inputs = np.asarray([caffe.io.resize_image(im, self.image_dims)
                             for im in inputs])

        if oversample:
            // Generate center, corner, and mirrored crops.
            inputs = caffe.io.oversample(inputs, self.crop_dims)

After Change


                     for N images and C classes.
        
        // Scale to standardize input dimensions.
        input_ = np.zeros((len(inputs),
            self.image_dims[0], self.image_dims[1], inputs[0].shape[2]),
            dtype=np.float32)
        for ix, in_ in enumerate(inputs):
            input_[ix] = caffe.io.resize_image(in_, self.image_dims)

        if oversample:
            // Generate center, corner, and mirrored crops.
            input_ = caffe.io.oversample(input_, self.crop_dims)
        else:
            // Take center crop.
            center = np.array(self.image_dims) / 2.0
            crop = np.tile(center, (1, 2))[0] + np.concatenate([
                -self.crop_dims / 2.0,
                self.crop_dims / 2.0
            ])
            input_ = input_[:, crop[0]:crop[2], crop[1]:crop[3], :]

        // Classify
        caffe_in = np.zeros(np.array(input_.shape)[[0,3,1,2]],
                            dtype=np.float32)
        for ix, in_ in enumerate(input_):
            caffe_in[ix] = self.preprocess(self.inputs[0], in_)
        out = self.forward_all(**{self.inputs[0]: caffe_in})
        predictions = out[self.outputs[0]].squeeze(axis=(2,3))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: BVLC/caffe
Commit Name: 0db94786a7a463fed49825811fac903f1f1fc3c8
Time: 2014-08-05
Author: shelhamer@imaginarynumber.net
File Name: python/caffe/classifier.py
Class Name: Classifier
Method Name: predict


Project Name: scipy/scipy
Commit Name: ee65304775a55bd52f383706fa65be506b8108e5
Time: 2017-10-11
Author: david@drhagen.com
File Name: scipy/sparse/lil.py
Class Name: lil_matrix
Method Name: tocsr


Project Name: rlworkgroup/garage
Commit Name: 1c6238429d8beff5e3934b6326d847b2f96e192a
Time: 2020-11-11
Author: shinyinn@usc.edu
File Name: src/garage/sampler/vec_worker.py
Class Name: VecWorker
Method Name: start_episode