## 3 Materials and Methods
### Gated Probability Fusion Module
Through local feature matching and internal correlation analysis, the gated fusion module could effectively concatenate various intraclass variations and distinguish small interclass differences for fine-grained pest identification. In the last step, the cross-entropy(CE) loss function is required to estimate the inconsistency degree between the true annotations of each image and the relative predicting probabilities. The usual pathway of building loss function is to make some regularization constraints such as L1 or L2 terms in order to minimize the error separation between annotations and predictions to a small enough value. However, CE loss functions are dramatically encouraging adjacent predicting probabilities of different sub-modules similar to each other, which potentially causes the overfitting description of intraclass discrepancy. This easily leads to the very low interclass recognition in handling fine-grained pests with a similar appearance. Therefore, a novel fuse loss is proposed to synthesize multiple probability outputs of sub-modules to optimize overall model training. The equation of fuse loss is listed as follows:  
\[FLoss=L_{fuse}+\lambda_{1}L_{gate}+\lambda_{2}L_{feature}=-\sum\limits_{c=1}^{ W}\widetilde{y}_{c}\log(s_{c})-\lambda_{1}\sum\limits_{i=1}^{2}\sum\limits_{j=1}^{ N}G_{ij}TopK_{i}-\lambda_{2}\sum\limits_{i=1}^{2}\sum\limits_{c=1}^{N} \widetilde{y}_{c}softmax(F_{i}) \tag{9}\]  
The fuse loss is designed to cover three main sub-modules for identifying fine-grained pest categories, where \(L_{fuse}\) means the united loss of soft-VLAD and fusion modules. \(L_{gate}\) denotes the partial loss of the gating network, and \(L_{feature}\) means the feature loss of the truncated backbone network. Then, two arguments \(\lambda_{1}\in[0,0.5]\) and \(\lambda_{2}\in[0,0.5]\) are introduced to balance the weightings of different compositions. \(\widetilde{y}_{c}\) is the matching parameter, which is set to 1 if the predicting result of the \(c\)-th category is the same as true annotation, otherwise 0. \(W\) indicates the number of pest categories. In the training and testing processes, the aforementioned fuse loss will guide the whole proposed method to approach the optimal solution, improving the overall performance for fine-grained pest identification. The detailed network structure of the above processes is shown in Figure 5 as follows:In this paper, some network hyperparameters are initialized to make sure the efficient training and credible learning of the entire model. The learning rate of the backbone network is set initially as 1e\(-\)3 in the first 30 cycles. Starting from the 31 st cycle to the 140 th cycle, the cosine annealing strategy is applied to reduce the learning rate in 70% attenuation ratio, until down to the minimum value 1e\(-\)7 of learning rate. The annealing step is set as 2, and each stage length is set for 20 cycles. During the training process, the size of the mini-batch was set to 128 according to the computing resources. The initial number of the gate value \(k\) is set to 6. Then, the Adam optimization is selected as the default settings to dynamically turn the adaptive learning rate on or off and adjust massive parameters to optimal results. Moreover, we pre-trained the proposed network on the public ImageNet data set to achieve the pre-training weights, then loaded it to learn the fine-grained identification ability on professional pest data sets. This operation helps the whole training process approach to the preferable direction with faster convergence.