S
S
Sergey Sokolov2020-02-24 13:09:38
Neural networks
Sergey Sokolov, 2020-02-24 13:09:38

Is it possible to retrain the model for 2 out of 4 classes?

There is an EfficientNet model trained on ImageNet and retrained to distinguish pictures of its 4 classes. Handles quite well. But it can and should be a little better.

New, manually parsed images for only 2 out of 4 classes have arrived.
35 of one class and 425 of another. Maybe it's generally too few images, it's not worth trying to pre-train on them?

I'm trying to train the model on these images. Training : Validation = 0.8 : 0.2
Created a folder with subfolders for each of the 4 classes, but the files resp. there are only two.
I use Keras ImageDataGenerator and its method flow_from_directory()

The creator of the model also trained its working version for 3500 pictures and got accuracy0.98755

But I have no result: the model starts erroneously recording everything in one of these two classes, even images from previously normally recognizable two untouched classes.

During training , it gives out minimal losses and an accuracy of about 1, but for validation , the loss is high and the accuracy is kept in the area of ​​​​the entire 0.21 — 0.25

CHDNT?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
OLZ1, 2020-02-27
@sergiks

At least two conclusions follow from your narrative: either "something is wrong" with the data, or an incorrect model configuration is chosen. When working with unbalanced data, shuffling comes to the rescue. Try to shuffle the data when training the model [ history = model.fit(..., shuffle=True)] / flow_from_dataframe(..., shuffle=True) . I would focus on Keras solutions, with which they "split" the MNIST set problem [ link ] with high accuracy.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question