euler-loading 2.0.0__tar.gz → 2.1.0__tar.gz
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.
- {euler_loading-2.0.0 → euler_loading-2.1.0}/PKG-INFO +1 -1
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/cpu/generic.py +71 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/gpu/generic.py +73 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/pyproject.toml +1 -1
- {euler_loading-2.0.0 → euler_loading-2.1.0}/.github/workflows/workflow.yml +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/.gitignore +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/README.md +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/__init__.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/_dataset_contract.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/_ds_crawler_utils.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/_metadata.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/_resolution.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/_writing.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/dataset.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/indexing.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/__init__.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/_annotations.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/_writer_utils.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/contracts.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/cpu/__init__.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/cpu/generic_dense_depth.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/cpu/real_drive_sim.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/cpu/vkitti2.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/generate/__init__.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/generate/__main__.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/generate/loaders.json +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/generic.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/gpu/__init__.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/gpu/generic_dense_depth.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/gpu/real_drive_sim.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/gpu/vkitti2.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/real_drive_sim.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/vkitti2.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/example.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/package-lock.json +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/sample_rds.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/tests/__init__.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/tests/conftest.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/tests/example_rds_calib.json +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/tests/test_dataset.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/tests/test_indexing.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/tests/test_loaders.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/tests/test_real_dataset.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/tests/test_writing.py +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/vkitti_cpu_example_output.json +0 -0
- {euler_loading-2.0.0 → euler_loading-2.1.0}/vkitti_gpu_example_output.json +0 -0
|
@@ -11,6 +11,8 @@ Supported file extensions:
|
|
|
11
11
|
Return types
|
|
12
12
|
------------
|
|
13
13
|
- **spherical_map** -- ``np.ndarray`` of shape ``(H, W, C)`` float32.
|
|
14
|
+
- **intrinsics** -- ``np.ndarray`` of shape ``(3, 3)`` float32.
|
|
15
|
+
- **sh_coeffs** -- ``np.ndarray`` of shape ``(N, 3)`` float32.
|
|
14
16
|
|
|
15
17
|
Usage::
|
|
16
18
|
|
|
@@ -18,6 +20,8 @@ Usage::
|
|
|
18
20
|
from euler_loading import Modality
|
|
19
21
|
|
|
20
22
|
Modality("/data/my_dataset/spherical_map", loader=generic.spherical_map)
|
|
23
|
+
Modality("/data/my_dataset/intrinsics", loader=generic.intrinsics)
|
|
24
|
+
Modality("/data/my_dataset/sh_coeffs", loader=generic.sh_coeffs)
|
|
21
25
|
"""
|
|
22
26
|
|
|
23
27
|
from __future__ import annotations
|
|
@@ -60,6 +64,22 @@ def _load_numpy(path: Union[str, BinaryIO]) -> np.ndarray:
|
|
|
60
64
|
return arr.astype(np.float32)
|
|
61
65
|
|
|
62
66
|
|
|
67
|
+
def _write_numpy(path: Union[str, BinaryIO], value: Any) -> None:
|
|
68
|
+
"""Write an array to ``.npy`` or ``.npz`` based on extension."""
|
|
69
|
+
ensure_parent(path)
|
|
70
|
+
ext = os.path.splitext(_get_name(path))[1].lower()
|
|
71
|
+
arr = to_numpy(value).astype(np.float32)
|
|
72
|
+
|
|
73
|
+
if ext == _NPY_EXTENSION:
|
|
74
|
+
np.save(path, arr)
|
|
75
|
+
return
|
|
76
|
+
if ext == _NPZ_EXTENSION:
|
|
77
|
+
np.savez_compressed(path, data=arr)
|
|
78
|
+
return
|
|
79
|
+
|
|
80
|
+
raise ValueError(f"Unsupported output extension: {ext}")
|
|
81
|
+
|
|
82
|
+
|
|
63
83
|
# ---------------------------------------------------------------------------
|
|
64
84
|
# Public loaders
|
|
65
85
|
# ---------------------------------------------------------------------------
|
|
@@ -86,6 +106,45 @@ def spherical_map(path: Union[str, BinaryIO], meta: dict[str, Any] | None = None
|
|
|
86
106
|
# ---------------------------------------------------------------------------
|
|
87
107
|
|
|
88
108
|
|
|
109
|
+
@modality_meta(
|
|
110
|
+
modality_type="intrinsics",
|
|
111
|
+
dtype="float32",
|
|
112
|
+
shape="3x3",
|
|
113
|
+
file_formats=[".npy", ".npz"],
|
|
114
|
+
)
|
|
115
|
+
def intrinsics(path: Union[str, BinaryIO], meta: dict[str, Any] | None = None) -> np.ndarray:
|
|
116
|
+
"""Load a camera intrinsics matrix as a ``(3, 3)`` float32 array.
|
|
117
|
+
|
|
118
|
+
The file is expected to contain a ``(3, 3)`` array::
|
|
119
|
+
|
|
120
|
+
[[fx, 0, cx],
|
|
121
|
+
[ 0, fy, cy],
|
|
122
|
+
[ 0, 0, 1]]
|
|
123
|
+
"""
|
|
124
|
+
return _load_numpy(path)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
@modality_meta(
|
|
128
|
+
modality_type="sh_coeffs",
|
|
129
|
+
dtype="float32",
|
|
130
|
+
shape="NC",
|
|
131
|
+
file_formats=[".npy", ".npz"],
|
|
132
|
+
)
|
|
133
|
+
def sh_coeffs(path: Union[str, BinaryIO], meta: dict[str, Any] | None = None) -> np.ndarray:
|
|
134
|
+
"""Load spherical-harmonic coefficients as an ``(N, 3)`` float32 array.
|
|
135
|
+
|
|
136
|
+
*N* is the number of SH basis functions (e.g. 15 for degree-3 SH with
|
|
137
|
+
the constant term removed). Each row is a 3-vector (one per spatial
|
|
138
|
+
dimension).
|
|
139
|
+
"""
|
|
140
|
+
return _load_numpy(path)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
# ---------------------------------------------------------------------------
|
|
144
|
+
# Writers
|
|
145
|
+
# ---------------------------------------------------------------------------
|
|
146
|
+
|
|
147
|
+
|
|
89
148
|
@mark_stream_supported
|
|
90
149
|
def write_spherical_map(path: Union[str, BinaryIO], value: Any, meta: dict[str, Any] | None = None) -> None:
|
|
91
150
|
"""Write spherical-map data to NumPy formats based on extension.
|
|
@@ -107,3 +166,15 @@ def write_spherical_map(path: Union[str, BinaryIO], value: Any, meta: dict[str,
|
|
|
107
166
|
return
|
|
108
167
|
|
|
109
168
|
raise ValueError(f"Unsupported spherical-map output extension: {ext}")
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
@mark_stream_supported
|
|
172
|
+
def write_intrinsics(path: Union[str, BinaryIO], value: Any, meta: dict[str, Any] | None = None) -> None:
|
|
173
|
+
"""Write a ``(3, 3)`` intrinsics matrix to a NumPy file."""
|
|
174
|
+
_write_numpy(path, value)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
@mark_stream_supported
|
|
178
|
+
def write_sh_coeffs(path: Union[str, BinaryIO], value: Any, meta: dict[str, Any] | None = None) -> None:
|
|
179
|
+
"""Write ``(N, 3)`` spherical-harmonic coefficients to a NumPy file."""
|
|
180
|
+
_write_numpy(path, value)
|
|
@@ -11,6 +11,8 @@ Supported file extensions:
|
|
|
11
11
|
Return types
|
|
12
12
|
------------
|
|
13
13
|
- **spherical_map** -- ``torch.FloatTensor`` of shape ``(C, H, W)``.
|
|
14
|
+
- **intrinsics** -- ``torch.FloatTensor`` of shape ``(3, 3)``.
|
|
15
|
+
- **sh_coeffs** -- ``torch.FloatTensor`` of shape ``(N, 3)``.
|
|
14
16
|
|
|
15
17
|
Usage::
|
|
16
18
|
|
|
@@ -18,6 +20,8 @@ Usage::
|
|
|
18
20
|
from euler_loading import Modality
|
|
19
21
|
|
|
20
22
|
Modality("/data/my_dataset/spherical_map", loader=generic.spherical_map)
|
|
23
|
+
Modality("/data/my_dataset/intrinsics", loader=generic.intrinsics)
|
|
24
|
+
Modality("/data/my_dataset/sh_coeffs", loader=generic.sh_coeffs)
|
|
21
25
|
"""
|
|
22
26
|
|
|
23
27
|
from __future__ import annotations
|
|
@@ -61,6 +65,22 @@ def _load_numpy(path: Union[str, BinaryIO]) -> np.ndarray:
|
|
|
61
65
|
return arr.astype(np.float32)
|
|
62
66
|
|
|
63
67
|
|
|
68
|
+
def _write_numpy(path: Union[str, BinaryIO], value: Any) -> None:
|
|
69
|
+
"""Write an array to ``.npy`` or ``.npz`` based on extension."""
|
|
70
|
+
ensure_parent(path)
|
|
71
|
+
ext = os.path.splitext(_get_name(path))[1].lower()
|
|
72
|
+
arr = to_numpy(value).astype(np.float32)
|
|
73
|
+
|
|
74
|
+
if ext == _NPY_EXTENSION:
|
|
75
|
+
np.save(path, arr)
|
|
76
|
+
return
|
|
77
|
+
if ext == _NPZ_EXTENSION:
|
|
78
|
+
np.savez_compressed(path, data=arr)
|
|
79
|
+
return
|
|
80
|
+
|
|
81
|
+
raise ValueError(f"Unsupported output extension: {ext}")
|
|
82
|
+
|
|
83
|
+
|
|
64
84
|
# ---------------------------------------------------------------------------
|
|
65
85
|
# Public loaders
|
|
66
86
|
# ---------------------------------------------------------------------------
|
|
@@ -86,6 +106,47 @@ def spherical_map(path: Union[str, BinaryIO], meta: dict[str, Any] | None = None
|
|
|
86
106
|
# ---------------------------------------------------------------------------
|
|
87
107
|
|
|
88
108
|
|
|
109
|
+
@modality_meta(
|
|
110
|
+
modality_type="intrinsics",
|
|
111
|
+
dtype="float32",
|
|
112
|
+
shape="3x3",
|
|
113
|
+
file_formats=[".npy", ".npz"],
|
|
114
|
+
)
|
|
115
|
+
def intrinsics(path: Union[str, BinaryIO], meta: dict[str, Any] | None = None) -> torch.Tensor:
|
|
116
|
+
"""Load a camera intrinsics matrix as a ``(3, 3)`` float32 tensor.
|
|
117
|
+
|
|
118
|
+
The file is expected to contain a ``(3, 3)`` array::
|
|
119
|
+
|
|
120
|
+
[[fx, 0, cx],
|
|
121
|
+
[ 0, fy, cy],
|
|
122
|
+
[ 0, 0, 1]]
|
|
123
|
+
"""
|
|
124
|
+
arr = _load_numpy(path)
|
|
125
|
+
return torch.from_numpy(arr).contiguous()
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
@modality_meta(
|
|
129
|
+
modality_type="sh_coeffs",
|
|
130
|
+
dtype="float32",
|
|
131
|
+
shape="NC",
|
|
132
|
+
file_formats=[".npy", ".npz"],
|
|
133
|
+
)
|
|
134
|
+
def sh_coeffs(path: Union[str, BinaryIO], meta: dict[str, Any] | None = None) -> torch.Tensor:
|
|
135
|
+
"""Load spherical-harmonic coefficients as an ``(N, 3)`` float32 tensor.
|
|
136
|
+
|
|
137
|
+
*N* is the number of SH basis functions (e.g. 15 for degree-3 SH with
|
|
138
|
+
the constant term removed). Each row is a 3-vector (one per spatial
|
|
139
|
+
dimension).
|
|
140
|
+
"""
|
|
141
|
+
arr = _load_numpy(path)
|
|
142
|
+
return torch.from_numpy(arr).contiguous()
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
# ---------------------------------------------------------------------------
|
|
146
|
+
# Writers
|
|
147
|
+
# ---------------------------------------------------------------------------
|
|
148
|
+
|
|
149
|
+
|
|
89
150
|
@mark_stream_supported
|
|
90
151
|
def write_spherical_map(path: Union[str, BinaryIO], value: Any, meta: dict[str, Any] | None = None) -> None:
|
|
91
152
|
"""Write spherical-map data to NumPy formats based on extension."""
|
|
@@ -101,3 +162,15 @@ def write_spherical_map(path: Union[str, BinaryIO], value: Any, meta: dict[str,
|
|
|
101
162
|
return
|
|
102
163
|
|
|
103
164
|
raise ValueError(f"Unsupported spherical-map output extension: {ext}")
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
@mark_stream_supported
|
|
168
|
+
def write_intrinsics(path: Union[str, BinaryIO], value: Any, meta: dict[str, Any] | None = None) -> None:
|
|
169
|
+
"""Write a ``(3, 3)`` intrinsics matrix to a NumPy file."""
|
|
170
|
+
_write_numpy(path, value)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
@mark_stream_supported
|
|
174
|
+
def write_sh_coeffs(path: Union[str, BinaryIO], value: Any, meta: dict[str, Any] | None = None) -> None:
|
|
175
|
+
"""Write ``(N, 3)`` spherical-harmonic coefficients to a NumPy file."""
|
|
176
|
+
_write_numpy(path, value)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/cpu/generic_dense_depth.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{euler_loading-2.0.0 → euler_loading-2.1.0}/euler_loading/loaders/gpu/generic_dense_depth.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|