Skip to main content

CoBaIR is a python lib for Context Based Intention Recognition

Project description

CoBaIR

CoBaIR is a python library for Context Based Intention Recognition. It provides the means to infer an intention from given context. An intention is a binary value e.g. repair pipe that can either be present or not. Only one intention can be present at a time. Context on the otherhand can have multiple discrete instantiations e.g. weather:sunny|cloudy|raining. If context values are continuous, discretizer functions can be used to create discrete values. From the infered intention in a HRI scenario the robot can perform corresponding actions to help the human with a specific task.

Publications

For a more in-depth explanation consult the following papers:

Install

You can install the library from your local copy after cloning this repo with pip using pip install .

Known Issues

On some Linux Distros there seems to be a problem with a shared library. This Solutions suggests to export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 which works on Ubuntu 22.04.

Use the Graphical User Interface

To make the configuration of a scenario easier we provide a Graphical User Interface(GUI). The GUI can be started with

python start_configurator.py

if you want to start the GUI with a loaded config use

python start_configurator.py -f config.yml

Documentation

The Documentation can be accessed via the VPN on http://bob.dfki.uni-bremen.de/apis/kimmi_sf/implementation/CoBaIR/latest

Bayesian Approach

In the bayesian approach CoBaIR uses a two-layer Bayesian Net of the following structure. two-layer Bayesian Net

Config Format

Configs will be saved in yml files. For convenience the is a configurator which can be started with

python start_configurator.py

Bayesian Approach

The configuration file for a two layer bayesian net for context based intention recognition follows the given format:

# List of contexts. Contexts can have different discrete instantiations. 
# Number of instantiations must be larger than 2.
# For all discrete instantiations a prior probability must be given(sum for one context must be 1)
contexts:
  context 1:
    instantiation 1 : float
    instantiation 2 : float
      .
      .
      .
    instantiation m_1 : float
  context 2:
    instantiation 1 : float
    instantiation 2 : float
      .
      .
      .
    instantiation m_2 : float
    .
    .
    .
  context n:
    instantiation 1 : float
    instantiation 2 : float
      .
      .
      .
    instantiation m_n : float



# List of intentions. Intentions are always binary(either present or not)
# For every intention the context variables and their influence on the intention is given
# [very high, high, medium, low, very low, no] => [5, 4, 3, 2, 1, 0]
intentions: 
  intention 1:
    context 1:
        instantiation 1: [5, 4, 3, 2, 1, 0]
        instantiation 2: [5, 4, 3, 2, 1, 0]
        .
        .
        .
        instantiation m_1: [5, 4, 3, 2, 1, 0]
    context 2:
        instantiation 1: [5, 4, 3, 2, 1, 0]
        instantiation 2: [5, 4, 3, 2, 1, 0]
        .
        .
        .
        instantiation m_1: [5, 4, 3, 2, 1, 0]
        .
        .
        .
    context n:
        instantiation 1: [5, 4, 3, 2, 1, 0]
        instantiation 2: [5, 4, 3, 2, 1, 0]
        .
        .
        .
        instantiation m_n: [5, 4, 3, 2, 1, 0]
  intention 2:
    context 1:
        instantiation 1: [5, 4, 3, 2, 1, 0]
        instantiation 2: [5, 4, 3, 2, 1, 0]
        .
        .
        .
        instantiation m_1: [5, 4, 3, 2, 1, 0]
    context 2:
        instantiation 1: [5, 4, 3, 2, 1, 0]
        instantiation 2: [5, 4, 3, 2, 1, 0]
        .
        .
        .
        instantiation m_1: [5, 4, 3, 2, 1, 0]
        .
        .
        .
    context n:
        instantiation 1: [5, 4, 3, 2, 1, 0]
        instantiation 2: [5, 4, 3, 2, 1, 0]
        .
        .
        .
        instantiation m_n: [5, 4, 3, 2, 1, 0]
    .
    .
    .
  intention p:
    context 1:
        instantiation 1: [5, 4, 3, 2, 1, 0]
        instantiation 2: [5, 4, 3, 2, 1, 0]
        .
        .
        .
        instantiation m_1: [5, 4, 3, 2, 1, 0]
    context 2:
        instantiation 1: [5, 4, 3, 2, 1, 0]
        instantiation 2: [5, 4, 3, 2, 1, 0]
        .
        .
        .
        instantiation m_1: [5, 4, 3, 2, 1, 0]
        .
        .
        .
    context n:
        instantiation 1: [5, 4, 3, 2, 1, 0]
        instantiation 2: [5, 4, 3, 2, 1, 0]
        .
        .
        .
        instantiation m_n: [5, 4, 3, 2, 1, 0]

How to contribute

If you find any Bugs or want to contribute/suggest a new feature you can create a Merge Request / Pull Request or contact me directly via adrian.lubitz@dfki.de

Run tests

Tests are implemented with pytest. To install test dependencies you need to run

pip install -r requirements/test_requirements.txt

Then you can run

python -m pytest tests/

You can as well see the test report for a specific commit in gitlab under pipeline->Tests

Coverage

If you want to see coverage for the tests you can run

coverage run -m pytest tests/

Use

coverage report

or

coverage html

You can as well see the coverage for a specific job in gitlab under jobs

To show results of the coverage analysis.

Build docu

Documentation is implemented with the material theme for mkdocs.

Dependencies

Install all dependencies for building the docu with

pip install -r requirements/doc_requirements.txt

Build

Build the docu with

mkdocs build

The documentation will be in the site folder.

Authors

Adrian Lubitz & Arunima Gopikrishnan

Funding

CoBaIR is currently developed in the Robotics Group of the University of Bremen, together with the Robotics Innovation Center of the German Research Center for Artificial Intelligence (DFKI) in Bremen. CoBaIR has been funded by the German Federal Ministry for Economic Affairs and Energy and the German Aerospace Center (DLR). CoBaIR been used and/or developed in the KiMMI-SF project.

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

CoBaIR-2.0.3.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

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

CoBaIR-2.0.3-py3-none-any.whl (32.7 kB view details)

Uploaded Python 3

File details

Details for the file CoBaIR-2.0.3.tar.gz.

File metadata

  • Download URL: CoBaIR-2.0.3.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for CoBaIR-2.0.3.tar.gz
Algorithm Hash digest
SHA256 08bd4f6d56cfb3497274a344a3a862c705fd08534855d2d68abe4a0f43a86f97
MD5 cd46e85ff96baf12d8929dc76f405dff
BLAKE2b-256 07db12825f5280909b99d01e92837e1d2ab00ac5d8ee5c62b0cbe480c29cf330

See more details on using hashes here.

File details

Details for the file CoBaIR-2.0.3-py3-none-any.whl.

File metadata

  • Download URL: CoBaIR-2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 32.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for CoBaIR-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 79f6ef4dce14f2fa5fd2c4ddb3b9a79bc21757992aa62d6884bf071a9043b995
MD5 30eca3c7f2f40e3dfbf6db6da48d060a
BLAKE2b-256 d1ceb2e1cf5a9e28dbaa14661824080855c2da028585fe570cab2ed6f8c48bdb

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