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

Fix Image Poisoning Perturbations Trigger Placement Bug #2143

Merged
merged 2 commits into from
May 9, 2023

Conversation

f4str
Copy link
Collaborator

@f4str f4str commented May 8, 2023

Description

Fix the bugs involving the trigger placement for image poisoning perturbations.

  1. The dimensions for the trigger height and width are swapped to accommodate for PIL. Now non-square triggers placed on the input image will be the correct dimension.
  2. The off-by-one error for the random placement was addressed. Now triggers of the same dimension as the image will work when the random parameter is set to true.

Additionally, apply minor optimizations for better performance and readability.

Fixes #2141

Type of change

Please check all relevant options.

  • Improvement (non-breaking)
  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Testing

Please describe the tests that you ran to verify your changes. Consider listing any relevant details of your test configuration.

  • Image perturbation tests

Test Configuration:

  • OS
  • Python version
  • ART version or commit number
  • TensorFlow / Keras / PyTorch / MXNet version

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

f4str added 2 commits May 8, 2023 12:14
Signed-off-by: Farhan Ahmed <Farhan.Ahmed@ibm.com>
Signed-off-by: Farhan Ahmed <Farhan.Ahmed@ibm.com>
@f4str f4str marked this pull request as ready for review May 8, 2023 19:55
@codecov-commenter
Copy link

codecov-commenter commented May 8, 2023

Codecov Report

Merging #2143 (90350ef) into dev_1.15.0 (b13f802) will decrease coverage by 0.01%.
The diff coverage is 66.66%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Impacted file tree graph

@@              Coverage Diff               @@
##           dev_1.15.0    #2143      +/-   ##
==============================================
- Coverage       85.63%   85.63%   -0.01%     
==============================================
  Files             297      297              
  Lines           26521    26521              
  Branches         4864     4864              
==============================================
- Hits            22712    22710       -2     
- Misses           2571     2572       +1     
- Partials         1238     1239       +1     
Impacted Files Coverage Δ
...cks/poisoning/perturbations/image_perturbations.py 93.58% <66.66%> (ø)

... and 1 file with indirect coverage changes

@beat-buesser beat-buesser self-assigned this May 9, 2023
@beat-buesser beat-buesser self-requested a review May 9, 2023 15:07
@beat-buesser beat-buesser added bug Something isn't working improvement Improve implementation labels May 9, 2023
@beat-buesser beat-buesser added this to the ART 1.15.0 milestone May 9, 2023
@beat-buesser beat-buesser linked an issue May 9, 2023 that may be closed by this pull request
Copy link
Collaborator

@beat-buesser beat-buesser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @f4str Thank you very much! The solution looks good to me.

@beat-buesser beat-buesser merged commit 1f784ed into Trusted-AI:dev_1.15.0 May 9, 2023
@f4str f4str deleted the image-trigger-bug branch June 1, 2023 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working improvement Improve implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trigger Placement Bugs for Image Poisoning Perturbations
3 participants