A method for detecting water column targets by UAV based on improved YOLO X
By improving the YOLO Improved detection accuracy and running speed.
Patent Information
- Application Number
- CN202210472300.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-29
- Publication Date
- 2024-09-13
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing target detection methods based on convolutional neural networks have too many model parameters and require high computing resources when detecting water column targets in naval gunfire. They cannot be applied to UAV platforms with relatively limited hardware resources and suffer from accuracy problems. Problems of low efficiency and low efficiency.
Using the improved YOLO X network structure, by replacing the original YOLO Targeted training reduces model calculations and resource usage while improving detection accuracy.
It achieves high-precision, low-resource-occupied water column target detection on the UAV platform, meets real-time detection requirements, reduces model capacity and calculation amount, and improves detection accuracy and operation speed.
Smart Images

Figure CN114782817B
Abstract
Description
Technical Field
[0001] The invention relates to a target detection method, and in particular to a method for detecting a water column target by an unmanned aerial vehicle based on an improved YOLO X. Background Art
[0002] Medium and large caliber naval guns are responsible for attacking surface ships and shore / island targets, and play an important role in safeguarding maritime rights and interests. To evaluate the shooting effect of naval gun weapon systems, it is mainly achieved by observing whether the target is hit or the deviation (miss distance) between the water column formed by the projectile falling into the water and the target ship. Therefore, accurate and rapid detection of the water column formed by the impact point is the key to completing this evaluation.
[0003] At present, manual methods are generally used to detect the miss distance in naval gun shooting training. This method has the disadvantages of low accuracy, high subjectivity, and low efficiency. It is urgent to introduce a new high-precision automatic target detection system. UAVs have the advantages of high shooting position, wide field of view, low probability of being blocked by obstacles, and flexible observation position, and can be applied to the task of target detection in naval gun shooting. Due to the complexity of the marine environment, the detection of water column targets at the impact point at sea based on UAV aerial photography has problems such as short water column target generation time and interference from background features such as waves and spray. Therefore, the water column target detection algorithm is required to have high accuracy and real-time performance.
[0004] In order to solve the problem of rapid and accurate detection of water column targets at the impact point, target detection based on convolutional neural networks is one of the effective solutions. Although the existing target detection methods based on convolutional neural networks have been improved in algorithm stability, they have too many model parameters and high requirements for hardware computing resources. At the same time, the large model size cannot be applied to UAV platforms with relatively limited hardware resources. Therefore, while maintaining high detection accuracy, reducing the amount of model calculations and model resource usage to meet the needs of UAV platforms for target detection models is a technical problem that needs to be solved urgently. Summary of the invention
[0005] In order to solve the shortcomings of the above technologies, the present invention provides a method for detecting water column targets by an unmanned aerial vehicle based on improved YOLO X.
[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is: a method for detecting water column targets by unmanned aerial vehicles based on improved YOLO X, comprising the following detection steps:
[0007] S1: Establish a proprietary dataset of water column targets;
[0008] S2: annotated water column image;
[0009] S3: Improve the YOLO X network structure;
[0010] S4: Define loss function;
[0011] S5: training water column target proprietary dataset;
[0012] S6: Use the improved YOLO X network model to detect water column targets.
[0013] Furthermore, in step S1, the steps of establishing a water column target-specific data set are as follows:
[0014] S1-1. Collect images of the water column at the point where the shells fall into the water during the naval gun firing process, name the collected water column images according to the format of the Pascal VOC dataset, create a folder named JPEG Images, and store the entire dataset images in the JPEG Images folder;
[0015] S1-2, dividing the water column images into training set, test set, validation set and training validation set;
[0016] S1-3. Create a folder named Image Sets, and create four .txt files named test, train, trainval, and val in the Image Sets folder. Write the numbers of the water column image training set, test set, validation set, and training validation set into the train.txt, test.txt, val.txt, and trainval.txt files respectively.
[0017] Furthermore, the training set, test set, and validation set account for 70%, 20%, and 10% respectively, and the training validation set is the training set plus the validation set, accounting for 80%.
[0018] Furthermore, in step S2, the steps of labeling the water column image are as follows:
[0019] S2-1, in the water column image collected in step S1-1, use the image annotation tool LabelImg to label the water column target in the image, and mark the position and name of the water column;
[0020] S2-2. Create a folder named Annotations and store the XML file generated by the marked image in the Annotations folder.
[0021] Furthermore, in step S3, the specific steps for improving the YOLO X network structure are as follows:
[0022] S3-1. Use the three valid feature layers in Mobilenet v3 to replace the corresponding three valid feature layers in the original YOLO X backbone network CSPDarknet;
[0023] S3-2. Use depth-wise separable convolution instead of ordinary convolution used in the network.
[0024] Furthermore, in step S4, the loss function is used to evaluate the degree of deviation between the predicted value and the true value in the convolutional neural network, and the Focal EIOU Loss loss function is used in the training process:
[0025] L Focal-EIOU =IOU γ L EIOU
[0026]
[0027] Among them, L Focal-EIOU represents the loss function of Focal-EIOU, IOU represents the intersection-over-union ratio; γ is a parameter that controls the degree of outlier suppression; L EIOU represents the loss function of EIOU, L IOU represents the overlap loss between the predicted box and the true box, L dis Represents the center distance loss between the predicted box and the true box, L asp represents the width and height loss of the predicted box and the real box; b represents the center point of the predicted box, b gt represents the center point of the real box, ρ(.) represents the Euclidean distance, c represents the diagonal distance of the minimum bounding box covering the predicted box and the real box, w represents the width of the predicted box, w gt represents the width of the real box, h represents the height of the predicted box, and h gt Indicates the height of the real box; C w and C h is the width and height of the minimum bounding box covering the predicted box and the true box.
[0028] Furthermore, in step S5, the steps of training the water column target proprietary dataset are as follows:
[0029] S5-2, the training of the model is divided into the freezing stage and the thawing stage: in the freezing stage, the backbone of the model is frozen, the feature extraction network does not change, the video memory occupied is small, and only the network is fine-tuned; in the thawing stage, the backbone of the model is not frozen, the feature extraction network will change, the video memory occupied is large, and all the parameters of the network will change;
[0030] S5-3. After training for multiple generations, select the weight file with the smallest train Loss as the detection weight file for improving the YOLO X network structure and store it in the log folder.
[0031] Furthermore, when training the model, the specific parameters of the improved YOLO X network structure are first set; the improved YOLO X network structure with the set parameters is placed in a computer with a configured environment, and the labeled images corresponding to the numbers in train.txt and val.txt are used for training.
[0032] Furthermore, in step S6, the steps of using the improved YOLO X network model to detect the water column target are as follows: according to the conditions of different light intensities, different distances and different numbers of water columns, prepare the water column images to be detected, store them in the img folder, and set the parameters in the python environment; input the training command in the command line, extract the images in the img folder and the weight files in the log folder in S5-3, obtain the detection results of the water column target and perform comparative analysis.
[0033] The present invention discloses a method for detecting water column targets by unmanned aerial vehicles based on improved YOLO X, which can be applied to evaluate the shooting effect of weapon systems in live-fire shooting training at sea; it reduces the amount of model calculation, reduces the amount of model resource occupation, and maintains high detection accuracy, meeting the requirements of unmanned aerial vehicle platforms for water column target detection models. Compared with the prior art, it has the following significant effects:
[0034] (1) Aiming at the demand of UAV platform for water column target detection model, the present invention uses a more lightweight Mobilenet v3 network for feature extraction and introduces a deep convolutional network to further reduce network parameters, thereby achieving a comprehensive improvement in network model performance in terms of water column target detection accuracy, model capacity and running speed;
[0035] (2) The present invention establishes a proprietary dataset of water column targets and uses an improved YOLO X network structure to train the dataset. Compared with commonly used datasets (such as MS COCO 2007, etc.), the trained model is more targeted in detecting water column targets and can more accurately identify individual smaller water column targets.
[0036] (3) To address the problem of imbalance between difficult and easy samples during training, the present invention replaces the original loss function GIOU with the loss function EIOU, and combines it with Focal Loss to obtain Focal EIOU Loss, which can achieve better training results and thus improve the performance of the target detector. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 The present invention is a flow chart of a method for detecting water column targets by an unmanned aerial vehicle based on improved YOLO X.
[0038] Figure 2 This part of the water column dataset images.
[0039] Figure 3 Schematic diagram of the operation of labeling images using LabelImg data labeling software.
[0040] Figure 4 This is a schematic diagram of the Mobilenet v3 network structure.
[0041] Figure 5 Schematic diagram of the standard convolution structure.
[0042] Figure 6 Schematic diagram of the depth-wise separable convolution structure.
[0043] Figure 7 Schematic diagram of the improved YOLO X network structure.
[0044] Figure 8 This is a curve graph showing the change of Loss value with the number of iterations.
[0045] Fig. 9 This is a partial image detection result diagram. DETAILED DESCRIPTION
[0046] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0047] Combination Figure 1 The flowchart of the present embodiment is a method for detecting water column targets by a drone based on improved YOLO X, comprising the following steps:
[0048] S1: Establish a proprietary dataset for water column targets. The specific steps are as follows:
[0049] S1-1. Use UAV optoelectronic pod or other image acquisition equipment to collect images of water columns at the point where shells fall into the water during the naval gun firing process. Some water column dataset images are as follows: Figure 2 As shown in the figure, the water column images are named according to the format of the PascalVOC dataset, a folder named JPEG Images is created, and the images of the entire dataset are stored in the JPEG Images folder;
[0050] S1-2, divide the water column images into training set, test set, validation set and training validation set. The training set, test set and validation set account for 70%, 20% and 10% respectively. The training validation set is the training set plus the validation set, accounting for 80%;
[0051] S1-3. Create a folder named Image Sets, and create four .txt files named test, train, trainval, and val in the Image Sets folder. According to the proportion of each part in S1-2, write the numbers of the water column image training set, test set, validation set, and training validation set into the train.txt, test.txt, val.txt, and trainval.txt folders respectively.
[0052] S2: Annotate the water column image. The specific steps are as follows:
[0053] S2-1, in the water column image collected in step S1-1, use the image annotation tool LabelImg to label the water column target in the image, and mark the position and name of the water column, such as Figure 3 As shown;
[0054] S2-2. Create a folder named Annotations and store the XML file generated by the labeled image in the Annotations folder; the XML file stores the types of annotated objects in the image. <object>- <name>, lower left corner coordinates<x min><y min> and the upper right corner coordinates<x max><y max> And the size of the image <size>, storage path <path>The content is equivalent to the standard format of the PASCAL VOC dataset, as shown below, which is the information contained in the XML format file;
[0055]
[0056] S3: Improve the YOLO Y network structure. The specific steps are as follows:
[0057] S3-1, Mobilenet v3 uses a lot of depth separable convolution and reverse residual structure with linear bottleneck in the network, and uses 5×5 size depth convolution to replace some 3×3 depth convolution in the network, which greatly reduces the number of model parameters and computational overhead. At the same time, SE-Block is introduced to improve the accuracy of the model, thus achieving a balance between the volume, speed and accuracy of the model. In view of the advantages of Mobilenet v3 in model volume and speed, it is used as the backbone network of the YOLO X network model, that is, the three effective feature layers in Mobilenet v3 are used to replace the corresponding three effective feature layers in the original YOLO X backbone network CSPDarknet to extract effective features in the water column image. The overall graph structure of Mobilenet v3 is as follows: Figure 4 As shown;
[0058] S3-2, standard convolution is performed by convolution summation through multiple convolution kernels with the same depth as the input data, such as Figure 5 As shown; the depth-wise separable convolution divides the convolution process into two steps: depth-wise convolution and point-wise convolution, as shown Figure 6 As shown. If the input image size is D F ×D F (can be 512×512, 640×640, etc.), by Figure 5 It can be seen that the computational cost of standard convolution is:
[0059] D F ×D F ×D K ×D K ×M×N
[0060] In the depthwise separable convolutional network structure, the sizes of the depthwise convolution and pointwise convolution kernels are D and D respectively. K ×D K (such as 3×3, 5×5, etc.) and 1×1, by Figure 6 It can be seen that the computational cost of the deep separable convolutional network is:
[0061] D K ×D K ×M×D F ×D F +M×N×D F ×D F
[0062] The ratio of the amount of calculation after the final standard volume decomposition to the amount of calculation before decomposition is:
[0063]
[0064] In the above formula, M represents the number of input channels, and N represents the number of output channels.
[0065] If the convolution kernel size used is 3×3, the amount of computation through depthwise separable convolution is reduced to 1 / 9 to 1 / 8 of the original. Therefore, the output dimension of depthwise separable convolution is the same as that of standard convolution, but through this convolution operation, the amount of computation of depthwise separable convolution is greatly reduced, thereby speeding up the calculation speed of the network. Since the network parameters are mainly concentrated in ordinary convolution, in order to further reduce the number of parameters, 3×3 depthwise separable convolution is used instead of 3×3 ordinary convolution used in the network. The improved YOLO X network structure is as follows Figure 7 As shown in the figure, 1) Input: The input image size is selected as 640×640×3; 2) Backbone: The three effective feature layers in Mobilenet v3 are used to replace the corresponding three effective feature layers in the original YOLO X backbone network CSPDarknet to reduce the number of parameters in the network; 3) Neck: The FPN structure is used for fusion. FPN is from top to bottom, and the high-level feature information is transferred and fused by upsampling to obtain the feature map for prediction; 4) Prediction: Three Decoupled Heads are added, with a total of three branches. The first one is mainly for the category of the target box and the prediction score; the second one is mainly for judging whether the target box is foreground or background; the third one is mainly for predicting the coordinate information of the target box; the last three outputs are fused together through Concat.
[0066] S4: Define the loss function. The specific steps are as follows:
[0067] The loss function can be used to evaluate the degree of deviation between the predicted value and the true value in the convolutional neural network. EIOU replaces GIOU and introduces Focal Loss to solve the problem of imbalance between difficult and easy samples. The EIOU loss function consists of three parts: overlap loss, center distance loss, and width loss. The penalty term formula is as follows:
[0068]
[0069] Among them, L EIOU represents the loss function of EIOU, L IOU represents the overlap loss between the predicted box and the true box, L dis Represents the center distance loss between the predicted box and the true box, L asp represents the width and height loss of the predicted box and the real box; IOU represents the intersection-union ratio, which calculates the ratio of the intersection and union of the predicted box and the real box; b represents the center point of the predicted box, b gt represents the center point of the real box, ρ(.) represents the Euclidean distance, c represents the diagonal distance of the minimum bounding box covering the predicted box and the real box, w represents the width of the predicted box, w gt represents the width of the real box, h represents the height of the predicted box, and h gt Indicates the height of the real box; C w and C h is the width and height of the minimum bounding box covering the predicted box and the true box.
[0070] In an image, the number of high-quality anchor frames with small regression errors is far less than the number of low-quality samples with large errors. Poor-quality samples will produce excessive gradients that affect the training process. Therefore, Focal Loss is combined with EIOU. Focal Loss separates high-quality anchor frames from low-quality anchor frames from the perspective of gradient. The penalty term formula is as follows:
[0071] L Focal-EIOU =IOU γ L EIOU
[0072] Among them, L Focal-EIOU represents the loss function of Focal-EIOU, IOU represents the intersection-over-union ratio; γ is a parameter that controls the degree of outlier suppression; it can be seen that the higher the IOU, the greater the loss, which is equivalent to the weighted effect. The better the regression target, the greater the loss, which helps to improve the regression accuracy.
[0073] To sum up, the Focal EIOU Loss loss function is used in the training process:
[0074] The Focal EIOU Loss loss function used in the training process is:
[0075] L Focal-EIOU =IOU γ L EIOU
[0076]
[0077] S5: Training the water column target proprietary dataset. The specific steps are as follows:
[0078] S5-1. Set the specific parameters of the improved YOLO X network structure. The size of each image is 640×640, batch batch=8, initial epoch InitEpoch=0, frozen training epoch FreezeEpoch=100, total training epoch UnFreezeEpoch=200, and freezing stage learning rate Freezelr=1×10 -3 , learning rate in the unfreezing phase UnFreezelr = 1×10 -4 Put the improved YOLO X network structure with set parameters into the computer with configured environment, and use the labeled pictures corresponding to the numbers in train.txt and val.txt for training;
[0079] S5-2, the training of the model is divided into two stages, namely the freezing stage and the thawing stage: in the freezing stage, the backbone of the model is frozen, the feature extraction network does not change, the video memory occupied is small, and only the network is fine-tuned; in the thawing stage, the backbone of the model is not frozen, the feature extraction network will change, the video memory occupied is large, and all the parameters of the network will change;
[0080] S5-3. After 200 generations of training, the Loss value basically converges to a stable value. The change of the Loss value with the number of iterations is as follows: Figure 8 As shown in the figure, in the freezing stage, the model fits quickly in the first 50 iterations, and the Loss value decreases rapidly, and then remains basically unchanged. In the thawing stage, the Loss value increases in the first few generations, but then decreases rapidly. After 150 generations, it gradually stabilizes with only a few oscillations. As the number of network model training iterations increases, the Loss gap between the training set and the validation set gradually decreases. When the number of network training iterations reaches 175, the network's Loss for the training set and the validation set drops to around 2.3, and the difference in Loss between the training set and the validation set is not much different. The Loss basically converges to a stable value, indicating that the network model has achieved the expected training effect. The weight file with the smallest train Loss value is selected as the detection weight file for improving the YOLO X network structure and stored in the log folder.
[0081] S6: Use the improved YOLO X network model to detect the water column target. The specific steps are as follows:
[0082] For different light intensities, different distances, and different water column quantities, prepare the water column images to be detected and store them in the img folder. Set specific parameters in the python environment, enter the training command in the command line, extract the images in the img folder and the weight files in the log folder in S5-2, obtain the detection results of the water column targets, and perform comparative analysis. Fig. 9 As shown, Fig. 9 This is the detection result of a water column image. The box in the figure shows the detected target (water column). "water_column" represents the class "water column" and 0.99 is the confidence level.
[0083] Therefore, for the water column target detection method for drones based on improved YOLO X disclosed in the present invention, the method improves the YOLO X network model structure, replaces the three effective feature layers in the lightweight deep convolutional neural network Mobilenet v3 with the corresponding three effective feature layers in the backbone network CSPDarknet in YOLO X, and uses 3×3 depth-separable convolution to replace the ordinary convolution in the YOLO X network structure, which greatly reduces the number of parameters and calculations of the YOLO X network structure, and fully balances the detection accuracy and real-time requirements. Secondly, a proprietary data set is established, and the training set and the test set are divided into training sets according to a certain ratio. At the same time, in order to solve the problem of imbalance between difficult and easy samples, the Focal EIOU Loss replaces the original loss function GIOU, which can obtain better training effects. After training for multiple generations, when the loss function basically converges to a stable value, it indicates that the network model has achieved the expected training effect. Finally, when detecting water column targets, the improved YOLO X network structure is used to train the water column target data set, and the resulting model can more accurately identify small targets; for water column targets with different light intensities, different distances, and different numbers, the improved YOLO X network structure has slightly reduced accuracy, but its model capacity is greatly reduced and its running speed is greatly improved, which can meet the needs of real-time detection and achieve a comprehensive improvement in the performance of water column target detection.
[0084] The above implementation modes are not limitations of the present invention, and the present invention is not limited to the above examples. Changes, modifications, additions or substitutions made by technicians in this technical field within the scope of the technical solution of the present invention also belong to the protection scope of the present invention.< / path> < / size> < / name> < / object>
Claims
1. A method for detecting water column targets by unmanned aerial vehicles based on improved YOLO X, characterized in that: The following detection steps are included: S1: Establish a proprietary dataset of water column targets; S2: annotated water column image; S3: Improve the YOLO X network structure; S4: Define loss function; S5: training water column target proprietary dataset; S6: Use the improved YOLO X network model to detect water column targets; In step S3, the specific steps for improving the YOLO X network structure are as follows: S3-1. Use the three valid feature layers in Mobilenet v3 to replace the corresponding three valid feature layers in the original YOLO X backbone network CSPDarknet; S3-2, use depth-wise separable convolution instead of ordinary convolution used in the network; In step S4, the loss function is used to evaluate the degree of deviation between the predicted value and the true value in the convolutional neural network. The Focal EIOU Loss loss function is used in the training process: L Focal-EIOU =IOU γ L EIOU Among them, L Focal-EIOU represents the loss function of Focal-EIOU, IOU represents the intersection-over-union ratio; γ is a parameter that controls the degree of outlier suppression; L EIOU represents the loss function of EIOU, L IOU represents the overlap loss between the predicted box and the true box, L dis Represents the center distance loss between the predicted box and the true box, L asp represents the width and height loss of the predicted box and the real box; b represents the center point of the predicted box, b gt represents the center point of the real box, ρ(.) represents the Euclidean distance, c represents the diagonal distance of the minimum bounding box covering the predicted box and the real box, w represents the width of the predicted box, w gt represents the width of the real box, h represents the height of the predicted box, and h gt Indicates the height of the real box; C w and C h is the width and height of the minimum bounding box covering the predicted box and the true box.
2. The method for detecting water column targets by unmanned aerial vehicles based on improved YOLO X according to claim 1, characterized in that: In step S1, the steps for establishing a water column target-specific dataset are as follows: S1-1. Collect images of the water column at the point where the shells fall into the water during the naval gun firing process, name the collected water column images according to the format of the Pascal VOC dataset, create a folder named JPEG Images, and store the entire dataset images in the JPEG Images folder; S1-2, dividing the water column images into training set, test set, validation set and training validation set; S1-3. Create a folder named Image Sets, and create four .txt files named test, train, trainval, and val in the Image Sets folder. Write the numbers of the water column image training set, test set, validation set, and training validation set into the train.txt, test.txt, val.txt, and trainval.txt files respectively.
3. The method for detecting water column targets by unmanned aerial vehicles based on improved YOLO X according to claim 2, characterized in that: The training set, test set, and validation set account for 70%, 20%, and 10% respectively, and the training validation set is the training set plus the validation set, accounting for 80%.
4. The method for detecting water column targets by unmanned aerial vehicles based on improved YOLO X according to claim 2, characterized in that: In step S2, the steps of labeling the water column image are as follows: S2-1, in the water column image collected in step S1-1, use the image annotation tool LabelImg to label the water column target in the image, and mark the position and name of the water column; S2-2. Create a folder named Annotations and store the XML file generated by the marked image in the Annotations folder.
5. The method for detecting water column targets by unmanned aerial vehicles based on improved YOLO X according to claim 4 is characterized in that: In step S5, the steps of training the water column target proprietary dataset are as follows: S5-2, the training of the model is divided into the freezing stage and the thawing stage: in the freezing stage, the backbone of the model is frozen, the feature extraction network does not change, the video memory occupied is small, and only the network is fine-tuned; in the thawing stage, the backbone of the model is not frozen, the feature extraction network will change, the video memory occupied is large, and all the parameters of the network will change; S5-3. After training for multiple generations, select the weight file with the smallest train Loss as the detection weight file for improving the YOLO X network structure and store it in the log folder.
6. The method for detecting water column targets by unmanned aerial vehicles based on improved YOLO X according to claim 5, characterized in that: When training the model, first set the specific parameters of the improved YOLO X network structure; put the improved YOLO X network structure with the set parameters into the computer with the configured environment, and use the labeled pictures corresponding to the numbers in train.txt and val.txt for training.
7. The method for detecting water column targets by unmanned aerial vehicles based on improved YOLO X according to claim 6, characterized in that: In step S6, the steps of using the improved YOLO X network model to detect the water column target are as follows: according to the conditions of different light intensities, different distances and different numbers of water columns, prepare the water column images to be detected, store them in the img folder, and set the parameters in the python environment; input the training command in the command line, extract the images in the img folder and the weight files in the log folder in S5-3, obtain the detection results of the water column target and perform comparative analysis.
