Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

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

keras - Validation acccuracy not improving

classifier = tf.keras.models.Sequential()
classifier.add(tf.keras.layers.Conv2D(32, (3, 3), input_shape = (224, 224, 3), activation = 'relu'))

classifier.add(tf.keras.layers.MaxPooling2D(pool_size = (2, 2)))

classifier.add(tf.keras.layers.Conv2D(32, (3, 3), activation = 'relu'))
classifier.add(tf.keras.layers.MaxPooling2D(pool_size = (2, 2)))

classifier.add(tf.keras.layers.Flatten())

classifier.add(tf.keras.layers.Dense(units = 128, activation = 'relu'))
classifier.add(tf.keras.layers.Dense(units = 1, activation = 'sigmoid'))

classifier.compile(optimizer = 'adam', loss = 'BinaryCrossentropy', metrics = ['accuracy'])

train_datagen = ImageDataGenerator(rescale = 1./255, shear_range = 0.2, zoom_range = 0.2, horizontal_flip = False)
test_datagen = ImageDataGenerator(rescale = 1./255)

training_set = train_datagen.flow_from_directory('/content/drive/MyDrive/Training/Training Data',
                                                 target_size = (224, 224),
                                                 batch_size = 50,
                                                 class_mode = 'sparse')

test_set = test_datagen.flow_from_directory('/content/drive/MyDrive/Training/Validation Data',
                                            target_size = (224, 224),
                                            batch_size = 50,
                                            class_mode = 'sparse')

classifier.fit(training_set,
                         steps_per_epoch = 4132/50, 
                         epochs = 10,
                         validation_data = test_set,
                         validation_steps = 978/50)

validation loss is changing but validation accuracy remain same. can anyone here tell me why this happens? I have dataset with two classes while training data of 4132 and validation data of 978.

question from:https://stackoverflow.com/questions/65861658/validation-acccuracy-not-improving

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

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...