A multi-scale target detection method based on improved YOLOv4-tiny
By improving the YOLOv4-tiny network and combining it with CSPDarknet53-tiny, SPPF, PANet, and ECA modules, the problem of balancing detection accuracy and speed in existing technologies has been solved, achieving efficient multi-scale target detection.
Patent Information
- Application Number
- CN202211088733.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-07
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2042-09-07
AI Technical Summary
Existing target detection technologies struggle to simultaneously guarantee both detection accuracy and speed when dealing with issues such as target occlusion, lighting variations, scale differences, and background interference.
An improved YOLOv4-tiny network is adopted, which is combined with the CSPDarknet53-tiny feature extraction network, the fast spatial pyramid pooling structure SPPF, the path-enhanced feature pyramid network PANet, and the channel attention module ECA to enhance feature extraction and prediction capabilities.
It improves the accuracy and speed of target detection, especially in multi-scale target detection, enhancing the recognition rate and detection accuracy of small targets.
Smart Images

Figure CN116310361B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer vision and object detection, in particular but not exclusively to a multi-scale object detection method based on improved YOLOv4-tiny. BACKGROUND
[0002] Object detection is a popular research direction in the field of computer vision, and is widely used in intelligent navigation, video monitoring, industrial detection, aerospace and many other fields. The task of object detection is to find objects of interest in images or videos and detect their positions and sizes at the same time. Unlike image classification tasks, object detection not only solves classification problems, but also solves positioning problems. Object detection is a basic algorithm in the field of general identity recognition, and plays a crucial role in subsequent tasks such as face recognition, gait recognition, crowd counting, and instance segmentation. Although great progress has been made in object detection technology in recent years, many efficient algorithms have been proposed to solve challenging problems in specific scenarios, but there are still problems such as target occlusion, lighting changes, different scales, and background interference. Therefore, the research on object detection technology is still a difficult task.
[0003] Deep learning-based object detection algorithms are currently the mainstream detection method, mainly including deep learning object detection algorithms based on region proposal and deep learning object detection algorithms based on regression method. The former has relatively high detection accuracy, but the speed cannot meet the real-time requirements. The latter uses the regression idea, that is, given an input image, directly regress the target bounding box and target class at multiple positions of the image, greatly speeding up the detection speed, but due to the lack of region proposal mechanism, only using 7*7 grid regression makes the target cannot be accurately positioned, resulting in relatively low detection accuracy.
[0004] Therefore, it is necessary to provide a new detection method to solve at least part of the above problems. SUMMARY
[0005] In view of one or more problems in the prior art, the present application provides a multi-scale object detection method based on improved YOLOv4-tiny,
[0006] The technical solution for achieving the purpose of the present application is:
[0007] A multi-scale object detection method based on improved YOLOv4-tiny, comprising:
[0008] Step 1: input a picture, and extract a feature map of the picture by using a backbone feature extraction network CSPDarknet53-tiny, wherein the backbone feature extraction network CSPDarknet53-tiny sequentially comprises two convolution modules, three residual blocks and one convolution module;
[0009] Step 2: input the feature map output by the last convolution module in the backbone feature extraction network into a fast spatial pyramid pooling structure SPPF for feature fusion;
[0010] Step 3: input the feature maps obtained by the first residual block and the second residual block of the backbone feature extraction network and the fused feature map in step 2 into a strengthened feature extraction network PANet respectively, the strengthened feature extraction network PANet processes the three feature maps and further extracts features, and the activation function of the strengthened feature extraction network uses a Leaky ReLu function;
[0011] Step 4: input the feature map processed by the strengthened feature extraction network PANet into an ultra-light channel attention module ECA for processing;
[0012] Step 5: input the feature map processed by the ECA module into a prediction output head yolo head, and use the prediction output head yolo head to perform result prediction;
[0013] Step 6: train the improved model, obtain a training result and evaluate the model;
[0014] Step 7: use the best model obtained by training to detect pictures and videos, or call a camera device to detect in real time, obtain a detection result and calculate the inference speed of the model.
[0015] Further, the improved YOLOv4-tiny-based multi-scale target detection method of the present application, step 1 comprises:
[0016] Step 1-1: the picture sequentially obtains a feature map by passing through two convolution modules, wherein the convolution module comprises a 3x3 two-dimensional convolution module, a normalization module and an activation function, the width and height of the picture are each reduced by half after passing through each convolution module, the step size is set to 2, the activation function uses a Leaky ReLu function, and the expression of the Leaky ReLu function is as follows:
[0017]
[0018] wherein x represents input, the zero gradient problem of negative value is adjusted by giving a very small linear component of x to negative input 0.01x, and the range of the Leaky ReLu function is negative infinity to positive infinity;
[0019] Steps 1-2: The feature maps obtained from two convolutional modules are sequentially input into three residual blocks. Each time a feature map passes through a residual block, its width and height are halved. Both the first and second residual blocks have two outputs: the first residual block outputs the first effective feature to the second residual block and the enhanced feature extraction network PANet; the second residual block outputs the second feature map to the third residual block and the enhanced feature extraction network PANet. Each residual block equally divides the feature map into two parts. One part is used directly as a residual edge without any processing, while the other part is nested within a small residual block. The Concat module then fuses the residual edges with the output processed by the small residual block. Finally, a max pooling layer is used to reduce the dimension to half.
[0020] Steps 1-3: Input the feature map processed by the third residual block into the convolution module for feature integration, and input the integrated feature map into the fast spatial pyramid pooling structure.
[0021] Furthermore, in the multi-scale target detection method based on the improved YOLOv4-tiny of the present invention, the small residual block includes two 3x3 convolutional modules, one connection module, and one 1x1 convolutional module. The input feature map is first subjected to a 3x3 convolution, and then equally divided into two parts. One part is used directly as a residual edge without any processing, and the other part is subjected to another 3x3 convolution. Then, the connection module is used to fuse the features of the output of the two parts, and finally a 1x1 convolution is performed.
[0022] Furthermore, in the multi-scale target detection method based on the improved YOLOv4-tiny of the present invention, step 2 includes:
[0023] Step 2-1: Input the feature map output by the last convolutional module in the backbone feature extraction network into the fast spatial pyramid pooling structure SPPF. The uniform stride of the fast spatial pyramid pooling structure SPPF is 1.
[0024] Step 2-2: Halve the number of channels in the feature map using a convolution module;
[0025] Steps 2-3: Pass the feature map through three 5*5 max pooling layers in sequence. Name the feature map directly output by the convolution module as x, name the feature map after one max pooling as y1, name the feature map after two max pooling as y2, and name the feature map after three max pooling as self.m(y2).
[0026] Steps 2-4: The feature maps x, y1, y2, and self.m(y2) are fused using the Concat connection module, then input into the convolution module for convolution, and finally output to the enhanced feature extraction network PANet.
[0027] Furthermore, in the multi-scale target detection method based on the improved YOLOv4-tiny of the present invention, step 3 includes:
[0028] Step 3-1: Name the feature map output by the Fast Spatial Pyramid Pooling (SPPF) structure as N1. Perform convolution, normalization, and upsampling on feature map N1 to double its width and height. The convolution kernel size is 1x1 and the stride is 1. Then, concat the feature map output by the second residual block of the backbone feature extraction network and name the concatenated feature map as N2.
[0029] Step 3-2: Convolve, standardize, and upsample the feature map N2 to double its width and height. The convolution kernel size is 1x1 and the stride is 1. Then, concat the feature map output by the first residual block of the backbone feature extraction network and name the concatenated feature map N3.
[0030] Step 3-3: Downsample feature map N3 to halve its width and height. The kernel size is 3x3 and the stride is 2. Then concatenate it with feature map N2 and name the concatenated feature map N4.
[0031] Steps 3-4: Downsample feature map N4 to halve its width and height, with a convolution kernel size of 3x3 and a stride of 2. Then concatenate it with feature map N1 and name the concatenated feature map N5.
[0032] Steps 3-5: Output feature maps N3, N4, and N5 respectively, with N3, N4, and N5 having different sizes.
[0033] Furthermore, in the multi-scale target detection method based on the improved YOLOv4-tiny of the present invention, step 4 includes:
[0034] Step 4-1: Perform global average pooling on the feature map after it has been processed by the enhanced feature extraction network, and the feature map will be transformed from matrix form to vector form;
[0035] Step 4-2: Use a 1D convolution with kernel size k to achieve local cross-channel interaction, extract the dependencies between channels, and obtain the weights ω of each channel through the Sigmoid activation function:
[0036] ω=σ(C1D k (y)), C1D represents one-dimensional convolution.
[0037] The Sigmoid activation function expression is as follows:
[0038]
[0039]
[0040] Step 4-3: Multiply the normalized weights channel-by-channel with the input feature map processed by the enhanced feature extraction network to generate a weighted feature map.
[0041] Furthermore, in the multi-scale target detection method based on the improved YOLOv4-tiny of the present invention, step 5 includes:
[0042] Step 5-1: Integrate features after a 3x3 convolution and normalization, using the LeakyReLU activation function with a stride of 1;
[0043] Step 5-2: Adjust the number of channels after one 1x1 convolution with a stride of 1;
[0044] Step 5-3: Each prediction output head, YOLO head, obtains a prediction result for a feature map, corresponding to the positions of three prediction boxes on a grid of different sizes for each feature map;
[0045] Step 5-4: Decode the prediction results to obtain the final predicted bounding box position on the image.
[0046] Furthermore, in the multi-scale target detection method based on the improved YOLOv4-tiny of the present invention, step 6 includes:
[0047] Step 6-1: Configure the training dataset information, where the training set, validation set, and test set are randomly allocated in a 7:1:2 ratio;
[0048] Step 6-2: Build the model and configure its relevant information;
[0049] Step 6-3: Import the training set data and train the dataset. Set the number of rounds to 300, the batch size to 16, and the image size to 640*640.
[0050] Step 6-4: Obtain training results, including training time, mAP@0.5, and mAP@0.5:0.95;
[0051] Step 6-5: Plot precision (P), recall (R), mAP@0.5, and mAP@0.5:0.95 as a curve for evaluation. The formula is as follows:
[0052]
[0053]
[0054]
[0055]
[0056] In the formula, N tp This indicates that a positive sample is predicted as a positive sample, N. fp This indicates that a negative sample is predicted as a positive sample, N. fn This indicates that a positive sample is predicted as a negative sample, k represents the number of images, p(k) represents the Precision value of identifying k images, Δr(k) represents the change in Recall value when the number of identified images increases from k-1 to k, P represents Precision, R represents Recall, and C is the total number of categories.
[0057] Furthermore, in the multi-scale target detection method based on the improved YOLOv4-tiny of the present invention, step 7 includes:
[0058] The best model obtained from training is used to detect images, videos, or using camera equipment. The detection results are output, including the detection time, total time, and frame rate (FPS) for each image or frame, where FPS = 1 / time.
[0059] Compared with the prior art, the present invention, employing the above technical solution, has the following technical effects:
[0060] 1. The multi-scale target detection method based on the improved YOLOv4-tiny of the present invention introduces a fast spatial pyramid pooling structure after the backbone feature extraction network, which enriches the spatial feature information of small targets, and introduces an ECA channel attention mechanism, which makes the network pay more attention to the target to be detected and improves the detection accuracy.
[0061] 2. The multi-scale target detection method based on the improved YOLOv4-tiny of the present invention uses a three-layer path-enhanced feature pyramid network PANet to improve the detection capability of multi-scale targets.
[0062] 3. The multi-scale target detection method based on the improved YOLOv4-tiny of the present invention uses three prediction output heads, which improves the recognition rate of small targets. Attached Figure Description
[0063] The accompanying drawings are provided to further illustrate the invention and, together with the description, serve to explain embodiments of the invention, but do not constitute a limitation thereof. In the drawings:
[0064] Figure 1 The overall network structure diagram of the multi-scale target detection method based on the improved YOLOv4-tiny of the present invention is shown.
[0065] Figure 2The diagram shows the residual block structure in the backbone feature extraction network of the multi-scale target detection method based on the improved YOLOv4-tiny of the present invention.
[0066] Figure 3 The diagram shows the fast spatial pyramid pooling structure in the multi-scale target detection method based on the improved YOLOv4-tiny of the present invention.
[0067] Figure 4 The diagram shows the structure of the channel attention module in the multi-scale target detection method based on the improved YOLOv4-tiny of the present invention.
[0068] Figure 5 The detection performance of the existing target detection method YOLOv4-tiny is shown in the figure.
[0069] Figure 6 The detection performance diagram of the multi-scale target detection method based on the improved YOLOv4-tiny of the present invention is shown. Detailed Implementation
[0070] To further understand the present invention, preferred embodiments of the present invention are described below in conjunction with examples. However, it should be understood that these descriptions are only for further illustrating the features and advantages of the present invention, and not for limiting the scope of the claims of the present invention.
[0071] The description in this section pertains to only a few typical embodiments, and the present invention is not limited to the scope of the embodiments described. Combinations of different embodiments, substitution of some technical features in different embodiments, and substitution of similar or identical prior art with some technical features in the embodiments are also within the scope of the description and protection of the present invention.
[0072] According to one aspect of the present invention, a multi-scale target detection method based on improved YOLOv4-tiny is provided, the overall network structure diagram of which is shown below. Figure 1 As shown, it includes the following steps:
[0073] Step 1: Input the image and use one of the existing backbone feature extraction networks, CSPDarknet53-tiny, to extract the feature map.
[0074] (1) The input image is processed through two convolutional modules (DarknetConv2D_BN_Leaky) to obtain feature maps. Each module includes a 3x3 2D convolution, normalization, and activation functions. Each pass through this module halves the width and height of the image. The stride is set to 2, and the Leaky ReLU activation function is used. The function expression is as follows:
[0075]
[0076] Where x is the input, the zero gradient problem of negative values is adjusted by giving a very small linear component of x to the negative input 0.01x. The function range of Leaky ReLU is from negative infinity to positive infinity.
[0077] (2) The feature maps obtained from the two convolutional modules are sequentially input into the three residual blocks. The network structure is as follows: Figure 2 As shown, the feature map after 3x3 convolution is divided into two equal parts. One part is left unprocessed as a residual edge, and the other part is nested with a small residual block. Concat connection is used to fuse the features of the output after processing the residual edge and the small residual block. Finally, the dimension is reduced to 1 / 2 through the processing of the max pooling layer. After each residual block, the width and height of the input feature map are reduced by half.
[0078] The small residual block structure is as follows: First, it undergoes a 3x3 convolution, then it is divided into two parts. One part is left unprocessed as a residual edge, and the other part undergoes another 3x3 convolution. Concat is used to fuse the features of the outputs of the two parts, and finally a 1x1 convolution is performed.
[0079] The first two residual blocks each have two outputs: one is input to the next residual block, and the other is input to the enhanced feature extraction network PANet. The feature map processed by the third residual block is input to the convolutional module for feature integration, and the integrated feature map is input to the fast spatial pyramid pooling structure SPPF.
[0080] Step 2: Input the feature map output by the last convolutional module in the backbone feature extraction network into the Fast Spatial Pyramid Pooling (SPPF) structure for feature fusion. The SPPF structure is as follows: Figure 3 As shown.
[0081] (1) Input the feature map output by the last convolutional module in the backbone feature extraction network into the fast spatial pyramid pooling structure SPPF.
[0082] (2) In SPPF, the number of channels is first halved by using the convolution module.
[0083] (3) The input is serially passed through three 5*5 max pooling layers. The output before max pooling is named x, the output after one max pooling is named y1, the output after two max pooling is named y2, and the output after three max pooling is named self.m(y2).
[0084] (4) The features of x, y1, y2 and self.m(y2) are fused by Concat connection, input to the convolution module for convolution, and finally input to PANet network to realize the fusion of local features and global features.
[0085] (5) SPPF has a uniform step size of 1, and the output feature maps are of the same size. By fusing feature maps with different receptive fields, the running speed is further improved while enriching the expressive power of the feature maps.
[0086] Step 3: Input the feature maps obtained from the first and second residual blocks in the backbone feature extraction network of Step 1, and the feature maps output by the SPPF network in Step 2, into the enhanced feature extraction network PANet. The PANet network processes these three feature maps to further extract features.
[0087] (1) Name the feature map output by the SPPF network as N1. Perform convolution, standardization and upsampling on N1 to double the width and height of the feature map. The convolution kernel size is 1x1 and the stride is 1. Then concatenate it with the feature map output by the second residual block in the backbone feature extraction network. The concatenated feature map is named N2.
[0088] (2) Convolve N2, standardize and upsample it to double the width and height of the feature map, where the kernel size is 1x1 and the stride is 1. Then concatenate it with the feature map output by the first residual block in the backbone feature extraction network, and name the concatenated feature map N3.
[0089] (3) Downsample N3 to halve the width and height of the feature map, where the kernel size is 3x3 and the stride is 2. Then concatenate it with N2, and name the concatenated feature map N4.
[0090] (4) Downsample N4 to halve the width and height of the feature map, where the kernel size is 3x3 and the stride is 2. Then concatenate it with N1, and name the concatenated feature map N5.
[0091] (5) The PANet network can deepen semantic information through multiple feature fusions, and finally outputs three feature maps of different sizes, namely N3, N4 and N5, which helps to improve the performance of multi-scale object detection. The activation function in the PANet network is the Leaky ReLU function.
[0092] (6) Enhanced Feature Extraction Network PANet is fast, simple, and effective. It enhances the representational ability of the backbone network by fusing bottom-up and top-down paths, shortening the distance between the lowest and top layers. The enhanced path enriches the features at each level, accurately preserves spatial information, and helps to correctly locate pixels and form a mask.
[0093] Step 4: Input the feature map processed by the PANet network into the ultra-lightweight channel attention module (ECA) for further processing, and then input the ECA-processed feature map into the prediction output head. The ECA structure diagram is shown below. Figure 4 As shown.
[0094] (1) Perform global average pooling on the input feature map, and the feature map is transformed from a matrix into a vector.
[0095] (2) To avoid dimensionality reduction, a 1D convolution with a kernel size of k is used to achieve local cross-channel interaction, extract the dependencies between channels, and obtain the weights ω of each channel through the Sigmoid activation function, as shown in the following formula:
[0096] ω=σ(C1D k (y)), C1D represents one-dimensional convolution.
[0097] Sigmoid activation function expression:
[0098]
[0099]
[0100] (3) Multiply the normalized weights and the original input feature map channel by channel to generate a weighted feature map.
[0101] (4) The ECA channel attention module avoids dimensionality reduction, effectively captures cross-channel interaction information, has fewer parameters, and significantly improves performance without increasing model complexity.
[0102] Step 5: Use the prediction output head YOLO head to predict the results of the features output by the ECA module.
[0103] (1) Features are integrated after a 3x3 convolution and normalization, with the activation function being LeakyReLU and the stride being 1.
[0104] (2) The number of channels is adjusted by one 1x1 convolution with a stride of 1.
[0105] (3) The three YOLO heads obtain the prediction results of three feature maps, which correspond to the positions of three prediction boxes on the grid of different sizes in each image.
[0106] (4) Decode the image to obtain the final predicted bounding box position on the image.
[0107] Step 6: Train the improved model, obtain the training results, and evaluate the model.
[0108] (1) Configure the training dataset information, where training, validation, and testing are randomly assigned in a 7:1:2 ratio.
[0109] (2) Establish the model and configure the relevant information of the model.
[0110] (3) Import training data and train, with 300 rounds, a batch size of 16, and an image size of 640*640.
[0111] (4) Obtain training results, including training time, mAP@0.5, mAP@0.5:0.95, etc.
[0112] (5) Plot precision, recall, mAP@0.5, and mAP@0.5:0.95 on a graph for evaluation. The formula is as follows:
[0113]
[0114]
[0115]
[0116]
[0117] In the formula, N tp This indicates that a positive sample is predicted as a positive sample, N. fp This indicates that a negative sample is predicted as a positive sample, N. fn This indicates that a positive sample is predicted as a negative sample, k represents the number of images, p(k) represents the Precision value of identifying k images, Δr(k) represents the change in Recall value when the number of identified images increases from k-1 to k, P represents Precision, R represents Recall, and C is the total number of categories.
[0118] Step 7: Use the best model obtained from training to detect images, videos, or use camera equipment, and output the detection results, including the detection time (time) for each image or each frame, the total time, the frame rate (FPS), etc., where FPS = 1 / time.
[0119] To further verify the effectiveness of the target detection method of the present invention, based on the VOC12 dataset, the detection performance graph of the YOLOv4-tiny method was compared with the detection performance graph of a multi-scale target detection method based on improved YOLOv4-tiny in this embodiment. The results are as follows:Figure 5 and Figure 6 As shown in Table 1, the evaluation metrics used are precision, recall, mAP@0.5, and mAP@0.5:0.95. Table 1 shows that this invention achieves a 10.36 percentage point improvement in precision, a 4.17 percentage point improvement in recall, a 12 percentage point improvement in mAP@0.5, and a 13.98 percentage point improvement in mAP@0.5:0.95 compared to the YOLOv4-tiny algorithm. Furthermore, from... Figure 5 and Figure 6 It can be seen that the accuracy of this invention has always been optimal.
[0120] Table 1 Statistical table of experimental results of the present invention
[0121] Model Precision / % Recall / % mAP@0.5 / % mAP@0.5:0.95 / % Ours 47.77 66.39 61.13 38.44 YOLOv4-tiny 37.41 62.22 49.13 24.46
[0122] The description and application of the present invention herein are illustrative and not intended to limit the scope of the invention to the embodiments described above. The effects or advantages described in the specification may not be apparent in actual experimental cases due to uncertainties in specific conditions or other factors, and such descriptions are not intended to limit the scope of the invention. Variations and modifications to the embodiments disclosed herein are possible, and various substitutions and equivalents of the components in the embodiments are well known to those skilled in the art. It should be understood by those skilled in the art that the invention can be implemented in other forms, structures, arrangements, proportions, and with other components, materials, and parts without departing from the spirit or essential characteristics of the invention. Other variations and modifications can be made to the embodiments disclosed herein without departing from the scope and spirit of the invention.
Claims
1. A multi-scale target detection method based on improved YOLOv4-tiny, characterized in that, include: Step 1: Input an image and use the backbone feature extraction network CSPDarknet53-tiny to extract the feature map of the image. The backbone feature extraction network CSPDarknet53-tiny includes two convolutional modules, three residual blocks and one convolutional module in sequence. Step 2: Input the feature map processed by the last convolutional module of the backbone feature extraction network into the fast spatial pyramid pooling structure for feature fusion to obtain the fused feature map; Step 3: Input the feature maps obtained from the first and second residual blocks of the backbone feature extraction network, as well as the fused feature map from Step 2, into the enhanced feature extraction network. The enhanced feature extraction network processes the three feature maps and further extracts features. The activation function of the enhanced feature extraction network is the Leaky ReLU function. Step 4: Input the feature map processed by the enhanced feature extraction network into the ultra-lightweight channel attention module (ECA) for further processing; Step 5: Input the feature map processed by the ECA module into the prediction output head, and use the prediction output head to predict the result; Step 6: Train the improved model, obtain the training results, evaluate the model, and obtain the best model; Step 7: Use the best model to detect images and videos, or call the camera equipment for real-time detection, obtain the detection results, and calculate the inference speed of the model.
2. The multi-scale target detection method based on improved YOLOv4-tiny according to claim 1, characterized in that, The specific steps for extracting the feature map in step 1 include: Step 1-1: The image is sequentially passed through two convolutional modules to obtain feature maps. Each convolutional module includes a 3x3 two-dimensional convolutional module, a normalization module, and an activation function. After each convolutional module, the width and height of the image are each halved, with a stride of 2. The Leaky ReLU function is used as the activation function. The expression for the Leaky ReLU function is as follows: Here, x represents the input. The zero gradient problem of negative values is adjusted by giving a very small linear component of x to the negative input 0.01x. The Leaky ReLU function ranges from negative infinity to positive infinity. Steps 1-2: The feature maps obtained from two convolutional modules are sequentially input into three residual blocks. Each time a feature map passes through a residual block, its width and height are halved. Both the first and second residual blocks have two outputs: the first residual block outputs the first effective feature to the second residual block and the enhanced feature extraction network PANet; the second residual block outputs the second feature map to the third residual block and the enhanced feature extraction network PANet. Each residual block equally divides the feature map into two parts. One part is used directly as a residual edge without any processing, while the other part is nested within a small residual block. A connection module then fuses the residual edges with the output processed by the small residual block. Finally, a max pooling layer is used to reduce the dimension to half. Steps 1-3: Input the feature map processed by the third residual block into the convolution module for feature integration, and input the integrated feature map into the fast spatial pyramid pooling structure.
3. The multi-scale target detection method based on the improved YOLOv4-tiny according to claim 2, characterized in that, The small residual block includes two 3x3 convolutional modules, one connection module, and one 1x1 convolutional module. The input feature map first undergoes a 3x3 convolution, then is equally divided into two parts. One part is used directly as a residual edge without any processing, and the other part undergoes another 3x3 convolution. The connection module then fuses the outputs of the two parts, and finally performs a 1x1 convolution.
4. The multi-scale target detection method based on improved YOLOv4-tiny according to claim 1, characterized in that, The specific steps of step 2 include: Step 2-1: Input the feature map output by the last convolutional module in the backbone feature extraction network into the fast spatial pyramid pooling structure. The uniform stride of the fast spatial pyramid pooling structure is 1. Step 2-2: Halve the number of channels in the feature map using a convolution module; Steps 2-3: Pass the feature map through three 5*5 max pooling layers in sequence. Name the feature map directly output by the convolution module as x, name the feature map after one max pooling as y1, name the feature map after two max pooling as y2, and name the feature map after three max pooling as self.m(y2). Steps 2-4: The feature maps x, y1, y2, and self.m(y2) are fused using the connection module, then input into the convolution module for convolution, and finally output to the enhanced feature extraction network.
5. The multi-scale target detection method based on improved YOLOv4-tiny according to claim 1, characterized in that, The specific steps of step 3 include: Step 3-1: Name the feature map output by the fast spatial pyramid pooling structure as N1. Perform convolution, normalization and upsampling on feature map N1 to double the width and height of the feature map. The convolution kernel size is 1x1 and the stride is 1. Then concatenate it with the feature map output by the second residual block of the backbone feature extraction network. Name the concatenated feature map as N2. Step 3-2: Convolve, standardize and upsample the feature map N2 to double its width and height. The convolution kernel size is 1x1 and the stride is 1. Then, concatenate it with the feature map output by the first residual block of the backbone feature extraction network and name the concatenated feature map N3. Step 3-3: Downsample feature map N3 to halve its width and height. The kernel size is 3x3 and the stride is 2. Then concatenate it with feature map N2 and name the concatenated feature map N4. Steps 3-4: Downsample feature map N4 to halve its width and height, with a convolution kernel size of 3x3 and a stride of 2. Then concatenate it with feature map N1 and name the concatenated feature map N5. Steps 3-5: Output feature maps N3, N4, and N5 respectively, with N3, N4, and N5 having different sizes.
6. The multi-scale target detection method based on improved YOLOv4-tiny according to claim 1, characterized in that, The specific steps of step 4 include: Step 4-1: Perform global average pooling on the feature map after it has been processed by the enhanced feature extraction network, and the feature map will be transformed from matrix form to vector form; Step 4-2: Use a 1D convolution with kernel size k to achieve local cross-channel interaction, extract the dependencies between channels, and obtain the weights ω of each channel through the Sigmoid activation function: ω=σ(C1D k (y)), C1D represents one-dimensional convolution. The Sigmoid activation function expression is as follows: Step 4-3: Multiply the normalized weights channel-by-channel with the input feature map processed by the enhanced feature extraction network to generate a weighted feature map.
7. The multi-scale target detection method based on improved YOLOv4-tiny according to claim 1, characterized in that, The specific steps of step 5 include: Step 5-1: Integrate features after a 3x3 convolution and normalization, using the LeakyReLU activation function with a stride of 1; Step 5-2: Adjust the number of channels using a 1x1 convolution with a stride of 1; Step 5-3: Each prediction output head obtains a prediction result for a feature map, corresponding to the positions of three prediction boxes on a grid of different sizes for each feature map; Step 5-4: Decode the prediction results to obtain the final predicted bounding box position on the image.
8. The multi-scale target detection method based on the improved YOLOv4-tiny according to claim 1, characterized in that, The specific steps of step 6 include: Step 6-1: Configure the training dataset information, where the training set, validation set, and test set are randomly allocated in a 7:1:2 ratio; Step 6-2: Build the model and configure its relevant information; Step 6-3: Import the training set data and train the dataset. Set the number of rounds to 300, the batch size to 16, and the image size to 640*640. Step 6-4: Obtain training results, including training time, mAP@0.5, and mAP@0.5:0.95; Step 6-5: Plot precision (P), recall (R), mAP@0.5, and mAP@0.5:0.95 as a curve for evaluation. The formula is as follows: In the formula, N tp This indicates that a positive sample is predicted as a positive sample, N. fp This indicates that a negative sample is predicted as a positive sample, N. fn This indicates that a positive sample is predicted as a negative sample, k represents the number of images, p(k) represents the Precision value of identifying k images, Δr(k) represents the change in Recall value when the number of identified images increases from k-1 to k, P represents Precision, R represents Recall, and C is the total number of categories.
9. The multi-scale target detection method based on improved YOLOv4-tiny according to claim 1, characterized in that, The specific steps of step 7 include: The best model obtained from training is used to detect images, videos, or using camera equipment. The detection results are output, including the detection time, total time, and frame rate (FPS) for each image or frame, where FPS = 1 / time.
Citation Information
Patent Citations
Lightweight target detection method
CN114120019A
Multi-scale aware pedestrian detection method based on improved full convolutional network
US20210056351A1