图像分类

使用 Keras 进行图像建模

Ariel Rokem

Senior Data Scientist, University of Washington

图像分类

使用 Keras 进行图像建模

图像分类:训练

使用 Keras 进行图像建模

图像分类:训练

使用 Keras 进行图像建模

图像分类:训练

使用 Keras 进行图像建模

图像分类:评估

使用 Keras 进行图像建模

图像分类:评估

使用 Keras 进行图像建模

类别数据表示:独热编码

labels = ["shoe", "dress", "shoe", "t-shirt", 
          "shoe", "t-shirt", "shoe", "dress"]
使用 Keras 进行图像建模

类别数据表示:独热编码

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 进行图像建模

独热编码

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 进行图像建模

独热编码:测试预测

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.], <= 错误
       [0., 0., 1.],
       [1., 0., 0.], <= 错误
       [0., 0., 1.], 
       [0., 1., 0.]])
使用 Keras 进行图像建模

Passons à la pratique !

使用 Keras 进行图像建模

Preparing Video For Download...