Two-party Privacy-preserving Neural Network Training using Split Learning and Homomorphic Encryption in CKKS Scheme.
Source code of the paper Split Without a Leak: Reducing Privacy Leakage in Split Learning (accepted at the 19th EAI International Conference on Security and Privacy in Communication Networks (SecureComm’23)).
python==3.9.7
tenseal==0.3.10
torch==1.8.1+cu102
icecream==2.1.2
h5py==3.7.0
hydra-core==1.1.1
pandas==1.5.2
├── conf
│ ├── config.yaml # hold the configurations (dataset to use, hyperparameters)
├── data
│ ├── ptbxl_processing.ipynb # code to process the PTB-XL dataset
├── images # images to be used in notebooks and README.md
├── notebooks # contains jupyter notebooks
├── outputs # will be automatically created after running the protocols
├── hesplitnet # contains the code
| ├── multi-clients # code for multi clients protocol (experimental)
| ├── single-client # code for the single client protocol
└── weights # contains the initial and trained weights
The processed MIT-BIH dataset for the one-client protocol (mitbih_train.hdf5
and mitbih_test.hdf5
) and multi-client protocol (multiclient_mitbih_train.hdf5
and multiclient_mitbih_test.hdf5
) are in the data/
folder.
For the PTB-XL dataset, you can run the file data/ptbxl_processing.ipynb
to produce the .hdf5
files, but it is recommended that you just download them here and put the .hdf5
files in the data
folder.
- Create a new conda environment, for example
conda create -n hesplitnet python=3.9.7
and activate it usingconda activate hesplitnet
- Install the required packages in the
requirements.txt
, e.g.pip install -r requirements.txt
- Install
hesplitnet
as a package usingpip install -e .
- Specify the hyperparamters for your protocol in
conf/config.yaml
- Running the protocol:
- In the terminal, run
python hesplitnet/single-client/server.py
. The server will be started and waiting for the client. - Open a new tab in the terminal and run
python hesplitnet/single-client/client.py
. The training process will start. - After the training is done, the logs and output files will be saved in the directory
outputs/<year_month_day>/<output_dir>
whereoutput_dir
is defined inconf/config.yaml
. - After training, go to
notebooks/test_mitbih.ipynb
ornotebooks/test_ptbxl.ipynb
to run and inspect the testing procedure for the MIT-BIH or PTB-XL dataset respectively.
- In the terminal, run