AsuharietYgvar / AppleNeuralHash2ONNX

Convert Apple NeuralHash model for CSAM Detection to ONNX.
Apache License 2.0
1.53k stars 131 forks source link

NeuralHash classifier #7

Open kjsman opened 3 years ago

kjsman commented 3 years ago

I tried to build a classifier for NeuralHash: It gets NeuralHash as input and outputs class and probability.

I hashed all images of ILSVRC2012 dataset and trained the simple NN model.

Performance on the ImageNet validation dataset: (1,000 possible choices)

So... It seems that NeuralHash can't anonymize images well.

You can try this in Colab.

willard-yuan commented 3 years ago

@kjsman I think you should use the outs[0].flatten() as input, and NeuralHash is an embedding network which put out the outs[0].flatten() of 128 dimension. The seed.dot(outs[0].flatten()) is the Local Sensitive Hashing Process, and the seed is the projection matrix of LSH.

kjsman commented 3 years ago

@willard-yuan The goal of this project is to prove that NeuralHash cannot guarentee anonymity of image, so I used final form(including LSH) of NeuralHash because that is what Apple accesses.

dxoigmn commented 3 years ago

This is a nice datapoint. What was the simple NN model you used? I'm wondering if we could learn something about which bits of the hash are biased.