Skip to content

Instantly share code, notes, and snippets.

@peune
Created January 13, 2019 16:08
Show Gist options
  • Save peune/b2196dd5c116ce35f30488585430cfac to your computer and use it in GitHub Desktop.
Save peune/b2196dd5c116ce35f30488585430cfac to your computer and use it in GitHub Desktop.
from keras.models import Sequential, Model
from keras.layers import (Conv2D, Dense, GlobalAveragePooling2D,
BatchNormalization, Activation, Flatten,
Reshape, Input)
x = Input(shape=(140,140,1))
y = Conv2D(16, (10,10), strides=(10,10), padding='valid')(x)
y = BatchNormalization()(y)
y = Activation('relu')(y)
y = Conv2D(8, (3,3), strides=(2,2), padding='same')(y)
y = BatchNormalization()(y)
y = Activation('relu')(y)
y = Conv2D(8, (3,3), padding='same')(y)
y = BatchNormalization()(y)
y = Activation('relu')(y)
# bbox prediction only
# 1 bbox = x,y,w,h,conf
z = Flatten()(y)
z = Dense(10, activation='sigmoid')(z)
z = Reshape((2,5))(z)
# region proposal network
rpn = Model(inputs=[x], outputs=[z])
rpn.summary()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment