Skip to content

Commit

Permalink
updated gitignore and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
kamwoh committed Sep 20, 2019
1 parent bb6e443 commit 5d1a670
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -102,3 +102,6 @@ venv.bak/

# mypy
.mypy_cache/

data/
logs/
60 changes: 59 additions & 1 deletion README.md
Expand Up @@ -8,7 +8,65 @@ Released on September 16, 2019

With the rapid development of deep neural networks (DNN), there emerges an urgent need to protect the trained DNN models from being illegally copied, redistributed, or abused without respecting the intellectual properties of legitimate owners. This work proposes novel passport-based DNN ownership verification schemes which are both robust to network modifications and resilient to ambiguity attacks. The gist of embedding digital passports is to design and train DNN models in a way such that, the DNN model performance of an original task will be significantly deteriorated due to forged passports. In other words genuine passports are not only verified by looking for predefined signatures, but also reasserted by the unyielding DNN model performances.

Code will be updated soon. Stay Tune.
## How to run

You must have a pretrained model before training a passport layer if you wish to use a real image as passport.

To see more arguments, please run the script with `--help`.

The example below are running with default arguments.

### To train a normal model (no passport)

Run without `--train-passport`
```
python train_v1.py
```

### To train a V1 model (scheme 1 passport)

Run with `--train-passport`
```
python train_v1.py --train-passport --pretrained-path path/to/pretrained.pth
```

### To train a V2 model (scheme 2 passport)

Do not need to run with `--train-private`, it is true by default
```
python train_v23.py --pretrained-path path/to/pretrained.pth
```

### To train a V3 model (scheme 3 passport)

Run with `--train-backdoor`
```
python train_v23.py --train-backdoor --pretrained-path path/to/pretrained.pth
```

## Dataset

Most of the datasets will be automatically downloaded except `trigger set` data.

To download default trigger-set, refer to https://github.com/adiyoss/WatermarkNN

Refer to `dataset.py` to see how data are loaded.

## Attack

`passport_attack_1.py`, `passport_attack_2.py`, and `passport_attack_3.py` are scripts to run fake attack 1, 2, 3 as mentioned in the paper.

The scripts should be easy to run, refer to `--help` on how to setup the arguments.

## Passport Config

All passport configs are stored in `passport_configs/`

To set a passport layer for Alexnet or ResNet18, simply changing `false` to `true` or a `string`.

If putting `string` into passport config, please make sure the length of string is less than number of channels in the specific layer.

For example, a layer with 256 channels, maximum 256-bit === 32 ascii characters are allowed.

## Citation
If you find this work useful for your research, please cite
Expand Down

0 comments on commit 5d1a670

Please sign in to comment.