Skip to content

Commit

Permalink
Fix_max_size
Browse files Browse the repository at this point in the history
  • Loading branch information
ternaus committed Jan 15, 2025
1 parent 5f9260b commit 77d45bb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions albumentations/augmentations/geometric/resize.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def validate_size_parameters(self) -> Self:

def __init__(
self,
max_size: int | Sequence[int] | None = 1024,
max_size: int | Sequence[int] | None = None,
max_size_hw: tuple[int | None, int | None] | None = None,
interpolation: int = cv2.INTER_LINEAR,
mask_interpolation: int = cv2.INTER_NEAREST,
Expand Down Expand Up @@ -222,7 +222,7 @@ class LongestMaxSize(MaxSizeTransform):
Args:
max_size (int, Sequence[int], optional): Maximum size of the longest side after the transformation.
When using a list or tuple, the max size will be randomly selected from the values provided. Default: 1024.
When using a list or tuple, the max size will be randomly selected from the values provided. Default: None.
max_size_hw (tuple[int | None, int | None], optional): Maximum (height, width) constraints. Supports:
- (height, width): Both dimensions must fit within these bounds
- (height, None): Only height is constrained, width scales proportionally
Expand Down Expand Up @@ -329,7 +329,7 @@ class SmallestMaxSize(MaxSizeTransform):
Args:
max_size (int, list of int, optional): Maximum size of smallest side of the image after the transformation.
When using a list, max size will be randomly selected from the values in the list. Default: 1024.
When using a list, max size will be randomly selected from the values in the list. Default: None.
max_size_hw (tuple[int | None, int | None], optional): Maximum (height, width) constraints. Supports:
- (height, width): Both dimensions must be at least these values
- (height, None): Only height is constrained, width scales proportionally
Expand Down
3 changes: 2 additions & 1 deletion tests/aug_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@
[A.RandomScale, {"scale_limit": 0.2, "interpolation": cv2.INTER_CUBIC}],
[A.Resize, {"height": 64, "width": 64}],
[A.SmallestMaxSize, {"max_size": 64, "interpolation": cv2.INTER_NEAREST}],
[A.LongestMaxSize, {"max_size": 128, "interpolation": cv2.INTER_NEAREST}],
[A.LongestMaxSize, [{"max_size": 128, "interpolation": cv2.INTER_NEAREST},
{"max_size_hw": (127, 126)}]],
[A.RandomGridShuffle, {"grid": (4, 4)}],
[A.Solarize, {"threshold_range": [0.5, 0.5]}],
[A.Posterize, {"num_bits": (3, 5)}],
Expand Down
1 change: 0 additions & 1 deletion tools/make_transforms_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@


def make_augmentation_docs_link(cls) -> str:
module_parts = cls.__module__.split(".")
return (
f"[{cls.__name__}](https://explore.albumentations.ai/transform/{cls.__name__})"
)
Expand Down

0 comments on commit 77d45bb

Please sign in to comment.