32b1313d00f1a7000532fd191ad497aaac7bf8c4,imgaug/augmenters/arithmetic.py,Multiply,_augment_images,#Multiply#Any#Any#Any#Any#,427

Before Change


                for c, sample in enumerate(samples):
                    assert sample >= 0
                    image[..., c] *= sample
                np.clip(image, 0, 255, out=image)
                result[i] = image.astype(np.uint8)
            else:
                sample = self.mul.draw_sample(random_state=rs_image)
                assert sample >= 0
                image *= sample
                np.clip(image, 0, 255, out=image)
                result[i] = image.astype(np.uint8)
        return result

    def _augment_keypoints(self, keypoints_on_images, random_state, parents, hooks):
        return keypoints_on_images

After Change


            raise Exception("Expected per_channel to be boolean or number or StochasticParameter")

    def _augment_images(self, images, random_state, parents, hooks):
        input_dtypes = meta.copy_dtypes_for_restore(images)

        result = images
        nb_images = len(images)
        seeds = random_state.randint(0, 10**6, (nb_images,))
        for i in sm.xrange(nb_images):
            image = images[i].astype(np.float32)
            rs_image = ia.new_random_state(seeds[i])
            per_channel = self.per_channel.draw_sample(random_state=rs_image)
            if per_channel == 1:
                nb_channels = image.shape[2]
                samples = self.mul.draw_samples((nb_channels,), random_state=rs_image)
                for c, sample in enumerate(samples):
                    assert sample >= 0
                    image[..., c] *= sample
                result[i] = image
            else:
                sample = self.mul.draw_sample(random_state=rs_image)
                assert sample >= 0
                image *= sample
                result[i] = image

        // TODO make value range more flexible
        meta.clip_augmented_images_(result, 0, 255)
        meta.restore_augmented_images_dtypes_(result, input_dtypes)

        return result

    def _augment_keypoints(self, keypoints_on_images, random_state, parents, hooks):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 9

Instances


Project Name: aleju/imgaug
Commit Name: 32b1313d00f1a7000532fd191ad497aaac7bf8c4
Time: 2018-01-12
Author: kontakt@ajung.name
File Name: imgaug/augmenters/arithmetic.py
Class Name: Multiply
Method Name: _augment_images


Project Name: aleju/imgaug
Commit Name: 32b1313d00f1a7000532fd191ad497aaac7bf8c4
Time: 2018-01-12
Author: kontakt@ajung.name
File Name: imgaug/augmenters/arithmetic.py
Class Name: ContrastNormalization
Method Name: _augment_images


Project Name: aleju/imgaug
Commit Name: 32b1313d00f1a7000532fd191ad497aaac7bf8c4
Time: 2018-01-12
Author: kontakt@ajung.name
File Name: imgaug/augmenters/arithmetic.py
Class Name: Multiply
Method Name: _augment_images


Project Name: aleju/imgaug
Commit Name: 32b1313d00f1a7000532fd191ad497aaac7bf8c4
Time: 2018-01-12
Author: kontakt@ajung.name
File Name: imgaug/augmenters/arithmetic.py
Class Name: ReplaceElementwise
Method Name: _augment_images


Project Name: aleju/imgaug
Commit Name: 32b1313d00f1a7000532fd191ad497aaac7bf8c4
Time: 2018-01-12
Author: kontakt@ajung.name
File Name: imgaug/augmenters/arithmetic.py
Class Name: AddElementwise
Method Name: _augment_images