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

Clear optical distortion #2176

Merged
merged 3 commits into from
Dec 5, 2024
Merged

Clear optical distortion #2176

merged 3 commits into from
Dec 5, 2024

Conversation

ternaus
Copy link
Collaborator

@ternaus ternaus commented Dec 5, 2024

Deprecated shift_limit in OpticalDistortion

Summary by Sourcery

Deprecate the shift_limit parameter in the OpticalDistortion class and update related documentation and tests.

Enhancements:

  • Remove the shift_limit parameter from the OpticalDistortion class as it no longer has any effect.

Documentation:

  • Deprecate the shift_limit parameter in the documentation of the OpticalDistortion class.

Tests:

  • Update test files to remove references to the deprecated shift_limit parameter.

Copy link
Contributor

sourcery-ai bot commented Dec 5, 2024

Reviewer's Guide by Sourcery

This PR removes the shift functionality from the OpticalDistortion transform, simplifying the optical distortion implementation by removing the ability to shift the distortion center. The distortion is now always centered at (0,0) for both camera matrix and fisheye models.

Class diagram for OpticalDistortion changes

classDiagram
    class OpticalDistortion {
        -shift_limit: ScaleFloatType | None
        +shift_limit: ScaleFloatType | None = None
        distort_limit: ScaleFloatType
        mode: Literal["camera", "fisheye"]
        +get_params_dependent_on_data()
        +get_transform_init_args_names() : tuple[str, ...]
    }
    note for OpticalDistortion "Removed shift_limit functionality and related parameters."
Loading

Class diagram for get_camera_matrix_distortion_maps and get_fisheye_distortion_maps changes

classDiagram
    class get_camera_matrix_distortion_maps {
        -cx: float
        -cy: float
        k: float
        +get_camera_matrix_distortion_maps(image_shape: tuple[int, int], k: float) : tuple[np.ndarray, np.ndarray]
    }
    class get_fisheye_distortion_maps {
        -cx: float
        -cy: float
        k: float
        +get_fisheye_distortion_maps(image_shape: tuple[int, int], k: float) : tuple[np.ndarray, np.ndarray]
    }
    note for get_camera_matrix_distortion_maps "Removed cx and cy parameters."
    note for get_fisheye_distortion_maps "Removed cx and cy parameters."
Loading

File-Level Changes

Change Details Files
Remove shift functionality from OpticalDistortion transform
  • Remove shift_limit parameter from OpticalDistortion class
  • Mark shift_limit as deprecated in InitSchema
  • Remove shift-related calculations from get_params_dependent_on_data
  • Remove cx and cy parameters from distortion map generation functions
albumentations/augmentations/geometric/transforms.py
albumentations/augmentations/geometric/functional.py
Update test files to reflect removal of shift functionality
  • Remove shift_limit from transform serialization files
  • Update OpticalDistortion test parameters
tests/files/transform_serialization_v2_with_totensor.json
tests/files/transform_serialization_v2_without_totensor.json
tests/files/transform_v1.1.0_with_totensor.json
tests/files/transform_v1.1.0_without_totensor.json
tests/aug_definitions.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a 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: 2 issues found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

tests/aug_definitions.py Show resolved Hide resolved
tests/aug_definitions.py Show resolved Hide resolved
Copy link

codecov bot commented Dec 5, 2024

Codecov Report

Attention: Patch coverage is 20.00000% with 8 lines in your changes missing coverage. Please review.

Project coverage is 89.74%. Comparing base (b1a79c2) to head (c527762).
Report is 300 commits behind head on main.

Files with missing lines Patch % Lines
...bumentations/augmentations/geometric/functional.py 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           main    #2176       +/-   ##
=========================================
+ Coverage      0   89.74%   +89.74%     
=========================================
  Files         0       47       +47     
  Lines         0     8433     +8433     
=========================================
+ Hits          0     7568     +7568     
- Misses        0      865      +865     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ternaus ternaus merged commit 9995c60 into main Dec 5, 2024
16 checks passed
@ternaus ternaus deleted the clear_optical_distortion branch December 5, 2024 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant