numpy ValueError:无法将输入数组从形状(200,200,3)广播到形状(200,200)

xlpyo6sf  于 2022-12-04  发布在  其他
关注(0)|答案(2)|浏览(378)
dldeef67

dldeef671#

使用了

np.asarray(img_00)

您的图像需要3个通道:(宽度、高度、颜色通道)

ilmyapht

ilmyapht2#

显示类似错误的小示例

In [72]: alist = [np.ones((3,3,3)), np.zeros((3,3))]

In [73]: np.array(alist)
C:\Users\paul\AppData\Local\Temp\ipykernel_7196\2629805649.py:1: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
  np.array(alist)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Input In [73], in <cell line: 1>()
----> 1 np.array(alist)

ValueError: could not broadcast input array from shape (3,3,3) into shape (3,3)

相关问题