Last active
April 7, 2022 19:29
-
-
Save JBed/c2fb3ce8ed299f197eff to your computer and use it in GitHub Desktop.
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
from keras.models import Sequential | |
from keras.layers.core import Dense, Dropout, Activation, Flatten | |
from keras.layers.convolutional import Convolution2D, MaxPooling2D | |
from keras.layers.normalization import BatchNormalization | |
#AlexNet with batch normalization in Keras | |
#input image is 224x224 | |
model = Sequential() | |
model.add(Convolution2D(64, 3, 11, 11, border_mode='full')) | |
model.add(BatchNormalization((64,226,226))) | |
model.add(Activation('relu')) | |
model.add(MaxPooling2D(poolsize=(3, 3))) | |
model.add(Convolution2D(128, 64, 7, 7, border_mode='full')) | |
model.add(BatchNormalization((128,115,115))) | |
model.add(Activation('relu')) | |
model.add(MaxPooling2D(poolsize=(3, 3))) | |
model.add(Convolution2D(192, 128, 3, 3, border_mode='full')) | |
model.add(BatchNormalization((128,112,112))) | |
model.add(Activation('relu')) | |
model.add(MaxPooling2D(poolsize=(3, 3))) | |
model.add(Convolution2D(256, 192, 3, 3, border_mode='full')) | |
model.add(BatchNormalization((128,108,108))) | |
model.add(Activation('relu')) | |
model.add(MaxPooling2D(poolsize=(3, 3))) | |
model.add(Flatten()) | |
model.add(Dense(12*12*256, 4096, init='normal')) | |
model.add(BatchNormalization(4096)) | |
model.add(Activation('relu')) | |
model.add(Dense(4096, 4096, init='normal')) | |
model.add(BatchNormalization(4096)) | |
model.add(Activation('relu')) | |
model.add(Dense(4096, 1000, init='normal')) | |
model.add(BatchNormalization(1000)) | |
model.add(Activation('softmax')) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
why your Convolution2D have four customized parameters? currently version's keras only need 3 params..??