AttributeError: 'list' object has no attribute 'ndim'
程序员文章站
2022-03-26 23:20:05
...
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)
上一篇: 3D场景角色血条/状态条
下一篇: UGUI实现血条跟随
推荐阅读
-
python编程排除163邮箱发送邮件报错(AttributeError: ‘tuple‘ object has no attribute ‘encode‘)
-
python编程排除163邮箱发送邮件报错(AttributeError: ‘tuple‘ object has no attribute ‘encode‘)
-
AttributeError: module ‘community‘ has no attribute ‘best_partition‘ 问题解决方法
-
【python】解决AttributeError: module ‘scipy.misc‘ has no attribute ‘toimage‘问题
-
【Tensorflow】Linux下Tensorflow报错:AttributeError: module ‘tensorflow‘ has no attribute ‘xxxx‘
-
AttributeError: 'module' object has no attribute 'main'
-
AttributeError: module 'sklearn' has no attribute 'linear_model'
-
解决Keras报错AttributeError: 'NoneType' object has no attribute 'inbound_nodes'
-
解决'DataFrame' object has no attribute 'sort'
-
‘MyObject‘ object has no attribute ‘***‘