

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can Tensorflow be used to display sample data from the cats and dogs input dataset?
Tensorflow can be used to display sample data from the cats and dogs input dataset with the help of ‘matplotlib’ library. The ‘imshow’ method can be used to display the images on the console.
Read More: What is TensorFlow and how Keras work with TensorFlow to create Neural Networks?
We will understand how to classify images of cats and dogs with the help of transfer learning from a pre-trained network.
The intuition behind transfer learning for image classification is, if a model is trained on a large and general dataset, this model can be used to effectively serve as a generic model for the visual world. It would have learned the feature maps, which means the user won’t have to start from scratch by training a large model on a large dataset.
Read More: How can a customized model be pre-trained?
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.
Example
class_names = train_dataset.class_names print("Sample dataset being displayed on console") plt.figure(figsize=(10, 10)) for images, labels in train_dataset.take(1): for i in range(9): ax = plt.subplot(3, 3, i + 1) plt.imshow(images[i].numpy().astype("uint8")) plt.title(class_names[labels[i]]) plt.axis("off")
Code credit −https://www.tensorflow.org/tutorials/images/transfer_learning
Output
Explanation
The images are iterated over and a sample of the images are displayed on the console.
- Related Questions & Answers
- How can Tensorflow be used to display sample data from abalone dataset?
- How can Tensorflow be used to iterate through the dataset and display sample data using Python?
- How can Tensorflow be used to visualize the augmented data from the dataset?
- How can Tensorflow be used to load the csv data from abalone dataset?
- How can Tensorflow be used to explore the dataset and see a sample file from the stackoverflow question dataset using Python?
- How can Tensorflow be used with Estimators to display metadata about the dataset?
- How can Tensorflow be used to standardize the flower dataset?
- How can Tensorflow and Python be used to verify the CIFAR dataset?
- How can Tensorflow be used to train and evaluate the titanic dataset?
- How can Tensorflow be used to configure the dataset for performance?
- How can Tensorflow and Python be used to download and prepare the CIFAR dataset?
- How can Tensorflow and Estimator be used to define input function for training and evaluation of dataset?
- How can Tensorflow be used to view a sample of the vectorised data using Python?
- How can Tensorflow be used to download flower dataset into the environment?
- How can Tensorflow be used to visualize the flower dataset using Python?