Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warning in piecewise affine #2052

Merged
merged 2 commits into from
Nov 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions albumentations/augmentations/geometric/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ def __init__(
super().__init__(p=p, always_apply=always_apply)

warn(
"This augmenter is very slow. Try to use ``ElasticTransformation`` instead, which is at least 10x faster.",
"This augmenter is very slow. Try to use ``ElasticTransform`` instead, which is at least 10x faster.",
stacklevel=2,
)

Expand Down Expand Up @@ -1120,14 +1120,14 @@ def get_transform_init_args_names(self) -> tuple[str, ...]:
)

def get_params_dependent_on_data(self, params: dict[str, Any], data: dict[str, Any]) -> dict[str, Any]:
height, width = params["shape"][:2]
image_shape = params["shape"][:2]

nb_rows = np.clip(self.py_random.randint(*self.nb_rows), 2, None)
nb_cols = np.clip(self.py_random.randint(*self.nb_cols), 2, None)
scale = self.py_random.uniform(*self.scale)

map_x, map_y = fgeometric.create_piecewise_affine_maps(
image_shape=(height, width),
image_shape=image_shape,
grid=(nb_rows, nb_cols),
scale=scale,
absolute_scale=self.absolute_scale,
Expand Down