Skip to content

cachedimageloader

cachedimageloader

Module for RemoteCachedImageLoader

Classes

RemoteDiskCacheImageLoader

RemoteDiskCacheImageLoader(
    storage,
    cache_dir="./image_cache",
    working_dir=None,
    output_dtype=np.uint8,
)

Bases: ImageLoader

Loads and caches remote images on the disk

Source code in niceml/data/dataloaders/cachedimageloader.py
def __init__(
    self,
    storage: StorageInterface,
    cache_dir: str = "./image_cache",
    working_dir: Optional[str] = None,
    output_dtype=np.uint8,
):
    self.storage = storage
    self.working_dir = working_dir
    self.cache_dir = cache_dir
    self.output_dtype = output_dtype

RemoteDiskCacheImageLoaderFactory

RemoteDiskCacheImageLoaderFactory(
    cache_dir="./image_cache",
)

Bases: ImageLoaderFactory

Creates RemoteDiskCacheImageLoader

Source code in niceml/data/dataloaders/cachedimageloader.py
def __init__(self, cache_dir: str = "./image_cache"):
    self.cache_dir = cache_dir
Functions
create_image_loader
create_image_loader(storage, working_dir)

Creates RemoteDiskCacheImageLoader

Source code in niceml/data/dataloaders/cachedimageloader.py
def create_image_loader(
    self, storage: StorageInterface, working_dir: str
) -> ImageLoader:
    """Creates RemoteDiskCacheImageLoader"""
    return RemoteDiskCacheImageLoader(storage, self.cache_dir)