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.
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
-
Clone the repository:
git clone git@github.com:sefaburakokcu/dinov2_onnx.git cd dinov2_onnx
-
Install the required Python dependencies:
pip install -r requirements.txt
Make sure you have Python and pip installed.
-
Place your input images in the
inputs
directory. -
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/
).
This project is licensed under the MIT License.