【发布时间】:2019-12-20 21:55:23
【问题描述】:
我正在做一个皮肤癌检测算法。问题是我有 2635 个 224 x 224 像素的 RGB 图像。数据增强后,我得到 23715 张图像(train_data)。
我的问题是我得到了这个错误 --> ValueError: cannot reshape array of size 23715 into shape (224,224,3)
这是我的代码:
X = np.array([i[0] for i in train_data]).reshape(-1, IMG_SIZE, IMG_SIZE, 3)
Y = [i[1] for i in train_data]
test_x = np.array([i[0] for i in test_data]).reshape(-1, IMG_SIZE, IMG_SIZE, 3)
test_y = [i[1] for i in test_data]
model.fit({'input': X}, {'targets': Y}, n_epoch=10, shuffle=True, validation_set=({'input': test_x}, {'targets': test_y}),
snapshot_step=500, show_metric=True, run_id=MODEL_NAME)
我应该怎么做才能解决这个问题?在互联网上我发现了类似的错误,但我仍然无法修复它。
【问题讨论】:
-
你能展示
train_data的结构吗? -
training_data.append([np.array(img), np.array(label)])
-
每个
img的形状是什么? -
每张图片的形状为--> (224, 224, 3)
-
请编辑您的问题并在底部添加输出