我面临有关输入形状的问题。在 model.fit() 期间,我得到一个值错误
ValueError: Error when checking input: expected conv2d_4_input to have 4 dimensions, but got array
with shape (58, 195, 1)
num_columns=195 #features
train_x = train_x.reshape(train_x.shape[0], num_columns,1)#array of size 11252. i.e 58*195
test_x = test_x.reshape(test_x.shape[0], num_columns,1)#array size 18*195
valid_x=valid_x.reshape(valid_x.shape[0], num_columns,1) #array size 22*195
model=Sequential()
model.add(Conv2D(32, kernel_size=(3, 3),activation='relu',input_shape=(58,195,1)))
model.add(Conv2D(64, (3, 3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.25))
model.add(Flatten())
model.add(Dense(128, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(num_labels, activation='softmax'))
有没有办法解决这个问题?我还尝试将数据重塑为 (-1,58,195,1)。它没有用