Skip to content

Commit

Permalink
cleanup repo
Browse files Browse the repository at this point in the history
  • Loading branch information
rvanbuijtenen committed Oct 29, 2020
1 parent bf786ab commit 0a93db6
Show file tree
Hide file tree
Showing 38 changed files with 1,143 additions and 25,016 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
.DS_Store
/latent-backdoor/data
15 changes: 12 additions & 3 deletions latent-backdoor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,19 @@ Make sure to have Docker daemon running.

Before you start development: download the test and validation datasets at http://www.image-net.org/download-images (ISVRC 2012 dataset) or follow `https://github.com/onnx/models/blob/master/vision/classification/imagenet_prep.md`

## Training locally
Download the datasets for teacher, poisoned teacher and student model:

- Teacher: https://drive.google.com/file/d/19tfqPEx8jzRaj5qw_tF4lbQ2aUWMyZqH/view?usp=sharing
- Poisoned teacher: https://drive.google.com/file/d/1_pXhJrT1L0ksiV0_hIqUFKKP1x9PP29Z/view?usp=sharing
- Student: https://drive.google.com/file/d/1bFI6Np2L6HzMCu3nZa3425wfDgojpKSt/view?usp=sharing

Start the app: `docker-compose up` and then follow the link shown in the console. In the notebooks folder you will find a jupyter notebook called `train_mobilenet.ipynb`. To use a trained model, see the `eval_mobilenet.ipynb` notebook instead. This will also produce a `my-model.onnx` file, which should be stored in `/home/checkpoints`. You can then find the model on your own machine in this repo in the `/latent-backdoor/params` folder.

## Running on peregrine

1. ensure that the GPU version of mxnet is enabled in `latent-backdoor/train/setup-dependencies.sh`
2. clone the repository into your home directory on peregrine
3. submit the batch: `sbatch train-peregrine.txt`

The batch will ensure that all training data is available in `/data/<s-number>/data`. It will also install all required dependencies on the node its running on
3. run `pip install gdown`
4. Update the files `ensure-data.sh`, `train-teacher.py`, `train-trigger.py` and `train-student.py` to point to your own `/data/<s or p number>` folder. Then run it to download and extract the data into the appropriate folder
5. submit the batch for the network that you want to train: `sbatch train-peregrine.txt`
Empty file.
Binary file removed latent-backdoor/data/test/img.jpg
Binary file not shown.
Binary file removed latent-backdoor/data/test/img.png
Binary file not shown.
5 changes: 2 additions & 3 deletions latent-backdoor/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ services:
ports:
- "8888:8888"
volumes:
- "./data/tmp:/home/data"
- "./data:/home/data"
- "./notebooks:/scripts/notebooks"
- "./train/params:/home/checkpoints"

- "./params:/home/checkpoints"
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 4
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
"cells": [
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Download 'mobilenetv2-1.0.onnx'...\n",
"Done.\n",
"Download 'imagenet_class_index.json'...\n",
"Done.\n",
"(1, 3, 224, 224)\n",
"(1, 3, 224, 224) 0.0 1.0\n",
"(1000,)\n",
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit 0a93db6

Please sign in to comment.