Method and device for detecting abnormality of human face, processor and electronic device
By building a deep learning-based target detection algorithm in the monitoring system, especially adding a target attention mechanism module and a feature extraction module, the problem that the monitoring system has difficulty detecting abnormal faces is solved, effective detection and real-time alarm of occluded faces are achieved, and the system's performance is improved.
Patent Information
- Application Number
- CN202210577436.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-25
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-05-25
AI Technical Summary
Existing monitoring systems have difficulty detecting abnormal faces, especially near ATMs, resulting in poor monitoring system performance, inability to provide real-time alarms, and a large waste of information communication and manpower and material resources.
A deep learning target detection algorithm is constructed using an initial target detection algorithm based on deep learning, a target attention mechanism module, and a feature extraction module. By adding a target attention mechanism module and a feature extraction module, especially a spatial pyramid pooling structure, the detection capability of occluded faces is improved.
It improves the monitoring system's detection rate for abnormal faces, realizes real-time alarm, improves the use effect of the monitoring system, and reduces the waste of manpower and material resources.
Smart Images

Figure CN115063850B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and more specifically, to a method and device for detecting facial anomalies, a processor, and an electronic device. Background Art
[0002] As a direct and reliable biometric feature, the human face has extensive applications in fields such as information security, financial security, social public security, virtual reality, and augmented reality. In recent years, with the rapid development of computer vision and deep learning technologies, deep learning-based face detection has gained widespread application. Furthermore, deep learning-based face detection leverages various techniques, such as convolutional neural networks and multi-layer feature fusion, to improve target detection accuracy while maintaining a certain level of real-time performance, gradually replacing traditional algorithms.
[0003] Moreover, face detection technology is simply to detect whether there is a face in an image. There are only two results: yes or no. The technical means based on deep learning is to input a face image, and predict the probability of the presence of a face through the convolutional network, feature fusion network, and fully connected prediction layer at one time, so as to determine whether there is a face.
[0004] Furthermore, with economic development, banking security monitoring, self-service terminals, and automated teller machines (ATMs) have experienced rapid growth in recent years. While these systems facilitate quick transactions and deposits and withdrawals, they have also led to a growing number of ATM-related disputes and financial disputes. Numerous ATM cases demonstrate that, to evade surveillance cameras, users often employ disguises, such as wearing masks, sunglasses, or masks. In these cases, the accuracy of anomaly detection plummets, often resulting in missed detections of unusual faces, causing significant damage to the economy and public security. While existing face detection methods offer strong feature extraction capabilities for facial frames and facial landmarks (eyes, nose, eyebrows, and mouth), resulting in high prediction accuracy, they can still misidentify faces as normal when obscured. This clearly fails to meet the needs of bank branches for detecting unusual faces.
[0005] Therefore, there are many problems with the current monitoring system: (1) 24-hour uninterrupted recording brings a huge burden to the information communication and storage of the monitoring system, and subsequent evidence collection requires a lot of manpower, material resources and time to browse and retrieve relevant video information; (2) There is a lack of intelligent detection methods. For example, if illegal activities are carried out using ATM machines, the monitoring system cannot actively alarm; (3) The monitoring system is meaningless to record videos of people with obscured faces. Therefore, abnormal face detection has a wide range of applications, especially near ATM machines. The existing video monitoring system has a low detection rate for abnormal faces and is almost unable to provide real-time alarms, which restricts the application of abnormal face detection in ATM machines.
[0006] Currently, no effective solution has been proposed to address the problem that the face detection method used in the monitoring system in the related art is difficult to detect abnormal faces, which affects the effectiveness of the monitoring system. Summary of the Invention
[0007] The main purpose of this application is to provide a method and device for detecting abnormal faces, a processor and an electronic device to solve the problem in related technologies that the monitoring system using the face detection method has difficulty in detecting abnormal faces, which affects the use effect of the monitoring system.
[0008] To achieve the above objectives, according to one aspect of the present application, a method for detecting facial anomalies is provided. The method comprises: obtaining a target image of a target face, wherein the target face is a face to be detected for facial anomalies in a monitoring system; inputting the target image into a deep learning target detection algorithm for anomaly detection processing, and obtaining an anomaly detection result for the target face, wherein the deep learning target detection algorithm is an algorithm constructed based on an initial target detection algorithm of deep learning, a target attention mechanism module, and a feature extraction module, and the feature extraction module is generated based on the spatial pyramid pooling structure in the initial target detection algorithm.
[0009] Furthermore, before inputting the target image into the deep learning target detection algorithm for anomaly detection processing to obtain the anomaly detection result of the target face, the method also includes: determining the feature fusion layer of each residual module in the initial target detection algorithm and the feature merging layer in the initial target detection algorithm; adding the target attention mechanism module at the upper level of the feature fusion layer, and adding the target attention mechanism module at the lower level of the feature merging layer to obtain the processed initial target detection algorithm; processing the spatial pyramid pooling structure in the processed initial target detection algorithm according to the target cross-stage local network module to obtain the feature extraction module, wherein the target cross-stage local network module is a module in the initial target detection algorithm or a module in the processed initial target detection algorithm; constructing the deep learning target detection algorithm based on the processed initial target detection algorithm and the feature extraction module.
[0010] Furthermore, the target attention mechanism module includes a channel attention feature extraction module and a spatial attention feature extraction module, and the target image is input into the deep learning target detection algorithm for anomaly detection processing to obtain the anomaly detection result of the target face, including: inputting the target image into the deep learning target detection algorithm to obtain the first feature of the target image; inputting the first feature into the channel attention feature extraction module to obtain the target channel attention feature; inputting the target channel attention feature into the spatial attention feature extraction module to obtain the target spatial attention feature; inputting the first feature into the feature extraction module to obtain the target feature; and obtaining the anomaly detection result of the target face based on the target spatial attention feature and the target feature.
[0011] Furthermore, inputting the first feature into the feature extraction module to obtain the target feature includes: inputting the first feature into the first convolution layer in the feature extraction module to obtain the second feature; inputting the second feature into the second convolution layer and the third convolution layer in the feature extraction module respectively to obtain the third feature and the fourth feature; inputting the third feature into the spatial pyramid pooling structure and performing convolution processing on the third feature to obtain the fifth feature; and merging the fourth feature and the fifth feature to obtain the target feature.
[0012] Furthermore, the first feature is input into the channel attention feature extraction module to obtain the target channel attention feature, including: based on the target channel of the channel attention feature extraction module, performing global maximum pooling processing on the first feature to obtain the first channel attention feature; based on the target channel, performing global average pooling processing on the first feature to obtain the second channel attention feature; splicing the first channel attention feature and the second channel attention feature to obtain the third channel attention feature; performing convolution processing on the third channel attention feature, and processing the third channel attention feature with an activation function to generate a fourth spatial attention feature; multiplying the first feature and the fourth spatial attention feature to obtain the target channel attention feature.
[0013] Furthermore, the target channel attention feature is input into the spatial attention feature extraction module to obtain the target spatial attention feature, including: performing the global maximum pooling process and the global average pooling process on the target channel attention feature respectively to obtain a first spatial attention feature; inputting the first spatial attention feature into the multi-layer perceptron in the spatial attention feature extraction module to obtain multiple second spatial attention features; performing a summing operation on the multiple second spatial attention features to obtain a third spatial attention feature; and processing the third spatial attention feature using the activation function to generate the target spatial attention feature.
[0014] Furthermore, after inputting the target image into a deep learning target detection algorithm for anomaly detection processing and obtaining an anomaly detection result of the target face, the method also includes: if the anomaly detection result indicates that the target face is an abnormal face, controlling the monitoring system to trigger an alarm signal.
[0015] To achieve the above-mentioned purpose, according to another aspect of the present application, a facial anomaly detection device is provided. The device comprises: a first acquisition unit, configured to acquire a target image of a target face, wherein the target face is a face to be detected for facial anomaly in a monitoring system; and a first processing unit, configured to input the target image into a deep learning target detection algorithm for anomaly detection processing to obtain an anomaly detection result for the target face, wherein the deep learning target detection algorithm is an algorithm constructed based on an initial target detection algorithm of deep learning, a target attention mechanism module, and a feature extraction module, and the feature extraction module is generated based on the spatial pyramid pooling structure in the initial target detection algorithm.
[0016] Furthermore, the device also includes: a first determination unit, used to determine the feature fusion layer of each residual module in the initial target detection algorithm and the feature merging layer in the initial target detection algorithm before inputting the target image into the deep learning target detection algorithm for anomaly detection processing to obtain the anomaly detection result of the target face; a first adding unit, used to add the target attention mechanism module at the upper level of the feature fusion layer, and add the target attention mechanism module at the lower level of the feature merging layer to obtain the processed initial target detection algorithm; a second processing unit, used to process the spatial pyramid pooling structure in the processed initial target detection algorithm based on the target cross-stage local network module to obtain the feature extraction module, wherein the target cross-stage local network module is a module in the initial target detection algorithm or a module in the processed initial target detection algorithm; a first construction unit, used to construct the deep learning target detection algorithm based on the processed initial target detection algorithm and the feature extraction module.
[0017] Furthermore, the target attention mechanism module includes a channel attention feature extraction module and a spatial attention feature extraction module, and the first processing unit includes: a first input module, used to input the target image into the deep learning target detection algorithm to obtain the first feature of the target image; a second input module, used to input the first feature into the channel attention feature extraction module to obtain the target channel attention feature; a third input module, used to input the target channel attention feature into the spatial attention feature extraction module to obtain the target spatial attention feature; a fourth input module, used to input the first feature into the feature extraction module to obtain the target feature; a first determination module, used to obtain the abnormality detection result of the target face based on the target spatial attention feature and the target feature.
[0018] Furthermore, the fourth input module includes: a first input submodule, used to input the first feature into the first convolution layer in the feature extraction module to obtain a second feature; a second input submodule, used to input the second feature into the second convolution layer and the third convolution layer in the feature extraction module respectively to obtain a third feature and a fourth feature; a first processing submodule, used to input the third feature into the spatial pyramid pooling structure and perform convolution processing on the third feature to obtain a fifth feature; and a second processing submodule, used to merge the fourth feature and the fifth feature to obtain the target feature.
[0019] Furthermore, the second input module includes: a third processing sub-module, which is used to perform global maximum pooling processing on the first feature based on the target channel of the channel attention feature extraction module to obtain a first channel attention feature; a fourth processing sub-module, which is used to perform global average pooling processing on the first feature based on the target channel to obtain a second channel attention feature; a fifth processing sub-module, which is used to splice the first channel attention feature and the second channel attention feature to obtain a third channel attention feature; a sixth processing sub-module, which is used to perform convolution processing on the third channel attention feature, and use an activation function to process the third channel attention feature to generate a fourth spatial attention feature; a first multiplication sub-module, which is used to multiply the first feature and the fourth spatial attention feature to obtain the target channel attention feature.
[0020] Furthermore, the third input module includes: a seventh processing sub-module, used to perform the global maximum pooling processing and the global average pooling processing on the target channel attention feature respectively to obtain a first spatial attention feature; a third input sub-module, used to input the first spatial attention feature into the multi-layer perceptron in the spatial attention feature extraction module to obtain multiple second spatial attention features; a first addition sub-module, used to perform a sum operation on the multiple second spatial attention features to obtain a third spatial attention feature; an eighth processing sub-module, used to process the third spatial attention feature using the activation function to generate the target spatial attention feature.
[0021] Furthermore, the device also includes: a first control unit, which is used to input the target image into a deep learning target detection algorithm for abnormality detection processing, and after obtaining an abnormality detection result of the target face, if the abnormality detection result indicates that the target face is an abnormal face, control the monitoring system to trigger an alarm signal.
[0022] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a processor is provided, which is used to run a program, wherein the program executes any one of the above-mentioned methods for detecting abnormalities in a human face when running.
[0023] In order to achieve the above-mentioned purpose, according to another aspect of the present application, an electronic device is provided, which includes one or more processors and a memory, and the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement any one of the above-mentioned facial abnormality detection methods.
[0024] Through this application, the following steps are adopted: obtaining a target image of a target face, wherein the target face is a face to be detected for facial anomaly in a monitoring system; inputting the target image into a deep learning target detection algorithm for anomaly detection processing to obtain an anomaly detection result of the target face, wherein the deep learning target detection algorithm is an algorithm constructed based on an initial target detection algorithm, a target attention mechanism module, and a feature extraction module of deep learning, and the feature extraction module is generated based on the spatial pyramid pooling structure in the initial target detection algorithm, which solves the problem in the related art that the monitoring system using the face detection method is difficult to detect abnormal faces, thereby affecting the use effect of the monitoring system. By using the deep learning target detection algorithm constructed based on the initial target detection algorithm, the target attention mechanism module, and the feature extraction module to perform anomaly detection processing on the face to be detected for facial anomaly in the monitoring system, abnormal faces in the monitoring system can be detected, thereby improving the use effect of the monitoring system. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The accompanying drawings, which constitute part of this application, are intended to provide a further understanding of this application. The exemplary embodiments and descriptions of this application are intended to explain this application and do not constitute an improper limitation on this application. In the accompanying drawings:
[0026] Figure 1 is a flowchart of a method for detecting facial anomalies according to an embodiment of the present application;
[0027] Figure 2 Schematic diagram of the YOLOv4 network in the embodiment of the present application;
[0028] Figure 3 Schematic diagram of the embedding position of the CBAM attention mechanism module in an embodiment of the present application;
[0029] Figure 4 It is a schematic diagram of the SPP module in the YOLOv4 algorithm in the prior art;
[0030] Figure 5 Schematic diagram of the CSP-SPP module in the embodiment of the present application;
[0031] Figure 6 Schematic diagram of the CBAM attention mechanism module processing image features in an embodiment of the present application;
[0032] Figure 7 Schematic diagram of image feature processing by the CAM channel attention feature extraction module in an embodiment of the present application;
[0033] Figure 8 Schematic diagram of the SAM spatial attention feature extraction module processing image features in an embodiment of the present application;
[0034] Figure 9 is a schematic diagram of a facial anomaly detection device provided according to an embodiment of the present application;
[0035] Figure 10 is a schematic diagram of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0036] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0037] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0038] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0039] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display and analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties. For example, an interface is set up between this system and the relevant user or organization. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving the consent information fed back by the aforementioned user or organization.
[0040] The present invention will be described below in conjunction with preferred implementation steps. Figure 1 is a flow chart of a method for detecting abnormalities in a face according to an embodiment of the present application, such as Figure 1 As shown, the method includes the following steps:
[0041] Step S101 : obtaining a target image of a target face, wherein the target face is a face to be detected for facial anomalies in a monitoring system.
[0042] For example, the target face may be a face to be detected for facial anomalies in a monitoring system, and the monitoring system may be a security monitoring system. An image corresponding to the face to be detected for facial anomalies in the monitoring system is obtained.
[0043] In step S102, the target image is input into a deep learning target detection algorithm for anomaly detection processing to obtain an anomaly detection result of the target face, wherein the deep learning target detection algorithm is an algorithm constructed based on the initial target detection algorithm of deep learning, a target attention mechanism module and a feature extraction module, and the feature extraction module is generated based on the spatial pyramid pooling structure in the initial target detection algorithm.
[0044] In this embodiment, the above-mentioned initial target detection algorithm can be the YOLOv4 algorithm, or it can be other types of target detection algorithms based on deep learning. Specifically, the YOLOv4 algorithm is a target detection algorithm, and the task of target detection is to find objects from the picture and give their categories and positions. For a single picture, the output is the center position (x, y), width (w), height (h) and category of each of the N objects contained in the picture. In addition, the YOLOv4 algorithm integrates the excellent algorithm model ideas in deep neural networks in recent years, has high detection accuracy, and meets real-time requirements. And the schematic diagram of the YOLOv4 network is as follows Figure 2 As shown in the figure, the YOLOv4 network includes: backbone network layer (Backbone), prediction layer (Head) and feature fusion layer (Neck). The backbone network layer includes multiple modules, such as CBM module (module one) and CBL module (module two), and the CBM module includes convolution layer (Conv), batch normalization layer (BN) and activation function (Mish).
[0045] The target attention mechanism module mentioned above can be a lightweight attention module (Convolutional Block Attention Module, CBAM). The CBAM attention mechanism module is a spatial and channel-based attention model that can effectively improve the accuracy of target detection in occluded environments.
[0046] Specifically, an image corresponding to a face to be detected for facial anomaly in a surveillance system is input into a deep learning target detection algorithm constructed based on an initial target detection algorithm, a target attention mechanism module, and a feature extraction module. Anomaly detection is then performed, and a detection result for the face to be detected for facial anomaly in the surveillance system is obtained. Furthermore, the feature extraction module is generated based on the spatial pyramid pooling structure in the initial target detection algorithm.
[0047] Through the above steps S101 to S102, by adopting the deep learning target detection algorithm constructed by the initial target detection algorithm based on deep learning, the target attention mechanism module and the feature extraction module, the faces to be detected for face anomaly detection in the monitoring system are subjected to anomaly detection processing, abnormal faces in the monitoring system can be detected, thereby improving the use effect of the monitoring system.
[0048] In order to detect abnormal faces in the monitoring system, how to construct a deep learning target detection algorithm for detecting abnormal faces is also one of the key points. In the face abnormality detection method provided in the embodiment of the present application, how to construct a deep learning target detection algorithm for detecting abnormal faces is further limited. Before the target image is input into the deep learning target detection algorithm for abnormality detection processing and the abnormality detection result of the target face is obtained, the deep learning target detection algorithm for detecting abnormal faces can be constructed by using the following technical features: determining the feature fusion layer of each residual module in the initial target detection algorithm and the feature merging layer in the initial target detection algorithm; adding a target attention mechanism module at the upper level of the feature fusion layer, and adding a target attention mechanism module at the lower level of the feature merging layer to obtain the processed initial target detection algorithm; based on the target cross-stage local network module, the spatial pyramid pooling structure in the processed initial target detection algorithm is processed to obtain a feature extraction module, wherein the target cross-stage local network module is a module in the initial target detection algorithm or a module in the processed initial target detection algorithm; based on the processed initial target detection algorithm and the feature extraction module, a deep learning target detection algorithm is constructed.
[0049] Figure 3 3 is a schematic diagram of the embedded position of the CBAM attention mechanism module in the embodiment of the present application, wherein Represents the Concat layer, Represents the Add layer, Represents the transformation before and after embedding the CBAM attention mechanism module. Figure 3 As shown in FIG, a CBAM module is embedded before the feature fusion layer Add layer of each residual block of the YOLOv4 algorithm, and a CBAM module is embedded after the feature merging layer Concat layer of the YOLOv4 algorithm.
[0050] In this embodiment, the feature extraction module may be a module obtained by modifying the spatial pyramid pooling layer (SPP) in the YOLOv4 algorithm according to the cross-stage partial network module (CSP) in the YOLOv4 algorithm, so the feature extraction module may be called a CSP-SPP module.
[0051] Figure 4 This is a schematic diagram of the SPP module in the YOLOv4 algorithm in the prior art. Specifically, the YOLOv4 model adds an SPP layer after the Backbone layer. The feature map input to the SPP layer passes through a convolutional layer and then undergoes max pooling processing through three pooling layers of different sizes: 5×5, 9×9, and 13×13. The resulting feature map is then concatenated using Concat, resulting in a channel-wise quadruple of the original number of channels without changing the size. Each pooling layer has a stride of 1 and padding of (k-1) / 2 (k is the size of the max pooling layer). The resulting output feature map has a size of:
[0052]
[0053] Among them, n is the size of the input feature map, p represents padding, and s is the step size. Therefore, the pooling layer expands the receptive field while maintaining the translation invariance of the feature map.
[0054] Figure 5 is a schematic diagram of the CSP-SPP module in the embodiment of the present application, such as Figure 5 As shown in the figure, in the CSP-SPP module, the first convolutional layer is first split into two convolutional layers, with the number of channels in both layers halved. The first convolutional layer is directly forward-passed, while the second convolutional layer is connected to the SPP layer. Finally, the two layers are concatenated. Furthermore, the CSP module in the YOLOv4 algorithm adopts a split-merge strategy, which mitigates the drawbacks of using explicit feature maps and duplicate connections, enhancing the learning ability of the CNN network while reducing the algorithm's computational complexity.
[0055] For example, a CBAM module is embedded before the feature fusion layer Add layer of each residual block of the YOLOv4 algorithm, and a CBAM module is embedded after the feature merging layer Concat layer of the YOLOv4 algorithm to obtain a new YOLOv4 algorithm. Then, based on the CSP module in the YOLOv4 algorithm in the prior art, the SPP module in this new YOLOv4 algorithm is redesigned to obtain a CSP-SPP module. The YOLOv4 algorithm with the CSP-SPP module is the deep learning target detection algorithm in this embodiment.
[0056] In summary, the newly constructed CSP-SPP structure in this embodiment not only maintains the receptive field capability of the SPP network, but also makes the network feature aggregation more profound, which is beneficial to the detection of occluded targets.
[0057] Optionally, in the face anomaly detection method provided in the embodiment of the present application, the target attention mechanism module includes a channel attention feature extraction module and a spatial attention feature extraction module, and the target image is input into the deep learning target detection algorithm for anomaly detection processing to obtain the anomaly detection result of the target face, including: inputting the target image into the deep learning target detection algorithm to obtain the first feature of the target image; inputting the first feature into the channel attention feature extraction module to obtain the target channel attention feature; inputting the target channel attention feature into the spatial attention feature extraction module to obtain the target spatial attention feature; inputting the first feature into the feature extraction module to obtain the target feature; and obtaining the anomaly detection result of the target face based on the target spatial attention feature and the target feature.
[0058] Figure 6 Schematic diagram of the CBAM attention mechanism module processing image features in the embodiment of the present application, such as Figure 6 As shown in the figure, the attention mechanism CBAM module is an attention model that combines space and channel, and extracts channel attention features (Channel Attention Module, CAM) and spatial attention features (SpatialAttention Module, SAM) from the feature map in sequence.
[0059] For example, a facial image in a surveillance system to be detected for facial anomalies is fed into the YOLOv4 algorithm to obtain facial image features. These features are then fed into the channel attention feature extraction (CAM) module to obtain channel attention features. These features are then fed into the spatial attention feature extraction (SAM) module to obtain spatial attention features. The resulting facial image features are then fed into the CSP-SPP module described above to obtain processed features. Finally, based on the spatial attention features and the features processed by the CSP-SPP module, the detection results for the facial anomaly detection in the surveillance system are obtained.
[0060] In summary, the CBAM attention mechanism module can provide stronger incentives for feature maps that combine important channel features with important spatial features. Combined with the features processed by the CSP-SPP module, this can improve the surveillance system's detection rate for abnormal faces, thereby providing protection for the area monitored by the surveillance system.
[0061] Optionally, in the face abnormality detection method provided in an embodiment of the present application, the first feature is input into the feature extraction module to obtain the target feature, including: inputting the first feature into the first convolution layer in the feature extraction module to obtain the second feature; inputting the second feature into the second convolution layer and the third convolution layer in the feature extraction module respectively to obtain the third feature and the fourth feature; inputting the third feature into the spatial pyramid pooling structure, and performing convolution processing on the third feature to obtain the fifth feature; and merging the fourth feature and the fifth feature to obtain the target feature.
[0062] For example, applications such as Figure 5 The CSP-SPP module shown processes facial images in the surveillance system for facial anomaly detection. Specifically, the features of the facial images obtained by processing the facial anomaly detection images in the surveillance system using the YOLOv4 algorithm are input into the first convolutional layer of the CSP-SPP module to obtain a feature vector. This feature vector is then input into the second and second convolutional layers of the CSP-SPP module to obtain two new feature vectors. One of these two new feature vectors is input into the SPP module and then into the fourth convolutional layer to obtain the final feature. Finally, the other of the two new feature vectors is combined with the final feature to obtain the target feature vector described above.
[0063] Through the above scheme, more profound features can be obtained, thereby improving the detection effect of occluded targets.
[0064] Optionally, in the face abnormality detection method provided in the embodiment of the present application, the first feature is input into the channel attention feature extraction module to obtain the target channel attention feature, including: based on the target channel of the channel attention feature extraction module, performing global maximum pooling processing on the first feature to obtain the first channel attention feature; based on the target channel, performing global average pooling processing on the first feature to obtain the second channel attention feature; splicing the first channel attention feature and the second channel attention feature to obtain the third channel attention feature; performing convolution processing on the third channel attention feature, and processing the third channel attention feature with an activation function to generate a fourth spatial attention feature; multiplying the first feature and the fourth spatial attention feature to obtain the target channel attention feature.
[0065] Figure 7 : is a schematic diagram of the CAM channel attention feature extraction module in the embodiment of the present application processing image features, such as Figure 7 As shown in Figure 2, the channel attention feature extraction CAM module inputs the channel modulation feature F, performs global maximum pooling and global average pooling operations based on the channel, and concatenates the results of the two. After that, it passes through the convolution layer and the sigmoid activation function in sequence to generate the spatial attention feature map M. s (F), M s (F) is multiplied with the module input F to obtain the final result, namely the spatial attention feature M. s The calculation formula for (F) is:
[0066] M s (F)=σ(f 7×7 ([AvgPool(F);MaxPool(F)]))
[0067] Among them, f 7×7 represents the 7*7 convolution kernel operation, and σ represents the sigmoid activation function.
[0068] Through the above scheme, a feature vector processed by the channel attention feature extraction module can be obtained, which can pave the way for the subsequent detection of faces to be detected for facial anomalies in the monitoring system.
[0069] Optionally, in the face abnormality detection method provided in the embodiment of the present application, the target channel attention feature is input into the spatial attention feature extraction module to obtain the target spatial attention feature, including: performing global maximum pooling processing and global average pooling processing on the target channel attention feature, respectively, to obtain a first spatial attention feature; inputting the first spatial attention feature into the multi-layer perceptron in the spatial attention feature extraction module to obtain multiple second spatial attention features; performing a summing operation on the multiple second spatial attention features to obtain a third spatial attention feature; and processing the third spatial attention feature using an activation function to generate a target spatial attention feature.
[0070] Figure 8 Schematic diagram of the SAM spatial attention feature extraction module processing image features in an embodiment of the present application, such as Figure 8 As shown in the figure, the spatial attention feature extraction SAM module is used to perform global average pooling (AvgPool) and global maximum pooling (MaxPool) on the spatial attention feature M, and then the corresponding output features are obtained through the multilayer perceptron (MLP). After the output features are added, the sigmoid function activates the features and finally generates the spatial attention feature M1.
[0071] Through the above scheme, a feature vector processed by the spatial attention feature extraction module can be obtained, thereby improving the accuracy of detecting faces to be detected for facial anomalies in the monitoring system.
[0072] Optionally, in the face anomaly detection method provided in an embodiment of the present application, after inputting the target image into the deep learning target detection algorithm for anomaly detection processing and obtaining the anomaly detection result of the target face, the method also includes: if the anomaly detection result indicates that the target face is an abnormal face, controlling the monitoring system to trigger an alarm signal.
[0073] For example, if the output image feature value is 1, it means that the face in the monitoring system is abnormal, and if the output image feature value is 0, it means that the face in the monitoring system is normal. Therefore, if the face anomaly detection result shows that the output image feature value is 1, it means that the face in the monitoring system is abnormal, and then the monitoring system is controlled to issue an alarm signal.
[0074] Through the above solution, the user can be prompted that there are abnormal faces in the area monitored by the monitoring system, and the user can handle it in time, thereby achieving the effect of ensuring the safety of the monitored area.
[0075] In summary, the face anomaly detection method provided by the embodiment of the present application obtains a target image of a target face, wherein the target face is a face to be detected for face anomaly in a monitoring system; the target image is input into a deep learning target detection algorithm for anomaly detection processing to obtain an anomaly detection result of the target face, wherein the deep learning target detection algorithm is an algorithm constructed based on an initial target detection algorithm, a target attention mechanism module and a feature extraction module of deep learning, and the feature extraction module is generated based on the spatial pyramid pooling structure in the initial target detection algorithm, which solves the problem in the related art that the monitoring system uses a face detection method that is difficult to detect abnormal faces, affecting the use effect of the monitoring system. By using a deep learning target detection algorithm constructed based on an initial target detection algorithm, a target attention mechanism module and a feature extraction module to perform anomaly detection processing on the face to be detected for face anomaly in the monitoring system, abnormal faces in the monitoring system can be detected, thereby improving the use effect of the monitoring system.
[0076] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0077] The present application also provides a facial anomaly detection device. It should be noted that the facial anomaly detection device of the present application can be used to execute the facial anomaly detection method provided in the present application. The following describes the facial anomaly detection device provided in the present application.
[0078] Figure 9 FIG is a schematic diagram of a face abnormality detection device according to an embodiment of the present application. Figure 9 As shown, the device includes: a first acquiring unit 901 and a first processing unit 902.
[0079] Specifically, the first acquisition unit 901 is configured to acquire a target image of a target face, wherein the target face is a face to be detected for facial anomaly in the monitoring system;
[0080] The first processing unit 902 is used to input the target image into a deep learning target detection algorithm for anomaly detection processing to obtain an anomaly detection result of the target face, wherein the deep learning target detection algorithm is an algorithm constructed based on an initial target detection algorithm of deep learning, a target attention mechanism module and a feature extraction module, and the feature extraction module is generated based on the spatial pyramid pooling structure in the initial target detection algorithm.
[0081] In summary, the face anomaly detection device provided in the embodiment of the present application obtains a target image of a target face through a first acquisition unit 901, wherein the target face is a face to be subjected to face anomaly detection in the monitoring system; the first processing unit 902 inputs the target image into a deep learning target detection algorithm for anomaly detection processing to obtain an anomaly detection result of the target face, wherein the deep learning target detection algorithm is an algorithm constructed based on an initial target detection algorithm, a target attention mechanism module and a feature extraction module of deep learning, and the feature extraction module is generated based on the spatial pyramid pooling structure in the initial target detection algorithm, which solves the problem in the related technology that the monitoring system uses a face detection method that is difficult to detect abnormal faces, affecting the use effect of the monitoring system. By using a deep learning target detection algorithm constructed based on an initial target detection algorithm, a target attention mechanism module and a feature extraction module to perform anomaly detection processing on the face to be subjected to face anomaly detection in the monitoring system, abnormal faces in the monitoring system can be detected, thereby improving the use effect of the monitoring system.
[0082] Optionally, in the face anomaly detection device provided in the embodiment of the present application, the device also includes: a first determination unit, used to determine the feature fusion layer of each residual module in the initial target detection algorithm and the feature merging layer in the initial target detection algorithm before inputting the target image into the deep learning target detection algorithm for anomaly detection processing to obtain the anomaly detection result of the target face; a first adding unit, used to add a target attention mechanism module at the upper level of the feature fusion layer, and add a target attention mechanism module at the lower level of the feature merging layer to obtain the processed initial target detection algorithm; a second processing unit, used to process the spatial pyramid pooling structure in the processed initial target detection algorithm based on the target cross-stage local network module to obtain a feature extraction module, wherein the target cross-stage local network module is a module in the initial target detection algorithm or a module in the processed initial target detection algorithm; a first construction unit, used to construct a deep learning target detection algorithm based on the processed initial target detection algorithm and the feature extraction module.
[0083] Optionally, in the face anomaly detection device provided in the embodiment of the present application, the target attention mechanism module includes a channel attention feature extraction module and a spatial attention feature extraction module, and the first processing unit includes: a first input module, used to input the target image into the deep learning target detection algorithm to obtain the first feature of the target image; a second input module, used to input the first feature into the channel attention feature extraction module to obtain the target channel attention feature; a third input module, used to input the target channel attention feature into the spatial attention feature extraction module to obtain the target spatial attention feature; a fourth input module, used to input the first feature into the feature extraction module to obtain the target feature; a first determination module, used to obtain the anomaly detection result of the target face based on the target spatial attention feature and the target feature.
[0084] Optionally, in the face anomaly detection device provided in the embodiment of the present application, the fourth input module includes: a first input submodule, used to input the first feature into the first convolution layer in the feature extraction module to obtain the second feature; a second input submodule, used to input the second feature into the second convolution layer and the third convolution layer in the feature extraction module respectively to obtain the third feature and the fourth feature; a first processing submodule, used to input the third feature into the spatial pyramid pooling structure, and perform convolution processing on the third feature to obtain the fifth feature; and a second processing submodule, used to merge the fourth feature and the fifth feature to obtain the target feature.
[0085] Optionally, in the face anomaly detection device provided in the embodiment of the present application, the second input module includes: a third processing sub-module, which is used to perform global maximum pooling processing on the first feature based on the target channel of the channel attention feature extraction module to obtain the first channel attention feature; a fourth processing sub-module, which is used to perform global average pooling processing on the first feature based on the target channel to obtain the second channel attention feature; a fifth processing sub-module, which is used to splice the first channel attention feature and the second channel attention feature to obtain the third channel attention feature; a sixth processing sub-module, which is used to perform convolution processing on the third channel attention feature, and use an activation function to process the third channel attention feature to generate a fourth spatial attention feature; and a first multiplication sub-module, which is used to multiply the first feature and the fourth spatial attention feature to obtain the target channel attention feature.
[0086] Optionally, in the face anomaly detection device provided in the embodiment of the present application, the third input module includes: a seventh processing sub-module, used to perform global maximum pooling processing and global average pooling processing on the target channel attention feature, respectively, to obtain a first spatial attention feature; a third input sub-module, used to input the first spatial attention feature into the multi-layer perceptron in the spatial attention feature extraction module, to obtain multiple second spatial attention features; a first addition sub-module, used to perform a sum operation on the multiple second spatial attention features to obtain a third spatial attention feature; an eighth processing sub-module, used to process the third spatial attention feature using an activation function to generate a target spatial attention feature.
[0087] Optionally, in the face anomaly detection device provided in an embodiment of the present application, the device also includes: a first control unit, which is used to input the target image into a deep learning target detection algorithm for anomaly detection processing, and after obtaining the anomaly detection result of the target face, if the anomaly detection result indicates that the target face is an abnormal face, control the monitoring system to trigger an alarm signal.
[0088] The facial anomaly detection device includes a processor and a memory. The above-mentioned first acquisition unit 901 and first processing unit 902 are stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.
[0089] The processor contains a kernel, which retrieves the corresponding program unit from the memory. You can set one or more kernels, and adjust the kernel parameters to improve the performance of the monitoring system.
[0090] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0091] An embodiment of the present invention provides a processor, which is used to run a program, wherein the method for detecting abnormalities in a human face is executed when the program is run.
[0092] like Figure 10As shown, an embodiment of the present invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and runable on the processor. When the processor executes the program, the following steps are implemented: obtaining a target image of a target face, wherein the target face is a face to be detected for facial anomaly in a monitoring system; inputting the target image into a deep learning target detection algorithm for anomaly detection processing to obtain an anomaly detection result of the target face, wherein the deep learning target detection algorithm is an algorithm constructed based on an initial target detection algorithm, a target attention mechanism module, and a feature extraction module based on deep learning, and the feature extraction module is generated based on the spatial pyramid pooling structure in the initial target detection algorithm.
[0093] When the processor executes the program, the following steps are also implemented: before the target image is input into the deep learning target detection algorithm for anomaly detection processing to obtain the anomaly detection result of the target face, the method also includes: determining the feature fusion layer of each residual module in the initial target detection algorithm and the feature merging layer in the initial target detection algorithm; adding the target attention mechanism module at the upper level of the feature fusion layer, and adding the target attention mechanism module at the lower level of the feature merging layer to obtain the processed initial target detection algorithm; based on the target cross-stage local network module, the spatial pyramid pooling structure in the processed initial target detection algorithm is processed to obtain the feature extraction module, wherein the target cross-stage local network module is a module in the initial target detection algorithm or a module in the processed initial target detection algorithm; based on the processed initial target detection algorithm and the feature extraction module, the deep learning target detection algorithm is constructed.
[0094] When the processor executes the program, the following steps are also implemented: the target attention mechanism module includes a channel attention feature extraction module and a spatial attention feature extraction module, and the target image is input into the deep learning target detection algorithm for anomaly detection processing to obtain the anomaly detection result of the target face, including: inputting the target image into the deep learning target detection algorithm to obtain the first feature of the target image; inputting the first feature into the channel attention feature extraction module to obtain the target channel attention feature; inputting the target channel attention feature into the spatial attention feature extraction module to obtain the target spatial attention feature; inputting the first feature into the feature extraction module to obtain the target feature; and obtaining the anomaly detection result of the target face based on the target spatial attention feature and the target feature.
[0095] When the processor executes the program, the following steps are also implemented: inputting the first feature into the feature extraction module to obtain the target feature, including: inputting the first feature into the first convolution layer in the feature extraction module to obtain the second feature; inputting the second feature into the second convolution layer and the third convolution layer in the feature extraction module respectively to obtain the third feature and the fourth feature; inputting the third feature into the spatial pyramid pooling structure, and performing convolution processing on the third feature to obtain the fifth feature; merging the fourth feature and the fifth feature to obtain the target feature.
[0096] When the processor executes the program, the following steps are also implemented: the first feature is input into the channel attention feature extraction module to obtain the target channel attention feature, including: based on the target channel of the channel attention feature extraction module, the first feature is subjected to global maximum pooling processing to obtain the first channel attention feature; based on the target channel, the first feature is subjected to global average pooling processing to obtain the second channel attention feature; the first channel attention feature and the second channel attention feature are concatenated to obtain the third channel attention feature; the third channel attention feature is subjected to convolution processing, and the third channel attention feature is processed using an activation function to generate a fourth spatial attention feature; the first feature and the fourth spatial attention feature are multiplied to obtain the target channel attention feature.
[0097] When the processor executes the program, the following steps are also implemented: the target channel attention feature is input into the spatial attention feature extraction module to obtain the target spatial attention feature, including: performing the global maximum pooling processing and the global average pooling processing on the target channel attention feature respectively to obtain a first spatial attention feature; the first spatial attention feature is input into the multi-layer perceptron in the spatial attention feature extraction module to obtain multiple second spatial attention features; the multiple second spatial attention features are summed to obtain a third spatial attention feature; the third spatial attention feature is processed using the activation function to generate the target spatial attention feature.
[0098] When the processor executes the program, the following steps are also implemented: after inputting the target image into the deep learning target detection algorithm for abnormality detection processing and obtaining the abnormality detection result of the target face, the method also includes: if the abnormality detection result indicates that the target face is an abnormal face, controlling the monitoring system to trigger an alarm signal.
[0099] The devices in this article can be servers, PCs, PADs, mobile phones, etc.
[0100] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program initialized with the following method steps: obtaining a target image of a target face, wherein the target face is a face to be subjected to face anomaly detection in a monitoring system; inputting the target image into a deep learning target detection algorithm for anomaly detection processing to obtain an anomaly detection result of the target face, wherein the deep learning target detection algorithm is an algorithm constructed based on an initial target detection algorithm, a target attention mechanism module and a feature extraction module based on deep learning, and the feature extraction module is generated based on the spatial pyramid pooling structure in the initial target detection algorithm.
[0101] When executed on a data processing device, it is also suitable for executing a program initialized with the following method steps: before inputting the target image into a deep learning target detection algorithm for anomaly detection processing to obtain an anomaly detection result of the target face, the method also includes: determining the feature fusion layer of each residual module in the initial target detection algorithm and the feature merging layer in the initial target detection algorithm; adding the target attention mechanism module at the upper level of the feature fusion layer, and adding the target attention mechanism module at the lower level of the feature merging layer to obtain a processed initial target detection algorithm; processing the spatial pyramid pooling structure in the processed initial target detection algorithm according to the target cross-stage local network module to obtain the feature extraction module, wherein the target cross-stage local network module is a module in the initial target detection algorithm or a module in the processed initial target detection algorithm; constructing the deep learning target detection algorithm based on the processed initial target detection algorithm and the feature extraction module.
[0102] When executed on a data processing device, it is also suitable for executing a program initialized with the following method steps: the target attention mechanism module includes a channel attention feature extraction module and a spatial attention feature extraction module, and the target image is input into the deep learning target detection algorithm for anomaly detection processing, and the anomaly detection result of the target face is obtained, including: inputting the target image into the deep learning target detection algorithm to obtain the first feature of the target image; inputting the first feature into the channel attention feature extraction module to obtain the target channel attention feature; inputting the target channel attention feature into the spatial attention feature extraction module to obtain the target spatial attention feature; inputting the first feature into the feature extraction module to obtain the target feature; based on the target spatial attention feature and the target feature, the anomaly detection result of the target face is obtained.
[0103] When executed on a data processing device, it is also suitable for executing a program initialized with the following method steps: inputting the first feature into the feature extraction module to obtain the target feature, including: inputting the first feature into the first convolution layer in the feature extraction module to obtain the second feature; inputting the second feature into the second convolution layer and the third convolution layer in the feature extraction module respectively to obtain the third feature and the fourth feature; inputting the third feature into the spatial pyramid pooling structure, and performing convolution processing on the third feature to obtain the fifth feature; and merging the fourth feature and the fifth feature to obtain the target feature.
[0104] When executed on a data processing device, it is also suitable for executing an initialized program having the following method steps: inputting the first feature into the channel attention feature extraction module to obtain the target channel attention feature, including: based on the target channel of the channel attention feature extraction module, performing global maximum pooling processing on the first feature to obtain the first channel attention feature; based on the target channel, performing global average pooling processing on the first feature to obtain the second channel attention feature; splicing the first channel attention feature and the second channel attention feature to obtain the third channel attention feature; performing convolution processing on the third channel attention feature, and processing the third channel attention feature with an activation function to generate a fourth spatial attention feature; multiplying the first feature and the fourth spatial attention feature to obtain the target channel attention feature.
[0105] When executed on a data processing device, it is also suitable for executing an initialized program having the following method steps: inputting the target channel attention feature into the spatial attention feature extraction module to obtain the target spatial attention feature, including: performing the global maximum pooling processing and the global average pooling processing on the target channel attention feature respectively to obtain a first spatial attention feature; inputting the first spatial attention feature into the multi-layer perceptron in the spatial attention feature extraction module to obtain multiple second spatial attention features; performing a summing operation on the multiple second spatial attention features to obtain a third spatial attention feature; and processing the third spatial attention feature using the activation function to generate the target spatial attention feature.
[0106] When executed on a data processing device, it is also suitable for executing a program initialized with the following method steps: after inputting the target image into a deep learning target detection algorithm for anomaly detection processing and obtaining an abnormality detection result of the target face, the method also includes: if the abnormality detection result indicates that the target face is an abnormal face, controlling the monitoring system to trigger an alarm signal.
[0107] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0108] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0109] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0110] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0111] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0112] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0113] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0114] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0115] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0116] The above are merely embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.
Claims
1. A method for detecting abnormality in a face, characterized in that: include: Acquire a target image of a target face, wherein the target face is a face to be detected for facial anomalies in a monitoring system; Inputting the target image into a deep learning target detection algorithm for anomaly detection processing to obtain an anomaly detection result of the target face, wherein the deep learning target detection algorithm is an algorithm constructed based on an initial target detection algorithm of deep learning, a target attention mechanism module, and a feature extraction module, the feature extraction module is generated based on the spatial pyramid pooling structure in the initial target detection algorithm, the target attention mechanism module is a lightweight attention module, and in the feature extraction module, the first convolution layer is first divided into two convolution layers, the number of channels of the two convolution layers is halved, the first convolution layer is directly forward passed, and the other convolution layer is connected to the spatial pyramid pooling structure layer; Before inputting the target image into the deep learning target detection algorithm for anomaly detection processing to obtain the anomaly detection result of the target face, the method also includes: determining the feature fusion layer of each residual module in the initial target detection algorithm and the feature merging layer in the initial target detection algorithm; adding the target attention mechanism module at the upper level of the feature fusion layer, and adding the target attention mechanism module at the lower level of the feature merging layer to obtain the processed initial target detection algorithm; processing the spatial pyramid pooling structure in the processed initial target detection algorithm according to the target cross-stage local network module to obtain the feature extraction module, wherein the target cross-stage local network module is a module in the initial target detection algorithm or a module in the processed initial target detection algorithm; constructing the deep learning target detection algorithm based on the processed initial target detection algorithm and the feature extraction module.
2. The method according to claim 1, characterized in that The target attention mechanism module includes a channel attention feature extraction module and a spatial attention feature extraction module. The target image is input into the deep learning target detection algorithm for anomaly detection processing. The anomaly detection result of the target face is obtained, including: Inputting the target image into the deep learning target detection algorithm to obtain a first feature of the target image; Inputting the first feature into the channel attention feature extraction module to obtain a target channel attention feature; Inputting the target channel attention feature into the spatial attention feature extraction module to obtain the target spatial attention feature; Inputting the first feature into the feature extraction module to obtain a target feature; An abnormality detection result of the target face is obtained based on the target spatial attention feature and the target feature.
3. The method according to claim 2, characterized in that Inputting the first feature into the feature extraction module to obtain the target feature includes: Inputting the first feature into the first convolutional layer in the feature extraction module to obtain a second feature; Inputting the second feature into the second convolution layer and the third convolution layer in the feature extraction module respectively to obtain a third feature and a fourth feature; Inputting the third feature into the spatial pyramid pooling structure, and performing convolution processing on the third feature to obtain a fifth feature; The fourth feature and the fifth feature are combined to obtain the target feature.
4. The method according to claim 2, characterized in that Inputting the first feature into the channel attention feature extraction module to obtain the target channel attention feature includes: Based on the target channel of the channel attention feature extraction module, performing global maximum pooling processing on the first feature to obtain a first channel attention feature; Based on the target channel, performing global average pooling processing on the first feature to obtain a second channel attention feature; Concatenate the first channel attention feature and the second channel attention feature to obtain a third channel attention feature; Performing convolution processing on the third channel attention feature and processing the third channel attention feature using an activation function to generate a fourth spatial attention feature; Multiply the first feature and the fourth spatial attention feature to obtain the target channel attention feature.
5. The method according to claim 4, characterized in that Inputting the target channel attention feature into the spatial attention feature extraction module to obtain the target spatial attention feature includes: Performing the global maximum pooling process and the global average pooling process on the target channel attention feature to obtain a first spatial attention feature; Inputting the first spatial attention feature into a multilayer perceptron in the spatial attention feature extraction module to obtain a plurality of second spatial attention features; performing a sum operation on the plurality of second spatial attention features to obtain a third spatial attention feature; The activation function is used to process the third spatial attention feature to generate the target spatial attention feature.
6. The method according to any one of claims 1 to 5, characterized in that After inputting the target image into a deep learning target detection algorithm for anomaly detection processing to obtain an anomaly detection result of the target face, the method further includes: If the abnormality detection result indicates that the target face is an abnormal face, the monitoring system is controlled to trigger an alarm signal.
7. A facial anomaly detection device, characterized in that: include: A first acquisition unit is configured to acquire a target image of a target face, wherein the target face is a face to be detected for facial anomalies in a monitoring system; A first processing unit is configured to input the target image into a deep learning target detection algorithm for anomaly detection processing to obtain an anomaly detection result of the target face, wherein the deep learning target detection algorithm is an algorithm constructed based on an initial target detection algorithm of deep learning, a target attention mechanism module, and a feature extraction module, the feature extraction module is generated based on the spatial pyramid pooling structure in the initial target detection algorithm, the target attention mechanism module is a lightweight attention module, and in the feature extraction module, the first convolution layer is first divided into two convolution layers, the number of channels of the two convolution layers is halved, the first convolution layer is directly forward passed, and the other convolution layer is connected to the spatial pyramid pooling structure layer; The device also includes: a first determining unit, used to determine the feature fusion layer of each residual module in the initial target detection algorithm and the feature merging layer in the initial target detection algorithm before inputting the target image into the deep learning target detection algorithm for anomaly detection processing to obtain the anomaly detection result of the target face; a first adding unit, used to add the target attention mechanism module at the upper level of the feature fusion layer, and add the target attention mechanism module at the lower level of the feature merging layer to obtain the processed initial target detection algorithm; a second processing unit, used to process the spatial pyramid pooling structure in the processed initial target detection algorithm according to the target cross-stage local network module to obtain the feature extraction module, wherein the target cross-stage local network module is a module in the initial target detection algorithm or a module in the processed initial target detection algorithm; a first constructing unit, used to construct the deep learning target detection algorithm based on the processed initial target detection algorithm and the feature extraction module.
8. A processor, characterized in that: The processor is configured to run a program, wherein the program, when running, executes the method for detecting abnormalities in a human face according to any one of claims 1 to 6.
9. An electronic device, characterized in that: The device comprises one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the face anomaly detection method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Lightweight target detection method and system based on improved YOLOv4-tiny
CN114283469A