Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Sparrow Datums

Sparrow Datums is a Python package for vision AI data structures, related operations and serialization/deserialization. Specifically, it makes it easier to work with bounding boxes, key points (TODO), and segmentation masks (TODO). It supports individual objects, frames of objects, multiple frames of objects, objects augmented with class labels and confidence scores, and more.

Sparrow Datums also supports object tracking where the identity of the object is maintained. And that data can be streamed instead of keeping it all in a single file.

Quick Start Example

Installation

pip install -U sparrow-datums

Switching between box parameterizations

import numpy as np
from sparrow_datums import FrameBoxes, PType

boxes = FrameBoxes(np.ones((4, 4)), PType.absolute_tlwh)
boxes.to_tlbr()

# Expected result
# FrameBoxes([[1., 1., 2., 2.],
#             [1., 1., 2., 2.],
#             [1., 1., 2., 2.],
#             [1., 1., 2., 2.]])

Slicing

Notice that all "chunk" objects override basic NumPy arrays. This means that some filtering operations work as expected:

boxes[:2]

# Expected result
# FrameBoxes([[1., 1., 1., 1.],
#             [1., 1., 1., 1.]])

But sub-types do their own validation. For example, FrameBoxes must be a (n, 4) array. Therefore, selecting a single column throws an error:

boxes[:, 0]

# Expected exception
# ValueError: A frame boxes object must be a 2D array

Instead, chunks expose different subsets of the data as properties. For example, you can get the x coordinate as an array:

boxes.x

# Expected result
# array([1., 1., 1., 1.])

Or the width of the boxes:

boxes.w

# Expected result
# array([1., 1., 1., 1.])

If you need to access the raw data, you can do that with a chunk's array property:

boxes.array[0, 0]

# Expected result
# 1.0

Operations

Sparrow Datums comes with common operations for data types. For example, you can compute the pairwise IoU of two sets of FrameBoxes:

from sparrow_datums import pairwise_iou

pairwise_iou(boxes, boxes + 0.1)

# array([[0.57857143, 0.57857143, 0.57857143, 0.57857143],
#        [0.57857143, 0.57857143, 0.57857143, 0.57857143],
#        [0.57857143, 0.57857143, 0.57857143, 0.57857143],
#        [0.57857143, 0.57857143, 0.57857143, 0.57857143]])

Metadata

Release files for sparrow-datums 0.8.2.dev1657903228

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

Source distribution (sdist)

Source distribution for sparrow-datums 0.8.2.dev1657903228
File Size Uploaded Provenance Actions
sparrow-datums-0.8.2.dev1657903228.tar.gz 22.2 kB Without provenance Details for sparrow-datums-0.8.2.dev1657903228.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sparrow-datums 0.8.2.dev1657903228
File Interpreter ABI Platform Actions
sparrow_datums-0.8.2.dev1657903228-py3-none-any.whl Python 3 none any Details for sparrow_datums-0.8.2.dev1657903228-py3-none-any.whl

Total release size: 56.9 kB

Release files / sparrow-datums-0.8.2.dev1657903228.tar.gz

Download URL sparrow-datums-0.8.2.dev1657903228.tar.gz
Size 22.2 kB
Tags Source
SHA-256 checksum
How to use checksums
59955a83b80c596d2d84dc8d563c6cd7f9a421a846218c9fc09fe04fd4d91bc3
BLAKE2b-256 checksum
How to use checksums
2e4967ee6c2f6be5cae38d21636da6848672ab59b5c5e617705a1dea27451ecf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.8.13 Linux/5.13.0-1031-azure

Release files / sparrow_datums-0.8.2.dev1657903228-py3-none-any.whl

Download URL sparrow_datums-0.8.2.dev1657903228-py3-none-any.whl
Size 34.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c394c9d34b0cbe1e638d9b680196b4c71855fd1134e2bcb0b2bae8e83e5b10b9
BLAKE2b-256 checksum
How to use checksums
5969fe1fc9fdb158e9f4bf763d15e6d7a0e1fa59534b74717a2c8d58143a8ea4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.8.13 Linux/5.13.0-1031-azure

Security for sparrow-datums 0.8.2.dev1657903228

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
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