|
Algorithm 3 The gas recognition algorithm based on CNN
|
| 1 Input:
E represents the error; e represents the set error value; k represents the number of iterations and K represents the maximum batch; represents all data sets. |
| 2 Process:
|
| //training the LeNet-5
|
| 3 for do |
| 4 One-Hot encoding and data set partition |
| 5 training dataset and testing dataset are obtained |
| 6 Begin of training time |
| 7 for all training dataset do |
| 8 for do |
| 9 Algorithm 1 |
| 10 if then do |
| 11 Algorithm 2 and return to step 8 |
| 12 else |
| 13 break; |
| 14 end |
| 15 end |
| 16 end |
| 17 End of training time |
| 18 store all and all
|
| // test the LeNet-5
|
| 19 Load all and all to the LeNet-5 then do |
| 20 Begin of test time |
| 21 for all testing dataset do |
| 22 Algorithm 1 which is forward propagation |
| 23 end |
| 24 End of test time |
| 25 Calculate the accuracy |
| 26 Output: training time, test time and accuracy. |