Introduction to CNNs

Image Modeling with Keras

Ariel Rokem

Senior Data Scientist, University of Washington

Image Modeling with Keras

Image Modeling with Keras

Software and pre-requisites

Image Modeling with Keras

Images as data

import matplotlib.pyplot as plt
data = plt.imread('stop_sign.jpg')
plt.imshow(data)
plt.show()

Image Modeling with Keras

Images as data

data.shape
(2832, 4256, 3)
Image Modeling with Keras

Images as data

data[1000, 1500]
array([0.73333333, 0.07843137, 0.14509804])

Image Modeling with Keras

Images as data

data[250, 3500]
array([0.25882353, 0.43921569, 0.77254902])

Image Modeling with Keras

Modifying image data

data[:, :, 1] = 0
data[:, :, 2] = 0
plt.imshow(data)
plt.show()

Image Modeling with Keras

Changing an image

data[200:1200, 200:1200, :] = [0, 1, 0]

plt.imshow(data) plt.show()

Image Modeling with Keras

Black and white images

Image Modeling with Keras

Black and white images

Image Modeling with Keras

Black and white images

tshirt[10:20, 15:25] = 1

plt.imshow(tshirt) plt.show()

Image Modeling with Keras

Let's practice!

Image Modeling with Keras

Preparing Video For Download...