![]() |
The Tensorflow flower dataset is a large dataset that consists of flower images. In this article, we are going to learn how we can visualize the flower dataset in python. For the purposes of this article, we will use tensorflow_datasets and Matplotlib library. PrerequisitesIf you don’t have any of the libraries mentioned below, you can install them using the pip command, for example, to install the tensorflow_datasets library you need to write the following command: pip install tensorflow-datasets Matplotlib is a plotting library for Python. It allows the user with functionalities to visualize and plot complex graphs in python yet provides extensive customization capabilities. To install Matplotlib, just as before you can use the pip command: pip install matplotlib Importing Librariestensorflow_datasets is a library of public datasets ready to use with TensorFlow and MatplotLib is one of the handy tools used by machine learning practitioners to build visualization on different kinds of datasets. Python3
Loading Flower DatasetLet’s start by importing the dataset. We will utilize the tfds.load() function to import the flower dataset. It is used to load the specified dataset into a tf.data.Dataset, which is supplied via the name argument. The flower dataset is called tf_flowers. Python3
![]()
Let’s check how many images we have in the dataset. Python3
Output: 3670 Now it’s time to visualize the images. The following piece of code shows the first four images in the dataset. Python3
Output: ![]() Visualizing some images from the flower dataset We can also apply data augmentation on it using one of the very handy libraries that are Albumentation. Python3
Output: ![]() Original image and the augmented image |
Reffered: https://www.geeksforgeeks.org
AI ML DS |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 14 |