Small target detection method based on lossless feature fusion and focusing IoU loss
By using lossless feature fusion and focused IoU loss in small target detection technology, the problem of low accuracy in small target detection is solved, effective fusion and retention of small target feature information is achieved, and the performance of small target detection is significantly improved.
Patent Information
- Application Number
- CN202411357896.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-09-27
AI Technical Summary
The existing small-object detection technology has the problem of low detection accuracy, mainly because the resolution of small-objectives is too low, resulting in less feature information and easy loss. The IoU loss function is sensitive to small-objective position deviation, resulting in too few high-quality samples and loss contribution. insufficient.
A small target detection method based on lossless feature fusion and focused IoU loss is adopted. By designing a multi-scale lossless feature fusion strategy (MLF) and an improved SIoU loss function, a focused penalty term IoU (FocalP-IoU) loss function is introduced to enhance small target features. Information fusion and retention capabilities improve SIoU convergence effect.
By enhancing the fusion and retention capabilities of small target feature information, the performance of small target detection is improved, especially when detecting microscopic targets smaller than 16×16 pixels.
Smart Images

Figure CN119359991A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of target detection, and in particular to a small target detection method based on lossless feature fusion and focused IoU loss. Background Art
[0002] In recent years, with the further development of deep learning, small target detection has become one of the most important and challenging research directions in computer vision. The task of small target detection is to detect small labeled target objects (less than 32×32 pixels) from images or videos. This technology is widely used in scenarios such as autonomous driving, drone reconnaissance, large-scale monitoring systems, and defect detection.
[0003] However, compared with regular-sized targets, small targets have lower detection accuracy. The fundamental reason for the difficulty in detecting small targets is that their resolution is too low, resulting in fewer usable features. Conventional methods are difficult to extract effective feature information of small targets, and too many conventional downsampling convolutions further lose their feature information. In addition, IoU is more sensitive to its position deviation, resulting in poor results of loss function regression, which is more obvious when facing smaller micro targets (less than 16×16 pixels).
[0004] However, there are relatively few existing methods for enhancing the feature information of small targets and the effects are poor, or the feature information problem is often handled at the cost of using a larger model. At the same time, IoU is more sensitive to the position deviation of small targets, resulting in too few high-quality samples, and therefore insufficient contribution to the loss. The mainstream IoU loss function method pays too little attention to small targets, resulting in a large gap in this type of method.
[0005] Therefore, a new solution to the above problems needs to be proposed. Summary of the invention
[0006] The purpose of the present invention is to provide a small target detection method based on lossless feature fusion and focused IoU loss to solve the technical problems raised in the background technology.
[0007] To achieve the above object, the present invention provides the following technical solution: a small target detection method based on lossless feature fusion and focused IoU loss, comprising at least the following steps:
[0008] S1: Obtain a small target image dataset and perform data preprocessing on the small target image dataset;
[0009] S2: Improve the Yolov8 network model and design a multiscale lossless feature fusion strategy (MLF) for model training;
[0010] S3: Based on the SIoU loss function, an improved focusing mechanism is introduced in SIoU, and the focal penalty term IoU (FocalP-IoU) loss function is proposed;
[0011] S4: Input the training set image data into the built network, save the trained model, and finally load the model for model verification and real-time reasoning to obtain the detection results.
[0012] Furthermore, the small target image dataset in step 1 adopts VisDrone-2019, AI-TOD and Pascal VOC datasets, and is divided into training set, validation set and test set with 7:1:2, 4:1:5 and 5:0:5 respectively.
[0013] Furthermore, the data preprocessing of the small object image data set in step 1 at least includes the following steps: converting the acquired json format or xml format labels into txt format labels, and performing normalization processing.
[0014] Furthermore, the S2 at least includes the following steps:
[0015] First, the input image passes through the feature extraction backbone network, and its size is continuously reduced to 160×160, 80×80, 40×40, and 20×20, while the number of channels is continuously increased to form feature maps of different levels: C2, C3, C4, and C5.
[0016] Secondly, FPN upsamples from top to bottom, from a 20×20 feature map to a 40×40 and 80×80 feature map, and then adds an additional upsampling to obtain a 160×160 feature map.
[0017] Then, in the following bottom-up downsampling process of FPN, the feature map of size 160×160 is downsampled to obtain feature maps of size 80×80, 40×40, and 20×20;
[0018] Next, the feature maps of the corresponding levels of C2, C3, C4, and C5 are concatenated. The network head has P2, P3, P4, and P5 detection heads, which correspond to detecting targets larger than 4×4, 8×8, 16×16, and 32×32 in size, respectively.
[0019] Among them, downsampling uses a convolution method based on SPD, where SPD is Space to Depth, and the feature dimension of the input feature map X is S×S×C input ;
[0020] Where S×S represents the feature map size, C input is the number of input channels. This lossless feature extraction method is to perform slice sampling with a step length of 2 in both the horizontal and vertical directions for each feature map of size S×S in X, and obtain four groups of size The feature maps are then concatenated into a set The feature map is finally reduced to
[0021] Finally, the newly added small target detection branch and the lossless feature downsampling method of SPD are combined into a multi-scale lossless feature fusion strategy to enhance the feature information of small targets while reducing the loss of feature information, thereby improving the detection performance of small targets.
[0022] Furthermore, the improvement based on the SIoU loss function in step 3 at least includes the following steps:
[0023] First, SIoU consists of four parts: IoU, angle cost (Λ), distance cost (Δ) and shape cost (Ω), where IoU represents the intersection-over-union ratio of two rectangular boxes, angle cost (Λ) represents the angle cost, distance cost (Δ) represents the distance cost, and shape cost (Ω) represents the shape cost, which are defined as follows:
[0024]
[0025] The Ω here represents the shape cost in SIoU, and the specific definition of Δ is as follows:
[0026]
[0027] Where γ = 2-Λ, γ represents the value of 2 minus the angle cost, Λ represents the angle cost, which is used to converge the angle between the frames, and ρ t It is the ratio of the difference between the horizontal and vertical coordinates of the center points between the frames to the height and width of the minimum circumscribed rectangle, which is used to converge the distance between the frames. Λ is shown in the following formula:
[0028]
[0029] Where σ represents the straight-line distance from the center point, d h Represents the ordinate difference of the center point, as shown in the following formula:
[0030]
[0031] in, Indicates the y coordinate of the center point of the label box, b cyRepresents the y coordinate of the center point of the prediction box;
[0032] At the same time, ρ in the distance cost Δ t It is the ratio of the difference between the horizontal and vertical coordinates of the center points of the boxes to the height and width of the minimum enclosing rectangle, calculated as follows:
[0033]
[0034] where ρ x and ρ y Respectively represent ρ t The calculation method in the x and y coordinate directions is, Indicates the x coordinate of the center point of the label box, b cx Represents the x-coordinate of the center point of the prediction box, Indicates the y coordinate of the center point of the label box, b cy Indicates the y coordinate of the center point of the prediction box, c w Indicates the width of the minimum enclosing rectangle, c h Indicates the height of the minimum enclosing rectangle;
[0035] In DIoU, R DIoU It is a center distance convergence method, R DIoU It is expressed as the ratio of the straight-line distance between the center points of the two boxes to the diagonal length of the minimum circumscribed rectangle, as shown in the following formula:
[0036]
[0037] where ρ 2 (b,b gt ) represents the square of the straight-line distance between the center points of the two boxes, b represents the center point of the predicted box, and b gt Indicates the center point of the label box, c 2 Represents the square of the diagonal length of the circumscribed rectangle;
[0038] In order to further improve the convergence effect of distance cost in SIoU in small target detection, R DIou Distance cost is introduced as the convergence method of center point distance, as shown in the following formula:
[0039] γ=2-Λ
[0040]
[0041] Where Δ is also the distance cost, Λ is the angle cost, γ is 2 minus the angle cost, and ρ z represents the straight-line distance from the center point, ρ z In and b cx , and b cy , and c w 2 and c h 2 All of these have been explained in the previous article.
[0042] Furthermore, the step 3 of introducing an improved focusing mechanism in SIoU includes at least the following steps:
[0043] First, the static focusing mechanism of EIoU is based on IoU γ As a weighted loss function, it is used to focus on high-quality samples with higher IoU values with the GroundTruth box, as shown in the following formula:
[0044] L Foacal-EioU =IoU γ L EIoU
[0045] Among them, IoU γ It means that IoU is exponentially expressed by γ, where γ is a static parameter, and L EIoU represents the EIoU loss,
[0046] Secondly, the focus mechanism is introduced into SIoU as follows:
[0047] L Fpcal-SIoU =IoU γ L SIoU
[0048] Among them, IoU γ It means that IoU is exponentially expressed by γ, where γ is a dynamic parameter, and L SIoU represents SIoU loss,
[0049] And modify γ to the penalty value, γ = angle cost-2 or γ = -distance cost. Based on this, a focus penalty IoU loss is proposed and called FocalP-IoU. This dynamic parameter form gives dynamic weighting to the SIoU loss function, which is used to give less attention to high-quality samples in small targets, thereby focusing on samples of ordinary quality in small targets.
[0050] Furthermore, the correction of the convergence gradient direction of the angle cost and the distance cost in SIoU comprises at least the following steps:
[0051] First, as the key part of distance cost, angle cost is converged first to flatten the two boxes to a horizontal or vertical state, while distance cost converges the distance between the center points of the two boxes;
[0052] Secondly, in the actual SIoU convergence process, the distance cost keeps decreasing, but the angle cost does not decrease accordingly, that is, the distance between the center points of the two frames keeps decreasing, but the angle is still 45 degrees, and it is impossible to flatten the two frames to a horizontal or vertical state;
[0053] Therefore, the angle cost is improved to converge in the same direction as the distance cost, and the γ in the distance cost is modified to γ = Λ 2 +1, and this does not change the value range of γ in the original distance cost, γ∈[1,2], as shown below:
[0054] γ=Λ 2 +1
[0055] Where Δ is the distance cost, Λ 2 is the square of the angle cost, γ is the square of the angle cost plus one, and ρ t It is the ratio of the difference between the horizontal and vertical coordinates of the center points of the boxes to the height and width of the minimum enclosing rectangle, and its calculation method is described above.
[0056] Furthermore, the step 4 at least includes the following steps:
[0057] The training set is input into the improved YOLOv8n network model for feature extraction, feature fusion, and head output detection. After training, the optimal weight model is saved, the weight model is loaded, and the validation set or test set is input for accuracy testing.
[0058] Compared with the prior art, the present invention has the following beneficial effects:
[0059] The present invention increases the small target detection branch and combines the downsampling convolution method of lossless feature information, namely the multi-scale lossless feature fusion strategy, called MLF, to enhance the small target feature information fusion and retention capabilities; at the same time, in order to improve the SIoU convergence effect and speed and adapt it to the loss contribution of ordinary quality samples, a focus penalty term IoU, namely FocalP-IoU, is proposed and applied to SIoU. By designing a dynamic focus on the penalty term parameter, the sample quality is measured by the penalty term value, and the loss contribution is provided for the ordinary quality sample of the small target. At the same time, the center point straight line distance convergence is introduced and the angle cost and distance cost convergence direction are corrected to accelerate the convergence of small targets; through the above method, it is expected to alleviate the problems existing in small target detection and improve the performance of small target detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for describing the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0061] Figure 1 It is a flowchart of a small target detection method according to a specific embodiment of the present invention;
[0062] Figure 2 A schematic diagram of a lossless feature downsampling method according to a specific embodiment of the present invention;
[0063] Figure 3 It is a multi-scale lossless feature network structure diagram of the improved YOLOv8 according to a specific implementation mode of the present invention;
[0064] Figure 4 Introducing R in SIoU according to a specific implementation of the present invention DIoU Improved distance cost diagram;
[0065] Figure 5 (a) is a graph showing the relationship between IoU and angle cost during SIoU convergence according to a specific embodiment of the present invention;
[0066] Figure 5 (b) is a graph showing the relationship between IoU and distance cost during SIoU convergence according to a specific embodiment of the present invention;
[0067] Figure 6 (a) is a graph showing the relationship between angle cost and distance cost before the convergence direction is improved in SIoU according to a specific embodiment of the present invention;
[0068] Figure 6 (b) is a graph showing the relationship between angle cost and distance cost after the convergence direction of SIoU is improved in a specific implementation manner of the present invention;
[0069] Figure 7 (a) is a convergence relationship diagram of angle cost and distance cost before the convergence direction is improved in SIoU according to a specific embodiment of the present invention;
[0070] Figure 7 (b) is a convergence relationship diagram of angle cost and distance cost after the convergence direction is improved in SIoU according to a specific implementation manner of the present invention. DETAILED DESCRIPTION
[0071] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0072] Reference Figures 1 to 7 , a small target detection method based on lossless feature fusion and focused IoU loss, where Figure 1 The flowchart of the small target detection method provided by the specific implementation mode of the present invention is shown, and the specific steps are as follows:
[0073] Training phase
[0074] The small target detection method based on lossless feature fusion and focused IoU loss includes the following steps:
[0075] Step 1: Obtain small target detection datasets, including VisDrone-2019, AI-TOD, and PascalVOC datasets, and divide them into training set, validation set, and test set with 7:1:2, 4:1:5, and 5:0:5, respectively; at the same time, convert the obtained json or xml format labels into txt format labels and perform normalization.
[0076] Step 2: Improve the YOLOv8n network model and design a multi-scale lossless feature fusion strategy for model training. The specific steps are as follows:
[0077] First, the input image passes through the feature extraction backbone network, and its size is continuously reduced to 160×160, 80×80, 40×40, and 20×20, while the number of channels is continuously increased to form feature maps of different levels: C2, C3, C4, and C5.
[0078] Secondly, FPN upsamples from top to bottom, from a 20×20 feature map to a 40×40 and 80×80 feature map, and then adds an additional upsampling to obtain a 160×160 feature map.
[0079] Then, in the following bottom-up downsampling process of FPN, the feature map of size 160×160 is downsampled to obtain feature maps of size 80×80, 40×40, and 20×20;
[0080] Next, the feature maps of the corresponding levels of C2, C3, C4, and C5 are concatenated. The network head has P2, P3, P4, and P5 detection heads, which correspond to detecting targets larger than 4×4, 8×8, 16×16, and 32×32 in size, respectively.
[0081] Among them, the downsampling module uses SPD-based convolution instead of the conventional downsampling method, where SPD is Space to Depth, such as Figure 2 As shown, the feature dimension of the input feature map X is S×S×C input , where S×S represents the feature map size, C input is the number of input channels. This lossless feature extraction method is to perform slice sampling with a step length of 2 in both the horizontal and vertical directions for each feature map of size S×S in X, and obtain four groups of size The feature maps are then concatenated into a set The feature map is finally reduced to
[0082] Finally, the newly added small target detection branch and the lossless feature downsampling method of SPD are combined into a multi-scale lossless feature fusion strategy to enhance the feature information of small targets while reducing the loss of feature information, thereby improving the detection performance of small targets. The improved network structure is shown in the figure below: Figure 3 shown.
[0083] Step 3, SIoU consists of four parts: IoU, angle cost (Λ), distance cost (Δ) and shape cost (Ω), where IoU represents the intersection-over-union ratio of two rectangular boxes, angle cost (Λ) represents the angle cost, distance cost (Δ) represents the distance cost, and shape cost (Ω) represents the shape cost, which are defined as follows:
[0084]
[0085] The Ω here represents the shape cost in SIoU, and the specific definition of Δ is as follows:
[0086]
[0087] Where γ = 2-Λ, γ represents the value of 2 minus the angle cost, Λ represents the angle cost, which is used to converge the angle between the frames, and ρ t It is the ratio of the difference between the horizontal and vertical coordinates of the center points between the frames to the height and width of the minimum circumscribed rectangle, which is used to converge the distance between the frames. Λ is shown in the following formula:
[0088]
[0089] Where σ represents the straight-line distance from the center point, d h Represents the ordinate difference of the center point, as shown in the following formula:
[0090]
[0091] in, Indicates the y coordinate of the center point of the label box, b cy Represents the y coordinate of the center point of the prediction box;
[0092] At the same time, ρ in the distance cost Δ t It is the ratio of the difference between the horizontal and vertical coordinates of the center points of the boxes to the height and width of the minimum enclosing rectangle, calculated as follows:
[0093]
[0094] where ρ x and ρ y Respectively represent ρ t The calculation method in the x and y coordinate directions is, Indicates the x coordinate of the center point of the label box, b cx Represents the x-coordinate of the center point of the prediction box, Indicates the y coordinate of the center point of the label box, b cy Indicates the y coordinate of the center point of the prediction box, c w Indicates the width of the minimum enclosing rectangle, c h Indicates the height of the minimum enclosing rectangle;
[0095] In DIoU, R DIoU It is a center distance convergence method, R DIoU It is expressed as the ratio of the straight-line distance between the center points of the two boxes to the diagonal length of the minimum circumscribed rectangle, as shown in the following formula:
[0096]
[0097] where ρ 2 (b,b gt ) represents the square of the straight-line distance between the center points of the two boxes, b represents the center point of the predicted box, and b gt Indicates the center point of the label box, c 2 Represents the square of the diagonal length of the circumscribed rectangle;
[0098] First, in order to further improve the convergence effect of distance cost in SIoU in small target detection, such as Figure 4 As shown, R DIoU Distance cost is introduced, and the original horizontal and vertical coordinate distance components between the center points are improved to the straight-line distance between the center points, which is used as the convergence method of distance cost, as shown in the following formula:
[0099]
[0100] Where Δ is also the distance cost, Λ is the angle cost, γ is 2 minus the angle cost, and ρ zrepresents the straight-line distance from the center point, ρ z In and b cx , and b cy , and c w 2 and c h 2 All have been explained in the previous article;
[0101] Secondly, the static focusing mechanism of EIoU is based on IoU γ As a weighted loss function, it is used to focus on high-quality samples with higher IoU values with the GroundTruth box, as shown in the following formula:
[0102] L Focal-EIoU =IoU γ L EIoU
[0103] Among them, IoU γ It means that IoU is exponentially expressed by γ, where γ is a static parameter, and L EIoU represents the EIoU loss,
[0104] The focusing mechanism is introduced into SIoU as follows:
[0105] L Focal-SIoU =IoU γ L SIoU
[0106] Among them, IoU γ It means that IoU is exponentially expressed by γ, where γ is a dynamic parameter, and L SIoU represents SIoU loss,
[0107] And modify γ to the penalty value, γ = angle cost-2 or γ = -distance cost. Since the loss function is converging, the penalty value should decrease when IoU increases. However, the penalty value will increase due to local fluctuations. The relationship between IoU, angle cost and distance cost (1 grid represents 10 pixels) is as follows: Figure 5 As shown in (a) and (b), only using IoU to evaluate sample quality cannot fully exert the effect of the focal mechanism. Using the penalty value as the focus parameter of IoU can better evaluate the quality of small target samples and give the loss function a corresponding contribution weight. This dynamic parameter is used to dynamically weight the loss function, which is used to give less attention to high-quality samples, thereby focusing on samples of ordinary quality.
[0108] Then, as the key part of distance cost, angle cost first converges to flatten the two boxes to a horizontal or vertical state. At the same time, distance cost converges to the distance between the center points of the two boxes. However, in the actual SIoU convergence process, distance cost keeps decreasing, but angle cost does not follow. That is, the distance between the center points of the two boxes keeps decreasing, but the angle is still 45 degrees, and it is impossible to flatten the two boxes to a horizontal or vertical state.
[0109] Therefore, the angle cost is improved to converge in the same direction as the distance cost, such as Figure 6 (a) and (b) show the convergence direction of angle cost relative to distance cost before and after improvement. The γ in distance cost is modified to γ = Λ 2 +1, and this does not change the value range of γ in the original distance cost, γ∈[1,2], as shown below:
[0110] γ=Λ 2 +1
[0111] After the modification, the convergence result curve of angle cost is synchronized with distance cost, such as Figure 7 (a) and (b) show the situation before and after the improvement.
[0112] Step 4: Input the training set into the improved YOLOv8n network model for feature extraction, feature fusion, and head output detection. After training, save the optimal weight model, load the weight model, and input the validation set or test set for accuracy testing.
[0113] Verification Phase
[0114] A small target detection method based on lossless feature fusion and focused IoU loss includes: In order to verify the effectiveness of the algorithm, comparative experiments are conducted using VisDrone2019 and AI-TOD datasets. All experiments are conducted based on the PyTorch framework, and YOLOv8n is selected as the benchmark model. The network depth multiplier in the model parameters is 0.33, the network width multiplier is 0.25, and the maximum number of channels is 1024. The experimental hyperparameters are the default values of YOLOv8n, the initial learning rate is 0.01, the optimizer selects SGD, the weight decay is 0.0005, and the momentum is 0.937. The batch size on the VisDrone2019 dataset is 8, the training round is 300, and the batch size on the AITOD dataset is 4, and the training round is 1500. The experimental results are shown in Tables 1 and 2.
[0115] Table 1 Experimental results on VisDrone2019-val
[0116]
[0117] Table 2 Experimental results on AITOD-test
[0118]
[0119] Comparative experiments were conducted using YOLOv8n as the baseline model, and significant improvements were observed in multiple indicators. Subsequently, comparative experiments were conducted with multiple mainstream methods in the above two datasets, and our method also achieved competitive results, with both AP t and AP vt The best result is obtained on the finger. This shows that this method can effectively improve the detection performance of small objects.
[0120] We designed an ablation experiment to verify the respective contributions of MLF and FocalP-IoU, and that they can bring greater improvements when working together. The experimental design uses YOLOv8n as the baseline, and each group of ablation experiments is carried out under the premise that the hyperparameters do not change. The results are shown in Table 3.
[0121] Table 3 Ablation experiment results on VisDrone2019-val
[0122]
[0123] Compared with the baseline, using MLF can improve the accuracy. 50 With AP 50:95 There are 2.1% and 1.5% improvements on the AP of small targets. s , A.P. t , A.P. vt The indicators are improved by 2.9%, 3.2%, and 1.5% respectively, indicating that MLF can enhance and preserve the feature information of small objects. Although the improvement is small after applying the FocalP-IoU loss function, it can play a greater role after combining with the MLF method.
[0124] The two methods work together to achieve 50:95 The AP of small targets was improved by 3.3% and 2.2% respectively. s , A.P. t , A.P. vt The indicators are improved by 3.1%, 3.5%, and 1.7% respectively, which shows that the proposed method can achieve higher performance for small target detection.
[0125] It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above and that the invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description, and it is intended that all variations falling within the meaning and scope of the equivalent elements of the claims be included in the invention. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.
Claims
1. A small target detection method based on lossless feature fusion and focused IoU loss, characterized by: At least the following steps are included: S1: Obtain a small target image dataset and perform data preprocessing on the small target image dataset; S2: Improve the Yolov8 network model and design a multi-scale lossless feature fusion strategy for model training; S3: Based on the SIoU loss function, an improved focusing mechanism is introduced in SIoU, and the FocalP-IoU loss function is proposed; S4: Input the training set image data into the built network, save the trained model, and finally load the model for model verification and real-time reasoning to obtain the detection results.
2. According to claim 1, a small target detection method based on lossless feature fusion and focused IoU loss is characterized in that: The small target image dataset in step 1 adopts VisDrone-2019, AI-TOD and PascalVOC datasets, and is divided into training set, validation set and test set with 7:1:2, 4:1:5 and 5:0:5 respectively.
3. According to claim 2, a small target detection method based on lossless feature fusion and focused IoU loss is characterized in that: The data preprocessing of the small target image data set in step 1 at least includes the following steps: converting the acquired json format or xml format labels into txt format labels, and performing normalization processing.
4. According to claim 1, a small target detection method based on lossless feature fusion and focused IoU loss is characterized in that: The S2 at least comprises the following steps: First, the input image passes through the feature extraction backbone network, and its size is continuously reduced to 160×160, 80×80, 40×40, and 20×20, while the number of channels is continuously increased to form feature maps of different levels: C2, C3, C4, and C5. Secondly, FPN upsamples from top to bottom, from a 20×20 feature map to a 40×40 and 80×80 feature map, and then adds an additional upsampling to obtain a 160×160 feature map. Then, in the following bottom-up downsampling process of FPN, the feature map of size 160×160 is downsampled to obtain feature maps of size 80×80, 40×40, and 20×20; Next, the feature maps of the corresponding levels of C2, C3, C4, and C5 are concatenated. The network head has P2, P3, P4, and P5 detection heads, which correspond to detecting targets larger than 4×4, 8×8, 16×16, and 32×32 in size, respectively. Among them, downsampling uses a convolution method based on SPD, where SPD is Space to Depth, and the feature dimension of the input feature map X is S×S×C input ; Where S×S represents the feature map size, C input is the number of input channels. This lossless feature extraction method is to perform slice sampling with a step length of 2 in both the horizontal and vertical directions for each feature map of size S×S in X, and obtain four groups of size The feature maps are then concatenated into a set The feature map is finally reduced to Finally, the newly added small target detection branch and the lossless feature downsampling method of SPD are combined into a multi-scale lossless feature fusion strategy to enhance the feature information of small targets while reducing the loss of feature information, thereby improving the detection performance of small targets.
5. According to claim 1, a small target detection method based on lossless feature fusion and focused IoU loss is characterized in that: The improvement based on the SIoU loss function in step 3 at least includes the following steps: First, SIoU consists of four parts: IoU, angle cost (Λ), distance cost (Δ) and shape cost (Ω), where IoU represents the intersection-over-union ratio of two rectangular boxes, angle cost (Λ) represents the angle cost, distance cost (Δ) represents the distance cost, and shape cost (Ω) represents the shape cost, which are defined as follows: The Ω here represents the shape cost in SIoU, and the specific definition of Δ is as follows: Where γ = 2-Λ, γ represents the value of 2 minus the angle cost, Λ represents the angle cost, which is used to converge the angle between the frames, ρt is the ratio of the difference between the horizontal and vertical coordinates of the center points between the frames to the height and width of the minimum circumscribed rectangle, which is used to converge the distance between the frames, and Λ is shown in the following formula: Where σ represents the straight-line distance from the center point, d h Represents the ordinate difference of the center point, as shown in the following formula: in, Indicates the y coordinate of the center point of the label box, b cy Indicates the y coordinate of the center point of the prediction box; At the same time, ρt in the distance cost Δ is the ratio of the difference between the horizontal and vertical coordinates of the center points between the boxes to the height and width of the minimum enclosing rectangle, and is calculated as shown in the following formula: where ρ x and ρ y Respectively represent ρ t The calculation method in the x and y coordinate directions is, Indicates the x coordinate of the center point of the label box, b cx Represents the x-coordinate of the center point of the prediction box, Indicates the y coordinate of the center point of the label box, b cy Indicates the y coordinate of the center point of the prediction box, c w Indicates the width of the minimum enclosing rectangle, c h Indicates the height of the minimum enclosing rectangle; In DIoU, R DIoU It is a center distance convergence method, R DIoU It is expressed as the ratio of the straight-line distance between the center points of the two boxes to the diagonal length of the minimum circumscribed rectangle, as shown in the following formula: where ρ 2 (b,b gt ) represents the square of the straight-line distance between the center points of the two boxes, b represents the center point of the predicted box, and b gt Indicates the center point of the label box, c 2 Represents the square of the diagonal length of the circumscribed rectangle; In order to further improve the convergence effect of distance cost in SIoU in small target detection, R DIoU Introducing Distanc ecos t is used as the convergence method of the center point distance, as shown in the following formula: Where Δ is also the distance cost, Λ is the angle cost, γ is 2 minus the angle cost, and ρ z represents the straight-line distance from the center point, ρ z In and b cx , and b cy , and c w 2 and c h 2 All of these have been explained in the previous article.
6. According to claim 5, a small target detection method based on lossless feature fusion and focused IoU loss is characterized in that: In step 3, introducing an improved focusing mechanism in SIoU at least includes the following steps: First, the static focusing mechanism of EIoU uses IoUγ as the weight of the loss function to focus on high-quality samples with higher IoU values with the Ground Truth box, as shown in the following formula: L Focal-EIoU =IoU γ L EIoU Among them, IoU γ It means that IoU is exponentially expressed by γ, where γ is a static parameter, and L EIoU represents the EIoU loss, Secondly, the focus mechanism is introduced into SIoU as follows: L Focal-SIoU =IoU γ L SIoU Among them, IoU γ It means that IoU is exponentially expressed by γ, where γ is a dynamic parameter, and L SIoU represents SIoU loss, And modify γ to the penalty value, γ = angle cost-2 or γ = -distance cost. Based on this, a focus penalty IoU loss is proposed and called FocalP-IoU. This dynamic parameter form gives dynamic weighting to the SIoU loss function, which is used to give less attention to high-quality samples in small targets, thereby focusing on samples of ordinary quality in small targets.
7. According to claim 5, a small target detection method based on lossless feature fusion and focused IoU loss is characterized in that: The correction of the convergence gradient direction of angle cost and distance cost in SIoU comprises at least the following steps: First, as the key part of distance cost, angle cost is converged first to flatten the two boxes to a horizontal or vertical state. ecos t converges the distance between the center points of the two frames; Secondly, in the actual SIoU convergence process, the distance cost keeps decreasing, but the angle cost does not decrease accordingly, that is, the distance between the center points of the two frames keeps decreasing, but the angle is still 45 degrees, and it is impossible to flatten the two frames to a horizontal or vertical state; Therefore, the angle cost is improved to converge in the same direction as the distance cost, and the γ in the distance cost is modified to γ = Λ 2 +1, and this does not change the value range of γ in the original distance cost, γ∈[1,2], as shown below: Where Δ is the distance cost, Λ 2 is the square of the angle cost, γ is the square of the angle cost plus one, and ρt is the ratio of the difference between the horizontal and vertical coordinates of the center points of the boxes to the height and width of the minimum enclosing rectangle, which is calculated as described above.
8. According to claim 1, a small target detection method based on lossless feature fusion and focused IoU loss is characterized in that: The step 4 at least comprises the following steps: Improved YOLO with input training set v The 8n network model performs feature extraction, feature fusion, and head output detection. After training, the optimal weight model is saved, the weight model is loaded, and the verification set or test set is input for accuracy testing.
Citation Information
Patent Citations
Vehicle target identification method based on multi-scale yolk algorithm
CN115171074A
Power distribution room switch cabinet surface component identification method based on improved YOLOv5 algorithm
CN115565232A
Remote sensing image small target detection method based on improved YOLOv3
CN116665054A
Small target detection method for images acquired by unmanned aerial vehicle based on improved YOLOv8 algorithm
CN118628939A