b374fdddb8f46b0ffeff2b98eb70f248e0c6d8f7,imgaug/augmenters/blur.py,AverageBlur,_augment_images,#AverageBlur#Any#Any#Any#Any#,200
Before Change
raise Exception("Expected int, tuple/list with 2 entries or StochasticParameter. Got %s." % (type(k),))
def _augment_images(self, images, random_state, parents, hooks):
result = images
nb_images = len(images)
if self.mode == "single":
samples = self.k.draw_samples((nb_images,), random_state=random_state)
samples = (samples, samples)
else:
samples = (
self.k[0].draw_samples((nb_images,), random_state=random_state),
self.k[1].draw_samples((nb_images,), random_state=random_state),
)
for i in sm.xrange(nb_images):
kh, kw = samples[0][i], samples[1][i]
kernel_impossible = (kh == 0 or kw == 0)
kernel_does_nothing = (kh == 1 and kw == 1)
if not kernel_impossible and not kernel_does_nothing:
image_aug = cv2.blur(result[i], (kh, kw))
// cv2.blur() removes channel axis for single-channel images
if image_aug.ndim == 2:
image_aug = image_aug[..., np.newaxis]
result[i] = image_aug
return result
def _augment_heatmaps(self, heatmaps, random_state, parents, hooks):
return heatmaps
After Change
self.k[0].draw_samples((nb_images,), random_state=random_state),
self.k[1].draw_samples((nb_images,), random_state=random_state),
)
for i, (image, kh, kw) in enumerate(zip(images, samples[0], samples[1])):
kernel_impossible = (kh == 0 or kw == 0)
kernel_does_nothing = (kh == 1 and kw == 1)
if not kernel_impossible and not kernel_does_nothing:
image_aug = cv2.blur(image, (kh, kw))
// cv2.blur() removes channel axis for single-channel images
if image_aug.ndim == 2:
image_aug = image_aug[..., np.newaxis]
images[i] = image_aug
return images
def _augment_heatmaps(self, heatmaps, random_state, parents, hooks):
return heatmaps
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 11
Instances
Project Name: aleju/imgaug
Commit Name: b374fdddb8f46b0ffeff2b98eb70f248e0c6d8f7
Time: 2018-12-17
Author: kontakt@ajung.name
File Name: imgaug/augmenters/blur.py
Class Name: AverageBlur
Method Name: _augment_images
Project Name: aleju/imgaug
Commit Name: b0bdcbfdabcae1933980925c8f2438cbb2359a49
Time: 2019-09-13
Author: kontakt@ajung.name
File Name: imgaug/augmenters/geometric.py
Class Name: ElasticTransformation
Method Name: _augment_keypoints
Project Name: aleju/imgaug
Commit Name: 544e915d11e1409c48943bd28759467bfad47cfd
Time: 2018-12-17
Author: kontakt@ajung.name
File Name: imgaug/augmenters/blur.py
Class Name: MedianBlur
Method Name: _augment_images
Project Name: aleju/imgaug
Commit Name: a17a7d615b4e75b7200cc0ac6ceca652e4f0067b
Time: 2018-12-17
Author: kontakt@ajung.name
File Name: imgaug/augmenters/blur.py
Class Name: GaussianBlur
Method Name: _augment_images
Project Name: aleju/imgaug
Commit Name: b374fdddb8f46b0ffeff2b98eb70f248e0c6d8f7
Time: 2018-12-17
Author: kontakt@ajung.name
File Name: imgaug/augmenters/blur.py
Class Name: AverageBlur
Method Name: _augment_images