All Projects → sayakpaul → Denoised-Smoothing-TF

sayakpaul / Denoised-Smoothing-TF

Licence: MIT license
Minimal implementation of Denoised Smoothing (https://arxiv.org/abs/2003.01908) in TensorFlow.

Programming Languages

Jupyter Notebook
11667 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Denoised-Smoothing-TF

Adversarial-Distributional-Training
Adversarial Distributional Training (NeurIPS 2020)
Stars: ✭ 52 (+173.68%)
Mutual labels:  robustness, adversarial-defense
EfficientMORL
EfficientMORL (ICML'21)
Stars: ✭ 22 (+15.79%)
Mutual labels:  vision
Cs231a Notes
The course notes for Stanford's CS231A course on computer vision
Stars: ✭ 230 (+1110.53%)
Mutual labels:  vision
autonomous-delivery-robot
Repository for Autonomous Delivery Robot project of IvLabs, VNIT
Stars: ✭ 65 (+242.11%)
Mutual labels:  vision
Opencv
📷 Computer-Vision Demos
Stars: ✭ 244 (+1184.21%)
Mutual labels:  vision
sam-textvqa
Official code for paper "Spatially Aware Multimodal Transformers for TextVQA" published at ECCV, 2020.
Stars: ✭ 51 (+168.42%)
Mutual labels:  vision
Simplecv
Stars: ✭ 2,522 (+13173.68%)
Mutual labels:  vision
Advances-in-Label-Noise-Learning
A curated (most recent) list of resources for Learning with Noisy Labels
Stars: ✭ 360 (+1794.74%)
Mutual labels:  robustness
spatial-smoothing
(ICML 2022) Official PyTorch implementation of “Blurs Behave Like Ensembles: Spatial Smoothings to Improve Accuracy, Uncertainty, and Robustness”.
Stars: ✭ 68 (+257.89%)
Mutual labels:  robustness
recentrifuge
Recentrifuge: robust comparative analysis and contamination removal for metagenomics
Stars: ✭ 79 (+315.79%)
Mutual labels:  robustness
frc-score-detection
A program to detect FRC match scores from their livestream.
Stars: ✭ 15 (-21.05%)
Mutual labels:  vision
Learnable-Image-Resizing
TF 2 implementation Learning to Resize Images for Computer Vision Tasks (https://arxiv.org/abs/2103.09950v1).
Stars: ✭ 48 (+152.63%)
Mutual labels:  vision
stereo.vision
planar fitting computation using stereo vision techniques
Stars: ✭ 19 (+0%)
Mutual labels:  vision
Amazing Arkit
ARKit相关资源汇总 群:326705018
Stars: ✭ 239 (+1157.89%)
Mutual labels:  vision
ViTs-vs-CNNs
[NeurIPS 2021]: Are Transformers More Robust Than CNNs? (Pytorch implementation & checkpoints)
Stars: ✭ 145 (+663.16%)
Mutual labels:  robustness
Arc Robot Vision
MIT-Princeton Vision Toolbox for Robotic Pick-and-Place at the Amazon Robotics Challenge 2017 - Robotic Grasping and One-shot Recognition of Novel Objects with Deep Learning.
Stars: ✭ 224 (+1078.95%)
Mutual labels:  vision
Grocery-Product-Detection
This repository builds a product detection model to recognize products from grocery shelf images.
Stars: ✭ 73 (+284.21%)
Mutual labels:  vision
pybv
A lightweight I/O utility for the BrainVision data format, written in Python.
Stars: ✭ 18 (-5.26%)
Mutual labels:  vision
monodepth
Python ROS depth estimation from RGB image based on code from the paper "High Quality Monocular Depth Estimation via Transfer Learning"
Stars: ✭ 41 (+115.79%)
Mutual labels:  vision
TokenLabeling
Pytorch implementation of "All Tokens Matter: Token Labeling for Training Better Vision Transformers"
Stars: ✭ 385 (+1926.32%)
Mutual labels:  vision

Denoised-Smoothing-TF

Minimal implementation of Denoised Smoothing: A Provable Defense for Pretrained Classifiers in TensorFlow. This implementation is now a part of Neural Structured Learning.

Denoised Smoothing is a simple and elegant way to (provably) robustify pre-trained image classification models (including the cloud APIs with only query access) and l2 adversarial attacks. This blog post provides a nice introduction to the method. The figure below summarizes what Denoised Smoothing is and how it works:


  • Take a pre-trained classifier and prepend a pre-trained denoiser with it. Of course, the dataset on which the classifier and the denoiser would need to be trained on the same/similar dataset.
  • Apply Randomized Smoothing.

Randomized Smoothing is a well-tested method to provably defend against l2 adversarial attacks under a specific radii. But it assumes that a classifier performs well under Gaussian noisy perturbations which may not always be the case.

Note: I utilized many scripts from the official repository of Denoised Smoothing to develop this repository. My aim with this repository is to provide a template for researchers to conduct certification tests with Keras/TensorFlow models. I encourage the readers to check out the original repository, it's really well-developed.

Further notes

All the notebooks can be executed on Colab! You also have the option to train using the free TPUs.

If you run into TypeError: Input 'y' of 'AddV2' Op has type float64 that does not match type float32 of argument 'x' error while training the denoiser, try the following (#1):

noise = tf.experimental.numpy.random.randn(batch_size, 32, 32, 3) * self.sigma
noise = tf.cast(noise, tf.float32)

This is not required if you are using TensorFlow 2.4.1.

Results

Denoiser with stability objective Denoiser with MSE objective

As we can see prepending a pre-trained denoiser is extremely helpful for our purpose.

Models

The models are available inside models.tar.gz in the SavedModel format. In the interest of reproducibility, the initial model weights are also provided.

Acknowledgements

Paper citation

@inproceedings{NEURIPS2020_f9fd2624,
 author = {Salman, Hadi and Sun, Mingjie and Yang, Greg and Kapoor, Ashish and Kolter, J. Zico},
 booktitle = {Advances in Neural Information Processing Systems},
 editor = {H. Larochelle and M. Ranzato and R. Hadsell and M. F. Balcan and H. Lin},
 pages = {21945--21957},
 publisher = {Curran Associates, Inc.},
 title = {Denoised Smoothing: A Provable Defense for Pretrained Classifiers},
 url = {https://proceedings.neurips.cc/paper/2020/file/f9fd2624beefbc7808e4e405d73f57ab-Paper.pdf},
 volume = {33},
 year = {2020}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].