I want my activation function select maximal value, generated by N
filters of M x M
convolution. This layer would convert X
channel image to 1-channel one.
How to do that?
First I wrote
classifier.add(Conv2D(3, (5, 5), activation='linear')
classifier.add(MaxPooling2D(pool_size=1, strides=1))
but then thought it doesn't return 1-channel image, but returns 3 channel.
How to do the job?
So to apply this you shoud create a Lambda
layer and max
from Backend:
from keras import backend as K
if K.image_data_format() == "channels_first":
channels_axis = 1
else:
channels_axis = 3
# To apply MaxOut:
classifier.add(Lambda(lambda x: K.max(x, axis=channels_axis, keepdims=True)))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With