'error using ImageDataGenerator,flow_from_dataframe where y_col is a list

I am trying to train a model to learn to generate bounding boxes. To that end I have created a dataframe of the form show below. The values in the xmin,ymin, xmax, ymax are integers

                                       filepaths labels  xmin  ymin  xmax  ymax
0  C:\Temp\whales\test_images\000110707af0ba.jpg  whale    25    81   183   118
1  C:\Temp\whales\test_images\0006287ec424cb.jpg  whale    65   154   114   176
2  C:\Temp\whales\test_images\000809ecb2ccad.jpg  whale    77   118   156   144
3  C:\Temp\whales\test_images\00098d1376dab2.jpg  whale     9    61   220   176
4  C:\Temp\whales\test_images\000b8d89c738bd.jpg  whale     3    12   223   222

The values in xmin, ymin, xmax, ymax are integers. I then try to create a train generator from the data frame with

train_gen=gen.flow_from_dataframe(train_df,x_col='filepaths', ycol=['xmin','ymin', 'xmax','ymax'],                              
                                  target_size=img_size,color_mode='rgb',
                                  class_mode='multi_output', batch_size=batch_size, shuffle=True, 
                                  seed=123)

Executing this code throws an error shown below

TypeError: If class_mode="multi_output", y_col must be a list. Received str.

I have read all the similar questions but found no solution. Also read documentation in detail but have not solved he problem. Looks to me like y_col is a list as the documentation specifies. I also tried using above code with class_mode='raw'. That throws an error

KeyError: 'class'

I am using tensorflow 2.4.0 and python 3.7. Any help would be most appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source