- Use https://github.com/AsuharietYgvar/AppleNeuralHash2ONNX to obtain the model and convert it to onnx.
- Use
onnx_tf
to convert the onnx model to tensorflow and save it inmodel.pb
. - Run the script. It will start off making lots of progress and then slowly approach a loss of -1. If you don't succeed, try raising the
eps
value in the script and play around witheps_step
to control the noisyness. - Confirm using
nnhash.py
from https://github.com/AsuharietYgvar/AppleNeuralHash2ONNX.
Note: The final output might have a slightly different hash due to quantization and clipping. Just try again until you find an exact match.
Images from wikipedia
Concurrent work: https://github.com/anishathalye/neural-hash-collider More concurrent work: https://github.com/greentfrapp/apple-neuralhash-attack
Pull requests to improve this repo welcome.