How to Load and Visualize CIFAR 10 Dataset using TensorFlow Keras

  Рет қаралды 164

Binary Study

3 ай бұрын

In this video, I will show you how to load and visualize the CIFAR -10 Dataset.
CIFAR -10 dataset consists of sixty thousand 32 by 32 color images.
Here the width and height of each image is 32 pixels.
And, each image has three channels RGB, red, green and, blue.
Further, these sixty thousand images are classified into 10 classes. So Each class has six thousand images.
Here 10 classes are airplane, automobile, bird …, etc.
The labels of the images are from 0 to 9. So the label of the airplane is 0, and the label of the automobile is 1, likewise, the label of the truck is 9.
Further, the images are categorized into 50,000 training images and 10,000 test images.
Now let's load the dataset and visualize some images
For this, we need to import some libraries
So let's import first,
tensorflow as tf
And
from tensorflow import keras
For visualizing images we import matplotlib.pyplot as plt
So lets load cifar 10 dataset
For this, we use keras.datasets.cifar10.load_data().
This will return two tuples. One for training images and other for test images.
Each tuple will have the image and label.
First tuple will have training images and their labels and the second tuple will have test images and their labels.
Run the cell and you will get the training and test images along with their labels.
Now we have loaded the dataset.
Let's check the shape of the training images
X_train.shape
It returns 50,000 by 32 by 32 by 3.
50 thousand training images each image is of height and width of 32 pixels each and each image consists of three channels rgb, red green and blue as we discussed.
Let's check the shape of training labels
Y_train.shape
It returns 50 thousand by 1. The labels are from 0 to 9.
Let's visualize a single training image
X_train[0]
It returns ndarray of shape 32 by 32 by 3.
You can also use plt.X_train[0]
It’s a frog. And the label of the frog class is 6.
Let’s check the label of this image.
y_train[0]
It returns an array of single value that is label of the image. Herer label is 6. And it is the label of frog as we have seen here.
We can also visualize multiple images using matplotlib.
Discuss with us at discord.gg/erNs7E5GyA
Read our blog at www.binarystudy.com

Пікірлер: 2
@REHANARAUNAK786
@REHANARAUNAK786 3 ай бұрын
Pls tell me how to load images of fole and subfolder ???
@binarystudy
@binarystudy 3 ай бұрын
Hi, please refer to this video kzbin.info/www/bejne/pnOyl4SKm6mAjMk Thanks
🕊️Valera🕊️
00:34
DO$HIK
Рет қаралды 6 МЛН
哈哈大家为了进去也是想尽办法!#火影忍者 #佐助 #家庭
00:33
火影忍者一家
Рет қаралды 125 МЛН
Это было очень близко...
00:10
Аришнев
Рет қаралды 1,6 МЛН
🕊️Valera🕊️
00:34
DO$HIK
Рет қаралды 6 МЛН