Coder Social home page Coder Social logo

zkcnn's Introduction

zkCNN

Introduction

This is the implementation of this paper, which is a GKR-based zero-knowledge proof for CNN reference, containing some common CNN models such as LeNet5, vgg11 and vgg16.

Requirement

  • C++14
  • cmake >= 3.10
  • GMP library

Input Format

The input has two part which are data and weight in the matrix.

Data Part

This part is the picture data, a vector reshaped from its original matrix by

formula1

where formula2 is the number of channel, formula3 is the height, formula4 is the width.

Weight Part

This part is the set of parameters in the neural network, which contains

  • convolution kernel of size formula10

    where formula11 and formula12 are the number of output and input channels, formula13 is the sideness of the kernel (here we only support square kernel).

  • convolution bias of size formula16.

  • fully-connected kernel of size formula14.

  • fully-connected bias of size formula15.

Experiment Script

Clone the repo

To run the code, make sure you clone with

git clone --recurse-submodules [email protected]:TAMUCrypto/zkCNN.git

since the polynomial commitment is included as a submodule.

Run a demo of LeNet5

The script to run LeNet5 model (please run the script in script/ directory).

./demo_lenet.sh
  • The input data is in data/lenet5.mnist.relu.max/.
  • The experiment evaluation is output/single/demo-result-lenet5.txt.
  • The inference result is output/single/lenet5.mnist.relu.max-1-infer.csv.

Run a demo of vgg11

The script to run vgg11 model (please run the script in script/ directory).

./demo_vgg.sh
  • The input data is in data/vgg11/.
  • The experiment evaluation is output/single/demo-result.txt.
  • The inference result is output/single/vgg11.cifar.relu-1-infer.csv.

Polynomial Commitment

Here we implement a hyrax polynomial commitment based on BLS12-381 elliptic curve. It is a submodule and someone who is interested can refer to this repo hyrax-bls12-381.

Reference

zkcnn's People

Contributors

dreamatd 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.