title: UnidentifiedImageError: cannot identify image file
body: <p>Hello I am training a model with TensorFlow and Keras, and the dataset was downloaded from <a href="https://www.microsoft.com/en-us/download/confirmation.aspx?id=54765" rel="noreferrer">https://www.microsoft.com/en-us/download/confirmation.aspx?id=54765</a></p>
  <p>This is a zip folder that I split in the following directories:</p>
  <pre><code>.
  ├── test
  │   ├── Cat
  │   └── Dog
  └── train
      ├── Cat
      └── Dog
  </code></pre>
  <p>Test.cat and test.dog have each folder 1000 jpg photos, and train.cat and traing.dog have each folder 11500 jpg photos.</p>
  <p>The load is doing with this code:</p>
  <pre><code>batch_size = 16
  
  # Data augmentation and preprocess
  train_datagen = ImageDataGenerator(rescale=1./255,
      shear_range=0.2,
      zoom_range=0.2,
      horizontal_flip=True,
      validation_split=0.20) # set validation split
  
  # Train dataset
  train_generator = train_datagen.flow_from_directory(
      'PetImages/train',
      target_size=(244, 244),
      batch_size=batch_size,
      class_mode='binary',
      subset='training') # set as training data
  
  # Validation dataset
  validation_generator = train_datagen.flow_from_directory(
      'PetImages/train',
      target_size=(244, 244),
      batch_size=batch_size,
      class_mode='binary',
      subset='validation') # set as validation data
  
  test_datagen = ImageDataGenerator(rescale=1./255)
  # Test dataset
  test_datagen = test_datagen.flow_from_directory(
      'PetImages/test')
  </code></pre>
  <p>THe model is training with the following code:</p>
  <pre><code>history = model.fit(train_generator,
                      validation_data=validation_generator,
                      epochs=5)
  </code></pre>
  <p>And i get the following input:</p>
  <pre><code>Epoch 1/5
  1150/1150 [==============================] - ETA: 0s - loss: 0.0505 - accuracy: 0.9906
  </code></pre>
  <p>But when the epoch is in this point I get the following error:</p>
  <blockquote>
  <p>UnidentifiedImageError: cannot identify image file &lt;_io.BytesIO object
  at 0x7f9e185347d0&gt;</p>
  </blockquote>
  <p>How can I solve this, in order to finish the training?</p>
  <p>Thanks</p>