----------------------------------------------< /p>
import IPython.display as ipd
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import librosa
from tqdm import tqdm
from sklearn.preprocessing import StandardScaler
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation
from keras.optimizers import Adam
model = Sequential()
model.add(Dense(186, input_shape=(186,), activation = 'relu'))
model.add(Dense(256, activation = 'relu'))
model.add(Dropout(0.6))
model.add(Dense(128, activation = 'relu'))
model.add(Dropout(0.5))
model.add(Dense(10, activation = 'softmax'))
model.compile(loss='categorical_crossentropy', metrics=['accuracy'], optimizer='adam')
history = model.fit(X_train, y_train, batch_size=64, epochs=30)
答案 0 :(得分:0)
您的 X_train
的形状是 (None,180)
,但您将形状 (None,186)
输入到密集层。
改变
model.add(Dense(186, input_shape=(186,), activation = 'relu'))
到:
model.add(Dense(186, input_shape=(180,), activation = 'relu'))