OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Models

Appleneuralhash2Onnx

Appleneuralhash2Onnx is a Python repository that converts Apple NeuralHash, a neural-network-based image perceptual-hashing model, into ONNX format and includes a script for calculating image hashes.

Independent OpenViST project profile, based on linked sources.

Appleneuralhash2Onnx — Model conversion from NeuralHash artifacts to ONNX
OpenViST project illustration. See the linked sources for product details.
Understand the project

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.
Before you choose

Requirements & limits

  • Conversion requires four model files, an LZFSE decoder, and Python 3.6 or later with onnx and coremltools.
  • 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.

Source-based practical guide

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 onnx and coremltools
  • Four model files: neuralhash_128x96_seed1.dat, NeuralHashv3b-current.espresso.net, NeuralHashv3b-current.espresso.shape and NeuralHashv3b-current.espresso.weights

Steps

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

  2. Decode the .espresso.net and .espresso.shape files with the LZFSE decoder and copy the weights file as model.espresso.weights.

  3. Clone the TNN repository and run its coreml2onnx.py conversion 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.
Source-based practical guide

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.onnx file
  • The neuralhash_128x96_seed1.dat file
  • The Python packages onnxruntime and pillow
  • An image file

Steps

  1. Install onnxruntime and pillow with the command below.

    Documented command
    pip install onnxruntime pillow
  2. Run the command below.

    Documented command
    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.
Evidence and transparency

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