How to load and visualize CIFAR-10 and CIFAR-100 datasets

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to this video tutorial in today's video i will show how to load and visualize cipher 10 and cipher 100 data sets first we will load cipher data set using unpickle method in this we will use pickle.load and then we will do some pre-processing and finally we will do some image reshape and transpose and then we will visualize a single image and finally we'll do all the reshape and transpose on the whole data set then we will visualize multiple images and then we will do all the things for c400 data sets now we need our data set you can click this link or you can directly go and search on the google for the nasifer 10 data set and you will get this space on this page you can download cipher 10 python version and for c400 data set you can download this c400 python version after downloading you will get vinzi file you extract and after extracting you will get this file and within this file you will go and you will get five batches for training and one batch for test we will load one of the batches and visualize some images this is simple code to load the data set it is provided here you can copy this for python 3 and this for python 2. run this cell shift enter now you have to give the file path enter the file path and the file name run this cell then use this method to load the data set you'll get that this data is basically a dictionary but what is the length of dictionary so the dictionary name dot keys we are using so the keys are batch level labels and then data and file names so our dictionary name and then we are giving this our data is basically a 2d array in this first we see that what is the shape of the data it is 10 000 and seven two so we have uh ten thousand images and each image has a three zero seven two entries so to see what is the first image so this is the first image an image has three zero seven two entries to visualize an image we have to reshape in a standard format so i have an interesting image for this thing you can see it here that we have 3072 entries so first we will divide this 3072 entries into three channels and then we will reshape in this form 332 32 then we will get this 32 by 32 red channel and 32 by 32 green channel and then 32 by 32 blue channel and then we will transpose it into this format like 1 2 3 4 5 6 1 2 3 and means that red blue green on one layer and this entry will be 32 and then we will have 32 channels and then our final output shape will be 32 by 32 by 3 i first reshaped the image into 3 by 32 by 32 done this so you will get this uh this 32 by 32 for red this 32 by 32 for green and this 32 by 32 for blue channel and then finally i transpose it into the standard format and this thing so it will be 32 by 32 by 3 so this this first first column will be for red second column will be for green and then it the last column will be for blue and this is 32 by 3 and this is 32 by 3 this is 32 by 3 and the whole entries are 32. so finally we should visualize the image so for the visualization i'm importing matplotlib dot pi plot splt and plt.i am show image will be this is my first image and it looks like a frog up to here we did only for the single image now we are going to do it for the whole data set so for whole data set i am taking data as a variable and then data dot reshape to this format and then we will transpose in standard format after reshaping and transposing our data is in this format 1032 323 and we can visualize multiple images like i am going to visualize 16 images run this it's very simple and this plt dot subplot and plt data i am show and then pld dot show so 4 by 4 i am using this thing very simple you can use for loop to visualize multiple images and here also the other method is that you can see the differences between these two first you give the file path then you unpickle the file means you load the file then you can find the data inside the file the length of the data that is five so we need to find the keys of the file and now we are in tested in the data we will write again data and for the shape we are using dot shape so for the first image we run this and for the first image shape we run this thing and for the visualization we are using same and you'll find that this is our first image in c400 dataset and then we will reshape and transpose a whole data set into a standard format and this is to visualize multiple images as previous and this is other method to visualize the images as we have seen in cipher 10 data set
Info
Channel: Binary Study
Views: 2,169
Rating: undefined out of 5
Keywords: Image Processing, cifar 10, cifar dataset, cifar 100, How to load and visualize cifar dataset, how to load image dataset in jupyter notebook, how to visualize images in python, python for beginners, puthon
Id: pBOfQTfDMVg
Channel Id: undefined
Length: 7min 53sec (473 seconds)
Published: Sat Apr 24 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.