# Evaluation Model of Rice Seeding Production Line Seeding Quality Based on Deep Learning
## 2 Materials and Methods
### Model Construction
#### 2.2.2 SE Attention Mechanism  
In this experiment, the uniformity of the original image capture environment within the rice seedling production workshop presents a significant challenge in image data feature extraction. The attention mechanism, mirroring the selective focus of human vision, concentrates on salient features while disregarding less critical information, thereby optimizing recognition performance [16]. This mechanism encompasses both channel and spatial attention, the former being crucial in directing the model's focus towards channels most beneficial for classification. Pertinent to this study's focus on classifying missed sowing areas in rice seedling trays, the ResNet50 model was improved with a squeeze-and-excitation network (SE). This enhancement aims to improve the model's proficiency in extracting features from tray images [17], with the network architecture of the channel attention mechanism depicted in Figure 9.  
The SE module primarily consists of three steps. In the first step, a feature map X is processed through the \(F_{tr}\) convolution to obtain a feature map U of size \(H\times W\times C\). Feature map U is then compressed through \(F_{sq}\) to yield a \(1\times 1\times C\) output, which is achieved by global average pooling, compressing the two-dimensional features of each channel into a single real number [18]. Its expression is given in Equation (1):  
\[z_{c}=F_{sq}(u_{c})=\frac{1}{W\times H}\sum_{i=1}^{W}\sum_{j=1}^{H}u_{c}(i,j) \tag{1}\]  
\(W\) and \(H\) represent the width and height of the feature map, respectively; \(u_{c}\) represents the input feature map; \(c\) represents the number of feature channels; \(i\) and \(j\) represent the row and column values of the feature data, respectively; and \(z_{c}\) is the output data feature value.  
In the second step, the \(1\times 1\times C\) matrix activated by \(F_{ex}\) is regarded as \(z\), giving each channel different weights. The \(z\) matrix passes through a fully connected layer, reducing its dimensions to \(C/r\), where \(r\) is the scaling size parameter. After activation by the ReLU function, it passes through another fully connected layer to restore its dimensions to \(C\), maintaining consistency between input and output channels. Finally, the sigmoid function is used to calculate the feature weights \(s\), as expressed in Equation (2):  
\[s=F_{ex}(z,W)=\sigma(g(z,W))=\sigma(W_{2}\delta(W_{1}z_{c})) \tag{2}\]  
Wherein \(\delta\) represents the ReLU activation function, \(\sigma\) denotes the sigmoid function, and \(s\) is the feature weight.  
Figure 9: SE channel attention mechanism.  
The third step involves multiplying the output \(s\) from the previous step with the original feature data, thereby implementing a weighted calibration of the channel's original data features, as expressed in Equation (3):  
\[\widetilde{x}_{c}=F_{scale}(u_{c},s_{c})=s_{c}\cdot u_{c} \tag{3}\]  
In the equation presented, \(u_{c}\) denotes the \(c\)-th channel of the feature map \(U\), while \(s_{c}\) signifies the c-th channel of the \(1\times 1\times C\) weight matrix. The term \(F_{scale}\) refers to the calibration operation applied within this context.