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

More cleanup #2265

Merged
merged 2 commits into from
Jan 8, 2025
Merged

More cleanup #2265

merged 2 commits into from
Jan 8, 2025

Conversation

ternaus
Copy link
Collaborator

@ternaus ternaus commented Jan 8, 2025

Summary by Sourcery

Remove deprecated parameters and files, update default parameter values, and fix type annotations.

Copy link
Contributor

sourcery-ai bot commented Jan 8, 2025

Reviewer's Guide by Sourcery

This PR removes unused code and simplifies some logic related to image augmentations. It also updates tests to reflect these changes and removes some outdated test files.

Class diagram showing changes to image augmentation classes

classDiagram
    class CustomTransform {
      -custom_apply_fns
      +__init__(p, name, image, mask, keypoints, bboxes)
    }
    note for CustomTransform "Removed global_label from custom_apply_fns"

    class RingingOvershoot {
      +InitSchema
      +__init__()
    }
    note for RingingOvershoot "Simplified cutoff validation using AfterValidator"

    class Spatter {
      +InitSchema
      -mean
      -std
      -gauss_sigma
      -cutout_threshold
      -intensity
      -mode
      -color
    }
    note for Spatter "Removed default values from InitSchema parameters"

    class AutoContrast {
      +__init__(p)
    }
    note for AutoContrast "Removed empty InitSchema class"
Loading

File-Level Changes

Change Details Files
Removed unused global_label from custom_apply_fns.
  • Removed global_label from the dictionary initialization in the __init__ method of several augmentation classes.
albumentations/augmentations/transforms.py
Simplified cutoff validation.
  • Replaced the custom check_cutoff validator with the check_range_bounds and nondecreasing validators.
albumentations/augmentations/transforms.py
Removed unnecessary keypoint handling logic.
  • Removed the apply_to_keypoints method override in the CoarseDropout class.
albumentations/augmentations/transforms.py
Simplified default values for Spatter parameters.
  • Removed default values for mean, std, gauss_sigma, cutout_threshold, and intensity in the Spatter class InitSchema.
albumentations/augmentations/transforms.py
Removed unnecessary AutoContrast schema.
  • Removed the empty InitSchema class from the AutoContrast transform.
albumentations/augmentations/transforms.py
Simplified tests.
  • Removed the p=1 case from several test parameterizations.
  • Removed some redundant tests.
tests/test_serialization.py
Updated augmentation parameters.
  • Changed slant_lower and slant_upper to slant_range in RandomRain.
  • Changed fog_coef_lower and fog_coef_upper to fog_coef_range in RandomFog.
  • Changed threshold to threshold_range in Solarize.
  • Added absolute_scale parameter to RandomScale.
  • Changed scale_min and scale_max to scale_range and added interpolation_pair in Downscale.
  • Changed unit_size_range to holes_number_xy in GridDropout.
  • Changed font_size_range to font_size_fraction_range and color to font_color in TextImage.
tests/aug_definitions.py
Removed unnecessary parameterization in test_solarize.
  • Removed the threshold=1.1 case.
tests/functional/test_functional.py
Simplified GridDropout parameters in tests.
  • Removed num_grid_x and num_grid_y parameters, using default values instead.
tests/test_transforms.py
Removed outdated transform files.
  • Deleted two outdated JSON files used for testing transform serialization.
tests/files/transform_v1.1.0_with_totensor.json
tests/files/transform_v1.1.0_without_totensor.json

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 - here's some feedback:

Overall Comments:

  • The removal of keypoint dropout functionality in apply_to_keypoints() appears to be a breaking change rather than cleanup. Consider handling this in a separate PR with proper deprecation notices.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 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.

Copy link

codecov bot commented Jan 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.72%. Comparing base (b1a79c2) to head (1242167).
Report is 371 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##           main    #2265       +/-   ##
=========================================
+ Coverage      0   89.72%   +89.72%     
=========================================
  Files         0       50       +50     
  Lines         0     8829     +8829     
=========================================
+ Hits          0     7922     +7922     
- Misses        0      907      +907     
Flag Coverage Δ
ubuntu-py3.12 89.72% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@ternaus ternaus merged commit 24e5386 into main Jan 8, 2025
16 checks passed
@ternaus ternaus deleted the updates branch January 8, 2025 01:59
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