0
$\begingroup$

So I have created a CNN for image classification, and I train and test it with two datasets. One contains 9,339 images and the other 9,100 images. The first model which I designed gave an accuracy of 94% on the first dataset (with 9,339 images) and 86% on the other (with 9,100 images).

This is the code for the model:

detect_model.add(Conv2D(16, kernel_size=(3, 3), activation='relu', input_shape=(64,64,3)))
detect_model.add(MaxPooling2D(pool_size=(2, 2)))
detect_model.add(Conv2D(32, (3, 3), activation='relu'))
detect_model.add(MaxPooling2D(pool_size=(2, 2)))
detect_model.add(Dropout(0.25))
detect_model.add(Flatten())
detect_model.add(Dense(128, activation='relu'))
detect_model.add(Dropout(0.25))
detect_model.add(Dropout(0.5))
detect_model.add(Dense(50, activation='relu'))
detect_model.add(Dense(num_classes, activation='softmax'))
detect_model.compile(loss='categorical_crossentropy', optimizer = 'adam', metrics=['accuracy'])

I was very impressed with the results on the first dataset in particularly. I am trying to improve the accuracy now and have tried many things, but none of them have improved the accuracy:

  1. Adding BatchNormalization layers after the activation layers

BatchNormalization doesn't help. It trains the model much faster but gives me a high training accuracy but low validation accuracy after every epoch ...

  1. Changing the epoch from 10 to 15

The model slows down in training and validation accuracy scores after about the seventh or eighth epoch and still produces the same results on the second dataset (I haven't tried doing this on the first dataset)

  1. Changing the filters from 16 to 32 and higher in subsequent conv2d layers.

The model still produces the same accuracy on the first and second dataset.

  1. Changing drop out rates

Still no change

  1. Adding more depth (add more conv2d and max-pooling layers with more filters, still don't seem to like this)

Has anyone got any suggestions for me? Any clear and helpful information will definitely be upvoted and, of course, appreciated.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.