ERROR:
1. AttributeError Traceback (most recent call last) 2. <ipython-input-6-9b77ac20aa23> in <module>() 3. 1 # Print the `images` dimensions 4. ----> 2 print(images.ndim) 5. 3 6. 4 # Print the number of `images`'s elements 7. 5 print(images.size) 8. 9. AttributeError: 'list' object has no attribute 'ndim' 10.
Solution:
It tried to get shape of input by reading ndim
attribute of numpy array and failed.
Just simply transform it using np.array
:
1. import numpy as np 2. ... 3. images=np.array(images) 4. labels=np.array(labels)
AIEarth是一个由众多领域内专家博主共同打造的学术平台,旨在建设一个拥抱智慧未来的学术殿堂!【平台地址:https://devpress.csdn.net/aiearth】 很高兴认识你!加入我们共同进步!