title: Tensorflow: Too many values to unpack error when loading data
body: <p>I am learning machine learning and I am trying to do image classification. I am at the point to define my train and test data from the directory, but I am getting an <a href="https://i.stack.imgur.com/REjfS.png" rel="nofollow noreferrer">error</a>:</p>
  <blockquote>
  <p>ValueError: too many values to unpack (expected 2).</p>
  </blockquote>
  <p>Can anyone help me fix this issue?</p>
  <pre class="lang-py prettyprint-override"><code>import tensorflow as tf
  from tensorflow.keras import datasets, layers, models
  import matplotlib.pyplot as plt
  import pathlib
  
  data_dir = &quot;C:/Users/efsol/OneDrive/Classification&quot;
  data_dir = pathlib.Path(data_dir)
  image_count = len(list(data_dir.glob('*/*.jpg')))
  print(image_count)
  data_dir.is_dir()
  
  (train_images, train_labels), (test_images, test_labels) = tf.keras.preprocessing.image_dataset_from_directory(data_dir)
  
  # Normalize pixel values to be between 0 and 1
  train_images, test_images = train_images / 255.0, test_images / 255.0
  </code></pre>