Code Monkey home page Code Monkey logo

microsoft / cryptonets Goto Github PK

View Code? Open in Web Editor NEW
273.0 13.0 73.0 35.78 MB

CryptoNets is a demonstration of the use of Neural-Networks over data encrypted with Homomorphic Encryption. Homomorphic Encryptions allow performing operations such as addition and multiplication over data while it is encrypted. Therefore, it allows keeping data private while outsourcing computation (see here and here for more about Homomorphic E

License: MIT License

C# 100.00%
homomorphic-encryptions data-encrypted neural-networks seal

cryptonets's Introduction

CryptoNets is a demonstration of the use of Neural-Networks over data encrypted with Homomorphic Encryption. Homomorphic Encryptions allow performing operations such as addition and multiplication over data while it is encrypted. Therefore, it allows keeping data private while outsourcing computation (see here and here for more about Homomorphic Encryptions and its applications). This project demonstrates the use of Homomorphic Encryption for outsourcing neural-network predictions. The scenario in mind is a provider that would like to provide Prediction as a Service (PaaS) but the data for which predictions are needed may be private. This may be the case in fields such as health or finance. By using CryptoNets, the user of the service can encrypt their data using Homomorphic Encryption and send only the encrypted message to the service provider. Since Homomorphic Encryptions allow the provider to operate on the data while it is encrypted, the provider can make predictions using a pre-trained Neural-Network while the data remains encrypted throughout the process and finaly send the prediction to the user who can decrypt the results. During the process the service provider does not learn anything about the data that was used, the prediction that was made or any intermediate result since everything is encrypted throughout the process.

This project uses the Microsoft SEAL version 3.2 implementation of Homomorphic Encryption developed in Microsoft Research. The project is made of three components:

  1. A wrapper for Homomorphic Encryption that allow working with matrices and vectors while hiding much of the underlying crypto.
  2. Implementation of main Neural-Network layers using the wrapper.
  3. Implementation of specific Neural-Networks using the framework.

The networks that are currently implemented are CryptoNets and Low-Latency CryptoNets (LoLa) that operate on the MNIST dataset as well as versions of LoLa that operate on the CIFAR-10 and CalTech-101 datasets. The project also includes a small demonstration of using the wrapper for Homomorphic Encryption for performing computations that are not necessarily Neural-Networks.

When using this project in a scientific paper, please cite the paper Low Latency Privacy Preserving Inference.

@inproceedings{Brutzkus2019LowLatency,
  title={Low Latency Privacy Preserving Inference},
  author={Brutzkus, Alon and Elisha, Oren and Gilad-Bachrach, Ran},
  booktitle={International Conference on Machine Learning},
  year={2019}
}

Installation

The project is designed to be built using Visual-Studio 2017 and was tested in the windows environment used .Net framework version 4.6.2.

To install the project follow the following steps

1. Install SEAL

This project depends on SEAL version 3.2. Download this version of SEAL from [http://sealcrypto.org]. Note that CryptoNets does not support SEAL 3.3 which uses a different API. Instead, you can checkout version 3.2 using the command git checkout 3.2.2. In order to obtain best performance introduce the following change to the code of SEAL before compiling:

Open SEAL/native/src/seal/evaluator.cpp and in the are_same_scale function change the the arguments to be: const T &value1, const S &value2.

Use the instructions in [https://github.com/microsoft/SEAL/blob/master/dotnet/nuget/NUGET.md] to create a NuGet package. Once done, copy the nuget package to the root directory of this project (where the solution file CryptoNets.sln is).

2. Build CryptoNets

  • Download all CryptoNets files.
  • Open the CryptoNets solution using Visual Studio and compile the project. Make sure to target x64 and use either Release or Debug mode.

3. Prepare data files

  • Change Directory to the .\bin\x64\Release or .\bin\x64\Debug directory (depending on the choice of build you used).
  • Use DataPreprocess.exe to obtain and prepare the datasets you are interested in. For each of the datests (MNIST/CIFAR/CAL) issue the command DataPreprocess.exe dataset-name. Instructions on where to download the data from will be displayed. After downloading the data to the local directory issue the command DataPreprocess.exe dataset-name again to preprocess the data.

Running

After downloading and preparing the data you can test the different applications. Note that if you build the code in Debug mode more information may be displayed. Here we demonstrate the outputs for Release mode.

Basic Examples

This project does not require any data. Issue the command BasicExample.exe which will generate output similar to

Generated keys in 0.4218858 seconds
Norm Sqared is:
DenseVector 1-Double
14

sum of elements in a vector:
DenseVector 1-Double
6

elementwise multiply =
DenseVector 3-Double
 -1
 10
-12

Compute in 0.203117 seconds

CryptoNets

This project requires the MNIST data. It implements the CryptoNets but with SEAL 3.2 as opposed to SEAL 1.0 that was used in the original paper. To run, issue the command .\CryptoNets.exe. The expected output is

Preparing
Layer EncryptLayer computed in 2.2655761 seconds (08:33:37.085 -- 08:33:39.351) layer width (8192,784)
Layer TimingLayer computed in 0.015603 seconds (08:33:39.351 -- 08:33:39.366) layer width (8192,784)
Pool (no-bias) layer with 5 maps and 169 locations (total size 845) kernel size 26
Layer PoolLayer computed in 5.156229 seconds (08:33:39.366 -- 08:33:44.523) layer width (8192,784)
Layer SquareActivation computed in 9.7500237 seconds (08:33:44.523 -- 08:33:54.273) layer width (8192,845)
Pool (bias) layer with 100 maps and 1 locations (total size 100) kernel size 845
Layer PoolLayer computed in 9.3281011 seconds (08:33:54.273 -- 08:34:03.601) layer width (8192,845)
Layer SquareActivation computed in 1.1562609 seconds (08:34:03.601 -- 08:34:04.757) layer width (8192,100)
Pool (bias) layer with 10 maps and 1 locations (total size 10) kernel size 100
Layer PoolLayer computed in 0.1875013 seconds (08:34:04.757 -- 08:34:04.944) layer width (8192,100)
Layer TimingLayer computed in 0 seconds (08:34:04.944 -- 08:34:04.944) layer width (8192,10)
errs 0/100 accuracy 100.000% prediction 9 label 9
errs 2/200 accuracy 99.000% prediction 2 label 2
errs 3/300 accuracy 99.000% prediction 8 label 8
errs 3/400 accuracy 99.250% prediction 4 label 4
errs 5/500 accuracy 99.000% prediction 6 label 6
errs 7/600 accuracy 98.833% prediction 9 label 9
errs 10/700 accuracy 98.571% prediction 3 label 3
errs 10/800 accuracy 98.750% prediction 2 label 2
errs 11/900 accuracy 98.778% prediction 8 label 8
...

LowLatencyCryptoNets

This project implements different LoLa versions on MNIST. Note that the paper uses SEAL 2.3 while here we use SEAL 3.2, so the expected performance is slightly better. To run this project use the command .\LowLatencyCryptoNets with the following parameters:

-v, --verbose (Default: false) Set output to verbose messages. In the verbose mode more information is presented

-e, --encrypt (Default: false) Use encryption. In encrypted mode the network operates on encrypted data, otherwise it operates on plain data

-n, --network Required. Type of network to use (LoLa, LoLaDense, LoLaSmall, LoLaLarge)

For example, the command .\LowLatencyCryptoNets -n LoLa -e will generate the following output:

LoLa mode
Generating keys in 1.8437561 seconds
errs 0/1 accuracy 100.000% Prediction-Time 2156.22 prediction 7 label 7
errs 0/2 accuracy 100.000% Prediction-Time 2070.28 prediction 2 label 2
errs 0/3 accuracy 100.000% Prediction-Time 2041.65 prediction 1 label 1
errs 0/4 accuracy 100.000% Prediction-Time 2027.33 prediction 0 label 0
errs 0/5 accuracy 100.000% Prediction-Time 2024.99 prediction 4 label 4
errs 0/6 accuracy 100.000% Prediction-Time 2023.44 prediction 1 label 1
errs 0/7 accuracy 100.000% Prediction-Time 2020.09 prediction 4 label 4
errs 0/8 accuracy 100.000% Prediction-Time 2017.58 prediction 9 label 9
errs 0/9 accuracy 100.000% Prediction-Time 2013.89 prediction 5 label 5
errs 0/10 accuracy 100.000% Prediction-Time 2014.07 prediction 9 label 9
...

CifarCryptoNets

This project implements LoLa on the CIFAR dataset. The version implemented here defers from the one in the paper in several ways:

  • The version here uses SEAL 3.2 whereas the paper version uses SEAL 2.3
  • The network here is slightly different. It has better accuracy of 76.31% and runs at ~750 seconds on an Azure VM B8ms

To run, issue the command .\CifarCryptoNets.exe with the following parameters:

-v, --verbose (Default: false) Set output to verbose messages. In the verbose mode more information is presented

-e, --encrypt (Default: false) Use encryption. In encrypted mode the network operates on encrypted data, otherwise it operates on plain data

For example, the command .\CifarCryptoNets -e will generate the following output:

Generating encryption keys 8/27/2019 7:10:24 AM
Encryption keys ready 8/27/2019 7:10:31 AM
Preparing
errs 0/1 accuracy 100.000% prediction 3 label 3 Inference-Time 745962.92ms
errs 0/2 accuracy 100.000% prediction 8 label 8 Inference-Time 747487.20ms
errs 0/3 accuracy 100.000% prediction 8 label 8 Inference-Time 748396.12ms
errs 0/4 accuracy 100.000% prediction 0 label 0 Inference-Time 749291.59ms
errs 0/5 accuracy 100.000% prediction 6 label 6 Inference-Time 749788.54ms
errs 0/6 accuracy 100.000% prediction 6 label 6 Inference-Time 752015.41ms
errs 0/7 accuracy 100.000% prediction 1 label 1 Inference-Time 752773.61ms
errs 0/8 accuracy 100.000% prediction 6 label 6 Inference-Time 753000.47ms
errs 0/9 accuracy 100.000% prediction 3 label 3 Inference-Time 753793.26ms
errs 0/10 accuracy 100.000% prediction 1 label 1 Inference-Time 753874.34ms
errs 0/11 accuracy 100.000% prediction 0 label 0 Inference-Time 754014.56ms
errs 0/12 accuracy 100.000% prediction 9 label 9 Inference-Time 754126.20ms
errs 1/13 accuracy 92.308% prediction 3 label 5 Inference-Time 754119.69ms
errs 1/14 accuracy 92.857% prediction 7 label 7 Inference-Time 754221.25ms
errs 1/15 accuracy 93.333% prediction 9 label 9 Inference-Time 754241.65ms
errs 1/16 accuracy 93.750% prediction 8 label 8 Inference-Time 754196.86ms
errs 1/17 accuracy 94.118% prediction 5 label 5 Inference-Time 754118.79ms
errs 1/18 accuracy 94.444% prediction 7 label 7 Inference-Time 754142.30ms
errs 1/19 accuracy 94.737% prediction 8 label 8 Inference-Time 754125.49ms
errs 1/20 accuracy 95.000% prediction 6 label 6 Inference-Time 754131.44ms

Caltech101

This project implements LoLa on the CalTech-101 dataset. Note that the paper uses SEAL 2.3 while here we use SEAL 3.2, so the expected performance is slightly better. To run, issue the command .\Caltech101.exe. The expected output is:

Time for Prediction+Encryption: 234.295
errs 0/1 accuracy 100.000%  prediction 39 label 39
Time for Prediction+Encryption: 187.465
errs 0/2 accuracy 100.000%  prediction 39 label 39
Time for Prediction+Encryption: 156.2081
errs 0/3 accuracy 100.000%  prediction 39 label 39
Time for Prediction+Encryption: 171.8693
errs 0/4 accuracy 100.000%  prediction 39 label 39
Time for Prediction+Encryption: 171.842
errs 0/5 accuracy 100.000%  prediction 39 label 39
Time for Prediction+Encryption: 171.8315
errs 0/6 accuracy 100.000%  prediction 39 label 39
Time for Prediction+Encryption: 156.2133
errs 0/7 accuracy 100.000%  prediction 39 label 39
Time for Prediction+Encryption: 156.2414
errs 0/8 accuracy 100.000%  prediction 39 label 39
Time for Prediction+Encryption: 156.2196
errs 0/9 accuracy 100.000%  prediction 39 label 39
Time for Prediction+Encryption: 156.2462
errs 0/10 accuracy 100.000%  prediction 39 label 39
...

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

cryptonets's People

Contributors

dependabot[bot] avatar kimlaine avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar msftgits avatar rang-microsoft avatar ranigb 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  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

Watchers

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

cryptonets's Issues

Running on other datasets

Hello,
So ,we know that the CryptoNets project is trained with MNIST dataset and works on currently 3 different datasets namely MNIST, CIFAR-10 and CALTECH-101.
My question is , can it run on any other datasets?. I am having my own dataset and want to train the CrytoNets model with it and run the model. So, is there any way to do it ? Thank you

Running the application using CKKS scheme other than BFV

Hello,

I had a confusion regarding the 'Selecting the encryption parameters' section. Is the code given in this section for 'BFV scheme' only or we can use it for 'CKKS scheme' as well? If it is for 'CKKS scheme' too, will changing the line var Factory = new RawFactory((ulong)batchSize); // we start without using encryption to var Factory = new EncryptedSealCkksFactory(new ulong[] { 957181001729, 957181034497 }, 16384); help in this case ?

Another thing is that the accuracy for running 'CIFAR-10' dataset with encryption is 76.318 % whilst if i run the cnn model for the dataset that i've jst built is 78.12 %. Can you please explain the reason for it ?

Thank you

Issue with building

Hello, I am using SEAL 3.2.2 and running into some issues. This is what I encountered when trying to compile Cryptonets for the first time. I have installed all the packages that were originally missing but I'm not sure whether the repo is missing some dll files. Any help would be appreciated!

seal

Unable to Datapreprocess CAL dataset

I have executed DataPreprocess.exe for CAL dataset as you said to prepare CAL dataset for LoLa.

(Cryptonet root directory)\bin\x64\Release> .\DataPreprocess.exe CAL 

Then I yielded System.IndexOutOfRangeException.

Unhandled Exception: System.IndexOutOfRangeException: Index out of array range.
   위치: DataPreprocess.GetCAL.Run(String[] args) 파일 C:\Users\ohsai\Desktop\Workspace\CryptoNets\DataPreprocess\GetCAL.cs:줄 0
   위치: DataPreprocess.DataPreprocess.Main(String[] args) 파일 C:\Users\ohsai\Desktop\Workspace\CryptoNets\DataPreprocess\DataPreprocess.cs:줄 18

So I thought additional arguments for the program were necessary, so I looked at the GetCAL.cs to find out that second argument should be .tsv file and third argument should be the folder which contains all the images of Caltech-101 dataset.

So I have downloaded Caltech-101 image dataset and placed it in (Cryptonet root directory)\bin\x64\Release folder as a folder name of "CALObjectCategories",

(Cryptonet root directory)\bin\x64\Release> ls .\CALObjectCategories\

    디렉터리: 
(Cryptonet root directory)\bin\x64\Release\CALObjectCategories


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----     2019-08-07   오전 5:31                accordion
d-----     2019-08-07   오전 5:31                airplanes
.
.
.

and executed following command.

(Cryptonet root directory)\bin\x64\Release>.\DataPreprocess.exe CAL ".\cal_train.tsv" ".\CALObjectCategories\"

But It failed to process all the images, printing

failure on line ant/image_0013.jpg	4

faliure message for all the files.

So I tried to find out what caused the exception, and printed stacktrace for all try catch syntaxes on GetCAL.cs file.

Then only this exception stack trace was printed.

 location: Microsoft.ML.Transforms.OnnxTransformer..ctor(IHostEnvironment env, Options options, Byte[] modelBytes)
   location: Microsoft.ML.Transforms.AlexNetExtension.AlexNet(DnnImageModelSelector dnnModelContext, IHostEnvironment env, String outputColumnName, String inputColumnName, String modelDir)
   location: Microsoft.ML.Transforms.AlexNetExtension.AlexNet(DnnImageModelSelector dnnModelContext, IHostEnvironment env, String outputColumnName, String inputColumnName)
  location: Microsoft.ML.Transforms.DnnImageFeaturizerEstimator..ctor(IHostEnvironment env, String outputColumnName, Func`2 modelFactory, String inputColumnName)
   location: DataPreprocess.GetCAL._Run(String imagesCatalog, String imagesFolder) 파일 C:\Users\ohsai\Desktop\Workspace\CryptoNets\DataPreprocess\GetCAL.cs:line 93
   location: DataPreprocess.GetCAL._Run_failover(String line, String imagesFolder) 파일 C:\Users\ohsai\Desktop\Workspace\CryptoNets\DataPreprocess\GetCAL.cs:line58

So, my question is,

  1. Is this the right way to fetch and preprocess CAL dataset? You said to fetch CAL dataset first by following the instruction after the first .\DataPreprocess.exe CAL, but it did not gave the instruction at all.
  2. If it is, how should I deal with this error? From the exception stacktrace, I think the error comes from Microsoft.ML.Transforms module.

CifarCryptoNet Data Processing

I have followed all instructions in README.md to process cifar-10-batches-bin data set. I am able to get the print result as README.md shows. However, there is no operation is seen when I run the program on the Debug version instead of the Release version.

To be sure, I put some fprintf functions to print the multiplication parameters in evaluater.cpp before creating the SEAL package. After that, I noticed the text file, produced for fprintf, exists when I run NeuralNetworksTest and HE Wrapper Tests with Visual Studio. Nevertheless, I cannot see the text file when I follow the DataPreprocess.exe and .\CifarCryptoNets.exe -v commands. Also, results are always the same given by:

Destructor 0
Encryption 0
Plain 0
Decryption 0
Multiplication 0
PlainMultiplication 0
Addition 0
Dispose 0
PlainAddition 0
Subtraction 0
PlainSubtraction 0
Rotation 0
AddMany 0
AddManyItemCount 0
Relinarization 0

These are some output from Release mode:

errs 33/160 accuracy 79.375% prediction 4 label 4 Inference-Time 43.87ms 2^76.939503250388 largest-value
errs 33/161 accuracy 79.503% prediction 2 label 2 Inference-Time 43.86ms 2^76.939503250388 largest-value
errs 33/162 accuracy 79.630% prediction 1 label 1 Inference-Time 44.22ms 2^76.939503250388 largest-value
errs 33/163 accuracy 79.755% prediction 6 label 6 Inference-Time 44.22ms 2^76.939503250388 largest-value
errs 33/164 accuracy 79.878% prediction 6 label 6 Inference-Time 44.22ms 2^76.939503250388 largest-value
errs 34/165 accuracy 79.394% prediction 0 label 8 Inference-Time 44.22ms 2^76.939503250388 largest-value
errs 34/166 accuracy 79.518% prediction 4 label 4 Inference-Time 44.22ms 2^76.939503250388 largest-value

Thanks,

'error budget is zero' exception & noise budget reduction in different encryption parameters

Dear authors,

Thanks very much for your released codes. Could I ask you two questions as follows?

  1. I met the 'error budget is zero' exception in running CryptoNets codes.

  2. Could you help me with how to use CryptoTracker in your codes to track one operation's noise budget reduction? My target is to know the noise budget reduction for each operation under different degrees N and the number of plaintext modulus. Could you kindly give me any ideas on how to implement my target?

Thanks in advance for your response.

[Help Wanted] Is CifarCryptoNets Functional? Low Accuracy with Small Test

I was able to reproduce the output provided for CifarCryptoNets. I believe they are the prediction values for the 10 categories in Cifar-10 and that the max value is the prediction.

I tested the model separately with the full Cifar-10 dataset and with 1 test image from the dataset and produced the same output which, I believe, is because the code doesn't loop through the network with the GetNext() method like the other provided models.

After iterating through 10 test images and took the max value as the prediction as displayed below, I noticed that the accuracy based on my approach is roughly around 10% instead of the higher accuracy expected of LoLaCryptoNet.

Is the CifarCryptoNet fully functional? Please advise.

# Prediction output for the first 10 images of the Cifar-10 dataset. 
0: -14.9947
1: -13.1457
2: 12.7913
3: 8.6813
4: 12.8255
5: -3.2621
6: 0.7135
7: 4.8243
8: -14.3768
9: -7.1885
Prediction 4 Label 3
0: -8.2010
1: -3.6772
2: 0.1281
3: 10.1785
4: -10.3159
5: -13.5987
6: -7.4372
7: -14.5098
8: -15.4177
9: -5.1588
Prediction 3 Label 8
0: 4.5273
1: 11.4319
2: -8.0989
3: 11.5048
4: -12.1562
5: 14.9259
6: 15.8742
7: -4.1455
8: 9.8287
9: 10.6513
Prediction 6 Label 8
0: 14.2459
1: -11.5474
2: 8.2095
3: -13.5229
4: -7.3236
5: 4.1504
6: -14.8993
7: -12.6799
8: -9.5187
9: -11.7253
Prediction 0 Label 0
0: -2.7235
1: -7.0029
2: 13.5247
3: -13.9630
4: 15.9141
5: 6.9853
6: -13.9143
7: -7.6527
8: -0.7338
9: 10.5105
Prediction 4 Label 6
0: 4.4299
1: -5.5504
2: -8.3946
3: 2.4063
4: 6.1031
5: -10.7999
6: -9.1229
7: 3.5830
8: -5.5245
9: -5.6314
Prediction 4 Label 6
0: -14.3356
1: 4.2231
2: 15.7832
3: 5.4311
4: 3.8572
5: 5.8699
6: -13.2955
7: -11.3057
8: 8.0676
9: -2.4369
Prediction 2 Label 1
0: 11.9822
1: 5.2481
2: -12.5903
3: 5.4623
4: 2.8625
5: 8.3463
6: -3.1007
7: 0.5379
8: -11.2521
9: -8.9174
Prediction 0 Label 6
0: 13.6397
1: -14.8832
2: -9.6858
3: 5.0069
4: -7.6892
5: 2.1170
6: 4.9055
7: 9.6919
8: -4.4410
9: 2.3507
Prediction 0 Label 3
0: 0.9694
1: -13.4114
2: -3.8784
3: -8.0430
4: 3.8281
5: -2.8454
6: 13.5963
7: 2.3001
8: 0.8784
9: -1.7873
Prediction 6 Label 1
Accuracy: 1/10

how to add an encrypted PNG image to the code ?

I want to do DL to an encrypted PNG image, I followed the ReadMe. File but I found a problem starting from prepressing data.
how can I add the image to be processed by the code ?
from which file should I start and where to put the image ?

I world be grateful if anyone can help ..
its important to complete my project
thank you

Project not working with SEAL version 3.3.1

The whole project is designed for SEAL 3.2.0. But SEAL library has been recently updated to 3.3.1/3.3.2 either of the 2 version( when i downloaded and installed SEAL from github, NuGet package of SEAL 3.3.1 was created). After following the instructions , i was only able to preprocess the data after building the project since after compiling the project , only DataPreprocess.exe is available (not CrytoNets.exe , BasicExample.exe, Caltech101.exe etc).Also, some dll files were missing.Prior to building it, i had added the Nuget package of SEAL 3.3.1 reference to the project .I had changed the version of the 'HE Wrapper and 'HE Wrapper Tests' to 3.3.1 from 3.2.0 in their 'packages.config' files to see if it helps but it didn't . Can sth
be done regarding this or can i somehow get the SEAL version 3.2.0 to run this project ? Thanks in advance.Below is the pic of whats happening currently
w1
w2
e1
e2
HE wrapper tests
HE wrapper

the scaled mean pool layer of cryptonets

From the description of the cryptonets, we find the input of layer 3 is 5 * 13 * 13,and the output of the layer 3 is also 5 * 13 * 13. But the windows is 1 * 3 * 3, and ther is no padding and stride declaration. why the output of layer 3 is 5 * 13 * 13? why the output of pool layer won`t be smaller?
image

Cryptonet MNIST training script

Hello,
I am trying to train the model from the original cryptonet paper and I am facing issues in even making the model in keras. For example: For the first 3 layers:
model = Sequential()
model.add(Conv2D(filters=5, kernel_size=(5, 5),strides=(2,2),input_shape=(28,28,1), padding = 'same'))
model.add(Activation(square))
model.add(AveragePooling2D(pool_size=(2,2)))

And the output shape:


Layer (type) Output Shape Param #

conv2d_8 (Conv2D) (None, 14, 14, 5) 130


activation_13 (Activation) (None, 14, 14, 5) 0


average_pooling2d_7 (Average (None, 7, 7, 5) 0


Which does not match the paper. Also could you please tell me the optimizer you used? Because I am always getting 'nan' loss when I have a square activation layer involved

Is there any example of training code with mnist data?

Sorry for this simple question. I resently know about neural networks and then find your great project. Unfortunately, i'm a newcomer to this area and i have a duty to create my own cryptonet with my datasets which are 128*128 grayscale images. So i think maybe an example of training code with mnist data can be helpful. If you have the code, could you please share to me? Thank you very much!

How to create 'test.txt' ?

Sorry to bother you but I want to know how to create the 'test.txt' in the code of chapter 'creating the application' in wiki pages. Since I just got in touch with this project and deep learning, maybe my question is very simple. Please don't mind and thank you for your patience and contributions.

Question about input image padding

The original CryptoNets paper mentions that padding is applied to the input image for the first network layer. The paper describes this padding as occurring in the upper and left parts of the image. However, it seems like this library adds padding to the lower and right sides instead (even though the padding is set in a field called 'Upperpadding').

Could you please confirm that I am correct in my understanding? I am wondering if I am missing something or if this is just a mistake in the library.

Hello,I meet a problem when I installed the CryptoNets!

Hello, when I installed the CryptoNets I meet an error that error CS0234 The type or namespace name 'research' does not exist in namespace 'Microsoft' (missing assembly reference?) HE Wrapper, and I can't solve this problem.

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.