# Spatio-Temporal Behavior Detection in Field Manual Labor Based on Improved SlowFast Architecture
## 3 Dataset and Methods
### Improvements to SlowFast Network Structure
#### 3.2.1 CA Attention Modules  
The CA module encodes channel relationships and long-range dependencies through precise location information. It comprises two steps: coordinate information embedding and coordinate attention generation. The specific structure is illustrated in Figure 7. Examining the network structure diagram of the CA attention module, we observe that the input features undergo two distinct pooling operations to generate spatial dimension features. These features are then inputted into a convolutional layer, and this is followed by processing through Batch Normalization and a Sigmoid activation function to produce the attention graph. This process can be outlined in the following steps:  
Figure 6: The overall structure of CA-ACTION-SlowFast. 1. A coordinate information embedding operation is conducted. To enable the attention module to capture spatial long-range dependencies with precise location information, global pooling is decomposed into a pair of one-dimensional feature encoding operations. Spatial information is extracted from the input features through pooling operations, reflecting the statistical information of different locations in the feature map. For input \(X\), it undergoes pooling (Pooling) using pooling kernels with dimensions (\(H\), 1) and (1, \(W\)). This process encodes each channel along the horizontal and vertical coordinate directions, resulting in the output of the cth channel with height \(h\) and the output of the cth channel with width \(yes\), given as follows:  
\[z_{c}^{h}(h)=\frac{1}{W}\sum_{0\leq i<W}X_{c}(h,i) \tag{1}\]  
\[z_{c}^{W}(w)=\frac{1}{H}\sum_{0\leq j<H}X_{c}(j,w) \tag{2}\]  
2. The aforementioned two transformations conduct feature aggregation along two spatial directions, yielding a pair of direction-aware attention maps that signify the regions to which SlowFast should \"pay attention\". These transformations enable the attention module to capture long-range dependencies along one spatial direction and preserve precise location information along the other, enhancing the network's ability to accurately localize target regions of interest with deep features. Coordinate attention generation is subsequently performed by concatenating the two feature maps generated by the preceding module and then transforming them into features using a 1 \(\times\) 1 convolution, Batch Normalization (BatchNorm), and nonlinear activation. The output of this process can be expressed as follows:  
\[f=\delta\Big{(}F_{1}([z^{h},z^{w}])\Big{)} \tag{3}\]  
The variable \(f\in R^{\bigcirc\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \! 3. Feature recalibration: The original feature map undergoes recalibration through the generated attention map. As shown in Equation (6), the original features are weighted based on the generated attention map to accentuate specific regions that demand the model's focus. Here, \(i\) and \(j\) represent spatial location coordinates on the feature map, and \(X_{c}(i,j)\) signifies the original feature map. The outputs \(j_{c}^{h}(i)\) and \(j_{c}^{w}(j)\) are amalgamated into a weighting matrix for computing the recalibration weights. These weights are then multiplied with the original feature map, yielding \(Y_{c}(i,j)\), which signifies the output feature values at position \((i,j)\) post the processing by the coordinate attention block. The objective of this step is to optimize the feature representation to align with the attentional requirements of the model by accentuating pivotal regions:  
\[Y_{c}(i,j)=X_{c}(i,j)\times j_{c}^{h}(i)\times j_{c}^{w}(j) \tag{6}\]  
In SlowFast networks, the slow branching network is designed to learn spatial information, with the number of channels set to \(\beta\) times that of the fast branches. The increase in the number of channels implies richer features. However, treating these features equally during the learning process may lead the network to learn features that are not beneficial for behavior classification tasks.