How to return pd.DataFrame from DataLoader

My CustomDataset returns:
image, target (which is a Pandas DataFrame).

Using the DataLoader throws an error:

TypeError: default_collate: batch must contain tensors, numpy arrays, numbers, dicts or lists; found … Pandas bla

Any clue how to fix this?

If I return target as a normal list, and convert the DataLoader target-Output to pd.Dataframe - the format is pretty strange. Instead of ‘Car’ I get '[‘Car]’

This didn’t happened before I have used the DL.
Any idea how to use the DL with pd.DF as return OR how to fix the format?

– Any help would be appreciated.

batch_size is –and always will be– 1.
collate_fn = None – doesn’t have any effect.

Follow-up is also tracked here. Let me know if transforming the data to tensors would work for your use case.