|
1 | 1 | # BLACKBOX |
2 | 2 |
|
3 | | -main code |
| 3 | +## Installation |
4 | 4 |
|
5 | | -## Structure |
| 5 | +```bash |
| 6 | +$ pip install vidmodex ## Stable version |
| 7 | +$ pip install git+https://github.com/hex-plex/Model-Extraction-Attacks-Video-Classification ## Latest development |
| 8 | +``` |
| 9 | + |
| 10 | +## Usage |
| 11 | +Simple snippet explaining the usage |
| 12 | + |
| 13 | +### BlackBox Extraction |
| 14 | +```python |
| 15 | +# Black Box Victim: SwinT, Student: ViViT, Generator: Tgan |
| 16 | + |
| 17 | +from vidmodex.models import ViViT as Student |
| 18 | +from vidmodex.models import SwinT as Victim |
| 19 | +from vidmodex.generator import Tgan as Generator |
| 20 | + |
| 21 | +custom_config = {} |
| 22 | +custom_config["num_classes"] = 400 |
| 23 | + |
| 24 | +blackbox_main(custom_config) |
| 25 | +``` |
| 26 | +### GreyBox Extraction |
| 27 | + |
| 28 | +```python |
| 29 | +# Grey Box Victim: SwinT, Student: ViViT, Generator: Tgan, Dataset: Kinetics 400 |
| 30 | + |
| 31 | +from vidmodex.models import ViViT as Student |
| 32 | +from vidmodex.models import SwinT as Victim |
| 33 | +from vidmodex.generator import Tgan as Generator |
| 34 | + |
| 35 | +custom_config = {} |
| 36 | +custom_config["csv_file"] = "ENTER-THE-LOCATION-OF-DATA-CSV" |
| 37 | +custom_config["root_dir"] = "ENTER-THE-LOCATION-OF-DATA-ROOT" |
| 38 | +custom_config["ucf_gan_weights"] = "ENTER-THE-LOCATION-OF-UCF-WEIGHTS" or "state_normal81000.ckpt" |
| 39 | +custom_config["num_classes"] = 400 |
| 40 | + |
| 41 | +greybox_main(custom_config) |
| 42 | +``` |
| 43 | + |
| 44 | +## File Structure |
| 45 | + |
| 46 | +This is for reference if one wants to experiment his own model or algorithm he may change that specific module / part |
6 | 47 |
|
7 | 48 | ``` |
8 | 49 | models/ |
9 | | - - modela.py |
| 50 | + - modela.py ## Video Classification Architecture (Teacher/Student) |
10 | 51 | - modelb.py |
11 | 52 | train/ |
12 | | - - train_loop1.py |
| 53 | + - train_loop1.py ## Traing Algorithm |
13 | 54 | - train_loop2.py |
14 | 55 | generator/ |
15 | | - - generator1_.py |
| 56 | + - generator1_.py ## Video Generator Architecture |
16 | 57 | - generator2_.py |
17 | 58 |
|
18 | | -main_1.py # usses modela with generator2 with train_loop1 |
| 59 | +main_file.py ## Contains your custom config/data |
19 | 60 | .. |
20 | 61 | ``` |
21 | 62 |
|
22 | | -## Models |
23 | | - |
24 | | -- Setup |
25 | | - |
26 | | - ```shell |
27 | | - #!/usr/bin/bash |
28 | | - conda env create -f environment_swinT.yml |
29 | | - conda activate swint |
30 | | - mkdir weights/ |
31 | | - cd weights/ |
32 | | - #SwinT weights |
33 | | - gdown https://drive.google.com/uc?id=10_ArqSj837hBzoQTq3RPGBZgKbBvNfSe |
34 | | - |
35 | | - #MoviNetA2 weights |
36 | | - gdown --id 12jpmoKb1wfF0Mpq7IeLbeoHLtJ1YaoDV |
37 | | - |
38 | | - cd ../ |
39 | | - ``` |
40 | | - |
41 | | -- Run files from root directory of this project. |
42 | | - |
43 | 63 | ## References |
44 | 64 |
|
45 | 65 | ViViT - https://arxiv.org/abs/2103.15691 |
|
0 commit comments