ksohan
ksohan

Reputation: 1203

How many hidden layers are there?

model = Sequential()
model.add(Conv2D(32, (3, 3), input_shape=input_shape))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))

model.add(Conv2D(32, (3, 3)))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))

model.add(Conv2D(64, (3, 3)))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
    
model.add(Flatten())  
model.add(Dense(64))
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add(Dense(1))
model.add(Activation('sigmoid'))

As far as I understand, model.add(Conv2D(32, (3, 3), input_shape=input_shape)) is the input layer here and model.add(Activation('sigmoid')) is the output layer.

There are a total 13 other layers between the input and output layers. So are there 13 hidden layers in the model? Or less? What are the names of the layers that should be counted as hidden layers?

I am confused about whether Activation or MaxPooling2D or Dropout should be counted as a single hidden layer or not.

Upvotes: 0

Views: 329

Answers (1)

Renu Patel
Renu Patel

Reputation: 51

Activation functions are not the hidden layers. Layers will be - Conv2D,MaxPooling2D,Flatten,Dense

You can use below code to get the model architecture details.

model.summary()

Upvotes: 1

Related Questions