A radar image ship detection network model and detection method based on domain adaptation
Through the radar image ship detection network model based on domain adaptation, using style transfer and encoder structure to transfer knowledge from optical images to radar images, it solves the problem of few radar image samples and difficult annotation, achieves efficient ship detection, and improves the efficiency of ship detection. Recognition accuracy.
Patent Information
- Application Number
- CN202210614592.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-30
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2042-05-30
AI Technical Summary
Due to the small number of samples and difficulty in labeling ships in radar images, the existing technology results in low recognition accuracy. In particular, the accuracy of ship recognition tasks on radar images is lower than that on optical remote sensing images, and it is difficult to obtain labeled radar image samples.
A radar image ship detection network model based on domain adaptation is adopted, using style transfer and encoder structure to transfer knowledge from optical images to radar images, through feature extraction network, adversarial training module, region candidate network, ROI Pooling layer, region classification network and Ship prototype alignment module realizes ship detection on radar images.
It realizes ship detection without additional labeling of radar images, solves the problem of few radar image samples and difficult labeling, improves the accuracy of ship detection on radar images, and realizes the terminal without complicated manual post-processing through knowledge migration. End-to-end detection.
Smart Images

Figure CN114998760B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of remote sensing target detection, and in particular is a radar image ship detection network model and a detection method based on domain adaptation. Background Art
[0002] Synthetic Aperture Radar (SAR) is a sensing device used for microwave imaging. Compared with traditional optical remote sensing devices, it has all-day and all-weather imaging processing capabilities. The present invention is mainly aimed at radar image ship detection, and its purpose is to accurately detect and locate the ship object in the image, which has important application value in the fields of environmental monitoring, resource exploration, national defense and military.
[0003] In recent years, the development of deep convolutional neural networks has brought great performance improvements in the field of target detection. However, these methods are label-driven and require the collection of a large number of samples and their annotation boxes. Due to the high cost of developing and maintaining synthetic aperture radars, data is difficult to obtain. In addition, its unique imaging principle and side-view imaging characteristics also make radar images less translatable and inconsistent with the human eye's observation habits. These characteristics make it difficult for us to obtain a large number of labeled samples of radar images. In particular, compared with the ship recognition task under optical images, the accuracy of the ship recognition task on radar images is often lower than that on optical remote sensing images due to the latter's timeliness and high resolution. In addition, visible light images are more in line with the perspective observed by the human eye, and ship objects appearing in radar images may be difficult to identify and annotate. To this end, the present invention uses domain adaptation technology to achieve the transfer of knowledge of ship recognition in optical remote sensing images to radar images without the need for additional annotation of radar images.
[0004] Realizing the monitoring of ship targets in a specific area plays an important role in maintaining maritime rights and interests. However, in practical applications, it is unrealistic to rely on collecting as many sample labels as possible to cover all data distributions in real scenarios. This is because real scenarios are accidental and uncertain. Using this method not only consumes resources, but also cannot significantly improve the effect in a short period of time. Therefore, in response to the above problems, the present invention implements domain adaptation technology to study ship target detection. Summary of the invention
[0005] In view of the shortcomings of the prior art, the purpose of the present invention is to propose a radar image ship detection network model and detection method based on domain adaptation. The radar image ship detection network model of the present invention adopts style transfer and encoder structure to realize the knowledge transfer from optical image to radar image, solves the problem of few radar image samples and difficult labeling, and adopts the detection method of the present invention to directly detect ships on radar images.
[0006] The technical solution of the present invention to solve the technical problem is: designing a radar image ship detection network model based on domain adaptation, characterized in that the ship detection network model includes a feature extraction network G, an adversarial training module, a consistency adjustment module, a region candidate network, a first ROI Pooling layer, a second ROI Pooling layer, a region classification network R1, a region classification network R2, and a ship prototype alignment module;
[0007] The feature extraction network G contains four network blocks, namely conv1, conv2_x, conv3_x and conv4_x, in the ResNet-101 network structure. The settings of these four network blocks are exactly the same as those in the ResNet-101 network structure. After the input image is processed by the feature extraction network G, the output is a feature map F1 equivalent to 1 / 32 of the original image.
[0008] The input of the region candidate network is the feature map F1. The region candidate network first convolves the feature map F1 through a conv2d 3*3 convolution layer to obtain an intermediate layer feature map. Each position of the intermediate layer feature map has 9 anchor boxes of different sizes. The anchor boxes are then input into two conv2d 1*1 convolution layer branches for processing. One branch uses softmax for binary classification to determine whether there is an object in the anchor box. If there is an object, it is positive, and if not, it is negative. The other branch performs bounding box regression to make the anchor box border closer to the ground truth box. Then, a number of anchor boxes are generated based on the output of the two branches plus the original image information. Finally, N candidate boxes are screened out through NMS. Each candidate box has its own feature information, including the position information of the box and the foreground and background probability information corresponding to the box.
[0009] The input of the adversarial training module is the feature map F1. The adversarial training module includes a gradient reversal layer and a domain classifier. The gradient reversal layer is connected between the feature extraction network and the domain classifier. The gradient reversal layer reverses the gradient during the back propagation process. The gradient reversal layer forwardly passes the feature map F1 to the domain classifier as it is. The domain classifier first uses a 3×3 convolution layer to perform three dimensionality reduction operations on the input feature map F1, reducing the dimension of the feature map F1 from 1024 to 128. Batch normalization is used after each convolution, and then a fully connected layer is used to obtain a binary classification result. The nonlinear activation process uses the ReLU function. The classification result indicates that the domain classifier determines whether the feature map F1 comes from the source domain or the target domain.
[0010] The loss of the adversarial training module is as follows:
[0011]
[0012]
[0013]
[0014] in, is the i-th sample in the annotated optical image domain; is the i-th sample in the radar image domain, n s and n t are the number of samples in the annotated optical image domain and the unannotated radar image domain respectively; G represents the feature extraction network, D g represents the domain classifier;
[0015] The input of the consistency adjustment module is the feature map F1. The alignment encoder of the consistency adjustment module performs dimension reduction, dimension increase and excitation operations on the feature map F1. The convolution kernel size is 5×5, the step size is 1, the edge padding is 2, and the ReLU function is used to learn the nonlinear interaction between channels. The output feature map F2; the feature map F2 is exactly the same size as the feature map F1; the loss formula of the consistency adjustment module is described as:
[0016]
[0017] in, is the i-th sample in the annotated optical image domain, This is the pseudo radar image generated after style transfer of the sample. E represents the alignment encoder and G represents the feature extraction network.
[0018] The input of the first ROI Pooling layer is the candidate box and feature map F1 output by the region candidate network. After being processed by the first ROI Pooling layer, all candidate boxes are uniformly adjusted to feature maps M1 of the same size; the feature map M1 is processed by the first fully connected layer of the region classification network R1 to obtain the feature vector V1 corresponding to each box;
[0019] The input of the second ROI Pooling layer is the candidate box and feature map F2 output by the region candidate network. After being processed by the second ROI Pooling layer, all candidate boxes are uniformly adjusted to feature maps M2 of the same size; the feature map M2 is processed by the first fully connected layer of the region classification network R2 to obtain the feature vector V2 corresponding to each box;
[0020] The input of the regional classification network R1 is the feature map M1 output by the first ROI Pooling layer. After the feature map M1 output by the first ROI Pooling layer is processed by the regional classification network R1, the category and position information of each box is obtained. Finally, the prediction result is obtained by the non-maximum suppression algorithm as the basic feature detection result.
[0021] The input of the regional classification network R2 is the feature map M2 output by the second ROI Pooling layer. After the feature map M2 output by the second ROI Pooling layer is processed by the regional classification network R2, the category and position information of each box is obtained. Finally, the prediction result is obtained by the non-maximum suppression algorithm, which is the domain invariant feature detection result.
[0022] The structure of the regional classification network R1 is the same as that of the regional classification network R2, both of which are structures of three fully connected layers, but they do not share parameters. The input of the network is first input into the first fully connected layer, and the output of the first fully connected layer is input into the other two fully connected layers respectively. The two fully connected layers output the position and classification of the candidate box respectively;
[0023] The ship prototype alignment module includes a foreground frame filter and a ship prototype calculator. The input of the ship prototype alignment module is the feature vector V1 and the feature vector V2. The foreground frame filter of the ship prototype alignment module first filters the input feature vectors V1 and V2 respectively, specifically re-weighting each input foreground frame, and then inputs it into the ship prototype calculator to calculate the ship prototype vector. The foreground frame filter and re-weighting operation formula are described as follows:
[0024]
[0025] Ship Prototype Calculator:
[0026]
[0027] In formula (8) and formula (9), w i,j represents the weight of the j-th candidate box in the i-th image when calculating the ship prototype vector, is the foreground confidence of the jth candidate box in the i-th image in the feature vector V1, is the foreground confidence of the jth candidate box in the i-th image in the feature vector V2; r i,j represents the jth candidate box of the i-th image; N is the total number of candidate boxes; FC(·) represents the feature vector belonging to the box in the feature vector V1; P i represents the ship prototype vector calculated from the i-th image;
[0028] The loss function of the ship prototype alignment module is:
[0029]
[0030] in, The ship prototype vector calculated for the i-th image in the annotated optical image domain, is the ship prototype vector calculated for the i-th image in the radar image domain, and ||·|| refers to the Euclidean distance calculation; the semantic information of the optical image domain and the radar image domain is aligned by reducing the distance between the two;
[0031] The loss function L of the ship detection network model is the weighted sum of the loss functions of the region candidate network, region classification network, adversarial training module, consistency adjustment module, and ship prototype alignment module. The formula is:
[0032]
[0033] Among them, L RPN is the classification and regression loss of the region proposal network, is the classification and regression loss of the regional classification networks R1 and R2, L DA is the loss function of the adversarial training module; L consis The loss function of the consistency adjustment module; L p is the loss function of the ship prototype alignment module; 1 ,λ 2 ,λ 3 These are hyperparameters given to different parts of the loss during training.
[0034] Furthermore, the present invention designs a radar image ship detection method based on domain adaptation, which is characterized in that the detection method adopts the radar image ship detection network model based on domain adaptation as described above, and also includes the following steps:
[0035] Step 1: Select the annotated optical image domain as the source domain data and the radar image domain as the target domain data. Input the source domain data and the target domain data into the ship detection network model with completed parameter initialization. Then calculate the value of the loss function L of the ship detection network model according to the detection results. Use the gradient method to back propagate and update all the parameters of the ship detection network model to complete one training. Input the source domain data and the target domain data into the ship detection network model after updating the parameters again for the next training. The parameter value when the loss function L of the ship detection network model takes the minimum value is the target parameter value. Save the current network model parameter value. The ship detection network model training is completed.
[0036] Step 2: Input the radar image to be detected into the ship detection network model trained in step 1, and the ship detection result can be obtained from the output of the regional classification network R1.
[0037] Compared with the prior art, the advantages and beneficial effects of the present invention are:
[0038] The ship detection network model of the present invention utilizes the knowledge in the field of domain adaptation to realize the knowledge transfer from optical images to radar images. The Fourier transform principle is used to generate pseudo radar images, and the style transfer from optical images to radar images is realized end-to-end, so as to achieve the purpose of not requiring complicated manual post-processing. The encoder structure is used to decompose the features into domain-similar features and domain-invariant features. At the same time, in order to make the decomposition effect more accurate, the domain-similar features are aligned using the style-transferred pictures. The above method solves the problem of too large a difference in appearance between the two domains. The detection method of the present invention solves the problem of few radar image samples and difficult labeling to a certain extent, and realizes that ship detection can be performed even in the absence of radar sample labeling. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 The working principle and flow chart of an embodiment of the radar image ship detection network model based on domain adaptation of the present invention;
[0040] Figure 2 (a) is an example of an optical image sample; Figure 2 (b) is a sample image of radar image; Figure 2 (c) Figure 2 (a) The image after style transfer obtained by two-dimensional Fourier transform;
[0041] Figure 3 A schematic diagram of the structure and principle of a region candidate network of a radar image ship detection network model based on domain adaptation of the present invention;
[0042] Figure 4 A schematic diagram of the structure and principle of a regional classification network of a radar image ship detection network model based on domain adaptation of the present invention;
[0043] Figure 5 This is a diagram of ship detection results of a radar image obtained by using the radar image ship detection method based on domain adaptation of the present invention. DETAILED DESCRIPTION
[0044] The technical solution of the present invention is described in detail below in conjunction with the accompanying drawings and specific implementation methods, but the protection scope of the present application is not limited thereto.
[0045] The present invention provides a radar image ship detection network model based on domain adaptation (referred to as the ship detection network model), which includes a feature extraction network G, an adversarial training module, a consistency adjustment module, a region candidate network, a first ROI Pooling layer, a second ROI Pooling layer (ROI Pooling is to pool feature maps of different sizes into feature maps of the same size, i.e., a mapping operation in the attached figure), a region classification network R1, a region classification network R2, and a ship prototype alignment module.
[0046] The feature extraction network G contains the four network blocks conv1, conv2_x, conv3_x, and conv4_x in the ResNet-101 network structure (that is, the input image requirements of the feature extraction network G are the same as the input requirements of the ResNet-101 network, and its output specifications are the same as the output of the last layer of the conv4_x network block of the ResNet-101 network). The settings of the four network blocks are exactly the same as those in the ResNet-101 network structure. After the input image is processed by the feature extraction network G, the output is a feature map F1 (dimension is 1024) equivalent to 1 / 32 of the original image.
[0047] The input of the region proposal network is the feature map F1. The region proposal network first convolves the feature map F1 through a conv2d 3*3 convolution layer to obtain an intermediate layer feature map (the size is the same as F1, the dimension is 256). Each position of the intermediate layer feature map has 9 anchor boxes of different sizes. The anchor box is then input into two conv2d 1*1 convolutional layer branches for processing. One branch uses softmax for binary classification to determine whether there is an object in the anchor box, which is positive if there is an object and negative if there is no object. The other branch performs bounding box regression to make the bounding box of the anchor box closer to the groundtruth box (pre-set box). Then, a number of anchor boxes are generated based on the output of the two branches plus the original image information. Finally, N (set to 128) candidate boxes (Proposal) are screened out through NMS (non-maximum suppression algorithm). Each candidate box has its own feature information, including the location information of the box and the foreground and background probability information corresponding to the box, which is represented by (xmin, ymin, xmax, ymax, foreground_conf, background_conf).
[0048] The input of the adversarial training module is the feature map F1. The adversarial training module includes a gradient reversal layer and a domain classifier. The gradient reversal layer (GRL) is connected between the feature extraction network and the domain classifier. The gradient reversal layer reverses the gradient during the back propagation process. The gradient reversal layer forward passes the feature map F1 to the domain classifier as it is. The domain classifier first uses the conv2d 3*3 convolution layer to perform three dimensionality reduction operations on the input feature map F1, reducing the dimension of the feature map F1 from 1024 to 128. Batch normalization is used after each convolution, and then a fully connected layer is used to obtain a binary classification result. The nonlinear activation process uses the ReLU function. The classification result indicates whether the domain classifier determines whether the feature map F1 comes from the source domain or the target domain.
[0049] The loss of the adversarial training module is as follows:
[0050]
[0051]
[0052]
[0053] in, is the i-th sample in the annotated optical image domain (i.e., the i-th picture, the same below); is the i-th sample in the radar image domain, n s and n t are the number of samples in the optical image domain and radar image domain with annotations. G represents the feature extraction network, and D g Represents the domain classifier. Through the gradient reversal layer and the domain classifier, the purpose of adversarial training is achieved. The domain classifier is confused about whether the input features come from the source domain or the target domain, so as to align the feature distributions of the two domains.
[0054] The input of the consistency adjustment module is the feature map F1. The alignment encoder of the consistency adjustment module performs dimension reduction, dimension increase and excitation operations on the feature map F1. The convolution kernel size is 5×5, the step size is 1, the edge padding is 2, and the ReLU function is used to learn the nonlinear interaction between channels, and the output feature map F2. The feature map F2 is exactly the same size as the feature map F1. The loss formula of the consistency adjustment module is described as:
[0055]
[0056] in, is the i-th sample in the annotated optical image domain, This is the pseudo radar image generated after style transfer of the sample. E represents the alignment encoder, G represents the feature extraction network, and ||·|| refers to the Euclidean distance calculation.
[0057] This embodiment uses a two-dimensional Fourier transform to perform style transfer on the annotated optical image domain. The two-dimensional Fourier transform can convert the annotated optical image domain from a spatial representation to a frequency representation. The magnitude of the frequency corresponds to the grayscale fluctuations of the optical image. Parts of the optical image with more drastic grayscale changes, such as the texture and edge of the optical image, appear as high-frequency signals in the frequency domain; while parts of the optical image with more gentle grayscale changes, such as the background of the optical image, appear as low-frequency signals in the frequency domain. In the present invention, the Fourier transform is used to convert the original optical image x from the image domain to the frequency domain, and then the low-frequency information of the radar image is used to replace the low-frequency information of the optical image. The specific location is the center of the spectrum graph, and the side length is β times the image side length. β takes a random decimal between 0 and 0.08, and then the newly generated image is obtained by inverse Fourier transform. The formula for the style transfer process using two-dimensional Fourier transform is described as follows:
[0058]
[0059] M β (h,w)=1 (h,w)∈[-βH:βH,-βW:βW] (6)
[0060]
[0061] The two-dimensional Fourier transform style transfer part is an existing technology, and can be referred to Section 2.1 of the paper "FDA: FourierDomain Adaptation for Semantic Segmentation".
[0062] The input of the first ROI Pooling layer is the candidate box and feature map F1 output by the region candidate network. After being processed by the first ROI Pooling layer, all candidate boxes are uniformly adjusted to feature maps M1 of the same size (each candidate box corresponds to a 7*7 size and a dimension of 1024); the feature map M1 is processed by the first fully connected layer of the region classification network R1 to obtain the feature vector V1 (128*2048 size) corresponding to each box;
[0063] The input of the second ROI Pooling layer is the candidate box and feature map F2 output by the region candidate network. After processing by the second ROI Pooling layer, all candidate boxes are uniformly adjusted to feature maps M2 of the same size (each candidate box corresponds to a 7*7 size and a dimension of 1024); the feature map M2 is processed by the first fully connected layer of the region classification network R2 to obtain the feature vector V2 (128*2048 size) corresponding to each box.
[0064] The input of the region classification network R1 is the feature map M1 output by the first ROI Pooling layer (each candidate box corresponds to a feature map of size 7*7 and dimension 1024). After the feature map M1 output by the first ROI Pooling layer is processed by the region classification network R1, the category and position information of each box is obtained, and finally the prediction result is obtained through the non-maximum suppression algorithm as the basic feature detection result.
[0065] The input of the region classification network R2 is the feature map M2 output by the second ROI Pooling layer (each candidate box corresponds to a feature map of size 7*7 and dimension 1024). After the feature map M2 output by the second ROI Pooling layer is processed by the region classification network R2, the category and position information of each box is obtained. Finally, the prediction result is obtained through the non-maximum suppression algorithm, which is the domain invariant feature detection result.
[0066] The structure of the region classification network R1 is the same as that of the region classification network R2, both of which are structures of three fully connected layers, but they do not share parameters. The input of the network is first input into the first fully connected layer (fully connected layer 11), and the output of the first fully connected layer is input into the other two fully connected layers (fully connected layer 21 and fully connected layer 22), which respectively output the position and classification of the candidate box.
[0067] The ship prototype alignment module includes a foreground frame filter and a ship prototype calculator, and the input of the ship prototype alignment module is a feature vector V1 and a feature vector V2. The foreground frame filter of the ship prototype alignment module first filters the input feature vectors V1 and V2 respectively.
[0068] For the same target box, the first ROI Pooling layer and the second ROI Pooling layer are used to map to the basic features and domain invariant features respectively. After passing through the first fully connected layer of the two regional classification networks, the two fully connected layers will output the foreground confidence of the box respectively (that is, the feature vector V1 and the feature vector V2 contain the foreground confidence information of the box). When the outputs of the two fully connected layers both determine that the box belongs to the foreground (foreground confidence>0.5), the box is sent to the ship prototype alignment controller, otherwise it is not sent to the ship prototype alignment controller. By combining the basic features and the domain invariant features, the foreground confidence of the box can be obtained from different perspectives. Only when the two fully connected layers both determine that the box belongs to the foreground, the feature vector of this box will be added to the calculation of the ship prototype.
[0069] The foreground frame filter filters the feature vectors V1 and V2 by re-weighting each input foreground frame, and then inputs it into the ship prototype calculator to calculate the ship prototype vector. The foreground frame filter and re-weighting operation formula are described as follows:
[0070]
[0071] Ship Prototype Calculator:
[0072]
[0073] In formula (8) and formula (9), w i,j represents the weight of the j-th candidate box in the i-th image when calculating the ship prototype vector, is the foreground confidence of the jth candidate box in the i-th image in the feature vector V1, is the foreground confidence of the jth candidate box in the i-th image in the feature vector V2; N represents the total number of candidate boxes, r i,j P represents the jth candidate box in the i-th image, and FC(·) represents the feature vector belonging to the box in the feature vector V1. i Represents the ship prototype vector calculated from the i-th image.
[0074] The loss function of the ship prototype alignment module is:
[0075]
[0076] in, The ship prototype vector calculated for the i-th image in the annotated optical image domain, The prototype vector of the ship calculated for the i-th image in the radar image domain, ||·|| refers to the Euclidean distance calculation. The semantic information of the optical image domain and the radar image domain is aligned by reducing the distance between the two.
[0077] The loss function L of the ship detection network model is the weighted sum of the loss functions of the region candidate network, region classification network, adversarial training module, consistency adjustment module, and ship prototype alignment module. The formula is:
[0078]
[0079] Among them, L RPN is the classification and regression loss of the region proposal network, is the classification and regression loss of the regional classification networks R1 and R2, L DA is the loss function of the adversarial training module; L consis The loss function of the consistency adjustment module; L p is the loss function of the ship prototype alignment module. λ is the hyperparameter assigned to different parts of the loss during the training process. In the present invention, λ 1 ,λ 2 ,λ 3They are 0.5, 0.5, and 0.01 respectively. The classification and regression losses of the region candidate network and the classification and regression losses of the region classification networks R1 and R2 are calculated in the annotated optical image domain, and the radar image is unlabeled and does not participate in the calculation.
[0080] The ship detection network model designed by the present invention is a robust detector learned in the radar image domain through knowledge transfer. Since the ship samples under the optical image have the characteristics of rich data and easier to label, the ship detection network model selects the optical image domain with labels as the source domain data and the radar image domain as the target domain data during training. The source domain data and the target domain data are used to train the parameters of the ship detection network model. According to the value of the loss function L of the ship detection network model, the gradient method is used for back propagation to update all the parameters of the ship detection network model, so that the network model parameters when the loss function L of the ship detection network model takes the minimum value are the target parameter values, and the current network model parameters are saved. When it is necessary to use radar images for ship detection, the ship detection network model under the target parameter value is input, and the ship detection result can be obtained by the output of the regional classification network R1.
[0081] Furthermore, the present invention provides a radar image ship detection method based on domain adaptation, characterized in that the detection method adopts the radar image ship detection network model based on domain adaptation as described above, and further includes the following steps:
[0082] Step 1: Select the annotated optical image domain as the source domain data and the radar image domain as the target domain data, and use the source domain data and the target domain data to train the parameters of the ship detection network model; input the source domain data and the target domain data into the ship detection network model after parameter initialization, and then calculate the value of the loss function L of the ship detection network model according to the detection results, and use the gradient method to back propagate to update all the parameters of the ship detection network model to complete one training; input the source domain data and the target domain data into the ship detection network model after the updated parameters again, and carry out the next training; the parameter value when the loss function L of the ship detection network model takes the minimum value is the target parameter value, save the current network model parameter value, and the ship detection network model training is completed;
[0083] Step 2: Input the radar image to be detected into the ship detection network model trained in step 1, and the ship detection result can be obtained from the output of the regional classification network R1.
[0084] Any matters not described in the present invention are applicable to the prior art.
Claims
1. A radar image ship detection network model based on domain adaptation, characterized in that: The ship detection network model includes a feature extraction network G, an adversarial training module, a consistency adjustment module, a region candidate network, a first ROI Pooling layer, a second ROI Pooling layer, a region classification network R1, a region classification network R2, and a ship prototype alignment module; The feature extraction network G contains four network blocks, namely conv1, conv2_x, conv3_x and conv4_x, in the ResNet-101 network structure. The settings of these four network blocks are exactly the same as those in the ResNet-101 network structure. After the input image is processed by the feature extraction network G, the output is a feature map F1 equivalent to 1 / 32 of the original image. The input of the region candidate network is the feature map F1. The region candidate network first convolves the feature map F1 through a conv2d 3*3 convolution layer to obtain an intermediate layer feature map. Each position of the intermediate layer feature map has 9 anchor boxes of different sizes. The anchor boxes are then input into two conv2d 1*1 convolution layer branches for processing. One branch uses softmax for binary classification to determine whether there is an object in the anchor box. If there is an object, it is positive, and if not, it is negative. The other branch performs bounding box regression to make the anchor box border closer to the ground truth box. Then, a number of anchor boxes are generated based on the output of the two branches plus the original image information. Finally, N candidate boxes are screened out through NMS. Each candidate box has its own feature information, including the position information of the box and the foreground and background probability information corresponding to the box. The input of the adversarial training module is the feature map F1. The adversarial training module includes a gradient reversal layer and a domain classifier. The gradient reversal layer is connected between the feature extraction network and the domain classifier. The gradient reversal layer reverses the gradient during the back propagation process. The gradient reversal layer forwardly passes the feature map F1 to the domain classifier as it is. The domain classifier first uses a 3×3 convolution layer to perform three dimensionality reduction operations on the input feature map F1, reducing the dimension of the feature map F1 from 1024 to 128. Batch normalization is used after each convolution, and then a fully connected layer is used to obtain a binary classification result. The nonlinear activation process uses the ReLU function. The classification result indicates that the domain classifier determines whether the feature map F1 comes from the source domain or the target domain. The loss of the adversarial training module is as follows: in, is the i-th sample in the annotated optical image domain; is the i-th sample in the radar image domain, n s and n t are the number of samples in the annotated optical image domain and the unannotated radar image domain respectively; G represents the feature extraction network, D g represents the domain classifier; The input of the consistency adjustment module is the feature map F1. The alignment encoder of the consistency adjustment module performs dimension reduction, dimension increase and excitation operations on the feature map F1. The convolution kernel size is 5×5, the step size is 1, the edge padding is 2, and the ReLU function is used to learn the nonlinear interaction between channels. The output feature map F2; the feature map F2 is exactly the same size as the feature map F1; the loss formula of the consistency adjustment module is described as: in, is the i-th sample in the annotated optical image domain, is the pseudo radar image generated after style transfer of the sample, E represents the alignment encoder, G represents the feature extraction network, and ||·|| refers to the Euclidean distance calculation; The input of the first ROI Pooling layer is the candidate box and feature map F1 output by the region candidate network. After being processed by the first ROIPooling layer, all candidate boxes are uniformly adjusted to feature maps M1 of the same size; the feature map M1 is processed by the first fully connected layer of the region classification network R1 to obtain the feature vector V1 corresponding to each box; The input of the second ROI Pooling layer is the candidate box and feature map F2 output by the region candidate network. After being processed by the second ROIPooling layer, all candidate boxes are uniformly adjusted to feature maps M2 of the same size; the feature map M2 is processed by the first fully connected layer of the region classification network R2 to obtain the feature vector V2 corresponding to each box; The input of the regional classification network R1 is the feature map M1 output by the first ROI Pooling layer. After the feature map M1 output by the first ROI Pooling layer is processed by the regional classification network R1, the category and position information of each box is obtained. Finally, the prediction result is obtained by the non-maximum suppression algorithm as the basic feature detection result. The input of the regional classification network R2 is the feature map M2 output by the second ROI Pooling layer. After the feature map M2 output by the second ROI Pooling layer is processed by the regional classification network R2, the category and position information of each box is obtained. Finally, the prediction result is obtained by the non-maximum suppression algorithm, which is the domain invariant feature detection result. The structure of the regional classification network R1 is the same as that of the regional classification network R2, both of which are structures of three fully connected layers, but they do not share parameters. The input of the network is first input into the first fully connected layer, and the output of the first fully connected layer is input into the other two fully connected layers respectively. The two fully connected layers output the position and classification of the candidate box respectively; The ship prototype alignment module includes a foreground frame filter and a ship prototype calculator. The input of the ship prototype alignment module is the feature vector V1 and the feature vector V2. The foreground frame filter of the ship prototype alignment module first filters the input feature vectors V1 and V2 respectively, specifically re-weighting each input foreground frame, and then inputs it into the ship prototype calculator to calculate the ship prototype vector. The foreground frame filter and re-weighting operation formula are described as follows: Ship Prototype Calculator: In formula (8) and formula (9), w i,j represents the weight of the j-th candidate box in the i-th image when calculating the ship prototype vector, is the foreground confidence of the jth candidate box in the i-th image in the feature vector V1, is the foreground confidence of the jth candidate box in the i-th image in the feature vector V2; N is the total number of candidate boxes, r i,j represents the jth candidate box of the i-th image, FC(·) represents the feature vector belonging to the box in the feature vector V1; P i represents the ship prototype vector calculated from the i-th image; The loss function of the ship prototype alignment module is: L p =||P s i -P t i || (10) Among them, P s i The ship prototype vector calculated for the i-th image in the annotated optical image domain, P t i is the ship prototype vector calculated for the i-th image in the radar image domain, and ||·|| refers to the Euclidean distance calculation; the semantic information of the optical image domain and the radar image domain is aligned by reducing the distance between the two; The loss function L of the ship detection network model is the weighted sum of the loss functions of the region candidate network, region classification network, adversarial training module, consistency adjustment module, and ship prototype alignment module. The formula is: Among them, L RPN is the classification and regression loss of the region proposal network, is the classification and regression loss of the regional classification networks R1 and R2, L DA is the loss function of the adversarial training module; L consis The loss function of the consistency adjustment module; L p is the loss function of the ship prototype alignment module; λ1, λ2, λ3 are the hyperparameters assigned to different parts of the loss during the training process; among them, the classification and regression losses of the region candidate network and the classification and regression losses of the region classification networks R1 and R2 are calculated in the annotated optical image domain, and the radar image is unlabeled and does not participate in the calculation.
2. According to the domain adaptation-based radar image ship detection network model of claim 1, it is characterized in that: In the region candidate network, the number of candidate boxes screened by NMS is 128.
3. According to the domain adaptation-based radar image ship detection network model of claim 1, it is characterized in that: The consistency adjustment module uses two-dimensional Fourier transform to perform style transfer on the annotated optical image domain when calculating the loss.
4. According to the domain adaptation-based radar image ship detection network model of claim 1, it is characterized in that: The hyperparameters λ1, λ2, and λ3 in the loss function L of the ship detection network model are 0.5, 0.5, and 0.01, respectively.
5. A radar image ship detection method based on domain adaptation, characterized in that: The detection method adopts the radar image ship detection network model based on domain adaptation as described in any one of claims 1 to 4.
6. The method for detecting ship in radar images based on domain adaptation according to claim 5, characterized in that: The detection method comprises the following steps: Step 1: Select the annotated optical image domain as the source domain data and the radar image domain as the target domain data. Input the source domain data and the target domain data into the ship detection network model with completed parameter initialization. Then calculate the value of the loss function L of the ship detection network model according to the detection results. Use the gradient method to back propagate and update all the parameters of the ship detection network model to complete one training. Input the source domain data and the target domain data into the ship detection network model after updating the parameters again for the next training. The parameter value when the loss function L of the ship detection network model takes the minimum value is the target parameter value. Save the current network model parameter value. The ship detection network model training is completed. Step 2: Input the radar image to be detected into the ship detection network model trained in step 1, and the ship detection result can be obtained from the output of the regional classification network R1.
