【发布时间】:2017-03-27 22:54:40
【问题描述】:
如果您有 keras 方面的经验,我们将不胜感激。这是我的第一次牛仔竞技表演,野马的表现非常强劲!
我对肺部图像进行了预处理,并提取了 48x48x48mm 立方阵列,表示感兴趣区域中的像素 (dtype=uint8)。我已将这 8504 个立方体存储在 *.npy 文件中。
当我将立方体列表作为训练数据传递给模型时,遇到以下错误:
“检查模型输入时出错:您传递给模型的 Numpy 数组列表不是模型预期的大小。预计会看到 1 个数组,但得到了以下 8504 个数组列表”。
我可能做错了什么?
相关代码:
# input layer of model
c3d_model.add(Convolution3D(64, 8,8,8, activation='relu', border_mode='same',
name='conv1', input_shape=(48, 48, 48, 1)))
# other layers ....
# get_data()
cubes = [np.load(os.path.join(CUBES_DIR, cubefile)) for cubefile in cubefiles] # cubefiles is a list of 8504 filenames
# shuffle data and labels to avoid skewing the training
ix = [i for i in range(len(labels))]
shuffle(ix)
X_cubes = [cubes[i] for i in ix]
Y_labels = [labels[i] for i in ix]
# and here's where I run aground
model.fit(cubes, Y_labels, validation_split=0.30, nb_epoch=1, batch_size=32, callbacks=[save_weights], verbose=2)
谢谢!
【问题讨论】: