
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How can Tensorflow and Python be used to verify the CIFAR dataset?
The CIFAR dataset can be verified by plotting the images present in the dataset on the console. Since the CIFAR labels are arrays, an extra index would be needed. The ‘imshow’ method from the ‘matplotlib’ library is used to display the image.
Read More: What is TensorFlow and how Keras work with TensorFlow to create Neural Networks?
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("Verifying the data") plt.figure(figsize=(10,10)) print("Plot the first 15 images") print("An extra index is needed since CIFAR labels are arrays") for i in range(15): plt.subplot(5,5,i+1) plt.xticks([]) plt.yticks([]) plt.grid(False) plt.imshow(train_images[i], cmap=plt.cm.binary) plt.xlabel(class_names[train_labels[i][0]]) plt.show()
Code credit: https://www.tensorflow.org/tutorials/images/cnn
Output
Verifying the data Plot the first 15 images An extra index is needed since CIFAR labels are arrays
Explanation
- The data which is normalized, is visualized.
- This is done using the 'matplotlib' library.
- Related Articles
- How can Tensorflow and Python be used to download and prepare the CIFAR dataset?
- How can Tensorflow be used to visualize the flower dataset using Python?
- How can Tensorflow be used to load the Illiad dataset using Python?
- How can Tensorflow be used to train the Illiad dataset using Python?
- How can Tensorflow be used to download and explore the Illiad dataset using Python?
- How can Tensorflow be used to download and explore IMDB dataset in Python?
- How can Tensorflow be used to standardize the flower dataset?
- How can Tensorflow be used to train and evaluate the titanic dataset?
- How can Tensorflow be used to configure the stackoverflow question dataset using Python?
- How can TensorFlow be used to download and explore the Fashion MNIST dataset using Python?
- How can Tensorflow be used to configure the dataset for performance?
- How can Tensorflow be used with Estimators to inspect the titanic dataset using Python?
- How can Tensorflow be used to prepare the IMDB dataset for training in Python?
- How can Tensorflow be used to prepare the dataset with stackoverflow questions using Python?
- How can Tensorflow be used to iterate through the dataset and display sample data using Python?

Advertisements