Esempio n. 1
0
    def transform_featurewise_std_normalization(self, featurewise_std_normalization, images, result):
        #Transformation object
        parameters = ImageDataTransformation.Parameters(featurewise_std_normalization = featurewise_std_normalization)
        transformation = ImageDataTransformation(parameters = parameters)

        #Fit and perform transformation
        transformation.fit(images)
        transformed_images = transformation.transform(images)
        transformed_std = transformed_images.std(axis = 0)

        #Assert
        self.assertTrue(np.allclose(transformed_std, result))
Esempio n. 2
0
    def transform_featurewise_mean(self, featurewise_mean, images, result):
        #Transformation object
        parameters = ImageDataTransformation.Parameters(featurewise_mean = featurewise_mean)
        transformation = ImageDataTransformation(parameters = parameters)

        #Fit and perform transformation
        transformation.fit(images)
        transformed_images = transformation.transform(images)
        sum_image = transformed_images.sum(axis = 0)

        #Assert
        self.assertTrue(
                np.array_equal(sum_image, result),
                "Sum images: {} expected: {}".format(sum_image, result))