This file contains hidden or 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
| from __future__ import print_function | |
| import imageio | |
| from PIL import Image | |
| import numpy as np | |
| import keras | |
| from keras.layers import Input, Dense, Conv2D, MaxPooling2D, AveragePooling2D, ZeroPadding2D, Dropout, Flatten, Concatenate, Reshape, Activation | |
| from keras.models import Model | |
| from keras.regularizers import l2 | |
| from keras.optimizers import SGD |
This file contains hidden or 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
| from googlenet_custom_layers import PoolHelper, LRN | |
| from keras.models import model_from_json | |
| model = model_from_json(open('googlenet_architecture.json').read(), custom_objects={"PoolHelper": PoolHelper, "LRN": LRN}) | |
| model.load_weights('googlenet_weights.h5') |
This file contains hidden or 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
| name: "GoogleNet" | |
| input: "data" | |
| input_dim: 10 | |
| input_dim: 3 | |
| input_dim: 224 | |
| input_dim: 224 |
This file contains hidden or 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
| input = Input(shape=(3, 224, 224)) |
This file contains hidden or 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: "conv1/7x7_s2" | |
| type: "Convolution" | |
| bottom: "data" | |
| top: "conv1/7x7_s2" | |
| param { | |
| lr_mult: 1 | |
| decay_mult: 1 | |
| } | |
| param { |
This file contains hidden or 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
| conv1_7x7_s2 = Convolution2D(64, 7, 7, subsample=(2,2), border_mode='same', activation='relu', name='conv1/7x7_s2')(input) |
This file contains hidden or 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: "pool1/3x3_s2" | |
| type: "Pooling" | |
| bottom: "conv1/7x7_s2" | |
| top: "pool1/3x3_s2" | |
| pooling_param { | |
| pool: MAX | |
| kernel_size: 3 | |
| stride: 2 | |
| } |
This file contains hidden or 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_3x3_s2 = MaxPooling2D(pool_size=(3, 3), strides=(2, 2), border_mode='valid', name='pool1/3x3_s2')(conv1_7x7_s2) |
This file contains hidden or 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
| conv1_zero_pad = ZeroPadding2D(padding=(1, 1))(conv1_7x7_s2) | |
| pool1_helper = PoolHelper()(conv1_zero_pad) | |
| pool1_3x3_s2 = MaxPooling2D(pool_size=(3, 3), strides=(2, 2), border_mode='valid', name='pool1/3x3_s2')(pool1_helper) |
This file contains hidden or 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 PoolHelper(Layer): | |
| def __init__(self, **kwargs): | |
| super(PoolHelper, self).__init__(**kwargs) | |
| def call(self, x, mask=None): | |
| return x[:,:,1:,1:] | |
| def get_config(self): | |
| config = {} | |
| base_config = super(PoolHelper, self).get_config() |
OlderNewer