A space target detection method based on an improved YOLOX network model
By improving the YOLOX network model and combining data augmentation and iterative optimization, the problems of low detection rate and poor generalization ability of traditional space target detection methods in complex environments are solved, and high-precision and real-time space target detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- XIAN INST OF OPTICS & PRECISION MECHANICS CHINESE ACAD OF SCI
- Filing Date
- 2022-07-20
- Publication Date
- 2026-05-19
AI Technical Summary
Traditional space target detection methods have low detection rates and poor generalization ability in extremely complex space environments. They cannot effectively identify targets of different sizes, and complex backgrounds can easily lead to misjudgments.
An improved YOLOX network model is adopted, including a backbone feature extraction module (Backbone network), an enhanced feature extraction module (Dilated Encoder network), and a decoupled output module (YoloHead network). Through data augmentation and iterative optimization of training weights, the detection accuracy and speed are improved.
It achieves high-precision, real-time target detection in complex spatial environments, outperforming YOLO v3, YOLO v4, and YOLO v5 networks, and can effectively identify and classify spatial targets.
Smart Images

Figure CN115471670B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to an image detection method, specifically to a spatial target detection method based on an improved YOLOX network model. Background Technology
[0002] With the continuous development and competition in space-related technologies, space target detection has intersected with many other important fields and has become an important foundation of aerospace technology, possessing significant research value.
[0003] For spatial object detection, traditional detection algorithms mainly rely on features such as lines, polygons, and ellipses to extract features from selected regions and then determine the type of object based on these features. However, traditional methods have high algorithmic complexity, low detection rates in extremely complex spatial environments, and poor generalization ability. Therefore, research on fast real-time algorithms with high accuracy and high reliability has become a hot topic.
[0004] In recent years, with the rapid development of computer technology and image processing technology, convolutional neural networks (CNNs) have made great progress in the field of object detection. Compared with traditional recognition methods, CNNs have a stronger ability to represent the features of objects. From a conceptual perspective, object detection algorithms can be divided into two-stage and one-stage detection algorithms. Two-stage detection algorithms are based on candidate regions, and then classify the selected regions, such as Faster R-CNN, Mask R-CNN, and R-FCN. These algorithms have high detection accuracy, but their detection speed is still unsatisfactory. One-stage detection algorithms can directly locate the target and output the target's category detection information, such as SSD, YOLOv3, YOLOv4, and YOLOv5. These algorithms only require one detection to obtain the target location, improving detection speed and meeting the accuracy requirements. However, many object detection tasks suffer from the following problems: 1. Targets of different sizes cannot be effectively detected and recognized; 2. Complex backgrounds easily lead to misjudgments. With the continuous development of artificial intelligence technology, deep learning methods have begun to penetrate various fields, thus urgently requiring intelligent monitoring of the spatial environment. Summary of the Invention
[0005] The purpose of this invention is to address the technical problems of low detection rate and poor generalization ability of traditional space target detection methods in extremely complex space environments, and to provide a space target detection method based on an improved YOLOX network model, which improves the detection accuracy of space targets. Experiments show that the model can perform target detection more accurately and quickly.
[0006] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:
[0007] A spatial target detection method based on an improved YOLOX network model, characterized by the following steps:
[0008] Step S1: Obtain a spatial object detection dataset with annotations and labels, and divide the spatial object detection dataset into a training set, a validation set, and a test set;
[0009] Step S2: Construct the YOLOX network model, which includes the Backbone network (a core feature extraction module), the Dilated Encoder network (an enhanced feature extraction module), and the YoloHead network (a decoupled output module).
[0010] Step S3: Input the training set and validation set obtained in step S1 into the YOLOX network model constructed in step S2 for training and validation, and obtain the spatial object detection model and its prediction weights. Iteratively optimize the prediction weights through forward propagation and back propagation to obtain the trained YOLOX network model.
[0011] Step S4: Input the spatial target images in the test set into the trained YOLOX network model for spatial target detection.
[0012] Furthermore, step S1 specifically includes:
[0013] S11. Obtain an image with spatial targets, perform Copy-Reduce-Paste data augmentation on the image, and obtain an enhanced image;
[0014] S12. Label the enhanced image obtained in step S11, obtain the XML annotation file of the spatial target location and type corresponding to the enhanced image; and establish a spatial target detection dataset by combining the enhanced image and its corresponding XML annotation file.
[0015] S13. The spatial object detection dataset obtained in step S12 is randomly divided into a training set, a validation set, and a test set in a ratio of 8:1:1.
[0016] Furthermore, step S2 specifically includes:
[0017] S21: Construct the backbone network for feature extraction;
[0018] S22: Construct a Dilated Encoder network to enhance the feature extraction module;
[0019] S23: Construct the decoupled output module YoloHead network to complete the YOLOX network model construction.
[0020] Furthermore, the backbone feature extraction module in step S21 includes a Focus module, a depthwise separable convolutional layer, a residual module, and an SPPBottleneck module.
[0021] The depthwise separable convolutional layer includes a first depthwise separable convolutional layer, a second depthwise separable convolutional layer, a third depthwise separable convolutional layer, a fourth depthwise separable convolutional layer, and a fifth depthwise separable convolutional layer;
[0022] The residual module includes the first CspLayer module, the second CspLayer module, the third CspLayer module, and the fourth CspLayer module;
[0023] The Focus module, the first depthwise separable convolutional layer, the second depthwise separable convolutional layer, the first CspLayer module, the third depthwise separable convolutional layer, the second CspLayer module, the fourth depthwise separable convolutional layer, the third CspLayer module, the fifth depthwise separable convolutional layer, the SPPBottleneck module, and the fourth CspLayer module are connected in sequence.
[0024] The second CspLayer module generates the first feature layer; the third CspLayer module generates the second feature layer; and the fourth CspLayer module generates the third feature layer.
[0025] Furthermore, the enhanced feature extraction module Dilated Encoder network mentioned in step S22 includes one initial convolutional layer module, Z dilated residual blocks, and Z-1 attention mechanism feedback modules CBAM, where Z is a positive integer;
[0026] Step S22 is as follows:
[0027] S221: Construct the initial convolutional layer module. Take the first feature layer m1 obtained in step S21 as the input of the initial convolutional layer module, use a 1×1 convolutional layer to reduce the channel dimension, and add a 3×3 convolutional layer to refine the semantic context to obtain the output x1 of the initial convolutional layer module.
[0028] x1 = conv2(conv1(m1))
[0029] In the formula, conv1 is a 1×1 convolutional layer and conv2 is a 3×3 convolutional layer;
[0030] S222: Construct the dilated residual block by performing a convolutional layer operation on the output x1 of the initial convolutional layer module obtained in step S221 to obtain the output X of the dilated residual block. i :
[0031] Xi =x i +conv5(conv4(conv3(x i )))
[0032] In the formula, x i For the input of the i-th expanded residual block, conv3 and conv5 are both 1×1 convolutional layers, and conv4 is a 3×3 convolutional layer. i For the output of the i-th extended residual block,
[0033] S223: Construct the attention mechanism feedback module CBAM, which will process the output X of the expanded residual block in step S222. i The input attention mechanism feedback module CBAM obtains the channel attention output feature map. Spatial attention output feature map Spatial attention output feature map The output feature map Y of the attention mechanism feedback module CBAM is... i ;
[0034] S224: Establish a recursive enhanced feature extraction module, the Dilated Encoder network.
[0035] x i+1 =Y i
[0036] Through steps S222 to S223, the output feature map Y of the attention mechanism feedback module CBAM at the Z-1th iteration is obtained. Z-1 That is, to obtain the input x of the Zth expanded residual block. Z , will x Z Substitute the output X of the expanded residual block in step S222 i =x i +conv5(conv4(conv3(x i ))), obtain the enhanced feature layer of the Dilated Encoder network corresponding to the first feature layer;
[0037] S225: Repeat steps S221 to S224 to obtain the enhanced feature layers output by the Dilated Encoder network corresponding to the second and third feature layers, thus completing the construction of the Dilated Encoder network.
[0038] Furthermore, the decoupled output module YOLOHead network mentioned in step S23 includes dynamic convolutional layers, layer attention mechanisms, and prediction parameter layers;
[0039] Step S23 is as follows:
[0040] S231: Calculate the task interaction features of the decoupled output module YOLOHead network to obtain the dynamic convolutional layer. for:
[0041] X∈R×H×W×C
[0042]
[0043] Where X is one of the enhanced feature layers obtained in step S225, R, H, W, and C represent the batch size, image height, image width, and number of channels of each input to the YOLOX network model, respectively, δ refers to the ReLU activation function, and conv k Refers to the k-th convolutional layer.
[0044] S232: Use the layer attention mechanism to utilize the dynamic convolutional layer obtained in step S231. Calculate the feature layers for classification and regression tasks
[0045] w=σ(fc2(δ(fc1(x inter ))))
[0046]
[0047] Where, x inter It is a splicing of dynamic convolutional layers The resulting feature maps are as follows: fc1 is the first fully connected layer, fc2 is the second fully connected layer, and w is the x... inter The k-dimensional weight variables calculated through the layer attention mechanism can capture the dependencies between k convolutional layers. k σ is the k-th element of w, and σ is the sigmoid function;
[0048] S233: Based on the feature layer in S232 The prediction parameters Z obtained from this enhanced feature layer through the decoupled output module YOLOHead network are used for classification or regression. task
[0049] Z task =conv 12 (δ(conv 11 (X task )))
[0050] Among them, X task It is the feature layer The concatenated feature map, conv 11 A 1×1 convolutional layer used to adjust the number of channels, conv12 Convolutional layers are used to generate the predicted parameters Z. task ;
[0051] S234: Repeat steps S231 to S233 to obtain the prediction parameters of all enhanced feature layers obtained through the decoupled output module YoloHead network, and complete the construction of the YOLOX network model.
[0052] Furthermore, step S3 specifically includes:
[0053] S31: Input the RGB images of the training and validation sets from step S13 into the YOLOX network model, and use the Focus module from step S21 to slice the RGB images.
[0054] S32: Input the RGB image processed in step S31 into the backbone feature extraction module Backbone network, and obtain the effective feature layer through the residual module and depthwise separable convolutional layer in step S21;
[0055] S33: Input the effective feature layers obtained in step S32 into the enhanced feature extraction module DilatedEncoder network to obtain the effective enhanced feature layers;
[0056] S34: Input the effective enhanced feature layer obtained in step S33 into the decoupled output module YoloHead network to obtain the prediction parameters of the effective enhanced feature layer; the prediction parameters include the category prediction parameter Cls, the target box parameter Reg, and the foreground / background parameter Obj.
[0057] S35: Stack the category prediction parameter Cls, the target box parameter Reg, and the foreground / background parameter Obj from step S34 to obtain the prediction feature layer;
[0058] S36: Calculate the cross-entropy loss of the prediction parameters of the prediction feature layer in step S35 and the category prediction parameters Cls, target box parameters Reg, and foreground / background parameters Obj in the training set and corresponding XML annotation files in the enhanced image in step S12. Based on the model prediction weights of the cross-entropy loss, continuously perform iterative optimization until the spatial object detection model is obtained.
[0059] Furthermore, step S223 specifically includes:
[0060] The formula for calculating the channel attention output feature map is as follows:
[0061]
[0062] Calculate the spatial attention output feature map based on the channel attention output feature map:
[0063]
[0064] The spatial attention output feature map is used as the output feature map of the attention mechanism feedback module CBAM:
[0065]
[0066] In the formula, AvgPool is average pooling, MaxPool is max pooling, conv6, conv7, conv8, and conv9 are all 1×1 convolutional layers, and conv... 10 It is a 7×7 convolutional layer, and cat is a concatenation operation based on one dimension.
[0067] Furthermore, it also includes step S5:
[0068] The spatial target images of the test set are input into the YOLOX network model constructed in step S2 to evaluate the overall detection performance of the YOLOX network model.
[0069] Further, in step S5, the method for evaluating the overall detection performance of the YOLOX network model is specifically as follows: the overall detection performance of the YOLOX network model satisfies the average value of the evaluation index AP of the average detection accuracy and all evaluation index AP, i.e., the average accuracy mAP.
[0070]
[0071]
[0072]
[0073] In the formula, P represents Precision, which is used to evaluate the correctness of the prediction; R represents Recall, which is used to evaluate how many samples were correctly predicted; TP refers to positive samples predicted as positive by the model, FP refers to negative samples predicted as positive by the model, and FN refers to positive samples predicted as negative by the model.
[0074] Compared with the prior art, the beneficial effects of the technical solution of the present invention are:
[0075] (1) The YOLOX network model constructed in this invention includes a backbone network for feature extraction, a Dilated Encoder network for enhanced feature extraction, and a decoupled output module, the YoloHead network. Its detection accuracy and speed for natural images have reached a relatively high level. Based on this, the network structure of the YOLOX network model has been improved, and a spatial object detection model has been obtained through training and testing using a labeled spatial object detection dataset. In practical applications, the improved YOLOX algorithm offers a better trade-off than YOLO v3, YOLO v4, and YOLO v5 networks.
[0076] (2) The present invention can realize real-time detection of space targets. By continuously iterating and optimizing the prediction weights of the YOLOX network model through forward propagation and backward propagation, the various model evaluation indicators of the YOLOX network model have achieved better results, enabling the YOLOX network model to effectively detect and identify specific categories. Attached Figure Description
[0077] Figure 1 This is a flowchart of the spatial target detection method based on the improved YOLOX of the present invention.
[0078] Figure 2 This is a schematic diagram of the YOLOX network in an embodiment of the present invention.
[0079] Figure 3 This is a schematic diagram of SPPBottleneck in an embodiment of the present invention.
[0080] Figure 4 This is a schematic diagram of the DilateEncoder network in YOLOX in an embodiment of the present invention.
[0081] Figure 5 This is a schematic diagram of the attention mechanism feedback module CBAM in the DilateEncoder network of YOLOX in an embodiment of the present invention.
[0082] Figure 6 This is a schematic diagram of the YoloHead network in YOLOX in an embodiment of the present invention.
[0083] Figure 7 This is a schematic diagram illustrating the spatial target detection effect in an embodiment of the present invention. Detailed Implementation
[0084] The technical solutions of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the technical solutions of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0085] This invention discloses a spatial target detection method based on an improved YOLOX network model, such as... Figure 1 As shown, it includes the following steps:
[0086] Step S1: Obtain a spatial object detection dataset with annotations and labels, and divide the spatial object detection dataset into a training set, a validation set, and a test set;
[0087] S11. Obtain an image with spatial targets, perform Copy-Reduce-Paste data augmentation on the image, and obtain an enhanced image;
[0088] S12. Label the enhanced image obtained in step S11, obtain the XML annotation file of the spatial target location and type corresponding to the enhanced image; and establish a spatial target detection dataset by combining the enhanced image and its corresponding XML annotation file.
[0089] S13. The spatial object detection dataset obtained in step S12 is randomly divided into a training set, a validation set, and a test set in a ratio of 8:1:1.
[0090] Step S2: Construct the YOLOX network model, which includes the Backbone network (a core feature extraction module), the Dilated Encoder network (an enhanced feature extraction module), and the YoloHead network (a decoupled output module).
[0091] S21: Construct the backbone network for feature extraction;
[0092] The backbone feature extraction module consists of a Focus module, depthwise separable convolutional layers, a residual module, and an SPPBottleneck module.
[0093] The depthwise separable convolutional layer includes a first depthwise separable convolutional layer, a second depthwise separable convolutional layer, a third depthwise separable convolutional layer, a fourth depthwise separable convolutional layer, and a fifth depthwise separable convolutional layer;
[0094] The residual module includes the first CspLayer module, the second CspLayer module, the third CspLayer module, and the fourth CspLayer module;
[0095] The Focus module, the first depthwise separable convolutional layer, the second depthwise separable convolutional layer, the first CspLayer module, the third depthwise separable convolutional layer, the second CspLayer module, the fourth depthwise separable convolutional layer, the third CspLayer module, the fifth depthwise separable convolutional layer, the SPPBottleneck module, and the fourth CspLayer module are set in sequence.
[0096] The second CspLayer module generates the first feature layer; the third CspLayer module generates the second feature layer; and the fourth CspLayer module generates the third feature layer.
[0097] S22: Construct a Dilated Encoder network to enhance the feature extraction module;
[0098] The enhanced feature extraction module Dilated Encoder network mentioned in step S22 includes one initial convolutional layer module, Z dilated residual blocks, and Z-1 attention mechanism feedback modules CBAM, where Z is a positive integer;
[0099] S221: Construct the initial convolutional layer module. Take the first feature layer m1 obtained in step S21 as the input of the initial convolutional layer module, use a 1×1 convolutional layer to reduce the channel dimension, and add a 3×3 convolutional layer to refine the semantic context to obtain the output x1 of the initial convolutional layer module.
[0100] x1 = conv2(conv1(m1))
[0101] In the formula, conv1 is a 1×1 convolutional layer and conv2 is a 3×3 convolutional layer;
[0102] S222: Construct the dilated residual block by performing a convolutional layer operation on the output x1 of the initial convolutional layer module obtained in step S221 to obtain the output X of the dilated residual block. i :
[0103] X i =x i +conv5(conv4(conv3(x i )))
[0104] In the formula, x i For the input of the i-th expanded residual block, conv3 and conv5 are both 1×1 convolutional layers, and conv4 is a 3×3 convolutional layer. i For the output of the i-th extended residual block,
[0105] S223: Construct the attention mechanism feedback module CBAM, which will process the output X of the expanded residual block in step S222.i The input attention mechanism feedback module CBAM obtains the channel attention output feature map. Spatial attention output feature map Spatial attention output feature map The output feature map Y of the attention mechanism feedback module CBAM is... i ;
[0106] The formula for calculating the channel attention output feature map is as follows:
[0107]
[0108] Calculate the spatial attention output feature map based on the channel attention output feature map:
[0109]
[0110] The spatial attention output feature map is used as the output feature map of the attention mechanism feedback module CBAM:
[0111]
[0112] In the formula, AvgPool is average pooling, MaxPool is max pooling, conv6, conv7, conv8, and conv9 are all 1×1 convolutional layers, and conv... 10 It is a 7×7 convolutional layer, and cat is a concatenation operation based on one dimension.
[0113] S224: Establish a recursive enhanced feature extraction module, the Dilated Encoder network.
[0114] x i+1 =Y i
[0115] Through steps S222 to S223, the output feature map Y of the attention mechanism feedback module CBAM at the Z-1th iteration is obtained. Z-1 That is, to obtain the input x of the Zth expanded residual block. Z , will x Z Substitute the output X of the expanded residual block in step S222 i =x i +conv5(conv4(conv3(x i ))), obtain the enhanced feature layer of the Dilated Encoder network corresponding to the first feature layer;
[0116] S225: Repeat steps S221 to S224 to obtain the enhanced feature layers output by the Dilated Encoder network corresponding to the second and third feature layers, thus completing the construction of the Dilated Encoder network.
[0117] S23: Construct the decoupled output module YoloHead network to complete the YOLOX network model construction.
[0118] The decoupled output module YOLOHead network mentioned in step S23 includes dynamic convolutional layers, layer attention mechanisms, and prediction parameter layers;
[0119] S231: Calculate the task interaction features of the decoupled output module YOLOHead network to obtain the dynamic convolutional layer. for:
[0120] X∈R×H×W×C
[0121]
[0122] Where X is one of the enhanced feature layers obtained in step S225, R, H, W, and C represent the batch size, image height, image width, and number of channels of each input to the YOLOX network model, respectively, δ refers to the ReLU activation function, and conv k Refers to the k-th convolutional layer.
[0123] S232: Use the layer attention mechanism to utilize the dynamic convolutional layer obtained in step S231. Calculate the feature layers for classification and regression tasks
[0124] w=σ(fc2(δ(fc1(x inter ))))
[0125]
[0126] Where, x inter It is a splicing of dynamic convolutional layers The resulting feature maps are as follows: fc1 is the first fully connected layer, fc2 is the second fully connected layer, and w is the x... inter The k-dimensional weight variables calculated through the layer attention mechanism can capture the dependencies between k convolutional layers. k σ is the k-th element of w, and σ is the sigmoid function;
[0127] S233: Based on the feature layer in S232 The prediction parameters Z obtained from this enhanced feature layer through the decoupled output module YOLOHead network are used for classification or regression. task
[0128] Z task =conv 12 (δ(conv 11 (X task )))
[0129] Among them, X task It is the feature layer The concatenated feature map, conv 11 A 1×1 convolutional layer used to adjust the number of channels, conv 12 It is a 1×1 convolutional layer used to generate the prediction parameters Z. task ;
[0130] S234: Repeat steps S231 to S233 to obtain the prediction parameters of all enhanced feature layers obtained through the decoupled output module YoloHead network, and complete the construction of the YOLOX network model.
[0131] Step S3: Input the training set and validation set obtained in step S1 into the YOLOX network model constructed in step S2 for training and validation, and obtain the spatial object detection model and its prediction weights. Iteratively optimize the prediction weights through forward propagation and back propagation to obtain the trained YOLOX network model.
[0132] S31: Input the RGB images of the training and validation sets from step S13 into the YOLOX network model, and use the Focus module from step S21 to slice the RGB images.
[0133] S32: Input the RGB image processed in step S31 into the backbone feature extraction module Backbone network, and obtain the effective feature layer through the residual module and depthwise separable convolutional layer in step S21;
[0134] S33: Input the effective feature layers obtained in step S32 into the enhanced feature extraction module DilatedEncoder network to obtain the effective enhanced feature layers;
[0135] S34: Input the effective enhanced feature layer obtained in step S33 into the decoupled output module YoloHead network to obtain the prediction parameters of the effective enhanced feature layer; the prediction parameters include the category prediction parameter Cls, the target box parameter Reg, and the foreground / background parameter Obj.
[0136] S35: Stack the category prediction parameter Cls, the target box parameter Reg, and the foreground / background parameter Obj from step S34 to obtain the prediction feature layer;
[0137] S36: Calculate the cross-entropy loss of the prediction parameters of the prediction feature layer in step S35 and the category prediction parameters Cls, target box parameters Reg, and foreground / background parameters Obj in the enhanced image and its corresponding XML annotation file in step S12. Based on the model prediction weights of the cross-entropy loss, continuously perform iterative optimization until the spatial object detection model is obtained.
[0138] Step S4: Input the spatial target images in the test set into the trained YOLOX network model for spatial target detection.
[0139] S41: Put the weights of the spatial object detection model trained in step S36 into the YOLOX network model constructed in step S235;
[0140] S42: Input the spatial target images in the test set obtained in step S13 into the YOLOX network model constructed in step S41 to evaluate the overall detection performance of the spatial target detection model.
[0141] The overall detection performance of the space target detection model meets the evaluation index of average detection accuracy (AP) and average precision (mAP), where mAP is the average of the average detection accuracy (AP) of all categories.
[0142] Step S5: Input the spatial target images of the test set into the YOLOX network model constructed in step S2, and evaluate the overall detection performance of the YOLOX network model.
[0143] The present invention will now be described in detail with reference to specific embodiments.
[0144] S1: Obtain a spatial object detection dataset with annotations and labels;
[0145] S11. Obtain an image with spatial targets and perform Copy-Reduce-Paste data augmentation on the image. Copy-Reduce-Paste data augmentation refers to shrinking / enlarging the spatial targets in the image and pasting them into the original image, increasing the number of spatial targets of different sizes, and obtaining an enhanced image with multiple spatial targets of different sizes, thereby improving the YOLOX network model's ability to extract image features.
[0146] S12. Use the deep learning image annotation tool LabelImg to annotate the enhanced images obtained in step S11, and obtain an XML annotation file containing the location and type of space target for each enhanced image. The annotation categories include three types of targets: satellite body, satellite cabin, and windsurfing. Combine the space target images and their corresponding XML annotation files to build a space target detection dataset.
[0147] S13. The spatial object detection dataset obtained in step S12 is randomly divided into a training set, a validation set, and a test set in a ratio of 8:1:1 for training and testing of the spatial object detection model.
[0148] S2: Construct the YOLOX network model. A schematic diagram of the YOLOX network is shown below. Figure 2 As shown.
[0149] The backbone network for feature extraction includes a Focus module, depthwise separable convolutional layers (Conv2D_BN_SiLU), a residual module (CspLayer), and an SPPBottleneck module. The depthwise separable convolutional layers include a first, second, third, fourth, and fifth depthwise separable convolutional layer. The residual modules include a first, second, third, and fourth residual module.
[0150] The backbone feature extraction module consists of the Focus module, the first depthwise separable convolutional layer, the second depthwise separable convolutional layer, the first CspLayer module, the third depthwise separable convolutional layer, the second CspLayer module, the fourth depthwise separable convolutional layer, the third CspLayer module, the fifth depthwise separable convolutional layer, the SPPBottleneck module, and the fourth CspLayer module in sequence.
[0151] The Focus module takes a value from every pixel in an enhanced image, obtaining four independent feature layers. These four independent feature layers are then stacked, with the input channels expanded fourfold, resulting in a twelve-channel feature layer instead of the original three. Depthwise separable convolutional layers are used to change the convolutional layer method, reducing the number of convolutional layer executions. The residual module is connected by two branches: one branch performs convolutional normalization and activation function operations on the input feature layer, and the other branch processes the input feature layer through the activation function before passing it through n residual modules. Finally, the two branches are connected. Figure 3As shown, the SPPBottleneck module extracts features through max pooling with different kernel sizes, thereby increasing the receptive field of the Backbone network. Finally, the second CspLayer module generates the first feature layer; the third CspLayer module generates the second feature layer; and the fourth CspLayer module generates the third feature layer.
[0152] S22: Enhance the construction of the Dilated Encoder network for the feature extraction module;
[0153] like Figure 4 As shown, the enhanced feature extraction module, the Dilated Encoder network, includes an initial convolutional layer module, a residual module, and an attention mechanism feedback module (CBAM). The residual module utilizes discrete convolutional layers to extract contextual information about targets at various scales from individual feature layers in the main feature extraction module. Figure 5 As shown, the attention mechanism feedback module CBAM bridges the performance gap between single-input single-output (SIO) and multi-input single-output (MIBO) structures. Figure 6 As shown, in step S23, the decoupled output module YoloHead network performs a series of vector convolutional layer operations and activation function branch decoupling operations on the feature layers extracted by the enhanced feature extraction module Dilated Encoder network to obtain the final prediction parameters. The prediction parameters include the prediction parameter Cls, the target box parameter Reg, and the foreground / background parameter Obj.
[0154] The enhanced feature extraction module, Dilated Encoder, comprises three main components: an initial convolutional layer module, dilated residual blocks, and a feedback attention mechanism module (CBAM). First, an initial convolutional layer module is constructed, using a 1×1 convolutional layer to reduce channel dimensions. Then, a 3×3 convolutional layer is added to refine the semantic context. Next, four consecutive dilated residual blocks are stacked, generating dilation rate outputs with multiple receptive fields across different 3×3 convolutional layers, covering the scale of all objects. Finally, the CBAM module bridges the performance gap between single-input single-output and multi-input single-output structures.
[0155] S221: Construct the initial convolutional layer module. Take the first feature layer m1 obtained in step S21 as the input of the initial convolutional layer module, use a 1×1 convolutional layer to reduce the channel dimension, and add a 3×3 convolutional layer to refine the semantic context to obtain the output x1 of the initial convolutional layer module, as shown in formula (1):
[0156] x1=conv2(conv1(m1)) (1)
[0157] Where x1 is the output of the initial convolutional layer module, conv1 represents a 1×1 convolutional layer, and conv2 is a 3×3 convolutional layer;
[0158] S222: Stack four expanded residual blocks Bottleneck1, Bottleneck2, Bottleneck3, and Bottleneck4, as shown in formula (2):
[0159]
[0160] Where, x i For the input of the i-th expanded residual block, conv3 and conv5 are both 1×1 convolutional layers, and conv4 is a 3×3 convolutional layer. The number of expanded residual blocks... Z is an integer;
[0161] In this embodiment, The expansion rates of the four holed convolutional layers are 2, 4, 6, and 8, respectively.
[0162] S223: Establish an attention mechanism feedback module CBAM, which combines spatial and channel attention mechanisms to bridge the performance gap between single-input single-output and multi-input single-output structures.
[0163]
[0164]
[0165]
[0166] in, It is the output of channel attention. It is the output of spatial attention, Y i It is the output of the Feedback Attention Module (CBAM), X i This is the input feature map. AvgPool and MaxPool are average pooling and max pooling operations, respectively. conv6, conv7, conv8, and conv9 are all 1×1 convolutional layers. 10 It is a 7×7 convolutional layer, where δ refers to the ReLU activation function, σ is the sigmoid function, and cat is a concatenation operation based on one dimension.
[0167] As shown in formula (3), X i The feature maps are then processed by AvgPool (average pooling based on width) and MaxPool (maximum pooling based on height), followed by convolutional layers. The feature maps output by the convolutional layers are summed, and finally, a sigmoid operation is performed to generate the final channel attention output feature map.
[0168] As shown in formula (4), After undergoing AvgPool average pooling and MaxPool max pooling operations based on width and height respectively, the concatenated data is processed by convolutional layers to obtain the final spatial attention output feature map.
[0169] As shown in Equation (5), the final spatial attention output feature map is used as the output feature map of the attention mechanism feedback module CBAM.
[0170] S224: Establish a recursive Dilated Encoder network
[0171]
[0172] S23: Construction of the decoupled output module YOLOHead network;
[0173] S231: To enhance the interaction between classification and localization, a feature extractor is used to learn a set of task interaction features from multiple convolutional layers. This design not only facilitates task interaction but also provides multi-layered features with effective receptive fields at multiple scales. Formally, let X∈R×H×W×C represent a single feature layer in step S21, where R, H, W, and C represent the batch size, image height, image width, and number of channels of each input image to the YOLOX network model, respectively. Four consecutive convolutional layers with activation functions are used to compute the task interaction features. The resulting convolutional layers... The dynamic aspect is shown in formula (7):
[0174]
[0175] Where, conv k Refers to the k-th convolutional layer.
[0176] S232: Using a layer attention mechanism, through the convolutional layer obtained in step S231... Dynamically, the characteristics of this specific task are calculated to decompose the task. The calculation method for each task is shown in formula (8).
[0177]
[0178] w=σ(fc2(δ(fc1(x inter )))) (9)
[0179] Among them, w k It is the k-th element of w obtained after the attention layer calculation, as shown in formula (9). w is calculated from the cross-layer task interaction features and can capture the inter-layer dependencies. fc1 and fc2 refer to two fully connected layers, and X interIt is splicing The feature map obtained afterward.
[0180] S233: Obtain the results for classification or localization, as shown in formula (10).
[0181] Z task =conv 12 (δ(conv 11 (X task ))) (10)
[0182] Among them, X task yes The concatenated feature map, conv 11 It is a 1×1 convolutional layer used to adjust the number of channels, where δ is the ReLU activation function, and conv 12 It is a 1×1 convolutional layer used to generate the prediction parameters Z. task This refers to generating the category prediction parameters Cls, the bounding box parameters Reg, and the foreground / background parameters Obj for object detection.
[0183] S3: Input the training set and validation set into the improved YOLOX network model for training and validation, respectively, to obtain the spatial object detection model.
[0184] S31: Input a 3-channel RGB image of arbitrary size, and perform normalization, cropping, random vertical and horizontal flipping, scaling, random color changes, Moisaic and CutMix processing on the image. The image is scaled to 640*640 and used as input to the YOLOX network model. The Focus structure in the Backbone network of the backbone feature extraction module is used to slice the input image.
[0185] S32: Input the image processed in step S31 into the backbone feature extraction module, the Backbone network. By stacking a series of residual modules containing multiple residual blocks with depth-separable convolutional layers, the network is deepened to achieve preliminary feature extraction and reduce a large number of training parameters, resulting in three effective feature layers of 20*20, 40*40 and 80*80.
[0186] S33: Input the three effective feature layers of 20*20, 40*40 and 80*80 obtained in step S32 into the enhanced feature extraction module Dilated Encoder network to obtain the effective enhanced feature layers.
[0187] S34: Input the three effective feature layers (20*20, 40*40, and 80*80) obtained in step S32 into the decoupled output module, the YoloHead network. For each effective enhanced feature layer, three prediction results are obtained: Reg(h, w, 4) is used to determine the regression parameters of each feature point, and the predicted bounding box can be obtained after adjusting the regression parameters; Obj(h, w, 1) is used to determine whether each feature point contains an object; Cls(h, w, num_classes) is used to determine the object type contained in each feature point. Stack the three prediction results, and the result obtained for each feature layer is: Out(h, w, 4+1+num_classes). The first four parameters are used to determine the regression parameters of each feature point, and the predicted bounding box can be obtained after adjusting the regression parameters; the fifth parameter is used to determine whether each feature point contains an object; and the last num_classes parameters are used to determine the object type contained in each feature point.
[0188] S35: Stack the category prediction parameter Cls, the target box parameter Reg, and the foreground / background parameter Obj from step S34 to obtain the prediction feature layer;
[0189] S36: Calculate the cross-entropy loss of the prediction parameters of the prediction feature layer in step S35 and the category prediction parameters Cls, target box parameters Reg, and foreground / background parameters Obj in the training set and corresponding XML annotation files in the enhanced image in step S12. Based on the model prediction weights of the cross-entropy loss, continuously perform iterative optimization until the spatial object detection model is obtained.
[0190] S4: Input the spatial target images from the test set into the trained YOLOX network model for spatial target detection.
[0191] S5: Evaluate the spatial object detection algorithm of the improved YOLOX network model using the spatial object detection results from step S4.
[0192] The weights of the spatial object detection model trained on the test set are fed into the YOLOX network model, and images of undetected spatial objects are input into the YOLOX network model to evaluate the overall detection performance of the spatial object detection model.
[0193] mAP (mean Average Precision) is used as the evaluation metric for the algorithm's detection accuracy, while frames per second (FPS) is used as the evaluation metric for detection speed. mAP is defined as the average of the average precision (AP) across all classes. Therefore, the average precision is:
[0194]
[0195]
[0196]
[0197] Where P represents Precision, used to evaluate the accuracy of predictions; R represents Recall, used to evaluate how many correctly predicted samples were obtained. TP refers to positive samples predicted as positive by the model, FP refers to negative samples predicted as positive by the model, and FN refers to positive samples predicted as negative by the model.
[0198] Figure 7 This image shows the detection results of using this invention to detect spatial target images. From... Figure 7 As can be seen, the satellite body, the satellite cabin, and the windsurfing were detected. The value above each bounding box represents the confidence level, used to determine whether the object within the bounding box is a positive or negative sample. Entities with a confidence level greater than the threshold are considered positive samples, while those less than the threshold are considered negative samples (background). In this invention, the confidence threshold is set to 0.60. The detection method proposed in this invention accurately detects the category and number of space targets. As shown in Table 1, while maintaining consistency between training and test images, the AP, mAP, and FPS of the detection results of this invention and the YOLOX network model were compared. Compared to YOLOX, the average accuracy of this invention is improved by 4 points, and in terms of inference speed, it meets the requirements for real-time detection.
[0199] Table 1 Comparison of detection results of the present invention and different detection methods
[0200] algorithm mAP FPS Satellite Windsurfing Cabin Yolo X 0.9117 58.1 0.95 0.90 0.89 Improved YOLO X 0.9528 59.2 0.98 0.96 0.91
[0201] In summary, this invention enables real-time detection of spatial targets. By iteratively optimizing the prediction weights of the YOLOX network model through forward and backward propagation, all model evaluation metrics have achieved better results, enabling the YOLOX network model to effectively detect and identify specific categories.
Claims
1. A spatial target detection method based on an improved YOLOX network model, characterized in that, Includes the following steps: Step S1: Obtain the spatial object detection dataset with annotations and labels, and divide the spatial object detection dataset into training set, validation set, and test set; specifically: S11. Obtain an image with spatial targets, perform Copy-Reduce-Paste data augmentation on the image, and obtain an enhanced image; S12. Label the enhanced image obtained in step S11 and obtain an XML label file of the spatial target location and type corresponding to the enhanced image; A spatial object detection dataset is then created by combining the enhanced images with their corresponding XML annotation files. S13. The spatial object detection dataset obtained in step S12 is randomly divided into a training set, a validation set, and a test set in a ratio of 8:1:
1. Step S2: Construct the YOLOX network model, which includes a backbone feature extraction module (Backbone network), an enhanced feature extraction module (Dilated Encoder network), and a decoupled output module (YoloHead network); specifically: S21: Construct the backbone network for feature extraction; the backbone network includes a focus module, depthwise separable convolutional layers, a residual module, and an SPPBottleneck module. The depth-separable convolutional layer includes a first depth-separable convolutional layer, a second depth-separable convolutional layer, a third depth-separable convolutional layer, a fourth depth-separable convolutional layer, and a fifth depth-separable convolutional layer. The residual module includes a first CspLayer module, a second CspLayer module, a third CspLayer module, and a fourth CspLayer module; The Focus module, the first depthwise separable convolutional layer, the second depthwise separable convolutional layer, the first CspLayer module, the third depthwise separable convolutional layer, the second CspLayer module, the fourth depthwise separable convolutional layer, the third CspLayer module, the fifth depthwise separable convolutional layer, the SPPBottleneck module, and the fourth CspLayer module are connected in sequence. The second CspLayer module generates the first feature layer; the third CspLayer module generates the second feature layer; and the fourth CspLayer module generates the third feature layer. S22: Construct a Dilated Encoder network to enhance feature extraction; the Dilated Encoder network includes one initial convolutional layer, Z dilated residual blocks, and Z-1 attention mechanism feedback modules (CBAM), where Z is a positive integer; specifically: S221: Construct the initial convolutional layer module, and use the first feature layer obtained in step S21. As input to the initial convolutional layer module, a 1×1 convolutional layer is used to reduce the channel dimension, and a 3×3 convolutional layer is added to refine the semantic context, thus obtaining the output of the initial convolutional layer module. : ; In the formula, It is a 1×1 convolutional layer. It is a 3×3 convolutional layer; S222: Construct the dilated residual block, processing the output of the initial convolutional layer module obtained in step S221. Perform convolutional layer operations to obtain the output of the dilated residual block. : ; In the formula, For the input of the i-th expanded residual block, , All are 1×1 convolutional layers. It is a 3×3 convolutional layer. For the output of the i-th extended residual block, ; S223: Construct the attention mechanism feedback module CBAM, which will process the output of the expanded residual block in step S222. The input attention mechanism feedback module CBAM obtains the channel attention output feature map. Spatial attention output feature map ; Spatial attention output feature map The output feature map of the attention mechanism feedback module CBAM ; S224: Establish a recursive enhanced feature extraction module, the Dilated Encoder network. ; Through steps S222 to S223, the output feature map of the attention mechanism feedback module CBAM for the Z-1th iteration is obtained. That is, to obtain the input of the Zth expanded residual block. ,Will Substitute the output of the expanded residual block in step S222 The enhanced feature layer of the DilatedEncoder network, the enhanced feature extraction module corresponding to the first feature layer, is obtained. S225: Repeat steps S221 to S224 to obtain the enhanced feature layers output by the Dilated Encoder network corresponding to the second and third feature layers, and complete the construction of the Dilated Encoder network. S23: Construct the decoupled output module YoloHead network to complete the YOLOX network model construction; the decoupled output module YoloHead network includes dynamic convolutional layers, layer attention mechanisms, and prediction parameter layers; specifically: S231: Calculate the task interaction features of the decoupled output module YOLOHead network to obtain the dynamic convolutional layer. for: ; ; in, This is one of the enhanced feature layers obtained in step S225. R, H, W, and C represent the batch size, image height, image width, and number of channels of each input image to the YOLOX network model, respectively. refer to Activation function Refers to the k-th convolutional layer. ; S232: Use the layer attention mechanism to utilize the dynamic convolutional layer obtained in step S231. Calculate the feature layers for classification and regression tasks. : ; ; in, It is a splicing of dynamic convolutional layers The feature map obtained later, It is the first fully connected layer. It is the second fully connected layer, w is The k-dimensional weight variables calculated through the layer attention mechanism can capture the dependencies between k convolutional layers. It is the k-th element of w, and σ is function; S233: Based on the feature layer in S232 The prediction parameters for classification or regression are obtained from the enhanced feature layer through the decoupled output module, the YoloHead network. : ; in, It is the feature layer The splicing feature map, It is a 1×1 convolutional layer used to adjust the number of channels. Convolutional layers are used to generate prediction parameters. ; S234: Repeat steps S231 to S233 to obtain the prediction parameters of all enhanced feature layers obtained through the decoupled output module YoloHead network, and complete the construction of the YOLOX network model; Step S3: Input the training set and validation set obtained in Step S1 into the YOLOX network model constructed in Step S2 for training and validation, to obtain the spatial object detection model and its prediction weights. Iteratively optimize the prediction weights through forward and backward propagation to obtain the trained YOLOX network model; specifically: S31: Input the RGB images of the training and validation sets from step S13 into the YOLOX network model, and use the Focus module from step S21 to slice the RGB images. S32: Input the RGB image processed in step S31 into the backbone network of the backbone feature extraction module, and obtain the effective feature layer through the residual module and the depthwise separable convolutional layer in step S21; S33: Input the effective feature layers obtained in step S32 into the enhanced feature extraction module Dilated Encoder network to obtain the effective enhanced feature layers; S34: Input the effective enhanced feature layer obtained in step S33 into the decoupled output module YoloHead network to obtain the prediction parameters of the effective enhanced feature layer; the prediction parameters include the category prediction parameter Cls, the target box parameter Reg, and the foreground / background parameter Obj. S35: Stack the category prediction parameter Cls, the target box parameter Reg, and the foreground / background parameter Obj from step S34 to obtain the prediction feature layer; S36: Calculate the cross-entropy loss of the prediction parameters of the prediction feature layer in step S35 and the category prediction parameters Cls, target box parameters Reg, and foreground / background parameters Obj in the training set and corresponding XML annotation files in the enhanced image in step S12. Based on the model prediction weights of the cross-entropy loss, iteratively optimize until the spatial object detection model is obtained. Step S4: Input the spatial target images in the test set into the trained YOLOX network model for spatial target detection.
2. The spatial target detection method based on the improved YOLOX network model according to claim 1, characterized in that, Step S223 is as follows: The formula for calculating the channel attention output feature map is as follows: ; Calculate the spatial attention output feature map based on the channel attention output feature map: ; The spatial attention output feature map is used as the output feature map of the attention mechanism feedback module CBAM: ; In the formula, It is average pooling. It is a max pooling operation. , , , All are 1×1 convolutional layers. It is a 7×7 convolutional layer. It is a splicing operation based on one dimension.
3. The spatial target detection method based on the improved YOLOX network model according to claim 2, characterized in that, It also includes step S5: The spatial target images of the test set are input into the YOLOX network model constructed in step S2 to evaluate the overall detection performance of the YOLOX network model.
4. The spatial target detection method based on the improved YOLOX network model according to claim 3, characterized in that, In step S5, the method for evaluating the overall detection performance of the YOLOX network model is as follows: the overall detection performance of the YOLOX network model satisfies the average value of the evaluation index AP of the average detection accuracy and the average value of all evaluation index AP, i.e., the average accuracy mAP. ; ; ; In the formula, P represents Precision, which is used to evaluate the correctness of the prediction; R represents Recall, which is used to evaluate how many samples were correctly predicted; TP refers to positive samples predicted as positive by the model, FP refers to negative samples predicted as positive by the model, and FN refers to positive samples predicted as negative by the model.