Skip to content

The inference of DINOv2 ONNX models using the ONNXRuntime library.

License

Notifications You must be signed in to change notification settings

sefaburakokcu/dinov2_onnx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DINOv2 ONNX Inference

This repository contains a Python script (onnx_inference.py) for extracting and comparing image features using the DINOv2 model in ONNX format. The script uses the onnxruntime library to load and run the model.

Dependencies

Models

Models can be obtained by exporting PyTorch models to ONNX models. To export models to ONNX, you can utilize the onnx_export_merge branch.

In addition, you can download pre-exported models from:

Google Drive

Hugging Face

Usage

  1. Clone the repository:

    git clone git@github.com:sefaburakokcu/dinov2_onnx.git
    cd dinov2_onnx
  2. Install the required Python dependencies:

    pip install -r requirements.txt

    Make sure you have Python and pip installed.

  3. Place your input images in the inputs directory.

  4. Run the inference script:

    python onnx_inference.py

    Optional arguments:

    • --onnx_model: Path to the ONNX model file (default: ./dinov2_vits14.onnx).
    • --image_folder: Path to the folder containing input images (default: ./inputs/).

License

This project is licensed under the MIT License.

Releases

No releases published

Packages

No packages published

Languages