Kornia is a differentiable computer vision library for PyTorch.

It consists of a set of routines and differentiable modules to solve generic computer vision problems. At its core, the package uses PyTorch as its main backend both for efficiency and to take advantage of the reverse-mode auto-differentiation to define and compute the gradient of complex functions.

Inspired by OpenCV, this library is composed by a subset of packages containing operators that can be inserted within neural networks to train models to perform image transformations, epipolar geometry, depth estimation, and low-level image processing such as filtering and edge detection that operate directly on tensors.


From pip:

    pip install kornia

From source:

    python setup.py install

From source using pip:

    pip install git+https://github.com/arraiyopensource/kornia

Quick Usage

 import torch
 import kornia

 x_rad = kornia.pi * torch.rand(1, 3, 3)
 x_deg = kornia.rad2deg(x_rad)

 torch.allclose(x_rad, kornia.deg2rad(x_deg))  # True


Run our Jupyter notebooks examples <https://github.com/arraiyopensource/kornia/tree/master/examples/>_ to learn to use the library.


If you are using kornia in your research-related documents, it is recommended that you cite the poster.

  author    = {E. Riba, M. Fathollahi, W. Chaney, E. Rublee and G. Bradski}
  title     = {torchgeometry: when PyTorch meets geometry},
  booktitle = {PyTorch Developer Conference},
  year      = {2018},
  url       = {https://drive.google.com/file/d/1xiao1Xj9WzjJ08YY_nYwsthE-wxfyfhG/view?usp=sharing}