无法重塑64号阵列的形状(28,28)

问题描述 投票:-1回答:2

无法使用sklean重新整形mnist数据集中的图像这是我的代码的起始部分只是加载数据

some_digit  =   X[880] 
some_digit_image = some_digit.reshape(28,   28)

错误部分

ValueError                                Traceback (most recent call last)
<ipython-input-15-4d618bdb57bc> in <module>
      1 some_digit = X[880]
----> 2 some_digit_image = some_digit.reshape(28,28)

ValueError: cannot reshape array of size 64 into shape (28,28)

python-3.x image machine-learning reshape mnist
2个回答
1
投票

您只能将其重塑为8,8阵列。 8×8 = 64个


0
投票

尝试:

some_digit  =   X[880] 
some_digit_image = some_digit.reshape(8,   8)
© www.soinside.com 2019 - 2024. All rights reserved.