Skip to content

Commit

Permalink
Removed deprecations from CenterCrop
Browse files Browse the repository at this point in the history
  • Loading branch information
ternaus committed Jan 7, 2025
1 parent d546f11 commit c937ad0
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions albumentations/augmentations/crops/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,31 +412,12 @@ class InitSchema(BaseCropAndPad.InitSchema):
border_mode: BorderModeType
fill: ColorType
fill_mask: ColorType
pad_mode: BorderModeType | None
pad_cval: ColorType | None
pad_cval_mask: ColorType | None

@model_validator(mode="after")
def validate_dimensions(self) -> Self:
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,
height: int,
width: int,
pad_if_needed: bool = False,
pad_mode: int | None = None,
pad_cval: ColorType | None = None,
pad_cval_mask: ColorType | None = None,
pad_position: PositionType = "center",
border_mode: int = cv2.BORDER_CONSTANT,
fill: ColorType = 0.0,
Expand Down

0 comments on commit c937ad0

Please sign in to comment.