How to Use the Decoder of a CNN Model

Hi all,
I have created a CNN model in tensorflow 1.13. It is an autoencoder. I really don’t know how to input an image into it from the left side and get an encoded-decoded image back from the right side. Here is the model summary.

Layer (type) Output Shape Param # Connected to

input_1 (InputLayer) (None, 42, 64, 3) 0


conv2d_1 (Conv2D) (None, 42, 64, 64) 15616 input_1[0][0]


batch_normalization_1 (BatchNor (None, 42, 64, 64) 256 conv2d_1[0][0]


conv2d_2 (Conv2D) (None, 42, 64, 4) 2308 batch_normalization_1[0][0]


batch_normalization_2 (BatchNor (None, 42, 64, 4) 16 conv2d_2[0][0]


conv2d_3 (Conv2D) (None, 21, 32, 8) 296 batch_normalization_2[0][0]


batch_normalization_3 (BatchNor (None, 21, 32, 8) 32 conv2d_3[0][0]


conv2d_4 (Conv2D) (None, 21, 32, 8) 1608 batch_normalization_3[0][0]


batch_normalization_4 (BatchNor (None, 21, 32, 8) 32 conv2d_4[0][0]


conv2d_5 (Conv2D) (None, 11, 16, 192) 38592 batch_normalization_4[0][0]


lambda_1 (Lambda) (None, 11, 16, 192) 0 conv2d_5[0][0]


reshape_1 (Reshape) (None, 1056, 32) 0 lambda_1[0][0]


digitcaps (CapsuleLayer) (None, 4, 4) 540672 reshape_1[0][0]


mask_2 (Mask) (None, 16) 0 digitcaps[0][0]


capsnet (Length) (None, 4) 0 digitcaps[0][0]


decoder (Sequential) (None, 42, 64, 3) 48539 mask_2[0][0]

Total params: 647,967
Trainable params: 647,795
Non-trainable params: 172


And yes, I am creating a capsule network architecture. But does this matter?

Hi Adil_Raja / Welcome to the Tensorflow forum.
Have tried to follow model/code examples available online such as Intro to Autoencoders or tf.data: Build TensorFlow input pipelines or any other great tutorial related to your own use case and put together by the Tensorflow team? Where do you get stuck, exactly?