562976ee11aaf0eef7190b71c05172112299cd52,imgaug/augmenters/blend.py,Alpha,_augment_segmentation_maps,#Alpha#Any#Any#Any#Any#,425

Before Change


            outputs_first = segmaps
            outputs_second = segmaps

        for i, (outputs_first_i, outputs_second_i) in enumerate(zip(outputs_first, outputs_second)):
            // Segmap augmentation also works channel-wise based on image
            // channels, even though the channels have different meanings
            // between images and segmaps. This is done in order to keep the
            // random values properly synchronized with the image augmentation
            if per_channel[i] > 0.5:
                nb_channels_i = segmaps[i].shape[2] if len(segmaps[i].shape) >= 3 else 1
                alpha = np.average(alphas[i, 0:nb_channels_i])
            else:
                alpha = alphas[i, 0]
            assert 0 <= alpha <= 1.0, (
                "Expected "alpha" to be in the interval [0.0, 1.0]. "
                "Got %.4f." % (alpha,))

            // We cant choose "just a bit" of one segmentation map augmentation
            // result without messing up the positions (interpolation doesn"t
            // make much sense here),
            // so if the alpha is >= 0.5 (branch A is more visible than
            // branch B), the result of branch A, otherwise branch B.
            if alpha >= 0.5:
                result[i] = outputs_first_i
            else:
                result[i] = outputs_second_i

After Change


            outputs_first = segmaps
            outputs_second = segmaps

        gen = enumerate(zip(outputs_first, outputs_second))
        for i, (outputs_first_i, outputs_second_i) in gen:
            // Segmap augmentation also works channel-wise based on image
            // channels, even though the channels have different meanings
            // between images and segmaps. This is done in order to keep the
            // random values properly synchronized with the image augmentation
            if per_channel[i] > 0.5:
                nb_channels_i = (
                    segmaps[i].shape[2] if len(segmaps[i].shape) >= 3 else 1)
                alpha = np.average(alphas[i, 0:nb_channels_i])
            else:
                alpha = alphas[i, 0]
            assert 0 <= alpha <= 1.0, (
                "Expected "alpha" to be in the interval [0.0, 1.0]. "
                "Got %.4f." % (alpha,))

            // We cant choose "just a bit" of one segmentation map augmentation
            // result without messing up the positions (interpolation doesn"t
            // make much sense here),
            // so if the alpha is >= 0.5 (branch A is more visible than
            // branch B), the result of branch A, otherwise branch B.
            if alpha >= 0.5:
                result[i] = outputs_first_i
            else:
                result[i] = outputs_second_i
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 9

Non-data size: 5

Instances


Project Name: aleju/imgaug
Commit Name: 562976ee11aaf0eef7190b71c05172112299cd52
Time: 2019-08-16
Author: kontakt@ajung.name
File Name: imgaug/augmenters/blend.py
Class Name: Alpha
Method Name: _augment_segmentation_maps


Project Name: aleju/imgaug
Commit Name: 1439ff31bd2062be2854505a87ceedf1170e5309
Time: 2019-08-16
Author: kontakt@ajung.name
File Name: imgaug/augmenters/contrast.py
Class Name: _ContrastFuncWrapper
Method Name: _augment_images


Project Name: aleju/imgaug
Commit Name: 4e28ad08101388d4611eddf79f2c8eeeed1f9d75
Time: 2019-08-16
Author: kontakt@ajung.name
File Name: imgaug/augmenters/blur.py
Class Name: AverageBlur
Method Name: _augment_images


Project Name: aleju/imgaug
Commit Name: f98d7f30e941330e575412670a310a979bc21eba
Time: 2019-08-16
Author: kontakt@ajung.name
File Name: imgaug/augmenters/geometric.py
Class Name: PerspectiveTransform
Method Name: _augment_segmentation_maps


Project Name: aleju/imgaug
Commit Name: 562976ee11aaf0eef7190b71c05172112299cd52
Time: 2019-08-16
Author: kontakt@ajung.name
File Name: imgaug/augmenters/blend.py
Class Name: Alpha
Method Name: _augment_coordinate_based


Project Name: aleju/imgaug
Commit Name: f98d7f30e941330e575412670a310a979bc21eba
Time: 2019-08-16
Author: kontakt@ajung.name
File Name: imgaug/augmenters/geometric.py
Class Name: PerspectiveTransform
Method Name: _augment_keypoints


Project Name: aleju/imgaug
Commit Name: 562976ee11aaf0eef7190b71c05172112299cd52
Time: 2019-08-16
Author: kontakt@ajung.name
File Name: imgaug/augmenters/blend.py
Class Name: Alpha
Method Name: _augment_images


Project Name: aleju/imgaug
Commit Name: f98d7f30e941330e575412670a310a979bc21eba
Time: 2019-08-16
Author: kontakt@ajung.name
File Name: imgaug/augmenters/geometric.py
Class Name: PerspectiveTransform
Method Name: _augment_heatmaps


Project Name: aleju/imgaug
Commit Name: f98d7f30e941330e575412670a310a979bc21eba
Time: 2019-08-16
Author: kontakt@ajung.name
File Name: imgaug/augmenters/geometric.py
Class Name: PerspectiveTransform
Method Name: _augment_images