SAR (Synthetic Aperture Radar) image ship classification method and device based on adversarial elimination over-fitting and medium
Through the adversarial training method, the cross-training of the scatter feature extraction network and the discriminator network is solved, and the accuracy and generalization ability of the classification model are improved.
Patent Information
- Application Number
- CN202510629620.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-16
- Publication Date
- 2025-08-15
AI Technical Summary
Due to the low resolution of SAR images and unclear imaging, it is difficult to label ship types and small samples, which leads to overfitting of classification models during training, affecting the generalization and accuracy of classification models.
Adversarial training method is adopted to cross-train the scatter feature extraction network and discriminator network through cross-training, and the gradient inversion layer and binary cross-entropy loss function are used to update the network parameters, suppress the model's over-memory of the training set and improve the generalization of the features.
It effectively alleviates the overfitting problem, improves the accuracy and generalization ability of SAR image ship type classification, and ensures the good performance of the model in different fields.
Smart Images

Figure CN120495895A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of ocean monitoring and management technology, and in particular to a method, device and medium for classifying ships in SAR images based on countermeasures to eliminate overfitting. Background Art
[0002] The classification of ship targets (different ship types) is crucial for maritime safety and traffic control. In the field of ocean monitoring and management, ship classification using SAR (Synthetic Aperture Radar) imagery plays a crucial role. Because SAR can capture ocean surface imagery in all weather conditions and at all times, it provides powerful support for ship classification.
[0003] Researchers have also conducted extensive research based on SAR imagery. However, due to the low resolution and unclear image quality of SAR images, ship type labeling is difficult, and the availability of well-labeled SAR image classification data is limited. Therefore, the limited sample size presents a significant challenge in the practical task of ship type classification using SAR images. This limited sample size makes it highly susceptible to overfitting during the training of relevant classification models. Overfitting essentially occurs when a classification model overlearns specific feature patterns in the training set. While these features perform well in the training set, due to the small number of training samples, the classification accuracy of the model decreases significantly when applied to other samples. For example, when testing the classification model on a test set, although the feature distributions of the training and test set images are identical (they are randomly partitioned from a set of images acquired by the same device under the same conditions), the model's training on the training set results in significant differences in the features extracted from the training and test sets. Consequently, when the classification model is applied to the test set, it lacks the ability to effectively generalize to the features in the test set, resulting in a sharp decline in classification performance, severely impacting the model's generalization and accuracy, and ultimately leading to inaccurate SAR image ship classification results. Summary of the Invention
[0004] The purpose of this application is to provide a SAR image ship classification method, device and medium based on countermeasures to eliminate overfitting, which can solve the problem of inaccurate SAR image ship type classification in the case of a small number of SAR images in the related art.
[0005] To achieve the above objectives, this application provides the following solutions.
[0006] In a first aspect, the present application provides a SAR image ship classification method based on adversarial elimination of overfitting, comprising: preprocessing the SAR image to determine the target SAR image; inputting the target SAR image as a first sample into a scattering feature extraction network to determine a first eigenvector; the first sample comprises a training set and a test set; the target SAR image in the training set corresponds to the training set label; the target SAR image in the test set corresponds to the test set label; after passing the first eigenvector through a gradient reversal layer, the first eigenvector is input into a discriminator network to determine a prediction result of the discriminator network; the prediction result includes the probability that the first eigenvector corresponds to the training set label and the probability that the first eigenvector corresponds to the test set label; based on the prediction results of the gradient reversal layer and the discriminator network, Cross entropy loss function, update the scattering feature extraction network and the discriminator network, and obtain the discriminator network with updated parameters and the scattering feature extraction network with updated parameters; the target SAR image in the training set and the real category label of the ship are used as the second sample; the second sample is input into the classification model to determine the updated scattering feature extraction network, and the updated scattering feature extraction network is used as the scattering feature extraction network, and the return step "input the target SAR image as the first sample into the scattering feature extraction network to determine the first feature vector" is returned until the trained classification model is determined; the classification model includes the scattering feature extraction network with updated parameters and the type recognition network; the SAR image of the target to be measured is input into the trained classification model to determine the ship type classification result of the SAR image of the target to be measured.
[0007] In a second aspect, the present application provides a computer device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described SAR image ship classification method based on adversarial elimination of overfitting.
[0008] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described SAR image ship classification method based on adversarial elimination of overfitting.
[0009] According to the specific embodiments provided in this application, this application discloses the following technical effects.
[0010] This application performs scattering transformation on the target SAR images in the training set and the test set through a scattering feature extraction network, which can capture the local texture and structural information of the target SAR images at different scales and directions. That is, the multi-scale and multi-directional analysis can obtain the first eigenvector more comprehensively and accurately, providing a rich information basis for the subsequent classification of ship types and improving the recognition and classification capabilities of ships of different shapes.
[0011] The present application then designs a scattering feature extraction network and a discriminator network as adversarial training networks to fully learn generalization features. This is because during the training process, the discriminator network is trained using the training set and test set as the first samples, introducing sample features from the test set. This allows the discriminator network to accurately determine the probability that the first feature vector extracted by the scattering feature extraction network comes from a training set sample or a test set sample. The scattering feature extraction network then generates a first feature vector that can confuse the discriminator. This adversarial training method encourages the scattering feature extraction network to generate more generalizable first feature vectors and simultaneously possesses the ability to effectively generalize features from both the training and test sets, preventing the subsequent classification model from overfitting the training set. This allows the classification model to perform well on SAR images from different domains (training and test sets), alleviating overfitting and improving the accuracy of subsequent ship type classification. Simultaneously, the adversarial training network is cross-trained with the classification model. Based on the second sample, the trained classification model is determined, and the ship type classification result for the SAR image under test is then determined. This improves the accuracy of ship type classification results in SAR images. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0013] Figure 1 The present invention provides a flowchart of a SAR image ship classification method based on countermeasures to eliminate overfitting provided in an embodiment of the present application.
[0014] Figure 2 This is a schematic diagram of the structure of a scattering feature extraction network provided in an embodiment of the present application. DETAILED DESCRIPTION
[0015] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0016] The core goal of machine learning model training is to accomplish specific tasks such as classification and prediction by learning the underlying patterns in the training data. When the sample size is small, the information available to the model is relatively limited. However, due to the high fitting capabilities of neural network-based models, this can easily lead the model to over-focus on every detail in the training data. Non-universal noise and random features in the training data are treated as important information for the model to learn and memorize. Deep neural networks, in particular, expand their representational space exponentially as the network depth increases. Without effective regularization constraints, deep networks will encode incidental features of the training samples into higher-order feature representations through layer-by-layer mapping, leading to increasingly severe overfitting.
[0017] This overfitting mechanism is most pronounced in the fully connected layers at the end of the model: the deep network continuously adjusts its parameters through backpropagation, forming a strong coupling between the terminal feature space and the distribution of the training set data. It is worth noting that even if the test and training sets meet the assumptions of independence and identical distribution, such as when they are collected under exactly the same conditions and obtained through random partitioning, the model gradually overfits the training samples during training, causing its generalization ability to gradually weaken, especially when the number of training samples is small. The root cause is that the over-optimized feature representation, while perfectly adapting to the classification boundaries of the training samples, loses the ability to distinguish the characteristics of unknown data. This memory-based learning of specific instances in the training set results in the model's inability to effectively capture type-related discriminative information in the test data, which is the core manifestation of overfitting.
[0018] Therefore, to prevent the model from overfitting to the training set data during training, adding constraints to the network's later layers to ensure that the learned features are adaptable to test samples with unknown labels is an important approach to addressing overfitting. Based on this idea, a new approach was designed to address the overfitting problem. By adding adversarial training to the model's later stages, this dual optimization objective effectively prevents excessive memorization of training samples by the terminal layers while maintaining the discriminative power of features against classes under limited sample conditions. This ensures that the distribution of features extracted by the model is consistent between the training and test sets, thereby improving the model's adaptability to the test set during small-sample training.
[0019] Based on the above analysis, this application innovatively proposes the use of adversarial training. By building an adversarial learning mechanism, the model is encouraged to learn more generalizable features, thereby better adapting to the feature distribution of the test set, alleviating overfitting, and improving the model's classification performance on the test set.
[0020] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0021] like Figure 1 As shown, the present application provides a SAR image ship classification method based on adversarial elimination of overfitting, including the following.
[0022] Step 101: Preprocess the SAR image to determine the target SAR image.
[0023] In some embodiments, step 101 specifically includes: adding speckle noise to a SAR image to determine a SAR image after the speckle addition; adjusting the contrast of the image after the speckle addition based on a contrast factor, performing a limiting process to determine an enhanced SAR image; and using the enhanced SAR image as a target SAR image.
[0024] Step 102: Input the target SAR image as a first sample into the scattering feature extraction network to determine a first feature vector; the first sample includes a training set and a test set; the target SAR images in the training set correspond to the training set label; the target SAR images in the test set correspond to the test set label.
[0025] In some embodiments, step 102 specifically includes: the scattering feature extraction network includes a scattering conversion layer, a convolution layer, a channel attention module, a maximum pooling layer processing and an adaptive average pooling layer; based on the scattering conversion layer, a scattering transformation is performed on the target SAR image, and a feature map is determined after the scattering features are extracted; based on the convolution layer and the channel attention module, the feature map is processed to determine the key features; based on the activation function and the maximum pooling layer, the key features are processed to generate the final features; the final features are processed through the adaptive average pooling layer to generate a first feature vector, and the first feature vector is used as the output of the scattering feature extraction network.
[0026] Step 103: After passing the first eigenvector through the gradient reversal layer, it is input into the discriminator network to determine the prediction result of the discriminator network; the prediction result includes the probability that the first eigenvector corresponds to the training set label and the probability that the first eigenvector corresponds to the test set label.
[0027] Step 104: According to the prediction results of the gradient reversal layer and the discriminator network, based on the binary cross entropy loss function, the scattering feature extraction network and the discriminator network are updated to obtain the discriminator network with updated parameters and the scattering feature extraction network with updated parameters.
[0028] In some embodiments, step 104 specifically includes steps 201 to 203 .
[0029] Step 201: Based on the binary cross entropy loss function, the domain classification loss is determined according to the prediction results of the discriminator network and the true domain labels of the target SAR image; the true domain labels include the training set labels and the test set labels.
[0030] Step 202: Calculate the gradient of the domain classification loss with respect to the discriminator network parameters through back propagation, and based on the gradient, update the discriminator network with the goal of minimizing the domain classification loss to determine the trained discriminator network.
[0031] Step 203: Based on the gradient and gradient reversal layer, determine the updated parameters of the scattering feature extraction network.
[0032] In some embodiments, step 203 specifically includes: when the gradient reaches the gradient reversal layer, reversing the gradient based on the gradient reversal layer to determine the reversed gradient; based on the reversed gradient, updating the scattering feature extraction network with the goal of maximizing the domain classification loss to obtain a scattering feature extraction network with updated parameters.
[0033] Step 105: The target SAR image and the true category label of the ship in the training set are used as the second sample.
[0034] Step 106: Input the second sample into the classification model, determine the updated scattering feature extraction network, and use the updated scattering feature extraction network as the scattering feature extraction network, and return to the step of "inputting the target SAR image as the first sample into the scattering feature extraction network to determine the first feature vector" until the trained classification model is determined; the classification model includes the scattering feature extraction network with updated parameters and the type recognition network.
[0035] In practical applications, the scattering feature extraction network and the type recognition network are cross-trained 200 times to determine the trained classification model.
[0036] In some embodiments, step 106 specifically includes: inputting the second sample into the scattering feature extraction network with updated parameters to determine the second eigenvector; inputting the second eigenvector into the type recognition network to determine the ship type classification result corresponding to the target SAR image in the training set; smoothing the real category label of the ship based on the random label smoothing technology to determine the smoothed label; determining the random label smoothing loss based on the smoothed label and the ship type classification result corresponding to the target SAR image in the training set; and determining the trained classification model with the goal of minimizing the random label smoothing loss.
[0037] In some embodiments, the binary cross entropy loss function is: .
[0038] in, is the number of samples of SAR images, that is, the number of samples of a batch of SAR images, is the index of the SAR image, that is, the index of the batch of SAR images; For the Domain labels for SAR images; For the discriminator network The probability value of the SAR image prediction as the training set; is the binary cross entropy loss value.
[0039] Among them, the binary cross entropy loss function is the loss function of the discriminator network, and the domain labels are the training set labels and the test set labels; Indicates the index of the sample, from 1 to , used to traverse each sample involved in calculating the loss. It is The domain label of each sample indicates whether the sample is from the training set or the test set. The model is The probability value of the sample prediction as the training set is in the range of between.
[0040] Step 107: Input the SAR image of the target to be measured into the trained classification model to determine the ship type classification result of the SAR image of the target to be measured.
[0041] In practical applications, to effectively address overfitting and achieve accurate classification, this application proposes a method for overfitting elimination based on adversarial learning. This method comprises a scattering feature extraction network, a classification network, and an adversarial training network. Specifically, the input SAR image first enters the scattering feature extraction network. After feature extraction, the extracted features are input into the classification network for ship type classification. Simultaneously, the adversarial training network constrains the feature extraction process, guiding the model to learn more generalizable features, ultimately achieving accurate classification output for test samples. The specific process steps are as follows.
[0042] Step 1: Data collection, annotation and enhancement.
[0043] The ship targets in the SAR images were captured and cropped to obtain target slices. The slices were then labeled and resized to 64 × 64 × 1. The data was randomly divided into training and test samples in a 7:3 ratio, which served as the training and test sets for the subsequent models.
[0044] Design a SAR-specific data enhancement method to simulate real-world SAR imaging characteristics and enhance model robustness. This step takes raw SAR image data as input and produces enhanced image data as output. This application proposes a method for adding speckle noise and introducing contrast perturbations. The specific process is as follows.
[0045] First, for the input SAR image x, we randomly decide whether to add speckle noise with a probability of 0.7. Specifically, we generate a random number r between (0, 1). If r < 0.7, we add speckle noise. We randomly select a value from [0.1, 0.2, 0.3] as the noise level, and then generate noise as follows: noise=m×noiselevel.
[0046] Here, m is random noise of the same size as the SAR image x. This generates random noise of the same shape as the input SAR image. This noise is multiplied point-by-point by the input SAR image x and then added to the original image to determine the post-noise SAR image x' = x + x × noise.
[0047] Then, the pixel values in x' greater than 1 are assigned to 1, and the values less than 0 are assigned to 0, ensuring that the image pixel values are in the range of 0 to 1, and the image after adding speckle noise is obtained.
[0048] Next, a contrast factor cf is randomly selected from the range [0.8, 1.2] to adjust the contrast of the SAR image. First, the mean of the entire SAR image, mean, is calculated. This means the mean reflects the overall brightness level of the image. Then, contrast adjustment is performed using x'' = (x' - mean) × cf + mean. This method increases or decreases the image contrast by changing the pixel value distribution.
[0049] Finally, the contrast-adjusted SAR image x'' is clipped again, and the pixel values in x'' greater than 1 are assigned to 1, and the values less than 0 are assigned to 0, to ensure that the pixel values of the SAR image are within a reasonable range, and the final enhanced image is obtained, that is, the target SAR image.
[0050] This method targets the characteristics of SAR images, simulates the speckle noise present in real imaging, and combines it with contrast perturbation, so that the model can be exposed to richer and more diverse SAR image changes during training, thereby enhancing the model's robustness to various changes in SAR images.
[0051] Step 2: Design of scattering feature extraction network.
[0052] Reference Figure 2, design a scattering feature extraction network, which includes a scattering transformation layer and a feature extraction module, as well as a final pooling and fully connected layer. Extract representative type-related scattering features from the SAR image. The input of this network is the SAR image of size 64×64×1 acquired in step 1, and the output is the feature vector obtained after the scattering transformation and convolution operations. To more effectively extract scattering features from SAR images, this application proposes a method that combines scattering transformation and channel attention mechanism. Specifically, it includes the following steps.
[0053] Scattering transformation layer: The input SAR image is processed by Scattering2D, which is a two-dimensional scattering transformation. It is a signal and image analysis tool based on Wavelet Transform, which is used to extract robust features of data for scattering transformation. The Scattering2D module can capture the local texture and structural information of the image and generate multi-scale and multi-directional scattering coefficients to extract scattering features of different scales and directions. After the scattering transformation, the size of [scat dim =49,h=32,w=32] feature map A, where scat dim is the dimension of the scattering coefficient, h and w are the height and width of the feature map.
[0054] Feature Extraction Module: The feature map A is processed through a convolutional layer and a channel attention module. The convolutional layer is used to further extract features, while the channel attention module is used to enhance the response of important feature channels and suppress unimportant channels.
[0055] Specifically, after the feature map passes through the convolutional layer Conv(3, 3, 64), the number of channels in the output feature map becomes 64. It then passes through the Channel Attention Module (CAM), which uses AdaptiveAvgPool and the fully connected layer Dense to generate channel attention weights. These weights are multiplied by the feature map to enhance the representation of key features. The feature map then passes through a batch normalization layer (BN) and a ReLU activation function, followed by a max pooling layer to reduce the size of the feature map and minimize computational effort. This network cycle is repeated once to obtain the final features extracted by the feature extraction module.
[0056] Finally, the size of the feature map is unified to 1×1 through the adaptive average pooling layer, and then through the Flatten operation to obtain the first feature vector with a length of 128 as the output of the scattering feature extraction network.
[0057] Step 3: Type identification network design.
[0058] Design a type recognition network, i.e., a classification model, to achieve the function of classifying the ship target type. The input of this network is the feature vector of length 128 output by the scattering feature extraction network in step 2, and the output is the category prediction result of the ship target, which is recorded as , which means that the model predicts a second sample as the first i The probability of a class type sample. In order to improve the accuracy and generalization ability of classification, this application introduces label smoothing regularization and Dropout layer in the type recognition network. Specifically, the input feature vector first passes through a fully connected layer to reduce its dimension from 128 to 64, then passes through the ReLU activation function, and then passes through the Dropout layer to randomly discard some neurons with a probability of 0.5 to prevent overfitting. Then, it passes through another fully connected layer to convert the dimension from 64 to C, corresponding to C different ship target types. is the number of categories.
[0059] Finally, the random label smoothing loss function is used for training. The existing label smoothing method is the fixed label smoothing threshold method. Suppose the one-hot label of the sample is , is the number of categories, and the true category index is , random number A very small decimal, usually set One-hot label smoothing The calculation formula is: .
[0060] In the existing label smoothing method, it is usually set is a fixed value that is the same for all samples. Although this method does not set the label to 0 or 1, the fixed threshold method is equivalent to directly mapping the original 0 / 1 label space to the new space 0 / 1- , so that the labels of all similar samples are smoothed from the original 1 to 1- , this approach is difficult to fully improve the learning ability of the network. To this end, a random label smoothing loss function is designed. This loss function softens the label distribution through random values to prevent the model from overfitting to the training set, thereby improving the generalization ability of the model. Specifically, for each one-hot label of an image (SAR image), each time the sample is used during training, the value of the one-hot label corresponding to the sample is subtracted from the random value α. Here, α is set to < 0.2, that is: .
[0061] in, ,i=1,..., C And i≠k, indicating is a randomly generated positive decimal. , this formula indicates that C The sum of -1 random numbers is α.
[0062] For example, in the five-category problem involved in this application, the true label of a sample is (0, 0, 1, 0, 0), and the smoothed labels generated by the traditional label smoothing method for all samples of this type during the training process are always ( / 4, / 4,1- , / 4, / 4), each time this sample is used in training, first randomly generate Then randomly generate the other 4 values .
[0063] Based on the above formula, we obtain the smoothed labels, and then input them and the predicted labels of the classification branch into the cross entropy loss function to calculate the loss of the type recognition task. In this multi-classification task, the random label smoothing loss is: .
[0064] in, is the number of categories, is the first label after random smoothing i The label value of the class, The classification model predicts a second sample as the first i The probability of the class sample type.
[0065] Step 4: Adversarial training network design.
[0066] Design an adversarial training network to guide the scattering feature extraction network designed in step 2 to learn more generalizable features and alleviate overfitting. The input of this module is the feature vector output by the feature extraction network in step 2, and the output is the feature vector adjusted through adversarial training.
[0067] To achieve this goal, this application introduces a discriminator network and combines it with a gradient reversal layer to build an adversarial training mechanism. Specifically, the first eigenvector of the input first passes through the gradient reversal layer. During forward propagation, this layer directly passes the first eigenvector of the input; during backward propagation, it multiplies the gradient by -1, thereby changing the gradient direction.
[0068] The feature vector after gradient inversion is input into the discriminator network. The discriminator network is a network composed of two fully connected layers. The input feature vector (16×16×64) first passes through a fully connected layer to map the dimension to 64, passes through the ReLU activation function, and then passes through another fully connected layer to output a scalar value, which is mapped to between 0 and 1 through the Sigmoid function as the probability of judging whether the image corresponding to the feature is a training set or a test set.
[0069] The domain label of the training set samples is recorded as 1, and the domain label of the test set samples is recorded as 0. The training is performed as follows.
[0070] Take e samples from the training set to form <image, class label> pairs. These are input into the scattering feature extraction network and the class recognition network. The predicted class recognition results are then output. The smoothed labels constructed in step 3 are then used to calculate the cross entropy loss and the backpropagation loss to optimize the two networks. The class label is the actual label of the ship.
[0071] We take e samples from each of the training and test sets to form <image, domain label> pairs. These are fed into the scattering feature extraction network and the adversarial training network. The network outputs predictions for the images from the training set, calculates the binary cross entropy loss function based on the predictions, and then feeds them back to optimize the two networks. The domain labels include both the training set labels and the test set labels.
[0072] The above two steps are repeated 200 times to cross-train the type recognition task and the domain recognition task.
[0073] During this process, the discriminator network attempts to accurately determine whether the first eigenvector comes from the training set or the test set, while the scattering feature extraction network attempts to generate a first eigenvector that can confuse the discriminator network. Through this adversarial training method, the scattering feature extraction network is prompted to learn more generalized features. Ultimately, the scattering feature extraction network can extract features with consistent distribution for the training set and test set samples, so that the type recognition network trained on the training set can achieve the same good results on the test set as the training set.
[0074] It is worth noting that this application has certain similarities with the method for solving domain adaptation tasks, but domain adaptation focuses on the natural distribution differences between the training set and the test set data themselves, that is, they follow independent non-identical distributions, while the task focused on by this application is the scenario where there is no distribution difference between the training set and the test set data, that is, the problem of following the independent and identically distributed assumption.
[0075] The beneficial effects of the present application are as follows: by designing a scattering feature extraction network through step 2 and using the Scattering2D module to perform scattering transformation on the SAR image, the local texture and structural information of the image at different scales and directions can be captured. The features of ship targets in SAR images may be distributed at different scales, such as the overall outline of the ship, local details, etc. Multi-scale and multi-directional analysis can obtain these features more comprehensively, provide a rich information basis for subsequent classification, and improve the ability to recognize ship targets of different forms. The feature map obtained after the scattering transformation contains rich scattering coefficient information, which can reflect the intrinsic characteristics of the image. Compared with the traditional single-scale feature extraction method, it can more accurately describe the characteristics of ship targets in SAR images, which helps to improve the accuracy of ship target classification. Ship targets are ship types.
[0076] Utilizes a channel-attention mechanism to enhance key features. The channel-attention module generates channel-attention weights through adaptive average pooling and fully connected layers and multiplies them with the feature map. This enables the network to automatically focus on feature channels that are more important for classification, enhancing the response of these channels and suppressing unimportant channels, highlighting the expression of key features and improving feature discrimination, which facilitates subsequent classification tasks.
[0077] In step 3, a type recognition network is designed. The first eigenvector of input length (128) is reduced to 64 through a fully connected layer. This reduces the feature dimension and computational complexity while also avoiding the risk of overfitting caused by high-dimensional features. During the dimensionality reduction process, the network learns important relationships between features and extracts more representative features. Dropout is also used to prevent overfitting.
[0078] We design a random label smoothing regularization method to soften the label distribution and prevent the model from being overly confident in the labels in the training set. During training, the model does not excessively pursue a perfect fit to the training samples, but instead learns more generalizable features, thereby improving the model's performance on unseen data and alleviating the overfitting problem.
[0079] In step 4, an adversarial training network is designed to fully learn generalizable features. During training, the discriminator network attempts to accurately determine whether a feature comes from the training set or the test set, while the feature extraction network attempts to generate features that confuse the discriminator. This adversarial training method forces the feature extraction network to learn features that are independent of the data source, i.e., more generalizable features. This approach prevents the model from overfitting to the training set, enabling it to perform well on data from different domains and alleviating the overfitting problem.
[0080] In an exemplary embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above method when executing the computer program.
[0081] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the above method when executed by a processor.
[0082] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0083] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0084] The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processors involved in the various embodiments provided herein may include, but are not limited to, general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic units, data processing logic units based on quantum computing, and the like.
[0085] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0086] This document uses specific examples to illustrate the principles and implementation methods of this application. The description of the above examples is only intended to help understand the method and core concept of this application. At the same time, for those skilled in the art, based on the concept of this application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.
Claims
1. A SAR image ship classification method based on adversarial elimination of overfitting, characterized in that: include: Preprocess the SAR image and determine the target SAR image; Inputting the target SAR image as a first sample into the scattering feature extraction network to determine a first eigenvector; The first sample includes a training set and a test set; the target SAR image in the training set corresponds to the training set label; the target SAR image in the test set corresponds to the test set label; After passing the first eigenvector through the gradient reversal layer, it is input into the discriminator network to determine the prediction result of the discriminator network; the prediction result includes the probability that the first eigenvector corresponds to the training set label and the probability that the first eigenvector corresponds to the test set label; According to the prediction results of the gradient reversal layer and the discriminator network, based on the binary cross entropy loss function, the scattering feature extraction network and the discriminator network are updated to obtain the discriminator network with updated parameters and the scattering feature extraction network with updated parameters; The target SAR image and the ship's true category label in the training set are used as the second sample; Inputting the second sample into the classification model, determining an updated scattering feature extraction network, and using the updated scattering feature extraction network as the scattering feature extraction network, returning to the step of "inputting the target SAR image as the first sample into the scattering feature extraction network to determine the first feature vector" until a trained classification model is determined; the classification model includes the scattering feature extraction network with updated parameters and the type recognition network; The SAR image of the target to be measured is input into the trained classification model to determine the ship type classification result of the SAR image of the target to be measured.
2. The SAR image ship classification method based on countermeasures to eliminate overfitting according to claim 1 is characterized in that: The target SAR image is input as the first sample into the scattering feature extraction network to determine the first eigenvector, specifically including: The scattering feature extraction network includes a scattering conversion layer, a convolutional layer, a channel attention module, a maximum pooling layer, and an adaptive average pooling layer; Based on the scattering conversion layer, the target SAR image is subjected to scattering transformation, and the scattering features are extracted to determine the feature map; Based on the convolutional layer and channel attention module, the feature map is processed to determine the key features; Process key features based on activation function and maximum pooling layer to generate final features; The final features are processed by an adaptive average pooling layer to generate the first eigenvector, which is used as the output of the scattering feature extraction network.
3. The SAR image ship classification method based on combating overfitting elimination according to claim 1 is characterized in that: Preprocess the SAR image and determine the target SAR image, specifically including: Adding speckle noise to the SAR image to determine the SAR image after the speckle noise is added; After adjusting the contrast of the image after adding speckles based on the contrast factor, a limiting process is performed to determine the enhanced SAR image; The enhanced SAR image is used as the target SAR image.
4. The SAR image ship classification method based on countermeasures to eliminate overfitting according to claim 1 is characterized in that: Inputting the second sample into the classification model, determining an updated scattering feature extraction network, and using the updated scattering feature extraction network as the scattering feature extraction network, returning to step "inputting the target SAR image as the first sample into the scattering feature extraction network to determine the first feature vector" until a trained classification model is determined, specifically including: Inputting the second sample into the scattering feature extraction network with updated parameters to determine a second eigenvector; The second eigenvector is input into the type recognition network to determine the ship type classification result corresponding to the target SAR image in the training set; Based on the random label smoothing technology, the real category labels of the ships are smoothed to determine the smoothed labels; Determine the random label smoothing loss based on the smoothed labels and the ship type classification results corresponding to the target SAR images in the training set; Determine the trained classification model with the goal of minimizing the random label smoothing loss.
5. The SAR image ship classification method based on countermeasures to eliminate overfitting according to claim 1 is characterized in that: The binary cross entropy loss function is: ; in, is the number of samples of SAR image; is the index of the SAR image; For the Domain labels for SAR images; For the discriminator network The probability value of the SAR image prediction as the training set; is the binary cross entropy loss value.
6. The SAR image ship classification method based on countermeasures to eliminate overfitting according to claim 1 is characterized in that: According to the prediction results of the gradient reversal layer and the discriminator network, based on the binary cross entropy loss function, the scattering feature extraction network and the discriminator network are updated to obtain the discriminator network with updated parameters and the scattering feature extraction network with updated parameters, specifically including: Based on the binary cross entropy loss function, the domain classification loss is determined according to the prediction results of the discriminator network and the true domain labels of the target SAR images; the true domain labels include the training set labels and the test set labels; Through back propagation, the gradient of the domain classification loss to the discriminator network parameters is calculated, and based on the gradient, the discriminator network is updated with the goal of minimizing the domain classification loss to determine the trained discriminator network; Scattering feature extraction network that determines update parameters based on gradient and gradient reversal layers.
7. The SAR image ship classification method based on countermeasures to eliminate overfitting according to claim 1 is characterized in that: Based on the gradient and gradient reversal layers, the scattering feature extraction network that determines the update parameters includes: When the gradient reaches the gradient reversal layer, the gradient is reversed based on the gradient reversal layer to determine the reversed gradient; Based on the inverted gradient, the scattering feature extraction network is updated with the goal of maximizing the domain classification loss to obtain a scattering feature extraction network with updated parameters.
8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the SAR image ship classification method based on adversarial elimination of overfitting according to any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the SAR image ship classification method based on adversarial elimination of overfitting according to any one of claims 1 to 7 is implemented.