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

匿名 (未验证) 提交于 2019-12-03 01:46:01

问题:

Not able to reshape the image in mnist dataset using sklean This is the starting portion of my code just load the data

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

ERROR PART

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)  

回答1:

You can only reshape it into a 8, 8 array. 8x8=64



回答2:

try:

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


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!