f98d7f30e941330e575412670a310a979bc21eba,imgaug/augmenters/geometric.py,PerspectiveTransform,_augment_heatmaps,#PerspectiveTransform#,2391
Before Change
random_state.copy()
)
for i, (M, max_height, max_width, cval, mode) in enumerate(zip(matrices, max_heights, max_widths, cval_samples, mode_samples)):
heatmaps_i = heatmaps[i]
arr = heatmaps_i.arr_0to1
nb_channels = arr.shape[2]
warped = [cv2.warpPerspective(
arr[..., c], M,
(max_width, max_height),
borderValue=0,
borderMode=cv2.BORDER_CONSTANT) for c in sm.xrange(nb_channels)]
warped = [warped_i[..., np.newaxis] for warped_i in warped]
warped = np.dstack(warped)
heatmaps_i_aug = ia.HeatmapsOnImage.from_0to1(warped, shape=heatmaps_i.shape,
min_value=heatmaps_i.min_value,
max_value=heatmaps_i.max_value)
if self.keep_size:
h, w = arr.shape[0:2]
heatmaps_i_aug = heatmaps_i_aug.resize((h, w))
else:
heatmaps_i_aug.shape = (max_heights_imgs[i], max_widths_imgs[i]) + heatmaps_i_aug.shape[2:]
result[i] = heatmaps_i_aug
return result
After Change
random_state.copy()
)
gen = enumerate(
zip(matrices, max_heights, max_widths, cval_samples, mode_samples)
)
for i, (M, max_height, max_width, cval, mode) in gen:
heatmaps_i = heatmaps[i]
arr = heatmaps_i.arr_0to1
nb_channels = arr.shape[2]
warped = [cv2.warpPerspective(
arr[..., c], M,
(max_width, max_height),
borderValue=0,
borderMode=cv2.BORDER_CONSTANT) for c in sm.xrange(nb_channels)]
warped = [warped_i[..., np.newaxis] for warped_i in warped]
warped = np.dstack(warped)
heatmaps_i_aug = ia.HeatmapsOnImage.from_0to1(
warped,
shape=heatmaps_i.shape,
min_value=heatmaps_i.min_value,
max_value=heatmaps_i.max_value)
if self.keep_size:
h, w = arr.shape[0:2]
heatmaps_i_aug = heatmaps_i_aug.resize((h, w))
else:
new_shape = (max_heights_imgs[i], max_widths_imgs[i]) \
+ heatmaps_i_aug.shape[2:]
heatmaps_i_aug.shape = new_shape
result[i] = heatmaps_i_aug
return result
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
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_keypoints
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