## 3 Methods
### Segmenter
#### 3.1.4 Bidirectional Convolutional LSTM Temporal Modeling Module  
While CBAM enhances critical features through channel and spatial attention mechanisms, it remains limited in capturing long-range spatial dependencies. Moreover, conventional unidirectional LSTM networks can only exploit past information, making them inadequate for modeling bidirectional contextual relationships--particularly when dealing with complex structures or ambiguous boundaries in skin lesion regions. To address these limitations and further improve the model's capacity for understanding and perceiving lesion areas, we introduce a Bidirectional Convolutional Long Short-Term Memory (BDC-LSTM) module following the attention mechanism. ConvLSTM integrates convolutional operations into the traditional LSTM architecture, enabling it to process spatially structured sequential data more effectively. Unlike fully connected LSTMs, ConvLSTM applies convolutional operations to the input, hidden states, and gating mechanisms, thereby capturing spatial features and local dependencies with greater precision. The core computations of ConvLSTM include the input gate \(i_{t}\), forget gate \(f_{t}\), output gate \(o_{t}\), and the update of the cell state, all of which are adapted to handle spatial information inherent in image data. The corresponding calculation formula is given in Equations (13)-(17). \[i_{t}=\sigma(W_{xi}*X_{t}+W_{bi}*H_{t-1}+W_{ci}*C_{t-1}+b_{i}) \tag{13}\]  
Figure 5: Spatial attention module diagram. Figure 6: Multi-scale hybrid attention module architecture diagram. \[f_{t}=\sigma\Big{(}W_{xf}*X_{t}+W_{hf}*H_{t-1}+W_{cf}*C_{t-1}+b_{f}\Big{)} \tag{14}\]  
\[C_{t}=f_{t}\odot C_{t-1}+i_{t}tanh(W_{xc}*X_{t}+W_{hc}*H_{t-1}+b_{c}) \tag{15}\]  
\[o_{t}=\sigma(W_{x0}*X_{t}+W_{ho}*H_{t-1}+W_{co}*C_{t-1}+b_{c}) \tag{16}\]  
\[H_{t}=o_{t}\odot tanh(C_{t}) \tag{17}\]  
In the mathematical formulation, \(W\) denotes the learnable weight matrices, \(b\) represents the bias terms, \(X_{t}\) signifies the input tensor at time step \(t\), \(H_{t}\) corresponds to the hidden state tensor, and \(C_{t}\) indicates the cell state tensor. The operator \(\sigma\) refers to the sigmoid activation function, while \(\odot\) designates the element-wise multiplication (Hadamard product) operation. Building upon this foundation, we integrate the Bidirectional Convolutional Long Short-Term Memory (BDC-LSTM) module after the attention mechanism. On one hand, this strategy leverages the salient features enhanced by the attention mechanism as input, allowing the model to focus more effectively on key regions for spatiotemporal modeling. On the other hand, it compensates for the limitations of attention mechanisms in capturing long-range dependencies, thereby improving the model's ability to recognize lesion morphology variations and ambiguous boundaries. The BDC-LSTM module consists of two independent ConvLSTM branches: a forward branch that processes the feature sequence \(\{X_{1},X_{2},\cdots,X_{t}\}\) in chronological order, gradually accumulating information from past states; and a backward branch that traverses the sequence in reverse order \(\{X_{t},X_{t-1},\cdots,X_{1}\}\), modeling the potential influence of future states on the current state. At each time step, the hidden states from both the forward and backward ConvLSTM branches are non-linearly transformed and fused using a hyperbolic tangent (tanh) activation function, resulting in a more comprehensive spatiotemporal context representation. The detailed process is illustrated in Figure 7. This bidirectional structure enables BDC-LSTM to aggregate feature information from both temporal directions, effectively establishing long-range contextual dependencies and enhancing the consistency of feature representation as well as segmentation accuracy. The corresponding computation is defined in Equation (18).