Classifying images

Keras ile Görüntü Modellemesi

Ariel Rokem

Senior Data Scientist, University of Washington

Image classification

Keras ile Görüntü Modellemesi

Image classification: training

Keras ile Görüntü Modellemesi

Image classification: training

Keras ile Görüntü Modellemesi

Image classification: training

Keras ile Görüntü Modellemesi

Image classification: evaluation

Keras ile Görüntü Modellemesi

Image classification: evaluation

Keras ile Görüntü Modellemesi

Representing class data: one-hot encoding

labels = ["shoe", "dress", "shoe", "t-shirt", 
          "shoe", "t-shirt", "shoe", "dress"]
Keras ile Görüntü Modellemesi

Representing class data: one-hot encoding

array([[0., 0., 1.],    <= shoe
       [0., 1., 0.],    <= dress
       [0., 0., 1.],    <= shoe
       [1., 0., 0.],    <= t-shirt
       [0., 0., 1.],    <= shoe
       [1., 0., 0.],    <= t-shirt
       [0., 0., 1.],    <= shoe
       [0., 1., 0.]])   <= dress
Keras ile Görüntü Modellemesi

One-hot encoding

categories = np.array(["t-shirt", "dress", "shoe"])

n_categories = 3 ohe_labels = np.zeros((len(labels), n_categories))
for ii in range(len(labels)):
jj = np.where(categories == labels[ii])
ohe_labels[ii, jj] = 1
Keras ile Görüntü Modellemesi

One-hot encoding: testing predictions

test
array([[0., 0., 1.], 
       [0., 1., 0.], 
       [0., 0., 1.], 
       [0., 1., 0.], 
       [0., 0., 1.],
       [0., 0., 1.],
       [0., 0., 1.],
       [0., 1., 0.]])
(test * prediction).sum()
6.0

prediction
array([[0., 0., 1.], 
       [0., 1., 0.], 
       [0., 0., 1.], 
       [1., 0., 0.], <= incorrect
       [0., 0., 1.],
       [1., 0., 0.], <= incorrect
       [0., 0., 1.], 
       [0., 1., 0.]])
Keras ile Görüntü Modellemesi

Let's practice!

Keras ile Görüntü Modellemesi

Preparing Video For Download...