Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Poor Performance with CNN Model on MNIST Dataset

I am currently a computer science student and for my Machine Learning class, I have been assigned a project. I chose to use a CNN model and I am working with the MNIST dataset. However, I am facing an issue where the model’s performance is unexpectedly low – I am getting an accuracy of just 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'])
print(model.summary())
model1 = model.fit(x_train, y_train,batch_size=128, epochs=20)

I appreciate any suggestions or insights on how I can improve the performance. Thanks in advance!

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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:

model.add(Dense(64, activation='relu'))
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading