Skip to main content

Low level implementations for computer vision in Rust

Project description

kornia-rs: Low level implementations for Computer Vision in Rust.

(🚨 Warning: Unstable Prototype 🚨)

Continuous integration PyPI version License Slack

The expectation of this project is to provide low level functionality for Computer Vision written in Rust to be consumed by deep learning frameworks, specially those working with images. We mainly provide I/O for images (future: video, cameras) and visualisation.

The library is written in Rust and wrapped to Python (potentially later to C/C++) using PyO3/Maturin. The library can also be used as a standalone Rust crate.

Basic Usage

Load an image, that is converted to cv::Tensor wich is designed centric to the DLPack protocol to share tensor data across deep learning frameworks with a zero-copy cost.

The visualisation API is based on vviz: https://github.com/strasdat/vviz

    import kornia_rs as K
    from kornia_rs import Tensor as cvTensor

    cv_tensor: cvTensor = K.read_image_rs("dog.jpeg")
    assert cv_tensor.shape == [195, 258, 3]

    # convert to dlpack to import to torch and numpy
    # NOTE: later we will support to jax and mxnet.
    th_tensor = torch.utils.dlpack.from_dlpack(cv_tensor)
    np_tensor = np.from_dlpack(cv_tensor)
    assert th_tensor.shape == (195, 258, 3)
    assert np_tensor.shape == (195, 258, 3)

TODO

  • [infra] Automate packaging for manywheels.
  • [kornia] integrate with the new Image API
  • [dlpack] move dlpack implementation to dlpack-rs.
  • [dlpack] implement test for numpy, jax and mxnet.
  • [dlpack] implement DLPack to cv::Tensor.
  • [io] Implement image encoding and explore video.
  • [viz] Fix minor issues and implement a full VizManager to 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:

  1. Clone the repository in your local directory
git clone https://github.com/kornia/kornia-rs.git

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/

cd ./docker && ./build_devel.sh
KORNIA_RS_DEVEL_IMAGE="kornia_rs/devel:local" ./devel.sh

2.2 Enter to the devel docker container.

./devel.sh
  1. Build the project

(you should now be inside the docker container)

# maturin needs you to be a `venv`
python3 -m venv .venv
source .venv/bin/activate

# build and generate linked wheels
maturin develop --extras dev
  1. Run the tests
pytest test/

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

kornia_rs-0.0.6-cp311-none-win_amd64.whl (981.4 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

kornia_rs-0.0.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

kornia_rs-0.0.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.1 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

kornia_rs-0.0.6-cp311-cp311-macosx_10_7_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.11 macOS 10.7+ x86-64

kornia_rs-0.0.6-cp310-none-win_amd64.whl (981.4 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

kornia_rs-0.0.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

kornia_rs-0.0.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.1 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

kornia_rs-0.0.6-cp310-cp310-macosx_10_7_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.10 macOS 10.7+ x86-64

kornia_rs-0.0.6-cp39-none-win_amd64.whl (981.7 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

kornia_rs-0.0.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

kornia_rs-0.0.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.1 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

kornia_rs-0.0.6-cp39-cp39-macosx_10_7_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.9 macOS 10.7+ x86-64

kornia_rs-0.0.6-cp38-none-win_amd64.whl (981.8 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

kornia_rs-0.0.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

kornia_rs-0.0.6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.1 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

kornia_rs-0.0.6-cp38-cp38-macosx_10_7_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.8 macOS 10.7+ x86-64

kornia_rs-0.0.6-cp37-none-win_amd64.whl (981.7 kB view hashes)

Uploaded CPython 3.7 Windows x86-64

kornia_rs-0.0.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

kornia_rs-0.0.6-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.1 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ARM64

kornia_rs-0.0.6-cp37-cp37m-macosx_10_7_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.7m macOS 10.7+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page