README.md 2.32 KB
Newer Older
Carl De Sousa Trias's avatar
Carl De Sousa Trias committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# MPAI-NNT v1.0 implementation 


This code refers to the implementation of the MPAI-NNT.
All the code is based in Python. 
Case 1 resents a direct implementation of the NNW Technical Specification.

### Folders
The structure of case 1 is as followed:
- **Imperceptibility.py**, **Robustness.py**, **ComputationalCost.py** implement the different Evaluation presented in the Technical Specification.
  - *Imperceptibility.py* evaluates imperceptibility by training and evaluate the trained model on a testing dataset
  - *Robustness.py* evaluates the robustness of the given method by selecting a modification **M_ID=1** Modification and **{"P":0.5}** Parameters
  - *Computational_cost* evaluates the computational cost of the method in terms of GPU memory and time of execution
- **utils.py** contains the common functions required for Evaluation.
- **Attacks** folder stores 7 files that implement the 7 Modifications involved in the Robustness Evaluation.
- **NNW** stores a file for each watermarking method, a Python class that possesses three main functions (init, embedder/embedder_one_step, detector/decoder).
- **NNF** stores a file for each fingerprinting method, a Python class that possesses three main functions (init, computer, matcher).
- **Resources** folder contains additional resources for the watermarking/fingerprinting methods and pretrained weights.
Carl De Sousa Trias's avatar
Carl De Sousa Trias committed
19

Carl De Sousa Trias's avatar
Carl De Sousa Trias committed
20
21
22
23
24
25
## Installation
Code was designed and tested on an Ubuntu 20.04 operating system using anaconda 23.7.2 and Python 3.9.
An environment with all the necessary libraries can be created using:
```bash
conda create --name <env> --file requirements.txt
```
Carl De Sousa Trias's avatar
Carl De Sousa Trias committed
26

Carl De Sousa Trias's avatar
Carl De Sousa Trias committed
27
28
29
30
31
## Run
All modifications should be applied inside the three files (**Imperceptibility.py**, **Robustness.py**, **ComputationalCost.py**). The "to be modified" section are delimited by ####### while the code can be run:
```bash
conda activate <env>
python Imperceptibility.py
Carl De Sousa Trias's avatar
Carl De Sousa Trias committed
32
```
Carl De Sousa Trias's avatar
Carl De Sousa Trias committed
33
34
35
36
37
38
To send commands to the controller as a user agent, 
a second terminal should be open, and run:
```bash
conda activate <env>
python input.py
input: <your command>
Carl De Sousa Trias's avatar
Carl De Sousa Trias committed
39
```
Carl De Sousa Trias's avatar
Carl De Sousa Trias committed
40
Watermarking methods & fingerprinting methods can be added in the NNW folder & NNT folder following the instruction specified in the technical specification (Python Class).
Carl De Sousa Trias's avatar
Carl De Sousa Trias committed
41

Carl De Sousa Trias's avatar
Carl De Sousa Trias committed
42
43
# Licence
[Licence](https://mpai.community/standards/mpai-nnw/framework-licence/) information are detailed in the MPAI website