|
Algorithm 1 The forward propagation algorithm of CNN
|
| 1 //process of the forward propagation |
| 2 Input: training set ; the number of CNN layers is L, each layer denoted as ; represents the input sample corresponding to the output of layer ; expected output . |
| 3 Process:
|
| 4 Initialization: Initialize all layers of convolutional kernel and offset term . |
| 5 for all do |
| 6 for do |
| 7 if ( is the convolutional layer) then |
| 8 for (all ) do |
| 9 get according to (1) |
| 10 end |
| 11 end |
| 12 if ( is the pooling layer) then |
| 13 for (all ) do |
| 14 get according to (7) |
| 15 end |
| 16 end |
| 17 if ( is fully connected layer) |
| 18 for(all ) do |
| 19 get according to (8) |
| 20 end |
| 21 end |
| 22 if ( is output layer) then |
| 23 get or according to (9) |
| 24 end |
| 25 end |
| 26 end |
| 27 Output: Calculate the error of the output layer by the loss function, according to (11). |