- Related Questions & Answers
- How can Tensorflow be used to train and compile a CNN model?
- How can Tensorflow be used with Estimators to evaluate the model using Python?
- How can Keras be used to evaluate the model using Python?
- How can Keras be used to evaluate the restored model using Python?
- How can Tensorflow be used to create a sequential model using Python?
- How can Tensorflow be used to compile the model using Python?
- How can Tensorflow be used to train the model using Python?
- How can Tensorflow be used to export the model built using Python?
- How can Tensorflow be used to export the built model using Python?
- How can Tensorflow be used to compile the exported model using Python?
- How can Tensorflow and pre-trained model be used to compile the model using Python?
- How can Tensorflow be used to compile and fit the model using Python?
- How can Tensorflow be used with Estimator to compile the model using Python?
- How can Tensorflow be used to evaluate both the models on test data using Python?
- How can TensorFlow used to train a linear model using Python?

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

A convolutional neural network can be evaluated using the ‘evaluate’ method. This method takes the test data as its parameters. Before this, the data is plotted on the console using ‘matplotlib’ library and ‘imshow’ methods.

**Read More:**
What is TensorFlow and how Keras work with TensorFlow to create Neural Networks?

Convolutional neural networks have been used to produce great results for a specific kind of problems, such as image recognition.

We are using the Google Colaboratory to run the below code. Google Colab or Colaboratory helps run Python code over the browser and requires zero configuration and free access to GPUs (Graphical Processing Units). Colaboratory has been built on top of Jupyter Notebook.

print("Plotting accuracy versus epoch") plt.plot(history.history['accuracy'], label='accuracy') plt.plot(history.history['val_accuracy'], label = 'val_accuracy') plt.xlabel('Epoch') plt.ylabel('Accuracy') plt.ylim([0.5, 1]) plt.legend(loc='lower right') print("The model is being evaluated") test_loss, test_acc = model.evaluate(test_images,test_labels, verbose=2) print("The accuracy of the model is:") print(test_acc)

Code credit: https://www.tensorflow.org/tutorials/images/cnn

Plotting accuracy versus epoch The model is being evaluated 313/313 - 3s - loss: 0.8884 - accuracy: 0.7053 The accuracy of the model is: 0.705299973487854

- The accuracy versus epoch data is visualized.
- This is done using matplotlib library.
- The model is evaluated, and the loss and accuracy are determined.

Advertisements