-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thermometer Encoding #17
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job. We can merge it as it is, but in general I feel like we should make the image as an Instance Column so that we would known on which image we actually got the result
wnn_chip.load(&mut layouter)?; | ||
|
||
let result = wnn_chip.predict(layouter.namespace(|| "wnn"), self.inputs.clone())?; | ||
let result = wnn_chip.predict(layouter.namespace(|| "wnn"), &self.image)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the image be as a public input in Advice
? As now we are proving that some image was converted into a valid representation
Thanks for the review! I think both use cases are valid, with public and private input. For private input, you'd probably want to additionally validate the image in the circuit (e.g. by checking the signature of an attested sensor). So then, you'd use this codebase as a library. I think we should support both and opened #21 to track it. |
Depends on #20
This PR adds two gadgets:
GreaterThanChip
: Computesx > y
EncodeImageChip
: Maps an image to a binary vector by comparing each pixel to multiple binarization thresholdsThe
WnnChip
then wires everything together and now proves the entire prediction, starting from the intensity values of the image! 🎉 The most involved part here was writing a test which asserts the right outputs all the way from the pixel values.Other Changes:
HashChip
no longer needs to range-check its inputs, because they are now comping from theBits2NumChip
, which guarantees that they can be represented by a certain number of bits.These are the benchmark results (including the changes from #20):
Fixes #6