我用下面的代码创建一个model,然后想用model.fit(X_test, Y_test, epochs=100)和model.fit(X_val, Y_val, epochs=100)提高模型的精度
model = tf.keras.models.Sequential([
tf.keras.layers.Flatten(input_shape=(80, 80, 3)),
tf.keras.layers.Dense(512, activation='sigmoid'),
tf.keras.layers.Dense(2, activation='sigmoid')
])
model.compile(optimizer = 'adam',
loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
metrics = ['accuracy'])
model.summary()
# Fits the model to the training data
model.fit(X_test, Y_test, epochs=100)
# Fits the model to the validation
model.fit(X_val, Y_val, epochs=100)
我的预期结果是类似这样的,epoch逐个提高精度
但是上面代码得到的结果accuracy并没有提高
想请教一下该怎么改进,可以实现accuracy的提高