A face detection method and system for edge computing

By adopting the decoupled fully connected attention mechanism and CA module in the image detection task, combined with feature fusion enhancement network, the computing efficiency problems and feature information loss problems of the Transformer model on edge devices are solved, and more efficient feature extraction and Improved detection accuracy.

CN118968601BActive Publication Date: 2024-12-27XIANGJIANG LAB
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411422254.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2024-12-27
Estimated Expiration
2044-10-12

AI Technical Summary

Technical Problem

The existing Transformer model is difficult to deploy on edge devices due to the computational efficiency bottlenecks and excessive parameter volume of multi-head attention mechanism in image detection tasks. At the same time, top-down and bottom-up feature fusion methods lead to deep and shallow layers. The loss or degradation of feature information affects the detection accuracy.

Method used

Feature extraction is performed using a backbone network with a decoupled fully connected attention mechanism, combined with the CA module and SimAM module, a feature fusion enhancement network is built specifically for small object detection scenarios, a cosine annealing algorithm is used to adjust the learning rate, and an appropriate loss function is selected to Achieve better feature fusion and enhancement.

Benefits of technology

Reduces parameter quantity and calculation overhead, improves the edge deployment capability of the network, focuses on spatial and channel feature information, accelerates the network convergence speed, improves image detection accuracy, has fewer parameters, smaller calculation overhead, and better feature fusion results. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118968601B_ABST
    Figure CN118968601B_ABST
Patent Text Reader

Abstract

The present invention provides a face detection method and system for edge computing, which relates to the field of image processing technology. By obtaining face target image sample data, and preprocessing the face target sample data to generate a target data set; obtaining a preset neural network model, sending the target data set into the preset neural network model for iterative training, and using the cosine annealing algorithm to adjust the learning rate; after the preset neural network model is iteratively trained, the training result of the preset neural network model is obtained; the face image data to be detected is obtained and combined with the training result to generate a detection result. By effectively capturing the target in the test image and achieving better recognition effect without increasing the training cost. The technical effect of improving the detection accuracy of the neural network for the image is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a face detection method and system for edge computing. Background Art

[0002] Since its introduction, Vision Transformer based on multi-head attention mechanism (MHA) has achieved state-of-the-art performance in multiple visual tasks. The key is that multi-head attention mechanism (MHA) allows tokens to interact with each other and learn global representations. Therefore, applying multi-head attention mechanism (MHA) in feature extraction network is helpful for feature extraction; however, most Transformer models and their derivative models have a time complexity of The multi-head attention mechanism (MHA) creates a bottleneck in computational efficiency and additional parameters. In addition, MHA requires complex operations to calculate self-attention, which is not conducive to deployment on edge devices.

[0003] In the object detection task, multi-scale features are very important for encoding objects with scale differences. A common strategy for multi-scale feature extraction is to adopt classic top-down and bottom-up feature pyramid networks (such as FPN and PAFPN). However, the top-down fusion method requires deep features to propagate through multiple intermediate scales and interact with the features of these scales before they can be fused with the low-level features at the bottom. In this propagation and interaction process, information from high-level features may be lost or degraded. Similarly, in the bottom-up fusion process, information from shallow features may be lost or degraded in the attributes and interactions. These methods will cause the loss or degradation of deep and shallow feature information, thereby affecting the fusion effect of non-adjacent levels.

[0004] Therefore, how to improve the detection accuracy of neural networks for images has become a technical problem that needs to be solved urgently. Summary of the invention

[0005] In order to improve the detection accuracy of neural networks for images, the present application provides a face detection method and system for edge computing.

[0006] In the first aspect, the present application provides a face detection method for edge computing using the following technical solutions:

[0007] A face detection method for edge computing, comprising:

[0008] Acquire target face image sample data, and preprocess the target face sample data to generate a target data set;

[0009] Obtaining a preset neural network model, sending the target data set into the preset neural network model for iterative training, and adjusting the learning rate using a cosine annealing algorithm;

[0010] After the iterative training of the preset neural network model is completed, obtaining the training result of the preset neural network model;

[0011] Acquire the face image data to be detected and combine it with the training result to generate a detection result.

[0012] Optionally, the step of obtaining target face image sample data and preprocessing the target face sample data to generate a target data set includes:

[0013] Obtain face target image sample data;

[0014] Performing format conversion on the face target image sample data to generate a first data set;

[0015] Obtaining a preset partitioning strategy, and generating a training set and a validation set in the first data set according to the preset partitioning strategy;

[0016] Randomly applying a data augmentation strategy to the data of the training set to generate a target training set;

[0017] A target data set is generated according to the validation set and the target training set.

[0018] Optionally, before the step of obtaining a preset neural network model, sending the target data set into the preset neural network model for iterative training, and adjusting the learning rate using a cosine annealing algorithm, the step further includes:

[0019] Build the GhostNetV2 model as the backbone network;

[0020] Build feature fusion enhancement network AFPN;

[0021] Build the CA module and SimAM module, and build the target detection head;

[0022] A preset neural network model is generated according to the backbone network, the feature fusion enhancement network AFPN, the CA module, the SimAM module and the target detection head.

[0023] Optionally, the step of obtaining a preset neural network model, sending the target data set into the preset neural network model for iterative training, and adjusting the learning rate using a cosine annealing algorithm includes:

[0024] Get the preset neural network model;

[0025] Sending the target data into the preset neural network model for iterative training and determining the learning rate;

[0026] Use Warmup to warm up the learning rate, reduce the learning rate of the bias layer from 0.1 to 0.01, and increase the learning rate of other parameters from 0 to 0.01;

[0027] After the Warmup phase is finished, the learning rate during the current training of the preset neural network model is updated using a cosine annealing algorithm.

[0028] Optionally, the step of sending the target data into the preset neural network model for iterative training and determining a learning rate includes:

[0029] Sending the target data into the preset neural network model and training it using a transfer learning strategy;

[0030] The cross entropy loss function is selected as the loss function of the preset neural network model for target classification and positioning, and the α_CIoU loss is selected as the loss function of the preset neural network model for target box regression.

[0031] Optionally, the step of selecting α_CIoU loss as the loss function of the preset neural network model target box regression includes:

[0032] Select α_CIoU loss to predict the relative coordinates and relative height and width of the target box relative to the upper left corner of the feature map grid of different scales by predicting the relative position to obtain the center coordinates of the predicted target box And height and width , the formula is:

[0033]

[0034] in, are the 4 offsets predicted by the network model, is the offset of the cell grid relative to the upper left corner of the image, is the width and height of the prior box, is the confidence of the prediction box, which is determined by the target true probability of the prediction box and the confidence of the prediction box and the true box. Multiply the values ​​together.

[0035] In a second aspect, the present application provides a face detection system for edge computing, including:

[0036] A target data set module is used to obtain target face image sample data and pre-process the target face sample data to generate a target data set;

[0037] A preset neural network module is used to obtain a preset neural network model, send the target data set into the preset neural network model for iterative training, and adjust the learning rate using a cosine annealing algorithm;

[0038] A training result module, used for obtaining the training result of the preset neural network model after the iterative training of the preset neural network model is completed;

[0039] The detection result module is used to obtain the face image data to be detected and combine it with the training result to generate the detection result.

[0040] Optionally, the target data set module is further used to obtain face target image sample data;

[0041] Performing format conversion on the face target image sample data to generate a first data set;

[0042] Obtaining a preset partitioning strategy, and generating a training set and a validation set in the first data set according to the preset partitioning strategy;

[0043] Randomly applying a data augmentation strategy to the data of the training set to generate a target training set;

[0044] A target data set is generated according to the validation set and the target training set.

[0045] The target data set module is also used to obtain face target image sample data;

[0046] Performing format conversion on the face target image sample data to generate a first data set;

[0047] Obtaining a preset partitioning strategy, and generating a training set and a validation set in the first data set according to the preset partitioning strategy;

[0048] Randomly applying a data augmentation strategy to the data of the training set to generate a target training set;

[0049] A target data set is generated according to the validation set and the target training set.

[0050] In a third aspect, the present application provides a computer device, comprising: a memory and a processor, wherein the processor executes the method described above when running computer instructions stored in the memory.

[0051] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the method described above when run.

[0052] In summary, the present application includes the following beneficial technical effects:

[0053] This application uses a backbone network with a decoupled fully connected attention mechanism for feature extraction, which reduces the amount of parameters and computational overhead generated while realizing the self-attention mechanism, and is helpful for the edge deployment of the network. Through the CA module and the SimAM module, the network pays more attention to the spatial feature information and channel feature information of the training samples, and can accelerate the convergence speed of the network. A feature fusion enhancement network redesigned specifically for small target detection scenarios is adopted. The network can adaptively adjust the weights of each feature map when fusion is performed when progressively fusing features of different scales to achieve better feature fusion and enhancement. Compared with the traditional feature enhancement fusion network, the network generates fewer parameters, less computational overhead, and better feature fusion results. The technical effect of improving the detection accuracy of the neural network for images is achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 It is a schematic diagram of the computer device structure of the hardware operating environment involved in the embodiment of the present application;

[0055] Figure 2 This is a flow chart of the first embodiment of the face detection method for edge computing of the present application;

[0056] Figure 3 This is a schematic diagram of the backbone network structure of the first embodiment of the face detection method for edge computing of the present application;

[0057] Figure 4 This is a structural diagram of the receptive field expansion module SPPF of the first embodiment of the face detection method for edge computing of the present application;

[0058] Figure 5 This is a structural diagram of a CA module of the first embodiment of the face detection method for edge computing of the present application;

[0059] Figure 6 This is a schematic diagram of the overall structure of the network of the first embodiment of the face detection method for edge computing of the present application;

[0060] Figure 7 This is an experimental comparison result diagram of the face detection method for edge computing in this application and the popular target detection network model YOLOv5;

[0061] Figure 8 It is a structural block diagram of the first embodiment of the face detection system for edge computing of the present application. DETAILED DESCRIPTION

[0062] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below through the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0063] Reference Figure 1 , Figure 1 A schematic diagram of the computer device structure of the hardware operating environment involved in the embodiment of the present application.

[0064] like Figure 1 As shown, the computer device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM), or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0065] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the computer device, and may include more or less components than shown in the figure, or combine some components, or arrange the components differently.

[0066] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a face detection program for edge computing.

[0067] exist Figure 1 In the computer device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the present application can be set in the computer device, and the computer device calls the edge computing-oriented face detection program stored in the memory 1005 through the processor 1001, and executes the edge computing-oriented face detection method provided in the embodiment of the present application.

[0068] The present application embodiment provides a face detection method for edge computing, referring to Figure 2 , Figure 2 This is a flow chart of the first embodiment of the face detection method for edge computing of the present application.

[0069] In this embodiment, the face detection method for edge computing includes the following steps:

[0070] Step S10: Acquire target face image sample data, and preprocess the target face sample data to generate a target data set.

[0071] In a specific implementation, the steps of obtaining target face image sample data and preprocessing the target face sample data to generate a target data set include: obtaining target face image sample data; formatting the target face image sample data to generate a first data set; obtaining a preset partitioning strategy, and generating a training set and a verification set in the first data set according to the preset partitioning strategy; randomly applying a data enhancement strategy to the data of the training set to generate a target training set; and generating a target data set according to the verification set and the target training set.

[0072] It should be noted that a data set of face target samples to be detected is obtained, and the image data in the data set is converted into a format that can be directly input into the network for training, including: converting the images in the data set into PNG format, creating and modifying a JSON file containing all target types to be detected, and converting all image data in the data set into a VOC data set format.

[0073] It can be understood that the image data that can be used for the target detection data set is divided into a training set and a validation set according to a preset ratio, and then data enhancement is randomly applied to the data used for training to obtain the final training set data for training, including dividing the image data that can be used for the target detection data set into a training set and a validation set according to a ratio of 9:1, and then randomly applying Mosaic-4 data enhancement to all the data, that is, 4 pictures are randomly cropped, randomly arranged, randomly scaled, and then combined into one picture, and some simple random noise is reasonably introduced at the same time, and ordinary data enhancement is randomly applied to all the data, that is, any picture and the picture after Mosaic data enhancement are randomly stretched, randomly horizontally flipped, and randomly color gamut enhanced to obtain the final training set data for training.

[0074] In the specific implementation, this embodiment converts the image data in the face data set into a format that can be directly input into the network for training. All the image data are enhanced with Mosaic data and ordinary data to expand the data set and improve the generalization ability of the model after training.

[0075] Step S20: Obtain a preset neural network model, send the target data set into the preset neural network model for iterative training, and use the cosine annealing algorithm to adjust the learning rate.

[0076] In the specific implementation, before obtaining the preset neural network model, sending the target data set into the preset neural network model for iterative training, and using the cosine annealing algorithm to adjust the learning rate, it also includes: building a GhostNetV2 model as the backbone network; building a feature fusion enhancement network AFPN; building a CA module and a SimAM module, and building a target detection head; generating a preset neural network model based on the backbone network, the feature fusion enhancement network AFPN, the CA module, the SimAM module, and the target detection head.

[0077] It should be noted that the preset neural network model needs to build the corresponding backbone network, feature fusion enhancement network, attention mechanism module and target detection head, including: building the GhostNetV2 model as the backbone network for feature extraction, building the redesigned feature fusion enhancement network AFPN for feature fusion enhancement, building the CA module and SimAM module, and building the target detection head. The training set data obtained for training is loaded into the preset neural network model for iterative training, the SGD optimizer is selected as the network optimizer, and the cosine annealing algorithm is used to adjust the learning rate during network training.

[0078] It can be understood that the preset neural network mainly includes three parts: feature extraction network backbone, feature fusion enhancement network AFPN and detection head Head. Among them, the backbone feature extraction network GhostNetV2 will generate four feature extraction output results of different scales based on the decoupled fully connected attention mechanism, and then send these results to the feature fusion network AFPN for feature fusion. The calculation process of the decoupled fully connected attention mechanism is as follows:

[0079] That is, for a given input , which can be regarded as token, that is , and considering that the input features are all 2D, two fully connected layers with fixed weights can be used to generate an attention map with a global receptive field, that is, to gradually aggregate features along the horizontal and vertical directions respectively. The above process can be expressed as:

[0080]

[0081] in, represents element-wise multiplication, and are learnable weights, is the generated attention map.

[0082] The computational complexity of the above process is Considering that in order to process input images of different resolutions, the two fully connected layers used above can be replaced by two convolutional kernels with sizes of and The depth-separable convolutional layer can further reduce the computational complexity of the above calculation process to .

[0083] It can be understood that the fusion network AFPN, which is specially improved for the characteristics of small-scale target detection tasks, processes the input features of four different scales of 20×20, 40×40, 80×80, and 160×160 extracted by the backbone network. The steps are as follows: the input features of four different scales of 20×20, 40×40, 80×80, and 160×160 are respectively passed through four different convolutional layers to adjust the depth to obtain ;Will Upsample and Obtained by fusion through adaptively assigned weights At the same time, Downsample and Obtained by fusion through adaptively assigned weights ;Will Continue learning features through residual units; and Upsample and Obtained by fusion through adaptively assigned weights ,Will Upsampling, while Downsampling, both Obtained by fusion through adaptively assigned weights ,Will and Downsample and Obtained by fusion through adaptively assigned weights ;Will Continue learning features through residual units; Upsample and Obtained by fusion through adaptively assigned weights ,Will Upsampling, while Downsampling, the three and Obtained by fusion through adaptively assigned weights ,Will Downsampling, while Upsampling, the three and Obtained by fusion through adaptively assigned weights ; S3.5: Continue learning features through residual units; S3.7: The fusion result is obtained by adjusting the depth through three different convolutional layers It is used to send to the prediction feature layer for prediction. Taking the fusion of three levels of features as an example, the solution method for adaptive weights follows the following formula:

[0084]

[0085] Among them, Indicates the position from Level n to Level m The resulting eigenvector is expressed as , obtained by adaptive spatial fusion of multi-level features and by linear combination of feature vectors Indicates. Among them, Represents the spatial weight of the features of the three levels at Level m, affected by constraints.

[0086] In the specific implementation, the parameters related to the network operation are set, including: setting the resolution of the input image data to 640×640×3, the probability of random mosaic data enhancement to 0.5, the probability of random stretching and random horizontal flipping to 0.5, and the probability of random color gamut enhancement to 0.7.

[0087] In a specific implementation, a preset neural network model is obtained, a target data set is sent into the preset neural network model for iterative training, and the steps of adjusting the learning rate using a cosine annealing algorithm include: obtaining a preset neural network model; sending the target data into the preset neural network model for iterative training and determining the learning rate; using Warmup to warm up the learning rate, reducing the learning rate of the bias layer from 0.1 to 0.01, and increasing the learning rate of other parameters from 0 to 0.01; after the Warmup stage is over, using the cosine annealing algorithm to update the learning rate of the current preset neural network model during training.

[0088] It should be noted that the step of sending the target data into the preset neural network model for iterative training and determining the learning rate includes: sending the target data into the preset neural network model and training with the strategy of transfer learning; selecting the cross entropy loss function as the loss function of the preset neural network model for target classification and positioning, and selecting α_CIoU loss as the loss function of the preset neural network model for target box regression.

[0089] It can be understood that the step of selecting α_CIoU loss as the loss function of the preset neural network model target frame regression includes: selecting α_CIoU loss to predict the relative coordinates and relative height and width of the target frame relative to the upper left corner of the feature map grid of different scales by predicting the relative position to obtain the center coordinates of the predicted target frame And height and width , the formula is:

[0090]

[0091] in, are the 4 offsets predicted by the network model, is the offset of the cell grid relative to the upper left corner of the image, is the width and height of the prior box. is the confidence of the prediction box, which is determined by the target true probability of the prediction box and the confidence of the prediction box and the true box. In order to predict the center point of the bounding box, the sigmoid function is used to process the offset value so that the predicted offset value is within the range of (0, 1). By setting the threshold, you can filter out the prediction boxes with lower confidence, and then apply the non-maximum suppression algorithm to the remaining prediction boxes to get the final prediction box.

[0092] It is understandable that before starting the next training, the network training weights obtained this time will be smoothed to speed up the convergence of the network.

[0093] It should be noted that at the end of each training, the training weight with the lowest current loss will be saved as the best result of network training.

[0094] In the specific implementation, Figure 3As shown in the figure, the data-enhanced image is sent to the backbone network of the network for feature extraction. The backbone network consists of 5 layers. Except for the Stage1 layer, the input features are first downsampled by 2 times by Ghost_bottleneck_s2 when they are input to each layer structure. In Ghost_bottleneck, the input passes through the Ghost Module and DFC attention branches respectively, and then the attention result generated by the DFC attention mechanism is multiplied by the result generated by the Ghost Module. The result is processed by a Ghost Module again, and finally the processed result is added to the input feature map to obtain the final processed result. In the Ghost Module, for the input, the primary conv operation is first used to generate a part of the feature map, and then the cheap operation is used to generate the remaining feature map through a series of cheap operations based on the result generated by the former, and finally the results of the two are spliced ​​to obtain the output feature map. In DFC attention, for the input, it will first go through a down sample and conv to adjust the scale and depth, then pass through the FC layer in the horizontal and vertical directions to obtain the attention feature results, and finally the attention result is adjusted to the value distribution between (0,1) through the sigmoid function.

[0095] like Figure 4 As shown in the figure, for the deep feature results extracted by the backbone network, the receptive field will be expanded through the SPPF module.

[0096] like Figure 5 As shown in the figure, the feature extraction results of four different scales obtained from the backbone network will be added with channel attention results and spatial attention results through the CA module. Specifically, for the input, each channel will be encoded along the horizontal and vertical coordinates first to obtain feature maps in both width and height directions; then the width and height will be transposed to the same dimension and concatenated; then, the width and height features will be processed separately and in parallel; finally, after adjusting the number of channels using convolution, the two will take sigmoid to obtain the attention in the width and height dimensions, and multiply by the original features to obtain the final result.

[0097] Specifically, Figure 6 As shown in the figure, for the constructed feature enhancement fusion network, the feature extraction results of four different scales of Lower-Level, Low-Level, High-Level and Top-Level are obtained from the backbone network in sequence as input, and then after the feature fusion is performed step by step, the result is The three results are sent to three detection heads respectively.

[0098] Step S30: After the iterative training of the preset neural network model is completed, the training result of the preset neural network model is obtained.

[0099] In the specific implementation, the training parameters of the network are set and the optimizer and loss function required for network training are instantiated. Then the enhanced data is input into the network for iterative training, and the learning rate is adjusted using the cosine annealing algorithm. The best training results are saved during the network training process.

[0100] Step S40: Obtain the face image data to be detected and combine it with the training results to generate a detection result.

[0101] In a specific implementation, after the network training is completed, the network is created again and the weights obtained from the previous training are loaded, and then the image that needs to be detected is loaded to check the detection results of the network.

[0102] It should be noted that this embodiment uses a backbone network with a decoupled fully connected attention mechanism for feature extraction, which reduces the number of parameters and computational overhead generated while implementing the self-attention mechanism, and is conducive to the edge deployment of the network;

[0103] This embodiment uses the CA module and the SimAM module, which, on the one hand, makes the network pay more attention to the spatial feature information and channel feature information of the training samples, and on the other hand, can accelerate the convergence speed of the network;

[0104] This embodiment adopts a feature fusion enhancement network that is redesigned specifically for small target detection scenarios. The network can adaptively adjust the weights of each feature map when progressively fusing features of different scales to achieve better feature fusion and enhancement. Compared with traditional feature enhancement fusion networks, this network generates fewer parameters, has lower computational overhead, and has better feature fusion results.

[0105] It can be understood that the main steps of this embodiment include: obtaining a face detection data set, re-labeling and dividing it, and using data enhancement to obtain a new data set; considering that the existing model based on the self-attention mechanism will bring a certain performance improvement to the network, but this improvement will be accompanied by a significant increase in the number of network parameters and computational overhead, which is obviously not conducive to the computing needs of edge devices. The decoupled fully connected attention mechanism is integrated into the backbone network for feature extraction to balance the performance, parameter amount and computational overhead; a progressive fusion strategy is introduced in the process of the network fusing the extracted feature information, which improves the performance while lightweighting the network. Considering that most face detection scenarios are small target detection samples, this embodiment redesigns the feature fusion enhancement network based on the original structure, aiming to introduce a larger scale feature extraction result in the shallow layer of the backbone network to improve the detection performance of small-scale targets, and at the same time deletes the relevant processing structure of the deep extraction result for large-scale target detection, thereby further reducing the number of parameters and computational overhead. In addition, the attention mechanism module is applied to the feature extraction results of the backbone network to enhance the model's feature recognition ability for face targets. The preset neural network model proposed in this embodiment is significantly competitive in terms of parameter quantity and computational overhead, can effectively capture the target in the same test image, and achieve better recognition effect without increasing training costs.

[0106] In the specific implementation, Figure 7 As shown, Figure 7 The comparison results of the method of this embodiment and the popular target detection network model YOLOv5 in terms of parameter quantity (unit: megabyte) and computational overhead (number of floating-point operations per second, unit: megabyte) are shown. By analyzing the comparison results, the parameter quantity and computational overhead of the method of this embodiment only account for 40.6% and 12.6% of the parameters of YOLOv5.

[0107] This embodiment uses a backbone network with a decoupled fully connected attention mechanism for feature extraction, which reduces the amount of parameters and computational overhead generated while realizing the self-attention mechanism, and is helpful for the edge deployment of the network. Through the CA module and the SimAM module, the network pays more attention to the spatial feature information and channel feature information of the training samples, and at the same time can accelerate the convergence speed of the network. A feature fusion enhancement network specially designed for small target detection scenarios is adopted. The network can adaptively adjust the weights of each feature map when fusion is performed when progressively fusing features of different scales to achieve better feature fusion and enhancement. Compared with the traditional feature enhancement fusion network, the network generates fewer parameters, smaller computational overhead, and better feature fusion results. The technical effect of improving the detection accuracy of neural networks for images is achieved.

[0108] In addition, an embodiment of the present application also proposes a computer-readable storage medium, on which a program for face detection for edge computing is stored. When the program for face detection for edge computing is executed by a processor, the steps of the method for face detection for edge computing as described above are implemented.

[0109] Reference Figure 8 , Figure 8 This is a structural block diagram of the first embodiment of the face detection system for edge computing of the present application.

[0110] like Figure 8 As shown, the face detection system for edge computing proposed in the embodiment of the present application includes:

[0111] The target data set module 10 is used to obtain target face image sample data and pre-process the target face sample data to generate a target data set;

[0112] A preset neural network module 20 is used to obtain a preset neural network model, send the target data set into the preset neural network model for iterative training, and use a cosine annealing algorithm to adjust the learning rate;

[0113] A training result module 30 is used to obtain the training result of the preset neural network model after the iterative training of the preset neural network model is completed;

[0114] The detection result module 40 is used to obtain the face image data to be detected and combine it with the training results to generate the detection result.

[0115] It should be understood that the above is only an example and does not constitute any limitation on the technical solution of the present application. In specific applications, technicians in this field can make settings as needed, and the present application does not impose any limitation on this.

[0116] This embodiment uses a backbone network with a decoupled fully connected attention mechanism for feature extraction, which reduces the amount of parameters and computational overhead generated while realizing the self-attention mechanism, and is helpful for the edge deployment of the network. Through the CA module and the SimAM module, the network pays more attention to the spatial feature information and channel feature information of the training samples, and at the same time can accelerate the convergence speed of the network. A feature fusion enhancement network specially designed for small target detection scenarios is adopted. The network can adaptively adjust the weights of each feature map when fusion is performed when progressively fusing features of different scales to achieve better feature fusion and enhancement. Compared with the traditional feature enhancement fusion network, the network generates fewer parameters, smaller computational overhead, and better feature fusion results. The technical effect of improving the detection accuracy of neural networks for images is achieved.

[0117] In one embodiment, the target data set module 10 is also used to obtain face target image sample data; perform format conversion on the face target image sample data to generate a first data set; obtain a preset partitioning strategy, and generate a training set and a verification set in the first data set according to the preset partitioning strategy; randomly apply a data enhancement strategy to the data of the training set to generate a target training set; and generate a target data set according to the verification set and the target training set.

[0118] In one embodiment, the preset neural network module 20 is also used to build a GhostNetV2 model as the backbone network; build a feature fusion enhancement network AFPN; build a CA module and a SimAM module, and build a target detection head; generate a preset neural network model based on the backbone network, the feature fusion enhancement network AFPN, the CA module, the SimAM module and the target detection head.

[0119] In one embodiment, the preset neural network module 20 is also used to obtain a preset neural network model; the target data is sent to the preset neural network model for iterative training and the learning rate is determined; Warmup is used to warm up the learning rate, the learning rate of the bias layer is reduced from 0.1 to 0.01, and the learning rate of other parameters is increased from 0 to 0.01; after the Warmup stage is over, the cosine annealing algorithm is used to update the learning rate during the current preset neural network model training.

[0120] In one embodiment, the preset neural network module 20 is also used to send the target data into the preset neural network model and train it using the transfer learning strategy; the cross entropy loss function is selected as the loss function of the preset neural network model for target classification and positioning, and the α_CIoU loss is selected as the loss function of the preset neural network model for target box regression.

[0121] In one embodiment, the neural network module 20 is preset, and is also used to select the α_CIoU loss to predict the relative coordinates and relative height and width of the target frame relative to the upper left corner of the grid of the feature map of different scales by predicting the relative position to obtain the center coordinates of the predicted target frame. And height and width , the formula is:

[0122]

[0123] in, are the 4 offsets predicted by the network model, is the offset of the cell grid relative to the upper left corner of the image, is the width and height of the prior box, is the confidence of the prediction box, which is determined by the target true probability of the prediction box and the confidence of the prediction box and the true box. Multiply the values ​​together.

[0124] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present application. In practical applications, technicians in this field can select part or all of it according to actual needs to achieve the purpose of the present embodiment, and no limitation is made here.

[0125] In addition, for technical details not described in detail in this embodiment, please refer to the method for face detection for edge computing provided in any embodiment of the present application, which will not be repeated here.

[0126] In addition, it should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0127] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0128] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory (ROM) / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of each embodiment of the present application. The above is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. All equivalent structures or equivalent process changes made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are similarly included in the patent protection scope of the present application.

Claims

1. A face detection method for edge computing, characterized in that: include: Acquire target face image sample data, and preprocess the target face sample data to generate a target data set; Obtaining a preset neural network model, sending the target data set into the preset neural network model for iterative training, and adjusting the learning rate using a cosine annealing algorithm; After the iterative training of the preset neural network model is completed, obtaining the training result of the preset neural network model; Acquire the face image data to be detected and combine it with the training result to generate a detection result; The step of obtaining target face image sample data and preprocessing the target face sample data to generate a target data set includes: Obtain face target image sample data; Performing format conversion on the face target image sample data to generate a first data set; Obtaining a preset partitioning strategy, and generating a training set and a validation set in the first data set according to the preset partitioning strategy; Randomly applying a data augmentation strategy to the data of the training set to generate a target training set; Generate a target data set according to the validation set and the target training set; Wherein, before the step of obtaining a preset neural network model, sending the target data set into the preset neural network model for iterative training, and adjusting the learning rate using a cosine annealing algorithm, the step further includes: Build the GhostNetV2 model as the backbone network; Build feature fusion enhancement network AFPN; Build the CA module and SimAM module, and build the target detection head; Generate a preset neural network model according to the backbone network, the feature fusion enhancement network AFPN, the CA module, the SimAM module and the target detection head; The step of obtaining a preset neural network model, sending the target data set into the preset neural network model for iterative training, and adjusting the learning rate using a cosine annealing algorithm includes: Get the preset neural network model; Sending the target data set into the preset neural network model for iterative training and determining a learning rate; Use Warmup to warm up the learning rate, reduce the learning rate of the bias layer from 0.1 to 0.01, and increase the learning rate of other parameters from 0 to 0.01; After the Warmup phase is over, the learning rate during the current training of the preset neural network model is updated using a cosine annealing algorithm; The step of sending the target data set into the preset neural network model for iterative training and determining the learning rate includes: Sending the target data set into the preset neural network model and training it using a transfer learning strategy; Select the cross entropy loss function as the loss function of the preset neural network model for target classification and positioning, and select the α_CIoU loss as the loss function of the preset neural network model for target frame regression; Among them, the selection The step of using the loss as the loss function of the target frame regression of the preset neural network model includes: choose The loss predicts the relative coordinates and relative height and width of the target box relative to the upper left corner of the feature map grid of different scales by predicting the relative position to obtain the center coordinates of the predicted target box. And height and width , the formula is: in, , , , , are the 4 offsets predicted by the network model, is the offset of the cell grid relative to the upper left corner of the image, is the width and height of the prior box, is the confidence of the prediction box, which is determined by the target true probability of the prediction box and the confidence of the prediction box and the true box. Multiply the values ​​together.

2. A face detection system for edge computing, characterized in that: include: A target data set module is used to obtain target face image sample data and pre-process the target face sample data to generate a target data set; A preset neural network module is used to obtain a preset neural network model, send the target data set into the preset neural network model for iterative training, and adjust the learning rate using a cosine annealing algorithm; A training result module, used for obtaining the training result of the preset neural network model after the iterative training of the preset neural network model is completed; A detection result module, used to obtain the face image data to be detected and combine it with the training result to generate a detection result; Wherein, the target data set module is also used to obtain face target image sample data; Performing format conversion on the face target image sample data to generate a first data set; Obtaining a preset partitioning strategy, and generating a training set and a validation set in the first data set according to the preset partitioning strategy; Randomly applying a data augmentation strategy to the data of the training set to generate a target training set; Generate a target data set according to the validation set and the target training set; Wherein, the preset neural network module is also used to build a GhostNetV2 model as a backbone network; Build feature fusion enhancement network AFPN; Build the CA module and SimAM module, and build the target detection head; Generate a preset neural network model according to the backbone network, the feature fusion enhancement network AFPN, the CA module, the SimAM module and the target detection head; Wherein, the preset neural network module is used to obtain a preset neural network model; Sending the target data set into the preset neural network model for iterative training and determining a learning rate; Use Warmup to warm up the learning rate, reduce the learning rate of the bias layer from 0.1 to 0.01, and increase the learning rate of other parameters from 0 to 0.01; After the Warmup phase is over, the learning rate during the current training of the preset neural network model is updated using a cosine annealing algorithm; The preset neural network module is used to send the target data set into the preset neural network model and perform training using a transfer learning strategy; Select the cross entropy loss function as the loss function of the preset neural network model for target classification and positioning, and select the α_CIoU loss as the loss function of the preset neural network model for target frame regression; Wherein, the preset neural network module is used to select The loss predicts the relative coordinates and relative height and width of the target box relative to the upper left corner of the feature map grid of different scales by predicting the relative position to obtain the center coordinates of the predicted target box. And height and width , the formula is: in, , , , , are the 4 offsets predicted by the network model, is the offset of the cell grid relative to the upper left corner of the image, is the width and height of the prior box, is the confidence of the prediction box, which is determined by the target true probability of the prediction box and the confidence of the prediction box and the true box. Multiply the values ​​together.

3. A computer device, characterized in that: The device comprises: a memory and a processor, and the processor executes the method according to claim 1 when running computer instructions stored in the memory.

4. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the method of claim 1 when executed.