Skip to content

Commit b8a6314

Browse files
committed
compatibility fixes for new albumentations version
1 parent 41cf4fc commit b8a6314

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def append_resize_transform(
163163
self, transform: A.BasicTransform | None,
164164
out_size: tuple[PosInt, PosInt]) -> A.Resize | A.Compose:
165165
"""Get transform to use for resizing windows to out_size."""
166-
resize_tf = A.Resize(*out_size, always_apply=True)
166+
resize_tf = A.Resize(*out_size, p=1.)
167167
if transform is None:
168168
transform = resize_tf
169169
else:

rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/object_detection_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def __init__(self, *args, **kwargs):
235235

236236
def append_resize_transform(self, transform: A.BasicTransform,
237237
out_size: tuple[int, int]) -> A.BasicTransform:
238-
resize_tf = A.Resize(*out_size, always_apply=True)
238+
resize_tf = A.Resize(*out_size, p=1.)
239239
if transform is None:
240240
transform = resize_tf
241241
else:

rastervision_pytorch_learner/rastervision/pytorch_learner/utils/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ def __init__(
222222
min_val=0.0,
223223
max_val=1.0,
224224
dtype=cv2.CV_32F,
225-
always_apply=False,
226225
p=1.0,
227226
):
228227
"""Constructor.
@@ -232,7 +231,7 @@ def __init__(
232231
max_val: the maximum value that output should have
233232
dtype: the dtype of output image
234233
"""
235-
super(MinMaxNormalize, self).__init__(always_apply, p)
234+
super(MinMaxNormalize, self).__init__(p)
236235
self.min_val = min_val
237236
self.max_val = max_val
238237
self.dtype = dtype

tests/data_files/lambda_transforms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ def swap(image: 'np.ndarray', **kwargs) -> 'np.ndarray':
1818

1919

2020
lambda_transforms = {
21-
'ndvi': A.Lambda(name='ndvi', image=ndvi, always_apply=True),
22-
'swap': A.Lambda(name='swap', image=swap, always_apply=True)
21+
'ndvi': A.Lambda(name='ndvi', image=ndvi, p=1.),
22+
'swap': A.Lambda(name='swap', image=swap, p=1.)
2323
}

0 commit comments

Comments
 (0)