Hands-On Deep Learning for Images with TensorFlow



Download 5,72 Mb.
Pdf ko'rish
bet12/32
Sana22.12.2022
Hajmi5,72 Mb.
#893820
1   ...   8   9   10   11   12   13   14   15   ...   32
Bog'liq
Hands On Deep Learning for Images

MNIST digits
Now, let's learn about MNIST digits. In this section, we'll look at the 
ImageData
notebook
that I've prepared to help us understand how to deal with image data; downloading and
getting the MNIST digits; looking at images as raw numbers; and then finally, visualizing
the actual images based on this numeric data.


Image Data
Chapter 2
[ 24 ]
The code we're going to be working with is contained in an IPython Notebook. This is the
way we've set up our container, so you're going to be running your container like we
mentioned at the end of the setting up your Machine Learning Toolkit. I've also prepared
an 
ImageData
IPython Notebook that we're going to be working with. We will start off by
importing all the necessary packages, and we're going to, turn on Matplotlib in order to
automatically plot. This means that when we show an image, we don't have to call 
.plot
;
it'll do it for us automatically:
Importing packages
Keras actually has the MNIST digits built-in as a dataset, so we're going to use this
convenience and go ahead and load them up.
You need an internet connection because it's going to be downloading
these as a file from Amazon S3.
As we load the data, there will be a Python tuple that we're going to be unpacking iPnto
two sets: a training set, and a testing set:
Python tuple
It is actually a common convention in machine learning to split your data into segments.
You use it in order to see that your model is actually learning with the training set. Then,
you can use a testing set to make sure that your model is not overfitting, which is really
taking into consideration whether your model is memorizing the training data or whether
it's actually learning.


Image Data
Chapter 2
[ 25 ]
Now, let's look at a quick setting with the format options for NumPy. As we print out
arrays, we're looping through the image as an array of arrays, and then printing out the
data. As you can see, the image is really just numbers from 
0
to 
255
:
Grey scale image (arrays of array)
This is a grayscale image, and each of these integers here records how dark that particular
pixel is.


Image Data
Chapter 2
[ 26 ]
Now, let's plot the image and see what these numbers really look like. Matplotlib has a
simple 
plot
function that you can give an array of arrays, or basically a two-dimensional
array of XY pixels, and it'll draw it out as an 
.image
file. Following, you can see what looks
an awful lot like a zero:
Plotting image

Download 5,72 Mb.

Do'stlaringiz bilan baham:
1   ...   8   9   10   11   12   13   14   15   ...   32




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish