Error: The model expects 3 input arrays, but only receives one array. Found: array with shape (10, 20, 50, 50, 1)
main_model = Sequential()
main_model.add(Conv3D(32, 3, 3,3, input_shape=(20,50,50,1)))'
main_model.add(Activation('relu'))
main_model.add(MaxPooling3D(pool_size=(2, 2,2))
main_model.add(Conv3D(64, 3, 3,3))
main_model.add(Activation('relu'))
main_model.add(MaxPooling3D(pool_size=(2, 2,2)))
main_model.add(Dropout(0.8))
main_model.add(Flatten())
#lower features model - CNN2
lower_model1 = Sequential()
lower_model1.add(Conv3D(32, 3, 3,3, input_shape=(20,50,50,1)))
lower_model1.add(Activation('relu'))
lower_model1.add(MaxPooling3D(pool_size=(2, 2,2)))
lower_model1.add(Dropout(0.8))
lower_model1.add(Flatten())
#lower features model - CNN3
lower_model2 = Sequential()
lower_model2.add(Conv3D(32, 3, 3,3, input_shape=(20,50,50,1)))
lower_model2.add(Activation('relu'))
lower_model2.add(MaxPooling3D(pool_size=(2, 2,2)))
lower_model2.add(Dropout(0.8))
lower_model2.add(Flatten())
merged_model = Merge([main_model, lower_model1,lower_model2],mode='concat')
final_model = Sequential()
final_model.add(merged_model)
final_model.add(Dense(1024,init='normal'))
final_model.add(Activation('relu'))
final_model.add(Dropout(0.5))
final_model.add(Dense(2,init='normal'))
final_model.add(Activation('softmax'))
final_model.compile(loss='binary_crossentropy', optimizer='Adam', metrics=
['accuracy'])
train=train_data[-10:]
test=train_data[-2:]
X = np.array([i[0] for i in train]).reshape(-1,20,50,50,1)
Y = [i[1] for i in train]
test_x = np.array([i[0] for i in test]).reshape(-1,20,50,50,1)
test_y = [i[1] for i in test]
final_model.fit(np.array(X),np.array(Y),validation_data=
(np.array(test_x),np.array(test_y)),batch_size=batch_size,nb_epoch =
nb_epoch,validation_split=0.2,shuffle=True,verbose=1)
I am using 50x50 images contained in 20 chunks and that y my numpy array is 20x50x50 1st and 2nd models I am using sequential model for 3d cnn multiscale network ... i dont know i get this kind of result
+3
source to share
No one has answered this question yet
See similar questions:
or similar: