-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add additive noise #2149
Add additive noise #2149
Conversation
Reviewer's Guide by SourceryThis PR introduces a new Class diagram for AdditiveNoise and related classesclassDiagram
class AdditiveNoise {
- noise_type: Literal["uniform", "gaussian", "laplace", "beta", "poisson"]
- spatial_mode: Literal["constant", "per_pixel", "shared"]
- noise_params: dict[str, Any] | None
- approximation: float
- always_apply: bool | None
- p: float
+ apply(img: np.ndarray, noise_map: np.ndarray, **params: Any) np.ndarray
+ get_params_dependent_on_data(params: dict[str, Any], data: dict[str, Any]) dict[str, Any]
+ get_transform_init_args_names() tuple[str, ...]
}
class RGBShift {
- r_shift_limit: ScaleFloatType
- g_shift_limit: ScaleFloatType
- b_shift_limit: ScaleFloatType
+ get_transform_init_args_names() tuple[str, ...]
}
class NoiseParamsBase {
- noise_type: str
}
class UniformParams {
- noise_type: Literal["uniform"]
- ranges: list[tuple[float, float]]
}
class GaussianParams {
- noise_type: Literal["gaussian"]
- mean_range: tuple[float, float]
- std_range: tuple[float, float]
}
class LaplaceParams {
- noise_type: Literal["laplace"]
- mean_range: tuple[float, float]
- scale_range: tuple[float, float]
}
class BetaParams {
- noise_type: Literal["beta"]
- alpha_range: tuple[float, float]
- beta_range: tuple[float, float]
- scale_range: tuple[float, float]
}
class PoissonParams {
- noise_type: Literal["poisson"]
- lambda_range: tuple[float, float]
}
AdditiveNoise <|-- RGBShift
NoiseParamsBase <|-- UniformParams
NoiseParamsBase <|-- GaussianParams
NoiseParamsBase <|-- LaplaceParams
NoiseParamsBase <|-- BetaParams
NoiseParamsBase <|-- PoissonParams
AdditiveNoise --> NoiseParamsBase
RGBShift --> AdditiveNoise
note for AdditiveNoise "This class applies random noise to image channels using various noise distributions."
note for RGBShift "This class is a specialized version of AdditiveNoise for RGB channel shifts."
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ternaus - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2149 +/- ##
=========================================
+ Coverage 0 90.23% +90.23%
=========================================
Files 0 48 +48
Lines 0 8250 +8250
=========================================
+ Hits 0 7444 +7444
- Misses 0 806 +806 ☔ View full report in Codecov by Sentry. |
Summary by Sourcery
Add the AdditiveNoise transform to apply random noise using various distributions and refactor RGBShift to utilize this new transform. Update tests to cover the new functionality.
New Features:
Enhancements:
Tests: