KerasSequence#

class ctlearn.core.keras.sequence.KerasSequence(DLDataReader, indices, tasks, batch_size=64, random_seed=None, sort_by_intensity=False, stack_telescope_images=False, **kwargs)[source]#

Bases: PyDataset

Generates batches for Keras application.

DLDataLoader is a data loader class that inherits from ~keras.utils.Sequence. It is designed to handle and load data for deep learning models in a batch-wise manner.

Attributes:#

data_readerDLDataReader

An instance of DLDataReader to read the input data.

indiceslist

List of indices to specify the data to be loaded.

taskslist

List of tasks to be performed on the data to properly set up the labels.

batch_sizeint

Size of the batch to load the data.

random_seedint, optional

Whether to shuffle the data after each epoch with a provided random seed.

Methods:#

__len__():

Returns the number of batches per epoch.

on_epoch_end():

Updates indices after each epoch if random seed is provided.

__getitem__(index):

Generates one batch of data using _get_mono_item(index) or _get_stereo_item(index).

_get_mono_item(index):

Generates one batch of monoscopic data.

_get_stereo_item(index):

Generates one batch of stereoscopic data.

Methods Summary

on_epoch_end()

Updates indices after each epoch.

Methods Documentation

on_epoch_end()[source]#

Updates indices after each epoch. If a random seed is provided, the indices are shuffled.

This method is called at the end of each epoch to ensure that the data is shuffled if the shuffle attribute is set to True. This helps in improving the training process by providing the model with a different order of data in each epoch.