All Projects → SSGAalto → minionn

SSGAalto / minionn

Licence: Apache-2.0 license
Privacy -preserving Neural Networks

Programming Languages

python
139335 projects - #7 most used programming language
C++
36643 projects - #6 most used programming language
Makefile
30231 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to minionn

UAV-Stereo-Vision
A program for controlling a micro-UAV for obstacle detection and collision avoidance using disparity mapping
Stars: ✭ 30 (-48.28%)
Mutual labels:  research, research-paper
annotated research papers
This repo contains annotated research papers that I found really good and useful
Stars: ✭ 2,101 (+3522.41%)
Mutual labels:  research, research-paper
best AI papers 2021
A curated list of the latest breakthroughs in AI (in 2021) by release date with a clear video explanation, link to a more in-depth article, and code.
Stars: ✭ 2,740 (+4624.14%)
Mutual labels:  research, research-paper
Qlib
Qlib is an AI-oriented quantitative investment platform, which aims to realize the potential, empower the research, and create the value of AI technologies in quantitative investment. With Qlib, you can easily try your ideas to create better Quant investment strategies. An increasing number of SOTA Quant research works/papers are released in Qlib.
Stars: ✭ 7,582 (+12972.41%)
Mutual labels:  research, research-paper
PhD
My PhD Papers and Presentations
Stars: ✭ 24 (-58.62%)
Mutual labels:  research, research-paper
encrypted-skin-cancer-detection
Detecting skin cancer in encrypted images with TensorFlow
Stars: ✭ 27 (-53.45%)
Mutual labels:  multi-party-computation, privacy-preserving
portfoliolab
PortfolioLab is a python library that enables traders to take advantage of the latest portfolio optimisation algorithms used by professionals in the industry.
Stars: ✭ 104 (+79.31%)
Mutual labels:  research
manifold mixup
Tensorflow implementation of the Manifold Mixup machine learning research paper
Stars: ✭ 24 (-58.62%)
Mutual labels:  research
haal
Hääl - Anonymous Electronic Voting System on Public Blockchains
Stars: ✭ 96 (+65.52%)
Mutual labels:  homomorphic-encryption
NDecrypt
Cartridge encrypt/decrypt
Stars: ✭ 22 (-62.07%)
Mutual labels:  research
Rough-Sketch-Simplification-Using-FCNN
This is a PyTorch implementation of the the Paper by Simo-Sera et.al. on Cleaning Rough Sketches using Fully Convolutional Neural Networks.
Stars: ✭ 31 (-46.55%)
Mutual labels:  research-paper
gamma
An Eclipse-based modeling framework for the component-based design and analysis of reactive systems
Stars: ✭ 21 (-63.79%)
Mutual labels:  research
assembly improvement
Improve the quality of a denovo assembly by scaffolding and gap filling
Stars: ✭ 46 (-20.69%)
Mutual labels:  research
alchemy
Experiments logging & visualization
Stars: ✭ 49 (-15.52%)
Mutual labels:  research
nllgrid
Python class for reading and writing NLLoc grid files.
Stars: ✭ 23 (-60.34%)
Mutual labels:  research
Manifest
Manifest is an investigative toolkit intended for researchers, journalists, students, and scholars interested in visualizing, analyzing, and documenting supply chains, production lines, and trade networks.
Stars: ✭ 12 (-79.31%)
Mutual labels:  research
datascience
Keeping track of activities around research data
Stars: ✭ 29 (-50%)
Mutual labels:  research
covid19 scenarios data
Data preprocessing scripts and preprocessed data storage for COVID-19 Scenarios project
Stars: ✭ 43 (-25.86%)
Mutual labels:  research
fully-homomorphic-encryption
Libraries and tools to perform fully homomorphic encryption operations on an encrypted data set.
Stars: ✭ 2,737 (+4618.97%)
Mutual labels:  homomorphic-encryption
dm2gym
Convert DeepMind Control Suite to OpenAI gym environments.
Stars: ✭ 76 (+31.03%)
Mutual labels:  research

Requirements

sudo apt install libssl-dev libgmp-dev libglib2.0-dev
pip install pybind11 cppimport onnx

Installation

ABY

Make sure you initialized gits submodules recursively:

git submodule update --init --recursive

Then, run make all in the lib folder:

cd lib
make all

SEAL

Download SEAL (MiniONN is tested for Seal v2.3.1), and place its SEAL subdirectory in libs (so that libs/SEAL contains the seal subdirectory). https://www.microsoft.com/en-us/research/project/simple-encrypted-arithmetic-library/

You now need to install SEAL with position independent code! Do this by adding the following line to the fie CMakeLists.txt before running CMake:

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

Now, install SEAL as instructed in the INSTALL.txt:

cd SEAL
cmake .
make
sudo make install 

NOTE: If you prefer to not install SEAL globally, or do not want to install a global version with position independent code, you can instruct MiniONN to use a local SEAL library. For this, update the minionn.cpp file as follows:

cfg['libraries'] = [
    #SEAL library
    'seal', # Change the path to the SEAL file here

Veryfying the installation

There are three test files in the lib subdirectory: test.py, test_mpc_server.py and test_mpc_client.py.

Run

python3 test.py

and verify that all tests passed. If you encountered errors during the initial compilation of the C++ modules, there are probably some files missing for SEAL or ABY.

Next, run the test_mpc_server.py and then the test_mpc_client.py in a second terminal.

Usage

There are three models given in the models folder. All three take the S.tensor as input:

# Server: 
python3 server.py -i models/S.onnx
# Client: 
python3 client.py -i models/S.tensor -o models.out.txt

You can test and verify the correctness of the three models with the given scripts in the models folder.

cd models
python3 check_s.py

You can additionally build your own models with the scripts in the tools folder. Those also have their own test scripts included.

MiniONN input

The MiniONN client requires only the model input to be given as a ONNX Tensor. The example models and tool model creators already create a TensorProto file automatically. However, for your own models you will need to export your data into a TensorProto and store that as a file. An example of how to do this process is in tools/csv_to_tensor.py .

MiniONN inaccuracy

MiniONN introduces some inaccuracy into the calculated result. This can best be seen when running the above usage example and taking a look at the Difference between the expected and given result of the check_s.py file. In our tests, this error did not change any predicted result. However, keep this error in mind whenever you experiment.

In future, this slight error might be resolved by changing the randomness of V as V gets downshifted after every matrix multiplication.

This downshift is also important for the scaling that is set in common/config.py . Here, the fractional_base is used to shift the input (weight and client input) up with the fractional base, and to scale the result down again after every matrix multiplication. If your input does not need to be scaled up (into integer range), then you can set the fractional_downscale to 1 for your models. However, you might then need to set the downscale factor in the same configuration file to prevent overflows (especially overflows over the cryptographic modulo used by MiniONN).

Important note

The MiniONN code has a small drawback that has to be taken into account when working with it: Currently, the server implementation uses a static dictionary in the minionn_helper file. This means that a server needs to be restarted after every run. This can easily be fixed by changing to a class that keeps all tensors of a specific instance and using this from the operation_helper.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].