All Projects → bolunwang → translearn

bolunwang / translearn

Licence: MIT license
Code implementation of the paper "With Great Training Comes Great Vulnerability: Practical Attacks against Transfer Learning", at USENIX Security 2018

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to translearn

Keras-MultiClass-Image-Classification
Multiclass image classification using Convolutional Neural Network
Stars: ✭ 48 (+166.67%)
Mutual labels:  transfer-learning
EntityTargetedActiveLearning
No description or website provided.
Stars: ✭ 17 (-5.56%)
Mutual labels:  transfer-learning
adversarial-code-generation
Source code for the ICLR 2021 work "Generating Adversarial Computer Programs using Optimized Obfuscations"
Stars: ✭ 16 (-11.11%)
Mutual labels:  adversarial-machine-learning
aml-keras-image-recognition
A sample Azure Machine Learning project for Transfer Learning-based custom image recognition by utilizing Keras.
Stars: ✭ 14 (-22.22%)
Mutual labels:  transfer-learning
task-transferability
Data and code for our paper "Exploring and Predicting Transferability across NLP Tasks", to appear at EMNLP 2020.
Stars: ✭ 35 (+94.44%)
Mutual labels:  transfer-learning
Open set domain adaptation
Tensorflow Implementation of open set domain adaptation by backpropagation
Stars: ✭ 27 (+50%)
Mutual labels:  transfer-learning
Context-Transformer
Context-Transformer: Tackling Object Confusion for Few-Shot Detection, AAAI 2020
Stars: ✭ 89 (+394.44%)
Mutual labels:  transfer-learning
TrainCaffeCustomDataset
Transfer learning in Caffe: example on how to train CaffeNet on custom dataset
Stars: ✭ 20 (+11.11%)
Mutual labels:  transfer-learning
CPCE-3D
Low-dose CT via Transfer Learning from a 2D Trained Network, In IEEE TMI 2018
Stars: ✭ 40 (+122.22%)
Mutual labels:  transfer-learning
Deep-Learning-Experiments-implemented-using-Google-Colab
Colab Compatible FastAI notebooks for NLP and Computer Vision Datasets
Stars: ✭ 16 (-11.11%)
Mutual labels:  transfer-learning
MoeFlow
Repository for anime characters recognition website, powered by TensorFlow
Stars: ✭ 113 (+527.78%)
Mutual labels:  transfer-learning
LegoBrickClassification
Repository to identify Lego bricks automatically only using images
Stars: ✭ 57 (+216.67%)
Mutual labels:  transfer-learning
NaiveNASflux.jl
Your local Flux surgeon
Stars: ✭ 20 (+11.11%)
Mutual labels:  transfer-learning
TransTQA
Author: Wenhao Yu ([email protected]). EMNLP'20. Transfer Learning for Technical Question Answering.
Stars: ✭ 12 (-33.33%)
Mutual labels:  transfer-learning
DAN
Code release of "Learning Transferable Features with Deep Adaptation Networks" (ICML 2015)
Stars: ✭ 149 (+727.78%)
Mutual labels:  transfer-learning
favorite-research-papers
Listing my favorite research papers 📝 from different fields as I read them.
Stars: ✭ 12 (-33.33%)
Mutual labels:  transfer-learning
adversarial-recommender-systems-survey
The goal of this survey is two-fold: (i) to present recent advances on adversarial machine learning (AML) for the security of RS (i.e., attacking and defense recommendation models), (ii) to show another successful application of AML in generative adversarial networks (GANs) for generative applications, thanks to their ability for learning (high-…
Stars: ✭ 110 (+511.11%)
Mutual labels:  adversarial-machine-learning
tamnun-ml
An easy to use open-source library for advanced Deep Learning and Natural Language Processing
Stars: ✭ 109 (+505.56%)
Mutual labels:  transfer-learning
AU Recognition
AU_Recognition based on CKPlus/CK database
Stars: ✭ 21 (+16.67%)
Mutual labels:  transfer-learning
super-gradients
Easily train or fine-tune SOTA computer vision models with one open source training library
Stars: ✭ 429 (+2283.33%)
Mutual labels:  transfer-learning

TransLearn

ABOUT

This repository contains code implementation of the paper "With Great Training Comes Great Vulnerability: Practical Attacks against Transfer Learning", at USENIX Security 2018.

DEPENDENCIES

Code is implemented using a mixure of Keras and TensorFlow. Following packages are used to perform the attack and setup the attack evaluation:

  • keras==2.2.0
  • numpy==1.14.0
  • tensorflow-gpu==1.8.0
  • h5py==2.8.0

The code is tested using Python 2.7.

HOWTO

Attack

We include a sample script that demonstrates how to perform the attack on the Face Recognition example and how to evaluate the attack performance.

python pubfig65_vggface_mimic_penalty_dssim.py

There are several parameters that need to be modified before running the code, which is included in the "PARAMETER" section of the script.

  1. Model files of the Teacher and Student need to be downloaded using the following link, and placed at the correct path. Model files are specified by TEACHER_MODEL_FILE and STUDENT_MODEL_FILE. You can download the pre-trained models using links provided in the section below, and place them under the models folder.
  2. We included a sample data file, which includes 1 image for each label in the Student model. Download the data file, and place it under the datasets folder.
  3. If you are using GPU, you need to specify which GPU you want to use for the attack. This this specified by the DEVICE variable. If the specified GPU is not found, it will fall back to CPU by default.
  4. Attack configuration is specified by this section of parameters. Most important parameters are, NB_PAIR and DSSIM_THRESHOLD.

Fingerprinting

We include two scripts showcasing how to fingerprint the Teacher model given a Student. pubfig65_fingerprint_vggface.py shows fingerprinting the VGGFace model and test on the Face Recognition model, which uses VGGFace as Teacher. This pubfig65_fingerprint_vgg16.py shows fingerprinting the VGG-16 model and test on the Face Recognition model. As described in the paper, the fingerprint image of the correct Teacher should produce an evenly-distributed prediction result, which would have a very low Gini coefficient. For example, pubfig65_fingerprint_vggface.py produces a Gini coefficient of 0.003539, and pubfig65_fingerprint_vgg16.py produces a Gini coefficient of 0.508905.

To run these examples, simply run

python pubfig65_fingerprint_vggface.py

Similar as the previous attack example, there are several parameters you need to change. And there are several special modifications comparing with the previous attack example.

  1. You need to specify the GPU used in DEVICE.
  2. Path to model files are specified by TEACHER_MODEL_FILE and STUDENT_MODEL_FILE. Or you can load Teacher model directly from Keras, inside the load_and_build_models() function, similar as this.
  3. DSSIM threshold (DSSIM_THRESHOLD) is set to 1 in fingerprinting. This is because this is not intended to be an attack, therefore does not have to be stealthy.
  4. When building the attacker, the mimic_img flag is set to be False. This is because we mimic an all-zero vector, instead of internal representation of a target image.

Patch

This script contains an example of how to patch DNN using the updated loss function. To run this script, simply run

python pubfig65_patch_neuron_distance.py

Similar as the previous example, there is some setup before running this example, as described below.

  1. Path to model files are specified by TEACHER_MODEL_FILE and STUDENT_MODEL_FILE.
  2. DATA_FILE specifies the patch to the training/testing dataset. We use the h5 format to store the dataset, but you can change it to any format you prefer. Dataset is loaded by the load_dataset() function. Be sure to modify the function if you change the dataset format.
  3. Similar as before, you need to specify the GPU used for training. This is specified by DEVICE.
  4. Parameters used by the patching is specified here. We incrementally increase the neuron distance threshold to stablize the training process. More details are included in the documentation of the script.

DATASETS

Below is the list of datasets we used in the paper.

  • PubFig: This dataset is used to train the Face Recognition model in the paper. The detailed information about this dataset is included in this page. We use a specific version of the dataset, where images are aligned.
  • CASIA Iris: This dataset is used to train the Iris Recognition task. Detailed information is included in this page.
  • GTSRB: This dataset is used to train the Traffic Sign Recognition model. Detailed information could be found here.
  • VGG Flower: This dataset is used to train the Flower Recognition model. Detailed information and download link could be found here.

PRE-TRAINED MODELS

Below is a list of links to pre-trained models we used in the paper. All models are hosted on Dropbox.

  • Face Recognition: link to model. This model uses imagenet mean-centering as preprocessing.
  • Iris Recognition: link to model. This model uses imagenet mean-centering as preprocessing.
  • Traffic Sign Recognition: link to model. This model uses imagenet mean-centering as preprocessing.
  • Flower Recognition: link to model. This model uses inception preprocessing, which rescales the input to [-1, 1].

We also converted the pre-trained VGGFace model from Caffe to Keras. The architecture is defined in utils_translearn.py, and the pre-trained model weights can be downloaded here.

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].