WO2024045320A1 - 人脸识别方法及装置 - Google Patents

人脸识别方法及装置 Download PDF

Info

Publication number
WO2024045320A1
WO2024045320A1 PCT/CN2022/129343 CN2022129343W WO2024045320A1 WO 2024045320 A1 WO2024045320 A1 WO 2024045320A1 CN 2022129343 W CN2022129343 W CN 2022129343W WO 2024045320 A1 WO2024045320 A1 WO 2024045320A1
Authority
WO
WIPO (PCT)
Prior art keywords
feature map
attention
processing
convolution
parameter matrix
Prior art date
Application number
PCT/CN2022/129343
Other languages
English (en)
French (fr)
Inventor
王夏洪
Original Assignee
北京龙智数科科技服务有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京龙智数科科技服务有限公司 filed Critical 北京龙智数科科技服务有限公司
Publication of WO2024045320A1 publication Critical patent/WO2024045320A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/80Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level
    • G06V10/806Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level of extracted features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks

Definitions

  • the present disclosure relates to the field of computer technology, and in particular to a face recognition method and device.
  • Face technology often needs to be deployed to the cloud and edge in practical applications. It is limited by the computing power and storage resources of edge devices such as embedded terminals.
  • the edge face recognition model needs to meet high-precision requirements while also meeting the small size of the model. , low computational complexity, fast reasoning and other requirements.
  • MobileFaceNet a mobile lightweight network designed specifically for face recognition tasks, adopts a smaller expansion rate based on MobileNet and replaces the global average pooling layer with a global depth-by-depth convolution layer.
  • the main building module of MobileFaceNet still uses the common residual bottleneck module, and the calculation of each module is the same, so it also has the problem of poor accuracy.
  • embodiments of the present disclosure provide a face recognition method, device, electronic device, and computer-readable storage medium to solve the problem of poor accuracy of face recognition models in the prior art.
  • a first aspect of an embodiment of the present disclosure provides a face recognition method.
  • the method includes: obtaining a first feature map of a face image to be recognized; performing depth-by-depth convolution processing on the first feature map to obtain a second feature map. ; Perform attention flow processing on the second feature map to obtain the third feature map; perform convolution processing to increase channels, attention flow processing, convolution processing to reduce channels, and attention flow processing on the third feature map in order to obtain The target feature map corresponding to the first feature map.
  • a second aspect of the embodiment of the present disclosure provides a face recognition device.
  • the device includes: an acquisition module for acquiring a first feature map of a face image to be recognized; a convolution module for performing on the first feature map depth-by-depth convolution processing to obtain the second feature map; the attention flow module is used to perform attention flow processing on the second feature map to obtain the third feature map; the hybrid processing module is used to increase the third feature map in sequence
  • the convolution processing of the channel, the attention flow processing, the convolution processing of the reduced channel and the attention flow processing are performed to obtain the target feature map corresponding to the first feature map.
  • a third aspect of an embodiment of the present disclosure provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor.
  • the processor executes the computer program, the steps of the above method are implemented.
  • a fourth aspect of the embodiments of the present disclosure provides a computer-readable storage medium.
  • the computer-readable storage medium stores a computer program.
  • the steps of the above method are implemented.
  • the beneficial effects of the embodiments of the present disclosure are: performing feature map processing for face recognition through a combination of convolution processing and attention flow processing, promoting the flow of attention in multiple directions and dimensions, so that ultimately The obtained feature map has high discriminative power in all directions and dimensions, thereby improving the recognition accuracy of the face recognition model.
  • embodiments of the present disclosure propose a lightweight attention flow module.
  • the tensor dimension of the attention flow module is very low, and the convolution calculation amount of the low-dimensional tensor is very small, which can achieve faster overall results. Running speed. If the entire network performs feature extraction in a low-dimensional space, it is very likely to cause incomplete information and non-robust features.
  • the number of channels of the expansion coefficient is set during the intermediate convolution process. Expansion can improve the feature extraction capabilities of the entire module and achieve a delicate balance between computational complexity and feature expression capabilities.
  • the entire attention flow module uses a combination of operations such as different types of convolution, channel number expansion and compression, and attention flow technology to make the attention flow focused on the face recognition task in space,
  • the flow conversion between channels makes the feature fusion more efficient, and the feature map finally effectively focuses on the area of interest for face recognition.
  • the attention flow module also has the advantages of small number of parameters, small calculation amount, and fast speed.
  • Figure 1 is a schematic diagram of an application scenario according to an embodiment of the present disclosure
  • Figure 2 is a schematic flowchart of a face recognition method provided by an embodiment of the present disclosure
  • FIG. 3 is a schematic flowchart of attention flow processing provided by an embodiment of the present disclosure.
  • Figure 4 is a schematic flowchart of yet another face recognition method provided by an embodiment of the present disclosure.
  • Figure 5 is a schematic structural diagram of a face recognition device provided by an embodiment of the present disclosure.
  • FIG. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
  • FIG. 1 is a schematic diagram of an application scenario according to an embodiment of the present disclosure.
  • the application scenario may include terminal devices 101, 102 and 103, server 104 and network 105.
  • the terminal devices 101, 102 and 103 may be hardware or software.
  • the terminal devices 101, 102, and 103 When the terminal devices 101, 102, and 103 are hardware, they may be various electronic devices having a display screen and supporting communication with the server 104, including but not limited to smart phones, robots, laptop computers, desktop computers, etc. (such as 102 may be a robot); when the terminal devices 101, 102 and 103 are software, they may be installed in the above electronic device.
  • the terminal devices 101, 102, and 103 may be implemented as multiple software or software modules, or as a single software or software module, which is not limited in the embodiment of the present disclosure.
  • various applications may be installed on the terminal devices 101, 102 and 103, such as data processing applications, instant messaging tools, social platform software, search applications, shopping applications, etc.
  • the server 104 may be a server that provides various services, for example, a backend server that receives requests sent by terminal devices with which a communication connection is established.
  • the backend server may receive and analyze requests sent by the terminal devices, and generate processing. result.
  • the server 104 may be one server, a server cluster composed of several servers, or a cloud computing service center, which is not limited in this embodiment of the disclosure.
  • the server 104 may be hardware or software. When the server 104 is hardware, it may be various electronic devices that provide various services for the terminal devices 101, 102, and 103. When the server 104 is software, it can be multiple software or software modules that provide various services for the terminal devices 101, 102, and 103, or it can be a single software or software that provides various services for the terminal devices 101, 102, and 103. Module, the embodiment of the present disclosure does not limit this.
  • the network 105 can be a wired network connected by coaxial cables, twisted pairs and optical fibers, or a wireless network that can interconnect various communication devices without wiring, such as Bluetooth, Near Field Communication , NFC), infrared (Infrared), etc., the embodiments of the present disclosure do not limit this.
  • the target user can establish a communication connection with the server 104 via the network 105 through the terminal devices 101, 102 and 103 to receive or send information, etc.
  • the specific types, quantities, and combinations of the terminal devices 101, 102, and 103, the server 104, and the network 105 can be adjusted according to the actual needs of the application scenario, and this is not limited by the embodiments of the present disclosure.
  • edge terminals such as embedded terminals have limited computing power and storage resources and can only support smaller model sizes.
  • general lightweight large face models do not have high face recognition accuracy.
  • embodiments of the present disclosure provide a face recognition solution.
  • This face recognition solution designs a simple and effective lightweight general model for extracting facial features, and specifically designs a real-time model for edge terminals and embedded devices. Responsive face recognition model to improve face recognition accuracy.
  • the technical solution of the embodiment of the present disclosure proposes a universal attention flow technology that can effectively capture attention in space and channels respectively, and improve feature discrimination through a channel-by-channel learnable nonlinear mapping method.
  • Technology can extract effective feature combinations and promote the flow of attention in multiple directions and dimensions.
  • FIG. 2 is a schematic flowchart of a face recognition method provided by an embodiment of the present disclosure.
  • the methods provided by the embodiments of the present disclosure can be executed by any electronic device with computer processing capabilities, such as a terminal or a server.
  • the face recognition method includes:
  • Step S201 Obtain the first feature map of the face image to be recognized.
  • the first feature map is a 4-dimensional tensor, and the dimensions of this tensor are (N, C, H, W), where N represents the number of batch images, C represents the number of channels, H represents the height, and W represents the width.
  • the first feature map is obtained by feature extraction from the face image to be recognized.
  • Step S202 Perform depth-by-depth convolution processing on the first feature map to obtain a second feature map.
  • depthwise convolution (Depthwise Convolution, referred to as DWConv) performs a convolution operation in each independent channel.
  • each convolution kernel performs one calculation for each channel, while in depthwise convolution, each convolution operation is performed once.
  • Each convolution kernel only calculates one channel.
  • Step S203 perform attention flow processing on the second feature map to obtain a third feature map.
  • attention flow processing can make attention flow between spaces and channels, resulting in more effective feature fusion.
  • Step S204 Convolution processing of increasing channels, attention flow processing, convolution processing of reducing channels and attention flow processing are performed on the third feature map in sequence to obtain the target feature map corresponding to the first feature map.
  • the convolution processing of increasing channels and the convolution processing of reducing channels are two corresponding conventional convolution calculation processes.
  • the convolution processing of increasing channels is first performed to increase the number of channels, and then the convolution processing of reducing channels is performed. Return the number of channels to the previous number.
  • the attention flow processing in steps S203 and S204 includes the following steps:
  • Step S301 Flatten the first dimension and the second dimension of the input feature map to obtain a first intermediate feature map.
  • the first dimension may be height
  • the second dimension may be width.
  • the input feature map is f 1
  • Step S302 Obtain the second intermediate feature map according to the first intermediate feature map and the first learnable parameter matrix.
  • the first product of the function value of the first intermediate feature map and its logistic regression function softmax can be obtained, and then the second intermediate feature map can be obtained according to the mean value of the first product.
  • the first intermediate feature map can be right multiplied by the first learnable parameter matrix to obtain a tensor, and the softmax function value of the tensor and the Hadamard product of the tensor can be further calculated to obtain a matrix, and the matrix Taking the average in a certain dimension, the second intermediate feature map is obtained.
  • the first learnable parameter matrix can learn attention flow information in the spatial dimension.
  • Step S303 Obtain the spatial attention feature map based on the product of the second intermediate feature map and the input feature map.
  • the spatial attention feature map is a feature map that incorporates spatial attention.
  • Step S304 obtain the channel attention feature map according to the second learnable parameter matrix, the third learnable parameter matrix and the spatial attention feature map, where the first dimension of the second learnable parameter matrix is equal to the third learnable parameter matrix
  • the second dimension of the third learnable parameter matrix is equal to the second dimension of the second learnable parameter matrix.
  • the spatial attention feature map can be right multiplied by the second learnable parameter matrix to obtain the second product; the second product can be sparsified, and the third learnable parameter matrix can be right multiplied to obtain the channel attention feature map.
  • the second learnable parameter matrix and the third learnable parameter matrix can learn the attention flow information in the channel dimension.
  • Step S305 Obtain the attention flow feature map based on the spatial attention feature map and the channel attention feature map.
  • nonlinear mapping processing can be performed on the spatial attention feature map to obtain the third intermediate feature map; according to the third intermediate feature map and The product of the channel attention feature maps obtains the fourth intermediate feature map; the fourth intermediate feature map is subjected to nonlinear mapping processing to obtain the attention flow feature map.
  • the attention flow feature map obtained from the spatial attention feature map and the channel attention feature map the attention flow information in the spatial dimension and the channel dimension can be learned, thereby enhancing the attention flow in the spatial dimension and the channel dimension. accuracy.
  • the first learnable parameter matrix Q 1 is introduced, with the dimension of (R, r) (r ⁇ R ).
  • step S302 right-multiply the first intermediate feature map obtained after dimension transformation by Q 1 to obtain a tensor f' 1 with dimensions (N, C, r), and perform a softmax operation on the r dimension of f' 1
  • Multiply the corresponding elements of f' 1 and A s in the r dimension that is, get the Hadamard product of f' 1 and A s ( Hadamard product), a matrix M 1 of size (N, C, r) can be obtained.
  • M 1 represents a fusion of multiple feature combinations. The larger r, the higher the complexity. Taking the average (avg) of M 1 according to the dimension r and compressing the dimension to 1, the second intermediate feature map can be obtained Its dimensions are (N, C), and the specific calculation process is as shown in the following formula (1):
  • the first learnable parameter matrix Q 1 is introduced to calculate and obtain r kinds of spatial linear transformation results, so that representative feature combinations in the space can be extracted.
  • each spatial pixel has the same receptive field, these receptive fields map to different areas of the original image and contribute differently to the final recognition task, so different pixels should be given Different weights.
  • the first learnable parameter matrix Q 1 can be used to learn the attention in the H*W dimension of the feature, so that the attention flows in the spatial dimension and a fusion result of multiple feature combinations is obtained.
  • step S303 the second intermediate feature map output in step S301 is Multiply with f 1 to get the spatial attention feature map Its dimensions are (N, C, H, W), and the specific calculation process is as shown in the following formula (2):
  • step S304 the spatial attention feature map with dimensions (N, C, H, W) is introduced into the second learnable parameter matrix Q 2 and the third learnable parameter matrix Q 3 for processing to obtain the channel attention feature map.
  • the dimension of the second learnable parameter matrix Q 2 is (C, C//p), and the dimension of the third learnable parameter matrix Q 3 is (C//p, C), where C is a natural number.
  • the first dimension of the second learnable parameter matrix is equal to the second dimension of the third learnable parameter matrix
  • the first dimension of the third learnable parameter matrix is equal to the second dimension of the second learnable parameter matrix.
  • step S305 the second learnable parameter matrix Q2 and the third learnable parameter matrix Q3 are introduced into the channel output in step S304 to learn the attention flow information in the channel dimension.
  • the design of this part pays more attention to the inter-channel Feature relationships, by capturing the feature relationships between different channels, learn the weight of each channel, making the features more discriminative of each channel information.
  • p represents the scaling factor, and the design parameter p can reduce the amount of calculation and control the model size.
  • mapping parameters ⁇ i and k i of each channel need to be learned.
  • the nonlinear mapping will gradually become more "nonlinear" as the depth deepens, that is, the model tends to retain information in shallow networks and strengthen discriminability in deep networks, that is, It is generally believed that low-level feature maps have high resolution and weak semantic information, but rich spatial information, while high-level feature maps have low resolution but strong semantic information.
  • nonlinear mapping is performed on the fourth intermediate feature map f c to obtain the attention flow feature map f c .
  • the specific calculation process is as shown in the following formulas (7) and (8):
  • f c represents the feature map in which attention has fully flowed in both the spatial direction and the channel direction, until the attention flow of interest spans the entire feature space.
  • the attention flow technology can be inserted into the neural network as a plug-and-play module. In any module and in any location, the usage is more flexible.
  • This attention flow technology mainly performs more effective feature fusion through the flow of attention between spaces and channels, and enhances feature expression capabilities through non-linear mapping of positive and negative responses respectively channel-by-channel learning, so that more discriminative features can be extracted.
  • Sexual facial features If we define this attention flow technology as SC function, with input f 1 and output f C , we can get the following attention flow formula (9):
  • an attention flow module can be formed according to the attention flow technology as the basic component module of the neural network. This module can achieve the function of extracting strong discriminative facial features with the least amount of calculation by designing a refined convolution module based on the particularity of the face structure, effectively focusing the attention of the feature map on the features that are beneficial to the recognition task. area.
  • steps S201 to S204 When applying the attention flow module in steps S201 to S204, the implementation process of steps S201 to S204 can be described in detail as follows:
  • step S202 depth-by-depth convolution processing may be performed on the first feature map, and batch normalization processing may be performed on the depth-by-depth convolution results to obtain a second feature map.
  • a depth-by-depth convolution calculation can be performed with the convolution kernel being n ⁇ n (n>1), the number of input channels being C, the number of output channels being C, the padding being 1, and the stride being s. (DWConv), and then perform batch normalization (BatchNorm, referred to as BN) to calculate the result f' 1.
  • BN batch normalization
  • the step size changes according to the network design and is a configurable hyperparameter.
  • depth-wise convolution is used instead of ordinary convolution to reduce the amount of parameters. It can be calculated that the parameter amount of depth-by-depth convolution is 1/C of ordinary conventional convolution. .
  • the 3 ⁇ 3 convolution here can be replaced by a larger convolution kernel such as 5 ⁇ 5 or 7 ⁇ 7, but the 3 ⁇ 3 convolution is the most cost-effective.
  • step S203 the output f'1 of step S202 is subjected to the above attention flow calculation to obtain The specific calculation process is shown in the following formula (11):
  • the convolution processing of increasing channels includes: performing convolution processing on the input feature map to increase the channels by N times, and performing batch normalization processing on the convolution results, where N is a natural number; reducing the convolution of channels
  • Product processing includes: performing convolution processing on the input feature map with channels reduced to 1/N, and performing batch normalization on the convolution results.
  • the following steps may be performed in sequence:
  • step S202 Perform convolution calculation (Conv) with a convolution kernel of 1 ⁇ 1, the number of input channels is C, the number of output channels is C*expension (expansion coefficient), and the step size is 1, and then perform batch normalization to calculate the result f 2.
  • Conv convolution calculation
  • the specific calculation process is as shown in the following formula (12):
  • a lightweight attention flow module is proposed. This module is refined and designed for face recognition technology.
  • the convolution design, linear and non-linear mapping and other technologies in it all follow two principles. First, The first is to reduce network parameters, save calculations, and improve the computing speed; the second is to perform more effective feature fusion in the spatial dimension and channel dimension, enhance feature expression capabilities, and extract more discriminative facial features.
  • the number of basic channels of the attention flow module in the embodiment of the present disclosure can be designed to be 64. Its tensor dimension is very low, and the amount of convolution calculation of the low-dimensional tensor is also very small, which can achieve faster overall running speed. If the entire network performs feature extraction in a low-dimensional space, it is very likely to cause incomplete information and non-robust features.
  • the number of channels of the expansion coefficient is set during the intermediate convolution process. Expansion can improve the feature extraction capabilities of the entire module and achieve a delicate balance between computational complexity and feature expression capabilities.
  • the entire attention flow module uses a combination of operations such as different types of convolution, channel number expansion and compression, and attention flow technology to make the attention flow focused on the face recognition task in space,
  • the flow conversion between channels makes the feature fusion more efficient, and the feature map finally effectively focuses on the area of interest for face recognition.
  • the attention flow module also has the advantages of small number of parameters, small calculation amount, and fast speed.
  • a face recognition method provided by an embodiment of the present disclosure includes the following steps:
  • Step S401 input the face image to be recognized into a convolution layer and a normalization layer with a convolution kernel of 3 ⁇ 3, a channel number of 64, and a step size of 1.
  • the resolution of the face image to be recognized is (1, 3, 112, 112).
  • the resolution of the feature map output in step S401 is (1, 64, 112, 112).
  • Step S402 Input the feature map obtained in the previous step into an attention flow module with a basic channel number of 64, an expansion coefficient of 1, and a configurable step size of 2.
  • the resolution of the feature map output in step S402 is (1, 64, 56, 56).
  • Step S403 input the feature map obtained in the previous step into an attention flow module with a basic channel number of 64, an expansion coefficient of 1, and a configurable step size of 1.
  • the resolution of the feature map output in step S403 is (1, 64, 56, 56).
  • Step S404 Input the feature map obtained in the previous step into an attention flow module with a basic channel number of 64, an expansion coefficient of 2, and a configurable step size of 2.
  • the resolution of the feature map output in step S404 is (1, 64, 28, 28).
  • Step S405 Input the feature map obtained in the previous step into four attention flow modules with a basic channel number of 64, an expansion coefficient of 2, and a configurable step size of 1.
  • the resolution of the feature map output in step S405 is (1, 64, 28, 28).
  • Step S406 Input the feature map obtained in the previous step into an attention flow module with a basic channel number of 128, an expansion coefficient of 2, and a configurable step size of 2.
  • the resolution of the feature map output in step S406 is (1, 128, 14, 14).
  • Step S407 Input the feature map obtained in the previous step into six attention transfer modules with a basic channel number of 128, an expansion coefficient of 2, and a step size of 1.
  • the resolution of the feature map output in step S407 is (1, 128, 14, 14).
  • Step S408 Input the feature map obtained in the previous step into an attention flow module with a basic channel number of 128, an expansion coefficient of 2, and a configurable step size of 2.
  • the resolution of the feature map output in step S408 is (1, 128, 7, 7).
  • Step S409 Input the feature map obtained in the previous step into two attention flow modules with a basic channel number of 128, an expansion coefficient of 2, and a configurable step size of 1.
  • the resolution of the feature map output in step S409 is (1, 128, 7, 7).
  • Step S410 input the feature map obtained in the previous step into a convolution layer and a normalization layer with a convolution kernel of 1 ⁇ 1 and a channel number of 512.
  • the resolution of the feature map output in step S410 is (1, 512, 7, 7).
  • Step S411 input the feature map obtained in the previous step into a convolution layer and a normalization layer with a convolution kernel of 7 ⁇ 7 and a channel number of 512.
  • the resolution of the feature map output in step S411 is (1, 512, 1, 1).
  • Step S412 After flattening the feature map obtained in the previous step, perform a fully connected matrix calculation of (512, 512) to obtain a 512-dimensional vector as the target feature map.
  • steps S402 and S403 can be regarded as one stage
  • steps S404 and S405 can be regarded as one stage
  • steps S406 and S407 can be regarded as one stage
  • steps S408 and step S409 can be regarded as one stage.
  • the number of attention flow modules included in each stage is (2, 5, 7, 3) respectively.
  • the combination of the attention flow modules is only an exemplary description. Other The combination of attention flow modules can also achieve the technical effects of the technical solutions of the embodiments of the present disclosure.
  • the technical solution of the embodiment of the present disclosure proposes a universal attention flow technology that can effectively capture attention in space and channel respectively, and improve feature discrimination through a channel-by-channel learnable nonlinear mapping method.
  • the entire technology can extract Effective feature combination methods promote the flow of attention in multiple directions and dimensions.
  • feature map processing for face recognition is performed through a combination of convolution processing and attention flow processing, which promotes the flow of attention in multiple directions and dimensions, so that the final feature map is Each direction dimension has high discriminative power, thereby improving the recognition accuracy of the face recognition model.
  • FIG. 5 is a schematic diagram of a face recognition device provided by an embodiment of the present disclosure. As shown in Figure 5, the face recognition device includes:
  • the acquisition module 501 may be used to acquire the first feature map of the face image to be recognized.
  • the first feature map is a 4-dimensional tensor, and the dimensions of this tensor are (N, C, H, W), where N represents the number of batch images, C represents the number of channels, H represents the height, and W represents the width.
  • the first feature map is obtained by feature extraction of the face image to be recognized.
  • the convolution module 502 can be used to perform depth-by-depth convolution processing on the first feature map to obtain the second feature map.
  • depth-wise convolution performs a convolution operation in each independent channel.
  • each convolution kernel performs one calculation for each channel, while in depth-wise convolution, each convolution kernel only calculates one channel for calculation.
  • the attention flow module 503 can be used to perform attention flow processing on the second feature map to obtain a third feature map.
  • attention flow processing can make attention flow between spaces and channels, resulting in more effective feature fusion.
  • the hybrid processing module 504 can be used to sequentially perform convolution processing for increasing channels, attention flow processing, convolution processing for reducing channels, and attention flow processing on the third feature map to obtain the target feature map corresponding to the first feature map.
  • the convolution processing of increasing channels and the convolution processing of reducing channels are two corresponding conventional convolution calculation processes.
  • the convolution processing of increasing channels is first performed to increase the number of channels, and then the convolution processing of reducing channels is performed. Return the number of channels to the previous number.
  • the attention flow module 503 can also be used to flatten the first dimension and the second dimension of the input feature map to obtain the first intermediate feature map; according to the first intermediate feature map and the first possible
  • the second intermediate feature map is obtained by learning the parameter matrix; the spatial attention feature map is obtained according to the product of the second intermediate feature map and the input feature map; the spatial attention feature map is obtained according to the second learnable parameter matrix, the third learnable parameter matrix and the spatial attention feature map Channel attention feature map, where the first dimension of the second learnable parameter matrix is equal to the second dimension of the third learnable parameter matrix, and the first dimension of the third learnable parameter matrix is equal to the second learnable parameter matrix
  • the second dimension obtain the attention flow feature map based on the spatial attention feature map and the channel attention feature map.
  • the first product of the function value of the first intermediate feature map and its logistic regression function softmax can be obtained, and then the second intermediate feature map can be obtained according to the mean value of the first product.
  • the first intermediate feature map can be right multiplied by the first learnable parameter matrix to obtain a tensor, and the softmax function value of the tensor and the Hadamard product of the tensor can be further calculated to obtain a matrix, and the matrix Taking the average in a certain dimension, the second intermediate feature map is obtained.
  • the spatial attention feature map is a feature map that incorporates spatial attention.
  • the first learnable parameter matrix can learn attention flow information in the spatial dimension.
  • the second learnable parameter matrix and the third learnable parameter matrix can learn the attention flow information in the channel dimension.
  • the weight of each channel can be learned, which can make the features more discriminative for each channel information. force.
  • the attention flow feature map obtained from the spatial attention feature map and the channel attention feature map the attention flow information in the spatial dimension and the channel dimension can be learned, thereby enhancing the attention flow in the spatial dimension and the channel dimension. accuracy.
  • the attention flow module 503 can also be used to perform non-linear mapping processing on the spatial attention feature map to obtain a third intermediate feature map; according to the product of the third intermediate feature map and the channel attention feature map Obtain the fourth intermediate feature map; perform nonlinear mapping processing on the fourth intermediate feature map to obtain the attention flow feature map.
  • mapping values depth-by-depth that is, channel-independent weight learning. It can be regarded as an attention learning method between different channels, which enhances the accuracy of attention flow between channels.
  • the nonlinear mapping will gradually become more "nonlinear" as the depth deepens, that is, the model tends to retain information in shallow networks and strengthen discriminability in deep networks, that is, It is generally believed that low-level feature maps have high resolution and weak semantic information, but rich spatial information, while high-level feature maps have low resolution but strong semantic information.
  • the attention flow module 503 can also be used to obtain the first product of the first intermediate feature map and its logistic regression function value; and obtain the second intermediate feature map according to the mean value of the first product.
  • the attention flow module 503 can also be used to right-multiply the spatial attention feature map by the second learnable parameter matrix to obtain the second product; perform sparse processing on the second product, and right-multiply the second learnable parameter matrix.
  • the parameter matrix can be learned to obtain the channel attention feature map.
  • the first learnable parameter matrix Q 1 is introduced to calculate and obtain r kinds of spatial linear transformation results, so that representative feature combinations in the space can be extracted.
  • the first learnable parameter matrix Q 1 can be used to learn the attention in the H*W dimension of the feature, so that the attention flows in the spatial dimension and a fusion result of multiple feature combinations is obtained.
  • Introducing the second learnable parameter matrix Q 2 and the third learnable parameter matrix Q 3 can learn the attention flow information in the channel dimension. This part of the design pays more attention to the characteristic relationships between channels, by capturing the characteristic relationships between different channels Learning the weight of each channel makes the features more discriminative to the information of each channel.
  • the hybrid processing module 504 can also be used to perform convolution processing to increase channels, including: performing convolution processing to increase the channels by N times on the input feature map, and performing batch normalization processing on the convolution results.
  • the convolution processing to reduce channels includes: performing convolution processing on the input feature map to reduce the channels to 1/N, and performing batch normalization processing on the convolution results.
  • the convolution module 502 can also be used to perform depth-by-depth convolution processing on the first feature map, and perform batch normalization processing on the depth-by-depth convolution results to obtain the second feature map.
  • a lightweight attention flow module is proposed. This module is refined and designed for face recognition technology.
  • the convolution design, linear and non-linear mapping and other technologies in it all follow two principles. First, The first is to reduce network parameters, save calculations, and improve the computing speed; the second is to perform more effective feature fusion in the spatial dimension and channel dimension, enhance feature expression capabilities, and extract more discriminative facial features.
  • the number of basic channels of the attention flow module in the embodiment of the present disclosure can be designed to be 64. Its tensor dimension is very low, and the amount of convolution calculation of the low-dimensional tensor is also very small, which can achieve faster overall running speed. If the entire network performs feature extraction in a low-dimensional space, it is very likely to cause incomplete information and non-robust features.
  • the number of channels of the expansion coefficient is set during the intermediate convolution process. Expansion can improve the feature extraction capabilities of the entire module and achieve a delicate balance between computational complexity and feature expression capabilities.
  • the entire attention flow module uses a combination of operations such as different types of convolution, channel number expansion and compression, and attention flow technology to make the attention flow focused on the face recognition task in space,
  • the flow conversion between channels makes the feature fusion more efficient, and the feature map finally effectively focuses on the area of interest for face recognition.
  • the attention flow module also has the advantages of small number of parameters, small calculation amount, and fast speed.
  • the technical solution of the embodiment of the present disclosure proposes a universal attention flow technology that can effectively capture attention in space and channel respectively, and improve feature discrimination through a channel-by-channel learnable nonlinear mapping method.
  • the entire technology can extract Effective feature combination methods promote the flow of attention in multiple directions and dimensions.
  • each functional module of the face recognition device corresponds to the steps of the above-mentioned exemplary embodiment of the face recognition method, for details not disclosed in the embodiments of the present disclosure device, please refer to the above-mentioned face recognition method of the present disclosure. Examples of face recognition methods.
  • the feature map processing for face recognition is performed through a combination of convolution processing and attention flow processing, thereby promoting the flow of attention in multiple directions and dimensions, so that the final feature map is Each direction dimension has high discriminative power, thereby improving the recognition accuracy of the face recognition model.
  • FIG. 6 is a schematic diagram of an electronic device 6 provided by an embodiment of the present disclosure.
  • the electronic device 6 of this embodiment includes: a processor 601 , a memory 602 , and a computer program 603 stored in the memory 602 and executable on the processor 601 .
  • the processor 601 executes the computer program 603
  • the steps in each of the above method embodiments are implemented.
  • the processor 601 executes the computer program 603 the functions of each module in the above device embodiments are implemented.
  • the electronic device 6 may be a desktop computer, a notebook, a handheld computer, a cloud server and other electronic devices.
  • the electronic device 6 may include, but is not limited to, a processor 601 and a memory 602.
  • FIG. 6 is only an example of the electronic device 6 and does not constitute a limitation on the electronic device 6. It may include more or less components than those shown in the figure, or different components.
  • the processor 601 can be a central processing unit (Central Processing Unit, CPU), or other general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or an on-site processor.
  • Programmable gate array Field-Programmable Gate Array, FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • the memory 602 may be an internal storage unit of the electronic device 6 , for example, a hard disk or memory of the electronic device 6 .
  • the memory 602 may also be an external storage device of the electronic device 6, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash memory card ( Flash Card), etc.
  • Memory 602 may also include both internal storage units of electronic device 6 and external storage devices. Memory 602 is used to store computer programs and other programs and data required by the electronic device.
  • Module completion means dividing the internal structure of the device into different functional units or modules to complete all or part of the functions described above.
  • Each functional unit and module in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.
  • the above-mentioned integrated unit can be hardware-based. It can also be implemented in the form of software functional units.
  • Integrated modules may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as independent products. Based on this understanding, the present disclosure can implement all or part of the processes in the methods of the above embodiments, and can also be completed by instructing relevant hardware through a computer program.
  • the computer program can be stored in a computer-readable storage medium, and the computer program can be processed after being processed. When the processor is executed, the steps of each of the above method embodiments can be implemented.
  • a computer program may include computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form.
  • Computer-readable media can include: any entity or device that can carry computer program code, recording media, USB flash drives, mobile hard drives, magnetic disks, optical disks, computer memory, read-only memory (Read-Only Memory, ROM), random access Memory (Random Access Memory, RAM), electrical carrier signals, telecommunications signals, and software distribution media, etc. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium is not Including electrical carrier signals and telecommunications signals.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Multimedia (AREA)
  • Artificial Intelligence (AREA)
  • Computing Systems (AREA)
  • Databases & Information Systems (AREA)
  • Medical Informatics (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Human Computer Interaction (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Molecular Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Image Analysis (AREA)

Abstract

本公开提供了一种人脸识别方法及装置。该方法包括:获取待识别人脸图像的第一特征图;对第一特征图进行逐深度卷积处理,得到第二特征图;对第二特征图进行注意力流转处理,得到第三特征图;对第三特征图依次进行增加通道的卷积处理、注意力流转处理、减少通道的卷积处理和注意力流转处理,得到第一特征图对应的目标特征图。

Description

人脸识别方法及装置 技术领域
本公开涉及计算机技术领域,尤其涉及一种人脸识别方法及装置。
背景技术
人脸技术在实际应用过程中经常需要部署到云端及边缘端,受限于嵌入式终端等边缘端的算力与存储资源,边缘端人脸识别模型需要满足高精度要求的同时,满足模型尺寸小、计算复杂度低、推理速度快等要求。
相关技术中,可以实现人脸识别任务的常见的轻量化网络有SqueezeNet、MobileNet、ShuffleNet等,由于人脸结构的特殊性,这些模型在人脸识别任务上精度欠佳。专门针对人脸识别任务设计的移动端轻量网络MobileFaceNet基于MobileNet采用了更小的扩张率,将全局平均池化层用全局逐深度卷积层替代。但MobileFaceNet的主要构建模块还是采用常见的残差瓶颈模块,每个模块的计算也是相同的,从而同样具有精度欠佳的问题。
发明内容
有鉴于此,本公开实施例提供了一种人脸识别方法、装置、电子设备及计算机可读存储介质,以解决现有技术中人脸识别模型精度欠佳的问题。
本公开实施例的第一方面,提供了一种人脸识别方法,方法包括:获取待识别人脸图像的第一特征图;对第一特征图进行逐深度卷积处理,得到第二特征图;对第二特征图进行注意力流转处理,得到第三特征图;对第三特征图依次进行增加通道的卷积处理、注意力流转处理、减少通道的卷积处理和注意力流转处理,得到第一特征图对应的目标特征图。
本公开实施例的第二方面,提供了一种人脸识别装置,装置包括:获取模块,用于获取待识别人脸图像的第一特征图;卷积模块,用于对第一特征图进行逐深度卷积处理,得到第二特征图;注意力流转模块,用于对第二特征图进行注意力流转处理,得到第三特征图;混合处理模块,用于对第三特征图依次进行增加通道的卷积处理、注意力流转处理、减少通道的卷积处理和注意力流转处理,得到第一特征图对应的目标特征图。
本公开实施例的第三方面,提供了一种电子设备,包括存储器、处理器以及存储在存储器中并且可在处理器上运行的计算机程序,该处理器执行计算机程序时实现上述方法的步骤。
本公开实施例的第四方面,提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,该计算机程序被处理器执行时实现上述方法的步骤。
本公开实施例与现有技术相比存在的有益效果是:通过卷积处理和注意力流转处理的组合进行人脸识别的特征图处理,促进注意力在多个方向维度上的流转,使得最终得到的特征图对各个方向维度均具有较高的判别力,从而提高人脸识别模型的识别精度。
具体地,本公开实施例中提出一种轻量级的注意力流转模块,该注意力流转模块的张量维度非常低,低维张量的卷积计算量非常小,可以实现较快的整体运行速度。如果整个网络都在低维空间中进行特征提取,极有可能造成信息的不完整和特征的不鲁棒,本公开实施例中在中间的卷积处理过程中进行了设定扩张系数的通道数膨胀,从而可以提高整个模块的特征提取能力,达到计算量和特征表达能力的一个微妙平衡。
在本公开实施例中,整个注意力流转模块通过不同类型的卷积、通道数的扩张与压缩、注意力流转技术等操作之间的组合使得人脸识别任务所关注的注意力流在空间、通道间流转变换,特征融合更加高效,特征图最终有效聚焦在人脸识别感兴趣的区域上,此外,该注意力流转模块还具有参数量少、计算量小、速度快的优势。
附图说明
为了更清楚地说明本公开实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。
图1是本公开实施例的应用场景的场景示意图;
图2是本公开实施例提供的一种人脸识别方法的流程示意图;
图3是本公开实施例提供的注意力流转处理的流程示意图;
图4是本公开实施例提供的再一种人脸识别方法的流程示意图;
图5是本公开实施例提供的一种人脸识别装置的结构示意图;
图6是本公开实施例提供的一种电子设备的结构示意图。
具体实施方式
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本公开实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本公开。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本公开的描述。
下面将结合附图详细说明根据本公开实施例的人脸识别方法和装置。
图1是本公开实施例的应用场景的场景示意图。该应用场景可以包括终端设备101、 102和103、服务器104以及网络105。
终端设备101、102和103可以是硬件,也可以是软件。当终端设备101、102和103为硬件时,其可以是具有显示屏且支持与服务器104通信的各种电子设备,包括但不限于智能手机、机器人、膝上型便携计算机和台式计算机等(比如102可以为机器人);当终端设备101、102和103为软件时,其可以安装在如上的电子设备中。终端设备101、102和103可以实现为多个软件或软件模块,也可以实现为单个软件或软件模块,本公开实施例对此不作限制。进一步地,终端设备101、102和103上可以安装有各种应用,例如数据处理应用、即时通信工具、社交平台软件、搜索类应用、购物类应用等。
服务器104可以是提供各种服务的服务器,例如,对与其建立通信连接的终端设备发送的请求进行接收的后台服务器,该后台服务器可以对终端设备发送的请求进行接收和分析等处理,并生成处理结果。服务器104可以是一台服务器,也可以是由若干台服务器组成的服务器集群,或者还可以是一个云计算服务中心,本公开实施例对此不作限制。
需要说明的是,服务器104可以是硬件,也可以是软件。当服务器104为硬件时,其可以是为终端设备101、102和103提供各种服务的各种电子设备。当服务器104为软件时,其可以是为终端设备101、102和103提供各种服务的多个软件或软件模块,也可以是为终端设备101、102和103提供各种服务的单个软件或软件模块,本公开实施例对此不作限制。
网络105可以是采用同轴电缆、双绞线和光纤连接的有线网络,也可以是无需布线就能实现各种通信设备互联的无线网络,例如,蓝牙(Bluetooth)、近场通信(Near Field Communication,NFC)、红外(Infrared)等,本公开实施例对此不作限制。
目标用户可以通过终端设备101、102和103经由网络105与服务器104建立通信连接,以接收或发送信息等。需要说明的是,终端设备101、102和103、服务器104以及网络105的具体类型、数量和组合可以根据应用场景的实际需求进行调整,本公开实施例对此不作限制。
在相关技术中,嵌入式终端等边缘端的算力与存储资源有限,只能支持较小的模型尺寸,而通用的轻量化的人脸大模型对人脸的识别精度不高。
为解决该技术问题,本公开实施例提供一种人脸识别方案,该人脸识别方案通过设计简洁有效的轻量化提取人脸特征的通用模型,专门针对边缘端和嵌入式设备设计一种实时响应的人脸识别模型,以提高人脸识别的精度。
具体地,本公开实施例的技术方案提出一种通用的注意力流转技术,能够分别有效抓取空间和通道上的注意力,并通过逐通道可学习的非线性映射方式提高特征判别力,整个 技术能够提取有效的特征组合方式,促进注意力在多个方向维度上的流转。
图2是本公开实施例提供的一种人脸识别方法的流程示意图。本公开实施例提供的方法可以由任意具备计算机处理能力的电子设备执行,例如终端或服务器。如图2所示,该人脸识别方法包括:
步骤S201,获取待识别人脸图像的第一特征图。
具体地,第一特征图为4维张量,该张量的维度为(N,C,H,W),其中,N代表批处理图像数、C代表通道数、H代表高度、W代表宽度。第一特征图是对待识别人脸图像进行特征提取得到的。
步骤S202,对第一特征图进行逐深度卷积处理,得到第二特征图。
具体地,逐深度卷积(Depthwise Convolution,简称DWConv)在每个独立的通道内进行卷积操作,常规卷积中每个卷积核对每个通道各进行一次计算,而逐深度卷积中每个卷积核只对一个通道进行计算。
步骤S203,对第二特征图进行注意力流转处理,得到第三特征图。
具体地,注意力流转处理可以使得注意力在空间和通道之间流转,从而进行更有效的特征融合。
步骤S204,对第三特征图依次进行增加通道的卷积处理、注意力流转处理、减少通道的卷积处理和注意力流转处理,得到第一特征图对应的目标特征图。
具体地,增加通道的卷积处理和减少通道的卷积处理是相对应的两个常规卷积计算过程,先进行增加通道的卷积处理使得通道的数量增加,再进行减少通道的卷积处理使得通道的数量恢复到之前的数量。
根据本公开实施例的技术方案,通过注意力流转处理,可以提取有效的特征组合方式,促进注意力在多个方向维度上的流转。通过注意力流转处理技术与不同类型的卷积的设计和组合,可以同时满足人脸识别任务要求和嵌入式设备的轻量级要求,与现有技术相比,可以使用更少的参数量实现更高的识别精度。
如图3所示,步骤S203和步骤S204中的注意力流转处理包括以下步骤:
步骤S301,对输入特征图的第一维度和第二维度进行拉平处理,得到第一中间特征图。
具体地,第一维度可以为高度,第二维度可以为宽度。假设输入特征图为f 1,将f 1的高度和宽度两个维度拉平(flatten),即可以将维度(N,C,H,W)变换为(N,C,R),其中,R=H*W。
步骤S302,根据第一中间特征图和第一可学习参数矩阵获取第二中间特征图。
在本公开实施例的技术方案中,可以获取第一中间特征图与其逻辑回归函数softmax的函数值的第一乘积,再根据第一乘积的均值获取第二中间特征图。具体地,可以将第一中间特征图右乘第一可学习参数矩阵,得到一个张量,进一步计算该张量的softmax函数值与该张量的哈达玛积,得到一个矩阵,并对该矩阵在某一维度上取平均,得到第二中间特征图。第一可学习参数矩阵可以学习空间维度上的注意力流转信息。
步骤S303,根据第二中间特征图和输入特征图的乘积获取空间注意力特征图。
具体地,空间注意力特征图即为融合了空间注意力的特征图。
步骤S304,根据第二可学习参数矩阵、第三可学习参数矩阵和空间注意力特征图获取通道注意力特征图,其中,第二可学习参数矩阵的第一个维度等于第三可学习参数矩阵的第二个维度,第三可学习参数矩阵的第一个维度等于第二可学习参数矩阵的第二个维度。
具体地,可以将空间注意力特征图右乘第二可学习参数矩阵,得到第二乘积;对第二乘积进行稀疏化处理,并右乘第三可学习参数矩阵,得到通道注意力特征图。第二可学习参数矩阵和第三可学习参数矩阵可以学习通道维度上的注意力流转信息,通过抓取不同通道间的特征关系学习到各通道的权重,可以使得特征对各个通道信息更有判别力。
步骤S305,根据空间注意力特征图和通道注意力特征图获取注意力流转特征图。
具体地,根据空间注意力特征图和通道注意力特征图获取注意力流转特征图时,可以对空间注意力特征图进行非线性映射处理,得到第三中间特征图;根据第三中间特征图和通道注意力特征图的乘积得到第四中间特征图;对第四中间特征图进行非线性映射处理,得到注意力流转特征图。根据空间注意力特征图和通道注意力特征图得到的注意力流转特征图,可以学习空间维度上和通道维度上的注意力流转信息,从而可以增强空间维度上和通道维度上的注意力流转的准确性。
以下为对步骤S301至步骤S305的详述:
在步骤S301中,假设输入特征图为f 1,维度分别是(N,C,H,W),将f 1的H和W两个维度拉平(flatten),维度变换为(N,C,R),可以得到第二中间特征图,其中R=H*W。
为学习到特征H*W这个维度上的注意力,使得注意力在空间维度流转,在本公开实施例中,引入第一可学习参数矩阵Q 1,维度为(R,r)(r<R)。
在步骤S302中,将维度变换后得到的第一中间特征图右乘Q 1,得到维度为(N,C,r)的张量f’ 1,在f’ 1的r这一维度进行softmax操作可以得到维度同样为(N,C,r)的张量A s,将f’ 1和A s在r这一维度上的对应元素相乘,即获取f’ 1和A s的哈达玛积(Hadamard product), 可以得到大小为(N,C,r)的矩阵M 1,M 1代表多种特征组合的一种融合,r越大,复杂度越高。将M 1按照r这一维度取平均(avg),将维度压缩为1,可以得到第二中间特征图
Figure PCTCN2022129343-appb-000001
其维度为(N,C),具体计算过程如以下公式(1)所示:
Figure PCTCN2022129343-appb-000002
在本公开实施例中,引入第一可学习参数矩阵Q 1是为了计算获得r种空间线性变换结果,可以将空间中有代表性的特征组合方式都提取出来。在提取到的人脸特征图中,虽然每个空间像素点具有相同的感受野,但这些感受野映射到原图的区域不同,对最终识别任务的贡献也不同,所以对于不同像素点应给予不同的权重。使用第一可学习参数矩阵Q 1可以学习到特征的H*W这个维度上的注意力,使得注意力在空间维度流转,得到多种特征组合的一种融合结果。
在步骤S303中,将步骤S301中输出的第二中间特征图
Figure PCTCN2022129343-appb-000003
与f 1相乘得到空间注意力特征图
Figure PCTCN2022129343-appb-000004
其维度为(N,C,H,W),具体计算过程如以下公式(2)所示:
Figure PCTCN2022129343-appb-000005
其中,
Figure PCTCN2022129343-appb-000006
即为融合了空间注意力的特征图。
在步骤S304中,将维度为(N,C,H,W)的空间注意力特征图引入第二可学习参数矩阵Q 2和第三可学习参数矩阵Q 3进行处理,得到通道注意力特征图
Figure PCTCN2022129343-appb-000007
具体地,第二可学习参数矩阵Q 2的维度为(C,C//p),第三可学习参数矩阵Q 3的维度为(C//p,C),其中C为自然数。可见第二可学习参数矩阵的第一个维度等于第三可学习参数矩阵的第二个维度,第三可学习参数矩阵的第一个维度等于第二可学习参数矩阵的第二个维度。将
Figure PCTCN2022129343-appb-000008
右乘Q 2,可以得到维度(N,C//p),经过relu稀疏化,再右乘Q 3,可以得到通道注意力特征图
Figure PCTCN2022129343-appb-000009
其维度为(N,C)。
具体计算过程如以下公式(3)所示:
Figure PCTCN2022129343-appb-000010
在步骤S305中,对步骤S304中输出的通引入第二可学习参数矩阵Q 2和第三可学习参数矩阵Q 3可以学习通道维度上的注意力流转信息,这部分的设计更关注通道间的特征关系,通过抓取不同通道间的特征关系学习到各通道的权重,使得特征对各个通道信息更有判别力。p代表缩放系数,设计参数p可以降低计算量,控制模型大小。
道注意力特征图
Figure PCTCN2022129343-appb-000011
进行非线性映射,可以得到第三中间特征f s,具体计算过程如以下公式(4)和(5)所示:
Figure PCTCN2022129343-appb-000012
Figure PCTCN2022129343-appb-000013
其中,
Figure PCTCN2022129343-appb-000014
i代表第i个通道,即对特征图f’ 1进行逐通道非线性映射,并且各通道的非线性映射函数可以不同,各通道的映射参数∈ i和k i需要通过学习得到。
采用非线性映射方式进行数据处理的过程中,对于负值输入,相比于relu直接值为0或小于0的输入映射为0进行输出的操作,可以认为卷积核的正负响应都应被接受,即可以认为人脸需要学习负值输入。应用这种非线性映射方式可以学习到数据中更加复杂的关系。其次,逐深度学习映射值,即进行通道独立的权重学习是有益的,其可以看作是一种不同通道间的注意力学习方式,增强了通道间的注意力流转准确性。此外,对于该逐通道映射方式,在深度加深的过程中非线性映射会逐渐变得更加“非线性”,即模型倾向于在浅层网络中保留信息,在深层网络中加强判别力,也即通常认为的低层特征图高分辨率、语义信息弱、但空间信息丰富,高层特征图具有低分辨率、但语义信息较强。
进一步地,将f s
Figure PCTCN2022129343-appb-000015
相乘得到第四中间特征图f c,维度为(N,C,H,W),具体计算过程如以下公式(6)所示:
Figure PCTCN2022129343-appb-000016
为了进一步增强特征的表达能力,对第四中间特征图f c进行非线性映射,得到注意力流转特征图f C,具体计算过程如以下公式(7)和(8)所示:
Figure PCTCN2022129343-appb-000017
Figure PCTCN2022129343-appb-000018
其中,
Figure PCTCN2022129343-appb-000019
f c代表注意力在空间方向和通道方向上都进行了充分流转的特征图,直到感兴趣的注意力流横跨整个特征空间。
由上述内容可知,f c的维度为(N,C,H,W),与输入特征图f 1保持维度一致,所以该注意力流转技术可以作为一种即插即用的模块插入到神经网络的任何模块和任何位置中,使用方式较为灵活。该注意力流转技术主要通过注意力在空间和通道之间的流转进行更有效的特征融合,并且通过正负响应分别逐通道学习的非线性映射方式增强特征表达能力,从而可以提取到更具判别性的人脸特征。如果我们把该注意力流转技术定义为SC函数,输入为f 1,输出为f C,则可以得到如下注意力流转公式(9):
f C=SC(f 1)   (9)
在本公开实施例中,可以根据该注意力流转技术形成一个注意力流转模块作为神经网络的基础组成模块。该模块可以通过针对人脸结构特殊性进行精细化卷积模块设计,从而 实现采用最少的计算量提取强判别性人脸特征的功能,将特征图的注意力有效聚焦在了对识别任务有利的区域。
在步骤S201至步骤S204中应用该注意力流转模块时,可以对步骤S201至步骤S204的实现过程详述如下:
在步骤S202中,可以对第一特征图进行逐深度卷积处理,并对逐深度卷积结果进行批归一化处理,得到第二特征图。具体地,可以进行卷积核为n×n(n>1)、输入通道数是C、输出通道数是C、填充(padding)为1、步长(stride)为s的逐深度卷积计算(DWConv),然后进行批量化归一(BatchNorm,简称BN),计算得到结果f’ 1,以n=3为例,具体计算过程如以下公式(10)所示:
f’ 1=BN(DWConv(f 1,3×3))   (10)
其中,步长依据网络设计而变化,是个可配置超参数。在本公开实施例中,基于设计小尺寸模块的思想,采用逐深度卷积而不是普通卷积来降低参数量,可以计算得到逐深度卷积的参数量是普通的常规卷积的1/C。需要特别说明的是,这里的3×3卷积可以替换为5×5或者7×7等更大的卷积核,但以3×3卷积性价比最高。
在步骤S203中,将步骤S202的输出f’ 1进行上述注意力流转计算,得到
Figure PCTCN2022129343-appb-000020
具体计算过程如以下公式(11)所示:
Figure PCTCN2022129343-appb-000021
在步骤S204中,增加通道的卷积处理包括:对输入的特征图进行通道增加N倍的卷积处理,并对卷积结果进行批归一化处理,其中,N为自然数;减少通道的卷积处理包括:对输入的特征图进行通道减少为1/N的卷积处理,并对卷积结果进行批归一化处理。具体地,在步骤S204中,可以依次执行以下步骤:
将步骤S202的输出
Figure PCTCN2022129343-appb-000022
进行卷积核是1×1、输入通道数是C、输出通道数是C*expension(扩张系数)、步长为1的卷积计算(Conv),然后进行批量化归一,计算得到结果f 2,具体计算过程如以下公式(12)所示:
Figure PCTCN2022129343-appb-000023
将f 2进行上述注意力流转计算,得到
Figure PCTCN2022129343-appb-000024
具体计算过程如以下公式(13)所示:
Figure PCTCN2022129343-appb-000025
Figure PCTCN2022129343-appb-000026
进行卷积核是1×1、输入通道数是C*expension、输出通道数是C、步长为1的卷积计算,然后进行批量化归一,计算得到结果f 3,具体计算过程如以下公式(14)所示:
Figure PCTCN2022129343-appb-000027
将f 3进行上述注意力流转计算,得到
Figure PCTCN2022129343-appb-000028
具体计算过程如以下公式(15)所示:
Figure PCTCN2022129343-appb-000029
本公开实施例中提出一种轻量级的注意力流转模块,该模块针对人脸识别技术进行精细化设计,其中的卷积设计、线性及非线性映射等技术都遵循两个原则,第一是减少网络参数,节省计算量,提升运算速度;第二是在空间维度和通道维度上进行更有效的特征融合,增强特征表达能力,提取到更具判别性的人脸特征。
本公开实施例中的注意力流转模块的基础通道数可以设计为64,其张量维度非常低,低维张量的卷积计算量也非常小,可以实现较快的整体运行速度。如果整个网络都在低维空间中进行特征提取,极有可能造成信息的不完整和特征的不鲁棒,本公开实施例中在中间的卷积处理过程中进行了设定扩张系数的通道数膨胀,从而可以提高整个模块的特征提取能力,达到计算量和特征表达能力的一个微妙平衡。
在本公开实施例中,整个注意力流转模块通过不同类型的卷积、通道数的扩张与压缩、注意力流转技术等操作之间的组合使得人脸识别任务所关注的注意力流在空间、通道间流转变换,特征融合更加高效,特征图最终有效聚焦在人脸识别感兴趣的区域上,此外,该注意力流转模块还具有参数量少、计算量小、速度快的优势。
如图4所示,本公开实施例提供的一种人脸识别方法包括以下步骤:
步骤S401,将待识别人脸图像输入卷积核为3×3,通道数为64,步长为1的卷积层和归一化层。在一种具体实施例中,该待识别人脸图像的分辨率为(1,3,112,112)。步骤S401输出的特征图分辨率为(1,64,112,112)。
步骤S402,将上一个步骤得到的特征图输入1个基础通道数为64,扩张系数为1,可配置步长为2的注意力流转模块。步骤S402输出的特征图分辨率为(1,64,56,56)。
步骤S403,将上一个步骤得到的特征图输入1个基础通道数为64,扩张系数为1,可配置步长为1的注意力流转模块。步骤S403输出的特征图分辨率为(1,64,56,56)。
步骤S404,将上一个步骤得到的特征图输入1个基础通道数为64,扩张系数为2,可配置步长为2的注意力流转模块。步骤S404输出的特征图分辨率为(1,64,28,28)。
步骤S405,将上一个步骤得到的特征图输入4个基础通道数为64,扩张系数为2,可配置步长为1的注意力流转模块。步骤S405输出的特征图分辨率为(1,64,28,28)。
步骤S406,将上一个步骤得到的特征图输入1个基础通道数为128,扩张系数为2,可配置步长为2的注意力流转模块。步骤S406输出的特征图分辨率为(1,128,14,14)。
步骤S407,将上一个步骤得到的特征图输入6个基础通道数为128,扩张系数为2,可 配置步长为1的注意力流转模块。步骤S407输出的特征图分辨率为(1,128,14,14)。
步骤S408,将上一个步骤得到的特征图输入1个基础通道数为128,扩张系数为2,可配置步长为2的注意力流转模块。步骤S408输出的特征图分辨率为(1,128,7,7)。
步骤S409,将上一个步骤得到的特征图输入2个基础通道数为128,扩张系数为2,可配置步长为1的注意力流转模块。步骤S409输出的特征图分辨率为(1,128,7,7)。
步骤S410,将上一个步骤得到的特征图输入卷积核为1×1,通道数为512的卷积层和归一化层。步骤S410输出的特征图分辨率为(1,512,7,7)。
步骤S411,将上一个步骤得到的特征图输入卷积核为7×7,通道数为512的卷积层和归一化层。步骤S411输出的特征图分辨率为(1,512,1,1)。
步骤S412,将上一个步骤得到的特征图进行拉平处理后,进行(512,512)的全连接矩阵计算,得到512维向量作为目标特征图。
在如图4所示的人脸识别方法中,步骤S402和步骤S403可以看作是一个阶段,步骤S404和步骤S405可以看作是一个阶段,步骤S406和步骤S407可以看作是一个阶段,步骤S408和步骤S409可以看作是一个阶段,各个阶段包含的注意力流转模块的个数分别为(2,5,7,3),但是该注意力流转模块的组合方式仅为示例性描述,其它注意力流转模块的组合方式也可以实现本公开实施例的技术方案的技术效果。
本公开实施例的技术方案提出一种通用的注意力流转技术,能够分别有效抓取空间和通道上的注意力,并通过逐通道可学习的非线性映射方式提高特征判别力,整个技术能够提取有效的特征组合方式,促进注意力在多个方向维度上的流转。
根据本公开实施例的人脸识别方法,通过卷积处理和注意力流转处理的组合进行人脸识别的特征图处理,促进注意力在多个方向维度上的流转,使得最终得到的特征图对各个方向维度均具有较高的判别力,从而提高人脸识别模型的识别精度。
下述为本公开装置实施例,可以用于执行本公开方法实施例。下文描述的人脸识别装置与上文描述的人脸识别方法可相互对应参照。对于本公开装置实施例中未披露的细节,请参照本公开方法实施例。
图5是本公开实施例提供的一种人脸识别装置的示意图。如图5所示,该人脸识别装置包括:
获取模块501,可以用于获取待识别人脸图像的第一特征图。
具体地,第一特征图为4维张量,该张量的维度为(N,C,H,W),其中,N代表批处理图像数、C代表通道数、H代表高度、W代表宽度。第一特征图是对待识别人脸图 像进行特征提取得到的。
卷积模块502,可以用于对第一特征图进行逐深度卷积处理,得到第二特征图。
具体地,逐深度卷积在每个独立的通道内进行卷积操作,常规卷积中每个卷积核对每个通道各进行一次计算,而逐深度卷积中每个卷积核只对一个通道进行计算。
注意力流转模块503,可以用于对第二特征图进行注意力流转处理,得到第三特征图。
具体地,注意力流转处理可以使得注意力在空间和通道之间流转,从而进行更有效的特征融合。
混合处理模块504,可以用于对第三特征图依次进行增加通道的卷积处理、注意力流转处理、减少通道的卷积处理和注意力流转处理,得到第一特征图对应的目标特征图。
具体地,增加通道的卷积处理和减少通道的卷积处理是相对应的两个常规卷积计算过程,先进行增加通道的卷积处理使得通道的数量增加,再进行减少通道的卷积处理使得通道的数量恢复到之前的数量。
根据本公开实施例的技术方案,通过注意力流转处理,可以提取有效的特征组合方式,促进注意力在多个方向维度上的流转。通过注意力流转处理技术与不同类型的卷积的设计和组合,可以同时满足人脸识别任务要求和嵌入式设备的轻量级要求,与现有技术相比,可以使用更少的参数量实现更高的识别精度。
在本公开实施例中,注意力流转模块503还可以用于,对输入特征图的第一维度和第二维度进行拉平处理,得到第一中间特征图;根据第一中间特征图和第一可学习参数矩阵获取第二中间特征图;根据第二中间特征图和输入特征图的乘积获取空间注意力特征图;根据第二可学习参数矩阵、第三可学习参数矩阵和空间注意力特征图获取通道注意力特征图,其中,第二可学习参数矩阵的第一个维度等于第三可学习参数矩阵的第二个维度,第三可学习参数矩阵的第一个维度等于第二可学习参数矩阵的第二个维度;根据空间注意力特征图和通道注意力特征图获取注意力流转特征图。
在本公开实施例的技术方案中,可以获取第一中间特征图与其逻辑回归函数softmax的函数值的第一乘积,再根据第一乘积的均值获取第二中间特征图。具体地,可以将第一中间特征图右乘第一可学习参数矩阵,得到一个张量,进一步计算该张量的softmax函数值与该张量的哈达玛积,得到一个矩阵,并对该矩阵在某一维度上取平均,得到第二中间特征图。
具体地,空间注意力特征图即为融合了空间注意力的特征图。第一可学习参数矩阵可以学习空间维度上的注意力流转信息。第二可学习参数矩阵和第三可学习参数矩阵可以学 习通道维度上的注意力流转信息,通过抓取不同通道间的特征关系学习到各通道的权重,可以使得特征对各个通道信息更有判别力。根据空间注意力特征图和通道注意力特征图得到的注意力流转特征图,可以学习空间维度上和通道维度上的注意力流转信息,从而可以增强空间维度上和通道维度上的注意力流转的准确性。
在本公开实施例中,注意力流转模块503还可以用于,对空间注意力特征图进行非线性映射处理,得到第三中间特征图;根据第三中间特征图和通道注意力特征图的乘积得到第四中间特征图;对第四中间特征图进行非线性映射处理,得到注意力流转特征图。
在本公开实施例中,应用这种非线性映射方式可以学习到数据中更加复杂的关系。逐深度学习映射值,即进行通道独立的权重学习是有益的,其可以看作是一种不同通道间的注意力学习方式,增强了通道间的注意力流转准确性。此外,对于该逐通道映射方式,在深度加深的过程中非线性映射会逐渐变得更加“非线性”,即模型倾向于在浅层网络中保留信息,在深层网络中加强判别力,也即通常认为的低层特征图高分辨率、语义信息弱、但空间信息丰富,高层特征图具有低分辨率、但语义信息较强。
在本公开实施例中,注意力流转模块503还可以用于,获取第一中间特征图与其逻辑回归函数值的第一乘积;根据第一乘积的均值获取第二中间特征图。
在本公开实施例中,注意力流转模块503还可以用于,将空间注意力特征图右乘第二可学习参数矩阵,得到第二乘积;对第二乘积进行稀疏化处理,并右乘第三可学习参数矩阵,得到通道注意力特征图。
在本公开实施例中,引入第一可学习参数矩阵Q 1是为了计算获得r种空间线性变换结果,可以将空间中有代表性的特征组合方式都提取出来。在提取到的人脸特征图中,虽然每个空间像素点具有相同的感受野,但这些感受野映射到原图的区域不同,对最终识别任务的贡献也不同,所以对于不同像素点应给予不同的权重。使用第一可学习参数矩阵Q 1可以学习到特征的H*W这个维度上的注意力,使得注意力在空间维度流转,得到多种特征组合的一种融合结果。引入第二可学习参数矩阵Q 2和第三可学习参数矩阵Q 3可以学习通道维度上的注意力流转信息,这部分的设计更关注通道间的特征关系,通过抓取不同通道间的特征关系学习到各通道的权重,使得特征对各个通道信息更有判别力。
在本公开实施例中,混合处理模块504还可以用于,增加通道的卷积处理包括:对输入的特征图进行通道增加N倍的卷积处理,并对卷积结果进行批归一化处理,其中,N为自然数;减少通道的卷积处理包括:对输入的特征图进行通道减少为1/N的卷积处理,并对卷积结果进行批归一化处理。
在本公开实施例中,卷积模块502还可以用于,对第一特征图进行逐深度卷积处理,并对逐深度卷积结果进行批归一化处理,得到第二特征图。
本公开实施例中提出一种轻量级的注意力流转模块,该模块针对人脸识别技术进行精细化设计,其中的卷积设计、线性及非线性映射等技术都遵循两个原则,第一是减少网络参数,节省计算量,提升运算速度;第二是在空间维度和通道维度上进行更有效的特征融合,增强特征表达能力,提取到更具判别性的人脸特征。
本公开实施例中的注意力流转模块的基础通道数可以设计为64,其张量维度非常低,低维张量的卷积计算量也非常小,可以实现较快的整体运行速度。如果整个网络都在低维空间中进行特征提取,极有可能造成信息的不完整和特征的不鲁棒,本公开实施例中在中间的卷积处理过程中进行了设定扩张系数的通道数膨胀,从而可以提高整个模块的特征提取能力,达到计算量和特征表达能力的一个微妙平衡。
在本公开实施例中,整个注意力流转模块通过不同类型的卷积、通道数的扩张与压缩、注意力流转技术等操作之间的组合使得人脸识别任务所关注的注意力流在空间、通道间流转变换,特征融合更加高效,特征图最终有效聚焦在人脸识别感兴趣的区域上,此外,该注意力流转模块还具有参数量少、计算量小、速度快的优势。
本公开实施例的技术方案提出一种通用的注意力流转技术,能够分别有效抓取空间和通道上的注意力,并通过逐通道可学习的非线性映射方式提高特征判别力,整个技术能够提取有效的特征组合方式,促进注意力在多个方向维度上的流转。
由于本公开的示例实施例的人脸识别装置的各个功能模块与上述人脸识别方法的示例实施例的步骤对应,因此对于本公开装置实施例中未披露的细节,请参照本公开上述的人脸识别方法的实施例。
根据本公开实施例的人脸识别装置,通过卷积处理和注意力流转处理的组合进行人脸识别的特征图处理,促进注意力在多个方向维度上的流转,使得最终得到的特征图对各个方向维度均具有较高的判别力,从而提高人脸识别模型的识别精度。
图6是本公开实施例提供的电子设备6的示意图。如图6所示,该实施例的电子设备6包括:处理器601、存储器602以及存储在该存储器602中并且可在处理器601上运行的计算机程序603。处理器601执行计算机程序603时实现上述各个方法实施例中的步骤。或者,处理器601执行计算机程序603时实现上述各装置实施例中各模块的功能。
电子设备6可以是桌上型计算机、笔记本、掌上电脑及云端服务器等电子设备。电子设备6可以包括但不仅限于处理器601和存储器602。本领域技术人员可以理解,图6仅仅 是电子设备6的示例,并不构成对电子设备6的限定,可以包括比图示更多或更少的部件,或者不同的部件。
处理器601可以是中央处理单元(Central Processing Unit,CPU),也可以是其它通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其它可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。
存储器602可以是电子设备6的内部存储单元,例如,电子设备6的硬盘或内存。存储器602也可以是电子设备6的外部存储设备,例如,电子设备6上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。存储器602还可以既包括电子设备6的内部存储单元也包括外部存储设备。存储器602用于存储计算机程序以及电子设备所需的其它程序和数据。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
集成的模块如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读存储介质中。基于这样的理解,本公开实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,计算机程序可以存储在计算机可读存储介质中,该计算机程序在被处理器执行时,可以实现上述各个方法实施例的步骤。计算机程序可以包括计算机程序代码,计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。计算机可读介质可以包括:能够携带计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、电载波信号、电信信号以及软件分发介质等。需要说明的是,计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如,在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括电载波信号和电信信号。
以上实施例仅用以说明本公开的技术方案,而非对其限制;尽管参照前述实施例对本公开进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所 记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本公开各实施例技术方案的精神和范围,均应包含在本公开的保护范围之内。

Claims (10)

  1. 一种人脸识别方法,其特征在于,所述方法包括:
    获取待识别人脸图像的第一特征图;
    对所述第一特征图进行逐深度卷积处理,得到第二特征图;
    对所述第二特征图进行注意力流转处理,得到第三特征图;
    对第三特征图依次进行增加通道的卷积处理、所述注意力流转处理、减少通道的卷积处理和所述注意力流转处理,得到第一特征图对应的目标特征图。
  2. 根据权利要求1所述的方法,其特征在于,所述注意力流转处理包括:
    对输入特征图的第一维度和第二维度进行拉平处理,得到第一中间特征图;
    根据所述第一中间特征图和第一可学习参数矩阵获取第二中间特征图;
    根据所述第二中间特征图和所述输入特征图的乘积获取空间注意力特征图;
    根据第二可学习参数矩阵、第三可学习参数矩阵和所述空间注意力特征图获取通道注意力特征图,其中,所述第二可学习参数矩阵的第一个维度等于所述第三可学习参数矩阵的第二个维度,所述第三可学习参数矩阵的第一个维度等于所述第二可学习参数矩阵的第二个维度;
    根据所述空间注意力特征图和所述通道注意力特征图获取注意力流转特征图。
  3. 根据权利要求2所述的方法,其特征在于,根据所述空间注意力特征图和所述通道注意力特征图获取注意力流转特征图,包括:
    对所述空间注意力特征图进行非线性映射处理,得到第三中间特征图;
    根据所述第三中间特征图和所述通道注意力特征图的乘积得到第四中间特征图;
    对所述第四中间特征图进行所述非线性映射处理,得到所述注意力流转特征图。
  4. 根据权利要求2所述的方法,其特征在于,根据所述第一中间特征图和第一可学习参数矩阵获取第二中间特征图,包括:
    获取所述第一中间特征图与其逻辑回归函数值的第一乘积;
    根据所述第一乘积的均值获取所述第二中间特征图。
  5. 根据权利要求2所述的方法,其特征在于,根据第二可学习参数矩阵、第三可学习参数矩阵和所述空间注意力特征图获取通道注意力特征图,包括:
    将所述空间注意力特征图右乘所述第二可学习参数矩阵,得到第二乘积;
    对所述第二乘积进行稀疏化处理,并右乘所述第三可学习参数矩阵,得到所述通道注意力特征图。
  6. 根据权利要求1所述的方法,其特征在于,
    所述增加通道的卷积处理包括:对输入的特征图进行通道增加N倍的卷积处理,并对卷积结果进行批归一化处理,其中,N为自然数;
    所述减少通道的卷积处理包括:对输入的特征图进行通道减少为1/N的卷积处理,并对卷积结果进行批归一化处理。
  7. 根据权利要求6所述的方法,其特征在于,根据对所述第一特征图进行逐深度卷积处理,得到第二特征图,包括:
    对所述第一特征图进行逐深度卷积处理,并对逐深度卷积结果进行批归一化处理,得到所述第二特征图。
  8. 一种人脸识别装置,其特征在于,所述装置包括:
    获取模块,用于获取待识别人脸图像的第一特征图;
    卷积模块,用于对所述第一特征图进行逐深度卷积处理,得到第二特征图;
    注意力流转模块,用于对所述第二特征图进行注意力流转处理,得到第三特征图;
    混合处理模块,用于对第三特征图依次进行增加通道的卷积处理、所述注意力流转处理、减少通道的卷积处理和所述注意力流转处理,得到第一特征图对应的目标特征图。
  9. 一种电子设备,包括存储器、处理器以及存储在所述存储器中并且可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1所述方法的步骤。
  10. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1所述方法的步骤。
PCT/CN2022/129343 2022-08-31 2022-11-02 人脸识别方法及装置 WO2024045320A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211055844.7 2022-08-31
CN202211055844.7A CN115588218A (zh) 2022-08-31 2022-08-31 人脸识别方法及装置

Publications (1)

Publication Number Publication Date
WO2024045320A1 true WO2024045320A1 (zh) 2024-03-07

Family

ID=84772610

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/129343 WO2024045320A1 (zh) 2022-08-31 2022-11-02 人脸识别方法及装置

Country Status (2)

Country Link
CN (1) CN115588218A (zh)
WO (1) WO2024045320A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117894058B (zh) * 2024-03-14 2024-05-24 山东远桥信息科技有限公司 基于注意力增强的智慧城市摄像头人脸识别方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190130204A1 (en) * 2017-10-31 2019-05-02 The University Of Florida Research Foundation, Incorporated Apparatus and method for detecting scene text in an image
CN111582044A (zh) * 2020-04-15 2020-08-25 华南理工大学 基于卷积神经网络和注意力模型的人脸识别方法
CN112766279A (zh) * 2020-12-31 2021-05-07 中国船舶重工集团公司第七0九研究所 一种基于联合注意力机制的图像特征提取方法
CN114782403A (zh) * 2022-05-17 2022-07-22 河南大学 基于混合空间和通道间注意力的肺炎图像检测方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190130204A1 (en) * 2017-10-31 2019-05-02 The University Of Florida Research Foundation, Incorporated Apparatus and method for detecting scene text in an image
CN111582044A (zh) * 2020-04-15 2020-08-25 华南理工大学 基于卷积神经网络和注意力模型的人脸识别方法
CN112766279A (zh) * 2020-12-31 2021-05-07 中国船舶重工集团公司第七0九研究所 一种基于联合注意力机制的图像特征提取方法
CN114782403A (zh) * 2022-05-17 2022-07-22 河南大学 基于混合空间和通道间注意力的肺炎图像检测方法及装置

Also Published As

Publication number Publication date
CN115588218A (zh) 2023-01-10

Similar Documents

Publication Publication Date Title
WO2019184657A1 (zh) 图像识别方法、装置、电子设备及存储介质
EP4163831A1 (en) Neural network distillation method and device
US20230401446A1 (en) Convolutional neural network pruning processing method, data processing method, and device
CN112990219B (zh) 用于图像语义分割的方法和装置
WO2024041479A1 (zh) 一种数据处理方法及其装置
CN112258512A (zh) 点云分割方法、装置、设备和存储介质
WO2023231794A1 (zh) 一种神经网络参数量化方法和装置
WO2020093724A1 (zh) 生成信息的方法和装置
WO2020062299A1 (zh) 一种神经网络处理器、数据处理方法及相关设备
WO2024045320A1 (zh) 人脸识别方法及装置
CN111539353A (zh) 一种图像场景识别方法及装置、计算机设备以及存储介质
WO2021169366A1 (zh) 数据增强方法和装置
CN114330565A (zh) 一种人脸识别方法及装置
CN110717405B (zh) 人脸特征点定位方法、装置、介质及电子设备
US20230281956A1 (en) Method for generating objective function, apparatus, electronic device and computer readable medium
EP4170547A1 (en) Method for extracting data features, and related apparatus
CN113139490B (zh) 一种图像特征匹配方法、装置、计算机设备及存储介质
CN115965520A (zh) 特效道具、特效图的生成方法、装置、设备及存储介质
CN113778078A (zh) 定位信息生成方法、装置、电子设备和计算机可读介质
CN116912631B (zh) 目标识别方法、装置、电子设备及存储介质
CN111582376B (zh) 神经网络的可视化方法、装置、电子设备和介质
CN114283060B (zh) 视频生成方法、装置、设备及存储介质
CN113643348B (zh) 一种人脸属性分析方法及装置
WO2024061123A1 (zh) 一种图像处理方法及其相关设备
US20240232575A1 (en) Neural network obtaining method, data processing method, and related device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22957133

Country of ref document: EP

Kind code of ref document: A1