Kornia ONNX Repository

Welcome to the Kornia ONNX Repository! This repository hosts ONNX files for models and operators related to the Kornia computer vision library. Here, you'll find pre-trained models, custom operators, and resources to accelerate your machine learning and computer vision workflows using ONNX format.

Kornia ONNX

Repository Structure

By default, we include ONNX models with dynamic shapes. If the model is exported with a specific input shape, it would be noted in the filename such as XXX_512x512.onnx.

The repository is organized into two main folders:

1. Operators

This folder contains various ONNX operators used within the Kornia library. These operators are designed to be modular and can be integrated into different models or workflows. Each operator comes with a brief description and example usage.

2. Models

This folder contains complete models built with Kornia and exported to ONNX format. These models are designed for various computer vision tasks such as image processing, stereo vision, and more. Each model is accompanied by a detailed description of its purpose and how to use it.

The detection models exported in this repo do not include a postprocessor, you may need to do it yourself or re-export the model by setting confidence_filtering=True. For example, RTDETRDetectorBuilder.to_onnx(confidence_threshold=0.5, confidence_filtering=True).

Getting Started

Install Kornia library:

pip install -U kornia

To chain many operators or models into one graph, follow these steps:

import numpy as np
from kornia.onnx import ONNXSequential
# Chain ONNX models from HuggingFace repo and your own local model together
onnx_seq = ONNXSequential(
    "hf://operators/kornia.geometry.transform.flips.Hflip",
    "hf://models/kornia.models.detection.rtdetr_r18vd_640x640",  # Or you may use "YOUR_OWN_MODEL.onnx"
)
# Prepare some input data
input_data = np.random.randn(1, 3, 384, 512).astype(np.float32)
# Perform inference
outputs = onnx_seq(input_data)
# Print the model outputs
print(outputs)

# Export a new ONNX model that chains up all three models together!
onnx_seq.export("chained_model.onnx")

Contribution

We welcome contributions! If you'd like to add your own ONNX operators or models, feel free to open a pull request. Please ensure that you include relevant documentation and example usage for any new additions.

Thank you for using the Kornia ONNX Repository! Feel free to explore and contribute to the growing collection of operators and models.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference API
Unable to determine this model's library. Check the docs .