ONNX_models / README.md
shijianjian
update
0a9eb59
|
raw
history blame
2.36 kB
metadata
language:
  - en
tags:
  - kornia
  - onnx

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.

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.color.gray.RgbToGrayscale",
    "hf://operators/kornia.geometry.transform.affwarp.Resize_512x512",
    "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.