Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问如何解决ValueError: cannot reshape array of size 9907170 into shape (65536,) #61

Open
PingYufeng opened this issue Jan 3, 2020 · 1 comment

Comments

@PingYufeng
Copy link

源码:
def generateData(batch_size,data=[]):
#print 'generateData...'
while True:
train_data = []
train_label = []
batch = 0
for i in (range(len(data))):
url = data[i]
batch += 1
img = load_img(filepath + 'src/' + url)
img = img_to_array(img)
train_data.append(img)
label = load_img(filepath + 'label/' + url, grayscale=True)
label = img_to_array(label).reshape((img_w*img_h,))
print(label.shape)
train_label.append(label)

报错:
  File "E:\RiseFile\Deeplearning\Satellite-Segmentation-master\segnet\segnet_train.py", line 78, in generateData
    label = img_to_array(label).reshape((img_w*img_h,))
ValueError: cannot reshape array of size 9907170 into shape (65536,)

img_to_array后无法reshape,是不是写错了?在windows下运行的,请问如何解决?
@JoernZheng
Copy link

可以复现的,你这个估计是导错图片了,这个错误是大小不匹配。
你在file填写的地址应该是256*256这个切割后大小的图片,而不是原始图片。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants