Skip to content

imageloader

imageloader

Module for abstract ImageLoader

Classes

ImageLoader

Bases: ABC

Abstract implementation of ImageLoader

Functions
is_image staticmethod
is_image(path)

checks if file from filepath is an image

Source code in niceml/data/dataloaders/interfaces/imageloader.py
@staticmethod
def is_image(path: str) -> bool:
    """checks if file from filepath is an image"""
    img_path = Path(path)
    return img_path.is_file() and img_path.name.split(".")[-1] in [
        "jpg",
        "png",
        "tiff",
        "tif",
        "bmp",
        "jpeg",
    ]