I don’t know if your dataset has any other issues, but right now the code is failing since a pandas.Series
object is not supported in the used transformations as it does not represent an image type.
Assuming the internal numpy
array represents an image, you could create a PIL.Image
via:
image = PIL.Image.fromarray(series.iloc[idx].to_numpy())
but would of course need to check the shape and dtype
making sure it is indeed a valid image type.