keras conv2d example : In this tutorial, we are going to study the keras conv2d example in detail. 2. The first CONV layer uses filters 7*7and all other layers in the network use other filters 3*3.
The StridedNet has important characteristics:
from keras.models import Sequential
from keras.layers.normalization import Batch Normalization
from keras.layers.convolutional import Conv2D
from keras.layers.core import Activation
from keras.layers.core import Flatten
from keras.layers.core import Dropout
from keras.layers.core import Dense
from keras import backend as K
class StridedNet:
@staticmethod
def build (width, height, depth, classes, reg, init="he_normal"):
model = Sequential ()
InputShape = (height, width, depth)
ChanDim = -1
if K.image_data_format () == "channels_first":
inputShape = (depth, height, width)
ChanDim = 1
The width, height, and depth parameters will affect the input volume shape.
The "channels_last" ordering and input shape is specified on Line 17 where the depth is last.
The keras backend is used to check the image_data_format we need to accommodate "channels_first" ordering.