1
votes

I have a neural network which classify 3 output.My dataset is very small, I have 340 images for train, and 60 images for test. I build a model and when I compile at my result is this:

Epoch 97/100 306/306 [==============================] - 46s 151ms/step - loss: 0.2453 - accuracy: 0.8824 - val_loss: 0.3557 - val_accuracy: 0.8922 Epoch 98/100 306/306 [==============================] - 47s 152ms/step - loss: 0.2096 - accuracy: 0.9031 - val_loss: 0.3795 - val_accuracy: 0.8824 Epoch 99/100 306/306 [==============================] - 47s 153ms/step - loss: 0.2885 - accuracy: 0.8627 - val_loss: 0.4501 - val_accuracy: 0.7745 Epoch 100/100 306/306 [==============================] - 46s 152ms/step - loss: 0.1998 - accuracy: 0.9150 - val_loss: 0.4586 - val_accuracy: 0.8627

when I predict the test images, test accuracy is poor. What should I do ? I also use ImageDatagenerator for data augmentation but the result is same.Is it because I have small dataset.

1
Did you shuffle the data before splitting into training and validation to make sure the validation data is somewhat representative of the data-set you are training on? - Luismi98
I have 3 classes and what I did for splitting is this: X_train,X_test,y_train,y_test=train_test_split(X,y,random_state=15,test_size=0.10) How can I shuffle the data ? Thank you. - Abdulsamet KILINÇARSLAN
try use Dropout layer on your fully connected layer, it will help reduce your overfit - Surya Mahadi
Thanks for your answer. I already used Dropout layer,but I used it like this: Conv-Max-Dropout Conv-Max-Dropout ... Flatten Dense Dropout Dense Dropout Dense Should I use Dropout layer only after FC layer ? - Abdulsamet KILINÇARSLAN
can you share the model architecture? - Sachin Prasad H S

1 Answers

0
votes

You can use Regularization on fully connected layers. But the fact that you already have high validation accuracy it's probably your data. your train data might not fully represent your test data. try to analyze that and make sure you do all the pre processing on the test data before testing as you did for the train data.