Multi-size target detection method, system and equipment based on YOLOV7 improvement and medium

By improving the network structure and loss function of the YOLOV7 model, the problem of YOLOV7's poor detection of micro-objects is solved, and the detection accuracy of micro-objects is significantly improved.

CN119516169AActive Publication Date: 2025-02-25ROCKETECH TECH CORP LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411587343.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-02-25
Estimated Expiration
2044-11-08

AI Technical Summary

Technical Problem

In the prior art, the YOLOV7 detection network has poor effect on detecting small targets with little pixel information.

Method used

By improving the Backbone network, Neck network and Head network of the YOLOV7 model, the micro-size target feature extraction capability is increased, and output branches are added to the Neck network and Head network, a hybrid border regression loss function based on the CIOU loss function and normalized Gaussian Wasserstein distance are adopted.

Benefits of technology

The detection accuracy and performance of the model for tiny targets is improved, especially when the targets are small and dense.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119516169A_ABST
    Figure CN119516169A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computer vision, provides a multi-size target detection method, system and device based on YOLOV7 improvement and a medium, and solves the technical problem that a YOLOV7 detection network in the prior art is poor in detection effect on a tiny target with little pixel information. The method comprises the following steps: constructing a multi-size target detection model based on YOLOV7 improvement; training the multi-size target detection model; and inputting a to-be-detected image into the trained multi-size target detection model, so that the multi-size target detection model outputs a target conforming to the size in the to-be-detected image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision technology, and in particular to a multi-size target detection method, system, device and medium based on an improvement of YOLOV7. Background Art

[0002] In recent years, the application of various intelligent devices combined with computer vision technology in modern agriculture has become increasingly popular in agricultural production and has become a research hotspot in the agricultural field. Specifically in apple production, deep learning target detection technology can be used to identify apples, predict yields, and identify pests and diseases through pictures or videos taken by cameras or drones. Apples can also be graded based on image information. These technologies have greatly promoted the intelligent development of apple production management. Among them, using target detection technology to accurately identify apples and then predict yields is of great significance to the operation and management of orchards, and can provide fruit farmers with information on orchard yields.

[0003] Traditional technologies used for crop yield estimation still have many problems to a certain extent, such as unclear image boundaries caused by sliding windows, complex target feature design, poor portability, and cumbersome manual design. Therefore, more and more deep learning-based target detection algorithms are applied to agricultural production. These algorithms can be roughly divided into single-stage and two-stage algorithms according to the algorithm implementation process. Classic two-stage target detection algorithms include R-CNN, Fast R-CNN, FasterR-CNN, etc. Compared with the two-stage algorithm, the single-stage algorithm has less redundant calculations, faster detection speed, and lower hardware performance requirements. Representative single-stage algorithms include YOLOV series, SSD, etc. The single-stage algorithm omits the step of generating candidate target areas and directly predicts the category or position of the target on the input image. The detection speed has been greatly improved, so it has been widely used in the agricultural field.

[0004] Most existing apple quantity detection methods are based on static images for experiments. However, in natural environments, when photographing apples, some detection target pixels are too small due to factors such as long shooting distance and occlusion by leaves, resulting in large differences in the scales of different targets. Although YOLOV7 has three detection heads to detect large, medium, and small targets respectively, the detection effect of these three detection heads alone is poor for small targets with little pixel information. Summary of the invention

[0005] The purpose of the present invention is to provide a multi-size target detection method, system, device and medium based on the improvement of YOLOV7, which is used to solve the technical problem in the prior art that the YOLOV7 detection network has poor detection effect on small targets with little pixel information.

[0006] To solve the above technical problems, as one aspect of the present invention, a multi-size target detection method based on an improvement of YOLOV7 is provided, comprising the following steps:

[0007] Construct a multi-size target detection model based on the improvement of YOLOV7; wherein the multi-size target detection model includes a Backbone network, a Neck network and a Head network; the Backbone network is used to extract features four times from the feature map input into the multi-size target detection model, the Neck network is used to fuse the features extracted four times by the Backbone network to form four fusion branches, and the four fusion branches are input into the Head network to detect four targets of different sizes, and the Head network outputs the detection results of four targets of different sizes;

[0008] Training the multi-scale object detection model;

[0009] Inputting the image to be detected into the trained multi-size object detection model, so that the multi-size object detection model outputs objects of the same size in the image to be detected;

[0010] Wherein, the Backbone network includes a CBS combination module, a first SIMAM combination module, a second SIMAM combination module, a third SIMAM combination module and a fourth SIMAM combination module in sequence;

[0011] The first SIMAM combination module includes an ELAN module and a SIMAM module in sequence for first feature extraction, and the features extracted by the first SIMAM combination module are respectively input into the second SIMAM combination module and the Neck network;

[0012] The second SIMAM combination module includes an MPConv module, an ELAN module and a SIMAM module in sequence for extracting features for the second time, and the features extracted by the second SIMAM combination module for the second time are respectively input into the third SIMAM combination module and the Neck network;

[0013] The third SIMAM combination module includes an MPConv module, an ELAN module and a SIMAM module in sequence for third feature extraction, and the features extracted for the third time by the third SIMAM combination module are respectively input into the fourth SIMAM combination module and the Neck network;

[0014] The fourth SIMAM combination module includes an MPConv module, an ELAN module, a SPPCSPC module and a SIMAM module in sequence for extracting features for the fourth time and inputting the extracted features into the Neck network;

[0015] Among them, the CBS combination module includes four different CBS modules, and the CBS module is used to change the size and number of feature maps; the ELAN module is an efficient layer aggregation network for multi-scale feature extraction and fusion of images; the SIMAM module is used to incorporate a three-dimensional attention mechanism when extracting features to improve the feature extraction capability of the multi-scale target detection model network, and the SIMAM modules in the four SIMAM combination modules all input the extracted features to the Neck network; the MPConv module is used to pool the feature maps; and the SPPCSPC module is used to extract features after being manifested in different sizes.

[0016] Furthermore, the loss function of the multi-scale object detection model is a hybrid border regression loss function based on the CIOU loss function and the normalized Gaussian Wasserstein distance.

[0017] Furthermore, the expression of the mixed border regression loss function lbox is:

[0018] lbox=λ*NWD+(1-λ)CIOU

[0019] Among them, λ is the weight factor and NWD is the normalized Gaussian Wasserstein distance.

[0020] Further, the Neck network includes 2 first CBS modules, 2 second CBS modules, 2 third CBS modules, 1 fourth CBS module, 3 upsampling modules, 6 Concat modules, 6 Concat-Conv modules and 3 MPConv modules;

[0021] Among them, the first CBS module, the second CBS module, the third CBS module and the fourth CBS module are four different CBS modules; the Concat module is used to perform feature fusion in the channel dimension; and the Concat-Conv module is used to extract and fuse multi-scale features of the image.

[0022] Further, the Head network includes a first size detection head, a second size detection head, a third size detection head and a fourth size detection head; wherein the first size>the second size>the third size>the fourth size;

[0023] The features extracted by the fourth SIMAM combination module are sequentially passed through the fourth CBS module, the first third CBS module, the first upsampling module, the first Concat module, the first Concat-Conv module, the second CBS module, the second upsampling module, the second Concat module, the second Concat-Conv module, the first CBS module, the third upsampling module, the third Concat module and the third Concat-Conv module; the features extracted by the third SIMAM combination module are passed through the second third CBS module and the first Concat module; the features extracted by the second SIMAM combination module are passed through the second second CBS module and the second Concat module; the features extracted by the first SIMAM combination module are passed through the second first CBS module and the third Concat module; the output of the third Concat-Conv module is used as the input of the first size detection head;

[0024] The output of the third Concat-Conv module is also sequentially passed through the first MPConv module, the fourth Concat module, the fourth Concat-Conv module, the second MPConv module, the fifth Concat module, the fifth Concat-Conv module, the third MPConv module, the sixth Concat module and the sixth Concat-Conv module; the output of the second Concat-Conv module is also used as the input of the fourth Concat module; the output of the first Concat-Conv module is also used as the input of the fifth Concat module; the output of the fourth CBS module is also used as the input of the sixth Concat module;

[0025] The output of the fourth Concat-Conv module is also used as the input of the second-size detection head; the output of the fifth Concat-Conv module is also used as the input of the third-size detection head; the output of the sixth Concat-Conv module is used as the input of the fourth-size detection head.

[0026] Furthermore, the Head network also includes four RepConv modules, which are re-parameterized convolution modules for re-parameterizing the Head network; wherein, the output of the third Concat-Conv module is used as the input of the first RepConv module, and the output of the first RepConv module is used as the input of the first size detection head; the output of the fourth Concat-Conv module is used as the input of the second RepConv module, and the output of the second RepConv module is used as the input of the second size detection head; the output of the fifth Concat-Conv module is used as the input of the third RepConv module, and the output of the third RepConv module is used as the input of the third size detection head; the output of the sixth Concat-Conv module is used as the input of the fourth RepConv module, and the output of the fourth RepConv module is used as the input of the fourth size detection head.

[0027] Further, the CBS combination module includes a fifth CBS module, a sixth CBS module, a seventh CBS module and an eighth CBS module; the feature map input to the multi-size target detection model passes through the fifth CBS module, the sixth CBS module, the seventh CBS module and the eighth CBS module in sequence;

[0028] Among them, the first CBS module is a two-dimensional convolution with a step size of 1 and a convolution kernel size of 1X1, and the number of output feature maps is 64; the second CBS module is a two-dimensional convolution with a step size of 1 and a convolution kernel size of 1X1, and the number of output feature maps is 128; the third CBS module is a two-dimensional convolution with a step size of 1 and a convolution kernel size of 1X1, and the number of output feature maps is 256; the fourth CBS module is a two-dimensional convolution with a step size of 1 and a convolution kernel size of 1X1, and the number of output feature maps is 5 12; the fifth CBS module is a two-dimensional convolution with a stride of 1 and a convolution kernel size of 3X3, and the number of output feature maps is 32; the sixth CBS module is a two-dimensional convolution with a stride of 2 and a convolution kernel size of 3X3, and the number of output feature maps is 64; the seventh CBS module is a two-dimensional convolution with a stride of 1 and a convolution kernel size of 3X3, and the number of output feature maps is 64; the eighth CBS module is a two-dimensional convolution with a stride of 2 and a convolution kernel size of 3X3, and the number of output feature maps is 128.

[0029] As a second aspect of the present invention, a multi-size target detection system based on an improvement of YOLOV7 is provided, comprising:

[0030] A construction module is used to construct a multi-size target detection model based on the improvement of YOLOV7; wherein the multi-size target detection model includes a Backbone network, a Neck network and a Head network; the Backbone network is used to extract features four times from the feature map input into the multi-size target detection model, the Neck network is used to fuse the features extracted four times by the Backbone network to form four fusion branches, and the four fusion branches are input into the Head network to detect four targets of different sizes, and the Head network outputs the detection results of four targets of different sizes;

[0031] A training module, used for training the multi-size object detection model;

[0032] A detection module, used for inputting the image to be detected into the trained multi-size target detection model, so that the multi-size target detection model outputs targets of the same size in the image to be detected;

[0033] Wherein, the Backbone network includes a CBS combination module, a first SIMAM combination module, a second SIMAM combination module, a third SIMAM combination module and a fourth SIMAM combination module in sequence;

[0034] The first SIMAM combination module includes an ELAN module and a SIMAM module in sequence for first feature extraction, and the features extracted by the first SIMAM combination module are respectively input into the second SIMAM combination module and the Neck network;

[0035] The second SIMAM combination module includes an MPConv module, an ELAN module and a SIMAM module in sequence for extracting features for the second time, and the features extracted by the second SIMAM combination module for the second time are respectively input into the third SIMAM combination module and the Neck network;

[0036] The third SIMAM combination module includes an MPConv module, an ELAN module and a SIMAM module in sequence for third feature extraction, and the features extracted for the third time by the third SIMAM combination module are respectively input into the fourth SIMAM combination module and the Neck network;

[0037] The fourth SIMAM combination module includes an MPConv module, an ELAN module, a SPPCSPC module and a SIMAM module in sequence for extracting features for the fourth time and inputting the extracted features into the Neck network;

[0038] Among them, the CBS combination module includes four different CBS modules, and the CBS module is used to change the size and number of feature maps; the ELAN module is an efficient layer aggregation network for multi-scale feature extraction and fusion of images; the SIMAM module is used to incorporate a three-dimensional attention mechanism when extracting features to improve the feature extraction capability of the multi-scale target detection model network, and the SIMAM modules in the four SIMAM combination modules all input the extracted features to the Neck network; the MPConv module is used to pool the feature maps; and the SPPCSPC module is used to extract features after being manifested in different sizes.

[0039] As a third aspect of the present invention, there is provided an electronic device, comprising:

[0040] one or more processors;

[0041] A storage device for storing one or more programs;

[0042] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in the first aspect above.

[0043] As a fourth aspect of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method described in the first aspect is implemented.

[0044] The beneficial effects of the present invention are:

[0045] The present invention makes corresponding improvements to the Backbone network, Neck network and Head network of the YOLOV7 model in view of the characteristics that the detection targets are small and dense; the Backbone network adds feature extraction of tiny-size targets, that is, outputs four scale feature maps, and adds a three-dimensional attention mechanism SimAM in the four-scale feature extraction process to improve the feature extraction ability of the network, and adds output branches to the Neck network and the Head network, thereby solving the technical problem in the prior art that the YOLOV7 detection network has poor detection effect on tiny targets with little pixel information. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 The figure schematically shows a step diagram of a multi-scale target detection method improved based on YOLOV7.

[0047] Figure 2 The structural diagram of the improved multi-scale object detection model based on YOLOV7 is schematically shown.

[0048] Figure 3 for Figure 2 CBS module structure diagram.

[0049] Figure 4 for Figure 2 ELAN module structure diagram.

[0050] Figure 5 for Figure 2 Figure 2. The MPConv module structure diagram.

[0051] Figure 6 for Figure 2 SPC module structure diagram.

[0052] Figure 7 for Figure 2 Concat-Conv module structure diagram.

[0053] Figure 8 A block diagram of a multi-scale object detection system improved based on YOLOV7 is schematically shown.

[0054] Fig. 9 A block diagram of an electronic device is schematically shown.

[0055] Fig.10 A block diagram of a computer-readable medium is schematically shown. DETAILED DESCRIPTION

[0056] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this application will be comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.

[0057] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.

[0058] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0059] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0060] It should be understood that although the terms first, second, third, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one component from another component. Therefore, the first component discussed below can be referred to as the second component without departing from the teachings of the concepts of the present application. As used herein, the term "and / or" includes any one of the associated listed items and all combinations of one or more.

[0061] Those skilled in the art will appreciate that the drawings are merely schematic diagrams of example embodiments, and the modules or processes in the drawings are not necessarily necessary for implementing the present application, and therefore cannot be used to limit the scope of protection of the present application.

[0062] According to the first specific embodiment of the present invention, Figure 1 As shown, the present invention provides a multi-size target detection method based on YOLOV7 improvement, comprising the following steps:

[0063] S11, build a multi-size target detection model based on the improved YOLOV7.

[0064] Figure 2 The constellation configuration diagram of the multi-scale target detection model improved based on YOLOV7 is schematically shown. Figure 2 As shown, the multi-size target detection model includes a Backbone network, a Neck network and a Head network. The Backbone network is used to extract features four times from the feature map input into the multi-size target detection model, the Neck network is used to fuse the features extracted four times by the Backbone network to form four fusion branches, and the four fusion branches are input into the Head network to detect four targets of different sizes, and the Head network outputs the detection results of four targets of different sizes.

[0065] Please refer to Figure 2 and Figure 3 , Figure 3 for Figure 2 The CBS module structure diagram is shown in Figure 1. Figure 2 and Figure 3As shown in the figure, the CBS combination module includes four different CBS modules. The CBS module is used to change the size and number of feature maps. Multiple CBS modules can be superimposed or matched with other modules to achieve the purpose of feature extraction and feature fusion. The CBS module is composed of a two-dimensional convolution layer Conv, a batch normalization layer BN and an activation function layer SiLU connected in sequence.

[0066] like Figure 2 As shown, the CBS combination module includes a fifth CBS module, a sixth CBS module, a seventh CBS module and an eighth CBS module connected in sequence. Among them, the fifth CBS module is a two-dimensional convolution with a step size of 1 and a convolution kernel size of 3X3, and the number of feature maps output is 32; the sixth CBS module is a two-dimensional convolution with a step size of 2 and a convolution kernel size of 3X3, and the number of feature maps output is 64; the seventh CBS module is a two-dimensional convolution with a step size of 1 and a convolution kernel size of 3X3, and the number of feature maps output is 64; the eighth CBS module is a two-dimensional convolution with a step size of 2 and a convolution kernel size of 3X3, and the number of feature maps output is 128.

[0067] Assume that the image size of the input multi-scale object detection model is H*W*C, where H represents length, W represents width, and C represents the number of channels. Figure 2 As shown in the figure, if the size of the input image is 640*640*3, the size of the feature map after the CBS combination module becomes 160*160*128.

[0068] Continue to refer Figure 2 The feature graph after the CBS combination module enters the first SIMAM combination module, which is used to perform the first feature extraction on the input feature graph. The features extracted by the first SIMAM combination module are respectively input into the second SIMAM combination module and the Neck network. Figure 2 As shown, the first SIMAM combination module includes an ELAN module and a SIMAM module in sequence.

[0069] The ELAN module is an efficient layer aggregation network that extracts and fuses multi-scale features from images. Figure 4 , Figure 4 for Figure 2 The ELAN module aggregates features at four different levels to better capture multi-scale information. The ELAN module consists of four branches, such as Figure 4As shown in the figure, the first branch and the fourth branch have been operated by one CBS module, the second branch has been operated by five CBS modules in succession, and the third branch has been operated by three CBS modules in succession. The outputs of these four branches are then operated by the Concat module, that is, the features of the outputs of these four branches are fused in the channel dimension, and finally passed through a CBS module, thus completing the operation of the ELAN module. Figure 2 As shown in the figure, the improved multi-size target detection model based on YOLOV7 uses 4 ELAN modules, and the parameters of the CBS module in each ELAN module are different.

[0070] like Figure 2 As shown, the first SIMAM combination also includes a SIMAM module, and the feature map after passing through the CBS combination module enters the SIMAM module after passing through the ELAN module. The SIMAM module is used to incorporate a three-dimensional attention mechanism when extracting features to improve the feature extraction capability of the multi-size target detection model network, and the SIMAM modules in the four SIMAM combination modules all input the extracted features to the Neck network.

[0071] The SIMAM module is inspired by neuroscience: neurons that contain more information often behave differently from surrounding neurons, so an energy function e is proposed to measure the importance of each neuron. The smaller the energy function value e, the more important the information contained in the neuron, and the higher its weight should be.

[0072] According to research in visual neuroscience, the most informative neurons are usually those that show significantly different activation patterns from surrounding neurons. In addition, an active neuron can also inhibit the activity of surrounding neurons, a phenomenon known as spatial inhibition. In order to calculate the importance of each neuron, the following energy function is defined:

[0073]

[0074] Among them, e t represents the neuron energy function, and is t and x i The linear transformation of w t and b t Respectively refer to the weight and bias of a neuron when it is transformed. t and x i They refer to the target neuron and other neurons in a single channel of the input feature X, respectively. i is the index in the spatial dimension, and M is the number of neurons in a channel. y represents a constant value, y t and oare two different constant values ​​used to simplify the calculation. By minimizing this energy function, the linear separability between the target neuron t and other neurons in the same channel can be found. In order to simplify the calculation, the regularization term λ is introduced, and the final energy function is as follows:

[0075]

[0076] In theory, for each channel, there are M energy functions to be solved. However, with some assumptions, the mean and variance can be calculated for all neurons in the channel and reused, thus avoiding the computational cost of iteratively calculating the mean and variance for each position. Therefore, the minimum energy can be calculated by the following formula:

[0077]

[0078] in, and are the mean and variance calculated on all neurons in the channel, Represents the minimum value of the energy function. The lower the energy value, the greater the difference between neuron t and surrounding neurons, and the higher its importance. According to the definition of the attention mechanism, the SIMAM module can be expressed by the following formula:

[0079]

[0080] in, is the output of the SIMAM module, X is the input of the SIMAM module, and E is all Grouped on the channel and spatial dimensions, sigmoid is used to limit values ​​in e that are too large.

[0081] like Figure 2 As shown in Figure 1, if the size of the input image is 640*640*3, the size of the feature map after passing through the CBS combination module becomes 160*160*128, and the size of the feature map after passing through the SIMAM module in the first SIMAM combination is 160*160*256. The feature map after passing through the SIMAM module in the first SIMAM combination has two directional outputs, such as Figure 2 As shown, one is to input the feature map to the Neck network, and the other is to input the feature map to the second SIMAM combination.

[0082] Continue to refer Figure 2 The second SIMAM combination module includes an MPConv module, an ELAN module and a SIMAM module in sequence for extracting features for the second time. The features extracted by the second SIMAM combination module for the second time are respectively input into the third SIMAM combination module and the Neck network. Figure 2As shown, compared with the first SIMAM combination module, the second SIMAM combination module has an additional MPConv module.

[0083] The MPConv module is used to pool the feature map. Figure 5 , Figure 5 for Figure 2 The MPConv module structure diagram is shown in Figure 2. Figure 5 As shown in the figure, the MPConv module consists of two branches: the first branch first passes through a maximum pooling layer Maxpoolk2 (k2 means the pooling kernel size is (2*2), and the step size is 2), and then passes through a 1*1 convolution module to adjust the output feature dimension; the second branch first passes through a 1*1 convolution module to adjust the feature dimension, and then passes through a 3*3 convolution module with a step size of 2 to achieve down sampling; finally, the results of the first branch and the second branch are spliced ​​together to obtain the final output of the MPConv module.

[0084] The features extracted by the first SIMAM combination module will pass through the MPConv module, ELAN module and SIMAM module in the second SIMAM combination module in sequence. Since the structures of the ELAN module and the SIMAM module have been described in the relevant paragraphs of the first SIMAM combination module, they will not be repeated for the sake of brevity.

[0085] like Figure 2 As shown in Figure 1, if the size of the input image is 640*640*3, the size of the feature map after passing through the CBS combination module becomes 160*160*128, and the size of the feature map after passing through the SIMAM module in the first SIMAM combination is 160*160*256, and the size of the feature map after passing through the SIMAM module in the second SIMAM combination is 80*80*512. The feature map after passing through the SIMAM module in the second SIMAM combination has two directional outputs, such as Figure 2 As shown, one is to input the feature map to the Neck network, and the other is to input the feature map to the third SIMAM combination.

[0086] Continue to refer Figure 2 The third SIMAM combination module includes an MPConv module, an ELAN module and a SIMAM module in sequence for the third feature extraction, and the features extracted for the third time by the third SIMAM combination module are respectively input into the fourth SIMAM combination module and the Neck network.

[0087] The features extracted by the second SIMAM combination module for the second time will pass through the MPConv module, ELAN module and SIMAM module in the third SIMAM combination module in sequence. Since the structures of the MPConv module, ELAN module and SIMAM module have been described in the relevant paragraphs of the first SIMAM combination module and the second SIMAM combination module, they will not be repeated for the sake of brevity.

[0088] like Figure 2 As shown, if the size of the input image is 640*640*3, the size of the feature map after passing through the CBS combination module becomes 160*160*128, and the size of the feature map after passing through the SIMAM module in the first SIMAM combination is 160*160*256, and the size of the feature map after passing through the SIMAM module in the second SIMAM combination is 80*80*512, and the size of the feature map after passing through the SIMAM module in the third SIMAM combination is 40*40*1024. The feature map after passing through the SIMAM module in the third SIMAM combination has two directional outputs, such as Figure 2 As shown, one is to input the feature map to the Neck network, and the other is to input the feature map to the fourth SIMAM combination.

[0089] Continue to refer Figure 2 , the fourth SIMAM combination module includes MPConv module, ELAN module, SPPCSPC module and SIMAM module in sequence for extracting features for the fourth time and inputting the extracted features into the Neck network. The features extracted for the third time by the third SIMAM combination module will pass through the MPConv module, ELAN module, SPPCSPC module and SIMAM module in the fourth SIMAM combination module in sequence. Since the structures of the MPConv module, ELAN module and SIMAM module have been described in the relevant paragraphs of the first SIMAM combination module and the second SIMAM combination module, they will not be repeated for the sake of brevity of the specification.

[0090] Among them, the SPPCSPC module is used to extract features after manifestation at different sizes. Please refer to Figure 6 , Figure 6 for Figure 2 SPC module structure diagram. Figure 6As shown in the figure, the SPPCSPC module consists of 7 CBS modules (the number of feature maps output by each CBS module is 512, but the size of the 2D convolution kernel and the convolution step size are different) and 3 maximum pooling layers (Maxpool k5, Maxpoolk9, Maxpool k13). The step size of the 3 maximum pooling layers is 1, the size of the pooling kernel of the maximum pooling layer Maxpool k5 is 5*5, the size of the pooling kernel of the maximum pooling layer Maxpool k9 is 9*9, and the size of the pooling kernel of the maximum pooling layer Maxpool k13 is 13*13.

[0091] like Figure 6 As shown in the figure, the SPPCSPC module divides the input into two branches, one of which performs feature extraction, and then passes through the feature pyramid and performs maximum pooling on features of different sizes, visualizes the extracted feature information and concatenates the result with the feature map that has not been pooled through the feature pyramid (that is, the other branch). Through this operation, the network can extract features of different sizes after visualization without losing the information of the original feature map, so as to achieve the effect of improving the detection accuracy.

[0092] like Figure 2 As shown, if the size of the input image is 640*640*3, the size of the feature map after passing through the CBS combination module becomes 160*160*128, and the size of the feature map after passing through the SIMAM module in the first SIMAM combination is 160*160*256, and the size of the feature map after passing through the SIMAM module in the second SIMAM combination is 80*80*512, and the size of the feature map after passing through the SIMAM module in the third SIMAM combination is 40*40*1024, and the size of the feature map after passing through the SIMAM module in the fourth SIMAM combination is 20*20*512. The feature map after passing through the SIMAM module in the fourth SIMAM combination is input into the Neck network.

[0093] Continue to refer Figure 2 , the four feature maps P1-P4 output by the BackBone network will enter the Neck network to fuse the top and bottom features from top to bottom, obtain four sets of fusion feature results and input them to the Head network. Figure 2 As shown, the Neck network includes 2 first CBS modules, 2 second CBS modules, 2 third CBS modules, 1 fourth CBS module, 3 upsampling modules, 6 Concat modules, 6 Concat-Conv modules and 3 MPConv modules.

[0094] Among them, the first CBS module, the second CBS module, the third CBS module and the fourth CBS module are four different CBS modules. The first CBS module is a two-dimensional convolution with a step size of 1 and a convolution kernel size of 1X1, and the number of feature maps output is 64; the second CBS module is a two-dimensional convolution with a step size of 1 and a convolution kernel size of 1X1, and the number of feature maps output is 128; the third CBS module is a two-dimensional convolution with a step size of 1 and a convolution kernel size of 1X1, and the number of feature maps output is 256; the fourth CBS module is a two-dimensional convolution with a step size of 1 and a convolution kernel size of 1X1, and the number of feature maps output is 512.

[0095] The Concat module is used to perform feature fusion in the channel dimension. The Concat-Conv module is used to extract and fuse multi-scale features of the image. Figure 7 , Figure 7 for Figure 2 The Concat-Conv module structure diagram in Figure 2. Figure 7 As shown in the figure, the Concat-Conv module aggregates features at 6 different levels to better capture multi-scale information. The Concat-Conv module includes 6 branches. The first and sixth branches have been operated by 1 CBS module, the second branch has been operated by 5 CBS modules in succession, the third branch has been operated by 4 CBS modules in succession, the fourth branch has been operated by 3 CBS modules in succession, and the fifth branch has been operated by 2 CBS modules in succession. The outputs of these 6 branches are then operated by the Concat module, that is, the features of the outputs of these 6 branches are fused in the channel dimension, and finally passed through a CBS module, thus completing the operation of the Concat-Conv module.

[0096] like Figure 2As shown, the Head network includes a first size detection head, a second size detection head, a third size detection head and a fourth size detection head; wherein, the first size> the second size> the third size> the fourth size. The features extracted by the fourth SIMAM combination module are sequentially passed through the fourth CBS module, the first third CBS module, the first upsampling module, the first Concat module, the first Concat-Conv module, the second CBS module, the second upsampling module, the second Concat module, the second Concat-Conv module, the first CBS module, the third upsampling module, the third Concat module and the third Concat-Conv module; the features extracted by the third SIMAM combination module are passed through the second third CBS module and the first Concat module; the features extracted by the second SIMAM combination module are passed through the second second CBS module and the second Concat module; the features extracted by the first SIMAM combination module are passed through the second first CBS module and the third Concat module; the output of the third Concat-Conv module is used as the input of the first size detection head.

[0097] The output of the third Concat-Conv module also passes through the first MPConv module, the fourth Concat module, the fourth Concat-Conv module, the second MPConv module, the fifth Concat module, the fifth Concat-Conv module, the third MPConv module, the sixth Concat module and the sixth Concat-Conv module in sequence; the output of the second Concat-Conv module is also used as the input of the fourth Concat module; the output of the first Concat-Conv module is also used as the input of the fifth Concat module; the output of the fourth CBS module is also used as the input of the sixth Concat module.

[0098] The output of the fourth Concat-Conv module is also used as the input of the second-size detection head; the output of the fifth Concat-Conv module is also used as the input of the third-size detection head; the output of the sixth Concat-Conv module is used as the input of the fourth-size detection head.

[0099] The Head network also includes four RepConv modules, which are re-parameterized convolution modules. Their function is to re-parameterize the network to reduce the computational complexity of the model and improve the model performance. Among them, the output of the third Concat-Conv module is used as the input of the first RepConv module, and the output of the first RepConv module is used as the input of the first-size detection head; the output of the fourth Concat-Conv module is used as the input of the second RepConv module, and the output of the second RepConv module is used as the input of the second-size detection head; the output of the fifth Concat-Conv module is used as the input of the third RepConv module, and the output of the third RepConv module is used as the input of the third-size detection head; the output of the sixth Concat-Conv module is used as the input of the fourth RepConv module, and the output of the fourth RepConv module is used as the input of the fourth-size detection head.

[0100] Optionally, the loss function of the improved multi-size object detection model based on YOLOV7 is a hybrid bounding box regression loss function based on the CIOU loss function and the normalized Gaussian Wasserstein distance.

[0101] YOLOV7 in the prior art uses CIOU as the bounding box regression loss function. However, the single CIOU is too sensitive to the change of the pixel position of small targets, which will cause the model's small target detection performance to drop rapidly. In contrast, the normalized Wasserstein distance (Normalized Wasserstein Distance, NWD) is smoother to the change of position offset, and NWD can measure the similarity between non-overlapping or overlapping small bounding boxes.

[0102] The bounding box is modeled as a Gaussian distribution as follows: To determine a bounding box, we need to know the coordinates of its center point (c x ,c y ), width (w) and height (h). Any horizontal bounding box R = (c x ,c y ,w,h), the equation of the inscribed ellipse can be expressed as:

[0103]

[0104] The probability density function of the two-dimensional Gaussian distribution is as follows:

[0105]

[0106] Where x is the coordinate of the two-dimensional Gaussian distribution, Σ is the covariance matrix, and μ is the mean vector. When , the inscribed ellipse of any bounding box R is the density contour of the two-dimensional Gaussian distribution, so the bounding box R = (c x ,c y ,w,h), can be modeled as a Gaussian distribution At this point, the similarity between the two bounding boxes can be converted into the distribution distance between the Gaussian distributions corresponding to the two bounding boxes. The normalized Wasserstein distance is used as the distance between the two Gaussian distributions. In the actual detection task, the Gaussian distribution corresponding to the predicted box P and the true box T is P~N(μ P ,∑ P ),T~N(μ T ,∑ T ). The Wasserstein distance between these two Gaussian distributions is defined as follows:

[0107]

[0108] When the covariance matrix satisfies the transformation:∑ P ∑ T =∑ T Σ P When P=(c xP ,c yP ,w P ,h p ), T=(c xT ,c yT ,w T ,h T ) into the formula, we get the following formula:

[0109]

[0110] Because the Wasserstein distance is a distance metric and cannot be directly used to measure the similarity between bounding boxes, it will make it difficult for the loss function to converge. Therefore, the Wasserstein distance is normalized:

[0111]

[0112] Where C is a constant that is closely related to the training data set. For example, in the apple detection task, the empirical value can be 12.8. After obtaining NWD, multiply it by the weight factor λ and add it to CIOU to obtain the new bounding box regression loss function:

[0113] lbox=λ*NWD+(1-λ)CIOU

[0114] If the proportion of small targets in the task is large, the weight λ of NWD can be increased accordingly. For example, the weight λ of the apple detection task can be 0.5.

[0115] like Figure 2As shown, if the size of the input image is 640*640*3, the size of the feature map after the CBS combination module becomes 160*160*128, and the size of the feature map after the SIMAM module in the first SIMAM combination is 160*160*256, and the size of the feature map after the SIMAM module in the second SIMAM combination is 80*80*512, and the size of the feature map after the SIMAM module in the third SIMAM combination is 40*40*1024, and the size of the feature map after the SIMAM module in the fourth SIMAM combination is 20*20*512, and the feature map after the SIMAM module in the fourth SIMAM combination is input to the Neck network. The Neck network fuses the top and bottom features from top to bottom, obtains four sets of fused feature results and inputs them to the Head network. Among them, the feature map size input by the Neck network to the first size detection head is 160*160*64, and the feature map size output by the first size detection head is 160*160; the feature map size input by the Neck network to the second size detection head is 80*80*128, and the feature map size output by the second size detection head is 80*80; the feature map size input by the Neck network to the third size detection head is 40*40*256, and the feature map size output by the third size detection head is 40*40; the feature map size input by the Neck network to the fourth size detection head is 20*20*512, and the feature map size output by the fourth size detection head is 20*20.

[0116] After completing the construction of the multi-size target detection model improved based on YOLOV7, execute step S12.

[0117] S12, training the multi-scale object detection model.

[0118] S13, inputting the image to be detected into the trained multi-size target detection model, so that the multi-size target detection model outputs targets of the same size in the image to be detected.

[0119] After building a multi-size target detection model based on YOLOV7, establish an image data training set and a validation set, input the image data training set into the multi-size target detection model based on YOLOV7 for training, and detect the validation set and output the multi-size target detection results. The multi-size target detection model after training is used to perform multi-size target detection on the image to be detected.

[0120] In order to verify the impact of each improved part on the model performance, the original YOLOV7 is used as the baseline model, and the improved parts are added in turn. Ablation experiments are performed on the Apple (self-made Apple dataset) and Drone (public dataset) datasets, and the results are detailed in Table 1. Among them, method A means that the SimAM attention mechanism is integrated into the feature extraction stage, method B means adding an additional small target detection head, and method C means adding NWD loss to the original border loss of the network. It can be seen from Table 1 that the methods proposed in this paper all improve the detection ability of the model, especially method C improves the detection ability of the model without increasing any network parameters. Therefore, it fully proves the effectiveness of NWD loss for small object detection. After the improvement, the mAP@0.5 of the improved network on the Apple dataset increased by 1.61%, and the map@0.5 on the Drone dataset increased by 3.95%, and the improvement effect is obvious.

[0121] Table 1

[0122]

[0123] This application makes corresponding improvements to the Backbone module, Head module and border loss function of the existing YOLOV7 model based on the characteristics of small and dense detection targets; the three-dimensional attention mechanism SimAM is added to the four scale feature maps output by BackBone to improve the feature extraction ability of the network, and an additional small target detection head is added to the Head module to improve the regression accuracy of the algorithm for small targets; a hybrid border loss based on CIoU and Wasserstein distance is used to replace the original IoU-based border loss, which solves the technical problem in the prior art that the YOLOV7 detection network has poor detection effect on small targets with little pixel information.

[0124] According to a second specific embodiment of the present invention, the present invention provides a multi-size target detection system based on an improvement of YOLOV7, using the method of the first specific embodiment, such as Figure 8 As shown, the multi-size target detection system 400 based on the improvement of YOLOV7 includes:

[0125] A construction module 410 is used to construct a multi-size target detection model based on the improvement of YOLOV7; wherein the multi-size target detection model includes a Backbone network, a Neck network and a Head network; the Backbone network is used to extract features four times from the feature map input into the multi-size target detection model, the Neck network is used to fuse the features extracted four times by the Backbone network to form four fusion branches, and the four fusion branches are input into the Head network to detect four targets of different sizes, and the Head network outputs the detection results of four targets of different sizes;

[0126] A training module 420, configured to train the multi-scale object detection model;

[0127] A detection module 430 is used to input the image to be detected into the trained multi-size object detection model, so that the multi-size object detection model outputs objects of the same size in the image to be detected;

[0128] Wherein, the Backbone network includes a CBS combination module, a first SIMAM combination module, a second SIMAM combination module, a third SIMAM combination module and a fourth SIMAM combination module in sequence;

[0129] The first SIMAM combination module includes an ELAN module and a SIMAM module in sequence for first feature extraction, and the features extracted by the first SIMAM combination module are respectively input into the second SIMAM combination module and the Neck network;

[0130] The second SIMAM combination module includes an MPConv module, an ELAN module and a SIMAM module in sequence for extracting features for the second time, and the features extracted by the second SIMAM combination module for the second time are respectively input into the third SIMAM combination module and the Neck network;

[0131] The third SIMAM combination module includes an MPConv module, an ELAN module and a SIMAM module in sequence for third feature extraction, and the features extracted for the third time by the third SIMAM combination module are respectively input into the fourth SIMAM combination module and the Neck network;

[0132] The fourth SIMAM combination module includes an MPConv module, an ELAN module, a SPPCSPC module and a SIMAM module in sequence for extracting features for the fourth time and inputting the extracted features into the Neck network;

[0133] Among them, the CBS combination module includes four different CBS modules, and the CBS module is used to change the size and number of feature maps; the ELAN module is an efficient layer aggregation network for multi-scale feature extraction and fusion of images; the SIMAM module is used to incorporate a three-dimensional attention mechanism when extracting features to improve the feature extraction capability of the multi-scale target detection model network, and the SIMAM modules in the four SIMAM combination modules all input the extracted features to the Neck network; the MPConv module is used to pool the feature maps; and the SPPCSPC module is used to extract features after being manifested in different sizes.

[0134] According to a third specific embodiment of the present invention, the present invention provides an electronic device, such as Fig. 9 As shown, Fig. 9 It is a block diagram of an electronic device according to an exemplary embodiment.

[0135] Refer to the following Fig. 9 The electronic device 200 according to this embodiment of the present application is described. Fig. 9 The electronic device 200 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0136] like Fig. 9 As shown, the electronic device 200 is in the form of a general computing device. The components of the electronic device 200 may include, but are not limited to: at least one processing unit 210, at least one storage unit 220, a bus 230 connecting different system components (including the storage unit 220 and the processing unit 210), a display unit 240, etc.

[0137] The storage unit stores a program code, which can be executed by the processing unit 210, so that the processing unit 210 performs the steps described in this specification according to various exemplary embodiments of the present application. For example, the processing unit 210 can perform the following steps: Figure 1 Follow the steps shown in .

[0138] The storage unit 220 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 2201 and / or a cache memory unit 2202 , and may further include a read-only memory unit (ROM) 2203 .

[0139] The storage unit 220 may also include a program / utility 2204 having a set (at least one) of program modules 2205, such program modules 2205 including but not limited to: an operating system, one or more application programs, other program modules and program data, each of which or some combination may include the implementation of a network environment.

[0140] Bus 230 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0141] The electronic device 200 may also communicate with one or more external devices 200' (e.g., keyboards, pointing devices, Bluetooth devices, etc.) to enable a user to communicate with the electronic device 200, and / or any device (e.g., routers, modems, etc.) that the electronic device 200 can communicate with one or more other computing devices. Such communication may be performed via an input / output (I / O) interface 250. In addition, the electronic device 200 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 260. The network adapter 260 may communicate with other modules of the electronic device 200 via the bus 230. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0142] Through the description of the above implementations, those skilled in the art can easily understand that the example implementations described here can be implemented by software, or by combining software with necessary hardware.

[0143] Therefore, according to a fourth specific embodiment of the present invention, the present invention provides a computer readable medium. Fig.10 As shown, the technical solution according to the embodiment of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes a number of instructions to enable a computing device (which can be a personal computer, a server, or a network device, etc.) to execute the above method according to the embodiment of the present invention.

[0144] The software product may be any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0145] The computer readable storage medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by an instruction execution system, an apparatus, or a device or used in combination with it. The program code contained on the readable storage medium may be transmitted with any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.

[0146] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0147] The computer-readable medium carries one or more programs. When the one or more programs are executed by a device, the computer-readable medium implements the functions of the first embodiment.

[0148] Those skilled in the art will appreciate that the above modules can be distributed in the device according to the description of the embodiment, or can be changed accordingly and only used in one or more devices different from the embodiment. The modules of the above embodiments can be combined into one module, or further divided into multiple sub-modules.

[0149] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiment of the present invention.

[0150] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A multi-size target detection method based on YOLOV7 improvement, characterized in that: The following steps are involved: Construct a multi-size target detection model based on the improvement of YOLOV7; wherein the multi-size target detection model includes a Backbone network, a Neck network and a Head network; the Backbone network is used to extract features four times from the feature map input into the multi-size target detection model, the Neck network is used to fuse the features extracted four times by the Backbone network to form four fusion branches, and the four fusion branches are input into the Head network to detect four targets of different sizes, and the Head network outputs the detection results of four targets of different sizes; Training the multi-scale object detection model; Inputting the image to be detected into the trained multi-size object detection model, so that the multi-size object detection model outputs objects of the same size in the image to be detected; Wherein, the Backbone network includes a CBS combination module, a first SIMAM combination module, a second SIMAM combination module, a third SIMAM combination module and a fourth SIMAM combination module in sequence; The first SIMAM combination module includes an ELAN module and a SIMAM module in sequence for first feature extraction, and the features extracted by the first SIMAM combination module are respectively input into the second SIMAM combination module and the Neck network; The second SIMAM combination module includes an MPConv module, an ELAN module and a SIMAM module in sequence for extracting features for the second time, and the features extracted by the second SIMAM combination module for the second time are respectively input into the third SIMAM combination module and the Neck network; The third SIMAM combination module includes an MPConv module, an ELAN module and a SIMAM module in sequence for third feature extraction, and the features extracted for the third time by the third SIMAM combination module are respectively input into the fourth SIMAM combination module and the Neck network; The fourth SIMAM combination module includes an MPConv module, an ELAN module, a SPPCSPC module and a SIMAM module in sequence for extracting features for the fourth time and inputting the extracted features into the Neck network; Among them, the CBS combination module includes four different CBS modules, and the CBS module is used to change the size and number of feature maps; the ELAN module is an efficient layer aggregation network for multi-scale feature extraction and fusion of images; the SIMAM module is used to incorporate a three-dimensional attention mechanism when extracting features to improve the feature extraction capability of the multi-scale target detection model network, and the SIMAM modules in the four SIMAM combination modules all input the extracted features to the Neck network; the MPConv module is used to pool the feature maps; and the SPPCSPC module is used to extract features after being manifested in different sizes.

2. The improved multi-size target detection method based on YOLOV7 according to claim 1 is characterized in that: The loss function of the multi-scale object detection model is a hybrid bounding box regression loss function based on the CIOU loss function and the normalized Gaussian Wasserstein distance.

3. The improved multi-size target detection method based on YOLOV7 according to claim 2 is characterized in that: The expression of the mixed border regression loss function lbox is: lbox=λ*NWD+(1-λ)CIOU Among them, λ is the weight factor and NWD is the normalized Gaussian Wasserstein distance.

4. The improved multi-size target detection method based on YOLOV7 according to claim 1 is characterized in that: The Neck network includes 2 first CBS modules, 2 second CBS modules, 2 third CBS modules, 1 fourth CBS module, 3 upsampling modules, 6 Concat modules, 6 Concat-Conv modules and 3 MPConv modules; Among them, the first CBS module, the second CBS module, the third CBS module and the fourth CBS module are four different CBS modules; the Concat module is used to perform feature fusion in the channel dimension; The Concat-Conv module is used to extract and fuse multi-scale features of images.

5. The improved multi-size target detection method based on YOLOV7 according to claim 4 is characterized in that: The Head network includes a first size detection head, a second size detection head, a third size detection head and a fourth size detection head; wherein the first size>the second size>the third size>the fourth size; The features extracted by the fourth SIMAM combination module are sequentially processed by the fourth CBS module, the first third CBS module, the first upsampling module, the first Concat module, the first Concat-Conv module, the second CBS module, the second upsampling module, the second Concat module, the second Concat-Conv module, first CBS module, third upsampling module, third Concat module and third Concat-Conv module; the features extracted by the third SIMAM combination module are passed through the second third CBS module and the first Concat module; the features extracted by the second SIMAM combination module are passed through the second second CBS module and the second Concat module; the features extracted by the first SIMAM combination module are passed through the second first CBS module and the third Concat module; the third The output of the Concat-Conv module is used as the input of the first-size detection head; The output of the third Concat-Conv module is also passed through the first MPConv module, the fourth Concat module, the fourth Concat-Conv module, the second MPConv module, the fifth Concat module, the fifth Concat-Conv module, the third MPConv module, the sixth Concat module and the sixth Concat-Conv module; the output of the second Concat-Conv module is also used as the input of the fourth Concat module; the output of the first Concat-Conv module is also used as the input of the fifth Concat module; the output of the fourth CBS module is also used as the input of the sixth Concat module; The output of the fourth Concat-Conv module is also used as the input of the second-size detection head; the output of the fifth Concat-Conv module is also used as the input of the third-size detection head; the output of the sixth Concat-Conv module is used as the input of the fourth-size detection head.

6. The improved multi-size target detection method based on YOLOV7 according to claim 5 is characterized in that: The Head network also includes four RepConv modules, which are re-parameterized convolution modules for re-parameterizing the Head network; wherein, the output of the third Concat-Conv module is used as the input of the first RepConv module, and the output of the first RepConv module is used as the input of the first size detection head; the output of the fourth Concat-Conv module is used as the input of the second RepConv module, and the output of the second RepConv module is used as the input of the second size detection head; the output of the fifth Concat-Conv module is used as the input of the third RepConv module, and the output of the third RepConv module is used as the input of the third size detection head; the output of the sixth Concat-Conv module is used as the input of the fourth RepConv module, and the output of the fourth RepConv module is used as the input of the fourth size detection head.

7. The improved multi-size target detection method based on YOLOV7 according to claim 4 is characterized in that: The CBS combination module includes a fifth CBS module, a sixth CBS module, a seventh CBS module and an eighth CBS module; the feature map input to the multi-size target detection model passes through the fifth CBS module, the sixth CBS module, the seventh CBS module and the eighth CBS module in sequence; Among them, the first CBS module is a two-dimensional convolution with a step size of 1 and a convolution kernel size of 1X1, and the number of output feature maps is 64; the second CBS module is a two-dimensional convolution with a step size of 1 and a convolution kernel size of 1X1, and the number of output feature maps is 128; the third CBS module is a two-dimensional convolution with a step size of 1 and a convolution kernel size of 1X1, and the number of output feature maps is 256; the fourth CBS module is a two-dimensional convolution with a step size of 1 and a convolution kernel size of 1X1, and the number of output feature maps is 5 12; the fifth CBS module is a two-dimensional convolution with a stride of 1 and a convolution kernel size of 3X3, and the number of output feature maps is 32; the sixth CBS module is a two-dimensional convolution with a stride of 2 and a convolution kernel size of 3X3, and the number of output feature maps is 64; the seventh CBS module is a two-dimensional convolution with a stride of 1 and a convolution kernel size of 3X3, and the number of output feature maps is 64; the eighth CBS module is a two-dimensional convolution with a stride of 2 and a convolution kernel size of 3X3, and the number of output feature maps is 128.

8. A multi-size target detection system based on YOLOV7 improvement, characterized in that: include: A construction module is used to construct a multi-size target detection model based on the improvement of YOLOV7; wherein the multi-size target detection model includes a Backbone network, a Neck network and a Head network; the Backbone network is used to extract features four times from the feature map input into the multi-size target detection model, the Neck network is used to fuse the features extracted four times by the Backbone network to form four fusion branches, and the four fusion branches are input into the Head network to detect four targets of different sizes, and the Head network outputs the detection results of four targets of different sizes; A training module, used for training the multi-size object detection model; A detection module, used for inputting the image to be detected into the trained multi-size target detection model, so that the multi-size target detection model outputs targets of the same size in the image to be detected; Wherein, the Backbone network includes a CBS combination module, a first SIMAM combination module, a second SIMAM combination module, a third SIMAM combination module and a fourth SIMAM combination module in sequence; The first SIMAM combination module includes an ELAN module and a SIMAM module in sequence for first feature extraction, and the features extracted by the first SIMAM combination module are respectively input into the second SIMAM combination module and the Neck network; The second SIMAM combination module includes an MPConv module, an ELAN module and a SIMAM module in sequence for extracting features for the second time, and the features extracted by the second SIMAM combination module for the second time are respectively input into the third SIMAM combination module and the Neck network; The third SIMAM combination module includes an MPConv module, an ELAN module and a SIMAM module in sequence for third feature extraction, and the features extracted for the third time by the third SIMAM combination module are respectively input into the fourth SIMAM combination module and the Neck network; The fourth SIMAM combination module includes an MPConv module, an ELAN module, a SPPCSPC module and a SIMAM module in sequence for extracting features for the fourth time and inputting the extracted features into the Neck network; Among them, the CBS combination module includes four different CBS modules, and the CBS module is used to change the size and number of feature maps; the ELAN module is an efficient layer aggregation network for multi-scale feature extraction and fusion of images; the SIMAM module is used to incorporate a three-dimensional attention mechanism when extracting features to improve the feature extraction capability of the multi-scale target detection model network, and the SIMAM modules in the four SIMAM combination modules all input the extracted features to the Neck network; the MPConv module is used to pool the feature maps; and the SPPCSPC module is used to extract features after being manifested in different sizes.

9. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Unmanned aerial vehicle aerial image multi-scale target detection method based on coordinate and global information aggregation

    CN116721368A

  • Target detection method based on improved YOLOv7

    CN117315449A

  • Small target detection method and device based on YOLOv7, storage medium and system

    CN117409295A

  • Underwater target identification method based on three-dimensional attention enhancement YOLO model

    CN117975250A

  • Underwater target detection method and device based on YOLOv8 and storage medium

    CN118470512A