Category: 08. Data loading

  • Audio data loading

    audio_dataset_from_directory function Generates a tf.data.Dataset from audio files in a directory. If your directory structure is: Then calling audio_dataset_from_directory(main_directory, labels=’inferred’) will return a tf.data.Dataset that yields batches of audio files from the subdirectories class_a and class_b, together with labels 0 and 1 (0 corresponding to class_a and 1 corresponding to class_b). Only .wav files are supported at this time. Arguments Returns A tf.data.Dataset object. Rules regarding labels format:

  • Text data loading

    text_dataset_from_directory function Generates a tf.data.Dataset from text files in a directory. If your directory structure is: Then calling text_dataset_from_directory(main_directory, labels=’inferred’) will return a tf.data.Dataset that yields batches of texts from the subdirectories class_a and class_b, together with labels 0 and 1 (0 corresponding to class_a and 1 corresponding to class_b). Only .txt files are supported at this time. Arguments Returns A tf.data.Dataset object. Rules regarding labels format:

  • Timeseries data loading

    timeseries_dataset_from_array function Creates a dataset of sliding windows over a timeseries provided as array. This function takes in a sequence of data-points gathered at equal intervals, along with time series parameters such as length of the sequences/windows, spacing between two sequence/windows, etc., to produce batches of timeseries inputs and targets. Arguments Returns A tf.data.Dataset instance. If targets was passed, the…

  • Image data loading

    image_dataset_from_directory function Generates a tf.data.Dataset from image files in a directory. If your directory structure is: Then calling image_dataset_from_directory(main_directory, labels=’inferred’) will return a tf.data.Dataset that yields batches of images from the subdirectories class_a and class_b, together with labels 0 and 1 (0 corresponding to class_a and 1 corresponding to class_b). Supported image formats: .jpeg, .jpg, .png, .bmp, .gif. Animated gifs are truncated to the first frame. Arguments Returns A tf.data.Dataset object. Rules regarding labels format:…