title: ImageDataGenerator for multi task output in Keras using flow_from_directory
body: <p>I am creating a multitask CNN model and I have two different classification properties (one with 10 classes, 2nd with 5 classes) and my directory structure looks like this:</p>
  <blockquote>
  <pre><code>    -Train
         - image1.jpg
            ...
         - imageN.jpg
     
      -Test
         - image1.jpg
               ...
         - imageN.jpg
  
      -Vald
         - image1.jpg
            ...
         - imageN.jpg
  </code></pre>
  </blockquote>
  <p>trainlabel is a dataframe containing, Image, PFRType, FuelType columns</p>
  <p>I am trying to use flow_from_dataframe and my generators are:</p>
  <pre><code>trainGen = ImageDataGenerator()
  trainGenDf = trainGen.flow_from_dataframe(trainLabel,
                                           directory = '../MTLData/train/',
                                           x_col = &quot;Image&quot;,y_col=[&quot;PFRType&quot;,&quot;FuelType&quot;],
                                           class_mode='multi_ouput',
                                           target_size=(224,224),
                                           batch_size=32)
  </code></pre>
  <p><strong>The error I get is:
  Error when checking target: expected PFR to have shape (10,) but got array with shape (1,)</strong></p>
  <p>PFR is a subtask layer with 10 classes output</p>
  <p>Here is model diagram.
  <a href="https://i.stack.imgur.com/GeDxX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GeDxX.png" alt="enter image description here" /></a></p>