So you want your dataset to output two images (one from the training dataset and one from the testing dataset) with the same index, and output the index as well?
I thought that you want to have a huge dataset containing both training and testing data, and you only output one image either from training or testing one time.