示例#1
0
文件: trainer.py 项目: dubzzz/menpo
    def features(self, image, shape):
        r"""
        Method that extracts the features for the regression, which in this
        case are patch based.

        Parameters
        ----------
        image : :map:`MaskedImage`
            The current image.

        shape : :map:`PointCloud`
            The current shape.
        """
        # TODO: in the future this should be extract_local_patches_fast
        patches = extract_local_patches(image, shape, self.sampling_grid)
        features = [clf(np.reshape(patch, (-1, patch.shape[-1])))
                    for (clf, patch) in zip(self.classifiers, patches)]
        return np.hstack((np.asarray(features).ravel(), 1))
示例#2
0
 def features(self, image, shape):
     patches = extract_local_patches(image, shape, self.sampling_grid)
     features = [clf(np.reshape(p.pixels, (-1, p.n_channels)))
                 for (clf, p) in zip(self.classifiers, patches)]
     return np.hstack((np.asarray(features).ravel(), 1))
示例#3
0
 def features(self, image, shape):
     patches = extract_local_patches(image, shape, self.sampling_grid)
     features = [compute_features(p, self.regression_features).pixels.ravel()
                 for p in patches]
     return np.hstack((np.asarray(features).ravel(), 1))