Skip to content

Commit

Permalink
Updated ChannelDropout
Browse files Browse the repository at this point in the history
  • Loading branch information
ternaus committed Jan 7, 2025
1 parent 38e1d44 commit 4db34f1
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions albumentations/augmentations/dropout/channel_dropout.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

from collections.abc import Mapping
from typing import Annotated, Any
from warnings import warn

import numpy as np
from albucore import get_num_channels
from pydantic import AfterValidator, model_validator
from typing_extensions import Self
from pydantic import AfterValidator

from albumentations.core.pydantic import check_range_bounds
from albumentations.core.transforms_interface import BaseTransformInitSchema, ImageOnlyTransform
Expand Down Expand Up @@ -76,24 +74,11 @@ class ChannelDropout(ImageOnlyTransform):

class InitSchema(BaseTransformInitSchema):
channel_drop_range: Annotated[tuple[int, int], AfterValidator(check_range_bounds(1, None))]
fill_value: float | None
fill: float

@model_validator(mode="after")
def validate_fill(self) -> Self:
if self.fill_value is not None:
self.fill = self.fill_value
warn(
"`fill_value` deprecated. Use `fill` instead.",
DeprecationWarning,
stacklevel=2,
)
return self

def __init__(
self,
channel_drop_range: tuple[int, int] = (1, 1),
fill_value: float | None = None,
fill: float = 0,
p: float = 0.5,
):
Expand Down

0 comments on commit 4db34f1

Please sign in to comment.