Reputation: 1855
Already, I have completed a project with 20 epochs using CNN model, model training code is given below,
model = tf.keras.models.Sequential([tf.keras.layers.Conv2D(16,(3,3), activation='relu', input_shape=(200, 200, 3)),
tf.keras.layers.MaxPool2D(2,2),
tf.keras.layers.Conv2D(32,(3,3), activation='relu'),
tf.keras.layers.MaxPool2D(2,2),
tf.keras.layers.Conv2D(64,(3,3), activation='relu'),
tf.keras.layers.MaxPool2D(2,2),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(512, activation='relu'),
tf.keras.layers.Dense(1, activation='sigmoid'),
])
Then, compile the model,
model.compile(loss = 'binary_crossentropy',
optimizer = RMSprop(lr=0.001),
metrics = ['accuracy'])
Now, fit the model with 20 epochs,
model_fit = model.fit(train_dataset,
steps_per_epoch=3,
epochs= 20,
validation_data = validation_dataset)
After train the model, show the accuracy and loss and that's is given below,
Note: I am failed to find a single accuracy so that I am failed to write it in research papers. Because I can't write whole accuracy in papers. I should use a single accuracy. So How should i find a single accuracy or how to write a single accuracy. Please help who know it.
Upvotes: 0
Views: 940
Reputation: 1170
I did comment above about the issue that you are having, but if you really only want one number, you can use the code below to evaluate both your loss and accuracy.
# Evaluate the loss and accuracy
loss, accuracy = model.evaluate(testingDataset)
# Print the accuracy
print("Accuracy: " + str(accuracy))
# Print the loss
print("Loss: " + str(loss))
Upvotes: 1