It depends a bit on the current structure of your data.
Generally, if you are implementing a custom Dataset, you would need to implement:

the __getitem__(self, index) method, which uses the passed index to load a single “sample” of the dataset
the __len__(self) method, which returns the length of the dataset and thus defines the indices to be sampled from the range [0, self.__len__()]

as well as the __init__ method, if you want, to pass e.g. image paths, tansformations etc.

If your images are all in a single folder and can be loaded sequentially, you could define a window_length in the __init__ and load multiple frames in __getitem__. I assume the target would be a single class index for the complete sequence.
It’s a bit hard to give a good recommendation without knowing your use case.