Skip to main content

LuxonisML

Ubuntu Windows

License PyBadge PyPI PyPI - Downloads Ruff CI codecov

🌟 Overview

LuxonisML is the core library of the Luxonis MLOps stack. It defines the Luxonis Data Format (LDF), and it provides the dataset, loader, parser, tracking, and utility layers that the other Luxonis tools build on. LuxonisTrain, ModelConverter, and LuxonisEval all depend on it.

✨ Key Features

  • One Dataset Format: Build a computer vision dataset once, then train on it with any of the Luxonis tools.
  • Bring Your Own Data: Convert COCO, YOLO, VOC, RoboFlow, and other common formats with a single call.
  • Storage Agnostic: Keep the images locally, in Google Cloud Storage, or in S3, without a change to your training code.
  • Rich Annotations: Bounding boxes, keypoints, semantic and instance segmentation, classification, arrays, and free-form metadata.
  • One Tracking API: Log metrics to TensorBoard, Weights & Biases, or MLflow through one interface.

[!WARNING] The project is in a beta state and might be unstable or contain bugs - please report any feedback.

🚀 Quick Start

  1. Install LuxonisML

    pip install luxonis-ml[data]
    

    This will create the luxonis_ml executable in your PATH.

  2. Convert a dataset into LDF

    We will use a sample COCO dataset from RoboFlow in this example.

    luxonis_ml data parse "roboflow://team-roboflow/coco-128/2/coco" --name coco_test
    

    [!IMPORTANT] A roboflow:// source needs the ROBOFLOW_API_KEY environment variable. Get your key from the Roboflow settings. The Roboflow documentation gives the steps.

  3. Inspect the result

    luxonis_ml data info coco_test
    luxonis_ml data inspect coco_test
    
  4. Load it in your training code

    from luxonis_ml.data import LuxonisDataset, LuxonisLoader
    
    loader = LuxonisLoader(LuxonisDataset("coco_test"), view="train")
    
    for sample in loader:
        images = sample.images
        labels = sample.labels
    

[!NOTE] For hands-on examples of how to prepare data with LuxonisML and train AI models using LuxonisTrain, check out this guide.

📜 Table Of Contents

🧩 Modules

Each module links to its own API reference:

Module Extra Purpose
luxonis_ml.data data Dataset creation, conversion, loading, augmentation, and export.
luxonis_ml.ldf ldf The annotation schemas of the Luxonis Data Format. A subset of data.
luxonis_ml.tracker tracker One experiment tracking API for TensorBoard, Weights & Biases, and MLflow.
luxonis_ml.telemetry telemetry A lightweight telemetry client with pluggable backends.
luxonis_ml.nn_archive nn_archive NN Archive creation and inspection.
luxonis_ml.utils utils Config, environment, filesystem, logging, graph, and registry helpers.

🛠️ Installation

LuxonisML requires Python 3.10 or higher. We recommend using a virtual environment to manage dependencies.

Install via pip:

pip install luxonis-ml[data]

Each module has its own extra, so you install only what you use:

Extra Installs the dependencies of
ldf luxonis_ml.ldf
data luxonis_ml.data, and luxonis_ml.ldf with it
tracker luxonis_ml.tracker, except mlflow and opencv-python
telemetry luxonis_ml.telemetry, with the PostHog backend
nn_archive luxonis_ml.nn_archive
utils luxonis_ml.utils
all All of the above, and all of the extras below

The data, ldf, tracker, and utils modules fail on import when you do not install their extra. The message names the extra. luxonis_ml.telemetry is an exception: it imports without posthog and falls back to a no-op backend.

☁️ Additional Dependencies

These extras add support for specific cloud services and integrations:

Extra Adds support for
gcs Google Cloud Storage
s3 AWS S3
roboflow Dataset downloads from Roboflow
mlflow MLflow tracking and artifact storage

[!NOTE] LuxonisML installs these four dependencies for you on first use. If you open a gs://, gcs://, s3://, mlflow://, or roboflow:// path and the package is absent, LuxonisML installs it and continues. Install the extra yourself when you want a reproducible environment or an offline machine.

Examples:

# the data module, with Google Cloud Storage and Roboflow support
pip install luxonis-ml[data,gcs,roboflow]

# everything
pip install luxonis-ml[all]

For a development environment, read CONTRIBUTING.md. The development tooling lives in uv dependency groups, not in a published extra.

📝 Usage

💾 Creating a Dataset

A dataset is a named collection of records. Each record points to one image and carries one annotation. The coordinates are relative to the image size.

from luxonis_ml.data import LuxonisDataset

dataset = LuxonisDataset("parking_lot")


def records():
    yield {
        "file": "images/frame_001.jpg",
        "task_name": "detection",
        "annotation": {
            "class": "car",
            "boundingbox": {
                "x": 0.1,
                "y": 0.2,
                "w": 0.3,
                "h": 0.4,
            },
        },
    }


dataset.add(records())
dataset.make_splits({"train": 0.8, "val": 0.1, "test": 0.1})

LDF also supports keypoints, semantic and instance segmentation, classification, arrays, and free-form metadata. See luxonis_ml.data.datasets for the dataset contract, and the luxonis_ml.ldf module for every annotation schema.

🔄 Converting an Existing Dataset

LuxonisParser reads the common dataset formats. It detects the format from the directory structure when you do not name one.

from luxonis_ml.data import LuxonisParser

dataset = LuxonisParser(
    "path/to/coco_dataset",
    dataset_name="coco",
).parse()

The dataset path can be one of the following:

  • a local directory, or a ZIP archive
  • s3://bucket/path/to/directory for AWS S3
  • gs://bucket/path/to/directory or gcs://bucket/path/to/directory for Google Cloud Storage
  • roboflow://{workspace}/{project}/{version}/{format} for RoboFlow
  • ultralytics://{username}/datasets/{slug} for Ultralytics

See luxonis_ml.data.parsers for the supported formats and their expected layouts.

📤 Loading the Data

LuxonisLoader reads one or more splits. It resizes the images, applies the augmentations, and returns the labels for each task.

from luxonis_ml.data import LuxonisLoader

loader = LuxonisLoader(dataset, view="train", height=640, width=640)

for sample in loader:
    images = sample.images
    labels = sample.labels

Labels use "task_name/task_type" keys, such as "detection/boundingbox". See luxonis_ml.data.loaders for the output shapes, and luxonis_ml.data.augmentations for the augmentation configuration.

📈 Tracking an Experiment

from luxonis_ml.tracker import LuxonisTracker

tracker = LuxonisTracker(
    project_name="parking_lot",
    run_name="baseline",
    is_tensorboard=True,
)

tracker.log_metric("loss", 0.42, step=1)
tracker.close()

[!NOTE] The tracker extra does not install every dependency of luxonis_ml.tracker. The module imports mlflow and cv2 at import time, so install mlflow and opencv-python as well: pip install "luxonis-ml[tracker,mlflow]" opencv-python. Install torch for TensorBoard and wandb for Weights & Biases.

💻 CLI

The package installs the luxonis_ml executable.

Available commands:

  • data - Parse, inspect, export, merge, push, pull, and delete datasets
  • archive - Inspect and extract NN Archive files
  • fs - Copy and list files across the supported storage backends
  • checkhealth - Report whether the ldf, data, utils, and nn_archive modules import correctly

To get help on any command:

luxonis_ml <command> --help

Examples:

luxonis_ml data parse ./coco_dataset --name coco
luxonis_ml data ls
luxonis_ml data health coco
luxonis_ml data export coco --type ultralyticsndjson

🔑 Credentials

When using cloud services, avoid hard-coding credentials or placing them directly in your configuration files. Instead:

  • Use environment variables to store sensitive information.
  • Use a .env file and load it securely, ensuring it's excluded from version control.

Supported Cloud Services:

  • AWS S3, requires:
    • AWS_ACCESS_KEY_ID
    • AWS_SECRET_ACCESS_KEY
    • AWS_S3_ENDPOINT_URL
  • Google Cloud Storage, requires:
    • GOOGLE_APPLICATION_CREDENTIALS
  • RoboFlow, requires:
    • ROBOFLOW_API_KEY
  • Ultralytics, requires:
    • ULTRALYTICS_API_KEY

For logging and tracking, we support:

  • MLFlow, requires:
    • MLFLOW_S3_BUCKET
    • MLFLOW_S3_ENDPOINT_URL
    • MLFLOW_TRACKING_URI

Dataset storage is configured with:

  • LUXONISML_BASE_PATH - local base path for datasets and cache files, ~/luxonis_ml by default
  • LUXONISML_TEAM_ID - team identifier used by dataset storage, offline by default
  • LUXONISML_BUCKET - the cloud bucket that holds remote datasets

[!NOTE] LuxonisML sends no telemetry. It only provides a telemetry client that other Luxonis packages can use. To turn that client off, set LUXONIS_TELEMETRY_ENABLED=false. See the luxonis_ml.telemetry documentation for the data an event carries.

📚 Documentation

The API documentation is generated from the docstrings in the source code, and it is published on the Luxonis documentation portal:

https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/

To build the documentation locally, run:

uv run pydoctor luxonis_ml

The command writes the site to apidocs/index.html.

🤝 Contributing

We welcome contributions! Please read our Contribution Guide to get started. Whether it's reporting bugs, improving documentation, or adding new features, your help is appreciated.

📄 License

This project is licensed under the Apache 2.0 License.

Metadata

Release files for luxonis-ml 0.10.0

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

Source distribution (sdist)

Source distribution for luxonis-ml 0.10.0
File Size Uploaded
luxonis_ml-0.10.0.tar.gz 285.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for luxonis-ml 0.10.0
File Interpreter ABI Platform
luxonis_ml-0.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 640.1 kB

Release files / luxonis_ml-0.10.0.tar.gz

Download URL luxonis_ml-0.10.0.tar.gz
Size 285.5 kB
Tags Source
SHA-256 checksum
How to use checksums
72dd2f070fabf106d658b0640536ea1486fdf9f3858d3515a793834c6d584447
BLAKE2b-256 checksum
How to use checksums
dba6157620680c37193f20f5e6d0891928dc84c574e89cfc9c676fa541cfd745
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / luxonis_ml-0.10.0-py3-none-any.whl

Download URL luxonis_ml-0.10.0-py3-none-any.whl
Size 354.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8711d4de1929a67847a1f34f55414bd174facee586ce4e6212674957760f3e2c
BLAKE2b-256 checksum
How to use checksums
d1f877ff2cbbb2c6c718494e7ebc0ea90bb9b7d913496c4f925359ed3aad4ad4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.10.0 This release

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.6

2 release files

0.8.5

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.1

2 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