Unmanned ship recognition system based on improved YOLOv7 algorithm
By improving the YOLOv7 algorithm, replacing the ELAN module with the DSConv-ELAN-REP module and using the NWD metric, the detection efficiency and accuracy issues of the YOLO model in complex environments were resolved, achieving more efficient ship target recognition.
Patent Information
- Application Number
- CN202410082190.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-19
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-01-19
AI Technical Summary
In ship target detection based on the YOLO algorithm, existing technologies suffer from low detection efficiency and decreased accuracy. In particular, in inland river and lake environments, the detection accuracy is insufficient after feature information is stripped away due to factors such as angle, lighting and rain/fog.
The YOLOv7 algorithm is improved by replacing the ELAN module with the DSConv-ELAN-REP module, replacing the IoU loss function with the NWD metric, and evaluating the feature stripping depth by combining environmental background complexity and downsampling factor. The model running status is output through the decision processing module.
It improved the model's target detection capabilities, reduced the workload of staff, enhanced detection accuracy and efficiency in complex backgrounds, and avoided missed detections and false detections.
Smart Images

Figure CN118097348B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning technology, and more specifically, to an unmanned ship recognition system based on an improved YOLOv7 algorithm. Background Art
[0002] Ship recognition detection shows excellent performance in large data sets based on the YOLO algorithm, but it is not realistic to directly apply general neural network detection algorithms to ship target detection. The data distribution of ship target detection scenarios varies greatly, and the appearance and spatial characteristics of ship targets have unique characteristics. In actual inland river and lake environments, target detection is also affected by environmental factors such as angle, lighting, rain and fog. Secondly, the detection speed of large data sets based on the YOLO algorithm is limited by the limitations of the YOLO algorithm itself, and the detection efficiency is difficult to improve. In the optimized lightweight YOLO model, the problem of redundant feature information can be solved, but the target detection accuracy is reduced due to the stripping of some effective feature information. The effective elimination of redundant information and retaining the key information required for efficient detection are urgent problems to be solved by the lightweight YOLO model.
[0003] In order to solve the above defects, a technical solution is now proposed. Summary of the invention
[0004] The purpose of the present invention is to provide an unmanned ship recognition system based on an improved YOLOv7 algorithm to solve the problems in the above-mentioned background technology.
[0005] To achieve the above object, the present invention provides the following technical solution: an unmanned ship identification system based on an improved YOLOv7 algorithm, comprising a data capture module, an intelligent learning module, an analysis and verification module, and a decision processing module:
[0006] The data capture module is used to collect image data of ships in inland rivers and lakes, annotate images containing ships, and divide the data set into three categories: training set, validation set, and test set;
[0007] The intelligent learning module is used to build a training model using the data set, optimize the traditional YOLOv7 algorithm framework, replace the ELAN module in the YOLOv7 algorithm structure with the DSConv-ELAN-REP module, and replace the IoU metric in the loss function with the NWD metric to evaluate the target detection performance of the optimized model;
[0008] The analysis and verification module is used to measure the depth of feature stripping in downsampling due to the complexity of the environmental background according to the product of the complexity of the environmental background and the downsampling scaling factor in the training model, and to construct an evaluation model based on the feature stripping depth and the corrected output value of the training model, comprehensively detecting the factors affecting the model performance in the regional environment, and measuring the correction efficiency of the training model;
[0009] The decision processing module is used to compare the calculated correction efficiency performance with the preset threshold, and output a status signal according to the comparison result to characterize the operational effectiveness of the target detection model.
[0010] Preferably, the structure of the training model includes a backbone feature extraction network, a neck feature fusion network, and a detection head, wherein the backbone extraction network includes a CBS convolution layer, an MP convolution layer, and an ELAN module, and the neck feature fusion network includes CBS, SPPCSPC, MP-SimAM, VoV-GSCSP Block, and UP. The detection head outputs feature maps of different scales according to the anchor mechanism, uses the NWD loss function after adjusting the number of channels, and performs nonlinear maximum suppression processing.
[0011] Preferably, the logic of replacing the ELAN module with the DSConv-ELAN-REP module is:
[0012] Based on the original ELAN structure, the distribution shift convolution is introduced to replace the CBS 3×3 convolution layer, and a residual branch is added between each DSConv to construct the DSConv-ELAN-REP module. DSConv decomposes the traditional convolution kernel into two components, including a variable quantization kernel and a distribution offset. The calculation process of DSConv is as follows: First, quantization is performed to approximate the weights of the convolution layer to the nearest integer and store them in the memory as integer values. Next, distribution displacement is performed to move the quantized weights to a position that matches the original weight tensor by calculating and adjusting the distribution of the quantized weights. Then, inference is performed to calculate the results using the integer values of the quantized weights and the input tensor to achieve fast calculation. Finally, after calculating all the convolution results of each convolution kernel, channel-level distribution displacement is applied.
[0013] Preferably, the logic of replacing the IoU metric in the loss function with the NWD metric is:
[0014] By modeling the bounding box as a two-dimensional Gaussian distribution, NWD is used to measure the similarity of the derived Gaussian distribution. For a horizontal bounding box R = (cx, cy, w, h), where (cx, cy) is the center point coordinate, w and h are the width and height of the box, respectively, R is modeled as a Gaussian distribution N (μ, Σ), where and The Wasserstein distance method is used to calculate the distribution distance between two different bounding boxes. For bounding boxes R1(cx1,cy2,w1,h1) and R2(cx2,cy2,w2,h2), we have The distance metric is converted into a similarity metric by normalization. The exponential form of is normalized, that is, Where C is a constant related to the image dataset.
[0015] Preferably, the calculation method of the training model correction output value is:
[0016] The corrected recall and corrected precision of the test results are calculated according to the NWD threshold. The calculation expression of the corrected recall is: In the formula, P is the precision, and the calculation expression is Among them, TP represents the number of correctly predicted positive samples, FP represents the number of incorrectly predicted positive samples, and the correction accuracy is In the formula, R is the recall rate, and the calculation expression is Among them, FN represents the number of samples that are not correctly predicted as positive samples.
[0017] Preferably, the method for measuring the depth of feature stripping in downsampling by using the complexity of the environmental background is:
[0018] The downsampling multiple is calibrated as Sb, and the environmental complexity of inland rivers and lakes is Cr. The calculation expression of the downsampling floating scaling factor Fo is Fo=Sb*(1-Cr). The environmental complexity Cr of inland rivers and lakes is a parameter that characterizes the degree of environmental interference in the detection. It is calculated through water surface visibility, binary cut specific ratio and ship density. The calibrated water surface visibility, binary cut specific ratio and ship density are Vi, Cu and De respectively. The calculation expression is: Where α1, α2, and α3 are the proportional coefficients of water surface visibility, binary cut specific ratio, and ship density, respectively, and α1, α2, and α3 are all greater than 0. The environmental complexity Cr is in the range of (0, 1) after normalization.
[0019] Water surface visibility refers to the visibility at the sampling height of the surface detection of inland rivers and lakes, and is measured by optical or acoustic instruments. The binary cut specific ratio is the ratio of the number of potential analysis target pixels above the water body to the number of pixels in the water body in the collected image. The potential analysis targets above the water body are ships or parts of ships, as well as potential detection targets such as mountains and buildings. The image features of the water body are relatively uniform and obvious. The potential analysis part above the water body directly determines the load pressure of the detection model operation. De is the ship density, which is detected by radar or other forms of electromagnetic wave active observation instruments. The higher the ship density, the higher the requirements for the accuracy and efficiency of the model detection.
[0020] Preferably, the logic of combining the impact of the detection area environmental factors on the model is:
[0021] S1. Obtain a reasonable delay time range for electromagnetic wave feedback of the unmanned ship identification system, and mark the reasonable delay time range for electromagnetic wave feedback of the unmanned ship identification system as T1-T2;
[0022] S2. Obtain the electromagnetic wave feedback delay time of each target that can be obtained in the detection area, and mark the electromagnetic wave feedback delay time of each target that can be obtained in the detection area as Mp, and p = {1, 2, 3 ... q}, where q is a positive integer;
[0023] S3, obtaining data of the electromagnetic wave feedback delay time of each target that can be obtained in the detection area exceeding the maximum value T2 of the reasonable electromagnetic wave feedback delay time, and calibrating the data of the electromagnetic wave feedback delay time of each target that can be obtained in the detection area exceeding the maximum value T2 of the reasonable electromagnetic wave feedback delay time as Gs, and s = P1,2,3...v}, where v is a positive integer;
[0024] S4. The expression for calculating the abnormal feedback frequency coefficient of the reflected wave is: In the formula is the average value of the electromagnetic wave feedback delay time Mp of each target that can be obtained in the detection area, that is,
[0025] Preferably, the logic of evaluating the correction efficiency of the training model by using the feature stripping depth and the correction output value of the training model is:
[0026] Calculate the correction efficiency index of the training model, the calculation expression is Ef = Fo*(β1*Ce+β2*Ca), compare the calculated correction efficiency index of the model with the preset correction efficiency index threshold Et. If Ef is greater than or equal to Et, the correction effect meets the detection accuracy requirements under complex backgrounds. If Ef is less than Et, the correction effect is difficult to maintain the accuracy requirements for model detection under complex backgrounds.
[0027] Preferably, the logic for classifying the training model operation status according to the evaluation of the correction efficiency of the training model is:
[0028] When the model detection accuracy requirements under complex backgrounds are not met, a warning signal is issued to remind staff to inspect and optimize the model. When the accuracy requirements are met, a stable signal is issued, indicating that no human intervention is required and the detection model is operating normally.
[0029] In the above technical solution, the technical effects and advantages provided by the present invention are:
[0030] The present invention optimizes the YOLOv7 network, improves the original ELAN module into a DSConv-ELAN-REP module, replaces the IoU metric in the loss function with the NWD metric, thereby enhancing the target detection capability of the model. The downsampling scaling float is evaluated by the environmental background complexity and the downsampling multiple, the depth of feature stripping is tested, and the correction value of the recall rate and accuracy of the model test results under the influence of the NWD coefficient is combined to jointly evaluate the correction value and the feature stripping depth. When the evaluation result is lower than the preset value, an abnormal signal is sent to remind the staff to perform verification and optimization, which can effectively improve the target detection capability of the model and reduce the burden on the staff. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0032] Figure 1 It is a system module diagram of the present invention.
[0033] Figure 2 This is a structural diagram of the improved YOLO algorithm of the present invention. DETAILED DESCRIPTION
[0034] 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.
[0035] Example 1
[0036] See also Figure 1 As shown, the present invention is an unmanned ship identification system based on an improved YOLOv7 algorithm, including a data capture module, an intelligent learning module, an analysis and verification module, and a decision processing module;
[0037] The data capture module is used to collect image data of ships in inland rivers and lakes, annotate images containing ships, and divide the data set into three categories: training set, validation set, and test set;
[0038] The intelligent learning module is used to build a training model using the data set, optimize the traditional YOLOv7 algorithm framework, replace the ELAN module in the YOLOv7 algorithm structure with the DSConv-ELAN-REP module, and replace the IoU metric in the loss function with the NWD metric to evaluate the target detection performance of the optimized model;
[0039] The analysis and verification module is used to measure the depth of feature stripping in downsampling due to the complexity of the environment background according to the product of the complexity of the environment background and the downsampling scaling factor in the target detection model, and to construct an evaluation model based on the feature stripping depth and the corrected output value of the target detection model to measure the correction efficiency of the target detection model;
[0040] The decision processing module is used to compare the calculated correction efficiency performance with the preset threshold, and output a status signal according to the comparison result to characterize the operational effectiveness of the target detection model.
[0041] Ship recognition detection shows excellent performance in large data sets based on the YOLO algorithm, but it is not realistic to directly apply general neural network detection algorithms to ship target detection. The data distribution of ship target detection scenarios varies greatly, and the appearance and spatial characteristics of ship targets have unique characteristics. In actual inland river and lake environments, target detection is also affected by environmental factors such as angle, lighting, rain and fog. Secondly, the detection speed of large data sets based on the YOLO algorithm is limited by the limitations of the YOLO algorithm itself, and the detection efficiency is difficult to improve. In the optimized lightweight YOLO model, the problem of redundant feature information can be solved, but the target detection accuracy is reduced due to the stripping of some effective feature information. The effective elimination of redundant information and retaining the key information required for efficient detection are urgent problems to be solved by the lightweight YOLO model.
[0042] The YOLO series of algorithms transforms the target detection problem into a regression problem, divides the input image into grids, and predicts the object category, center point coordinates, and object length-width ratio in the grid to directly detect objects in the object grid. The YOLOv7 algorithm replaces the grid map with an anchor frame, uses the deviation between the predicted frame and the true frame to detect the segmented image, and adds normalization operations to accelerate the convergence of the network. By downsampling and simplifying the feature map, the amount of calculation can be reduced. YOLOv7 improves the network used, further optimizes downsampling and feature extraction, and expands the network's perception range. Feature maps of different scales are integrated into the feature module, and the output is re-parameterized by the convolutional layer, which can effectively reduce the computational burden.
[0043] Reference Figure 2 As shown in the figure, YOLOv7 consists of three parts: backbone feature extraction network, neck feature fusion network, and detection head.
[0044] The improved backbone extraction network consists of CBS convolution layer, MP convolution layer and ELAN module. The CBS convolution layer consists of ordinary convolution, batch normalization and activation function, which is used to extract original features from the input data. The MP convolution layer expands the receptive field of the current layer by downsampling and concatenates it with the feature tensor after ordinary convolution processing to obtain richer feature expression. The ELAN module gives the backbone network lightweight characteristics and extracts deep features.
[0045] The neck feature fusion network includes CBS, SPPCSPC, MP-SimAM, VoV-GSCSP Block and UP. According to the PAFPN structure, multi-scale feature fusion is performed on the three levels of feature layers in the backbone network structure, namely the middle layer, the lower middle layer and the bottom layer. The SPPCSPC structure is used in the pyramid pool structure to expand the receptive field of the backbone network. The MP-SimAM structure is used to optimize the downsampling operation to ensure that the key features are retained during the downsampling process. The VoV-GSCSP Block module can further expand the receptive field of the model and enhance the network's utilization efficiency of effective features. UP can achieve upsampling operations through interpolation, which can improve the optimization accuracy of the model.
[0046] The detection head adopts the anchor mechanism to output feature maps of three scales: large, medium and small. The re-parameterized structure is used to connect the conventional convolution to adjust the number of channels and predictions. Then, the NWD loss function and nonlinear maximum suppression are used to obtain the final prediction result. Figure 2 In the figure, a, b, and c represent three feature maps of different scales output.
[0047] The improved algorithm can make the backbone network more lightweight and reduce the inference time of the model, while enriching the features extracted by the network and improving detection accuracy.
[0048] In order to improve the feature extraction capability and inference speed of the ELAN module in the backbone network, based on the original ELAN structure, a distributed shift convolution is introduced to replace the CBS 3×3 convolution layer, and a residual branch is added between each DSConv to construct a distributed shift convolution joint branch module.
[0049] In order to solve the problem of large number of parameters of ordinary convolution in CBS, DSConv is introduced to make the network more lightweight while ensuring more effective extraction of spatial features. Traditional convolution layers require a lot of storage and computing resources, while the design of DSConv layer aims to significantly improve the storage efficiency and speed of standard convolution layers, and can be directly applied to the reasoning and training process of convolutional networks.
[0050] The principle of DSConv is to quantize the original floating-point convolution kernel parameters, and then approximate them to the original parameters through distribution shift, so as to achieve memory reduction and speed up operation. At the same time, DSConv decomposes the traditional convolution kernel into two components, including variable quantization kernel and distribution shift. It achieves lower memory usage and higher speed by storing only integer values in the quantizable kernel, and maintains the same output as the original convolution kernel by applying kernel- and channel-based distribution shift. This structure can directly replace the original convolution layer, which is convenient for direct application in existing networks.
[0051] The calculation process of DSConv is as follows: first, quantization is performed to approximate the weights of the convolution layer to the nearest integer and store them in the memory as integer values. Next, distribution displacement is performed to calculate and adjust the distribution of the quantized weights and move them to a position that matches the original weight tensor. Then, inference is performed to calculate the results using the integer values of the quantized weights and the input tensor to achieve fast calculations. Finally, after calculating all the convolution results of each convolution kernel, channel-level distribution displacement is applied. DSConv greatly reduces memory usage and achieves faster calculation speeds while maintaining the same output as traditional convolution.
[0052] In order to avoid the problem of insufficient feature extraction of objects on the lake surface by the model under complex interference such as blurred object contours and occlusion in the environmental background, which leads to missed detection during multi-scale feature fusion, the VoV-GSCSP Block structure is used to optimize the ELAN structure in the feature fusion part of the network to expand the receptive field of the model, enhance the network's ability to utilize effective features, and improve the accuracy of target detection under complex backgrounds. At the same time, the use of VoV-GSCSP Block can reduce the number of model parameters and further optimize the lightweight structure of the model.
[0053] During the downsampling process, the size of the feature map of the image data is reduced, resulting in the loss of some key features, which in turn causes the network to inaccurately locate targets in complex backgrounds. The parameter-free attention mechanism is integrated into the original MP structure to optimize downsampling, and SimAM is used to replace the original CBS 1×1 convolution to capture key image features from multiple dimensions and enlarge the receptive field. This can enhance the network's ability to effectively extract depth and important features in complex backgrounds and avoid the loss of feature information.
[0054] The parameter-free attention mechanism, namely SimAM, is used in the downsampling stage. SimAM can better capture the key features of each neuron in the feature map by performing 3D attention weighting on the feature map, and can improve the expressiveness of the model. SimAM is a lightweight attention module that is directly embedded in the existing network architecture without introducing additional parameters. It can quickly calculate the 3D attention weights, improve the efficiency of the model, avoid excessive adjustments to the structure, and make the model easier to train and optimize.
[0055] Regarding the problem that the IoU metric calculation is sensitive to position deviations of feature-poor targets, especially targets with fewer pixels, NWD is introduced in the regression loss function to measure the similarity between the predicted bounding box and the true target bounding box. The traditional IoU metric calculates the degree of overlap of image features. Since feature-poor targets have fewer pixels and their scale changes are discrete, a slight position deviation will cause the target IoU value to drop significantly. The use of NWD can reduce the sensitivity of this position deviation. By modeling the bounding box as a two-dimensional Gaussian distribution, NWD is used to measure the similarity of the derived Gaussian distribution. For the horizontal bounding box R = (cx, cy, w, h), (cx, cy) is the coordinate of the center point, w and h are the width and height of the box, respectively, R is modeled as a Gaussian distribution N (μ, Σ), where The Wasserstein distance method is used to calculate the distribution distance between two different bounding boxes. For bounding boxes R1(cx1,cy2,w1,h1) and R2(cx2,cy2,w2,h2), we have It should be pointed out that the distance between R1 and R2 is calculated according to the Gaussian distribution of the two bounding boxes. The Wasserstein distance method can also be used to calculate other continuous or discrete distribution forms, which will not be repeated here.
[0056] The IoU value is a similarity measure, and is a distance metric. The two cannot be directly interchanged. The distance metric is converted into a similarity metric through normalization. The exponential form of is normalized, that is, Where C is a constant related to the image data set. It can be seen from the expression that NWD is insensitive to the enrichment of target pixels and can effectively avoid missed detection problems caused by small targets and target overlap.
[0057] Example 2
[0058] Feature stripping and feature concentration in the sampling process are common problems in the effectiveness of feature extraction in target detection. The downsampling operation simplifies and reduces the image size. For an image of size M*N, downsampling is performed by a times to obtain a downsampled image of size (M / a)*(N / a). The downsampling method directly affects the efficiency of retaining key features after feature stripping. In different environmental backgrounds, the accuracy requirements for downsampling operations are different. If the environmental background in inland rivers and lakes is complex, the accuracy of feature stripping will be adjusted accordingly to meet the detection accuracy of model construction.
[0059] It should be noted that if the image data is in matrix form, the downsampling operation is performed by programming the image in the window a*a of the original image into a pixel, and the value of the pixel is the average value of all pixels in the window.
[0060] The downsampling multiple is calibrated as Sb, and the environmental complexity of inland rivers and lakes is Cr. The calculation expression of the downsampling floating scaling factor Fo is Fo=Sb*(1-Cr). The environmental complexity Cr of inland rivers and lakes is a parameter that characterizes the degree of environmental interference in the detection. It is calculated through water surface visibility, binary cut specific ratio and ship density. The calibrated water surface visibility, binary cut specific ratio and ship density are Vi, Cu and De respectively. The calculation expression is: Where α1, α2, and α3 are the proportional coefficients of water surface visibility, binary cut specific ratio, and ship density, respectively, and α1, α2, and α3 are all greater than 0. The environmental complexity Cr is in the range of (0, 1) after normalization.
[0061] Water surface visibility refers to the visibility at the sampling height of the surface detection of inland rivers and lakes, and is measured by optical or acoustic instruments. The binary cut specific ratio is the ratio of the number of potential analysis target pixels above the water body to the number of pixels in the water body in the collected image. The potential analysis targets above the water body are ships or parts of ships, as well as potential detection targets such as mountains and buildings. The image features of the water body are relatively uniform and obvious. The potential analysis part above the water body directly determines the load pressure of the detection model operation. De is the ship density, which is detected by radar or other forms of electromagnetic wave active observation instruments. The higher the ship density, the higher the requirements for the accuracy and efficiency of the model detection.
[0062] When using electromagnetic wave instruments to detect the density of ships, the relative displacement of ships may cause different ships to overlap and cover each other, which is a difficult detection situation. The principle of electromagnetic wave detection is to use the Doppler effect. The position information of the ship can be obtained by analyzing the spectrum frequency. The faster the relative movement of the ship, the higher the probability of entering the target overlapping and shielding state, and the greater the challenge of detecting and identifying the training model. When the bottom ship of the image is completely covered by the shallow ship of the image, it is almost impossible to accurately identify the covered ship from the perspective of image processing. In order to improve the accuracy and real-time performance of model detection, monitoring the feedback stability of the reflected electromagnetic wave can effectively ensure the model load pressure in the detection area. The acquisition method is as follows:
[0063] S1. Obtain a reasonable delay time range for electromagnetic wave feedback of the unmanned ship identification system, and mark the reasonable delay time range for electromagnetic wave feedback of the unmanned ship identification system as T1-T2;
[0064] It should be pointed out that by conducting electromagnetic wave scanning tests on the detection areas of inland rivers and lakes, after excluding non-potential detection targets such as mountains and buildings, the electromagnetic wave feedback delay time range of potential ship targets in the detection area is analyzed and limited to obtain the electromagnetic wave feedback delay time range of potential ship targets;
[0065] S2. Obtain the electromagnetic wave feedback delay time of each target that can be obtained in the detection area, and mark the electromagnetic wave feedback delay time of each target that can be obtained in the detection area as Mp, and p = {1, 2, 3 ... q}, where q is a positive integer;
[0066] S3, obtaining data of the electromagnetic wave feedback delay time of each target that can be obtained in the detection area exceeding the maximum value T2 of the reasonable electromagnetic wave feedback delay time, and calibrating the data of the electromagnetic wave feedback delay time of each target that can be obtained in the detection area exceeding the maximum value T2 of the reasonable electromagnetic wave feedback delay time as Gs, and s = P1,2,3...v}, where v is a positive integer;
[0067] S4. The expression for calculating the abnormal feedback frequency coefficient of the reflected wave is: In the formula is the average value of the electromagnetic wave feedback delay time Mp of each target that can be obtained in the detection area, that is,
[0068] The larger the abnormal feedback frequency coefficient of the reflected wave, the higher the detection difficulty.
[0069] The detection model is trained. After collecting image data, the data is divided into training set, validation set and test set. The training set helps the model learn the mapping rules from input to output so that the model can better fit the training data. The validation set is used to adjust the model's hyperparameters, such as learning rate, regularization coefficient, etc., and to evaluate the performance of the model under different hyperparameters. The test set is used to evaluate the performance of the model in real scenarios. By making predictions on the test set and comparing them with the real labels, the accuracy, recall rate and other indicators of the model on unknown data can be obtained.
[0070] The corrected recall and corrected precision of the test results are calculated according to the NWD threshold. The calculation expression of the corrected recall is: In the formula, P is the precision, and the calculation expression is Among them, N is the NWD threshold condition, N = 0.5:0.05:0.95 means that 11 values are isolated at 0.05 intervals, TP represents the number of correctly predicted positive samples, FP represents the number of incorrectly predicted positive samples, and the corrected accuracy is In the formula, R is the recall rate, and the calculation expression is Among them, FN represents the number of samples that are not correctly predicted as positive samples.
[0071] Calculate the correction efficiency index of the detection model. The calculation expression is Ef=Fo*(β1*Ce+β2*Ca) / Fb. Compare the calculated correction efficiency index of the model with the preset correction efficiency index threshold Et. If Ef is greater than or equal to Et, the correction effect meets the detection accuracy requirements under complex backgrounds. If Ef is less than Et, the correction effect is difficult to maintain the accuracy requirements for model detection under complex backgrounds.
[0072] When the model detection accuracy requirements under complex backgrounds are not met, a warning signal is issued to remind the staff to test and optimize the model. Otherwise, a stable signal is issued, indicating that no human intervention is required and the detection model is operating normally.
[0073] The present invention optimizes the YOLOv7 network, improves the original ELAN module into a DSConv-ELAN-REP module, replaces the IoU metric in the loss function with the NWD metric, thereby enhancing the target detection capability of the model. The downsampling scaling float is evaluated by the environmental background complexity and the downsampling multiple, the depth of feature stripping is tested, and the correction value of the recall rate and accuracy of the model test results under the influence of the NWD coefficient is combined to jointly evaluate the correction value and the feature stripping depth. When the evaluation result is lower than the preset value, an abnormal signal is sent to remind the staff to perform verification and optimization, which can effectively improve the target detection capability of the model and reduce the burden on the staff.
[0074] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.
[0075] The above embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented by software, the above embodiments can be implemented in whole or in part in the form of computer program goods. The computer program goods include one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired or wireless (e.g., infrared, wireless, electromagnetic waves, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media sets. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state hard disk.
[0076] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0077] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0078] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0079] If the functions are implemented in the form of software functional units and sold or used as independent goods, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of software goods, which are stored in a storage medium and include several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.
[0080] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. Unmanned ship recognition system based on improved YOLOv7 algorithm, It is characterized in that Including data capture module, intelligent learning module, analysis and verification module, and decision processing module: The data capture module is used to collect image data of ships in inland rivers and lakes, annotate images containing ships, and divide the data set into three categories: training set, validation set, and test set; The intelligent learning module is used to build a training model using the data set, optimize the traditional YOLOv7 algorithm framework, replace the ELAN module in the YOLOv7 algorithm structure with the DSConv-ELAN-REP module, and replace the IoU metric in the loss function with the NWD metric to evaluate the target detection performance of the optimized model; The analysis and verification module is used to measure the depth of feature stripping in downsampling due to the complexity of the environment background according to the product of the complexity of the environment background and the downsampling scaling factor in the training model, and to construct an evaluation model based on the feature stripping depth and the corrected output value of the training model to measure the correction efficiency of the training model; The decision processing module is used to compare the calculated correction efficiency performance with the preset threshold value, and output a status signal according to the comparison result to characterize the operation effectiveness of the target detection model; The method to measure the depth of feature stripping in downsampling by using the complexity of the environmental background is: The downsampling multiple is calibrated as Sb, and the environmental complexity of inland rivers and lakes is Cr. The calculation expression of the downsampling floating scaling factor Fo is: The environmental complexity of inland rivers and lakes, Cr, is a parameter that characterizes the degree of environmental interference in the detection. It is calculated through water surface visibility, binary cut specific ratio and ship density. The water surface visibility, binary cut specific ratio and ship density are calibrated as Vi, Cu and De respectively. The calculation expression is: , where are the proportionality coefficients of water surface visibility, binary cut-specific ratio and ship density, respectively, and are all greater than 0. The value range of the environmental complexity Cr after normalization is ; Water surface visibility is the visibility at the sampling height of the surface of inland rivers and lakes, which is measured by optical or acoustic instruments. The binary cut specific ratio is the ratio of the number of potential analysis target pixels above the water body to the number of pixels of the water body in the collected image. The potential analysis targets above the water body are ships or parts of ships, as well as potential detection targets such as mountains and buildings. The image features of the water body are relatively uniform and obvious. The potential analysis part above the water body directly determines the load pressure of the detection model operation. De is the ship density, which is detected by radar or other forms of microwave active observation instruments. The higher the ship density, the higher the accuracy and efficiency requirements for model detection. The logic of using the feature stripping depth and the corrected output value of the training model to evaluate the correction efficiency of the training model is: Calculate the corrected efficiency index of the training model. The calculation expression is: , compare the calculated correction efficiency index of the model with the preset correction efficiency index threshold Et. If Ef is greater than or equal to Et, the correction effect meets the detection accuracy requirements under complex backgrounds. If Ef is less than Et, the correction effect is difficult to maintain the accuracy requirements for model detection under complex backgrounds; The structure of the training model includes a backbone feature extraction network, a neck feature fusion network, and a detection head. The backbone extraction network includes a CBS convolution layer, an MP convolution layer, and an ELAN module. The neck feature fusion network includes CBS, SPPCSPC, MP-SimAM, VoV-GSCSP Block, and UP. The detection head outputs feature maps of different scales based on the anchor mechanism, uses the NWD loss function after adjusting the number of channels, and performs nonlinear maximum suppression processing. The logic of replacing the ELAN module with the DSConv-ELAN-REP module is: Based on the original ELAN structure, the distribution shift convolution is introduced to replace the CBS 3×3 convolution layer, and a residual branch is added between each DSConv to construct the DSConv-ELAN-REP module. DSConv decomposes the traditional convolution kernel into two components, including a variable quantization kernel and a distribution offset. The calculation process of DSConv is as follows: First, quantization is performed to approximate the weights of the convolution layer to the nearest integer and store them in the memory as integer values. Next, distribution displacement is performed to move the quantized weights to a position that matches the original weight tensor by calculating and adjusting the distribution of the quantized weights. Then, inference is performed to calculate the results using the integer values of the quantized weights and the input tensor to achieve fast calculation. Finally, after calculating all the convolution results of each convolution kernel, channel-level distribution displacement is applied.
2. According to the unmanned ship recognition system based on the improved YOLOv7 algorithm according to claim 1, It is characterized in that The logic of replacing the IoU metric in the loss function with the NWD metric is: By modeling the bounding box as a two-dimensional Gaussian distribution, NWD is used to measure the similarity of the derived Gaussian distribution. For a horizontal bounding box R=(cx, cy, w, h), where (cx, cy) is the center point coordinate, w and h are the width and height of the box, respectively, R is modeled as a Gaussian distribution N(μ, Σ), where ,and , use the Wasserstein distance method to calculate the distribution distance between two different bounding boxes. For bounding boxes R1(cx1,cy2,w1,h1) and R2(cx2,cy2,w2,h2), we have , the distance metric is converted into a similarity metric by normalization. The exponential form of is normalized, that is, , where C is a constant related to the image dataset.
3. The unmanned ship recognition system based on the improved YOLOv7 algorithm according to claim 1, It is characterized in that The calculation method for the corrected output value of the training model is: The corrected recall and corrected precision of the test results are calculated according to the NWD threshold. The calculation expression of the corrected recall is: , where P is the precision and the calculation expression is , where TP represents the number of correctly predicted positive samples, FP represents the number of incorrectly predicted positive samples, and the corrected accuracy is , where R is the recall rate and the calculation expression is , where FN represents the number of samples that are not correctly predicted as positive.
4. The unmanned ship recognition system based on the improved YOLOv7 algorithm according to claim 1, It is characterized in that The logic for classifying the training model operation status according to the evaluation of the correction efficiency of the training model is: When the model detection accuracy requirements under complex backgrounds are not met, a warning signal is issued to remind staff to inspect and optimize the model. When the accuracy requirements are met, a stable signal is issued, indicating that no human intervention is required and the detection model is operating normally.
