title: Error in input/output shape for image classification in TensorFlow
body: <p>I am getting the following error:</p>
  
  <p><strong>ValueError: Error when checking input: expected flatten_input to have 4 dimensions, but got array with shape (80, 80, 3)</strong></p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/ubuntu/capstone/TFcaps.py", line 163, in &lt;module&gt;
      validation_steps=total_val // batch_size
    File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training.py", line 819, in fit
      use_multiprocessing=use_multiprocessing)
    File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training_v2.py", line 235, in fit
      use_multiprocessing=use_multiprocessing)
    File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training_v2.py", line 593, in _process_training_inputs
      use_multiprocessing=use_multiprocessing)
    File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training_v2.py", line 706, in _process_inputs
      use_multiprocessing=use_multiprocessing)
    File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/data_adapter.py", line 702, in __init__
      x = standardize_function(x)
    File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training_v2.py", line 684, in standardize_function
      return dataset.map(map_fn, num_parallel_calls=dataset_ops.AUTOTUNE)
    File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 1591, in map
      self, map_func, num_parallel_calls, preserve_cardinality=True)
    File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 3926, in __init__
      use_legacy_function=use_legacy_function)
    File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 3147, in __init__
      self._function = wrapper_fn._get_concrete_function_internal()
    File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/eager/function.py", line 2395, in _get_concrete_function_internal
      *args, **kwargs)
    File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/eager/function.py", line 2389, in _get_concrete_function_internal_garbage_collected
      graph_function, _, _ = self._maybe_define_function(args, kwargs)
    File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/eager/function.py", line 2703, in _maybe_define_function
      graph_function = self._create_graph_function(args, kwargs)
    File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/eager/function.py", line 2593, in _create_graph_function
      capture_by_value=self._capture_by_value),
    File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/func_graph.py", line 978, in func_graph_from_py_func
      func_outputs = python_func(*func_args, **func_kwargs)
    File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 3140, in wrapper_fn
      ret = _wrapper_helper(*args)
    File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 3082, in _wrapper_helper
      ret = autograph.tf_convert(func, ag_ctx)(*nested_args)
    File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/autograph/impl/api.py", line 237, in wrapper
      raise e.ag_error_metadata.to_exception(e)
  ValueError: in converted code:
  
      /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training_v2.py:677 map_fn
          batch_size=None)
      /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training.py:2410 _standardize_tensors
          exception_prefix='input')
      /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training_utils.py:573 standardize_input_data
          'with shape ' + str(data_shape))
  
      ValueError: Error when checking input: expected flatten_input to have 4 dimensions, but got array with shape (80, 80, 3)
  </code></pre>
  
  <p>My model looks like this:</p>
  
  <pre><code>model = tf.keras.Sequential([
      tf.keras.layers.Flatten(input_shape=(80, 80, 3)),
      tf.keras.layers.Dense(128, activation='relu'),
      tf.keras.layers.Dense(4)])
  </code></pre>
  
  <p>And these are my images shape:</p>
  
  <pre><code>Image shape:  (80, 80, 3)
  Label:  [False False  True False]
  &lt;TakeDataset shapes: ((80, 80, 3), (4,)), types: (tf.float32, tf.bool)&gt;
  </code></pre>
  
  <p>This is how I'm compiling the model:</p>
  
  <pre><code>model.compile(optimizer=tf.keras.optimizers.Adam(lr=LR), loss=tf.keras.losses.CategoricalCrossentropy(), metrics=["accuracy"])
  </code></pre>
  
  <p>And this how I'm fitting:</p>
  
  <pre><code>history = model.fit(
      train_data,
      steps_per_epoch=total_train // batch_size,
      epochs=epochs,
      validation_data=val_data,
      validation_steps=total_val // batch_size
  )
  </code></pre>
  
  <p>How can I solve this issue?</p>