Reputation:
I am implementing flower recognition - the dataset has few types of flowers. Totally the dataset contains about 4000 images
My code -
model = Sequential()
model.add(Conv2D(32, (3, 3), padding='same', input_shape=(32, 32, 3), activation="relu"))
model.add(Conv2D(32, (3, 3), activation="relu"))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.5))
model.add(Conv2D(64, (3, 3), padding='same', activation="relu"))
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(512, activation="relu"))
model.add(Dropout(0.5))
model.add(Dense(5, activation="softmax"))
model.compile(loss='categorical_crossentropy',optimizer='adam',metrics=['accuracy'])
history=model.fit(x_train,y_train,batch_size=64,epochs=7,validation_data=(x_test, y_test),shuffle=True)
From this, I get the accuracy and loss
Then, I need more accuracy. So, I just increase the epochs=30 and the results are
(FOR epochs = 30)
I understand that neural network set random weights so that we get different results. But how can I improve the accuracy. I am new to neural nets. Would greatly appreciate some explanation. Thank you
Upvotes: 0
Views: 2576
Reputation: 2348
I think that you have enough data samples. I recommend you to try the following:
You can also try to increase number of kernels in convolutional layers and reducing the batch size, maybe 32 or 16
Upvotes: 0
Reputation: 141
According to the training and validation metrics, the model seem to have over fitted. That is why training accuracy is increasing while validation accuracy seems constant. The reason for over-fitting is the lack of training samples. You may have to increase the number of training samples. Try followings one by one.
Please update a link to data-set if you want us to try a model with that.
Upvotes: 1