Ship detection model training method and device, electronic equipment and storage medium
The ship detection model enhances small target detection in video satellite images through multi-scale feature extraction and iterative training, addressing low resolution and multi-scale challenges for improved accuracy.
Patent Information
- Application Number
- CN202311515863.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-13
- Publication Date
- 2024-12-20
AI Technical Summary
Traditional ship detection methods in video satellite images face challenges with small target detection due to low resolution, blurry images, and multi-scale phenomena, leading to missed detections and inaccurate results, especially for small target ships.
A ship detection model training method involving multi-scale feature extraction, semantic and position information enhancement using a feature pyramid and reconstruction subnet, and iterative training until convergence is achieved.
Improves the accuracy of small target detection by enhancing semantic and positional features, reducing missed detections and improving detection precision.
Smart Images

Figure CN119169402A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer processing technology, and in particular to a ship detection model training method, device, electronic equipment and storage medium. Background Art
[0002] Video satellite images have large width, complex background, large number of moving targets, low resolution, few pixels occupied by targets, and lack of feature and texture information of moving targets. These have brought great difficulties to the detection task of video satellite images. Taking small target ships as an example, the target resolution in the detection area is low, the image quality is blurry, and the small receptive field area cannot efficiently extract effective feature information, which leads to the problem of missing detection of small target ship objects.
[0003] Traditional ship detection uses manual feature extraction. For example, the feature level of the sea level is detected through color segmentation and edge detection, and then the ship and water are separated using image registration. With the rapid development of deep learning technology, more and more detection methods based on deep learning are applied to conventional ship target detection.
[0004] The current method of ship detection based on neural networks has a significant effect on ship detection tasks in normal scenarios. However, for targets such as ships in video satellite images, which are small and sometimes densely distributed, the small receptive field area is small and cannot efficiently extract effective feature information, resulting in missed detection in small target areas. At the same time, due to differences in shooting angles and large differences in the size of the ships themselves, multi-scale phenomena are present, which further reduces the performance of the detector. In addition, existing algorithms for solving small target detection often use a super-resolution-based method, that is, super-resolution amplification before detection, but this method often requires strong hardware support and the image after super-resolution amplification may have artifacts, resulting in missed detection of small target ships, so it cannot meet actual needs well. Summary of the invention
[0005] In view of this, the purpose of the embodiments of the present application is to provide a ship detection model training method, device, electronic device and storage medium, which can improve the problems of inaccurate small target detection results and easy missed detection in traditional ship detection methods.
[0006] In order to achieve the above technical objectives, the technical solutions adopted in this application are as follows:
[0007] In a first aspect, an embodiment of the present application provides a ship detection model training method, the method comprising:
[0008] Acquire a data set for model training, wherein the data set includes a plurality of sample images and the type and coordinates of a real target corresponding to each sample image;
[0009] Inputting the data set into a backbone network in an initial detection model to be trained, and for each sample image, performing multi-scale feature extraction on the sample image through the backbone network to obtain scale feature maps of different scales corresponding to the sample image;
[0010] For each of the sample graphics, the multiple scale feature maps are input into a feature pyramid subnetwork of a feature extraction network in the initial detection model, so as to enhance semantic features of the multiple scale feature maps through the feature pyramid subnetwork to obtain a first feature map, wherein the first feature map contains semantic information of the target;
[0011] For each of the sample graphics, the multiple scale feature maps are input into a feature reconstruction subnet of a feature extraction network in the initial detection model, so as to enhance the position information of the multiple scale feature maps through the feature reconstruction subnet to obtain a second feature map, wherein the second feature map contains the position information of the target;
[0012] Inputting each of the first feature map and the second feature map into a detection head in the initial detection model to identify the category and coordinates of the target in the first feature map and the second feature map, and obtaining a detection result corresponding to the sample image, wherein the detection result includes the type and coordinates of the target;
[0013] Determine whether the loss function of the initial detection model converges, wherein when the loss function converges, determine that the initial detection model is a target detection model, and when the loss function does not converge, adjust the parameters of the initial detection model, and train the initial detection model according to the adjusted parameters until the loss function of the initial detection model converges.
[0014] In combination with the first aspect, in some optional implementations, for each of the sample graphics, the multiple scale feature maps are input into a feature pyramid subnetwork of a feature extraction network in the initial detection model, so as to perform semantic feature enhancement on the multiple scale feature maps through the feature pyramid subnetwork to obtain a first feature map, including:
[0015] At least one feature map that meets the first preset condition among the multiple scale feature maps is used as a first target feature map set, and the first target feature map set is input into the feature pyramid subnet, and semantic feature information is enhanced on each first target feature map in the first target feature map set through the feature pyramid subnet to obtain a semantically enhanced first target feature map corresponding to each first target feature map, and positioning feature information is enhanced on each semantically enhanced first target feature map to obtain a positioning enhanced first target feature map corresponding to each semantically enhanced first target feature map;
[0016] Among the multiple scale feature maps, a feature map that meets the second preset condition is used as a second target feature map, and the second target feature map is respectively spliced with each feature map in the first target feature map after positioning enhancement, except the feature map corresponding to the second target feature map, in channel dimension, to obtain the first feature map corresponding to each of the first target feature maps.
[0017] In combination with the first aspect, in some optional implementations, the feature reconstruction subnet includes a feature extraction layer, a first feature concatenation layer, and a first convolution layer with a convolution kernel of 1×1, and the feature extraction layer includes a local attention-guided global reconstruction module and at least one feature extraction module;
[0018] For each of the sample graphics, the multiple scale feature maps are input into a feature reconstruction subnet of a feature extraction network in the initial detection model, so as to enhance the position information of the multiple scale feature maps through the feature reconstruction subnet to obtain a second feature map, including:
[0019] Using at least one feature map that meets the third preset condition among the multiple scale feature maps as a third target feature map set, and using a feature map that meets the fourth preset condition in the third target feature map set as a fourth target feature map, inputting the fourth target feature map into the local attention guided global reconstruction module to extract a global information feature map and a local information weight in the fourth target feature map, and multiplying the global information feature map by the local information weight to obtain a first sub-map;
[0020] Inputting each feature graph except the fourth target feature graph in the third target feature graph set into the feature extraction module respectively, to obtain a second subgraph corresponding to each feature graph except the fourth target feature graph in the third target feature graph set;
[0021] Inputting the first sub-image and each of the second sub-images into the first feature concatenation layer to concatenate them in the channel dimension to obtain an initial reconstructed feature image;
[0022] The initial reconstructed feature map is input into the first convolutional layer for convolution operation to obtain the second feature map.
[0023] In combination with the first aspect, in some optional implementations, the local attention guided global reconstruction module includes a global feature information extraction submodule and a local feature information extraction submodule;
[0024] The global feature information extraction submodule includes a feature fusion layer, a Swin Transformer layer, a first deconvolution layer and a second deconvolution layer;
[0025] The local feature information extraction submodule includes a first pooling layer, a second pooling layer, a second convolutional layer, a third convolutional layer, a second feature splicing layer, a first jump connection layer, and a second jump connection layer;
[0026] The first jump connection layer includes a first activation function, a first convolution block, and a first Sigmoid function;
[0027] The second jump connection layer includes a second convolution block, a second activation function, a third convolution block and a second Sigmoid function;
[0028] At least one feature map that meets the third preset condition among the multiple scale feature maps is used as a third target feature map set, and a feature map that meets the fourth preset condition in the third target feature map set is used as a fourth target feature map, and the fourth target feature map is input into the local attention guided global reconstruction module to extract the global information feature map and the local information weight in the fourth target feature map, and the global information feature map is multiplied by the local information weight to obtain a first sub-map, including:
[0029] Inputting the fourth target feature map into the feature fusion layer in the global feature information extraction submodule to downsample the fourth target feature map to obtain a first fused feature map;
[0030] Inputting the first fused feature map into the Swin Transformer layer to enhance the global information of the first fused feature map to obtain an enhanced first fused feature map;
[0031] Inputting the enhanced first fused feature map into the first deconvolution layer for a first deconvolution operation, and inputting the first fused feature map after the first deconvolution operation into the second deconvolution layer for a second deconvolution operation, to obtain the global information feature map;
[0032] And, inputting the fourth target feature map into the first pooling layer for average pooling operation, and inputting the fourth target feature map after the average pooling operation into the second convolutional layer for convolution operation to obtain a background information feature map;
[0033] Inputting the fourth target feature map into the second pooling layer for a maximum pooling operation, and inputting the fourth target feature map after the maximum pooling operation into the third convolutional layer for a convolution operation to obtain a texture information feature map;
[0034] Inputting the background information feature map and the texture information feature map into the second feature splicing layer to splice the background information feature map and the texture information feature map in the channel dimension to obtain a second fused feature map;
[0035] Inputting the second fused feature map into the first jump connection layer, passing through the first activation function, the first convolution block, and the first Sigmoid function in the first jump connection layer, outputting a feature weight corresponding to the second fused feature map, and multiplying the feature weight with the fourth target feature map to obtain a third fused feature map;
[0036] The third fused feature map is input into the second jump connection layer, passes through the second convolution block, the second activation function, the third convolution block and the second Sigmoid function in the second jump connection layer, outputs the local information weight, and multiplies the local information weight with the global information feature map to obtain the first sub-map.
[0037] In combination with the first aspect, in some optional implementations, each of the feature extraction modules includes a bilinear interpolation layer and a third convolution layer;
[0038] Inputting each feature map except the fourth target feature map in the third target feature map set into the feature extraction module respectively, and obtaining a second sub-map corresponding to each feature map except the fourth target feature map in the third target feature map set, including:
[0039] For each of the feature maps, inputting the feature maps into the bilinear interpolation layer respectively to perform a bilinear interpolation operation on the feature maps to obtain scaled feature maps;
[0040] The scaled feature map is input into the third convolutional layer to perform a convolution operation on the scaled feature map to obtain the second sub-map.
[0041] In combination with the first aspect, in some optional implementations, the loss function is as follows:
[0042] QFL(δ)=-|y-δ| β((1-y)log(1-δ)+y log(δ))
[0043] QEFL(δ)=QFL(δ)*∑P(i)log P(i)
[0044] DFL(S i ,S i+1 )=-((y i+1 -y)log(S i )+(yy i )log(S i+1 ))
[0045] Wherein, δ represents the predicted output, including the probability that the category of the target to be detected is a certain category, y represents the intersection-and-union ratio of the predicted box and the true value box, y∈(0,1), the predicted box carries the coordinates of the target to be detected, β represents the adjustment factor for adjusting the absolute distance between the predicted output δ and the intersection-and-union ratio y, ∑P(i)logP(i) represents the feature entropy weight coefficient term, y i and i+1 Represent the two values closest to y, S i and S i+1 Respectively represent y i and i+1 The output value of the softmax function.
[0046] In combination with the first aspect, in some optional implementations, the method further includes:
[0047] Obtain an image to be recognized;
[0048] The image to be identified is input into the target detection model, the image to be identified is detected, and the target type and coordinates of the target to be identified in the image to be identified are obtained.
[0049] In a second aspect, an embodiment of the present application further provides a ship detection model training device, the device comprising:
[0050] A first acquisition unit is used to acquire a data set for model training, wherein the data set includes a plurality of sample images and a type and coordinates of a real target corresponding to each sample image;
[0051] A feature extraction unit, used for inputting the data set into a backbone network in an initial detection model to be trained, and for each of the sample images, performing multi-scale feature extraction on the sample image through the backbone network to obtain scale feature maps of different scales corresponding to the sample image;
[0052] A first feature enhancement unit is configured to input the multiple scale feature maps into a feature pyramid subnetwork of a feature extraction network in the initial detection model for each of the sample graphics, so as to perform semantic feature enhancement on the multiple scale feature maps through the feature pyramid subnetwork to obtain a first feature map, wherein the first feature map contains semantic information of the target;
[0053] A second feature enhancement unit is used to input the multiple scale feature maps into a feature reconstruction subnet of a feature extraction network in the initial detection model for each of the sample graphics, so as to enhance the position information of the multiple scale feature maps through the feature reconstruction subnet to obtain a second feature map, wherein the second feature map contains the position information of the target;
[0054] an identification unit, configured to input each of the first feature map and the second feature map into a detection head in the initial detection model to identify the category and coordinates of the target in the first feature map and the second feature map, and obtain a detection result corresponding to the sample image, wherein the detection result includes the type and coordinates of the target;
[0055] A training unit is used to determine whether the loss function of the initial detection model converges, wherein when the loss function converges, the initial detection model is determined to be a target detection model, and when the loss function does not converge, the parameters of the initial detection model are adjusted, and the initial detection model is trained according to the adjusted parameters until the loss function of the initial detection model converges.
[0056] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a processor and a memory coupled to each other, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the electronic device executes the above method.
[0057] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium. When the computer program is executed on a computer, the computer executes the above method.
[0058] The invention adopting the above technical solution has the following advantages:
[0059] In the technical solution provided by the present application, a data set for model training is first obtained, and then the sample images in the data set are input into the backbone network in the initial detection model to be trained for multi-scale feature extraction, and multiple scale feature maps of different scales corresponding to each sample image are obtained, and the multiple scale feature maps are input into the feature extraction network in the initial detection model to obtain the first feature map and the second feature map, and then each first feature map and the second feature map are input into the detection head to obtain the detection result corresponding to the sample image, and finally the initial detection model is parameter adjusted and iteratively trained according to the detection result until the initial detection model meets the preset model convergence conditions. In this way, the problem of inaccurate small target detection results and easy missed detection in the traditional ship detection method is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] The present application may be further described by the non-limiting embodiments given in the accompanying drawings. It should be understood that the following drawings only illustrate certain embodiments of the present application and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other relevant drawings may be obtained based on these drawings without creative effort.
[0061] Figure 1 A block diagram of an electronic device provided in an embodiment of the present application.
[0062] Figure 2 One of the flow charts of the ship detection model training method provided in the embodiment of the present application.
[0063] Figure 3 A schematic diagram of a target example provided for an embodiment of the present application.
[0064] Figure 4 A schematic diagram of the real target marking code provided in an embodiment of the present application.
[0065] Figure 5 The second flowchart of the ship detection model training method provided in the embodiment of the present application.
[0066] Figure 6 A schematic diagram of the network structure of the initial detection model provided in an embodiment of the present application.
[0067] Figure 7 A schematic diagram of the structure of the feature extraction module provided in an embodiment of the present application.
[0068] Figure 8 A schematic diagram of the structure of a local attention guided global reconstruction module provided in an embodiment of the present application.
[0069] Fig. 9 A block diagram of a ship detection model training device provided in an embodiment of the present application.
[0070] Icon: 100 - electronic device; 101 - processor; 102 - memory; 200 - ship detection model training device; 210 - first acquisition unit; 220 - feature extraction unit; 230 - first feature enhancement unit; 240 - second feature enhancement unit; 250 - recognition unit; 260 - training unit. DETAILED DESCRIPTION
[0071] The present application will be described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that in the drawings or descriptions, similar or identical parts use the same figure numbers, and the implementation methods not shown or described in the drawings are forms known to ordinary technicians in the relevant technical field. In the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0072] Please refer to Figure 1 , an embodiment of the present application provides an electronic device 100 that may include a processor 101 and a memory 102. The memory 102 stores a computer program, and when the computer program is executed by the processor 101, the electronic device 100 can execute the corresponding steps in the following ship detection model training method.
[0073] In this embodiment, the electronic device 100 can be a personal computer, a laptop, a server, etc., which is used to obtain a data set for model training, and then input the sample image in the data set into the backbone network in the initial detection model to be trained for multi-scale feature extraction to obtain multiple scale feature maps of different scales, and then input the scale feature map into the feature extraction network, the first feature map and the second feature map in the initial detection model. For each sample image, each first target feature map and the second target feature map are input into the detection head in the initial detection model to obtain the detection result corresponding to the sample image, and finally adjust the parameters of the initial detection model based on the detection result, and iteratively train the initial detection model until the loss value meets the preset model convergence condition.
[0074] Please refer to Figure 2 and Figure 5 The present application also provides a ship detection model training method, which can be applied to the above electronic device 100, and each step in the method is executed or implemented by the electronic device 100. The ship detection model training method can include the following steps:
[0075] Step 110, obtaining a data set for model training, wherein the data set includes a plurality of sample images and the type and coordinates of a real target corresponding to each sample image;
[0076] Step 120, inputting the data set into a backbone network in an initial detection model to be trained, and for each of the sample images, performing multi-scale feature extraction on the sample image through the backbone network to obtain scale feature maps of different scales corresponding to the sample image;
[0077] Step 130: for each of the sample graphics, input the multiple scale feature maps into a feature pyramid subnetwork of a feature extraction network in the initial detection model, so as to enhance semantic features of the multiple scale feature maps through the feature pyramid subnetwork to obtain a first feature map, wherein the first feature map contains semantic information of the target;
[0078] Step 140: for each of the sample graphics, input the multiple scale feature maps into a feature reconstruction subnet of a feature extraction network in the initial detection model, so as to enhance the position information of the multiple scale feature maps through the feature reconstruction subnet to obtain a second feature map, wherein the second feature map contains the position information of the target;
[0079] Step 150, inputting each of the first feature map and the second feature map into a detection head in the initial detection model to identify the category and coordinates of the target in the first feature map and the second feature map, and obtaining a detection result corresponding to the sample image, wherein the detection result includes the type and coordinates of the target;
[0080] Step 160, determining whether the loss function of the initial detection model converges, wherein when the loss function converges, determining that the initial detection model is a target detection model, when the loss function does not converge, adjusting the parameters of the initial detection model, and training the initial detection model according to the adjusted parameters until the loss function of the initial detection model converges.
[0081] In the above implementation, a data set for model training is first obtained, and then the sample images in the data set are input into the backbone network in the initial detection model to be trained for multi-scale feature extraction, and multiple scale feature maps corresponding to each sample image are obtained, and the multiple scale feature maps are input into the feature extraction network in the initial detection model to obtain the first feature map and the second feature map, and then each first feature map and the second feature map are input into the detection head to obtain the detection result corresponding to the sample image, and finally the initial detection model is parameter adjusted and iteratively trained according to the detection result until the initial detection model meets the preset model convergence condition. In this way, the problem of inaccurate small target detection results and easy missed detection in the traditional ship detection method is improved.
[0082] The following is a detailed description of the various steps of the ship detection model training method, as follows:
[0083] In step 110, a pre-stored data set may be called based on a user instruction, or an initial sample image may be acquired in real time and a data set may be generated through the aforementioned steps to serve as a data source for subsequent initial detection model training. The method for acquiring the data set is not specifically limited here.
[0084] In practical applications, since video satellite images are difficult to obtain, the following Figure 3 The real scene on the inland waterway shown in the figure is used as the initial sample image. For the initial sample image, the data set composed of the initial sample images is first annotated. In this embodiment, the number of target instances (i.e., ships) carried by all the initial sample images in the data set is 13651. According to the definition of small targets in MS COCO (Microsoft COCO: Common Objects in Context, COCO database) (targets smaller than 32×32 pixels are regarded as small targets), the above target instances are classified and annotated. The specific categories are shown in the following table:
[0085] Label information table:
[0086]
[0087] In this embodiment, refer to Figure 4 ,The above target instances are annotated in VOC2007 format, the annotated initial sample images are used as sample images, and the annotated dataset format is converted to MS COCO format for model training.
[0088] In step 120, the backbone network may adopt a network structure based on EfficientNet, such as EfficientNet_v1, EfficientNet_v2, etc. The backbone network composed of such a structure has a strong ability to extract deep feature information, such as the global color and texture structure of the sample image. The sample image is input into the backbone network, and the backbone network outputs scale feature maps with downsampling scales of 2, 4, 8, 16, and 32 times, respectively, which are recorded as C1, C2, C3, C4, and C5.
[0089] In step 130, for each of the sample graphics, the multiple scale feature maps are input into a feature pyramid subnetwork of a feature extraction network in the initial detection model, so as to enhance semantic features of the multiple scale feature maps through the feature pyramid subnetwork to obtain a first feature map, which may include:
[0090] At least one feature map that meets the first preset condition among the multiple scale feature maps is used as a first target feature map set, and the first target feature map set is input into the feature pyramid subnet, and semantic feature information is enhanced on each first target feature map in the first target feature map set through the feature pyramid subnet to obtain a semantically enhanced first target feature map corresponding to each first target feature map, and positioning feature information is enhanced on each semantically enhanced first target feature map to obtain a positioning enhanced first target feature map corresponding to each semantically enhanced first target feature map;
[0091] Among the multiple scale feature maps, a feature map that meets the second preset condition is used as a second target feature map, and the second target feature map is respectively spliced with each feature map in the first target feature map after positioning enhancement, except the feature map corresponding to the second target feature map, in channel dimension, to obtain the first feature map corresponding to each of the first target feature maps.
[0092] In this embodiment, the first preset condition may refer to sorting the scale feature maps according to the semantic information of the target to be detected carried by each scale feature map, and taking a preset number (for example, 3, 4, etc.) of feature maps with more semantic information as the first target feature map set.
[0093] In this embodiment, refer to Figure 6 ( Figure 6 In the example, C1, C2 and C3 are used as inputs of the feature reconstruction subnet. The structure and working principle of the feature reconstruction subnet refer to the following step 140). Figure 6 As shown, the feature pyramid subnet can be composed of a PAN network, and the scale feature maps C1, C2, C3, C4 and C5 output by the backbone network, C2, C3, C4 and C5 with more semantic information are used as the first target feature map set, and each first target feature map is input into the feature pyramid subnet, and the semantic feature enhancement is performed from top to bottom through the feature pyramid subnet, for example, C4 is spliced with C5 after 2x (i.e., 2 times upsampling), and C3 is spliced with C4 after 2x (i.e., 2 times upsampling). And the first feature map after semantic feature enhancement is enhanced from bottom to top. For example, C3 after semantic feature enhancement is spliced with P2 after 0.5x (i.e., 0.5 times downsampling) to obtain P3, and C4 after semantic feature enhancement is spliced with P3 after 0.5x (i.e., 0.5 times downsampling) to obtain P4. Finally, the first target feature maps P2, P3, P4 and P5 after positioning enhancement are obtained. In this embodiment, in order to lighten the model structure, the convolution operation in the original PAN network structure can be adaptively replaced by upsampling or downsampling.
[0094] After obtaining the first target feature map after positioning enhancement, in order to further enhance the semantic features of the feature map, the second preset condition will be met, that is, the feature map C5 carrying the most semantic information of the target to be detected will be used as the second target feature map, and C5 will be spliced with each first target feature map after positioning enhancement in the channel dimension. In practical applications, since the enhanced first target feature map P5 and the second target feature map carry the same semantic feature information, the second target feature map only needs to be spliced with the first target feature maps P2, P3 and P4 after positioning enhancement in the channel dimension, and the spliced feature map is reduced in dimension through a convolution with a convolution kernel of 1×1 to finally obtain the first feature map corresponding to each first target feature map.
[0095] In step 140, in this embodiment, refer to Figure 7 and Figure 8 , the feature reconstruction subnet includes a feature extraction layer, a first feature concatenation layer and a first convolution layer with a convolution kernel of 1×1, and the feature extraction layer includes a local attention-guided global reconstruction module and at least one feature extraction module;
[0096] For each of the sample graphics, inputting the multiple scale feature maps into a feature reconstruction subnet of a feature extraction network in the initial detection model, so as to enhance the position information of the multiple scale feature maps through the feature reconstruction subnet to obtain a second feature map, may include:
[0097] Using at least one feature map that meets the third preset condition among the multiple scale feature maps as a third target feature map set, and using a feature map that meets the fourth preset condition in the third target feature map set as a fourth target feature map, inputting the fourth target feature map into the local attention guided global reconstruction module to extract a global information feature map and a local information weight in the fourth target feature map, and multiplying the global information feature map by the local information weight to obtain a first sub-map;
[0098] Inputting each feature graph except the fourth target feature graph in the third target feature graph set into the feature extraction module respectively, to obtain a second subgraph corresponding to each feature graph except the fourth target feature graph in the third target feature graph set;
[0099] Inputting the first sub-image and each of the second sub-images into the first feature concatenation layer to concatenate them in the channel dimension to obtain an initial reconstructed feature image;
[0100] The initial reconstructed feature map is input into the first convolutional layer for convolution operation to obtain the second feature map.
[0101] In this embodiment, the local attention guided global reconstruction module includes a global feature information extraction submodule and a local feature information extraction submodule;
[0102] The global feature information extraction submodule includes a feature fusion layer, a Swin Transformer layer, a first deconvolution layer and a second deconvolution layer;
[0103] The local feature information extraction submodule includes a first pooling layer, a second pooling layer, a second convolutional layer, a third convolutional layer, a second feature splicing layer, a first jump connection layer, and a second jump connection layer;
[0104] The first jump connection layer includes a first activation function, a first convolution block, and a first Sigmoid function;
[0105] The second jump connection layer includes a second convolution block, a second activation function, a third convolution block and a second Sigmoid function;
[0106] Taking at least one feature map that satisfies the third preset condition among the multiple scale feature maps as a third target feature map set, taking a feature map that satisfies the fourth preset condition among the third target feature map set as a fourth target feature map, inputting the fourth target feature map into the local attention guided global reconstruction module to extract a global information feature map and a local information weight in the fourth target feature map, and multiplying the global information feature map by the local information weight to obtain a first sub-map may include:
[0107] Inputting the fourth target feature map into the feature fusion layer in the global feature information extraction submodule to downsample the fourth target feature map to obtain a first fused feature map;
[0108] Inputting the first fused feature map into the Swin Transformer layer to enhance the global information of the first fused feature map to obtain an enhanced first fused feature map;
[0109] Inputting the enhanced first fused feature map into the first deconvolution layer for a first deconvolution operation, and inputting the first fused feature map after the first deconvolution operation into the second deconvolution layer for a second deconvolution operation, to obtain the global information feature map;
[0110] And, inputting the fourth target feature map into the first pooling layer for average pooling operation, and inputting the fourth target feature map after the average pooling operation into the second convolutional layer for convolution operation to obtain a background information feature map;
[0111] Inputting the fourth target feature map into the second pooling layer for a maximum pooling operation, and inputting the fourth target feature map after the maximum pooling operation into the third convolutional layer for a convolution operation to obtain a texture information feature map;
[0112] Inputting the background information feature map and the texture information feature map into the second feature splicing layer to splice the background information feature map and the texture information feature map in the channel dimension to obtain a second fused feature map;
[0113] Inputting the second fused feature map into the first jump connection layer, passing through the first activation function, the first convolution block, and the first Sigmoid function in the first jump connection layer, outputting a feature weight corresponding to the second fused feature map, and multiplying the feature weight with the fourth target feature map to obtain a third fused feature map;
[0114] The third fused feature map is input into the second jump connection layer, passes through the second convolution block, the second activation function, the third convolution block and the second Sigmoid function in the second jump connection layer, outputs the local information weight, and multiplies the local information weight with the global information feature map to obtain the first sub-map.
[0115] In this embodiment, the main difference between the small target detection task and the general target detection task is that in the small target detection task, the resolution of the target to be detected is too low and the size is too small. Therefore, for the small target detection task, it is necessary to use the shallow feature map with higher resolution extracted by the neural network as much as possible. Because the feature map with higher shallow resolution contains more spatial position information, which is conducive to the detection of small targets, although the scale feature maps C4 and C5 contain more semantic information, they lack the physical information of small targets (i.e., spatial position information, position information). If they are fused with high-resolution feature maps, the physical information of small targets in the high-resolution feature map will be destroyed, which is not conducive to the detection of small targets. Therefore, the input of the feature reconstruction subnet is C1, C2 and C3. That is, the third preset condition can be three feature maps with higher resolution and more position information among multiple scale feature maps.
[0116] In this embodiment, in order to ensure the expression ability of global information in the feature map, the scale feature map C1 that meets the fourth preset condition (i.e., the largest resolution and the most global feature information) in the third target feature map set (i.e., C1, C2, and C3) is used as the fourth target feature map and input into the local attention guided global reconstruction module. The local attention guided global reconstruction module (hereinafter referred to as LAGGR module) includes a global feature information extraction submodule and a local feature information extraction submodule.
[0117] Specifically, the global information feature map F in C1 is extracted through the global feature information extraction submodule global , the local feature information extraction submodule performs average pooling and global pooling operations on C1 respectively, and obtains the background information feature map and the texture information feature map respectively, and then inputs the two into the first skip layer, and after the first activation function, the first convolution block, and the first Sigmoid function in the first skip layer, the feature weight F′ is output as follows:
[0118] F′=Sig(Conv(ReLU(Conv(Concat(Conv(Avg(C1)),Conv(Max(C1)))))))
[0119] After obtaining the feature weight, the feature weight F′ is multiplied by C1 to obtain the third fused feature map, and the third fused feature map is input into the second jump connection layer, and the local information weight F is output through the second convolution block, the second activation function, the third convolution block and the second Sigmoid function in the second jump connection layer. local ,as follows:
[0120] F local =Sig(Conv(ReLU(Conv(F′×C1))))
[0121] After determining the local information weight, the local information weight F local Compared with the above global information feature map F global Multiplying them, we can get the first subgraph P1, as follows:
[0122] P1=F global ×F local .
[0123] In this embodiment, each of the feature extraction modules includes a bilinear interpolation layer and a third convolution layer;
[0124] Inputting each feature graph other than the fourth target feature graph in the third target feature graph set into the feature extraction module respectively, and obtaining a second subgraph corresponding to each feature graph other than the fourth target feature graph in the third target feature graph set may include:
[0125] For each of the feature maps, inputting the feature maps into the bilinear interpolation layer respectively to perform a bilinear interpolation operation on the feature maps to obtain scaled feature maps;
[0126] The scaled feature map is input into the third convolutional layer to perform a convolution operation on the scaled feature map to obtain the second sub-map.
[0127] In this embodiment, the feature maps other than the fourth target feature map, namely C2 and C3, in the third target feature map set are subjected to bilinear interpolation through a bilinear interpolation layer to obtain a scaled feature map. The bilinear interpolation operation is performed on C2 and C3 so that the resolution of C2 and C3 is consistent with that of C1, which is convenient for subsequent splicing.
[0128] In this embodiment, after obtaining the scaled feature maps corresponding to C2 and C3, 3×3 convolution operations are performed respectively to obtain the second sub-maps corresponding to C2 and C3.
[0129] In this embodiment, the first sub-image and each second sub-image are input into the first feature splicing layer, and the channel dimension is spliced to obtain an initial reconstructed feature map, and then the initial reconstructed feature map is input into the first convolution layer for a 1×1 convolution operation to obtain a second feature map.
[0130] In step 150, each first feature map and second feature map are input into the detection head, and the detection head identifies the target to be detected in the sample image to obtain the category and coordinates of the target to be detected. Among them, the detection head uses ATSS (Adaptive Training Sample Selection) to divide the preset anchor frame in the sample image into positive and negative samples. The loss function of the detection head uses the improved GFL Loss, and the improved GFL Loss specifically refers to the description of the loss function in step 160.
[0131] In step 160, the loss function is as follows:
[0132] QFL(δ)=-|y-δ| β ((1-y)log(1-δ)+ylog(δ))
[0133] QEFL(δ)=QFL(δ)*∑P(i)log P(i)
[0134] DFL(S i ,S i+1 )=-((y i+1 -y)log(S i )+(yy i )log(S i+1 ))
[0135] Wherein, δ represents the predicted output, including the probability that the category of the target to be detected is a certain category, y represents the intersection-and-union ratio of the predicted box and the true value box, y∈(0,1), the predicted box carries the coordinates of the target to be detected, β represents the adjustment factor for adjusting the absolute distance between the predicted output δ and the intersection-and-union ratio y, ∑P(i)logP(i) represents the feature entropy weight coefficient term, y i and i+1 Represent the two values closest to y, S i and S i+1 Respectively represent y i and i+1 The output value of the softmax function.
[0136] As an optional implementation, the method may further include:
[0137] Obtain an image to be recognized;
[0138] The image to be identified is input into the target detection model, the image to be identified is detected, and the target type and coordinates of the target to be identified in the image to be identified are obtained.
[0139] In this embodiment, after the training of the initial detection model is completed, the trained initial detection model is used as the target detection model. A single frame image in the video stream generated by satellite remote sensing on the ground is captured as the image to be identified, and then the image to be identified is input into the target detection model. The target detection model is used to identify the type and coordinate position of small targets in the image to be identified, such as transport ships, lifeboats, etc.
[0140] Please refer to Fig. 9 The present application also provides a ship detection model training device 200, which includes at least one software function module that can be stored in the memory 102 in the form of software or firmware or fixed in the operating system (OS) of the electronic device 100. The processor 101 is used to execute the executable modules stored in the memory 102, such as the software function modules and computer programs included in the ship detection model training device 200.
[0141] The ship detection model training device 200 includes a first acquisition unit 210, a feature extraction unit 220, a first feature enhancement unit 230, a second feature enhancement unit 240, a recognition unit 250 and a training unit 260. The functions of each unit may be as follows:
[0142] A first acquisition unit 210 is used to acquire a data set for model training, wherein the data set includes a plurality of sample images and a type and coordinates of a real target corresponding to each sample image;
[0143] A feature extraction unit 220 is used to input the data set into a backbone network in the initial detection model to be trained, and for each of the sample images, perform multi-scale feature extraction on the sample image through the backbone network to obtain scale feature maps of different scales corresponding to the sample image;
[0144] A first feature enhancement unit 230 is used for inputting the multiple scale feature maps into a feature pyramid subnetwork of a feature extraction network in the initial detection model for each of the sample graphics, so as to perform semantic feature enhancement on the multiple scale feature maps through the feature pyramid subnetwork to obtain a first feature map, wherein the first feature map contains semantic information of the target;
[0145] A second feature enhancement unit 240 is used to input the multiple scale feature maps into a feature reconstruction subnet of a feature extraction network in the initial detection model for each of the sample graphics, so as to enhance the position information of the multiple scale feature maps through the feature reconstruction subnet to obtain a second feature map, wherein the second feature map includes the position information of the target;
[0146] an identification unit 250, configured to input each of the first feature map and the second feature map into a detection head in the initial detection model to identify the category and coordinates of the target in the first feature map and the second feature map, and obtain a detection result corresponding to the sample image, wherein the detection result includes the type and coordinates of the target;
[0147] The training unit 260 is used to determine whether the loss function of the initial detection model converges, wherein when the loss function converges, the initial detection model is determined to be a target detection model, and when the loss function does not converge, the parameters of the initial detection model are adjusted, and the initial detection model is trained according to the adjusted parameters until the loss function of the initial detection model converges.
[0148] Optionally, the first feature enhancement unit 230 is further configured to:
[0149] At least one feature map that meets the first preset condition among the multiple scale feature maps is used as a first target feature map set, and the first target feature map set is input into the feature pyramid subnet, and semantic feature information is enhanced on each first target feature map in the first target feature map set through the feature pyramid subnet to obtain a semantically enhanced first target feature map corresponding to each first target feature map, and positioning feature information is enhanced on each semantically enhanced first target feature map to obtain a positioning enhanced first target feature map corresponding to each semantically enhanced first target feature map;
[0150] Among the multiple scale feature maps, a feature map that meets the second preset condition is used as a second target feature map, and the second target feature map is respectively spliced with each feature map in the first target feature map after positioning enhancement, except the feature map corresponding to the second target feature map, in channel dimension, to obtain the first feature map corresponding to each of the first target feature maps.
[0151] Optionally, the feature reconstruction subnet includes a feature extraction layer, a first feature concatenation layer, and a first convolution layer with a convolution kernel of 1×1, and the feature extraction layer includes a local attention-guided global reconstruction module and at least one feature extraction module;
[0152] The second feature enhancement unit 240 is further configured to:
[0153] Using at least one feature map that meets the third preset condition among the multiple scale feature maps as a third target feature map set, and using a feature map that meets the fourth preset condition in the third target feature map set as a fourth target feature map, inputting the fourth target feature map into the local attention guided global reconstruction module to extract a global information feature map and a local information weight in the fourth target feature map, and multiplying the global information feature map by the local information weight to obtain a first sub-map;
[0154] Inputting each feature graph except the fourth target feature graph in the third target feature graph set into the feature extraction module respectively, to obtain a second subgraph corresponding to each feature graph except the fourth target feature graph in the third target feature graph set;
[0155] Inputting the first sub-image and each of the second sub-images into the first feature concatenation layer to concatenate them in the channel dimension to obtain an initial reconstructed feature image;
[0156] The initial reconstructed feature map is input into the first convolutional layer for convolution operation to obtain the second feature map.
[0157] Optionally, the local attention guided global reconstruction module includes a global feature information extraction submodule and a local feature information extraction submodule;
[0158] The global feature information extraction submodule includes a feature fusion layer, a Swin Transformer layer, a first deconvolution layer and a second deconvolution layer;
[0159] The local feature information extraction submodule includes a first pooling layer, a second pooling layer, a second convolutional layer, a third convolutional layer, a second feature splicing layer, a first jump connection layer, and a second jump connection layer;
[0160] The first jump connection layer includes a first activation function, a first convolution block, and a first Sigmoid function;
[0161] The second jump connection layer includes a second convolution block, a second activation function, a third convolution block and a second Sigmoid function;
[0162] The second feature enhancement unit 240 is further configured to:
[0163] Inputting the fourth target feature map into the feature fusion layer in the global feature information extraction submodule to downsample the fourth target feature map to obtain a first fused feature map;
[0164] Inputting the first fused feature map into the Swin Transformer layer to enhance the global information of the first fused feature map to obtain an enhanced first fused feature map;
[0165] Inputting the enhanced first fused feature map into the first deconvolution layer for a first deconvolution operation, and inputting the first fused feature map after the first deconvolution operation into the second deconvolution layer for a second deconvolution operation, to obtain the global information feature map;
[0166] And, inputting the fourth target feature map into the first pooling layer for average pooling operation, and inputting the fourth target feature map after the average pooling operation into the second convolutional layer for convolution operation to obtain a background information feature map;
[0167] Inputting the fourth target feature map into the second pooling layer for a maximum pooling operation, and inputting the fourth target feature map after the maximum pooling operation into the third convolutional layer for a convolution operation to obtain a texture information feature map;
[0168] Inputting the background information feature map and the texture information feature map into the second feature splicing layer to splice the background information feature map and the texture information feature map in the channel dimension to obtain a second fused feature map;
[0169] Inputting the second fused feature map into the first jump connection layer, passing through the first activation function, the first convolution block, and the first Sigmoid function in the first jump connection layer, outputting a feature weight corresponding to the second fused feature map, and multiplying the feature weight with the fourth target feature map to obtain a third fused feature map;
[0170] The third fused feature map is input into the second jump connection layer, passes through the second convolution block, the second activation function, the third convolution block and the second Sigmoid function in the second jump connection layer, outputs the local information weight, and multiplies the local information weight with the global information feature map to obtain the first sub-map.
[0171] Optionally, each of the feature extraction modules includes a bilinear interpolation layer and a third convolution layer;
[0172] The second feature enhancement unit 240 is further configured to:
[0173] For each of the feature maps, inputting the feature maps into the bilinear interpolation layer respectively to perform a bilinear interpolation operation on the feature maps to obtain scaled feature maps;
[0174] The scaled feature map is input into the third convolutional layer to perform a convolution operation on the scaled feature map to obtain the second sub-map.
[0175] Optionally, the loss function is as follows:
[0176] QFL(δ)=-|y-δ| β ((1-y)log(1-δ)+y log(δ))
[0177] QEFL(δ)=QFL(δ)*∑P(i)logP(i)
[0178] DFL(S i ,S i+1 )=-((y i+1 -y)log(S i )+(yy i )log(S i+1 ))
[0179] Wherein, δ represents the predicted output, including the probability that the category of the target to be detected is a certain category, y represents the intersection-and-union ratio of the predicted box and the true value box, y∈(0,1), the predicted box carries the coordinates of the target to be detected, β represents the adjustment factor for adjusting the absolute distance between the predicted output δ and the intersection-and-union ratio y, ∑P(i)logP(i) represents the feature entropy weight coefficient term, y i and i+1Represent the two values closest to y, S i and S i+1 Respectively represent y i and i+1 The output value of the softmax function.
[0180] Optionally, the ship detection model training device 200 further includes:
[0181] A second acquisition unit, used for acquiring an image to be recognized;
[0182] The detection unit is used to input the image to be identified into the target detection model, detect the image to be identified, and obtain the target type and coordinates of the target to be identified in the image to be identified.
[0183] In this embodiment, the processor 101 may be an integrated circuit chip having signal processing capabilities. The processor 101 may be a general-purpose processor. For example, the processor may be a central processing unit (CPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application.
[0184] The memory 102 may be, but is not limited to, a random access memory, a read-only memory, a programmable read-only memory, an erasable programmable read-only memory, an electrically erasable programmable read-only memory, etc. In this embodiment, the memory 102 may be used to store a data set, an initial detection model, a first preset condition, a second preset condition, a third preset condition, a fourth preset condition, a preset model convergence condition, a target detection model, an image to be identified, a detection result, etc. Of course, the memory 102 may also be used to store a program, and the processor 101 executes the program after receiving an execution instruction.
[0185] Understandably, Figure 1 The structure of the electronic device 100 shown in FIG. 1 is only a schematic diagram of the structure. The electronic device 100 may also include Figure 1 More components are shown. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0186] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the electronic device 100 described above can refer to the corresponding process of each step in the aforementioned method, and will not be elaborated herein.
[0187] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed on a computer, the computer executes the ship detection model training method described in the above embodiment.
[0188] Through the description of the above implementation methods, technical personnel in this field can clearly understand that the present application can be implemented by hardware, and can also be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0189] In summary, the embodiments of the present application provide a ship detection model training method, device, electronic device and storage medium. In this technical solution, a data set for model training is first obtained, and then the sample images in the data set are input into the backbone network of the initial detection model to be trained for multi-scale feature extraction, and multiple scale feature maps of different scales corresponding to each sample image are obtained, and the multiple scale feature maps are input into the feature extraction network in the initial detection model to obtain the first feature map and the second feature map, and then the second feature map and each first feature map are input into the detection head to obtain the detection result corresponding to the sample image, and finally the initial detection model is parameter adjusted and iteratively trained according to the detection result until the initial detection model meets the preset model convergence condition. In this way, the problem of inaccurate small target detection results and easy missed detection in the traditional ship detection method is improved.
[0190] In the embodiments provided in the present application, it should be understood that the disclosed device, system and method can also be implemented in other ways. The above-described device, system and method embodiments are merely schematic, for example, the flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a part of a module, a program segment or a code, and a part of the module, program segment or code contains one or more executable instructions for implementing the specified logical function. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of the boxes in the block diagram and / or the flowchart can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. In addition, each functional module in each embodiment of the present application can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part.
[0191] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A ship detection model training method, characterized in that: The method comprises: Acquire a data set for model training, wherein the data set includes a plurality of sample images and the type and coordinates of a real target corresponding to each sample image; Inputting the data set into a backbone network in an initial detection model to be trained, and for each sample image, performing multi-scale feature extraction on the sample image through the backbone network to obtain scale feature maps of different scales corresponding to the sample image; For each of the sample graphics, the multiple scale feature maps are input into a feature pyramid subnetwork of a feature extraction network in the initial detection model, so as to enhance semantic features of the multiple scale feature maps through the feature pyramid subnetwork to obtain a first feature map, wherein the first feature map contains semantic information of the target; For each of the sample graphics, the multiple scale feature maps are input into a feature reconstruction subnet of a feature extraction network in the initial detection model, so as to enhance the position information of the multiple scale feature maps through the feature reconstruction subnet to obtain a second feature map, wherein the second feature map contains the position information of the target; Inputting each of the first feature map and the second feature map into a detection head in the initial detection model to identify the category and coordinates of the target in the first feature map and the second feature map, and obtaining a detection result corresponding to the sample image, wherein the detection result includes the type and coordinates of the target; Determine whether the loss function of the initial detection model converges, wherein when the loss function converges, determine that the initial detection model is a target detection model, and when the loss function does not converge, adjust the parameters of the initial detection model, and train the initial detection model according to the adjusted parameters until the loss function of the initial detection model converges.
2. The method according to claim 1, characterized in that: For each of the sample graphics, the multiple scale feature maps are input into a feature pyramid subnetwork of a feature extraction network in the initial detection model, so as to perform semantic feature enhancement on the multiple scale feature maps through the feature pyramid subnetwork to obtain a first feature map, including: At least one feature map that meets the first preset condition among the multiple scale feature maps is used as a first target feature map set, and the first target feature map set is input into the feature pyramid subnet, and semantic feature information is enhanced on each first target feature map in the first target feature map set through the feature pyramid subnet to obtain a semantically enhanced first target feature map corresponding to each first target feature map, and positioning feature information is enhanced on each semantically enhanced first target feature map to obtain a positioning enhanced first target feature map corresponding to each semantically enhanced first target feature map; Among the multiple scale feature maps, a feature map that meets the second preset condition is used as a second target feature map, and the second target feature map is respectively spliced with each feature map in the first target feature map after positioning enhancement, except the feature map corresponding to the second target feature map, in channel dimension, to obtain the first feature map corresponding to each of the first target feature maps.
3. The method according to claim 1, characterized in that The feature reconstruction subnet includes a feature extraction layer, a first feature concatenation layer, and a first convolution layer with a convolution kernel of 1×1, and the feature extraction layer includes a local attention-guided global reconstruction module and at least one feature extraction module; For each of the sample graphics, the multiple scale feature maps are input into a feature reconstruction subnet of a feature extraction network in the initial detection model, so as to enhance the position information of the multiple scale feature maps through the feature reconstruction subnet to obtain a second feature map, including: Using at least one feature map that meets the third preset condition among the multiple scale feature maps as a third target feature map set, and using a feature map that meets the fourth preset condition in the third target feature map set as a fourth target feature map, inputting the fourth target feature map into the local attention guided global reconstruction module to extract a global information feature map and a local information weight in the fourth target feature map, and multiplying the global information feature map by the local information weight to obtain a first sub-map; Inputting each feature graph except the fourth target feature graph in the third target feature graph set into the feature extraction module respectively, to obtain a second subgraph corresponding to each feature graph except the fourth target feature graph in the third target feature graph set; Inputting the first sub-image and each of the second sub-images into the first feature concatenation layer to concatenate them in the channel dimension to obtain an initial reconstructed feature image; The initial reconstructed feature map is input into the first convolutional layer for convolution operation to obtain the second feature map.
4. The method according to claim 3, characterized in that The local attention guided global reconstruction module includes a global feature information extraction submodule and a local feature information extraction submodule; The global feature information extraction submodule includes a feature fusion layer, a Swin Transformer layer, a first deconvolution layer and a second deconvolution layer; The local feature information extraction submodule includes a first pooling layer, a second pooling layer, a second convolutional layer, a third convolutional layer, a second feature splicing layer, a first jump connection layer, and a second jump connection layer; The first jump connection layer includes a first activation function, a first convolution block, and a first Sigmoid function; The second jump connection layer includes a second convolution block, a second activation function, a third convolution block and a second Sigmoid function; At least one feature map that meets the third preset condition among the multiple scale feature maps is used as a third target feature map set, and a feature map that meets the fourth preset condition in the third target feature map set is used as a fourth target feature map, and the fourth target feature map is input into the local attention guided global reconstruction module to extract the global information feature map and the local information weight in the fourth target feature map, and the global information feature map is multiplied by the local information weight to obtain a first sub-map, including: Inputting the fourth target feature map into the feature fusion layer in the global feature information extraction submodule to downsample the fourth target feature map to obtain a first fused feature map; Inputting the first fused feature map into the Swin Transformer layer to enhance the global information of the first fused feature map to obtain an enhanced first fused feature map; Inputting the enhanced first fused feature map into the first deconvolution layer for a first deconvolution operation, and inputting the first fused feature map after the first deconvolution operation into the second deconvolution layer for a second deconvolution operation, to obtain the global information feature map; And, inputting the fourth target feature map into the first pooling layer for average pooling operation, and inputting the fourth target feature map after the average pooling operation into the second convolutional layer for convolution operation to obtain a background information feature map; Inputting the fourth target feature map into the second pooling layer for a maximum pooling operation, and inputting the fourth target feature map after the maximum pooling operation into the third convolutional layer for a convolution operation to obtain a texture information feature map; Inputting the background information feature map and the texture information feature map into the second feature splicing layer to splice the background information feature map and the texture information feature map in the channel dimension to obtain a second fused feature map; Inputting the second fused feature map into the first jump connection layer, passing through the first activation function, the first convolution block, and the first Sigmoid function in the first jump connection layer, outputting a feature weight corresponding to the second fused feature map, and multiplying the feature weight with the fourth target feature map to obtain a third fused feature map; The third fused feature map is input into the second jump connection layer, passes through the second convolution block, the second activation function, the third convolution block and the second Sigmoid function in the second jump connection layer, outputs the local information weight, and multiplies the local information weight with the global information feature map to obtain the first sub-map.
5. The method according to claim 3, characterized in that: Each of the feature extraction modules comprises a bilinear interpolation layer and a third convolutional layer; Inputting each feature map except the fourth target feature map in the third target feature map set into the feature extraction module respectively, and obtaining a second sub-map corresponding to each feature map except the fourth target feature map in the third target feature map set, including: For each of the feature maps, inputting the feature maps into the bilinear interpolation layer respectively to perform a bilinear interpolation operation on the feature maps to obtain scaled feature maps; The scaled feature map is input into the third convolutional layer to perform a convolution operation on the scaled feature map to obtain the second sub-map.
6. The method according to claim 1, characterized in that The loss function is as follows: QFL(δ)=-|y-δ| β ((1-y)log(1-δ)+ylog(δ)) QEFL(δ)=QFL(δ)*∑P(i)logP(i) DFL(S i ,S i+1 )=-((y i+1 -y)log(S i )+(y-y i )log(S i+1 )) Wherein, δ represents the predicted output, including the probability that the category of the target to be detected is a certain category, y represents the intersection-and-union ratio of the predicted box and the true value box, y∈(0,1), the predicted box carries the coordinates of the target to be detected, β represents the adjustment factor for adjusting the absolute distance between the predicted output δ and the intersection-and-union ratio y, ∑P(i)logP(i) represents the feature entropy weight coefficient term, y i and i+1 Represent the two values closest to y, S i and S i+1 Respectively represent y i and i+1 The output value of the softmax function.
7. The method according to claim 1, characterized in that The method further comprises: Obtain an image to be recognized; The image to be identified is input into the target detection model, the image to be identified is detected, and the target type and coordinates of the target to be identified in the image to be identified are obtained.
8. A ship detection model training device, characterized in that: The device comprises: A first acquisition unit is used to acquire a data set for model training, wherein the data set includes a plurality of sample images and a type and coordinates of a real target corresponding to each sample image; A feature extraction unit, used for inputting the data set into a backbone network in an initial detection model to be trained, and for each of the sample images, performing multi-scale feature extraction on the sample image through the backbone network to obtain scale feature maps of different scales corresponding to the sample image; A first feature enhancement unit is configured to input the multiple scale feature maps into a feature pyramid subnetwork of a feature extraction network in the initial detection model for each of the sample graphics, so as to perform semantic feature enhancement on the multiple scale feature maps through the feature pyramid subnetwork to obtain a first feature map, wherein the first feature map contains semantic information of the target; A second feature enhancement unit is used to input the multiple scale feature maps into a feature reconstruction subnet of a feature extraction network in the initial detection model for each of the sample graphics, so as to enhance the position information of the multiple scale feature maps through the feature reconstruction subnet to obtain a second feature map, wherein the second feature map contains the position information of the target; an identification unit, configured to input each of the first feature map and the second feature map into a detection head in the initial detection model to identify the category and coordinates of the target in the first feature map and the second feature map, and obtain a detection result corresponding to the sample image, wherein the detection result includes the type and coordinates of the target; A training unit is used to determine whether the loss function of the initial detection model converges, wherein when the loss function converges, the initial detection model is determined to be a target detection model, and when the loss function does not converge, the parameters of the initial detection model are adjusted, and the initial detection model is trained according to the adjusted parameters until the loss function of the initial detection model converges.
9. An electronic device, characterized in that: The electronic device comprises a processor and a memory coupled to each other, wherein the memory stores a computer program. When the computer program is executed by the processor, the electronic device executes the method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed on a computer, the computer is enabled to execute the method according to any one of claims 1 to 7.
