In Keras, we can define the network as follows. Are there any way to output the shape after each layer. For instance, I want to print out the shape of inputs
after the line defining inputs
, then print out the shape of conv1
after the line defining conv1
, etc.
inputs = Input((1, img_rows, img_cols))
conv1 = Convolution2D(64, 3, 3, activation='relu', init='lecun_uniform', W_constraint=maxnorm(3), border_mode='same')(inputs)
conv1 = Convolution2D(64, 3, 3, activation='relu', init='lecun_uniform', W_constraint=maxnorm(3), border_mode='same')(conv1)
pool1 = MaxPooling2D(pool_size=(2, 2))(conv1)
conv2 = Convolution2D(128, 3, 3, activation='relu', init='lecun_uniform', W_constraint=maxnorm(3), border_mode='same')(pool1)
conv2 = Convolution2D(128, 3, 3, activation='relu', init='lecun_uniform', W_constraint=maxnorm(3), border_mode='same')(conv2)
pool2 = MaxPooling2D(pool_size=(2, 2))(conv2)
Just using model.summary()
, which gives you pretty print.
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