Practical overview
When it fits
Use it when you have the required NeuralHash model files and want to convert them for an ONNX-based local workflow or calculate hashes with the repository’s demo script.
Who it is for
- Developers and researchers who need to convert NeuralHash model files into ONNX.
- People building local image perceptual-hashing workflows that can use the converted model.
Documented uses
- Convert NeuralHash model artifacts into an ONNX model.
- Preprocess an image and calculate its NeuralHash using the included script and ONNX Runtime.
- Inspect the converted model with Netron.
Requirements & limits
- Conversion requires four model files, an LZFSE decoder, and Python 3.6 or later with
onnxandcoremltools. - The README describes macOS and Linux; obtaining files through an IPSW requires extra system-image extraction steps.
- Hash calculation uses
onnxruntime,pillow, the converted model, the seed file and an image. - The project warns that hash outputs may differ by a few bits across hardware.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Convert NeuralHash model files to ONNX
Prepare the NeuralHash model files and convert them into an ONNX model.
Before you start
- macOS or Linux
- Python 3.6 or later
- LZFSE decoder; on macOS, the README specifies
brew install lzfse; on Linux, build and install from the LZFSE source - The Python packages
onnxandcoremltools - Four model files:
neuralhash_128x96_seed1.dat,NeuralHashv3b-current.espresso.net,NeuralHashv3b-current.espresso.shapeandNeuralHashv3b-current.espresso.weights
Steps
Obtain the four model files from the documented Vision.framework location on a recent macOS or jailbroken iOS installation, or use the documented iOS IPSW route.
Decode the
.espresso.netand.espresso.shapefiles with the LZFSE decoder and copy the weights file asmodel.espresso.weights.Clone the TNN repository and run its
coreml2onnx.pyconversion script on the NeuralHash directory.
Expected outcome
The README identifies the resulting model as `NeuralHash/model.onnx`.
Guide limitations
- The IPSW route includes additional unpacking and system-image access steps; Linux instructions include building and installing apfs-fuse.
- This guide covers model conversion, not a particular deployment or inference runtime.
Calculate an image hash with the converted model
Run the included `nnhash.py` script on an image using the converted model.
Before you start
- A converted
model.onnxfile - The
neuralhash_128x96_seed1.datfile - The Python packages
onnxruntimeandpillow - An image file
Steps
Install
onnxruntimeandpillowwith the command below.pip install onnxruntime pillowRun the command below.
python3 nnhash.py /path/to/model.onnx /path/to/neuralhash_128x96_seed1.dat image.jpg
Expected outcome
The script prints a NeuralHash value represented as 96-bit binary data.
Guide limitations
- The README warns that results can differ by a few bits across hardware because floating-point calculations accumulate differences in the 200-plus-layer network.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 3 November 2026
- Original website title
- AsuharietYgvar/AppleNeuralHash2ONNX · Official homepage title · retained in its source language

