Skip to main content

High level interface to create Pytorch Graphs.

Project description

Limbus: Computer Vision pipelining for PyTorch

(🚨 Warning: Unstable Prototype 🚨)

CI

Similar to the eye corneal limbus - Limbus is a framework to create Computer Vision pipelines within the context of Deep Learning and writen in terms of differentiable tensors message passing on top of Kornia and PyTorch.

Overview

You can create pipelines using limbus.Components as follows:

# define your components
c1 = Constant("c1", 1.)
c2 = Constant("c2", torch.ones(1, 3))
add = Adder("add")
show = Printer("print")

# connect the components
c1.outputs.out >> add.inputs.a
c2.outputs.out >> add.inputs.b
add.outputs.out >> show.inputs.inp

# create the pipeline and add its nodes
pipeline = Pipeline()
pipeline.add_nodes([c1, c2, add, show])

# run your pipeline
pipeline.run(1)

torch.allclose(add.outputs.out.value, torch.ones(1, 3) * 2.)

Example using the stack torch method:

# define your components
c1 = Constant("c1", 0)
t1 = Constant("t1", torch.ones(1, 3))
t2 = Constant("t2", torch.ones(1, 3) * 2)
stack = Stack("stack")
show = Printer("print")

# connect the components
c1.outputs.out >> stack.inputs.dim
t1.outputs.out >> stack.inputs.tensors.select(0)
t2.outputs.out >> stack.inputs.tensors.select(1)
stack.outputs.out >> show.inputs.inp

# create the pipeline and add its nodes
pipeline = Pipeline()
pipeline.add_nodes([c1, t1, t2, stack, show])

# run your pipeline
pipeline.run(1)

torch.allclose(stack.outputs.out.value, torch.tensor([[1., 1., 1.],[2., 2., 2.]]))

Remember that the components can be run without the Pipeline, e.g in the last example you can also run:

asyncio.run(asyncio.gather(c1(), t1(), t2(), stack(), show()))

Basically, Pipeline objects allow you to control the execution flow, e.g. you can stop, pause, resume the execution, determine the number of executions to be run...

A higher level API on top of Pipeline is App allowing to encapsulate some code. E.g.:

class MyApp(App):
    def create_components(self):
        self.c1 = Constant("c1", 0)
        self.t1 = Constant("t1", torch.ones(1, 3))
        self.t2 = Constant("t2", torch.ones(1, 3) * 2)
        self.stack = stack("stack")
        self.show = Printer("print")

    def connect_components(self):
        self.c1.outputs.out >> self.stack.inputs.dim
        self.t1.outputs.out >> self.stack.inputs.tensors.select(0)
        self.t2.outputs.out >> self.stack.inputs.tensors.select(1)
        self.stack.outputs.out >> self.show.inputs.inp

MyApp().run(1)

Installation

from PyPI:

pip install limbus  # limbus alone
# or
pip install limbus[components]  # limbus + some predefined components

from the repository:

pip install limbus@git+https://git@github.com/kornia/limbus.git  # limbus alone
# or
pip install limbus[components]@git+https://git@github.com/kornia/limbus.git  # limbus + some predefined components

for development

you can install the environment with the following commands:

git clone https://github.com/kornia/limbus
cd limbus
source path.bash.inc

In order to regenerate the development environment:

cd limbus
rm -rf .dev_env
source path.bash.inc

Testing

Run pytest and automatically will test: cov, pydocstyle, mypy and flake8

Project details


Download files

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

Source Distribution

limbus-0.1.2.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

limbus-0.1.2-py2.py3-none-any.whl (27.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file limbus-0.1.2.tar.gz.

File metadata

  • Download URL: limbus-0.1.2.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for limbus-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e9866b48ee167c367a98aff93a876f8ea2ad5e6b4c3fadef2c61cee20c9afb77
MD5 8959185557af1d7617ffa01cce40059f
BLAKE2b-256 7558e463390a60655b5c7608b7380bf0ffaecef45f1056f4606f4f6ca478b410

See more details on using hashes here.

File details

Details for the file limbus-0.1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: limbus-0.1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 27.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for limbus-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d3152038bfc256617525119ea774b0cc5cdcdc1d31107e21aab07a1e6710f2ce
MD5 8ef3e0b33cd4d592921a9e47ecd62da2
BLAKE2b-256 b12c5ba9c0ddb39641cd9c2bc7adb8b236d2e6826d51881bd83112a724003d8a

See more details on using hashes here.

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