-
-
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 illumination #2155
Add illumination #2155
Conversation
Reviewer's Guide by SourceryThis PR introduces a new image augmentation transform called 'Illumination' that simulates various lighting effects. The implementation includes three different illumination modes (linear, corner, and gaussian) with configurable parameters for intensity, angle, position, and effect type. The transform is integrated into the albumentations library with proper documentation, type hints, and test coverage. Class diagram for the new Illumination transformclassDiagram
class Illumination {
+Illumination(mode: Literal["linear", "corner", "gaussian"] = "linear", intensity_range: tuple[float, float] = (0.01, 0.2), effect_type: Literal["brighten", "darken", "both"] = "both", angle_range: tuple[float, float] = (0, 360), center_range: tuple[float, float] = (0.1, 0.9), sigma_range: tuple[float, float] = (0.2, 1.0), always_apply: bool = False, p: float = 0.5)
+get_params() dict[str, Any]
+apply(img: np.ndarray, **params: Any) np.ndarray
+get_transform_init_args_names() tuple[str, ...]
}
class BaseTransformInitSchema {
}
Illumination --|> ImageOnlyTransform
Illumination : +mode
Illumination : +intensity_range
Illumination : +effect_type
Illumination : +angle_range
Illumination : +center_range
Illumination : +sigma_range
Illumination : +p
Illumination : +InitSchema
class InitSchema {
+mode: Literal["linear", "corner", "gaussian"]
+intensity_range: Annotated[tuple[float, float], AfterValidator]
+effect_type: Literal["brighten", "darken", "both"]
+angle_range: Annotated[tuple[float, float], AfterValidator]
+center_range: Annotated[tuple[float, float], AfterValidator]
+sigma_range: Annotated[tuple[float, float], AfterValidator]
}
InitSchema --|> BaseTransformInitSchema
note for Illumination "This class simulates various lighting effects on images."
Class diagram for the new functional methodsclassDiagram
class Functional {
+apply_linear_illumination(img: np.ndarray, intensity: float, angle: float) np.ndarray
+apply_corner_illumination(img: np.ndarray, intensity: float, corner: int) np.ndarray
+apply_gaussian_illumination(img: np.ndarray, intensity: float, center: tuple[float, float], sigma: float) np.ndarray
}
note for Functional "These methods apply different illumination effects to images."
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 found some issues that need to be addressed.
Blocking issues:
- Missing dedicated test file for the new Illumination transform (link)
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🔴 Testing: 1 blocking issue
- 🟡 Complexity: 1 issue found
- 🟢 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 #2155 +/- ##
=========================================
+ Coverage 0 90.04% +90.04%
=========================================
Files 0 48 +48
Lines 0 8481 +8481
=========================================
+ Hits 0 7637 +7637
- Misses 0 844 +844 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
Summary by Sourcery
Add a new Illumination transform to the library, allowing users to simulate various lighting conditions on images. Update the README to include documentation for this new feature and add corresponding tests to validate its implementation.
New Features:
Documentation:
Tests: