모델 해석

Keras로 배우는 이미지 모델링

Ariel Rokem

Senior Data Scientist, University of Washington

레이어 선택

model.layers
[<keras.layers.convolutional.Conv2D at 0x109f10c18>,
 <keras.layers.convolutional.Conv2D at 0x109ec5ba8>,
 <keras.layers.core.Flatten at 0x1221ffcc0>,
 <keras.layers.core.Dense at 0x1221ffef0>]
Keras로 배우는 이미지 모델링

모델 가중치 가져오기

conv1 = model.layers[0]

weights1 = conv1.get_weights()
len(weights1)
2
kernels1 = weights1[0]

kernels1.shape
(3, 3, 1, 5)
kernel1_1 = kernels1[:, :,
                     0, 0]

kernel1_1.shape
(3, 3)
Keras로 배우는 이미지 모델링

커널 시각화

plt.imshow(kernel1_1)

Keras로 배우는 이미지 모델링

커널 응답 시각화

test_image = test_data[3, :, :, 0]

plt.imshow(test_image)

Keras로 배우는 이미지 모델링

커널 응답 시각화

filtered_image = convolution(test_image, kernel1_1)

plt.imshow(filtered_image)

Keras로 배우는 이미지 모델링

커널 응답 시각화

test_image = test_data[4, :, :, 1]
plt.imshow(test_image)

Keras로 배우는 이미지 모델링

커널 응답 시각화

filtered_image = convolution(test_image, kernel1_1)
plt.imshow(filtered_img)

Keras로 배우는 이미지 모델링

커널 응답 시각화

kernel1_2 = kernels[:, :, 0, 1]
filtered_image = convolution(test_image, kernel1_2)
plt.imshow(filtered_img)

Keras로 배우는 이미지 모델링

연습해 봅시다!

Keras로 배우는 이미지 모델링

Preparing Video For Download...