Skip to content

Commit 44bf38d

Browse files
committed
Update get_feature_map.py
1 parent 899999a commit 44bf38d

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

DeepLearning Tutorials/dive_into_keras/get_feature_map.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1+
#coding=utf-8
2+
13
"""
24
Author:wepon
35
Code:https://github.com/wepe
46
57
File: get_feature_map.py
68
1. visualize feature map of Convolution Layer, Fully Connected layer
79
2. rewrite the code so you can treat CNN as feature extractor, see file: cnn-svm.py
10+
11+
--
12+
2016.06.06更新:
13+
keras的API已经发生变化,现在可视化特征图可以直接调用接口,具体请参考:http://keras.io/visualization/
14+
15+
816
"""
917
from __future__ import print_function
1018
import cPickle,theano
@@ -16,10 +24,10 @@
1624
model = cPickle.load(open("model.pkl","rb"))
1725

1826
#define theano funtion to get output of FC layer
19-
get_feature = theano.function([model.layers[0].input],model.layers[11].get_output(train=False),allow_input_downcast=False)
27+
get_feature = theano.function([model.layers[0].input],model.layers[11].output,allow_input_downcast=False)
2028

2129
#define theano funtion to get output of first Conv layer
22-
get_featuremap = theano.function([model.layers[0].input],model.layers[2].get_output(train=False),allow_input_downcast=False)
30+
get_featuremap = theano.function([model.layers[0].input],model.layers[2].output,allow_input_downcast=False)
2331

2432

2533
data, label = load_data()

0 commit comments

Comments
 (0)