- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 download the flower dataset using keras sequential API?
The flower dataset can be downloaded using the keras sequential API with the help of google API that stores the dataset. The ‘get_file’ method is used with the API (URL) to fetch the dataset, and store it in memory.
Read More: What is TensorFlow and how Keras work with TensorFlow to create Neural Networks?
A neural network that contains at least one layer is known as a convolutional layer. Convolutional neural networks have been used to produce great results for a specific kind of problems, such as image recognition.
An image classifier is created using a keras.Sequential model, and data is loaded using preprocessing.image_dataset_from_directory. Data is efficiently loaded off disk. Overfitting is identified and techniques are applied to mitigate it. These techniques include data augmentation, and dropout. There are images of 3700 flowers. This dataset contaisn 5 sub directories, and there is one sub directory per class. They are: daisy, dandelion, roses, sunflowers, and tulips.
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.
import matplotlib.pyplot as plt import numpy as np import os import PIL import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers from tensorflow.keras.models import Sequential import pathlib print("Required pakcages imported") dataset_url = "https://storage.googleapis.com/download.tensorflow.org/example_images/flower_photos.tgz" data_dir = tf.keras.utils.get_file('flower_photos', origin=dataset_url, untar=True) data_dir = pathlib.Path(data_dir) print("Data has been downloaded")
Code credit: https://www.tensorflow.org/tutorials/images/classification
Output
Required pakcages imported Downloading data from https://storage.googleapis.com/download.tensorflow.org/example_images/flower_photos.tgz 228818944/228813984 [==============================] - 5s 0us/step Data has been downloaded
Explanation
- The required packages are imported.
- The data is downloaded from the API.
- Related Articles
- How can Tensorflow be used to explore the flower dataset using keras sequential API?
- How can Tensorflow be used to download flower dataset into the environment?
- How can Tensorflow be used to visualize the flower dataset using Python?
- How can Tensorflow be used to standardize the flower dataset?
- How can Tensorflow be used to download and explore the Illiad dataset using Python?
- How can Tensorflow be used to configure the flower dataset for performance?
- How can Tensorflow be used to pre-process the flower training dataset?
- How can TensorFlow be used to download and explore the Fashion MNIST dataset using Python?
- How can Tensorflow be used with premade estimator to download the Iris dataset?
- How can Tensorflow be used with flower dataset to continue training the model?
- How can Tensorflow be used with abalone dataset to build a sequential model?
- How can Tensorflow be used to download and explore IMDB dataset in Python?
- How can Tensorflow and Python be used to download and prepare the CIFAR dataset?
- How can Tensorflow be used to load the flower dataset and work with it?
- How can Tensorflow be used to split the flower dataset into training and validation?
