Giter Club home page Giter Club logo

cryptflow-demo's Introduction

cryptflow-demo

Step 0. Requirements

Setup ezpc repo by following instructions from here. Load the environment and install additional required packages:

source path/to/EzPC/mpc_venv/bin/activate
pip install mscviplib Pillow

Step 2. Compile graph.

python path/to/EzPC/Athos/CompileTFGraph.py --config config.json --role server

Step 3. Compile for client (we can skip if testing on the same machine)

python path/to/EzPC/Athos/CompileTFGraph.py --config config.json --role client

Step 4. Preprocess xray.

python pre_process.py covid19positive.jpeg

This dumps input image as a numpy array (xray.npy)

Step 5. Scale input image.

python path/to/EzPC/Athos/CompilerScripts/convert_np_to_fixedpt.py --inp xray.npy --config config.json

This dumps xray_fixedpt_scale_12.inp.

Step 6. Run computation.

Server on one machine:

./model_SCI_OT.out r=1 p=12345 < model_input_weights_fixedpt_scale_12.inp

Client on another machine:

./model_SCI_OT.out r=2 ip=123.231.231.123 p=12345 < xray_fixedpt_scale_12.inp > output.txt

You can change ip to 127.0.0.1 if both run on the same machine. (Will take around ~30 mins to run with a peak memory usage of ~8GB)

Step 7. Extract output as numpy array

python path/to/EzPC/Athos/CompilerScripts/get_output.py output.txt config.json

Dumps model_output.npy as a flattened numpy array(1-D).

Step 8. Verify Results

Run input graph with tensorflow.

python run_tf.py xray.npy

Dumps output in tensorflow_output.npy. Compare with output generated in 2PC computation:

python path/to/EzPC/Athos/CompilerScripts/comparison_scripts/compare_np_arrs.py tensorflow_output.npy model_output.npy

We get output as

Arrays matched upto 1 decimal points

cryptflow-demo's People

Contributors

bhatuzdaname avatar bhatuzdanamemsr 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.