From 191352763b7e495c2b5b43f427b8952a293ae2b2 Mon Sep 17 00:00:00 2001 From: Vladimir Iglovikov Date: Tue, 7 Jan 2025 13:57:58 -0800 Subject: [PATCH 1/3] Updated image compression --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50d11cbfe..8fe30f57c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,8 +68,6 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} slug: albumentations-team/albumentations files: ./coverage.xml - flags: ubuntu-py3.12 - fail_ci_if_error: true # Optional: fails CI if upload fails verbose: true # Optional: helps with debugging check_code_formatting_types: From b6a63c9cdda497be93f005013ec2209928881be5 Mon Sep 17 00:00:00 2001 From: Vladimir Iglovikov Date: Tue, 7 Jan 2025 14:09:29 -0800 Subject: [PATCH 2/3] updated random snow --- albumentations/augmentations/transforms.py | 41 ---------------------- tests/test_transforms.py | 18 ---------- 2 files changed, 59 deletions(-) diff --git a/albumentations/augmentations/transforms.py b/albumentations/augmentations/transforms.py index 369a74532..1998417f2 100644 --- a/albumentations/augmentations/transforms.py +++ b/albumentations/augmentations/transforms.py @@ -456,52 +456,11 @@ class InitSchema(BaseTransformInitSchema): AfterValidator(nondecreasing), ] - snow_point_lower: float | None = Field( - gt=0, - lt=1, - ) - snow_point_upper: float | None = Field( - gt=0, - lt=1, - ) brightness_coeff: float = Field(gt=0) method: Literal["bleach", "texture"] - @model_validator(mode="after") - def validate_ranges(self) -> Self: - if self.snow_point_lower is not None or self.snow_point_upper is not None: - if self.snow_point_lower is not None: - warn( - "`snow_point_lower` deprecated. Use `snow_point_range` as tuple" - " (snow_point_lower, snow_point_upper) instead.", - DeprecationWarning, - stacklevel=2, - ) - if self.snow_point_upper is not None: - warn( - "`snow_point_upper` deprecated. Use `snow_point_range` as tuple" - "(snow_point_lower, snow_point_upper) instead.", - DeprecationWarning, - stacklevel=2, - ) - lower = self.snow_point_lower if self.snow_point_lower is not None else self.snow_point_range[0] - upper = self.snow_point_upper if self.snow_point_upper is not None else self.snow_point_range[1] - self.snow_point_range = (lower, upper) - self.snow_point_lower = None - self.snow_point_upper = None - - # Validate the snow_point_range - if not (0 < self.snow_point_range[0] <= self.snow_point_range[1] < 1): - raise ValueError( - "snow_point_range values should be increasing within (0, 1) range.", - ) - - return self - def __init__( self, - snow_point_lower: float | None = None, - snow_point_upper: float | None = None, brightness_coeff: float = 2.5, snow_point_range: tuple[float, float] = (0.1, 0.3), method: Literal["bleach", "texture"] = "bleach", diff --git a/tests/test_transforms.py b/tests/test_transforms.py index 17fcf7581..cd1788224 100644 --- a/tests/test_transforms.py +++ b/tests/test_transforms.py @@ -1508,24 +1508,6 @@ def test_random_rain_invalid_input(params): A.RandomRain(**params) -@pytest.mark.parametrize( - "params, expected", - [ - # Test default initialization values - ({}, {"snow_point_range": (0.1, 0.3)}), - # Test snow point range - ({"snow_point_range": (0.2, 0.6)}, {"snow_point_range": (0.2, 0.6)}), - # Deprecated quality values handling - ({"snow_point_lower": 0.15}, {"snow_point_range": (0.15, 0.3)}), - ({"snow_point_upper": 0.4}, {"snow_point_range": (0.1, 0.4)}), - ], -) -def test_random_snow_initialization(params, expected): - img_comp = A.RandomSnow(**params) - for key, value in expected.items(): - assert getattr(img_comp, key) == value, f"Failed on {key} with value {value}" - - @pytest.mark.parametrize( "params", [ From d48050aa57f716985a4ac6339a19c63892073c84 Mon Sep 17 00:00:00 2001 From: Vladimir Iglovikov Date: Tue, 7 Jan 2025 14:12:52 -0800 Subject: [PATCH 3/3] Update CI --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8fe30f57c..50d11cbfe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,6 +68,8 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} slug: albumentations-team/albumentations files: ./coverage.xml + flags: ubuntu-py3.12 + fail_ci_if_error: true # Optional: fails CI if upload fails verbose: true # Optional: helps with debugging check_code_formatting_types: