edgefirst-decoder 0.29.3__cp38-abi3-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- edgefirst/decoder/__init__.py +82 -0
- edgefirst/decoder/__init__.pyi +853 -0
- edgefirst/decoder/_decoder.pyd +0 -0
- edgefirst/decoder/py.typed +0 -0
- edgefirst_decoder-0.29.3.dist-info/METADATA +235 -0
- edgefirst_decoder-0.29.3.dist-info/RECORD +9 -0
- edgefirst_decoder-0.29.3.dist-info/WHEEL +4 -0
- edgefirst_decoder-0.29.3.dist-info/licenses/LICENSE +202 -0
- edgefirst_decoder-0.29.3.dist-info/sboms/edgefirst-python-decoder.cyclonedx.json +8625 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""EdgeFirst decoder bindings.
|
|
2
|
+
|
|
3
|
+
Part of the PEP 420 `edgefirst.*` namespace. No package in the set ships an
|
|
4
|
+
`edgefirst/__init__.py`: a single one would shadow the namespace and break
|
|
5
|
+
every sibling.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import os
|
|
9
|
+
import sys
|
|
10
|
+
from typing import Any, Dict, List, NamedTuple, Protocol, Tuple
|
|
11
|
+
|
|
12
|
+
if sys.platform == "win32" and hasattr(os, "add_dll_directory"):
|
|
13
|
+
# Python 3.8+ loads extension modules with LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
|
|
14
|
+
# | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR: the .pyd's own directory and the
|
|
15
|
+
# directories registered via os.add_dll_directory() are searched, PATH is
|
|
16
|
+
# not. _decoder.pyd lives here but edgefirst_tensor.dll ships in the sibling
|
|
17
|
+
# edgefirst/tensor/ directory, so register that directory before the
|
|
18
|
+
# import below loads the extension. The handle stays bound for the life
|
|
19
|
+
# of the process (CPython's handle has no __del__, so dropping it would
|
|
20
|
+
# not undo the registration, but holding it keeps the lifetime explicit
|
|
21
|
+
# and remove_dll_directory() possible); the leading underscore keeps it
|
|
22
|
+
# out of the public surface checked by tests/packaging.
|
|
23
|
+
import edgefirst.tensor as _tensor_pkg
|
|
24
|
+
|
|
25
|
+
_tensor_dll_dir = os.add_dll_directory(os.path.dirname(_tensor_pkg.__file__))
|
|
26
|
+
del _tensor_pkg
|
|
27
|
+
|
|
28
|
+
from edgefirst.tensor import EdgeFirstTensorExportable as EdgeFirstTensorExportable
|
|
29
|
+
|
|
30
|
+
from ._decoder import *
|
|
31
|
+
from ._decoder import __doc__ # noqa: F401
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class EdgeFirstDecoderExportable(Protocol):
|
|
35
|
+
"""Structural type for anything that can hand a ``Decoder`` across an
|
|
36
|
+
``edgefirst.*`` package boundary via the ``__edgefirst_decoder__``
|
|
37
|
+
capsule protocol. See
|
|
38
|
+
``crates/python-common/INTEROP.md`` in the
|
|
39
|
+
`hal <https://github.com/EdgeFirstAI/hal>`_ repository.
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
def __edgefirst_decoder__(self) -> object: ...
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class EdgeFirstProtoDataExportable(Protocol):
|
|
46
|
+
"""Structural type for anything that can hand mask-prototype data
|
|
47
|
+
across an ``edgefirst.*`` package boundary via the
|
|
48
|
+
``__edgefirst_protodata__`` capsule protocol. See
|
|
49
|
+
``crates/python-common/INTEROP.md`` in the
|
|
50
|
+
`hal <https://github.com/EdgeFirstAI/hal>`_ repository.
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
# `from __future__ import annotations` is deliberately not used in this
|
|
54
|
+
# module -- see the `del` below.
|
|
55
|
+
def __edgefirst_protodata__(self) -> Tuple[object, object, str]: ... # noqa: FA100
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class InferredSchema(NamedTuple):
|
|
59
|
+
"""What :func:`infer_ultralytics_schema` derived from a model's signals.
|
|
60
|
+
|
|
61
|
+
A :class:`typing.NamedTuple`, so it unpacks positionally like a plain
|
|
62
|
+
tuple while giving the three fields names -- two of them are strings,
|
|
63
|
+
which positional unpacking alone cannot keep straight.
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
#: The inferred ``edgefirst.json`` schema v2 document, ready to hand to
|
|
67
|
+
#: ``Decoder(schema)``.
|
|
68
|
+
schema: Dict[str, Any] # noqa: FA100
|
|
69
|
+
#: Class names in index order. ``decode()`` returns class indices into
|
|
70
|
+
#: this list.
|
|
71
|
+
labels: List[str] # noqa: FA100
|
|
72
|
+
#: Human-readable summary, e.g. ``"Ultralytics YOLOv8/11 detect, 80
|
|
73
|
+
#: classes"``.
|
|
74
|
+
description: str
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
# `os`/`sys` and the `typing` names must not remain bound as module
|
|
78
|
+
# attributes: both tests/packaging/test_stub_parity.py (via `dir()`) and
|
|
79
|
+
# tests/packaging/test_namespace.py's `test_pyclass_modules_are_named` (via
|
|
80
|
+
# `vars()`, which `Protocol.__module__ == "typing"` would fail) treat every
|
|
81
|
+
# top-level name here as this package's public surface.
|
|
82
|
+
del Any, Dict, List, NamedTuple, os, Protocol, sys, Tuple
|