Skip to main content

Application Module Library

Application Module Library (modlib) is an SDK designed to simplify and streamline the process of creating end-to-end applications for the IMX500 vision sensor.

1. Quickstart

For the Raspberry Pi AI Camera, make sure that the python version of the virtual environment is the same as the system Python version. (Verify by running /usr/bin/python3 -V). This depends on your platform.

  • Raspberry Pi OS Bookworm: Python 3.11
  • Raspberry Pi OS Trixie: Python 3.13

We expect the Raspberry Pi computer to be installed correclty with the AiCamera connected and access to the board terminal. Ensure that your Raspberry Pi runs the latest software. A full setup guide can be found here.

One can use pip to install the library in your project Python environment.

pip install modlib

Create a new Python file named hello_world.py. and run the following code to see a camera preview.

from modlib.devices import AiCamera

device = AiCamera()

with device as stream:
    for frame in stream:
        frame.display()

2. Documentation

For a comprehensive guide on how to use the library, including detailed API documentation, tutorials, and examples, make sure to check out the documentation!

  1. Documentation site: Coming soon!
  2. Local Documentation: You can run a local documentation server using:
python -m http.server --directory ./docs

3. Development Environment Setup (Build from source)

Before getting started, ensure you have the following prerequisites installed on your system:

3.1 Prerequisites

3.1.1 UV

UV is the Python environment and package manager used for the project. Follow the installation instructions provided in the UV documentation to set it up. Verify your uv installation by running:

uv --version

3.1.2 Build environment dependencies

  • On Linux, install ninja using apt. And make sure to have a gcc compiler installed on your system: sudo apt install ninja-build
  • On Windows, install ninja using Chocolatey. And make sure to have an MSVC compiler installed on your system: choco install ninja

3.2 Hardware setup

3.2.1 Raspberry Pi AI Camera

We expect the Raspberry Pi computer to be installed correclty with the AiCamera connected and access to the board terminal. Ensure that your Raspberry Pi runs the latest software:

sudo apt update && sudo apt full-upgrade
sudo apt install imx500-all

Reboot if needed.

3.2.2 Triton® Smart (IMX501)

NOTE: It is possible to skip this step if you do not intend to use the Triton® Smart device. Be aware that any attempt to initialize the Triton® device will fail if you chose to skip the installation of the Arena SDK.

We recommend a PoE (IEEE 802.3af) setup where both the Triton® Smart camera and the host device are connected. [PC] --- [POE] --- [Triton® Camera] IPv4 should be set to Manual, Address: 169.254.0.1, Netmask: 255.255.0.0

System requirements (LUCID Arena compatible device as stated by the Arena SDK docs):

  • Linux: x64 - Ubuntu 22.04/24.04 (64-bit)
  • Linux: arm64 - Ubuntu 22.04/24.04 (64-bit)
  • Windows: amd64 - Windows 11 (64-bit) & Windows 10 (32/64-bit)

Install the Arena SDK (Linux x64 or ARM64 or Windows) Download from: https://thinklucid.com/downloads-hub/

  • Windows: Run the ArenaSDK installer for profile: Developer.
  • Linux: Unzip and make sure to make the libraries (.so) available. Example Linux x64 (but similar for aarch64):
tar -xvzf ArenaSDK_<sdk-version-number>_Linux_x64.tar.gz
cd /path/to/ArenaSDK_Linux
sudo sh Arena_SDK_Linux_x64.conf

3.3 Setup

uv sync

This will setup and build the project using the meson-python build system.

3.4 Running examples

As a basic example let's demonstrate the usage of the Raspberry Pi AiCamera device using a pre-trained SSDMobileNetV2FPNLite320x320 object detection model.

  1. Run any of the model examples from ./examples/aicam:
uv run examples/aicam/classifier.py
uv run examples/aicam/detector.py
uv run examples/aicam/segment.py
uv run examples/aicam/posenet.py

Note that the Application Module Library API allows you to create custom Models and combine any network.rpk with your own custom post_processing function. More information in Docs > getting_started > custom_models.md.

  1. Run any of the application examples ./examples/apps:
uv run examples/apps/tracker.py
uv run examples/apps/area.py
uv run examples/apps/heatmap.py

...

Extra

  • Unit-tests are included in the corresponding /tests folder and can be exectued by running: make test
  • Linting corrections and checks using ruff by running: make lint
  • Building the Python wheel. One can create a wheel file of the Application Module Library by running: make build The generated wheel file located in the /dist folder can be used to install the library in you project environment.

Releases

Release tags must be of the format "\d+.\d+.\d+" example "1.0.4".

License

LICENSE

Trademarks

Trademarks | Sony Semiconductor Solutions Group

Notice

Sony Semiconductor Solutions Corporation assumes no responsibility for applications created using this library. Use of the library is entirely at the user's own risk.

Security

Please read the Site Policy of GitHub and understand the usage conditions.

Release files for modlib 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for modlib 1.5.0
File
modlib-1.5.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
modlib-1.5.0-cp313-cp313-manylinux_2_35_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.35+ x86-64 Details
modlib-1.5.0-cp313-cp313-manylinux_2_34_aarch64.manylinux_2_35_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.35+ ARM64, Linux glibc 2.34+ ARM64 Details
modlib-1.5.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
modlib-1.5.0-cp312-cp312-manylinux_2_35_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.35+ x86-64 Details
modlib-1.5.0-cp312-cp312-manylinux_2_34_aarch64.manylinux_2_35_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ ARM64, Linux glibc 2.35+ ARM64 Details
modlib-1.5.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
modlib-1.5.0-cp311-cp311-manylinux_2_35_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.35+ x86-64 Details
modlib-1.5.0-cp311-cp311-manylinux_2_34_aarch64.manylinux_2_35_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.35+ ARM64, Linux glibc 2.34+ ARM64 Details

Total release size: 173.6 MB

Release files / modlib-1.5.0-cp313-cp313-win_amd64.whl

Download URL modlib-1.5.0-cp313-cp313-win_amd64.whl
Size 18.3 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
6bac5fcf5b0b0d4485121f02d5c18c4b3cbd3bcdd8c0e9c444422c28a56ae574
BLAKE2b-256 checksum
How to use checksums
ee7cdac64bbf814c7cee3c4ff6cc5fe7cb2c321154d27fbcf0564d0f6a248fb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / modlib-1.5.0-cp313-cp313-manylinux_2_35_x86_64.whl

Download URL modlib-1.5.0-cp313-cp313-manylinux_2_35_x86_64.whl
Size 31.7 MB
Tags CPython 3.13 Linux glibc 2.35+ x86-64
SHA-256 checksum
How to use checksums
1d6766f3886d38422fcdc812021b0dbed664a0a40303f11496d6b546505204a9
BLAKE2b-256 checksum
How to use checksums
3d6dcfa1a85342c5e575e17f6e96cd9b7132a5b31ea41b7097708a29f5468b8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / modlib-1.5.0-cp313-cp313-manylinux_2_34_aarch64.manylinux_2_35_aarch64.whl

Download URL modlib-1.5.0-cp313-cp313-manylinux_2_34_aarch64.manylinux_2_35_aarch64.whl
Size 7.9 MB
Tags CPython 3.13 Linux glibc 2.34+ ARM64 Linux glibc 2.35+ ARM64
SHA-256 checksum
How to use checksums
4161b8786b88cc2c2bb2eb10d2a467e9741ec2f74aec831a99a87517c1140285
BLAKE2b-256 checksum
How to use checksums
c9a97a1b3fc2c502c1f979a949e251cfa66dce5453373de63af22cda735ab16f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / modlib-1.5.0-cp312-cp312-win_amd64.whl

Download URL modlib-1.5.0-cp312-cp312-win_amd64.whl
Size 18.3 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
52d94e20324c0e055a0f347b708b7aa220ae394b55f83bfdb541fd2b631b83d2
BLAKE2b-256 checksum
How to use checksums
887af580762392faa8249cdd980ce9be8c91445c89e1bd360dd93683d34fcb55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / modlib-1.5.0-cp312-cp312-manylinux_2_35_x86_64.whl

Download URL modlib-1.5.0-cp312-cp312-manylinux_2_35_x86_64.whl
Size 31.7 MB
Tags CPython 3.12 Linux glibc 2.35+ x86-64
SHA-256 checksum
How to use checksums
7311bb4dc534801052d46f6643668152b75e23f343ca8932122490bb38195391
BLAKE2b-256 checksum
How to use checksums
4871bd924905af0f325f6003fde9e6c9444f07708ada63c3d427845896503bd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / modlib-1.5.0-cp312-cp312-manylinux_2_34_aarch64.manylinux_2_35_aarch64.whl

Download URL modlib-1.5.0-cp312-cp312-manylinux_2_34_aarch64.manylinux_2_35_aarch64.whl
Size 7.9 MB
Tags CPython 3.12 Linux glibc 2.34+ ARM64 Linux glibc 2.35+ ARM64
SHA-256 checksum
How to use checksums
43724b3be50a7071acd476df0045da9f880011da02ad28c7646a37de83ab05be
BLAKE2b-256 checksum
How to use checksums
d165106ae2815ab7b4667808259aa9fe07bd195e89604c722f11ad01c1860914
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / modlib-1.5.0-cp311-cp311-win_amd64.whl

Download URL modlib-1.5.0-cp311-cp311-win_amd64.whl
Size 18.3 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
7322bfbd4458700af4722488b1869b13077d8a6c454a81d7663d211d68c3f6d9
BLAKE2b-256 checksum
How to use checksums
0a3d2c675a4b4474cca9dbfbf56bf9ab0c02be02395a83d3df22c1b7935c4559
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / modlib-1.5.0-cp311-cp311-manylinux_2_35_x86_64.whl

Download URL modlib-1.5.0-cp311-cp311-manylinux_2_35_x86_64.whl
Size 31.7 MB
Tags CPython 3.11 Linux glibc 2.35+ x86-64
SHA-256 checksum
How to use checksums
51768d13efaf652286f8d2139cc591f0d2ec67ae76fa0066f6085966021aaeaa
BLAKE2b-256 checksum
How to use checksums
27b439321ddf1ac097dd496e5f7a88332f9806772c804d380d0aa7fd013d3bb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / modlib-1.5.0-cp311-cp311-manylinux_2_34_aarch64.manylinux_2_35_aarch64.whl

Download URL modlib-1.5.0-cp311-cp311-manylinux_2_34_aarch64.manylinux_2_35_aarch64.whl
Size 7.9 MB
Tags CPython 3.11 Linux glibc 2.34+ ARM64 Linux glibc 2.35+ ARM64
SHA-256 checksum
How to use checksums
20b5994df60f2a4918184ce76a525fd49465872796378208fcab58ebb6ce53dd
BLAKE2b-256 checksum
How to use checksums
7af9d186350fb763b81cbf0a6f15e369d40bf0f8c32229e2fa1a24b27dc123b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

1.5.0 This release

9 release files

1.4.0

9 release files

1.3.1

9 release files

1.3.0

9 release files

1.2.1

3 release files

1.2.0

3 release files

1.1.1

3 release files

1.1.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page