kornia-rs: Low level implementations for Computer Vision in Rust.
This project provides low level functionality for Computer Vision written in Rust to be consumed by machine learning and data-science frameworks, specially those working with images. We mainly aim to provide I/O functionality for images (future: video, cameras), and visualisation in future.
- The library is written in Rust.
- Python bindings are created with PyO3/Maturin.
- We package with support for Linux [amd64/arm64], Macos and WIndows.
- Supported Python versions are 3.7/3.8/3.9/3.10/3.11
Installation
From pip:
From source:
Basic Usage
Load an image, that is converted to cv::Tensor wich is a centric structure to the DLPack protocol to share tensor data across frameworks with a zero-copy cost.
# load an image with Rust `image-rs` as backend library
: =
assert ==
# convert to dlpack to import to torch
=
assert ==
assert ==
# or to numpy with same interface
=
Advanced usage
Encode or decoda image streams using the turbojpeg backend
# load image using turbojpeg
=
: = # HxWx3
# encode the image with jpeg
=
# set the encoding quality
# get the encoded stream
: =
# write to disk the encoded stream
# decode back the image
=
=
: = # HxWx3
TODO: short/mid-terrm
- [infra] Automate packaging for manywheels.
- [kornia] integrate with the new
ImageAPI - [dlpack] move dlpack implementation to dlpack-rs.
- [dlpack] implement test for torch and numpy.
- [dlpack] update dlpack version >=0.8
- [dlpack] implement
DLPacktocv::Tensor.
TODO: not priority for now
- [io] Implement image encoding and explore video.
- [viz] Fix minor issues and implement a full
VizManagerto work on the browser. - [tensor] implement basic functionality to test: add, sub, mul, etc.
- [tensor] explore xnnpack and openvino integration.
Development
To test the project in lyour local machine use the following instructions:
- Clone the repository in your local directory
2.1 (optional) Build the devel.Dockerfile
Let's prepare the development environment with Docker. Make sure you have docker in your system: https://docs.docker.com/engine/install/ubuntu/
&&
KORNIA_RS_DEVEL_IMAGE="kornia_rs/devel:local"
2.2 Enter to the devel docker container.
- Build the project
(you should now be inside the docker container)
# maturin needs you to be a `venv`
# build and generate linked wheels
- Run the tests
Contributing
This is a child project of Kornia. Join the community to get in touch with us, or just sponsor the project: https://opencollective.com/kornia