1
$\begingroup$

We have a data set that is converted from signal data to video. We want to classify these images using convolution. We tried many different methods but val acc is consistently low. Training accuracy is 99% and val_acc is 40%. We need your help in this respect. Thank you

weight_decay=0.0005
input_ = Input(shape=(125, 125, 1))
# Block 1
x = Conv2D(64, (3, 3), strides=(1, 1), activation='relu', padding='same',kernel_regularizer='0.001')(input_)
x = BatchNormalization()(x)
x = MaxPooling2D((2, 2), strides=(2, 2), padding='same', name='pool1')(x)

# Block 2
x = Conv2D(128, (3, 3), strides=(1, 1), activation='relu', padding='same',kernel_regularizer='0.001')(x)
x = BatchNormalization()(x)
x = MaxPooling2D((2, 2), strides=(2, 2), padding='same', name='pool2')(x)

# Block 3
x = Conv2D(256, (3, 3), strides=(1, 1), activation='relu', padding='same',kernel_regularizer='0.001')(x)
x = BatchNormalization()(x)
x = Conv2D(256, (3, 3), strides=(1, 1), activation='relu', padding='same',kernel_regularizer='0.001')(x)
x = BatchNormalization()(x)
x = MaxPooling2D((2, 2), strides=(2, 2), padding='same', name='pool3')(x)

# Block 4
x = Conv2D(512, (3, 3), strides=(1, 1), activation='relu', padding='same',kernel_regularizer='0.001')(x)
x = BatchNormalization()(x)
x = Conv2D(512, (3, 3), strides=(1, 1), activation='relu', padding='same',kernel_regularizer='0.001')(x)
x = BatchNormalization()(x)
x = MaxPooling2D((2, 2), strides=(2, 2), padding='same', name='pool4')(x)
x = GlobalMaxPooling2D()(x)

x = Dense(800,kernel_regularizer='0.001')(x)
x = Dropout(0.5)(x)
x = BatchNormalization()(x)
x = Dense(800,kernel_regularizer='0.001')(x)
x = Dropout(0.5)(x)
x = BatchNormalization()(x)
x = Activation('relu')(x)
x = Dense(8)(x)
x = Activation('softmax')(x)
model = Model(inputs = input_, outputs=x)

enter image description here

my kernel and dataset https://www.kaggle.com/ultrasonraporlama/video-kernel/

$\endgroup$

2 Answers 2

0
$\begingroup$

Try adding dropout layers to your network, this should work very well to reduce the amount of overfitting of your network.

$\endgroup$
16
  • $\begingroup$ I added the last 2 dense layers. but the result has not changed $\endgroup$
    – merve
    Dec 31, 2019 at 10:50
  • $\begingroup$ I said dropout, so keras.layers.Dropout, which I do not see in your code example. $\endgroup$
    – Oxbowerce
    Dec 31, 2019 at 11:43
  • $\begingroup$ it doesn't appear in my current code, but I've tried to add it later. the result has not changed. $\endgroup$
    – merve
    Dec 31, 2019 at 11:48
  • $\begingroup$ Between which layers have you added the dropout layer(s) and what dropout percentage did you use? $\endgroup$
    – Oxbowerce
    Dec 31, 2019 at 11:49
  • $\begingroup$ I've tried every possibility between 0.1 and 0.5. also when I add kernel_regularizer = 0.01, train acc and vall_acc do not exceed 50% .kernel_regularizer = 0.001 when I add train acc, after a certain epoch, 90% comes out but val_acc cannot pass 40% $\endgroup$
    – merve
    Dec 31, 2019 at 11:55
0
$\begingroup$

First of all you are using VGG-16 so make sure you have a good number of examples for each classes else it will overfitt. Secondly VGG-16 takes in an input of 224x224. So, please change it and see.

I think for your usecase, you should use a custom model rather than VGG-16 because the network might not map your data correctly to the corresponding classes.

$\endgroup$
1
  • $\begingroup$ thank you. I tried it with different models. however, the result has not changed. $\endgroup$
    – merve
    Mar 31, 2020 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.