Keras next(); what does (2, 256, 128, 128, 3) mean
Keras generator returns a Tuple for data and label. So is that 2.
First you should unpack it with a tuple then use image and labels.

yielding tuples of (x, y) where x is a numpy array containing a batch of images with shape (batch_size, *target_size, channels) and y is a numpy array of corresponding labels

img, labels = traindata.next()
img.shape, labels.shape

Output - ((16, 224, 224, 3), (16, 2))
We are also supposed to return a Tuple of batches of images/labels in case we build a custom generator for Keras.