希望能从你们中那些对角角有经验的人那里得到一两点建议。这是我的第一次牛仔竞技,而且野马在拼命地挣扎!
我有预处理的肺图像和提取48x48x48毫米立方体阵列代表像素在感兴趣区域(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)谢谢!
发布于 2017-03-28 00:00:07
这个错误说Keras需要一个数组,但是您给它一个数组列表。
洗牌后,试着:
X_cubes = np.array(X_cubes)
Y_labels = np.array(X_cubes)还请注意,您正在对X和Y进行洗牌,但只将改组后的Y交给Keras,给出未洗牌的X。我想这不是你想要的。
https://stackoverflow.com/questions/43057780
复制相似问题