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_jpeg("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.
  • [io] Implement image encoding and explore video.
  • [viz] Fix minor issues and implement a full VizManager to work on the browser.
  • [dlpack] implement DLPack to cv::Tensor.
  • [dlpack] implement test for numpy, jax and mxnet.
  • [tensor] implement basic functionality to test: add, sub, mul, etc.
  • [tensor] explore xnnpack and openvino integration.
  • [kornia] integrate with the new Image API

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
  1. 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
  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

If you're not sure about the file name format, learn more about wheel file names.

kornia_rs-0.0.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64manylinux: glibc 2.5+ x86-64

kornia_rs-0.0.2-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ x86-64manylinux: glibc 2.5+ x86-64

kornia_rs-0.0.2-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.12+ x86-64manylinux: glibc 2.5+ x86-64

File details

Details for the file kornia_rs-0.0.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for kornia_rs-0.0.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 df1d0f2909927ba170597d33243f48c00dfae83659d11240c4576d47877209e5
MD5 bb9b537f54cf79e86578ae2d6ab331fa
BLAKE2b-256 24778d16dfbf3e04ede360b3fad2ef8a0ceda446faff86e1c0971b4b2df4630b

See more details on using hashes here.

File details

Details for the file kornia_rs-0.0.2-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for kornia_rs-0.0.2-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a9636ca8b44ce16f3b4598ef1f9ebd2748097dfc3c8e8aae6620985277b1e815
MD5 77572b6048ef1f1c7f89fe76ec4fb6d1
BLAKE2b-256 3e78bc6b4e0f73bd94e0d62cd9451e8b975b30fbaeef3ac4e590cf9a0992198c

See more details on using hashes here.

File details

Details for the file kornia_rs-0.0.2-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for kornia_rs-0.0.2-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 66236ae49a92b8ccbb00a8c0fb0cab4d498c851f29ec69aa72712ca6bbe77101
MD5 e49ff6bd3b4ee32b6bf253ca6ec830f5
BLAKE2b-256 d7ec0aef0f6abd7714d5669063fc226667deb046095df1a711e3a7a469896f56

See more details on using hashes here.

Supported by

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