I use a CNN model and I am working with the MNIST dataset. However, the model's performance is unexpectedly low - I am getting an accuracy of just 0.0664.
我使用CNN模型,我正在使用MNIST数据集。然而,该模型的性能出乎意料地低-我得到的准确率仅为0.0664。
Below is the code for my model:
以下是我的模型的代码:
model = Sequential()
model.add(Conv2D(32, kernel_size=(5, 5), strides=(1, 1), padding="same", kernel_initializer='glorot_uniform', input_shape=(64, 64, 1), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2), padding="same"))
model.add(Flatten())
model.add(Dense(1024, activation='relu'))
model.add(Dense(num_classes, activation='softmax'))
model.compile(optimizer = Adam(learning_rate = 0.01), loss = 'categorical_crossentropy', metrics = ['accuracy'])
model1 = model.fit(x_train, y_train,batch_size=128, epochs=20)
How I can improve the performance?
我如何才能提高性能?
更多回答
优秀答案推荐
A potential improvement could come from reducing the size of your Dense layer. Try minimizing the number of units in your Dense layer to 64 instead of 1024. Update your model with:
一个潜在的改进可能来自于减小致密层的大小。尝试将密集层中的单元数量从1024个减少到64个。使用以下内容更新您的模型:
model.add(Dense(64, activation='relu'))
更多回答
我是一名优秀的程序员,十分优秀!