Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
130 views
in Technique[技术] by (71.8m points)

python - How to increase validation accuracy in multiclass image classifications using Deep transfer learning algorithm?

My validation-accuracy is lower than training accuracy.outputoftrainandvalidationaccuracy How can I get better validation accuracy that is not too much different from training accuracy? Thank you.

My problem is the classification of the chest X-ray images(four class categories) using the deep transfer learning model. I used a total of 4593 chest X-ray images of four class categories with 2755(60%) images for training 1838(40%) images for testing. I used also for training and testing 80%-20% & 70%-30% samples but the accuracy was less than 60%-40% samples. The batch size in this model is 32, no. of epochs 50, and learning rate 1e-5.

The Model

from tensorflow.keras.applications import ResNet50V2

conv_base = ResNet50V2(weights='imagenet',
                  include_top=False,
                  input_shape=(224, 224, 3))


conv_base.trainable = True


model = models.Sequential()
model.add(conv_base)




model.add(layers.Flatten())
model.add(layers.Dropout(0.1))
model.add(layers.Dense(256, activation='relu'))
model.add(layers.Dense(4, activation='softmax'))


model.compile(loss='categorical_crossentropy',     #for multiclass use categorical_crossentropy
              
              optimizer=optimizers.Adam(lr=LEARNING_RATE),
              metrics=['acc'])

Model summary

Model: "sequential"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
resnet50v2 (Functional)      (None, 7, 7, 2048)        23564800  
_________________________________________________________________
flatten (Flatten)            (None, 100352)            0         
_________________________________________________________________
dropout (Dropout)            (None, 100352)            0         
_________________________________________________________________
dense (Dense)                (None, 256)               25690368  
_________________________________________________________________
dense_1 (Dense)              (None, 4)                 1028      
=================================================================
Total params: 49,256,196
Trainable params: 49,210,756
Non-trainable params: 45,440
_________________________________________________________________

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...