Small target face detection method based on improved YOLOv8

By introducing HGStem, MCAM and ADPN in YOLOv8, the small-target face detection method is improved, and the detection accuracy problems caused by occlusion, complex background and small size are solved, and high accuracy detection in complex environments is achieved.

CN119131858APending Publication Date: 2024-12-13ZHENGZHOU UNIVERSITY OF LIGHT INDUSTRY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411145692.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-20
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

The existing small-object detection methods are difficult to effectively extract the features of small-objective faces under factors such as occlusion, complex background and small size, resulting in insufficient detection accuracy.

Method used

A small-target face detection method for improving YOLOv8 is proposed, called YOLOv8-PHA. By introducing high-efficiency extraction feature module (HGStem), multi-convolution aggregation module (MCAM) and aggregation diffusion pyramid network (ADPN), the model parameters are reduced While increasing the accuracy of face detection in complex scenarios, it can also improve the accuracy of face detection in small targets.

Benefits of technology

The detection accuracy on the Wider Face dataset reaches 94.77%, 93.53% and 83.71%, which is better than the original network and meets the requirements of small-target face detection in complex environments, showing the advancedness and robustness of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119131858A_ABST
    Figure CN119131858A_ABST
Patent Text Reader

Abstract

The invention proposes an improved YOLOv8 small target face detection method, and the method comprises the steps: selecting a WiderFace data set, and obtaining a training set and a verification set which are divided; the method comprises the following steps: constructing a YOLOv8-PHA model which comprises a backbone network, a neck network and a head network which are connected in sequence, introducing an HGStem module into the backbone network, and introducing an ADPN network structure combined with an MCAM module into the neck network; carrying out small target face sample anchor box detection optimization; training the constructed YOLOv8-PHA model by using the training set, verifying the trained model by using the verification set, and adjusting model parameters; repeating until the training requirements or training rounds are met; and running the trained YOLOv8-PHA model on a verification set of the widface data set to obtain a final evaluation detection result. According to the method, the precision of small target face detection in a complex environment can be effectively improved, and the requirement for small target face detection is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of face detection, and in particular to a small target face detection method based on improved YOLOv8. Background Art

[0002] With the continuous development of modern deep learning models, detection models are mainly divided into one-stage algorithms and two-stage algorithms, both of which are able to train and learn facial feature representations in large-scale data sets to achieve high-accuracy face detection. However, due to limited computing resources and real-time requirements, and as models are deployed more on mobile devices, one-stage algorithms with smaller computational workloads and faster speeds have gradually become a research hotspot in the field of target detection. Commonly used one-stage algorithms include the YOLO (You Only Look Once) series, SSD (Single Shot MultiBox Detector), etc.

[0003] With the advancement of computer vision and image processing technology, face detection technology has been continuously applied to various scenarios. For example, face detection plays a key role in security monitoring, human-computer interaction, traffic roads, and intelligent attendance. At the same time, many technologies closely related to face detection are current research hotspots, such as face recognition and face positioning, which shows that the accuracy and efficiency of a face detection algorithm are crucial to promoting the development of these technologies. However, various factors that these algorithms need to consider in the face detection process also come with it. For example, when the light is insufficient or too strong, the image quality will be reduced, thereby affecting the clarity of facial features. Images with low resolution and small size will also lose a lot of detailed information about the face. At the same time, the change in the deflection angle of the face and various postures will also cause trouble for extracting facial features. The model often ignores these faces because it does not pay attention to these small features, resulting in missed detection or false detection. There are more factors such as occlusion and background clutter, which leads to huge challenges in locating the face position more accurately.

[0004] The invention patent with publication number CN117437407 A is a small target detection model for autonomous driving based on YOLOv8, including step 1: selecting the SODA10M data set and dividing the labeled data into a training set, a validation set, and a test set. Step 2: constructing an improved YOLOv8 network structure, including adding an attention mechanism, improving the target detection layer, and designing a target detection head for feature extraction and target detection. Step 3: training the model on the training set, using the gradient descent algorithm and back propagation technology to optimize the neural network parameters to maximize the accuracy of small target detection. Step 4: using the validation set to verify and tune the trained model to ensure the generalization performance and robustness of the model. Step 5: testing the trained and verified model on the test set to evaluate its detection performance of small target objects in autonomous driving scenarios. However, this invention method has many model parameters and still has deficiencies in capturing smaller details, making it difficult to effectively extract the features of small targets. Summary of the invention

[0005] In view of the technical problem that the existing small target detection methods are difficult to effectively extract the features of small targets due to occlusion, complex background, small size and other reasons, the present invention proposes a small target face detection method with improved YOLOv8, and proposes a small target face detection model YOLOv8-PHA. By introducing a high-efficiency feature extraction module (HGStem), a multi-convolution aggregation module (MCAM) and a new aggregate diffusion pyramid network (ADPN), the accuracy of small target face detection in complex scenes can be improved while reducing the number of model parameters.

[0006] In order to achieve the above object, the technical solution of the present invention is achieved as follows:

[0007] A small target face detection method for improving YOLOv8, comprising the steps of:

[0008] S1: Select the WiderFace dataset and obtain the divided training set and validation set;

[0009] S2: Build a YOLOv8-PHA model, including a backbone network, a neck network, and a head network connected in sequence, introduce the HGStem module into the backbone network, and introduce the ADPN network structure combined with the MCAM module into the neck network;

[0010] S3: Optimize the anchor frame detection of small target face samples;

[0011] S4: Use the training set to train the constructed YOLOv8-PHA model; run the trained YOLOv8-PHA model on the validation set and adjust the parameters.

[0012] S5: Repeat S4 until the training requirements or training rounds are met to obtain the trained YOLOv8-PHA model;

[0013] S6: Run the trained YOLOv8-PHA model on the validation set of the widerface dataset to obtain the final evaluation detection results.

[0014] The method for optimizing the anchor frame detection of small target face samples described in step S3 is: using the backbone network to extract features of the input image X to obtain input features of three scales, using the ADPN network combined with the MCAM module in the neck network to fuse the input features of the three scales to obtain feature output maps of three scales, clustering the anchor frame according to the position information in the feature output map, dividing the intersection of the anchor frame and the true target frame by the union of the two to obtain the IOU value, using the head network to regress and classify the feature output maps of the three scales, predicting the bounding box regression value of each anchor frame and the confidence of the target existence, using the IOU value and confidence to calculate the anchor frame alignment metric t, and using the execution program of TaskAlignedAssigner to adjust the anchor frame alignment metric t to the value most suitable for small target face detection.

[0015] The calculation method of the anchor box alignment metric t is: t = s α ×u β , where s represents the confidence, u represents the IOU value, and α and β are control parameters.

[0016] The process of training the constructed YOLOv8-PHA model using the training set described in step S4 is as follows: using the backbone network to extract features of the input image X to obtain input features of three scales, using the ADPN network combined with the MCAM module in the neck network to fuse the input features of the three scales to obtain feature output maps of three scales, and the head network to perform final regression and classification operations on the feature output maps of the three scales, predicting the bounding box regression value of each anchor box and the confidence of the target existence, and adjusting the anchor box using the regression prediction value to generate the final prediction box.

[0017] The method for extracting features from input data using a backbone network is as follows: the input image X first passes through a starting layer HGStem module to extract feature information, passes the feature information to a C2f module, uses a convolution operation through a CBs convolution layer to halve the size of the input image X, then passes through operations of multiple C2f modules + CBs convolution layers in sequence, passes through a last C2f module, and finally passes through feature extraction, pooling and fusion operations of an SPPF layer, and finally outputs small-size feature information X3, medium-size feature information X4 and large-size feature information X5.

[0018] The calculation process of the HGStem module is as follows: the input image X passes through the Conv1 convolution layer to obtain the feature map HG1, the Fpad function is used to fill the edge of the feature map HG1 to obtain the edge-filled feature map HG2, and then after passing through the Conv2a convolution layer and edge filling, it enters the Conv2b convolution layer to obtain the feature map HG3; the edge-filled feature map HG2 passes through the maximum pooling layer pool to obtain the feature map HG4; finally, the feature map HG3 and the feature map HG4 are spliced ​​in the channel dimension, and the feature information is output through the Conv3 convolution layer and the Conv4 convolution layer.

[0019] The method of fusing the input features of three scales by using the ADPN network combined with the MCAM module is as follows: the ADPN network is divided into two parts, the front and back parts. In the first part, the small-scale feature information X3, the medium-scale feature information X4 and the large-scale feature information X5 are input into the first MCAM module in the neck network to extract the feature P, which is then divided into two steps. The first step is: a feature Z5 is obtained by performing a convolution operation on the feature P, and the feature Z5 is aggregated with the large-scale feature information X5. The aggregated feature a is passed through the C2f module a to obtain the feature Y5; the second step is: a feature Z3 is obtained after a downsampling operation on the feature P, and the feature Z3 is aggregated with the small-scale feature information X3. The aggregated feature b is also passed through the C2f module b to obtain the feature Y3;

[0020] In the second part, feature Y3, feature P and feature Y5 are input into the second MCAM module in the neck network to extract feature P2, which is then divided into two steps: the first step is to perform a convolution operation on feature P2 to obtain feature C5, feature C5, feature Y5 and feature Z5 are aggregated, and the aggregated feature c passes through the C2f module c to obtain a large-size feature output image H5; the second step is to perform a downsampling operation on feature P to obtain feature C3, feature C3, feature Y3 and feature Z3 are aggregated, and the aggregated feature d is also passed through the C2f module d to obtain a small-size feature output image H3; feature Y5, feature Y3 and feature P pass through the second MCAM module to obtain a medium-size feature output image H4.

[0021] The calculation process of the first MCAM module is as follows: the input small-scale feature information X3, medium-scale feature information X4 and large-scale feature information X5 are respectively subjected to different convolution operations to capture local information on three scales, and the local information on the three scales is merged to obtain local features L. The local features L are subjected to an identity mapping and M parallel deep convolutions to obtain context features Z of M scales. (m) The local feature L after the identity mapping is then integrated into the contextual feature Z of M scales through a convolution operation. (m)And the local feature L after identity mapping, finally the integrated feature is aggregated with the local feature L to obtain the final output feature P.

[0022] The calculation process of the local feature L is:

[0023] L=ConvX5+ConvX4+ADownX3

[0024] Among them, Conv is the convolution operation, and ADown is the downsampling operation;

[0025] The method for obtaining context features of M scales through M parallel deep convolutions is:

[0026]

[0027] Among them, Z (m) For the context features of each scale, DWConv refers to the depthwise convolution operation, and k(m) represents the convolution kernel size;

[0028] The process of obtaining the final output feature P is as follows:

[0029]

[0030] The specific method of running the trained YOLOv8-PHA model on the validation set is as follows: input the validation set, run the trained YOLOv8-PHA model, compare the predicted box obtained by the YOLOv8-PHA model with the true target box, determine the truth of the predicted box by calculating the degree of overlap between the predicted box and the true target box, and then calculate the area of ​​the precision-recall curve based on the truth of the predicted box.

[0031] Beneficial effects of the present invention:

[0032] Firstly, the present invention proposes the optimization of anchor frame detection for small target face samples, aiming to introduce more high-quality face anchor frames to increase the detection strength of small target face samples; secondly, an efficient feature extraction module (HGStem) is introduced, which uses the advantages of residual structure and maximum pooling layer to reduce the loss of feature information of difficult face samples in the early stage of model training, and improves the quality and diversity of feature maps; thirdly, a multi-convolution aggregation module (MCAM) is designed, which adopts three input scales to better aggregate feature information of different sizes, and uses a set of parallel deep convolutions to capture rich information across multiple scales; finally, a new aggregate diffusion pyramid network (ADPN) is proposed based on the multi-convolution aggregation module (MCAM), which has strong flexibility and adaptability and can better process face images of different sizes.

[0033] The experimental results show that the detection accuracy of the improved YOLOv8-PHA model in the Easy, Medium and Hard levels of the Wider Face dataset is 94.77%, 93.53% and 83.71% respectively, and the detection results are better than the original network. The YOLOv8-PHA model can meet the requirements of small target face detection in complex environments. The experimental results of the WiderFace dataset show that the improved method improves the detection accuracy and reduces the parameters of the network, showing that the YOLOv8-PHA model of the present invention has good advancement and robustness. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0035] Figure 1 It is a network structure diagram of the YOLOv8-PHA model of the present invention.

[0036] Figure 2 It is the structural diagram of the HGStem module of the present invention.

[0037] Figure 3 This is a structural diagram of the MCAM module of the present invention.

[0038] Figure 4 This is the ADPN network structure diagram of the present invention.

[0039] Figure 5 This is the robustness study result of the present invention on the FDDB dataset.

[0040] Figure 6 : The figures are comparison diagrams of the detection effects of the YOLOv8 model and the YOLOv8-PHA model of the present invention on the validation set of the widerface dataset, where (a) is a case where the face resolution is low and the size is small, (b) is a case where the face and the sign are difficult to distinguish, (c) is a case where the face is offset and only part of the face information is exposed, and (d) is a case where the background is very complex and the number of faces is large and the size is small. DETAILED DESCRIPTION

[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0042] like Figure 1 As shown, a small target face detection method for improving YOLOv8 includes the following steps:

[0043] S1: Select the WiderFace dataset and obtain the divided training set and validation set.

[0044] First, download the WiderFace dataset from the WiderFace official website and convert it into the YOLO format that can be used on the YOLO model. Because the WiderFace dataset is divided into training set, test set and validation set in a ratio of 4:5:1, there is no need to perform dataset division. In subsequent experiments, the training set and validation set are mainly used as the evaluation criteria. The test set is not used in this invention.

[0045] S2: Construct a YOLOv8-PHA model, including a backbone network (backbone), a neck network (neck) and a head network (Head) connected in sequence. The backbone network is used to extract feature information from the image for use by the subsequent network. The neck network is used to better utilize the features extracted by the backbone and plays the role of "feature fusion". The head network uses the previously extracted features to make identifications. An efficient feature extraction module (HGStem) is introduced into the backbone network. It can quickly extract features in the early stages of the network, providing an effective starting point for the network and a good foundation for subsequent feature extraction. An aggregate diffusion pyramid network (ADPN) structure combined with a multi-convolution aggregation module MCAM is introduced into the neck network. It captures objects of different sizes and scales through aggregation and diffusion mechanisms, and uses the three-scale inputs of the MCAM module to ensure that the integrity of local feature information is not lost while capturing a wider range of contextual information.

[0046] Set initial parameters:

[0047] The present invention experiments the YOLOv8-PHA model on the WiderFace dataset in pycharm software, using YOLOv8s as the baseline model, the initial learning rate is 1e-2, the final learning rate is 1e-3, the momentum is set to 0.937, which refers to momentum, a parameter of the experiment, and a commonly used acceleration technology in the gradient descent method. The workers are set to 4, which refers to the number of threads used by the CPU when loading data, and the batch size is set to 4, which refers to how many pictures are stuffed into the GPU at a time.

[0048] S3: Optimize the anchor box detection of small target face samples.

[0049] In the YOLO series of models, anchor boxes are predefined bounding boxes that are obtained by clustering the positions of the target detection objects in the data set. They are used as references for the calculation of prediction boxes and provide the model with prior information of different lengths and aspect ratios, which enables the model to adapt to targets of different sizes and shapes. When performing target detection, for each prediction box, the network predicts its offset relative to the corresponding anchor to obtain the final prediction box. However, when a large number of prediction boxes are used in detection, there are some low-quality prediction boxes caused by incorrect anchor matching, noise interference or inaccurate model prediction. Especially in face detection, there will be a large number of dense small-sized face targets, and these targets will be occluded. In this case, due to the overlap and interference between the targets, it is easier to generate low-quality prediction boxes, thereby reducing the detection effect of small target faces. Therefore, the small target face sample anchor box detection optimization is adopted, and more high-quality face anchor boxes are introduced to increase the detection strength of small target face samples.

[0050] During the detection process, the model will compare the generated anchor frame with the standard face frame (real target frame) after data annotation, which is the positive and negative sample allocation stage. The anchor frame alignment metric t (Top k value) is usually expressed by a high-order combination of the classification score, anchor frame, and real target frame IOU, which can be specifically expressed as formula (1), using the Top k value as the basis for the positive and negative sample label allocation.

[0051] t=s α ×u β (1)

[0052] Among them, s represents the classification score, which is obtained by using the predict_proba method to obtain the probability of the classifier's prediction for each category, thereby obtaining the classifier classification score s, which represents the model's prediction confidence of whether the anchor box contains the target object; u represents the IOU value, which is calculated by dividing the intersection of the anchor box and the true target box by the union of the two. The higher the IoU value, the higher the overlap between the anchor box and the true target box, which is used to measure the positioning accuracy of the anchor box. α and β are used to control the influence of the two tasks of classification score s and IOU value on the Top k value respectively; when the Top k value is calculated, the Top k anchor boxes with the largest IOU value will be selected as positive sample points. Except for the anchor box selected as the positive sample point, all other anchor boxes are regarded as negative sample points. These anchors either have a low Top k value (i.e., poor alignment) with the true target box, or the Top k value with any true target box is not enough to make it a positive sample. Negative sample points are usually used in the training process to help the model learn how to distinguish between background and actual target. In the baseline model YOLOv8, this maximum Top k value is selected as 10, but in the experiment, it is found that a larger Top k value will cause some targets with a small proportion in the feature map to be assigned to other categories because there is no high-quality anchor, which affects the detection accuracy. Therefore, in the experiment, as shown in Table 1, the loss.py program in the YOLOv8 model contains a class of execution programs called TaskAlignedAssigner, which is trained with different parameter Top k values. It is found that when Top k is 3, the model performs best and can significantly improve the accuracy at the hard level of the dataset. By changing Top k to 3, more high-quality face anchors can be introduced to increase the detection of small target face samples. The top k value specifies the number of optimal anchors considered when assigning anchors to each true target box, that is, for each true target box, the algorithm selects the top t anchors with the highest similarity as candidates, and then further processes these candidate anchors to decide which ones will be considered positive samples, that is, the labels assigned to the true target boxes. When the topk value is low, the model will focus more on the few anchors with the highest similarity to the true target box, and discard some anchors with low quality, which helps improve the matching accuracy.

[0053] The method is as follows: the backbone network is used to extract features of the input image X to obtain input features of three scales; the ADPN network is used in combination with the MCAM module in the neck network to fuse the input features of the three scales to obtain feature output maps of three scales; the anchor frame is clustered according to the position information in the feature output map; the IOU value is obtained by dividing the intersection of the anchor frame and the true target frame by the union of the two; the head network is used to perform regression and classification tasks on the feature output maps of the three scales, the bounding box regression value of each anchor frame and the confidence of the target existence are predicted, the anchor frame alignment metric t is calculated using the IOU value and confidence, and the anchor frame alignment metric t value is adjusted to the most suitable value for small target face detection using the execution program of TaskAlignedAssigner.

[0054] Table 1: Ablation experiment of anchor frame for small target face samples

[0055]

[0056] S4: Use the training set to train the constructed YOLOv8-PHA model; run the trained YOLOv8-PHA model on the validation set and adjust the parameters;

[0057] The training process is as follows: after setting the value of the anchor alignment metric t to the optimal matching value of the small target anchor, an efficient feature extraction module (HGStem) is introduced into the backbone network, and the backbone network is used to extract features from the input image X to obtain input features of three scales. The neck network uses the aggregate diffusion pyramid network (ADPN) combined with the multi-convolution aggregation module MCAM to fuse the input features of the three scales to obtain feature output maps of three scales, and finally enters the head network. The head network uses the original head network in the YOLOv8 network, and the loss calculation uses the original method in the YOLOv8 network. The head network performs the final regression and classification tasks on the feature output maps of the three scales according to the three scales of 80×80, 40×40 and 20×20, predicts the bounding box regression value of each anchor box and the confidence of the target existence, and uses the regression prediction value to adjust the anchor box to generate a prediction box;

[0058] The method of extracting features from input data using a backbone network is as follows:

[0059] like Figure 1As shown in the figure, the calculation process of the backbone network is as follows: the input image X first passes through the starting layer efficient feature extraction module (HGStem) to extract feature information, and passes the feature information to the C2f module I with a channel number of 128, and then passes through the convolutional layer I (Convolutional Blocks, CBS) using a convolution operation with a step size of 2 and a convolution kernel of 3×3 to increase the number of channels to 256, and the size of the input image X is halved, and then passes through the C2f module II, convolutional layer II, C2f module III and convolutional layer III in sequence, with a channel number of 1024, and then passes through the last group of C2f modules IV, and finally passes through the feature extraction, pooling and fusion operations of the SPPF layer to increase the receptive field and aggregate context information, and finally outputs small-size feature information X3, medium-size feature information X4 and large-size feature information X5. The large-size feature information X5 comes from the output of the SPPF layer, and the small-size feature information X3 and medium-size feature information X4 come from the C2f module II and C2f module III of the aforementioned layer respectively. The C2f module realizes feature fusion by splicing the features of different branches in the channel dimension.

[0060] In traditional convolutional neural networks, as the network depth increases, the spatial size of the feature map gradually decreases, which may cause the feature information of small target faces to be lost during the transmission process, especially in the backbone network of YOLOv8, where feature extraction is performed through two convolution modules followed by a C2f module. However, since the focus of the present invention is on dense small target faces, it is considered that if 4 times downsampling is achieved directly through two convolution modules, a lot of small target face information may be lost. Therefore, the present invention uses an efficient feature extraction module (HGStem) to replace the first two convolution modules, and introduces the idea of ​​residual learning. This structure allows the network to learn the residual between input and output instead of directly learning the complete mapping. At the same time, compared with the ordinary convolution module, the maximum pooling layer (Pool) is added, which retains important feature information and enhances the generalization ability of the model.

[0061] The structure of the efficient feature extraction module (HGStem) is as follows Figure 2As shown. This module improves the number of channels in Conv2a and Conv2b. The number of output channels of Conv2a is half of the number of input channels, while the number of output channels of Conv2b is half of the number of input channels. This will cause the spatial size of the feature map to be reduced due to the sliding of the convolution kernel, thereby noticing more subtle feature information. This structure introduces the idea of ​​residual learning. The residual connection allows the input to directly jump over one or more layers and be added to the output of these layers to form the output of the residual block. This design allows the network to learn the residual between input and output (i.e., the difference between input and expected output) instead of directly learning the complete mapping from input to output (i.e., the original unprocessed mapping) during learning. At the same time, compared with the ordinary convolution module, the maximum pooling layer (Pool) is added to retain important feature information and enhance the generalization ability of the model. The role of the efficient feature extraction module (HGStem) is that it can quickly extract features in the early stages of the network, providing an efficient starting point for the network and a good basis for subsequent feature extraction. In addition, through the design of residual structures such as Conv2a and Conv2b, it can effectively reduce the redundant calculation of the network and improve the quality and diversity of feature maps. This is especially important for small target face detection, because small targets occupy fewer pixels in the image and feature extraction is more difficult. The efficient feature extraction module (HGStem) can help the network capture and extract the features of these small targets more efficiently.

[0062] The calculation process of the efficient feature extraction module (HGStem): First, input image X through the Conv1 convolution layer to obtain feature map HG1, and then use the F.pad function to fill the edge of feature map HG1 to obtain feature map HG2 after edge filling. The purpose of edge filling is to maintain or adjust the spatial size of feature map HG1 during the convolution operation, and then enter the two convolution layers Conv2a and Conv2b. Similarly, edge filling is performed between them to obtain feature map HG3. At the same time, the feature map HG2 after edge filling passes through the maximum pooling layer pool to obtain feature map HG4. The pooling layer can effectively reduce the size of the parameter matrix, thereby reducing the number of parameters in the last connection layer. Therefore, adding a pooling layer can speed up the calculation and prevent overfitting. Finally, feature map HG3 and feature map HG4 are spliced ​​in the channel dimension, which helps the network capture more feature information, and output the feature information through the Conv3 convolution layer and the Conv4 convolution layer as the input of the subsequent network layer.

[0063] The method of fusing the input features of three scales by using the aggregate diffusion pyramid network (ADPN) combined with the multi-convolution aggregation module (MCAM) is as follows:

[0064] Aggregate Diffused Pyramid Network (ADPN) Figure 4 shown.

[0065] First, in the first part of the ADPN network, the small-size feature information X3, the medium-size feature information X4, and the large-size feature information X5 are input into the first multi-convolution aggregation module (MCAM) in the neck network to extract feature P, which is then divided into two steps. The first step is to obtain feature Z5 by performing a 3×3 convolution (Conv) on feature P. Feature Z5 is aggregated with the large-size feature information X5. The aggregated feature a is passed through the C2f module a to obtain feature Y5. The second step is to obtain feature Z3 by downsampling feature P (Upsample). Feature Z3 is aggregated with the small-size feature information X3. The aggregated feature b is also passed through the C2f module b to obtain feature Y3.

[0066] The second part is similar to the first part. Feature Y3, feature P and feature Y5 are input into the second multi-convolutional aggregation module (MCAM) in the neck network to extract feature P2, which is then divided into two steps. The first step is to obtain feature C5 by performing a 3×3 convolution (Conv) on feature P2. Feature C5, feature Y5 and feature Z5 are aggregated, and the aggregated feature c passes through the C2f module c to obtain a large-size feature output map H5. The second step is to downsample feature P to obtain feature C3. Feature C3, feature Y3 and feature Z3 are aggregated, and the aggregated feature d also passes through the C2f module d to obtain a small-size feature output map H3. In the second part, during aggregation, feature Z5 and feature Z3 are added respectively, which can ensure that more information is not lost, and the medium-size feature output map H4 is obtained by feature Y5, feature Y3 and feature P through the second multi-convolutional aggregation module (MCAM).

[0067] The Aggregate Diffusion Pyramid Network (ADPN) designed in the present invention captures targets of different sizes through aggregation and diffusion mechanisms, especially in dense detection tasks, to ensure that not too much semantic information is lost during feature transfer and to allow information to diffuse to various detection scales. The model can also perform image segmentation and processing more stably under complex conditions, and the number of parameters is reduced compared to traditional pyramid networks, making the model more efficient.

[0068] The calculation process of the multi-convolution aggregation module (MCAM) is:

[0069] like Figure 3As shown, the multi-convolution aggregation module (MCAM) proposed in the present invention can receive inputs of three scales. Taking the calculation process of the first multi-convolution aggregation module (MCAM) as an example, the calculation process of other multi-convolution aggregation modules (MCAM) is the same; first, the feature information of the three scales of the input feature is small-scale feature information X3, medium-scale feature information X4 and large-scale feature information X5, and different convolution layers are performed on the three scales to capture the local information on the three scales. In particular, in the face of difficult sample faces that are difficult to extract information, the present invention uses the ADown downsampling module in YOLOv9 in the small-scale P3 detection scale for targets with a detection size of 8×8 or more. The ADown downsampling module can extract useful information from the feature map by using a convolution layer, and perform more in-depth feature extraction on target faces with smaller scales. By adjusting the stride of the convolution layer, the spatial dimension of the feature map is reduced, and the spatial resolution of the feature map is reduced. At the same time, the number of parameters in the convolution layer is optimized to reduce the complexity of the model. Then the local information on the three scales is merged to obtain the local feature L, and the formula is as follows:

[0070] L=Conv 3×3 X5+Conv 3×3 X4+ADown 3×3 X3 (2)

[0071] The local feature L is obtained through an identity mapping and M parallel deep convolutions to obtain contextual features of M scales and local features L after identity mapping. Each scale has feature information with different receptive field sizes. The contextual features of each scale are represented as Z (m) , the formula is:

[0072]

[0073] DWConv refers to the depthwise convolution operation, k (m) represents the convolution kernel size, in this embodiment, M=4;

[0074] The identity map does not perform any transformation or operation on the input, but simply returns the input as output.

[0075] In the experiment, the present invention changes the convolution kernel size k (m) Set to (m+1)×2+1.

[0076] Then, a 1×1d convolution operation is performed to integrate the context features of M scales and the local features L after identity mapping. Finally, the integrated features are aggregated with the local features L to obtain the final output feature P, which is formulated as follows:

[0077]

[0078] In the detection of difficult face samples, aggregating diverse contextual information through convolution kernels of different sizes can enable the network to capture both local detail information and global structural information of the face, thereby having better expression capabilities for faces of different scales. In view of this feature, the present invention designs a new multi-convolution aggregation module (MCAM) to solve the problem of difficult face detection caused by large differences in information of different scales. Through input at three scales and introducing a more efficient ADown module for feature extraction in the small-size layer, the local information of target features from different input scales is effectively integrated.

[0079] The multi-convolution aggregation module (MCAM) of the present invention takes input at three scales and introduces a more efficient ADown downsampling module for feature extraction in the small-size layer, effectively integrating the local information of target features from different input scales, and then uses a set of parallel deep convolutions to capture rich information across multiple scales. This parallel processing mechanism helps to enhance the network's perception of small target faces because it can analyze images from different angles and scales, reduce information omissions, and finally ensure the capture of broader contextual information through aggregation operations without losing the integrity of local feature information.

[0080] After designing a multi-convolutional aggregation module (MCAM), the present invention designs a new aggregate diffusion pyramid network (ADPN) based on the multi-convolutional aggregation module (MCAM) and uses the three-scale input features of the multi-convolutional aggregation module (MCAM) and applies it to the YOLOv8 network. The aggregate diffusion pyramid network (ADPN) can make the features of each scale have detailed context information through its unique multi-convolutional aggregation module (MCAM) and feature diffusion mechanism, and diffuse it to each detection scale, which is more conducive to the detection and classification of subsequent targets.

[0081] Verification set verification: Use the WiderFace dataset official website evaluation code and the prediction box obtained after training for verification. The evaluation indicators are: Input the verification set, run the YOLOv8-PHA model, the algorithm will output a series of face prediction boxes, and compare them with the real face target box. By calculating the degree of overlap between the prediction box and the real target box (such as IoU, i.e., intersection over union), it can be determined which prediction boxes are correct (true positives, True Positives, TP) and which are wrong (false positives, False Positives, FP). Then, based on these results, calculate the area under the precision-recall rate (Precision-Recall, PR) curve (Area Under Curve, AUC), that is, the AP value at this difficulty level. Stochastic gradient descent is used to adjust the hyperparameters based on the performance feedback on the verification set.

[0082] S5: Repeat S4 until the training requirements or training rounds are met to obtain the trained YOLOv8-PHA model;

[0083] Each training process and the verification and parameter adjustment process after training is a round. The present invention trains the model for 250 (rounds) epochs on the GPU of NVIDIA GeForceRTX 3060Ti, and finally obtains the trained YOLOv8-PHA model.

[0084] S6: Run the trained YOLOv8-PHA model on the validation set of the widerface dataset to obtain the final evaluation detection results.

[0085] Experimental results analysis:

[0086] Table 2 shows the detection performance of the proposed algorithm on the widerface dataset, and compares it with other models that perform well in face detection. Since some face detection algorithms are not open source, this experiment selects the most advanced technology level or research results (SOTA) with the best performance on the widerface dataset for comparison.

[0087] The results show that compared with the two-stage algorithm CMS-RCNN, the model of the present invention has improved by 4.57%, 6.13% and 19.41% at three levels, respectively, and has been greatly improved in all aspects; compared with the one-stage algorithm RetinaFace, ResNet-10GF and DSFD models, although the improvement at the Easy and Medium levels is not outstanding, the method of the present invention is mainly aimed at difficult face samples, so it can be seen that in the detection accuracy of the Hard level, the model of the present invention has improved by 19.54%, 3.29% and 12.32% respectively, which shows that when detecting difficult-to-distinguish faces, the model of the present invention will have more advantages; in comparison with YOLOv5, YOLO5Face and YOLOv8, which belong to the same YOLO algorithm, at the difficult level, the detection accuracy of the present invention has improved by 0.3%, 0.99% and 1.89% respectively. Although the calculation amount and parameter amount have increased, it still meets the requirements for the detection of difficult face samples. In summary, the detection accuracy of the algorithm of the present invention at the difficult level in the widerface dataset is higher than that of most classic algorithms at this stage. This also proves that when facing some difficult faces that are difficult to detect due to occlusion, complex background, small size, etc., the model of the present invention can have a better detection performance.

[0088] Table 2 Comparative study of different algorithms on WiderFace dataset

[0089]

[0090] like Figure 5 As shown, in order to evaluate the robustness of the model proposed in the present invention, an evaluation test was conducted on the FDDB dataset, and the evaluation criteria were all the true positive rate (TPR) obtained when the false alarm (FP) was 1000. Because the method proposed in the present invention is mainly aimed at some difficult-to-detect face samples that are difficult to extract features, and the face size in the FDDB dataset is usually large, and is also less affected by occlusion and posture, so after using the training results on the widerface dataset for evaluation, although there is only a 0.06% improvement compared to the original model, compared with other evaluated classic models, the model of the present invention can also achieve good results when targeting large faces.

[0091] In order to more intuitively feel the effectiveness of the model in this paper, the present invention performs visualization operations of the YOLOv8 model and the YOLOv8-PHA model of the present invention on the validation set of the widerface dataset. Figure 6 The left side of the four comparison result graphs are all the models of the present invention, and the right side is the baseline yolov8 model. Figure 6 In (a), it can be seen that the model of the present invention can still accurately detect the target face when the face resolution is low and the size is small; Figure 6 In (b), the original model misdetected the sign as a human face, but the model of the present invention corrected this well. Figure 6 In (c), when the face is offset and only part of the face information is revealed, the model of the present invention will perform better in this regard; Figure 6 In (d), when the background is very complex, and there are many faces with small sizes, it undoubtedly meets the difficult face sample. The model of the present invention can extract more small target face information while correcting the error of "misdetecting the trophy as a face", so that more faces can be detected. In summary, the model proposed by the present invention can effectively overcome the factors of low resolution, posture changes, small face size, etc. when detecting small target face samples, thereby achieving better results.

[0092] The present invention proposes a small target face detection method for improving YOLOv8, which involves the problem that some small target faces are difficult to detect due to occlusion, complex background, small size and the like. The key to small target face detection is how to more effectively capture the feature information of these faces. However, in real complex scenes, faces are deflected and overlapped, and the size accounts for a small proportion of the image. Poor image quality will affect the clarity of the face, resulting in low resolution and difficulty in detection, etc. The model often ignores these faces because it does not pay attention to these small features, resulting in unsatisfactory detection effect. In order to improve this problem, the method of the present invention is proposed. Experimental results show that the method can effectively improve the accuracy of small target face detection in complex environments and meet the requirements for small target face detection. The present invention is applied to small target face detection.

[0093] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. An improved YOLOv8 small target face detection method, It is characterized in that Includes steps: S1: Select the WiderFace dataset and obtain the divided training set and validation set; S2: Build a YOLOv8-PHA model, including a backbone network, a neck network, and a head network connected in sequence, introduce the HGStem module into the backbone network, and introduce the ADPN network structure combined with the MCAM module into the neck network; S3: Optimize the anchor frame detection of small target face samples; S4: Use the training set to train the constructed YOLOv8-PHA model; run the trained YOLOv8-PHA model on the validation set and adjust the parameters; S5: Repeat S4 until the training requirements or training rounds are met to obtain the trained YOLOv8-PHA model; S6: Run the trained YOLOv8-PHA model on the validation set of the widerface dataset to obtain the final evaluation detection results.

2. The small target face detection method of the improved YOLOv8 according to claim 1, It is characterized in that The method for optimizing the anchor frame detection of small target face samples described in step S3 is: using the backbone network to extract features of the input image X to obtain input features of three scales, using the ADPN network combined with the MCAM module in the neck network to fuse the input features of the three scales to obtain feature output maps of three scales, clustering the anchor frame according to the position information in the feature output map, dividing the intersection of the anchor frame and the true target frame by the union of the two to obtain the IOU value, using the head network to regress and classify the feature output maps of the three scales, predicting the bounding box regression value of each anchor frame and the confidence of the target existence, using the IOU value and confidence to calculate the anchor frame alignment metric t, and using the execution program of TaskAlignedAssigner to adjust the anchor frame alignment metric t to the value most suitable for small target face detection.

3. The small target face detection method of the improved YOLOv8 according to claim 2, It is characterized in that The calculation method of the anchor frame alignment metric t is: t = s α ×u β , where s represents the confidence, u represents the IOU value, and α and β are control parameters.

4. The small target face detection method according to the improved YOLOv8 of claim 3, It is characterized in that The process of training the constructed YOLOv8-PHA model using the training set described in step S4 is as follows: using the backbone network to extract features of the input image X to obtain input features of three scales, using the ADPN network combined with the MCAM module in the neck network to fuse the input features of the three scales to obtain feature output maps of three scales, and the head network to perform final regression and classification operations on the feature output maps of the three scales, predicting the bounding box regression value of each anchor box and the confidence of the target existence, and adjusting the anchor box using the regression prediction value to generate the final prediction box.

5. The small target face detection method according to claim 4, It is characterized in that The method for extracting features from input data using a backbone network is as follows: the input image X first passes through a starting layer HGStem module to extract feature information, passes the feature information to a C2f module, uses a convolution operation through a CBs convolution layer to halve the size of the input image X, then passes through operations of multiple C2f modules + CBs convolution layers in sequence, passes through a last C2f module, and finally passes through feature extraction, pooling and fusion operations of an SPPF layer, and finally outputs small-size feature information X3, medium-size feature information X4 and large-size feature information X5.

6. The small target face detection method according to claim 1 or 5, It is characterized in that The calculation process of the HGStem module is as follows: the input image X passes through the Conv1 convolution layer to obtain the feature map HG1, the Fpad function is used to fill the edge of the feature map HG1 to obtain the edge-filled feature map HG2, and then after passing through the Conv2a convolution layer and edge filling, it enters the Conv2b convolution layer to obtain the feature map HG3; the edge-filled feature map HG2 passes through the maximum pooling layer pool to obtain the feature map HG4; finally, the feature map HG3 and the feature map HG4 are spliced ​​in the channel dimension, and the feature information is output through the Conv3 convolution layer and the Conv4 convolution layer.

7. The small target face detection method according to claim 4, It is characterized in that The method of fusing the input features of three scales by using the ADPN network combined with the MCAM module is as follows: the ADPN network is divided into two parts, the front and back parts. In the first part, the small-scale feature information X3, the medium-scale feature information X4 and the large-scale feature information X5 are input into the first MCAM module in the neck network to extract the feature P, which is then divided into two steps. The first step is: a feature Z5 is obtained by performing a convolution operation on the feature P, and the feature Z5 is aggregated with the large-scale feature information X5. The aggregated feature a is passed through the C2f module a to obtain the feature Y5; the second step is: a feature Z3 is obtained after a downsampling operation on the feature P, and the feature Z3 is aggregated with the small-scale feature information X3. The aggregated feature b is also passed through the C2f module b to obtain the feature Y3; In the second part, features Y3, P and Y5 are input into the second MCAM module in the neck network to extract feature P2, which is then divided into two steps: the first step is to perform a convolution operation on feature P2 to obtain feature C5, and feature C5 , feature Y5 and feature Z5 are aggregated, and the aggregated feature c passes through the C2f module c to obtain a large-sized feature output map H5. The second step is to downsample the feature P to obtain feature C3. Feature C3, feature Y3 and feature Z3 are aggregated, and the aggregated feature d also passes through the C2f module d to obtain a small-sized feature output map H3; feature Y5, feature Y3 and feature P pass through the second MCAM module to obtain a medium-sized feature output map H4.

8. The small target face detection method according to claim 7, It is characterized in that The calculation process of the first MCAM module is as follows: the input small-scale feature information X3, medium-scale feature information X4 and large-scale feature information X5 are respectively subjected to different convolution operations to capture local information on three scales, and the local information on the three scales is merged to obtain local features L. The local features L are subjected to an identity mapping and M parallel deep convolutions to obtain context features Z of M scales. (m) The local feature L after the identity mapping is then integrated into the contextual feature Z of M scales through a convolution operation. (m) And the local feature L after identity mapping, finally the integrated feature is aggregated with the local feature L to obtain the final output feature P.

9. The small target face detection method according to claim 8, It is characterized in that The calculation process of the local feature L is: L=ConvX 5 +ConvX 4 +ADownX 3 Among them, Conv is the convolution operation, and ADown is the downsampling operation; The method for obtaining context features of M scales through M parallel deep convolutions is: Among them, Z (m) For the context features of each scale, DWConv refers to the depthwise convolution operation, and k(m) represents the convolution kernel size; The process of obtaining the final output feature P is as follows:

10. The small target face detection method according to claim 4, It is characterized in that The specific method of running the trained YOLOv8-PHA model on the validation set is as follows: input the validation set, run the trained YOLOv8-PHA model, compare the predicted box obtained by the YOLOv8-PHA model with the true target box, determine the truth of the predicted box by calculating the degree of overlap between the predicted box and the true target box, and then calculate the area of ​​the precision-recall curve based on the truth of the predicted box.