Skip to content

Commit a1259cf

Browse files
committed
fix bug
1 parent 7c0a38f commit a1259cf

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ppocr/data/imaug/iaa_augment.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import numpy as np
77
import albumentations as A
88
from albumentations.core.transforms_interface import DualTransform
9+
from albumentations.augmentations.geometric import functional as fgeometric
910

1011

1112
# Custom resize transformation mimicking Imgaug's behavior with scaling
@@ -22,8 +23,14 @@ def apply(self, img, scale=1.0, **params):
2223
height, width = img.shape[:2]
2324
new_height = int(height * scale)
2425
new_width = int(width * scale)
25-
return A.functional.resize(
26-
img, (new_height, new_width), interpolation=self.interpolation
26+
27+
# For compatibility with Albumentations 1.4.15 and later
28+
# return fgeometric.resize(
29+
# img, (new_height, new_width), interpolation=self.interpolation
30+
# )
31+
32+
return fgeometric.resize(
33+
img, new_height, new_width, interpolation=self.interpolation
2734
)
2835

2936
# Apply the same scaling transformation to keypoints (e.g., polygon points)

0 commit comments

Comments
 (0)