This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LRN(Layer): | |
def __init__(self, alpha=0.0001,k=1,beta=0.75,n=5, **kwargs): | |
self.alpha = alpha | |
self.k = k | |
self.beta = beta | |
self.n = n | |
super(LRN, self).__init__(**kwargs) | |
def call(self, x, mask=None): | |
b, ch, r, c = x.shape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pool1_norm1 = LRN(name='pool1/norm1')(pool1_3x3_s2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inception_3a_1x1 = Convolution2D(64,1,1, border_mode='same', activation='relu', name='inception_3a/1x1')(pool2_3x3_s2) | |
inception_3a_3x3_reduce = Convolution2D(96,1,1, border_mode='same', activation='relu', name='inception_3a/3x3_reduce')(pool2_3x3_s2) | |
inception_3a_3x3 = Convolution2D(128,3,3, border_mode='same', activation='relu', name='inception_3a/3x3')(inception_3a_3x3_reduce) | |
inception_3a_5x5_reduce = Convolution2D(16,1,1, border_mode='same', activation='relu', name='inception_3a/5x5_reduce')(pool2_3x3_s2) | |
inception_3a_5x5 = Convolution2D(32,5,5, border_mode='same', activation='relu', name='inception_3a/5x5')(inception_3a_5x5_reduce) | |
inception_3a_pool = MaxPooling2D(pool_size=(3,3), strides=(1,1), border_mode='same', name='inception_3a/pool')(pool2_3x3_s2) | |
inception_3a_pool_proj = Convolution2D(32,1,1, border_mode='same', activation='relu', name='inception_3a/pool_proj')(inception_3a_pool) | |
inception_3a_output = merge([inception_3a_1x1, inception_3a_3x3, inception_3a_5x5, inception_3a_pool_proj], mode='con |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
layer { | |
name: "pool5/7x7_s1" | |
type: "Pooling" | |
bottom: "inception_5b/output" | |
top: "pool5/7x7_s1" | |
pooling_param { | |
pool: AVE | |
kernel_size: 7 | |
stride: 1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pool5_7x7_s1 = AveragePooling2D(pool_size=(7,7), strides=(1,1), name='pool5/7x7_s2')(inception_5b_output) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
layer { | |
name: "pool5/drop_7x7_s1" | |
type: "Dropout" | |
bottom: "pool5/7x7_s1" | |
top: "pool5/7x7_s1" | |
dropout_param { | |
dropout_ratio: 0.4 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loss3_flat = Flatten()(pool5_7x7_s1) | |
pool5_drop_7x7_s1 = Dropout(0.4, name='pool5/drop_7x7_s1')(loss3_flat) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
layer { | |
name: "loss3/classifier" | |
type: "InnerProduct" | |
bottom: "pool5/7x7_s1" | |
top: "loss3/classifier" | |
param { | |
lr_mult: 1 | |
decay_mult: 1 | |
} | |
param { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loss3_classifier = Dense(1000, name='loss3/classifier')(pool5_drop_7x7_s1) | |
loss3_classifier_act = Activation('softmax', name='prob')(loss3_classifier) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
googlenet = Model(input=input, output=[loss1_classifier_act, loss2_classifier_act, loss3_classifier_act]) |