## 4 One-Dimensional Residual Attention Convolutional Neural Network Model
### Residual Attention Block  
The color features of the rare earth solution image data utilized in this study are susceptible to external environmental interference during the measurement process. This interference manifests as noise during model learning and training. As the number of layers in the model network increases, the weight corresponding to the noise continually increases as well. To mitigate this effect, an attention mechanism module based on the residual is introduced in this paper. The attention mechanism can adjust the weight of each channel, enabling the model to focus more on significant features, thereby reducing the impact of noise on the model. The Residual Attention Block (RAB) primarily consists of two components, namely, the residual connection branch and the attention mechanism branch. The structure of the residual branch aligns with that of the residual network. In the residual branch, the network learns the residual map, not the underlying map of the input at that layer. The connection to the output through identity mapping is referred to as a skip connection [28]. In the residual branch, the network learns the difference between the input and the expected output, rather than directly learning the output. The implementation of the residual block is as follows:  
\[y=f(H(x,W)+h(x)) \tag{18}\]  
where \(y\) represents the output of the residual block, \(f\) is the activation function, \(W\) is the weight parameter, \(x\) is the input, \(H(x,W)\) is the residual map to be learned, and \(h(x)\) is the identity map. In neural networks, the residual mapping is often easier to optimize than the original mapping. Assuming that an identity mapping in a neural network is its optimal solution, it is much more difficult to fit the identity mapping by stacking multi-layer nonlinear networks than to reduce the residual to zero. If the input \(x\) is represented as the underlying mapping is represented as \(H(x)\), the residual mapping is defined as:  
\[F(x)=H(x)-x. \tag{19}\]  
Using the residual attention block, the deep information of the data can be extracted based on retaining the residual structure, while the weight ratio of noise can be suppressed by the attention mechanism. The residual attention block structure is shown in Figure 3.  
Figure 3: Residual attention block composition diagram. The fundamental structure of a Residual Attention Block (RAB) is primarily composed of two convolution layers, namely, a global average pooling layer and a fully connected layer. An RAB contains three branches: the residual connection branch, the convolution branch, and the attention branch. The function of the residual connection branch is to add skip connections to the network. The convolution branch performs convolution operations on the input data. The attention branch changes the weight ratio between the feature maps, assigning more weight to more important features. The operation process of a RAB is as follows. First, the input features are convolved to obtain the output of the convolution branch \(h(x)\). Then, the channel information of the upper layer is globally averaged pooled to obtain the compressed global information, expressed in the following formula:  
\[g(x)=\frac{1}{k}\sum_{k=1}^{k}h(x). \tag{20}\]  
In the above formula, \(h(x)\) is the output of the second convolution layer and \(k\) represents the number of channels in the convolution layer. The global channel information is transformed into its corresponding weight ratio through a fully connected layer and the softmax activation function, yielding the output of the attention branch. The formula for this process is as follows:  
\[z(x)=\delta(F(g(x),W)). \tag{21}\]  
In the above formula, \(\delta\) is the softmax activation function, \(F(g(x),W)\) for the global channel information for the input conditions, with the whole connection layer corresponding to the function. Ultimately, the output of the convolution branch is multiplied by the output of the attention mechanism branch.