nicetoolbox.evaluation.data.loaders

Data loaders for evaluation module, including lazy loading and caching.

Classes

AnnotationLoader

Lazily loads a single ground truth data slice from a NPZ archive.

PredictionLoader

Lazily loads a single prediction data slice from a large NPZ file.

class nicetoolbox.evaluation.data.loaders.AnnotationLoader(path_to_annotations: Path)[source]

Lazily loads a single ground truth data slice from a NPZ archive. Uses an LRU cache to optimize access to internal arrays.

close_files()[source]

Clears the LRU cache.

load_full_array(data_key: str) ndarray | None[source]

Loads a full data array from within the single annotation NPZ.

Parameters:

data_key – The key for the data array within the npz file (e.g.,

Returns:

The full numpy array or None if the key does not exist.

class nicetoolbox.evaluation.data.loaders.PredictionLoader[source]

Lazily loads a single prediction data slice from a large NPZ file. Caches open file handles for efficiency.

close_files()[source]

Clears the cache of loaded arrays.

load_full_array(path: Path, data_key: str) ndarray[source]

Loads a full data array from an NPZ file using bounded cache. :param path: Path to the .npz file. :param data_key: The key for the data array within the npz file (e.g., ‘2d’, ‘3d’).

Returns:

The full numpy array.