Skip to content

Commit

Permalink
Updated CropAndPad (#2238)
Browse files Browse the repository at this point in the history
  • Loading branch information
ternaus authored Jan 7, 2025
1 parent 294b62a commit f6e16c3
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions albumentations/augmentations/crops/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from collections.abc import Sequence
from numbers import Real
from typing import Annotated, Any, cast
from warnings import warn

import cv2
import numpy as np
Expand Down Expand Up @@ -1490,9 +1489,6 @@ class CropAndPad(DualTransform):
class InitSchema(BaseTransformInitSchema):
px: PxType | None
percent: PercentType | None
pad_mode: BorderModeType | None
pad_cval: ColorType | None
pad_cval_mask: ColorType | None
keep_size: bool
sample_independently: bool
interpolation: InterpolationType
Expand All @@ -1509,25 +1505,13 @@ def check_px_percent(self) -> Self:
if self.px is not None and self.percent is not None:
msg = "Only px or percent may be set!"
raise ValueError(msg)
if self.pad_mode is not None:
warn("pad_mode is deprecated, use border_mode instead", DeprecationWarning, stacklevel=2)
self.border_mode = self.pad_mode
if self.pad_cval is not None:
warn("pad_cval is deprecated, use fill instead", DeprecationWarning, stacklevel=2)
self.fill = self.pad_cval
if self.pad_cval_mask is not None:
warn("pad_cval_mask is deprecated, use fill_mask instead", DeprecationWarning, stacklevel=2)
self.fill_mask = self.pad_cval_mask

return self

def __init__(
self,
px: int | list[int] | None = None,
percent: float | list[float] | None = None,
pad_mode: int | None = None,
pad_cval: ColorType | None = None,
pad_cval_mask: ColorType | None = None,
keep_size: bool = True,
sample_independently: bool = True,
interpolation: int = cv2.INTER_LINEAR,
Expand Down

0 comments on commit f6e16c3

Please sign in to comment.