Optical remote sensing small ship detection method, device and system, and storage medium
By using CSPAM and MEAM modules in optical remote sensing images for feature extraction and fusion, and using the QG-LOSS loss function optimization model, the problem of difficulty in detecting small and medium-sized ships in optical remote sensing images is solved, and high-precision and efficient detection effects are achieved.
Patent Information
- Application Number
- CN202411771193.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-04
AI Technical Summary
It is difficult to detect small and medium-sized ships in optical remote sensing images. They are affected by weather, light and other factors. The ship's targets account for a small proportion and the characteristics are not obvious, resulting in low detection accuracy.
An optical remote sensing small ship detection method is adopted, including data preprocessing, model construction and training, feature extraction and fusion is used using CSPAM module and MEAM module, and the QG-LOSS loss function is used to optimize the model.
It effectively improves the accuracy and computing efficiency of small ship detection, enhances the adaptability and robustness of the model to irregular and multi-scale features, and significantly improves the practicality and reliability of the detection.
Smart Images

Figure CN119762750A_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 deep complementarity of economies around the world and the growth of import and export trade, the demand for ship transportation is increasing day by day. High-altitude remote sensing ship detection technology to avoid ship collisions and maintain territorial sovereignty has attracted widespread attention. Optical remote sensing images, with the advantage of large imaging area, provide rich object information and background space information for ship detection. However, optical remote sensing imaging is easily affected by factors such as weather and lighting. At the same time, the proportion of ships in the image is small and the features are not obvious, making it difficult to detect. Therefore, the research on ship target detection in optical remote sensing images has great application value.
[0003] Small vessels (such as fishing boats and yachts) are small in size, diverse in shape, and difficult to accurately identify in complex backgrounds (such as the presence of waves, cloud shadows or buoys), making traditional detection algorithms face great difficulties. In addition, the detection methods commonly used in the prior art based on artificially designed features, such as edge detection and background subtraction, are unstable when facing different 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 detecting small ships.
[0005] To achieve the above object, the present invention adopts the following technical solution:
[0006] An optical remote sensing small ship detection method, comprising:
[0007] Step S1, obtaining optical remote sensing small ship data set;
[0008] Step S2, preprocessing the optical remote sensing small ship data set, and dividing the preprocessed optical remote sensing small ship data set to obtain a training set and a test set;
[0009] Step S3, constructing an optical remote sensing small ship detection model according to the preprocessed optical remote sensing small ship data set; 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 according to 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 acquire 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 to obtain 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 data set; wherein the optical remote sensing small ship detection model includes: a CSPAM module and a MEAM module;
[0019] A training module, used to train an optical remote sensing small ship detection model based on a 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 ship 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 ship detection method when executed by the processor.
[0022] An embodiment of the present invention further provides a storage medium, on which a computer program is stored, and when the computer program is run, the optical remote sensing small ship detection method is executed.
[0023] The present invention effectively improves the accuracy and computational efficiency of small ship detection in complex environments, and also enhances the adaptability and robustness when processing irregular and multi-scale features, significantly improving 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 drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying 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 This is a schematic diagram of the CSPAM module structure. DETAILED DESCRIPTION
[0029] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. 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 creative work 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] Embodiment 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 data set;
[0034] Step S2, preprocessing the optical remote sensing small ship data set, and dividing the preprocessed optical remote sensing small ship data set to obtain a training set and a test set;
[0035] Step S3, constructing an optical remote sensing small ship detection model according to the preprocessed optical remote sensing small ship data set;
[0036] Step S4, training an optical remote sensing small ship detection model according to 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 mode 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 photograph 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 labeled and the position of the small ship is framed using a labeling tool, that is, the coordinates of the upper left corner vertex and the lower right corner vertex of the frame are determined, and labels are marked.
[0039] As an 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. In general, the optical remote sensing small ship dataset is small, and the size of the dataset needs to be expanded so that it has enough samples for training, verification and testing, and the robustness of the optical remote sensing small ship detection model is enhanced, and the model's sensitivity to images is reduced; then, the optical remote sensing small ship dataset is data enhanced to obtain the optical remote sensing small ship dataset after data enhancement, and the above dataset is divided into a training set, a verification set and a test set in a ratio of 8:1:1.
[0040] Furthermore, data enhancement uses random pixels, Gaussian noise, salt and pepper noise, edge enhancement, flipping, etc. to expand the original data set. This can be implemented in Python, using the cv2.randu() function in Python to insert random pixels into the ship image, using the GaussianBlur() method in the ImageFilter library in the PIL library to add Gaussian noise to the ship image, using the cv2.randSalt() function to add salt and pepper noise to the ship image, using the cv2.Canny() function to enhance the edge of the ship image, and using the cv2.flip() function to flip the ship image.
[0041] As an implementation 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; 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 the optical remote sensing small ship feature map X 12 ; X8 and X 12 Perform Concat operation to obtain the 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 the optical remote sensing small ship feature map X 15 ; X6 and X 15 Perform Concat operation to obtain the 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 the 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 the 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), and 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 embodiment of the present invention designs a MEAM module for extracting local features and global features from the input optical remote sensing small ship feature map, and fuses these two types of features to reduce the impact of occlusion and angle changes on detection accuracy. In remote sensing images, small ships have variable shapes and small sizes. Through multi-layer convolution operations, these detailed information can be gradually focused on, improving the detection accuracy of the model.
[0045] The multi-scale features after convolution processing are spliced according to the channel dimension, and the channels are compressed through 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 weightedly fuses 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 and avoid detection failures due to feature loss. The structure of the MEAM module 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. Perform CPool operation on Q1 to obtain the optical remote sensing small ship feature map Q2 of size C×H×W; perform Conv2d operation with convolution kernel size of 3×3 on Q1 to obtain the optical remote sensing small ship feature map Q3 of size C×H×W; perform Conv2d operation with convolution kernel size of 3×3 on Q3 to obtain the optical remote sensing small ship feature map Q4 of size C×H×W; perform Conv2d operation with convolution kernel size of 3×3 on Q4 to obtain the optical remote sensing small ship feature map Q5 of size C×H×W; Q2, Q3, Q4 and Q5 are spliced according to the channel dimension to obtain the optical remote sensing small ship feature map Q6 of size 4C×H×W. Perform Conv2d operation with convolution kernel size of 1×1 on Q6 to reduce the number of channels of Q6 to obtain the 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 ability to understand complex scenes. If part of the boat is blocked, 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 value results 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] Where 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: Transform the optical remote sensing small ship feature map X 10 After input into the CSPAM module, the optical remote sensing small ship feature map X is obtained. 10 ′.
[0053] The present invention designs a CSPAM module to improve the model's ability to express features in complex remote sensing images. The CSPAM module uses the ECA module to reduce the model's computational complexity, while being able to identify and strengthen feature channels important for small ship detection and suppress redundant or noisy channels. At the spatial feature level, the module fuses the small ship location details in the low-order feature map with the rich contextual semantic information in the high-order feature map, allowing the model to more accurately locate and identify small ships.
[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 a ship partially obscured by waves), spatial attention can help the model focus on the visible part of the ship and ignore 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, allowing 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 of the feature map, H is the height of the feature map, and W is the width of the feature map. Perform the Conv2d operation with a convolution kernel size of 3×3 on F1 to obtain the optical remote sensing small ship feature map F2 of size C×H×W. Perform the Global Average Pooling operation and the Global Max Pooling operation on F2 to obtain the optical remote sensing small ship feature map F3 of size C×1×1 and the optical remote sensing small ship feature map F4 of size C×1×1 respectively. Then, the optical remote sensing small ship feature maps F3 and F4 are added element by element to obtain the optical remote sensing small ship feature map F5 of size C×1×1. F5 is calculated through a layer of Sigmoid activation function to obtain the feature weight W. F1 and W are multiplied element by element to obtain the 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 It is the feature map finally output by the CSPAM module. Among them, ECA is an existing module. ECA does not use a fully connected layer and only captures local channel relationships through one-dimensional convolution. It has low computational cost and excellent performance, is suitable for embedding in lightweight models, and is suitable for the scenarios applied by the present 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 the 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 the 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 the optical remote sensing small ship feature map X 15 ; X6 and X15 Perform Concat operation to obtain the 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 the 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 feature map X 21 Perform Concat operation to obtain the 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 the coordinates of the bounding box), and confidence of existence 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 confidence of the object's existence 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; the above coordinates are input into the sigmoid function to ensure that the output value is between 0 and 1, so that training can be more stable.
[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 the training process, 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 category prediction of the bounding box. This loss function helps the optical remote sensing small ship detection model to make trade-offs in 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 high 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 only focusing 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 the geometric loss L g The 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 true box respectively; b and b gt Represent the center points of the predicted box and the real box respectively; ρ(·) represents the Euclidean distance between the two points; w c and h c Respectively represent the width and height of the minimum bounding box composed of the predicted box and the true box; c represents the diagonal of the minimum bounding box; w gtand h gt Respectively represent the width and height of the real box; 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 the detection box does not overlap with the real box. When the detection box overlaps with the real box, QG-LOSS optimizes the distance and angle between the detection box and the real box through the penalty term to give the optimal detection box loss.
[0073] In the experiment of the embodiment of the present invention, the size of the feature map is assumed to be 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 is 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 is 256×256×64) with 64 channels, wherein the Conv module is sequentially composed of a Conv2d layer, a BN layer, and a SiLU layer with a convolution kernel size of 3×3 and a step size of 2 in series; X2 is input into the Conv module to obtain an optical remote sensing small ship feature map X3 with 128 channels and a size of 128×128×128; X3 is input into the MEAM module to obtain an optical remote sensing small ship feature map X4 with 256 channels and a size of 128×128×256; and then the Conv modules and are stacked in sequence. 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 input into the CSPAM module, an 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 the embodiment of the present invention, step S4 is specifically:
[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 training rounds, batch size, optimizer selection, learning rate, weight initialization method, Dropout ratio, etc.
[0076] After initializing the parameters, the training set and validation set data are divided into multiple batches. Each time, a batch of training set data is input into the optical remote sensing small ship detection model for training to obtain the training loss value loss of the batch. After a round of training for all batches of data in the entire training set is completed, the validation set is input into the optical remote sensing small ship detection model in batches to obtain the corresponding batch loss value batch_loss. The loss value of the validation set is mainly used to monitor whether the optical remote sensing small ship detection model is overfitting and to adjust the training strategy, such as terminating the training early or adjusting the learning rate. During training and verification, the optical remote sensing small ship detection model will automatically learn and adjust parameters according to each loss and batch_loss situation. When the training process has been carried out for one or more rounds until the batch_loss value converges, the training of the optical remote sensing small ship detection model is completed.
[0077] The embodiment of the present invention proposes feature extraction of local and global features, extracts local and global features from the input optical remote sensing small ship feature map through the MEAM module, and then fuses the local and global features to reduce the impact of reduced detection accuracy caused by occlusion and angle changes. In remote sensing images, small ships have variable shapes and small sizes. Through multi-layer convolution operations, these detailed information can be gradually focused on, improving the detection accuracy of the model.
[0078] The embodiment of the present invention effectively reduces the number of parameters of the optical remote sensing small ship detection model, and can identify and strengthen the feature channels that are important for small ship detection through CSPAM, while suppressing redundant or noisy channels. At the spatial feature level, the module fuses the small ship location details in the low-order feature map with the rich contextual semantic information in the high-order feature map, so that the model can more accurately locate and identify small ships.
[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 the imbalance of the model when processing samples with high 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 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] Embodiment 2:
[0081] The embodiment of the present invention further provides an optical remote sensing small ship detection device, comprising:
[0082] Acquisition module, used to acquire 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 to obtain 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 data set; wherein the optical remote sensing small ship detection model includes: a CSPAM module and a MEAM module;
[0085] A training module, used to train an optical remote sensing small ship detection model based on a 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] Embodiment 3:
[0088] An embodiment of the present invention further provides an optical remote sensing small ship 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 ship detection method when executed by the processor.
[0089] Embodiment 4:
[0090] An embodiment of the present invention further provides a storage medium, on which a computer program is stored, and when the computer program is run, the optical remote sensing small ship detection method is executed.
[0091] The embodiments described above are only descriptions of the preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should all fall within the protection scope determined 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 data set; Step S2, preprocessing the optical remote sensing small ship data set, and dividing the preprocessed optical remote sensing small ship data set to obtain a training set and a test set; Step S3, constructing an optical remote sensing small ship detection model according to the preprocessed optical remote sensing small ship data set; 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 according to 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.
2. The optical remote sensing small ship detection method according to claim 1, characterized in that: 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.
3. The optical remote sensing small ship detection method according to claim 2, characterized in that: 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.
4. The optical remote sensing small ship detection method according to claim 3, characterized in that: 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.
5. An optical remote sensing small ship detection device, characterized in that: include: Acquisition module, used to acquire 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 to obtain 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 data set; wherein the optical remote sensing small ship detection model includes: a CSPAM module and a MEAM module; A training module, used to train an optical remote sensing small ship detection model based on a 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.
6. An optical remote sensing small ship detection system, characterized in that: include: A memory and a processor, wherein the memory stores a computer program executed by the processor, and when the computer program is executed by the processor, the optical remote sensing small ship detection method according to any one of claims 1 to 4 is executed.
7. 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 any one of claims 1 to 4 when running.
Citation Information
Patent Citations
Visible light remote sensing image ship target detection method
CN116109942A
Risk monitoring method, device, equipment, medium and program product
CN117151420A
Light-weight remote sensing image military tank target detection algorithm based on MSG-YOLOv7
CN117853929A
Satellite image ship rapid detection method based on large kernel selective attention mechanism
CN118196652A
Ocean remote sensing ship image retrieval method based on self-attention hashing
CN118312636A