Git Product home page Git Product logo

snu-ccl / fhe-mp-cnn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoft/seal

57.0 0.0 10.0 53.95 MB

Implementation of deep ResNet model on CKKS scheme in Microsoft SEAL library using multiplexed parallel convolution

Home Page: https://www.microsoft.com/en-us/research/group/cryptography-research/

License: MIT License

Shell 0.05% C++ 69.18% C 2.61% C# 21.48% Makefile 4.03% CMake 2.65%

fhe-mp-cnn's Introduction

Dependencies

The GMP library and the NTL library is needed for the Remez algorithm. OpenMP library is needed for the multi-threaded execution of cnn. All programs for building the SEAL library is needed. This source code has been developed and checked in Ubuntu-20.04. 384GB RAM is required to test one image. (not exact hard limit but encouraged) 512GB RAM is required to test 50 images simultaneously with multi-threading. (not exact hard limit but encouraged)

Regarding SEAL library

We use Microsoft SEAL library version 3.6.6 for RNS-CKKS homomorphic encryption scheme. Since the original SEAL library version 3.6.6 is not bootstrapping-friendly, we modified the SEAL library so that the bootstrapping operation of the RNS-CKKS scheme can be implemented. You should build and install the modified SEAL library in "cnn_ckks/cpu-ckks/single-key/seal-modified-3.6.6" if you want to build our homomorphic ResNet CNN source code. Specifically, you can build and install the modified SEAL library by the following commands.

cd cnn_ckks/cpu-ckks/single-key/seal-modified-3.6.6
cmake -S . -B build
cmake --build build
cmake --install build

Building cnn_ckks

The executable file can be built by the following commands.

cd cnn_ckks
cmake -S . -B build
cd build
make

The build outputs including executable is stored in "cnn_ckks/build" directory, and the executable file is named as "cnn".

Executing the executable file

There are some additional parameters when executing the "cnn" file, and the form of the command should be as follows.

cd cnn_ckks/build
./cnn (LAYER NUMBER) (DATASET NUMBER) (START IMAGE) (END IMAGE)

(LAYTER NUMBER) : the number of layers in cnn (DATASET NUMBER) : the type of dataset (10: CIFAR-10, 100: CIFAR-100) (START IMAGE) : the label number of the first image you want to infer (END IMAGE) : the label number of the last image you want to infer

For example, if you want to perform ResNet-110 for images in CIFAR-10 test dataset with label number 6, 7, 8, 9, and 10, you may want to execute the "cnn" file as follows.

cd cnn_ckks/build
./cnn 110 10 6 10 

If you want to perform ResNet-32 for only an image in CIFAR-100 with label number 4, you may want to execute the "cnn" file as follows.

cd cnn_ckks/build
./cnn 32 100 4 4 

Supported layers : CIFAR-10 - 20, 32, 44, 56, 110 / CIFAR-100 - 32 Supported image label numbers : 0 ~ 9999

Checking results

Text files for various intermediate and final results are generated in the result directory in the root directory of our supplementary file. The following text files are generated.

resnet(LAYER NUMBER)_cifar(DATASET NUMBER)_image(IMAGE NUMBER).txt: This file includes information about the running time, the remaining level, and the scaling factor for each procedure. Also, it partly shows the decrypted values when each layer is terminated and shows the resultant decrypted values. Finally, it shows the inference result with the correct image label and total running time. This type of file is generated for each input image.

resnet(LAYER NUMBER)cifar(DATASET NUMBER)label(START IMAGE)(END IMAGE): This file includes information about the inference results with the correct image label for all images.

fhe-mp-cnn's People

Contributors

alexanderviand avatar bastienvialla avatar chrdavis avatar codedust avatar dkaidalov avatar dnat112 avatar fboemer avatar fionser avatar florentclmichel avatar g2flyer avatar haochenuw avatar jharrilim avatar joonwoolee42 avatar joshbeal avatar kimlaine avatar kiromaru avatar marinthiercelin avatar microsoftopensource avatar mmroz avatar msftgits avatar nescobaraloplop avatar qix- avatar rand0musername avatar rav1kantsingh avatar s0l0ist avatar sivanov-work avatar youben11 avatar yurivict avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.