Optical remote sensing small ship detection method, device, system, and storage medium
By constructing an optical remote sensing small ship detection model using CSPAM and MEAM modules, the problem of low detection accuracy of small ships in complex backgrounds is solved, and efficient and accurate ship target recognition is achieved.
Patent Information
- Application Number
- CN202411771193.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2044-12-04
AI Technical Summary
Existing technologies have difficulty in accurately detecting small ships in complex backgrounds, especially the low accuracy of small ship target detection in optical remote sensing images, and traditional methods are unstable in different scenes and lighting conditions.
The CSPAM module and the MEAM module are used to construct an optical remote sensing small ship detection model. The MEAM module is used to extract and fuse local and global features. The CSPAM module is combined to perform spatial attention analysis. The QG-LOSS function is used to optimize model training to improve detection accuracy and robustness.
The accuracy and computational efficiency of small ship detection are significantly improved, the adaptability and robustness of the model in complex environments are enhanced, and the practicality and reliability of detection are improved.
Smart Images

Figure CN119762750B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image processing technology, and in particular relates to an optical remote sensing small ship detection method and device, a system, and a storage medium. Background Art
[0002] With the deepening economic complementarity and growing import and export trade worldwide, the demand for shipping is increasing. High-altitude remote sensing ship detection technology, which aims to avoid collisions and safeguard territorial sovereignty, has attracted widespread attention. Optical remote sensing images, with their large imaging area, provide rich object and background spatial information for ship detection. However, optical remote sensing images are susceptible to factors such as weather and lighting. Furthermore, ships occupy a small proportion of the image and their features are not obvious, making them difficult to detect. Therefore, research on ship target detection in optical remote sensing images has significant application value.
[0003] Small vessels (such as fishing boats and yachts) are compact, diverse, and difficult to accurately identify against complex backgrounds (such as those with waves, cloud shadows, or buoys), making them challenging for traditional detection algorithms. Furthermore, existing detection methods based on artificially designed features, such as edge detection and background subtraction, often perform poorly in diverse scenes and lighting conditions. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a method and device, a system and a storage medium for detecting small ships by optical remote sensing, so as to improve the accuracy of small ship detection.
[0005] To achieve the above object, the present invention adopts the following technical solutions:
[0006] An optical remote sensing small ship detection method comprising:
[0007] Step S1, obtaining optical remote sensing small ship dataset;
[0008] Step S2: preprocessing the optical remote sensing small ship dataset, and dividing the preprocessed optical remote sensing small ship dataset into a training set and a test set;
[0009] Step S3: constructing an optical remote sensing small ship detection model based on the preprocessed optical remote sensing small ship dataset; wherein the optical remote sensing small ship detection model includes: a CSPAM module and a MEAM module;
[0010] Step S4: training an optical remote sensing small ship detection model based on the training set;
[0011] Step S5: Input the test set into the trained optical remote sensing small ship detection model to obtain the ship type and location.
[0012] Preferably, the MEAM module is used to extract and fuse local and global features of the optical remote sensing small ship feature map in the optical remote sensing small ship dataset.
[0013] Preferably, the CSPAM module performs importance analysis on each position in the feature map through the channel attention mechanism module ECA, and fuses the channel weights generated by ECA with the spatial attention feature map.
[0014] As a preference, the QG-LOSS function is used as the loss function for training the optical remote sensing small ship detection model, and the prediction quality is included in the loss calculation.
[0015] The present invention also provides an optical remote sensing small ship detection device, comprising:
[0016] Acquisition module, used to obtain optical remote sensing small ship dataset;
[0017] A partitioning module is used to preprocess the optical remote sensing small ship dataset and partition the preprocessed optical remote sensing small ship dataset into a training set and a test set;
[0018] A construction module is used to construct an optical remote sensing small ship detection model based on the preprocessed optical remote sensing small ship dataset; wherein the optical remote sensing small ship detection model includes: a CSPAM module and a MEAM module;
[0019] A training module is used to train the optical remote sensing small ship detection model based on the training set;
[0020] The detection module is used to input the test set into the trained optical remote sensing small ship detection model to obtain the ship type and location.
[0021] An embodiment of the present invention further provides an optical remote sensing small vessel detection system, comprising: a memory and a processor, wherein the memory stores a computer program executed by the processor, and the computer program executes an optical remote sensing small vessel detection method when executed by the processor.
[0022] An embodiment of the present invention further provides a storage medium having a computer program stored thereon, wherein the computer program executes the optical remote sensing small ship detection method when running.
[0023] The present invention effectively improves the accuracy and computational efficiency of small ship detection in complex environments, enhances the adaptability and robustness when processing irregular and multi-scale features, and significantly improves the practicality and reliability of optical remote sensing small ship detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0025] Figure 1 This is a flow chart of a method for detecting small ships using optical remote sensing according to an embodiment of the present invention;
[0026] Figure 2 This is a schematic diagram of the structure of the optical remote sensing small ship detection model;
[0027] Figure 3 It is a schematic diagram of the MEAM module structure;
[0028] Figure 4 Schematic diagram of the CSPAM module structure. DETAILED DESCRIPTION
[0029] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0030] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0031] Example 1:
[0032] like Figure 1 As shown, an embodiment of the present invention provides an optical remote sensing small ship detection method, comprising:
[0033] Step S1, obtaining optical remote sensing small ship dataset;
[0034] Step S2: preprocessing the optical remote sensing small ship dataset, and dividing the preprocessed optical remote sensing small ship dataset into a training set and a test set;
[0035] Step S3: constructing an optical remote sensing small ship detection model based on the preprocessed optical remote sensing small ship dataset;
[0036] Step S4: training an optical remote sensing small ship detection model based on the training set;
[0037] Step S5: Input the test set into the trained optical remote sensing small ship detection model to obtain the ship type and location.
[0038] As an implementation method of an embodiment of the present invention, in step S1, optical remote sensing image data of small ships is collected, such as using a drone to shoot an ocean area containing small ships to obtain optical remote sensing image data of small ships, or using an existing public data set to collect optical remote sensing small ship images (hereinafter referred to as ship images), which are manually annotated by using an annotation tool to select the position of the small ship, that is, determine the coordinates of the upper left corner vertex and the lower right corner vertex of the box, and mark them with labels.
[0039] As one implementation of an embodiment of the present invention, in step S2, the ship images in the optical remote sensing small ship dataset are cropped to the same size. Generally, the optical remote sensing small ship dataset is small, and it is necessary to expand the dataset to provide sufficient samples for training, validation, and testing, enhance the robustness of the optical remote sensing small ship detection model, and reduce the model's sensitivity to images. Next, data enhancement is performed on the optical remote sensing small ship dataset to obtain a data-enhanced optical remote sensing small ship dataset, which is then divided into a training set, a validation set, and a test set in a ratio of 8:1:1.
[0040] Furthermore, data augmentation uses random pixels, Gaussian noise, salt and pepper noise, edge enhancement, and flipping to expand the original dataset. This can be implemented in Python using the cv2.randu() function in Python to insert random pixels into the ship image, the GaussianBlur() method in the ImageFilter library in the PIL library to add Gaussian noise to the ship image, the cv2.randSalt() function to add salt and pepper noise to the ship image, the cv2.Canny() function to enhance the edges of the ship image, and the cv2.flip() function to flip the ship image.
[0041] As an implementation method of the embodiment of the present invention, in step S3, Figure 2As shown in the figure, the preprocessed optical remote sensing small ship image X1 is used as the input of the optical remote sensing small ship detection model. First, X1 is input into the Conv module to obtain the optical remote sensing small ship feature map X2, where the Conv module is composed of a Conv2d layer with a convolution kernel size of 3×3 and a step size of 2, a BN layer, and a SiLU layer in series; X2 is input into the Conv module to obtain the optical remote sensing small ship feature map X3; X3 is input into the MEAM module to obtain the optical remote sensing small ship feature map X4; then the Conv module and the MEAM module are stacked three times in sequence, that is, through the Conv module, MEAM module, Conv module, MEAM module, Conv module, and MEAM module in sequence, the optical remote sensing small ship feature map X5, the optical remote sensing small ship feature map X6, the optical remote sensing small ship feature map X7, the optical remote sensing small ship feature map X8, the optical remote sensing small ship feature map X9, and the optical remote sensing small ship feature map X10 are obtained respectively. 10 ; X 10 Input to CSPAM module to obtain optical remote sensing small ship feature map X 10 '; Then X 10 'Input to the SPPF module to obtain the optical remote sensing small ship feature map X 11 ; for X 11 Perform Upsample operation to obtain optical remote sensing small ship feature map X 12 ; X8 and X 12 Perform Concat operation to obtain optical remote sensing small ship feature map X 13 ; X 13 Input into the MEAM module to obtain the optical remote sensing small ship feature map X 14 ; for X 14 Perform Upsample operation to obtain optical remote sensing small ship feature map X 15 ; X6 and X 15 Perform Concat operation to obtain optical remote sensing small ship feature map X 16 ; X 16 Input into the MEAM module to obtain the optical remote sensing small ship feature map X 17 ; X 17 Input into the Conv module to obtain the optical remote sensing small ship feature map X 18 ; X 14 and X 18 Perform Concat operation to obtain optical remote sensing small ship feature map X 19 ; X 19 Input into the MEAM module to obtain the optical remote sensing small ship feature map X 20 ; X 20Input into the Conv module to obtain the optical remote sensing small ship feature map X 21 ; X 11 and X 21 Perform Concat operation to obtain optical remote sensing small ship feature map X 22 ; X 22 Input into the MEAM module to obtain the optical remote sensing small ship feature map X 23 ; X 17 、X 20 、X 23 They are input into the target prediction head respectively, and the output is a tensor containing the prediction information. Each row corresponds to a prediction, including the bounding box coordinates, category label and confidence score.
[0042] Further, step S3 specifically includes:
[0043] Step 3.1: Input the preprocessed optical remote sensing small ship image X1 into the optical remote sensing small ship detection model. First, input X1 into the Conv module to obtain the optical remote sensing small ship feature map X2, where the Conv module is composed of a Conv2d layer with a convolution kernel size of 3×3 and a step size of 2, a BN layer, and a SiLU layer in series; input X2 into the Conv module to obtain the optical remote sensing small ship feature map X3; input X3 into the MEAM module to obtain the optical remote sensing small ship feature map X4; then stack the Conv module and the MEAM module 3 times in sequence (i.e., Conv module, MEAM module, Conv module, MEAM module, Conv module, MEAM module in series) to obtain the optical remote sensing small ship feature map X5, the optical remote sensing small ship feature map X6, the optical remote sensing small ship feature map X7, the optical remote sensing small ship feature map X8, the optical remote sensing small ship feature map X9, and the optical remote sensing small ship feature map X10 respectively. 10 ;
[0044] The MEAM module, designed in this embodiment of the present invention, extracts local and global features from input optical remote sensing small vessel feature maps and fuses these two types of features to reduce the impact of occlusion and angle variations on detection accuracy. Small vessels in remote sensing images have diverse shapes and small sizes. Multi-layer convolution operations gradually focus on these details, improving the model's detection accuracy.
[0045] The multi-scale features after convolution processing are spliced according to the channel dimension, and the channels are compressed by 1×1 convolution for subsequent processing. Subsequently, the SiLU activation function is used to make the model respond more strongly to the key features of the ship. When there is a large amount of interference noise on the sea surface (such as buoys or waves), the MEAM module can more accurately identify and enhance the feature channels related to small ships and reduce false alarms. The MEAM module uses weighted fusion to all extracted multi-scale feature maps to ensure that the model can take into account features at different levels. This mechanism can significantly improve the robustness of the model when dealing with different angles and posture changes of ships. In remote sensing images taken by drones, small boats may appear in the picture at various angles. Through the dynamic weighted fusion mechanism, the model can adapt to these angle changes to avoid detection failure due to feature loss. The MEAM module structure is as follows Figure 3 shown.
[0046] The optical remote sensing small ship feature map X3 is used as the input feature map of the MEAM module. Here, the input optical remote sensing small ship feature map is denoted as Q1, and its size is C×H×W, where C is the number of channels of the feature map, H is the height of the feature map, and W is the width of the feature map. A CPool operation is performed on Q1 to obtain an optical remote sensing small ship feature map Q2 of size C×H×W. A Conv2d operation with a convolution kernel size of 3×3 is performed on Q1 to obtain an optical remote sensing small ship feature map Q3 of size C×H×W. A Conv2d operation with a convolution kernel size of 3×3 is performed on Q3 to obtain an optical remote sensing small ship feature map Q4 of size C×H×W. A Conv2d operation with a convolution kernel size of 3×3 is performed on Q4 to obtain an optical remote sensing small ship feature map Q5 of size C×H×W. Q2, Q3, Q4, and Q5 are concatenated according to the channel dimension to obtain an optical remote sensing small ship feature map Q6 of size 4C×H×W. A Conv2d operation with a convolution kernel size of 1×1 is performed on Q6 to reduce the number of channels in Q6, resulting in an optical remote sensing small ship feature map Q7. The SiLU activation function is used to perform nonlinear enhancement on Q7 to obtain the optical remote sensing small ship feature map Q8, which is the output feature map of the MEAM module.
[0047] CPool can adaptively aggregate different feature information to improve the model's understanding of complex scenes. For example, if a boat is partially obscured, the model can still infer its location based on global information.
[0048] The average value of each row in each pooling window is calculated, and the maximum value of the result is obtained. The average value of each column in the pooling window is calculated, and the maximum value of the result is obtained. The two maximum values are weighted to obtain the value of the pixel point on the corresponding output feature map.
[0049] The calculation formula is as follows:
[0050]
[0051] Among them, k is the size of the CPool layer, a m,n is the pixel point in the mth row and nth column of the corresponding k×k pooling window in the input feature map (m=1,…,k,n=1,…,k), is the pixel point on the corresponding output feature map; the initial value of p is set to 0.5, and the final value is automatically learned during the model training process.
[0052] Step 3.2: Convert the optical remote sensing small ship feature map to X 10 After inputting into the CSPAM module, the optical remote sensing small ship feature map X is obtained. 10 ′.
[0053] This paper designs a CSPAM module to enhance the model's ability to represent features in complex remote sensing imagery. Leveraging the ECA module, the CSPAM module reduces model computational complexity while identifying and enhancing feature channels important for small vessel detection and suppressing redundant or noisy channels. At the spatial feature level, the module fuses the small vessel location details in low-order feature maps with the rich contextual semantic information in high-order feature maps, enabling the model to more accurately locate and identify small vessels.
[0054] In order to further improve the detection accuracy, the CSPAM module introduces spatial attention to analyze the importance of each position in the feature map. When dealing with complex scenes (such as when a ship is partially obscured by waves), spatial attention can help the model focus on the visible part of the ship while ignoring irrelevant noise areas. With the lightweight design of the efficient channel attention mechanism module (ECA), CSPAM greatly reduces the computational complexity. The CSPAM module fuses the channel weights generated by ECA with the spatial attention feature map, enabling the model to accurately perceive important information at different levels. The overall structure of CSPAM is as follows: Figure 4 shown.
[0055] Optical remote sensing small ship feature map X 10 As the input feature map of CSPAM. For the convenience of description, X 10Denoted as F1, its size is C×H×W, where C is the number of channels in the feature map, H is the height of the feature map, and W is the width of the feature map. A Conv2d operation with a kernel size of 3×3 is performed on F1 to obtain an optical remote sensing small ship feature map F2 of size C×H×W. Global average pooling and global max pooling are performed on F2, respectively, to obtain optical remote sensing small ship feature maps F3 and F4 of size C×1×1, respectively. Next, element-wise addition is performed on the optical remote sensing small ship feature maps F3 and F4 to obtain an optical remote sensing small ship feature map F5 of size C×1×1. F5 is then subjected to a Sigmoid activation function to obtain the feature weight W. Element-wise multiplication of F1 and W is performed to obtain an optical remote sensing small ship feature map F6 of size C×H×W. Multiply F2 by the feature weight W element by element to obtain the optical remote sensing small ship feature map F7, whose size is C×H×W. Input F1 into the ECA module to obtain the optical remote sensing small ship feature map F8, whose size is C×H×W. Add the optical remote sensing small ship feature maps F6, F7 and F8 element by element to obtain the optical remote sensing small ship feature map F9 of size C×H×W. After the optical remote sensing small ship feature map F9 is subjected to the Conv2d operation with a convolution kernel size of 3×3, the optical remote sensing small ship feature map F is obtained with a size of C×H×W. 10 , F 10 This is the feature map output by the CSPAM module. ECA is an existing module that does not use fully connected layers and only captures local channel relationships through one-dimensional convolution. It has low computational cost and excellent performance, making it suitable for embedding in lightweight models and applicable to the scenarios used in this invention.
[0056] Step 3.3: Then use the optical remote sensing small ship feature map X 10 'Input into the SPPF module to obtain the optical remote sensing small ship feature map X 11 ; for X 11 Perform Upsample operation to obtain optical remote sensing small ship feature map X 12 ; Optical remote sensing small ship feature map X8 and optical remote sensing small ship feature map X 12 Perform Concat operation to obtain optical remote sensing small ship feature map X 13 ; X 13 Input into the MEAM module to obtain the optical remote sensing small ship feature map X 14 ; for X 14 Perform Upsample operation to obtain optical remote sensing small ship feature map X 15 ; X6 and X15 Perform Concat operation to obtain optical remote sensing small ship feature map X 16 ; X 16 Input into the MEAM module to obtain the optical remote sensing small ship feature map X 17 ; X 17 Input into the Conv module to obtain the optical remote sensing small ship feature map X 18 ; X 14 and X 18 Perform Concat operation to obtain optical remote sensing small ship feature map X 19 ; X 19 Input into the MEAM module to obtain the optical remote sensing small ship feature map X 20 ; X 20 Input into the Conv module to obtain the optical remote sensing small ship feature map X 21 ; Optical remote sensing small ship feature map X 11 and optical remote sensing small ship characteristic map X 21 Perform Concat operation to obtain optical remote sensing small ship feature map X 22 ; Optical remote sensing small ship feature map X 22 Input into the MEAM module to obtain the optical remote sensing small ship feature map X 23 .
[0057] Step 3.4: X 17 、X 20 、X 23 They are input into the target prediction head respectively, and the output is a tensor containing the prediction information. Each row corresponds to a prediction, including the bounding box coordinates, category label and confidence score.
[0058] The head is responsible for predicting the object's category, location (including bounding box coordinates), and presence confidence directly from the feature map. The output of the detection head is a three-dimensional tensor, where each row contains the category probability, bounding box coordinates, and object presence confidence for each predicted box at each spatial location (relative to the feature map).
[0059] (1) Bounding box prediction: Each cell is responsible for predicting the coordinates and confidence of several bounding boxes. The coordinates of the bounding box include: ① the center point (x, y), which is the position relative to the feature map cell; ② the width and height (w, h), which are scaled relative to the width and height of the entire image; these coordinates are input to the sigmoid function to ensure that the output value is between 0 and 1, which allows for more stable training.
[0060] (2) Category and confidence prediction: In addition to coordinate predictions, each bounding box also has a confidence prediction, which is used to indicate the probability that an object of a specific category exists within the box.
[0061] During training, the optical remote sensing small ship detection model uses the QG-LOSS loss function to simultaneously optimize the position, size, confidence, and accuracy of the bounding box prediction. This loss function helps the optical remote sensing small ship detection model balance multiple aspects to achieve the best overall performance.
[0062] The present invention designs the QG-LOSS function as the loss function for training the optical remote sensing small ship detection model, incorporates the prediction quality into the loss calculation, and avoids the imbalance of the model when processing samples with higher uncertainty (such as complex situations such as blurred boundaries and occlusions). QG-Loss not only improves the adaptability of the model to difficult-to-classify samples, but also optimizes the accuracy of small target detection and complex backgrounds. For unbalanced data sets (such as the number of samples in a certain class is far less than that of other classes), QG-Loss can dynamically adjust the loss to avoid the model focusing only on easy-to-classify samples and ignoring difficult-to-classify samples. Among them, difficult-to-classify samples refer to samples with complex backgrounds, small targets, low resolution or more occlusions, unbalanced data sets refer to data sets in which the number of samples in a certain class is far less than that of other classes, and easy-to-classify samples refer to samples with obvious and clear features and easy to distinguish in image classification or target detection tasks.
[0063] Loss function L QG-LOSS By L Q-loss and geometric loss L g Its function expression is as follows:
[0064] L QG-LOSS =L Q-loss +λ g L g
[0065] Among them, λ g is the loss weight.
[0066] L Q-loss The function expression is as follows:
[0067]
[0068] Among them, B and B gt Represent the predicted box and the real box respectively; b and b gt Represents the center point of the predicted box and the true box respectively; ρ(·) represents the Euclidean distance between the two points; w c and h c Represents the width and height of the minimum bounding box composed of the predicted box and the real box respectively; c represents the diagonal of the minimum bounding box; w gtand h gt Represents the width and height of the real box respectively; w p and h p Represent the width and height of the prediction box respectively.
[0069] Geometric loss L g The function expression is as follows:
[0070]
[0071] in, It is the weight of the angle loss and penalty term between the predicted box and the true box. is the angle between the predicted box and the true box.
[0072] QG-LOSS can provide a moving direction for the detection box when it does not overlap with the ground-truth box. When the detection box overlaps with the ground-truth box, QG-LOSS optimizes the distance and angle between the detection box and the ground-truth box through a penalty term to provide the optimal detection box loss.
[0073] In the experiment of the embodiment of the present invention, the size of the feature map is set to H×W×C, where H is the height of the feature map, W is the width of the feature map, and C is the number of channels of the feature map. The preprocessed optical remote sensing small ship image X1 (size 512×512×3) is used as the input of the optical remote sensing small ship detection model. First, X1 is input into the Conv module to obtain an optical remote sensing small ship feature map X2 (size 256×256×64) with 64 channels, wherein the Conv module is sequentially composed of a Conv2d layer with a convolution kernel size of 3×3 and a step size of 2, a BN layer, and a SiLU layer in series; X2 is input into the Conv module to obtain an optical remote sensing small ship feature map X3 with 128 channels, size 128×128×128; X3 is input into the MEAM module to obtain an optical remote sensing small ship feature map X4 with 256 channels, size 128×128×256; and then the Conv modules and The MEAM module is passed through the Conv module, MEAM module, Conv module, MEAM module, Conv module, and MEAM module three times, and the optical remote sensing small ship feature map X5 with a size of 64×64×512, the optical remote sensing small ship feature map X6 with a size of 64×64×512, the optical remote sensing small ship feature map X7 with a size of 32×32×512, the optical remote sensing small ship feature map X8 with a size of 32×32×512, the optical remote sensing small ship feature map X9 with a size of 16×16×512, and the optical remote sensing small ship feature map X10 with a size of 16×16×512 are obtained respectively. 10 ; X 10 After inputting into the CSPAM module, the optical remote sensing small ship feature map X with a size of 16×16×512 is obtained.10 '; Then X 10 'Input into the SPPF module to obtain the optical remote sensing small ship feature map X with a size of 16×16×512 11 ; for X 11 Perform Upsample operation to obtain the optical remote sensing small ship feature map X with a size of 32×32×512 12 ; X8 and X 12 Perform the Concat operation to obtain the optical remote sensing small ship feature map X with a size of 32×32×1024. 13 ; X 13 Input into the MEAM module to obtain the optical remote sensing small ship feature map X with a size of 32×32×512 14 ; for X 14 Perform Upsample operation to obtain the optical remote sensing small ship feature map X with a size of 64×64×512 15 ; X6 and X 15 Perform the Concat operation to obtain the optical remote sensing small ship feature map X with a size of 64×64×1024. 16 ; X 16 Input into the MEAM module to obtain the optical remote sensing small ship feature map X with a size of 64×64×256 17 ; X 17 Input into the Conv module to obtain the optical remote sensing small ship feature map X with a size of 32×32×256 18 ; X 14 and X 18 Perform the Concat operation to obtain the optical remote sensing small ship feature map X with a size of 32×32×768 19 ; X 19 Input into the MEAM module to obtain the optical remote sensing small ship feature map X with a size of 32×32×512 20 ; X 20 Input into the Conv module to obtain the optical remote sensing small ship feature map X with a size of 16×16×512 21 ; X 11 and X 21 Perform the Concat operation to obtain the optical remote sensing small ship feature map X with a size of 16×16×1024. 22 ; X 22 Input into the MEAM module to obtain the optical remote sensing small ship feature map X with a size of 16×16×512 23 ; X 17 、X 20 、X 23They are input into the target prediction head respectively, and the output is a tensor containing the prediction information. Each row corresponds to a prediction, including the bounding box coordinates, category label and confidence score.
[0074] As an implementation of an embodiment of the present invention, step S4 is specifically as follows:
[0075] First, initialize all neural network parameters and set the hyperparameters related to the optical remote sensing small ship detection model. The hyperparameters set include but are not limited to the number of training rounds, batch size, optimizer selection, learning rate, weight initialization method, Dropout ratio, etc.
[0076] After initializing the parameters, the training and validation data sets are divided into multiple batches. Each batch of training data is fed into the optical remote sensing small vessel detection model for training, generating the training loss for that batch. After completing a round of training on all batches of the training set, the validation data set is fed into the optical remote sensing small vessel detection model, batch by batch, generating the corresponding batch loss, batch_loss. The validation loss is used to monitor overfitting in the optical remote sensing small vessel detection model and adjust the training strategy, such as terminating training early or adjusting the learning rate. During training and validation, the optical remote sensing small vessel detection model automatically learns and adjusts parameters based on the loss and batch_loss values. Training for the optical remote sensing small vessel detection model concludes when the batch_loss value converges after one or more rounds of training.
[0077] This embodiment of the present invention proposes feature extraction of both local and global features. The MEAM module extracts both local and global features from the input optical remote sensing small vessel feature map, and then fuses these features to mitigate the effects of occlusion and angle variations that reduce detection accuracy. Small vessels in remote sensing images have diverse shapes and small sizes. Multi-layer convolution operations gradually focus on these details, improving the model's detection accuracy.
[0078] This embodiment of the present invention effectively reduces the number of parameters in the optical remote sensing small vessel detection model. Using CSPAM, it identifies and enhances feature channels crucial for small vessel detection while suppressing redundant or noisy channels. At the spatial feature level, this module fuses the small vessel location details in low-order feature maps with the rich contextual semantic information in high-order feature maps, enabling the model to more accurately locate and identify small vessels.
[0079] The embodiment of the present invention adopts the QG-LOSS function as the loss function for training the optical remote sensing small ship detection model, and incorporates the prediction quality into the loss calculation to avoid imbalance in the performance of the model when processing samples with high uncertainty (such as complex situations such as blurred boundaries and occlusion). QG-Loss not only improves the adaptability of the model to difficult-to-classify samples, but also optimizes the accuracy of small target detection and complex backgrounds. For unbalanced data sets (such as the number of samples in one class is far less than that of other classes), QG-Loss can dynamically adjust the loss to avoid the model focusing only on easy-to-classify samples and ignoring difficult-to-classify samples.
[0080] Example 2:
[0081] An embodiment of the present invention further provides an optical remote sensing small ship detection device, comprising:
[0082] Acquisition module, used to obtain optical remote sensing small ship dataset;
[0083] A partitioning module is used to preprocess the optical remote sensing small ship dataset and partition the preprocessed optical remote sensing small ship dataset into a training set and a test set;
[0084] A construction module is used to construct an optical remote sensing small ship detection model based on the preprocessed optical remote sensing small ship dataset; wherein the optical remote sensing small ship detection model includes: a CSPAM module and a MEAM module;
[0085] A training module is used to train the optical remote sensing small ship detection model based on the training set;
[0086] The detection module is used to input the test set into the trained optical remote sensing small ship detection model to obtain the ship type and location.
[0087] Example 3:
[0088] An embodiment of the present invention further provides an optical remote sensing small vessel detection system, comprising: a memory and a processor, wherein the memory stores a computer program executed by the processor, and the computer program executes an optical remote sensing small vessel detection method when executed by the processor.
[0089] Example 4:
[0090] An embodiment of the present invention further provides a storage medium having a computer program stored thereon, wherein the computer program executes the optical remote sensing small ship detection method when running.
[0091] The embodiments described above are merely descriptions of preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by persons skilled in the art should fall within the scope of protection defined by the claims of the present invention.
Claims
1. An optical remote sensing small ship detection method, characterized in that: include: Step S1, obtaining optical remote sensing small ship dataset; Step S2: preprocessing the optical remote sensing small ship dataset, and dividing the preprocessed optical remote sensing small ship dataset into a training set and a test set; Step S3: constructing an optical remote sensing small ship detection model based on the preprocessed optical remote sensing small ship dataset; wherein the optical remote sensing small ship detection model includes: a CSPAM module and a MEAM module; Step S4: training an optical remote sensing small ship detection model based on the training set; Step S5: input the test set into the trained optical remote sensing small ship detection model to obtain the ship type and location; The MEAM module is used to extract and fuse local and global features of the optical remote sensing small ship feature map in the optical remote sensing small ship dataset; The CSPAM module uses the channel attention mechanism module ECA to analyze the importance of each position in the feature map, and fuses the channel weights generated by ECA with the spatial attention feature map; The QG-LOSS function is used as the loss function for training the optical remote sensing small ship detection model, and the prediction quality is included in the loss calculation; In step S3, the preprocessed optical remote sensing small ship image X1 is used as the input of the optical remote sensing small ship detection model; first, X1 is input into the Conv module to obtain the optical remote sensing small ship feature map X2, wherein the Conv module is sequentially composed of a Conv2d layer with a convolution kernel size of 3×3 and a step size of 2, a BN layer, and a SiLU layer in series; X2 is input into the Conv module to obtain the optical remote sensing small ship feature map X3; X3 is input into the MEAM module to obtain the optical remote sensing small ship feature map X4; and then the Conv module and the MEAM module are stacked three times in sequence, that is, through the Conv module, MEAM module, Conv module, MEAM module, Conv module, and MEAM module in sequence, the optical remote sensing small ship feature map X5, the optical remote sensing small ship feature map X6, the optical remote sensing small ship feature map X7, the optical remote sensing small ship feature map X8, the optical remote sensing small ship feature map X9, and the optical remote sensing small ship feature map X10 are obtained respectively. 10 ; X 10 Input to CSPAM module to obtain optical remote sensing small ship feature map X 10 '; Then X 10 'Input to the SPPF module to obtain the optical remote sensing small ship feature map X 11 ; for X 11 Perform Upsample operation to obtain optical remote sensing small ship feature map X 12 ; X8 and X 12 Perform Concat operation to obtain optical remote sensing small ship feature map X 13 ; X 13 Input into the MEAM module to obtain the optical remote sensing small ship feature map X 14 ; for X 14 Perform Upsample operation to obtain optical remote sensing small ship feature map X 15 ; X6 and X 15 Perform Concat operation to obtain optical remote sensing small ship feature map X 16 ; X 16 Input into the MEAM module to obtain the optical remote sensing small ship feature map X 17 ; X 17 Input into the Conv module to obtain the optical remote sensing small ship feature map X 18 ; X 14 and X 18 Perform Concat operation to obtain optical remote sensing small ship feature map X 19 ; X 19 Input into the MEAM module to obtain the optical remote sensing small ship feature map X 20 ; X 20 Input into the Conv module to obtain the optical remote sensing small ship feature map X 21 ; X 11 and X 21 Perform Concat operation to obtain optical remote sensing small ship feature map X 22 ; X 22 Input into the MEAM module to obtain the optical remote sensing small ship feature map X 23 ; X 17 、X 20 、X 23 They are input into the target prediction head respectively, and the output is a tensor containing the prediction information. Each row corresponds to a prediction, including the bounding box coordinates, category label and confidence score. In the MEAM module, the optical remote sensing small ship feature map X3 is used as the input feature map of the MEAM module. Here, the input optical remote sensing small ship feature map is denoted as Q1, and its size is C×H×W, where C is the number of channels of the feature map, H is the height of the feature map, and W is the width of the feature map; a CPool operation is performed on Q1 to obtain an optical remote sensing small ship feature map Q2 with a size of C×H×W; a Conv2d operation with a convolution kernel size of 3×3 is performed on Q1 to obtain an optical remote sensing small ship feature map Q3 with a size of C×H×W; a Conv2d operation with a convolution kernel size of 3×3 is performed on Q3 to obtain a C×H×W optical remote sensing small ship feature map Q3. ×W optical remote sensing small ship feature map Q4; perform a Conv2d operation with a convolution kernel size of 3×3 on Q4 to obtain an optical remote sensing small ship feature map Q5 with a size of C×H×W; concatenate Q2, Q3, Q4 and Q5 according to the channel dimension to obtain an optical remote sensing small ship feature map Q6 with a size of 4C×H×W; perform a Conv2d operation with a convolution kernel size of 1×1 on Q6 to reduce the number of channels of Q6 to obtain an optical remote sensing small ship feature map Q7; use the SiLU activation function to perform nonlinear enhancement on Q7 to obtain the optical remote sensing small ship feature map Q8, which is the output feature map of the MEAM module; The CPool operation is as follows: average each row in each pooling window, and then maximize the results. Also average each column in the pooling window, and then maximize the results. These two maximum values are weighted to obtain the value of the pixel on the corresponding output feature map. The calculation formula is as follows: Where X is the size of the CPool layer, a m,n is the pixel point in the mth row and nth column of the corresponding k×k pooling window in the input feature map (m=1,…,k,n=1,…,k), is the pixel point on the corresponding output feature map; the initial value of p is set to 0.5, and the final value is automatically learned during the model training process; Loss function L of optical remote sensing small ship detection model QG-LOSS By L Q-loss and geometric loss L g Its function expression is as follows: L QG-LOSS =L Q-loss +λ g L g Among them, λ g is the loss weight; L Q-loss The function expression is as follows: Among them, B and B gt Represent the predicted box and the real box respectively; b and b gt Represents the center point of the predicted box and the true box respectively; ρ(·) represents the Euclidean distance between the two points; w c and h c Represents the width and height of the minimum bounding box composed of the predicted box and the real box respectively; c represents the diagonal of the minimum bounding box; w gt and h gt Represents the width and height of the real box respectively; w p and h p Represent the width and height of the prediction box respectively; Geometric loss L g The function expression is as follows: in, is the weight of the angle loss and penalty term between the predicted box and the real box, is the angle between the predicted box and the true box.
2. An optical remote sensing small vessel detection device for implementing the optical remote sensing small vessel detection method according to claim 1, characterized in that: include: Acquisition module, used to obtain optical remote sensing small ship dataset; A partitioning module is used to preprocess the optical remote sensing small ship dataset and partition the preprocessed optical remote sensing small ship dataset into a training set and a test set; A construction module is used to construct an optical remote sensing small ship detection model based on the preprocessed optical remote sensing small ship dataset; wherein the optical remote sensing small ship detection model includes: a CSPAM module and a MEAM module; A training module is used to train the optical remote sensing small ship detection model based on the training set; The detection module is used to input the test set into the trained optical remote sensing small ship detection model to obtain the ship type and location.
3. An optical remote sensing small ship detection system, characterized in that: include: A memory and a processor, wherein the memory stores a computer program to be run by the processor, and when the computer program is run by the processor, the optical remote sensing small ship detection method according to claim 1 is executed.
4. A storage medium, characterized in that The storage medium stores a computer program, which executes the optical remote sensing small ship detection method according to claim 1 when running.
Citation Information
Patent Citations
Ship identification model establishment method and device, ship identification method and device and electronic equipment
CN118365951A