Table 4.
Algorithm and training procedure of restricted Boltzmann machine-capsule networks (RBM-CapsNet).
| Algorithm: RBM-CapsNet training algorithm, using a mini-batch stochastic gradient descent (SGD) for simplicity. |
|
Input: mini batch feature vector (x); Number of RBM training epoch (S1); Number of Capsule training epoch (S2); Number of dynamic routing iterations (iter). Output: Length of each capsules (Len). |
| 1: For n=1 to S1 do
2: ………………………………………{RBM1 training} 3: End for 4: For n=1 to S1 do 5: …………………………………{RBM2 training} 6: End for |
| 7: For n=1 to S2 do
8: 9: 10: 11: For all capsule i in PrimaryCaps layer:…………{contribution computes Eq. 1} 12: For all capsule i in PrimaryCaps layer and capsule j in DigitCaps layer: 13: For m=1 to iter do 14: For all capsule i in PrimaryCaps layer: ……{softmax computes Eq. 2-1} 15: For all capsule j in DigitCaps layer:………{dynamic computes Eq. 2-2} 16: For all capsule j in DigitCaps layer:…………{squash computes Eq. 2-3} 17: For all capsule i in PrimaryCaps layer and capsule j in DigitCaps layer: 18: End for |
| 19:
20: ………………………………………{loss computes Eq. 3} 21: 22: 23: 24: End for |