-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Implement STRIP Defense Against Poisoning Attacks #656
Conversation
tests/defences/test_strip.py
Outdated
@@ -0,0 +1,108 @@ | |||
# MIT License |
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.
Could you please convert these tests to the new pytest pattern: https://github.com/Trusted-AI/adversarial-robustness-toolbox/wiki/ART-Unit-Testing
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.
Done
run_tests.sh
Outdated
@@ -111,6 +111,7 @@ declare -a defences=("tests/defences/test_adversarial_trainer.py" \ | |||
"tests/defences/test_pixel_defend.py" \ | |||
"tests/defences/test_reverse_sigmoid.py" \ | |||
"tests/defences/test_rounded.py" \ | |||
"tests/defences/test_strip.py" \ |
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.
Could you please convert these tests to the new pytest pattern: https://github.com/Trusted-AI/adversarial-robustness-toolbox/wiki/ART-Unit-Testing
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.
Done. Please check that it's truly framework-independent. I'm not sure if it's only testing TF.
self, | ||
num_samples: int = 20, | ||
false_acceptance_rate: float = 0.01, | ||
) -> "CLASSIFIER_TYPE": |
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.
Could we make the return type more specific to reflect the STRIPMixin
? I think it's not just a general classifier anymore.
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.
This is a very good point. I've added a TypeVar
to bound the return type.
|
||
:param num_samples: The number of samples to use to test entropy at inference time | ||
:param false_acceptance_rate: The percentage of acceptable false acceptance | ||
:param predict function |
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.
I think this line needs an update.
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.
Done
# Randomly select samples from test set | ||
selected_indices = np.random.choice(np.arange(len(x_val)), self.num_samples) | ||
|
||
# Perturn the images by combining them |
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.
# Perturn the images by combining them | |
# Perturb the images by combining them |
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.
Thanks for catching this.
Could you please update Could you please add the new notebook to |
@@ -0,0 +1,4 @@ | |||
""" | |||
Neural cleanse estimators. |
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.
I think this docstring needs an update.
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.
Fixed
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.
Hi @ebubae Thank you very much for implementing a new defence against poisoning! A think it's a very nice implementation and I only have a few formatting requests.
Signed-off-by: Ebube Chuba <ebube.chuba@ibm.com>
Signed-off-by: Ebube Chuba <ebube.chuba@ibm.com>
Signed-off-by: Ebube Chuba <ebube.chuba@ibm.com>
Signed-off-by: Ebube Chuba <ebube.chuba@ibm.com>
Signed-off-by: Ebube Chuba <ebube.chuba@ibm.com>
Signed-off-by: Ebube Chuba <ebube.chuba@ibm.com>
Codecov Report
@@ Coverage Diff @@
## dev_1.5.0 #656 +/- ##
=============================================
- Coverage 58.93% 58.86% -0.08%
=============================================
Files 155 159 +4
Lines 14206 14282 +76
Branches 2551 2559 +8
=============================================
+ Hits 8373 8407 +34
- Misses 5031 5072 +41
- Partials 802 803 +1
|
Signed-off-by: Ebube Chuba <ebube.chuba@ibm.com>
Signed-off-by: Ebube Chuba <ebube.chuba@ibm.com>
Signed-off-by: Ebube Chuba <ebube.chuba@ibm.com>
Signed-off-by: Ebube Chuba <ebube.chuba@ibm.com>
Signed-off-by: Ebube Chuba <ebube.chuba@ibm.com>
Signed-off-by: Ebube Chuba <ebube.chuba@ibm.com>
Signed-off-by: Ebube Chuba <ebube.chuba@ibm.com>
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.
Hi @ebubae Thank you very much for implementing the STRIP defense against poisoning attacks!
Description
This PR:
poison_mitigation
folder to host mixins used for poison mitigationType of change
Please check all relevant options.
Testing
Please describe the tests that you ran to verify your changes. Consider listing any relevant details of your test configuration.
Currently tests are running and pass for Keras and TF Keras. I had some issues with the Pytorch unit test classifier.
Checklist