-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path78_cnn_dogs_cats.py
More file actions
37 lines (32 loc) · 878 Bytes
/
78_cnn_dogs_cats.py
File metadata and controls
37 lines (32 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# plot dog photos from the dogs vs cats dataset
from matplotlib import pyplot
from matplotlib.image import imread
# define location of dataset
folder = 'dogs-vs-cats/train/'
# plot first few images of dogs
for i in range(9):
# define subplot
pyplot.subplot(330 + 1 + i)
# define filename
filename = folder + 'dog.' + str(i) + '.jpg'
# load image pixels
image = imread(filename)
# plot raw pixel data
pyplot.imshow(image)
# show the figure
pyplot.show()
# plot first few images of cats
for i in range(9):
# define subplot
pyplot.subplot(330 + 1 + i)
# define filename
filename = folder + 'cat.' + str(i) + '.jpg'
# load image pixels
image = imread(filename)
# plot raw pixel data
pyplot.imshow(image)
# show the figure
pyplot.show()
# As can be seen, the images are of different sizes
# They need to be resized to a standard size
# Too heavy dataset -- abort