] [Keras] freeze Vgg16
본문 바로가기

카테고리 없음

[Keras] freeze Vgg16

Model.summary()

 

어떻게 다른지 알수가 없다.

1
2
3
4
5
6
print('conv_base를 동결하기 전 훈련되는 가중치의 수 : 'len(model.trainable_weights))
print(model.trainable_weights)
conv_base.trainable = False
print()
print(model.trainable_weights)
print('conv_base를 동결한 후 훈련되는 가중치의 수 : 'len(model.trainable_weights))
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs

<tf.Variable 'block1_conv1_1/kernel:0' shape=(3, 3, 3, 64) dtype=float32_ref>

 

<tf.Variable 'block1_conv1_1/bias:0' shape=(64,) dtype=float32_ref>

 

<tf.Variable 'block1_conv2_1/kernel:0' shape=(3, 3, 64, 64) dtype=float32_ref>

 

<tf.Variable 'block1_conv2_1/bias:0' shape=(64,) dtype=float32_ref>

 

<tf.Variable 'block2_conv1_1/kernel:0' shape=(3, 3, 64, 128) dtype=float32_ref>

 

<tf.Variable 'block2_conv1_1/bias:0' shape=(128,) dtype=float32_ref>

 

<tf.Variable 'block2_conv2_1/kernel:0' shape=(3, 3, 128, 128) dtype=float32_ref>

 

<tf.Variable 'block2_conv2_1/bias:0' shape=(128,) dtype=float32_ref>

 

<tf.Variable 'block3_conv1_1/kernel:0' shape=(3, 3, 128, 256) dtype=float32_ref>

 

<tf.Variable 'block3_conv1_1/bias:0' shape=(256,) dtype=float32_ref>

 

<tf.Variable 'block3_conv2_1/kernel:0' shape=(3, 3, 256, 256) dtype=float32_ref>

 

<tf.Variable 'block3_conv2_1/bias:0' shape=(256,) dtype=float32_ref>

 

<tf.Variable 'block3_conv3_1/kernel:0' shape=(3, 3, 256, 256) dtype=float32_ref>

 

<tf.Variable 'block3_conv3_1/bias:0' shape=(256,) dtype=float32_ref>

 

<tf.Variable 'block4_conv1_1/kernel:0' shape=(3, 3, 256, 512) dtype=float32_ref>

 

<tf.Variable 'block4_conv1_1/bias:0' shape=(512,) dtype=float32_ref>

 

<tf.Variable 'block4_conv2_1/kernel:0' shape=(3, 3, 512, 512) dtype=float32_ref>

 

<tf.Variable 'block4_conv2_1/bias:0' shape=(512,) dtype=float32_ref>

 

<tf.Variable 'block4_conv3_1/kernel:0' shape=(3, 3, 512, 512) dtype=float32_ref>

 

<tf.Variable 'block4_conv3_1/bias:0' shape=(512,) dtype=float32_ref>

 

<tf.Variable 'block5_conv1_1/kernel:0' shape=(3, 3, 512, 512) dtype=float32_ref>

 

<tf.Variable 'block5_conv1_1/bias:0' shape=(512,) dtype=float32_ref>

 

<tf.Variable 'block5_conv2_1/kernel:0' shape=(3, 3, 512, 512) dtype=float32_ref>

 

<tf.Variable 'block5_conv2_1/bias:0' shape=(512,) dtype=float32_ref>

 

<tf.Variable 'block5_conv3_1/kernel:0' shape=(3, 3, 512, 512) dtype=float32_ref>

 

<tf.Variable 'block5_conv3_1/bias:0' shape=(512,) dtype=float32_ref>

 

<tf.Variable 'dense_5/kernel:0' shape=(2048, 256) dtype=float32_ref>

 

<tf.Variable 'dense_5/bias:0' shape=(256,) dtype=float32_ref>

 

<tf.Variable 'dense_6/kernel:0' shape=(256, 13) dtype=float32_ref>

 

<tf.Variable 'dense_6/bias:0' shape=(13,) dtype=float32_ref>

 

동결 전 30개의 층

 

 

 

동결 후  4개의 층

<tf.Variable 'dense_5/kernel:0' shape=(2048, 256) dtype=float32_ref>

<tf.Variable 'dense_5/bias:0' shape=(256,) dtype=float32_ref> 

<tf.Variable 'dense_6/kernel:0' shape=(256, 13) dtype=float32_ref> 

<tf.Variable 'dense_6/bias:0' shape=(13,) dtype=float32_ref>