AppleNeuralHash2ONNX icon indicating copy to clipboard operation
AppleNeuralHash2ONNX copied to clipboard

NeuralHash classifier

Open kjsman opened this issue 3 years ago • 3 comments

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)

  • Top-1 Accuracy: 5.25% (If random, 0.1% expected)
  • Top-5 Accuracy: 14.09% (If random, 0.5% expected)

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

You can try this in Colab.

kjsman avatar Aug 21 '21 12:08 kjsman

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

willard-yuan avatar Aug 21 '21 17:08 willard-yuan

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

kjsman avatar Aug 21 '21 17:08 kjsman

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.

dxoigmn avatar Aug 23 '21 18:08 dxoigmn