ERROR:

AttributeError                            Traceback (most recent call last)
<ipython-input-6-9b77ac20aa23> in <module>()
      1 # Print the `images` dimensions
----> 2 print(images.ndim)
      3 
      4 # Print the number of `images`'s elements
      5 print(images.size)

AttributeError: 'list' object has no attribute 'ndim'

Solution:

It tried to get shape of input by reading ndim attribute of numpy array and failed.

Just simply transform it using np.array:

import numpy as np
...
images=np.array(images)
labels=np.array(labels)