How to rewrite Dataset to load a pair of data

The input of my model is sequence data(saved as .txt), and the label is Image(saved as .png). I don’t know how load them at the same time and ensure that they correspond one to one.

It’s a bit hard to help here, as we also don’t know how these files correspond to each other. :stuck_out_tongue:

Generally, the just needs a method to load a single sample.
This can be a plain Python function, which would return tensors.

I would recommend to start with this plain Python method and try to load each sample given an index.
Based on your description I guess you could use the file names to load the pairs or create any lookup table such as a list of tuples containing the file paths to the data and label.
Once your method can load a single sample and return the tensors, you could just paste it into the Dataset.__getitem__ method.