<p>After the first Conv layer, the size reduced to 20x20
for the primary caps which is convolutional caps layer
n final = (n + 2p -f )/s + 1
which gives a 6x6 output with 256 channels</p>

<p>6x6x256 is further encoded into capsules of 8 dimensions by reshaping the channels 
i.e. 256/8 = 32
which gives 6x6x32 = 1152 capsules</p>

<p>try experimenting with the same hyperparameters first and then try to encode higher-level features by making suitable changes to the hyperparameters. </p>

CC BY-SA 4.0
2019-08-13T17:25:38.693Z
2019-08-13T17:25:38.693Z
Bhavya Shah
<p>I want to experiment with capsule networks on facial expression recognition (FER). For now, I am using fer2013 Kaggle dataset.</p>

<p>One thing that I didn't understand in capsule networks was in the first convolution layer, the size was reduced to 20x20 - having input image as 28x28 and filters as 9x9 with 1 stride. But, in the capsules, the size reduces to 6x6. </p>

<p>How did this happen? Because with the input size as 20x20 and filters as 9x9 and 2 strides, I couldn't get 6x6. Maybe I missed something.</p>

<p>For my experiment, the input size image is 48x48. Should I use the same hyperparameters for the start or are there any suggested hyperparameters that I can use?</p>

<neural-networks><machine-learning><deep-learning><convolutional-neural-networks><capsule-neural-network>
Why does the size reduce to $6 \times 6$ in the capsule networks?
nirvair
# Why does the size reduce to $6 \times 6$ in the capsule networks?

(Asked by: username_0 on 2018-05-14)

I want to experiment with capsule networks on facial expression recognition (FER). For now, I am using fer2013 Kaggle dataset.

One thing that I didn't understand in capsule networks was in the first convolution layer, the size was reduced to 20x20 - having input image as 28x28 and filters as 9x9 with 1 stride. But, in the capsules, the size reduces to 6x6.

How did this happen? Because with the input size as 20x20 and filters as 9x9 and 2 strides, I couldn't get 6x6. Maybe I missed something.

For my experiment, the input size image is 48x48. Should I use the same hyperparameters for the start or are there any suggested hyperparameters that I can use?

**Tags:** neural-networks, machine-learning, deep-learning, convolutional-neural-networks, capsule-neural-network


---

## 1 answers

### Answer by username_1 on 2019-08-13. Score: 1

After the first Conv layer, the size reduced to 20x20
for the primary caps which is convolutional caps layer
n final = (n + 2p -f )/s + 1
which gives a 6x6 output with 256 channels

6x6x256 is further encoded into capsules of 8 dimensions by reshaping the channels
i.e. 256/8 = 32
which gives 6x6x32 = 1152 capsules

try experimenting with the same hyperparameters first and then try to encode higher-level features by making suitable changes to the hyperparameters.


---

