## 2 Proposed Method
### Optimal Distortion Search  
Assuming the current problem is a \(k\)-way, \(N\)-shot task, the overall framework of the optimal distortion search (ODS) is represented in Figure 3, where \(X_{ij}\) denotes a specific image's data in the support set, and \(X_{ij}^{D}\) represents the image after feature distortion. The core idea of this method is to introduce additional distortion to the sample features provided by the support set, allowing these features to generate appropriate shifts in the feature space. In the initial stages of the method, we need to obtain a similarity matrix \(S_{ij}\) for each sample in the support set with all other samples. Here, \(i\) and \(j\) represent the indices of images in the support set, \(S\) represents the similarity between image pairs, and f denotes a convolutional neural network. From this matrix, we can find the maximum and minimum values of intraclass similarity \(S_{ij}^{\text{intra}}\) for each sample, as well as the maximum and minimum values of interclass similarity \(S_{ij}^{\text{inter}}\). Similarly, \(S_{ij}^{\text{intra}}\) and \(S_{ij}^{\text{inter}}\), respectively, represent the  
Figure 3: Schematic diagram of data augmentation method based on distortion magnitude optimization. Through the similarity comparison, the current distortion magnitude is gradually updated to a better level. During this workflow, optimizing the magnitude of feature shifts induced by distortion leads to better intraclass space and interclass boundaries. similarity matrices between the current distorted sample and samples of the same class and other classes, which can be represented as follows:  
\[S_{ij}^{\text{Dintra}}= \begin{bmatrix}S_{i1}^{D}\\ S_{i2}^{D}\\ \cdots\\ S_{i(i-1)}^{D}\\ S_{i(j+1)}^{D}\\ \cdots\\ S_{i(N-1)}^{D}\end{bmatrix} ,S_{ij}^{\text{Dinter}}= \begin{bmatrix}S_{11}^{D}&S_{21}^{D}& \cdots&S_{(i-1)1}^{D}&S_{(i+1)1}^{D}&\cdots&S_{(k-1)1}^{D}\\ S_{12}^{D}&S_{22}^{D}&\cdots&S_{(i-1)2}^{D}&S_{(i+1)2}^{D}&\cdots&S_{(k-1)2}^{D} \\ \cdots&\cdots&\ddots&\cdots&\cdots&\cdots&\cdots\\ S_{1N}^{D}&S_{1N}^{D}&\cdots&S_{(i-1)N}^{D}&S_{(i-1)N}^{D}&\cdots&S_{(k-1)N}^{D }\end{bmatrix}  \tag{1}\]  
Depending on the magnitude of the distortion, the feature vectors of the distorted samples may exhibit a significant shift from their original positions. Therefore, during the process of updating the distortion parameters, it is essential to impose reasonable constraints on this range. Therefore, we set \(S_{\min}^{\text{intra}}\) and \(S_{\max}^{\text{inter}}\) as the expected target values to achieve for \(S_{ij}\). In previous few-shot learning methods, these two parameters were often set to 0 and 1, but in the distortion magnitude search process, such settings can lead to issues. For example, it may result in distorted sample features being too close to the original features, rendering the distortion itself meaningless. So, in our approach, we uniformly set the threshold for \(S_{\min}^{\text{intra}}\) to be 0.7 (set to 0.7 if it falls below this value) and the threshold for \(S_{\max}^{\text{inter}}\) to be 0.3 (set to 0.3 if it exceeds this value). This choice aims to ensure that the distortion of features increases the similarity between the current image and the sample with the minimum intraclass similarity while decreasing the similarity with the sample with the maximum interclass similarity. This way, the feature vector of the distorted image can approach the intraclass boundary as closely as possible while staying far away from the feature boundary of other sample classes in the support set. The loss function in the optimization process is defined as follows:  
\[L_{\text{d}}=\frac{1}{N}\sum_{i=1}^{N}\frac{1}{k}\sum_{j=1}^{k}Max\Big{(} \Big{|}S_{\min}^{\text{intra}}-Min\Big{(}S_{ij}^{\text{Dintra}}\Big{)}\Big{|},\Big{|}S_{\max}^{\text{inter}}-Max\Big{(}S_{ij}^{\text{Dinter}}\Big{)}\Big{|} \Big{)} \tag{2}\]  
This framework shares the same feature extractor \(f\) and fully connected layers with the earlier pretrained model.