Pluggable hyperspectral DataModules (cu3s + COCO, TIFF + paired-PNG) for the Cuvis.AI ecosystem
Project description
cuvis-ai-dataloader
Pluggable hyperspectral DataModules for the cuvis-ai ecosystem.
Overview
cuvis-ai-dataloader ships the concrete hyperspectral DataModules for the
Cuvis.AI ecosystem. A
DataModule is the unit the framework uses for both training and inference: it
bundles the data, the labels, the splits, and the train / val / test /
predict dataloaders.
This single plugin holds every concrete loader, with per-format heavy deps gated
behind optional extras. The cuvis SDK lives only here, behind [cu3s]; no
other Cuvis.AI repo pins it.
Module (data_module_name) |
Reads | Labels | Extra |
|---|---|---|---|
cu3s |
one .cu3s session (or a folder of them) via cuvis |
COCO JSON | [cu3s, coco] |
cu3s_multi |
many .cu3s, one frame per CSV row |
per-day COCO JSON | [cu3s, coco] |
tiff_paired |
a folder of *.tif / *.tiff cubes via tifffile |
paired PNG | [tiff] |
Key points:
- One plugin, three DataModules, per-format heavy deps behind extras
- The
cuvisSDK is isolated here, behind[cu3s] - Composable split selectors over an attributed sample universe
cuvis/tifffile/pycocotoolsimport lazily, so the plugin registers with any subset of extras
Splits
Splits are defined in one of two ways:
- Selectors (
splits.json) is the general mechanism, shared by every module. Composable selectors over an attributed sample universe are resolved into a committablesplits.jsonby theresolve-splitsCLI, then referenced from aDataConfig.splits. - CSV
splitcolumn is specific tocu3s_multi, which is driven by a required CSV manifest (split, cu3s_path, annotation_json, image_id). With noDataConfig.splits, each stage maps straight to thatsplitcolumn; otherwise the CSV rows become the selector universe (andresolve-splits --from-csvturns the CSV into asplits.json).
Installation
uv pip install "cuvis-ai-dataloader[cu3s,coco]" # cu3s + COCO
uv pip install "cuvis-ai-dataloader[tiff]" # TIFF + paired PNG
uv pip install "cuvis-ai-dataloader[all]" # every format
Extras:
cu3s:.cu3ssession reading via thecuvisSDK bindingcoco: COCO-JSON mask labels (pycocotools,scikit-image)tiff: TIFF cube reading (tifffile)all: All formatsdev: Development dependencies
The cu3s extra carries the Windows cuvis-il<3.5.3 pin (the last build with a
win_amd64 wheel).
Cuvis SDK (system install, required for cu3s)
The [cu3s] extra installs the cuvis Python package, but that is only a
binding: the C++ Cuvis SDK must also be installed system-wide, or any
.cu3s read fails at runtime.
macOS not supported. Cuvis SDK ships for Windows and Linux only. On macOS,
.cu3sreads fail at runtime; thetiff_pairedmodule and any numpy / video input still work.
Obtain a build matching the cuvis>=3.5.0 pin for your OS from the
Cuvis SDK download page,
then verify:
uv run python -c "import cuvis; print(cuvis.__version__)"
Usage
Inference (restore-pipeline) selects a module and its params on the CLI:
restore-pipeline \
--pipeline-path X.yaml \
--plugins-dir <this-repo>/configs/plugins \
--data-module cu3s \
--data-arg cu3s_file_path=X.cu3s \
--data-arg annotation_json_path=Y.json
Training (Train / RestoreTrainRun) selects the same module via the yaml
DataConfig:
data:
data_module: cu3s
splits:
train:
- { kind: file_indices, source: X.cu3s, ids: [0, 2, 3] }
val:
- { kind: file_indices, source: X.cu3s, ids: [1, 5] }
batch_size: 4
params:
cu3s_file_path: X.cu3s
annotation_json_path: Y.json
processing_mode: Reflectance
In-process / notebooks construct the DataModule directly and run it through
the Predictor:
from cuvis_ai_dataloader.data import Cu3sDataModule
from cuvis_ai_core.training import Predictor
from cuvis_ai_core.utils.restore import restore_pipeline
pipeline = restore_pipeline("X.yaml", plugins_dirs=[...])
dm = Cu3sDataModule(cu3s_file_path="X.cu3s", batch_size=1)
Predictor(pipeline, dm).predict()
Architecture
Concrete DataModules subclass cuvis_ai_core.data.datamodule.BaseCuvisAIDataModule
and implement validate_params plus the selector hooks enumerate(required_attrs)
(the module's attributed sample universe) and build_dataset_from_refs(refs);
a module that owns its own splits also implements build_stage_dataset(stage).
Per-format cube readers and labelers are internal helpers (data/readers/,
data/labelers/), reused but not a plugin contract. Module-top imports stay free
of heavy deps; cuvis / tifffile / pycocotools / scikit-image load lazily
on first use (data/_extras.py).
Development
uv sync --extra dev
uv run pytest tests/ -v
uv run ruff check cuvis_ai_dataloader/ tests/
uv run ruff format cuvis_ai_dataloader/ tests/
uv run mypy cuvis_ai_dataloader/
Git hooks
Enable the repo's hooks once per clone:
git config core.hooksPath .githooks
- pre-commit:
ruff format+ruff check --fixon staged Python, then re-stages. - pre-push:
ruff format --check,ruff check, docstring coverage (uvx interrogate, ≥95%, configured in[tool.interrogate]), andpytest -m "not slow and not gpu".
Skip a hook for one command with --no-verify.
Contributing
Contributions are welcome. Please:
- Ensure tests pass
- Run ruff format and ruff check
- Keep type hints and update docs as needed
License
Licensed under the Apache License 2.0. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cuvis_ai_dataloader-0.2.0.tar.gz.
File metadata
- Download URL: cuvis_ai_dataloader-0.2.0.tar.gz
- Upload date:
- Size: 135.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8cc3f307cbb65b38eacaea759ab60fe03542a6599bc6786f6e3355236d2c919
|
|
| MD5 |
d6177856742e91742775a5fbf95bd316
|
|
| BLAKE2b-256 |
6e2cff603e7ab7faf900d96e066f46d401e8834e2ce57ee568efb92e514cb36a
|
Provenance
The following attestation bundles were made for cuvis_ai_dataloader-0.2.0.tar.gz:
Publisher:
pypi-release.yml on cubert-hyperspectral/cuvis-ai-dataloader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cuvis_ai_dataloader-0.2.0.tar.gz -
Subject digest:
f8cc3f307cbb65b38eacaea759ab60fe03542a6599bc6786f6e3355236d2c919 - Sigstore transparency entry: 1927272687
- Sigstore integration time:
-
Permalink:
cubert-hyperspectral/cuvis-ai-dataloader@c930b7a5b2c7703fc739df9ca8e3bc9cc162cfb3 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/cubert-hyperspectral
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-release.yml@c930b7a5b2c7703fc739df9ca8e3bc9cc162cfb3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cuvis_ai_dataloader-0.2.0-py3-none-any.whl.
File metadata
- Download URL: cuvis_ai_dataloader-0.2.0-py3-none-any.whl
- Upload date:
- Size: 37.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c539a56040b3b39ffbc4ab65d17d9967e3205e370ed3a6f8f74b465df3c58afa
|
|
| MD5 |
d22eadb824b822c0b4ccf755cf2b7f13
|
|
| BLAKE2b-256 |
7072d194a2599903c9d9213b943d2cd4b6a0605229f5107d5f81b015f3a10389
|
Provenance
The following attestation bundles were made for cuvis_ai_dataloader-0.2.0-py3-none-any.whl:
Publisher:
pypi-release.yml on cubert-hyperspectral/cuvis-ai-dataloader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cuvis_ai_dataloader-0.2.0-py3-none-any.whl -
Subject digest:
c539a56040b3b39ffbc4ab65d17d9967e3205e370ed3a6f8f74b465df3c58afa - Sigstore transparency entry: 1927273569
- Sigstore integration time:
-
Permalink:
cubert-hyperspectral/cuvis-ai-dataloader@c930b7a5b2c7703fc739df9ca8e3bc9cc162cfb3 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/cubert-hyperspectral
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-release.yml@c930b7a5b2c7703fc739df9ca8e3bc9cc162cfb3 -
Trigger Event:
push
-
Statement type: