In order to improve the accuracy of network traffic classification, a traffic classification method combining an attention mechanism and a convolutional neural network was proposed. An attention mechanism layer was designed and implemented on the basis of the convolutional neural network model, which received the output of the fully connected layer as input, calculated the weight of the input features, and multiplied it by the original features to strengthen the key features. This, in turn, helped to improve the model's ability to capture key information. Secondly, in order to solve the problem that the model was overfitting to the high-proportion category due to the unbalanced sample number of network traffic categories, and it was difficult to identify the small-proportion categories, a method to augment the dataset was proposed. Considering the perspective of hyperparameter combination optimization, a hyperparameter search strategy based on Bayesian optimization and five-fold cross-validation was proposed to optimize the hyperparameter combination of the model. The combination of hyperparameters of the model was determined by the above methods. The public dataset was used for the above experiments and model tests. The results show that compared with other methods, the overall accuracy, precision, and F1 score are significantly improved, which verifies that the proposed method has better classification performance.
| 科 Family | 属数 Number of genus | 种数 Number of species | 占总种数比例 Percentage of total species (%) | 属 Genus | 种数 Number of species | 占总种数比例 Percentage of total species (%) |
|---|---|---|---|---|---|---|
| 鹅膏菌科Amanitaceae | 2 | 11 | 5.26 | 鹅膏菌属 Amanita | 10 | 4.78 |
| 小菇科 Mycenaceae | 2 | 12 | 5.74 | 丝盖伞属 Inocybe | 5 | 2.39 |
| 多孔菌科 Polyporaceae | 8 | 14 | 6.70 | 蜡蘑属 Laccaria | 5 | 2.39 |
| 红菇科 Russulaceae | 3 | 23 | 11.00 | 小皮伞属 Marasmius | 6 | 2.87 |
| 小菇属 Mycena | 11 | 5.26 | ||||
| 光柄菇属 Pluteus | 5 | 2.39 | ||||
| 红菇属 Russula | 17 | 8.13 | ||||
| 栓菌属 Trametes | 5 | 2.39 |