Skip to content

FsImageNetLikeReader

FsImageNetLikeReader class

dlf.data_generators.fs_imagenet_like_reader.FsImageNetLikeReader(
    path, is_simclr=False, categorical_labels=False, preprocess_list=None, shuffle=True, shuffle_buffer=100
)

A data generator which reads imagenet like file structures

- folder
    - folder class1
        - file 1
        - file 2
        - ...
    - folder class2
        - file 1
        - file 2
        - ...
    - ....

Aliases

  • FsImageNetLikeReader
  • fs_imagenet_like_reader

Arguments

  • path: str. glob pattern to find images
  • is_simclr: bool. If true, for each image a replicat with additional augmentation is generated. Defaults to False.
  • categorical_labels: bool. If true, labes are one-hot encoded. Defaults to False.
  • preprocess_list: dict. Dictionary where the value describes a preprocessing method and the values are the arguments. Defaults to None.
  • shuffle_buffer: int. Size of shuffle buffer. For details check: tf.data.Dataset. Defaults to 2000.

Raises

  • FileNotFoundError: If path is not valid

YAML Configuration

input_reader:
    training_reader:
        name: fs_imagenet_like_reader
        path: /mnt/data/datasets/openimages/semisupervised/filtered_62/train/**/*.jpg
        categorical_labels: True
        is_simclr: True
        preprocess_list:
        h_flip:
        color_distortion:
            s: 1.0
            color_jitter_probability: 0.5
            color_drop_probability: 0.3
        resize:
            width: 224
            height: 224