File size: 1,921 Bytes
b7e49b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d5afa0d
b7e49b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# SPDX-License-Identifier: Apache-2.0
"""DepthPro2: Apple's Depth Pro 2 (S, B, L, H+) monocular and video metric depth on one Tenstorrent Blackhole p150.

    from tt_depthpro2 import DepthPro2
    with DepthPro2.from_pretrained("L") as model:
        out = model.infer("photo.jpg")          # inverse depth, depth in metres, focal length in pixels

Sub-packages / modules: ``api`` (the Python API), ``config`` (sizes, weights pins, resolution buckets, video
settings), ``io`` (image decoding, array / PNG encoding), ``streaming`` (buffered / unbuffered video on the host),
``cpu_engine`` (the device-engine interface on the CPU reference), ``server`` (the HTTP server, client and smoke
test), ``reference`` (clean-room float32 CPU reference, no Apple code), ``tt`` (the device programs), ``ttaw``
(vendored common helpers), ``tests``. Importing this package has no side effects (exports load lazily).

The weights are Apple's (apple/DepthPro2-*, Apple Machine Learning Research Model License: research purposes only);
they are not part of this package. Apple Machine Learning Research Model is licensed under the Apple Machine
Learning Research Model License Agreement.
"""

__version__ = "0.2.0"

__all__ = ["DepthPro2", "DepthOutput", "VideoSession", "load_sample", "InputError", "open_device", "close_device",
           "__version__"]

_EXPORTS = {
    "DepthPro2": ("api", "DepthPro2"),
    "DepthOutput": ("api", "DepthOutput"),
    "VideoSession": ("api", "VideoSession"),
    "load_sample": ("api", "load_sample"),
    "InputError": ("io", "InputError"),
    "open_device": ("device", "open_device"),
    "close_device": ("device", "close_device"),
}


def __getattr__(name):
    if name in _EXPORTS:
        import importlib

        mod, attr = _EXPORTS[name]
        return getattr(importlib.import_module(f"{__name__}.{mod}"), attr)
    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")