Image recognition method and related device

By adopting a facial liveness detection model with a front-to-back spatio-temporal fusion twin-tower structure in the face verification system, and combining static and dynamic features, the problem of inaccurate live face recognition in the existing technology is solved, and the security of the system is significantly improved.

CN114360073BActive Publication Date: 2024-10-01TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210005751.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-04
Publication Date
2024-10-01
Estimated Expiration
2042-01-04

AI Technical Summary

Technical Problem

It is difficult for the existing face verification system to accurately identify whether the object in the video is a living face, and it is easy to misidentify non-living faces as living ones, leading to security vulnerabilities.

Method used

Using a facial liveness detection model based on the front and rear spatio-temporal fusion twin tower structure, through frame processing, shallow feature extraction, post spatiotemporal feature fusion and front spatiotemporal feature fusion, the feature vectors of multi-frame video images are obtained, and static and dynamic features are integrated to determine Whether the face is alive.

Benefits of technology

It improves the accurate recognition of living faces, reduces the risk of fake and synthetic videos bypassing verification, and enhances the security of the face verification system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114360073B_ABST
    Figure CN114360073B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses an image recognition method and related device in the field of artificial intelligence, wherein the method comprises: obtaining a target video including the face of a target object, performing frame processing on the target video to obtain multiple frames of video images arranged in sequence; performing feature extraction processing on the multiple frames of video images to obtain multiple target feature maps arranged in sequence; performing spatial compression processing on the multiple target feature maps first, and then performing temporal compression processing to obtain a post-fusion global feature vector; performing temporal compression processing on the multiple target feature maps first, and then performing spatial compression processing to obtain a pre-fusion global feature vector; determining a face detection result according to the post-fusion global feature vector and the pre-fusion global feature vector. The method can improve the detection accuracy of the face of an object in a video.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to an image recognition method and related devices. Background Art

[0002] As face recognition technology matures, face verification systems are now widely used in various application scenarios. For example, in electronic payment scenarios, face verification systems can be used to verify the identity of payment users, thereby ensuring the security of online electronic payments; in account login scenarios, face verification systems can also be used to verify whether the user requesting to log in to an account is the legitimate user of the account, thereby ensuring the security of account login, and so on.

[0003] In practical applications, in order to prevent criminals from using recorded videos or forged masks to bypass the face verification system, the face verification system not only needs to identify whether the verified face is a specific face, but also needs to identify whether the verified face is a real face, that is, to identify whether the object face in the image collected during the verification process is a living face.

[0004] However, the inventors of this application have discovered through research that the implementation effects of the methods used in the related art for verifying live faces are generally not ideal, that is, these methods find it difficult to accurately verify whether the face of the object in the image is a live face, and it is easy to mistakenly identify a non-live face in the image as a live face, giving criminals an opportunity to take advantage. Summary of the invention

[0005] The embodiments of the present application provide an image recognition method and related devices, which can more accurately verify whether the face of an object in a video is a living face.

[0006] In view of this, the first aspect of the present application provides an image recognition method, the method comprising:

[0007] Acquire a target video, wherein the target video includes the face of the target object to be verified; perform frame processing on the target video to obtain a plurality of video frames arranged in sequence in the target video;

[0008] Performing feature extraction processing on the multiple frames of video images to obtain a plurality of target feature maps arranged in sequence corresponding to the multiple frames of video images;

[0009] Performing feature extraction processing on the spatial dimension for each of the multiple target feature maps to obtain feature vectors corresponding to each of the multiple target feature maps; performing feature extraction processing on the temporal dimension based on the feature vectors corresponding to each of the multiple target feature maps to obtain a post-fusion global feature vector;

[0010] Performing feature extraction processing in the time dimension based on the multiple target feature maps to obtain a time compression feature map; performing feature extraction processing in the space dimension on the time compression feature map to obtain a pre-fusion global feature vector;

[0011] A face detection result corresponding to the target object is determined according to the post-fusion global feature vector and the pre-fusion global feature vector.

[0012] A second aspect of the present application provides an image recognition device, the device comprising:

[0013] The video splitting module is used to obtain a target video, wherein the target video includes the face of the target object to be verified; perform frame processing on the target video to obtain multiple frames of video images arranged in sequence in the target video;

[0014] A primary feature extraction module, used for performing feature extraction processing on the multiple frames of video images to obtain a plurality of target feature maps arranged in sequence corresponding to the multiple frames of video images;

[0015] A post-fusion feature extraction module is used to perform feature extraction processing in the spatial dimension on the multiple target feature maps respectively to obtain feature vectors corresponding to the multiple target feature maps; based on the feature vectors corresponding to the multiple target feature maps respectively, perform feature extraction processing in the time dimension to obtain a post-fusion global feature vector;

[0016] A pre-fusion feature extraction module is used to perform feature extraction processing in the time dimension based on the multiple target feature maps to obtain a time compression feature map; perform feature extraction processing in the space dimension on the time compression feature map to obtain a pre-fusion global feature vector;

[0017] A verification module is used to determine the face detection result corresponding to the target object according to the post-fusion global feature vector and the pre-fusion global feature vector.

[0018] A third aspect of the present application provides a computer device, the device comprising a processor and a memory:

[0019] The memory is used to store computer programs;

[0020] The processor is used to execute the steps of the image recognition method as described in the first aspect according to the computer program.

[0021] A fourth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the steps of the image recognition method described in the first aspect above.

[0022] In a fifth aspect, the present application provides a computer program product or a computer program, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of the image recognition method described in the first aspect above.

[0023] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:

[0024] The embodiment of the present application provides an image recognition method, which proposes a new model for detecting whether an object in a video is a living object, and the model includes a shallow feature extraction module, a post-spatial feature fusion module, and a pre-spatial feature fusion module. When verifying whether a target object in a target video (including the face of the target object) is a living object based on the model, the target video can be first framed to obtain a plurality of video images arranged in sequence in the target video. Then, through the shallow feature extraction module in the model, the plurality of video images are subjected to feature extraction processing to obtain a plurality of target feature maps arranged in sequence corresponding to the plurality of video images. Furthermore, through the post-spatial feature fusion module in the model, the plurality of target feature maps are first subjected to feature extraction processing in the spatial dimension, and then subjected to feature extraction processing in the temporal dimension based on the spatial feature extraction result, to obtain a post-fusion global feature vector; in this way, the plurality of target feature maps are subjected to spatial compression first and temporal compression later, so that the facial contour and texture of the target object in the single-frame video image can be described more meticulously, that is, the facial features of the target object can be better portrayed. At the same time, through the pre-temporal and spatial feature fusion module in the model, the feature extraction processing of the time dimension is first performed based on multiple target feature maps, and then the feature extraction processing of the space dimension is performed based on the time feature extraction results to obtain the pre-fusion global feature vector; in this way, the pre-temporal compression and the post-spatial compression processing of multiple target feature maps can better describe the state changes of each position in the multi-frame video images in the target video, that is, better describe the position changes of the target object's face in the target video. Finally, the post-fusion global feature vector and the pre-fusion global feature vector are combined to verify whether the target object in the target video is a living object, and the static and dynamic features of the target object's face are comprehensively considered, thereby ensuring the accuracy of the verification results determined accordingly. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 A schematic diagram of an application scenario of the image recognition method provided in an embodiment of the present application;

[0026] Figure 2 A schematic diagram of the process of an image recognition method provided in an embodiment of the present application;

[0027] Figure 3 A schematic diagram of the working principle of the facial liveness detection model provided in the embodiment of the present application;

[0028] Figure 4 A schematic diagram of the working principle of the shallow feature extraction module provided in the embodiment of the present application;

[0029] Figure 5 A schematic diagram of the working principle of the motion supplement structure provided in an embodiment of the present application;

[0030] Figure 6 A schematic diagram of the working principle of the post-spatial-temporal feature fusion module provided in an embodiment of the present application;

[0031] Figure 7 A schematic diagram of the working principle of the pre-temporal and spatial feature fusion module provided in the embodiment of the present application;

[0032] Figure 8 A schematic diagram of the working principle of the residual structure provided in the embodiment of the present application;

[0033] Fig. 9 A schematic diagram of the implementation architecture of the image recognition method provided in the embodiment of the present application;

[0034] Fig.10 A schematic diagram of the structure of an image recognition device provided in an embodiment of the present application;

[0035] Fig.11 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application;

[0036] Fig.12 A schematic diagram of the structure of a server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0037] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0038] The terms "first", "second", "third", "fourth", etc. (if any) 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 sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or 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 comprising 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] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.

[0040] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. Basic artificial intelligence technologies generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operating / interactive systems, mechatronics and other technologies. Artificial intelligence software technologies mainly include computer vision technology, speech processing technology, natural language processing technology, as well as machine learning / deep learning, autonomous driving, smart transportation and other major directions.

[0041] Computer vision technology (CV) is a science that studies how to make machines "see". To put it more specifically, it refers to using cameras and computers to replace human eyes to identify, track and measure targets, and further perform image processing to make computer processing into images that are more suitable for human eye observation or transmission to instruments for detection. As a scientific discipline, computer vision studies related theories and technologies, and attempts to establish an artificial intelligence system that can obtain information from images or multi-dimensional data. Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous positioning and map construction, automatic driving, smart transportation and other technologies.

[0042] The solution provided in the embodiments of the present application involves artificial intelligence computer vision technology, which is specifically described by the following embodiments:

[0043] In order to more accurately detect whether a face in a video including a face is a live face, an embodiment of the present application provides an image recognition method, which innovatively proposes a facial liveness detection model based on a forward and backward space-time fusion dual-tower structure, so that the model can be used to detect whether the person in the video including the face of the person is a real person, rather than a person in a synthesized video or a person wearing a fake mask.

[0044] Specifically, in the image recognition method provided in the embodiment of the present application, a target video (including the face of the target object to be verified) is first obtained, and the target video is framed to obtain multiple frames of video images arranged in sequence in the target video. Then, the multiple frames of video images are input into the face liveness detection model provided in the embodiment of the present application to detect whether the target object in the target video is a live object through the model. When the model works specifically, it first performs feature extraction processing on multiple frames of video images through a shallow feature extraction module to obtain multiple target feature maps arranged in order corresponding to the multiple frames of video images; then, through a post-spatial-temporal feature fusion module, feature extraction processing in the spatial dimension is performed on the multiple target feature maps respectively to obtain feature vectors corresponding to each of the multiple target feature maps, and based on the feature vectors corresponding to each of the multiple target feature maps, feature extraction processing in the time dimension is performed to obtain a post-fusion global feature vector; at the same time, through a pre-spatial-temporal feature fusion module, feature extraction processing in the time dimension is performed based on multiple target feature maps to obtain a time compression feature map, and feature extraction processing in the spatial dimension is performed on the time compression feature map to obtain a pre-fusion global feature vector; finally, according to the post-fusion global feature vector and the pre-fusion global feature vector, the facial liveness detection result corresponding to the target object is determined.

[0045] The above-mentioned image recognition method uses a facial liveness detection model to detect whether the target object in the target video is a live object. Through the post-spatial-temporal feature fusion module in the model, multiple target feature maps are first spatially compressed and then temporally compressed, so as to more carefully describe the facial contour and texture of the target object in a single-frame video image, and better characterize the facial features of the target object. In addition, through the pre-spatial-temporal feature fusion module in the model, multiple target feature maps are first temporally compressed and then spatially compressed, which can better describe the state change of each position in the multi-frame video images in the target video, that is, better describe the position change information of the target object's face in the target video. Finally, the post-fusion global feature vector and the pre-fusion global feature vector are combined to verify whether the target object in the target video is a live object, and the static and dynamic features of the target object's face are comprehensively considered, thereby ensuring the accuracy of the verification result determined accordingly.

[0046] It should be understood that the image recognition method provided in the embodiment of the present application can be performed by a computer device with image processing capabilities, which can be a terminal device or a server. Among them, the terminal device can be a computer, a smart phone, a tablet computer, a personal digital assistant (PDA), etc.; the server can be an application server or a Web server. In actual deployment, it can be an independent server, or a cluster server or cloud server composed of multiple physical servers. The data involved in the embodiment of the present application can be stored on the blockchain.

[0047] To facilitate understanding of the image recognition method provided in the embodiment of the present application, the following uses the execution subject of the image recognition method as a server as an example to exemplarily introduce the application scenario of the image recognition method.

[0048] See also Figure 1 , Figure 1 Schematic diagram of application scenarios of the image recognition method provided in the embodiment of the present application. Figure 1 As shown, the application scenario includes a terminal device 110, a server 120 and a server 130. The terminal device 110 and the server 120 can communicate through a network, and the server 120 and the server 130 can also communicate through a network. Among them, the terminal device 110 is used to collect videos including faces when performing face verification operations; a general face verification system runs on the server 120, which is used to detect whether the face in the video collected by the terminal device 110 is a specific face, and to perform preliminary liveness detection on the face; the server 130 is used to execute the image recognition method provided in the embodiment of the present application, and the facial liveness detection model provided in the embodiment of the present application runs on it.

[0049] In actual applications, when a user needs to use a function provided by the terminal device 110 that requires facial verification (such as facial recognition payment function, facial recognition account login function, etc.), the terminal device 110 can capture a video including the user's face and transmit the captured video to the server 120 in real time through the network.

[0050] After receiving the video transmitted by the terminal device 110, the server 120 can verify the received video through the face verification system 121 running thereon. On the one hand, the server 120 needs to verify whether the face in the video is a specific face through the face verification system 121; for example, assuming that the user is currently using the face recognition payment function provided by the terminal device 110, the server 120 can determine the legitimate user under the account that triggers the payment operation, and obtain the standard facial image corresponding to the legitimate user, and then verify whether the features of the face in the received video match the features of the face in the standard facial image. On the other hand, the server 120 also needs to verify whether the face in the video is a live face through the face verification system 121, that is, verify whether the face in the video captured by the terminal device 110 is the face of a real person, so as to avoid the situation of using a synthetic video including a face or wearing a fake mask to pass the test.

[0051] As an example, when the above-mentioned face verification system 121 verifies whether the face in the video is a live face, a face liveness detection method based on human-computer interaction can be adopted; that is, the server 120 can control the terminal device 110 to guide its current user to make specified actions (such as blinking, shaking head, opening mouth, etc.), or guide its current user to read out specified text (such as specifying numbers, etc.), and then, the face verification system 121 can detect whether the person in the video has made a specified action or read out the specified text based on the video captured by the terminal device 110, and then, determine whether the face in the video is a live face according to the detection result. As another example, when the above-mentioned face verification system 121 verifies whether the face in the video is a live face, a face liveness detection method based on flash skin reflection characteristics can also be adopted; that is, the server 120 can control the terminal device 110 to flash different colors of light through the screen during the video collection process, and then, the face verification system 121 can detect the texture changes of the face in the video based on the video collected by the terminal device 110, and then determine whether the face in the video is a live face according to the detection result.

[0052] It should be understood that in actual applications, the face verification system 121 running on the server 120 can also use other methods to perform live face detection on the face in the video, and this application does not make any limitation here. However, the face detection system 121 deployed on the server 120 has the following defects, that is, since the user of the terminal device 110 can directly interact with the face detection system running on the server 120, it provides an opportunity for criminals to conduct confrontation tests on the face detection system 121, that is, criminals can use software to synthesize a large number of videos including faces, and then use the synthesized videos to continuously conduct confrontation tests on the face verification system 121 to find a synthetic video and video synthesis method that can bypass the face verification system 121, which will cause security vulnerabilities in the face verification system 121.

[0053] In order to avoid the above situation, the embodiment of the present application further deploys a server 130 at the back end of the server 120. The server 130 can perform a secondary face liveness detection on the video verified by the server 120 by executing the image recognition method provided by the embodiment of the present application, thereby further improving the security of face verification and improving the face verification mechanism.

[0054] Specifically, the server 130 may regard the video verified by the server 120 as the target video, where the video verified by the server 120 refers to a video in which the face verification system on the server 120 has detected and confirmed that the face is a specific face and the face is a live face; in addition, the server 130 may regard the person included in the target video as the target object to be verified. Before the server 130 detects whether the face of the target object in the target video is a live face, it is necessary to perform frame processing on the target video to obtain multiple frames of video images arranged in sequence in the target video.

[0055] Furthermore, the server 130 can input the multiple frames of video images obtained by the frame processing into the pre-trained facial liveness detection model 131, so as to detect whether the face of the target object in the target video is the face of a live object through the facial liveness detection model 131. When the facial liveness detection model 131 is working specifically, the shallow feature extraction module 1311 can first perform feature extraction processing on the input multiple frames of video images to obtain multiple target feature maps arranged in order corresponding to the multiple frames of video images. Then, the post-spatial feature fusion module 1312 can perform feature extraction processing on the multiple target feature maps in the spatial dimension to obtain the feature vectors corresponding to the multiple target feature maps; then, based on the feature vectors corresponding to the multiple target feature maps, feature extraction processing is performed in the time dimension to obtain the post-fusion global feature vector. Moreover, the pre-spatial feature fusion module 1313 can perform feature extraction processing on the time dimension based on the multiple target feature maps to obtain the time compression feature map; and the time compression feature map can be subjected to feature extraction processing in the spatial dimension to obtain the pre-fusion global feature vector. Finally, the model can determine the facial liveness detection result corresponding to the target object based on the above-mentioned post-fusion global feature vector and pre-fusion global feature vector, that is, determine whether the face of the target object is a live face.

[0056] It should be understood that Figure 1 The application scenarios shown are only examples. In actual applications, the image recognition method provided by the embodiment of the present application can also be applied to other scenarios; for example, the face liveness detection model 131 provided by the embodiment of the present application can be directly deployed in the server 120, and the face liveness detection model 131 can be used to perform the face liveness detection task in the face verification system. The application scenarios of the image recognition method provided by the embodiment of the present application are not limited here.

[0057] The image recognition method provided by the present application is described in detail below through a method embodiment.

[0058] See also Figure 2 , Figure 2 The following is a flow chart of the image recognition method provided in the embodiment of the present application. For the convenience of description, the following embodiment is still introduced by taking the execution subject of the image recognition method as a server as an example. Figure 2 As shown, the image recognition method includes the following steps:

[0059] Step 201: Acquire a target video, wherein the target video includes the face of a target object to be verified; perform frame processing on the target video to obtain multiple frames of video images arranged in sequence in the target video (the multiple frames of video images here include at least two frames of video images).

[0060] Before executing the face liveness detection task, the server first obtains the target video based on which the face liveness detection task is executed, and the target video includes the face of the target object to be verified. Then, the target video is framed to obtain multiple frames of video images arranged in time order (such as time from front to back) in the target video.

[0061] It should be noted that the target video is the video based on which the face liveness detection task is performed, and the embodiment of the present application is intended to detect whether the face of the target object in the target video is a live face; the so-called live face (also called live face) refers to the real face of a real person, that is, in the process of collecting the target video, the face of the person facing the camera is the face of the real person himself, rather than the face of the person in the synthetic video or the face wearing a fake mask, etc. The target video can be, for example, the video collected by the terminal device when the user uses a function that requires face verification (hereinafter referred to as face verification function, such as face recognition payment function, face recognition account login function, etc.) through the terminal device.

[0062] As an example, the server can directly obtain the video captured by the terminal device when the user uses the face verification function as the target video. Specifically, when the terminal device detects that the user triggers the use of a certain face verification function, it can start its camera to capture the video and transmit the captured video to the server in real time; after receiving the video, the server can accordingly use it as the target video to be detected.

[0063] As another example, the server can obtain a video that has been preliminarily verified by a general face verification system as a target video. Specifically, the terminal device can first transmit the video it collects when the user uses the face verification function to the general face verification system, and the face verification system verifies whether the face in the video is a specific face; for example, when the face verification function used by the user is the face recognition payment function, it can be verified whether the face in the video is a legitimate user face under the account that triggers the payment operation; and the face verification system verifies preliminarily whether the face in the video is a live face; when the face verification system verifies that the face in the video is a specific face and a live face, the server can use the video as the target video and perform secondary live face verification based on the target video.

[0064] It should be understood that in actual applications, the server may also use other methods to obtain the target video, and this application does not impose any limitation on the method for obtaining the target video.

[0065] After the server obtains the target video, it needs to perform frame processing on the target video to convert the video stream data into video frame sequence data; illustratively, the server can use the frame splitting tool provided by the video processing software (such as OpenCV) to perform frame processing on the target video to obtain the video images of each frame arranged in chronological order in the target video. In the face verification scenario, the length of the collected video is usually within 8 seconds, about 5 seconds on average, and the video consists of 10 to 15 frames of video images per second; in order to facilitate the processing of the subsequent model, the server can truncate the video frame sequence data obtained after the frame splitting process to retain the video frame sequence data of a fixed length (such as video frame sequence data including 60 frames of video images); that is, after the server performs frame splitting process on the target video and obtains the video images of each frame arranged in chronological order in the target video, the server can truncate the video image sequence to retain only the video images of a specific number of frames. When the server specifically truncates and processes a video image sequence, it can directly retain the video images of a specific frame number that are ranked at the top in the video image sequence and delete the remaining video images in the video image sequence; or, it can select video images of a specific frame number with a higher reference value from the video image sequence and delete the remaining video images in the video image sequence. The present application does not impose any limitation on the processing method of truncating the video image sequence by the server.

[0066] In addition, the sizes of video images recorded by different video recording devices are not the same. In order to facilitate the processing of subsequent models, the server can interpolate and map the video to be processed to a specific size, that is, interpolate and map the video image to be processed to a specific aspect ratio; for example, the server can use the screen size adjustment tool provided by the video processing software (such as OpenCV) to interpolate and map each frame of the video image so that the aspect ratio of the video image reaches a specific aspect ratio. At the same time, in order to ensure that the face shape in the video image is not deformed, the server can process the video image by first filling and then restoring the size (resize) processing method.

[0067] Step 202: performing feature extraction processing on the multiple frames of video images to obtain a plurality of target feature maps arranged in sequence corresponding to the multiple frames of video images (the plurality of target feature maps herein include at least two target feature maps).

[0068] After the server completes the frame processing of the target video and obtains the multiple frames of video images arranged in sequence in the target video, it can use the pre-trained facial liveness detection model to process the multiple frames of video images, thereby obtaining the facial liveness detection results corresponding to the target object in the target video. That is, the server can input the multiple frames of video images arranged in sequence obtained by the frame processing into the facial liveness detection model, and the facial liveness detection model will output the facial liveness detection results corresponding to the target object in the target video accordingly by analyzing and processing the multiple frames of video images.

[0069] It should be noted that the facial liveness detection model in the embodiment of the present application is a model used to detect whether the face of the target object in the video image is a live face based on the input of multiple frames of video images arranged in sequence; the facial liveness detection model can be pre-trained in the embodiment of the present application.

[0070] Before training the facial liveness detection model, negative training samples (i.e., videos including non-live faces) can be accumulated through template matching, clustering, manual labeling, external network feedback, etc. In general, for videos including non-live faces, the facial texture, facial lighting, naturalness and other features of the face are different from those of live faces, and the specific actions made by the characters (such as blinking, opening the mouth, shaking the head, etc.) are also more rigid than the specific actions made by real people. Furthermore, since some black market users will batch synthesize videos including non-live faces, many videos including non-live faces have basically similar video backgrounds or character actions; in view of the above characteristics of videos including non-live faces, negative training samples can be screened and accumulated based on these characteristics. In addition, some videos including live faces can be randomly selected from real business data as positive training samples; then, the above negative training samples and positive training samples are used to construct a binary classification sample set for training the facial liveness detection model. When training the facial liveness detection model, the facial liveness detection model to be trained can be repeatedly iteratively trained based on the positive training samples and negative training samples in the above two-category sample set until the facial liveness detection model converges.

[0071] It should be noted that the facial liveness detection model provided in the embodiment of the present application mainly includes a shallow feature extraction module, a post-spatial feature fusion module and a pre-spatial feature fusion module. Steps 202, 203 and 204 in the embodiment of the present application are used to introduce the processing of the shallow feature extraction module, the post-spatial feature fusion module and the pre-spatial feature fusion module, respectively. Figure 3 The figure is a schematic diagram of the working principle of the face liveness detection model provided by the embodiment of the present application. The processing process of the shallow feature extraction module in the face liveness detection model is first introduced below.

[0072] The shallow feature extraction module in the facial liveness detection model is used to perform feature extraction processing on multiple video frames input into the facial liveness detection model, so as to obtain multiple target feature maps arranged in order corresponding to the multiple video frames. That is, after the server inputs the multiple video frames arranged in order obtained by the frame processing of the target video into the facial liveness detection model, the shallow feature extraction module in the facial liveness detection model will perform feature extraction processing on the multiple video frames, and obtain multiple target feature maps corresponding to the multiple video frames, so as to provide the subsequent post-spatial-temporal feature fusion module and the pre-spatial-temporal feature fusion module with further processing based on the multiple target feature maps.

[0073] In a possible implementation, when the shallow feature extraction module is working, it can first perform feature extraction processing on multiple frames of video images through a two-dimensional convolutional structure (2D Convolutional Neural Network, 2D CNN) to obtain the primary feature maps corresponding to each of the multiple frames of video images; then, for each frame of video image, determine the motion feature corresponding to the video image according to the primary feature map corresponding to the video image and the primary feature map corresponding to the video image adjacent to the video image; determine the secondary feature map corresponding to the video image according to the primary feature map and the motion feature corresponding to the video image; and further, determine multiple target feature maps according to the secondary feature maps corresponding to the multiple frames of video images.

[0074] It should be noted that the first-level feature map corresponding to the video image is a multi-channel feature map obtained by performing feature extraction processing on the video image itself through 2DCNN, which carries the original feature information of the video image itself. The motion feature corresponding to the video image is determined based on the difference between the first-level feature map corresponding to the video image itself and the first-level feature map corresponding to the video image adjacent to it in the arrangement order. Since the motion feature is determined based on the difference between the first-level feature maps corresponding to the adjacent frames of video images, the motion feature can reflect the spatial change information of each position in the video image to a certain extent, that is, reflect the motion information. The second-level feature map corresponding to the video image is a multi-channel feature map obtained by fusing the first-level feature map corresponding to the video image and the motion feature, which carries both the original feature information of the video image itself and the motion information of the video image.

[0075] Figure 4 The following is a schematic diagram of the working principle of an exemplary shallow feature extraction module provided in the embodiment of the present application. Figure 4As shown, when the shallow feature extraction module is working specifically, it can first perform feature conversion and channel expansion processing on the input multiple frames of video images arranged in sequence through at least one layer of 2D CNN (for example, it can be two layers of 2DCNN), and obtain the multi-channel feature maps (i.e., the first-level feature maps) corresponding to each of the multiple frames of video images. Since the input multiple frames of video images are arranged in sequence, the multi-channel feature maps obtained by 2DCNN processing should also be arranged in the corresponding order, that is, the multiple first-level feature maps obtained by 2DCNN processing can constitute a first-level feature map sequence, and the arrangement order of each first-level feature map in the first-level feature map sequence is the same as the arrangement order of the video images corresponding to each first-level feature map. In this way, by performing feature extraction processing on each frame of video images through 2D CNN, and then performing subsequent motion supplement processing based on the first-level feature map obtained through the feature extraction processing, it can avoid the situation where the output value range is unstable after the difference is made directly on the original video image information.

[0076] like Figure 4 As shown, after obtaining the first-level feature maps corresponding to each of the multiple frames of video images through the feature extraction process of 2D CNN, the motion feature can be further supplemented on the basis of the first-level feature maps corresponding to each of the frames of video images through the motion supplement structure to generate a second-level feature map carrying the motion feature. Specifically, for each frame of video image, the motion supplement structure can determine the motion features of the video image relative to the adjacent video images according to the first-level feature map corresponding to the video image and the first-level feature map corresponding to the video image adjacent to the video image, that is, determine the motion features corresponding to the video image. Furthermore, the motion supplement structure can fuse the first-level feature map and the motion feature corresponding to the video image to obtain the second-level feature map corresponding to the video image; for example, the motion supplement structure can add the elements at the same position in the first-level feature map and the motion feature to obtain the corresponding second-level feature map; the second-level feature map generated in this way can reflect both the information carried by the video image itself and the motion information of the video image relative to the adjacent video images.

[0077] As an example, the above-mentioned motion supplement structure can specifically determine the motion features corresponding to the video image in the following manner: determine a video image arranged in front of the video image and adjacent to the video image as an adjacent video image of the video image; then, based on the channel gating mechanism, subtract each element in the first-level feature map corresponding to the video image from each element in the first-level feature map corresponding to its adjacent video image to obtain a motion feature weight; and then, based on the motion feature weight, perform weighted processing on each element in the first-level feature map corresponding to the video image to obtain the motion features corresponding to the video image.

[0078] Figure 5The following is a schematic diagram of the working principle of an exemplary motion supplement structure provided in the embodiment of the present application. Figure 5 As shown, for the n-1th (n is an integer greater than 1) frame video image Xn-1, the nth frame video image Xn and the n+1th frame video image Xn+1, feature extraction processing can be performed on them through 2D CNN to obtain the first-level feature corresponding to the n-1th frame video image Xn-1 Figure X n-1', the first-level feature corresponding to the n-th frame video image Xn Figure X n', and the first-level features corresponding to the n+1th frame of video image Xn+1 Figure X For the n-th frame video image Xn, the n-1-th frame video image Xn-1 can be determined as its adjacent video image, and for the n+1-th frame video image Xn+1, the n-th frame video image X can be determined as its adjacent video image; the motion supplement structure is for the first-level feature corresponding to the n-th frame video image Xn Figure X When n' is used for motion supplementation processing, the channel gating mechanism can be used to Figure X n-1' and first-level features Figure X The elements in the same position in n' are subtracted, and the subtraction results are processed in turn using the maximum pooling structure Max_Pooling and the fully connected structure FC+Sigmoid to obtain the first-level features Figure X n' corresponds to the motion feature weight; then, the motion feature weight can be used to Figure X Each element in n' is weighted accordingly to obtain the motion feature corresponding to the n-th frame video image Xn; furthermore, the motion feature corresponding to the n-th frame video image Xn and the primary feature corresponding to the n-th frame video image Xn can be combined. Figure X n' is added, that is, the motion feature and the first-level feature Figure X The elements in the same position in n' are added to obtain the secondary features corresponding to the video image Xn Figure X Similarly, for the n+1th frame video image Xn+1, a similar method can also be used to obtain its corresponding secondary features. Figure X n+1”.

[0079] It should be noted that when the sampling method is used to determine the secondary feature map corresponding to each frame of video image, for the first frame of video image in the video image sequence, since there is no video image adjacent to it (that is, there is no video image arranged before it), it is impossible to use the above method to determine the secondary feature map corresponding to the first frame of video image. In this case, the primary feature map corresponding to the first frame of video image can be directly used as the secondary feature map; or, it is also possible to abandon the determination of the secondary feature map corresponding to the first frame of video image, even if the number of secondary feature maps generated in the end is one less than the number of video images input.

[0080] The motion supplement structure incorporates motion features into the feature map corresponding to the video image in the above-mentioned manner, which is equivalent to simulating the optical flow in the target video, so that the secondary feature map corresponding to each generated video image can correspondingly express the information of the video image itself and the motion information between it and the adjacent video images, so that the information carried in the generated secondary feature map is richer.

[0081] In a possible implementation, the shallow feature extraction module performs the above processing on the input multiple video frames, and after obtaining the secondary feature maps corresponding to each of the multiple video frames, the short-time spatiotemporal feature fusion processing can be further performed on the secondary feature maps corresponding to each of the multiple video frames through a three-dimensional convolution structure (3D Convolutional Neural Network, 3D CNN). That is, for each video frame, according to the arrangement position of the video frame and the preset window range, a reference video image related to the video image can be determined in the multiple video frames; then, for each video frame, the short-time spatiotemporal feature fusion is performed based on the secondary feature map corresponding to the video image and the secondary feature maps corresponding to each reference video image related to the video image through 3D CNN to obtain the tertiary feature map corresponding to the video image; and then, according to the tertiary feature maps corresponding to each of the multiple video frames, multiple target feature maps are determined.

[0082] It should be noted that the third-level feature map corresponding to the video image is a multi-channel feature map obtained by performing short-time spatiotemporal feature fusion processing on the second-level feature maps corresponding to multiple adjacent frames of video images, that is, the features at the same position in multiple adjacent frames of video images are fused together, so that the features at each position in the three-level feature map are integrated with both the feature information of the video image itself and the feature information of the multiple adjacent frames of video images.

[0083] like Figure 4As shown, after the shallow feature extraction module obtains the secondary feature map corresponding to each frame of video image through the motion supplement structure, the short-time spatiotemporal feature fusion processing can be performed on each secondary feature map fused with motion information through 3D CNN. In specific implementation, for each frame of video image, 3D CNN can perform short-time spatiotemporal feature fusion processing on the secondary feature map corresponding to the frame of video image and the secondary feature map corresponding to each reference video image related to the frame of video image, so as to obtain the third-level feature map corresponding to the frame of video image. The so-called short-time spatiotemporal feature fusion processing refers to fusing the features at the same position in the secondary feature map corresponding to the video image and the secondary feature map corresponding to each reference video image. Here, each reference video image related to the video image is a video image located within a preset window range based on the arrangement position of the video image in the video image sequence; for example, assuming that the preset window range is a frame adjacent to the front and back, then for the second frame of video image in the video image sequence, the first frame of video image and the third frame of video image in the video image sequence are reference video images related to the second frame of video image.

[0084] In order to further improve the feature extraction effect, multi-layer 3DCNN can be deployed in the shallow feature extraction module to increase the nonlinear capability and expand the receptive field, so as to further abstract the underlying features and better extract important features in the video image.

[0085] In addition, for input video images of larger size, a maximum pooling layer can be further deployed on the basis of 3D CNN to perform maximum pooling processing on the processing results of 3D CNN, so as to compress the feature map, reduce the redundant information therein, and reduce the amount of calculation and the use of video memory, saving computing resources. For example, for a secondary feature map of 60*320*200, two layers of 3D CNN (the two layers are 24 convolution kernels of size 2*3*3 and 2*3*3, respectively) can be used to simultaneously mine the connection and changes between adjacent video images from the two dimensions of time and space; then, through the maximum pooling layer with a window and a step size of 1*2*2, the size of the feature map obtained by 3D CNN processing can be reduced to 60*160*100.

[0086] In this way, the above-mentioned 3D CNN is used to perform short-term spatiotemporal feature fusion processing on the secondary feature maps corresponding to each frame of video image, so as to obtain the third-level feature maps corresponding to each frame of video image. The obtained third-level feature maps can carry the temporal and spatial dependency relationship between adjacent video images, so that the information carried in the generated third-level feature maps is richer.

[0087] In a possible implementation, the shallow feature extraction module performs the above processing on the input multiple frames of video images, and after obtaining the three-level feature maps corresponding to each of the multiple frames of video images, the three-level feature maps corresponding to each of the multiple frames of video images can be further processed by a recurrent neural network structure (RNN) to perform long-term spatiotemporal feature fusion processing on the three-level feature maps corresponding to each of the multiple frames of video images. Specifically, when the video image is the first frame of video image, multiple feature extraction processes are performed based on the three-level feature maps corresponding to the video image through its corresponding recurrent neural network structure to obtain the target feature map corresponding to the video image; spatial accumulation information and time accumulation information corresponding to the video image are generated during the multiple feature extraction processes. When the video image is not the first frame of video image, a video image located in front of the video image and adjacent to the video image is determined as an adjacent video image; and multiple feature extraction processes are performed based on the three-level feature maps corresponding to the video image, and the spatial accumulation information, time accumulation information and target feature maps corresponding to its adjacent video images through its corresponding recurrent neural network structure to obtain the target feature map corresponding to the video image.

[0088] It should be noted that the target feature map corresponding to the video image is obtained by performing long-term spatiotemporal feature fusion processing on the three-level feature map corresponding to the video image and the three-level feature maps corresponding to each frame of video image before the video image. It can reflect the static features of the face of the object in the video image, behavioral actions, and background picture changes in the target video.

[0089] For example, Figure 4 As shown, STLSTM (Spatiotemporal Long short-term memory) can be used as the above-mentioned recurrent neural network structure. The STLSTM can further perform long-term spatiotemporal feature fusion processing on the three-level feature map sequence obtained by the short-term spatiotemporal feature fusion processing using a recurrent neural network including two gating mechanisms of time and space, and realize global time fusion and space fusion processing based on the three-level feature map sequence, while retaining the spatial position information in the original video image. The so-called long-term spatiotemporal feature fusion processing refers to the feature fusion processing of the time dimension and the space dimension on the three-level feature maps corresponding to each frame of the input video image.

[0090] In specific operation, for the three-level feature map corresponding to the first frame of video image, the STLSTM corresponding to the first frame of video image can perform multiple feature extraction processes on the three-level feature map, and continuously accumulate the spatial information and time information in the video image during the multiple feature extraction processes; the STLSTM corresponding to the first frame of video image will eventually obtain the target feature map corresponding to the first frame of video image, and the spatial accumulation information and time accumulation information accumulated during the multiple feature extraction processes by performing multiple feature extraction processes on the three-level feature map corresponding to the first frame of video image. For the STLSTM corresponding to the second frame of video image, the three-level feature map corresponding to the second frame of video image, the target feature map corresponding to the first frame of video image, and the spatial accumulation information and time accumulation information accumulated by the STLSTM corresponding to the first frame of video image during the multiple feature extraction processes can be input therein, and the STLSTM corresponding to the second frame of video image will obtain the target feature map corresponding to the second frame of video image by performing multiple feature extraction processes on the input information, and the STLSTM corresponding to the second frame of video image will also accumulate spatial accumulation information and time accumulation information during the multiple feature extraction processes. By analogy, for each subsequent frame of video image, multiple feature extraction processes are performed through its corresponding STLSTM in the above manner, so as to obtain the target feature map corresponding to each frame of video image. It should be noted that the spatiotemporal fusion operation performed by the above STLSTM will not change the size of the input feature map, that is, after each feature extraction process is completed, a feature map of the same size will be output.

[0091] It should be understood that in practical applications, in addition to using STLSTM as the recurrent neural network structure in the shallow feature extraction module, ConvLSTM (Convolutional Long short-term memory) can also be selected as the recurrent neural network. However, experimental studies have found that STLSTM can achieve better results than ConvLSTM, that is, compared with the single storage unit of ConvLSTM, the dual storage unit combining time and space in STLSTM can better integrate spatiotemporal information. Of course, in practical applications, other structures can also be used as the recurrent neural network structure in the shallow feature extraction module, and this application does not make any restrictions here.

[0092] The facial liveness detection module converts the input original video image sequence data into a target feature map sequence containing local facial features, action state features, time and space dependencies and other features through the above-mentioned shallow feature extraction module. The target feature map sequence can accurately reflect the static features, behavioral actions, and background picture changes of the target object in the target video. These features are of great reference value for detecting whether the target object face in the target video is a live face.

[0093] Step 203: Perform feature extraction processing in the spatial dimension on the multiple target feature maps respectively to obtain feature vectors corresponding to each of the multiple target feature maps; perform feature extraction processing in the temporal dimension based on the feature vectors corresponding to each of the multiple target feature maps to obtain a post-fusion global feature vector.

[0094] The facial liveness detection model completes the feature extraction processing of the input video image sequence through the shallow feature extraction module therein, and after obtaining the corresponding target feature map sequence (i.e., multiple target feature maps arranged in chronological order), the multiple target feature maps in the target feature map sequence can be further processed by the post-spatial feature fusion module to first perform spatial compression and then temporal compression, thereby obtaining a post-fusion global feature vector. That is, the post-spatial feature fusion module can first perform spatial dimension feature extraction processing on multiple target feature maps in the target feature map sequence, respectively, to obtain the feature vectors corresponding to each of the multiple target feature maps; then, based on the feature vectors corresponding to each of the multiple target feature maps, feature extraction processing is performed in the temporal dimension to obtain a post-fusion global feature vector.

[0095] It should be noted that the post-spatial feature fusion module is a processing structure for first spatially compressing and then temporally compressing the target feature map sequence. Based on the fact that the shallow feature extraction module has extracted the spatiotemporal information of adjacent frames for each frame of the video image sequence, the post-spatial feature fusion module can more finely depict the facial features of the target object in the target video by first spatially compressing and then temporally compressing the target feature map sequence.

[0096] In a possible implementation, when the post-spatial-temporal feature fusion module is working, it can first perform feature extraction processing on the spatial dimension of each target feature map through 2DCNN and pooling structure to obtain the feature vector corresponding to each target feature map; then, a feature matrix is ​​constructed according to the feature vectors corresponding to each of the multiple target feature maps; then, the feature matrix is ​​subjected to feature extraction processing on the time dimension through multiple one-dimensional convolution structures to obtain multiple time-compressed feature vectors; the multiple one-dimensional convolution structures here correspond to different window widths; finally, the post-fusion global feature vector is determined according to the multiple time-compressed feature vectors.

[0097] Figure 6 The following is a schematic diagram of the working principle of an exemplary post-temporal and spatial feature fusion module provided in the embodiment of the present application. Figure 6As shown in the figure, when the post-spatial-temporal feature fusion module works specifically, for each target feature map in the target feature map sequence, the corresponding 2D CNN and pooling layer can first perform deeper feature extraction processing on the target feature map in the spatial dimension, so as to extract features such as the texture of the target object's face in the video image, the naturalness of lighting, and the naturalness of the face and background edges from the spatial dimension. In the spatial dimension, using 2D CNN and pooling layers to further abstract the features of the target feature map can make a more detailed state characterization of each frame of the video image, so as to better learn the various distinguishing feature information between living faces and non-living faces, and reduce the missed judgment caused by factors such as the stillness of the person, changes in image details, and changes in background. 2D CNN and pooling layers can compress spatial information, thereby converting the target feature map with multiple channels into a corresponding feature vector. Here, the 2D CNN and pooling layers corresponding to each target feature map can share parameters.

[0098] like Figure 6 As shown, after the post-spatial-temporal feature fusion module completes the feature extraction processing for each target feature map through its corresponding 2D CNN and pooling layer to obtain its corresponding feature vector, the post-spatial-temporal feature fusion module can use the feature vectors corresponding to each target feature map to construct a feature matrix. Specifically, the post-spatial-temporal feature fusion module can use the first row of the feature matrix to carry the feature vector corresponding to the first target feature map, use the second row of the feature matrix to carry the feature vector corresponding to the second target feature map, and so on.

[0099] like Figure 6 As shown in the figure, after the post-spatial feature fusion module constructs the feature matrix, it can perform feature extraction processing on the feature matrix in the time dimension through multiple one-dimensional convolution structures (1D Convolutional Neural Network, 1DCNN) corresponding to different window widths and multiple 1D CNNs' respective corresponding maximum pooling layers, thereby obtaining the time compression feature vectors corresponding to each 1D CNN. In addition to spatially characterizing the features of the video image through 2D CNN, the post-spatial feature fusion module can further characterize the facial state changes between frames through multiple 1D CNNs (also called multi-scale 1D CNNs) corresponding to different window widths. Multi-scale 1D CNN can effectively prevent misjudgment caused by jitter between multiple frames, and can also characterize the state features of regular false movements of facial parts such as eyes and mouth between multiple frames.

[0100] As an example, when the multi-scale 1D CNN performs feature extraction processing on the feature matrix in the time dimension, for each 1D CNN, based on the window width corresponding to the 1D CNN, each feature vector in the feature matrix can be combined to obtain a feature vector combination to be processed corresponding to the 1D CNN; then, each 1D CNN performs feature extraction processing on each feature vector combination to be processed corresponding to the 1D CNN, to obtain a time feature vector corresponding to each feature vector combination to be processed; and then, a maximum pooling processing is performed on the time feature vector corresponding to each feature vector combination to be processed, to obtain a time compression feature vector.

[0101] Exemplarily, it is assumed that the multi-scale 1D CNN in the post-spatial feature fusion module includes conv1, conv3, conv5, conv7 and conv9, and the corresponding window widths of conv1, conv3, conv5, conv7 and conv9 are 1, 3, 5, 7 and 9 respectively; the corresponding conv1 with a window width of 1 is used to perform convolution processing on each eigenvector in the feature matrix, the corresponding conv3 with a window width of 3 is used to perform convolution processing on every three eigenvectors in the feature matrix (that is, three adjacent eigenvectors in the feature matrix), the corresponding conv5 with a window width of 5 is used to perform convolution processing on every five eigenvectors in the feature matrix (that is, five adjacent eigenvectors in the feature matrix), the corresponding conv7 with a window width of 7 is used to perform convolution processing on every seven eigenvectors in the feature matrix (that is, seven adjacent eigenvectors in the feature matrix), and the corresponding conv9 with a window width of 9 is used to perform convolution processing on every nine eigenvectors in the feature matrix (that is, nine adjacent eigenvectors in the feature matrix).

[0102] Taking the processing process of conv3 as an example, conv3 performs feature extraction processing on the feature matrix in the time dimension by combining every three adjacent feature vectors in the feature matrix to obtain the corresponding vector combinations to be processed of conv3; for example, the feature vectors carried by the first row, the second row, and the third row in the feature matrix are respectively combined into a vector combination to be processed, and the feature vectors carried by the second row, the third row, and the fourth row in the feature matrix are respectively combined into a vector combination to be processed, and so on. When there are n feature vectors in the feature matrix, the post-spatial-temporal feature fusion module will combine in the above manner to obtain (n-2) vector combinations to be processed corresponding to conv3. Assume that conv3 includes K convolution kernels in cascade, wherein the i-th (i is an integer greater than 1 and less than or equal to K) convolution kernel is superimposed on the i-1th convolution kernel to process the output result of the i-1th convolution kernel; when conv3 performs feature extraction processing on each corresponding vector combination to be processed, the K convolution kernels can be used to perform feature extraction processing on the vector combination to be processed in turn. During the processing, each convolution kernel will output a corresponding time feature vector, so that the corresponding K time feature vectors will be obtained for a vector combination to be processed. The K time feature vectors corresponding to each of the (n-2) vector combinations to be processed are obtained, and the K time feature vectors corresponding to each of the (n-2) vector combinations to be processed can be combined, and the combined result can be subjected to maximum pooling processing through the maximum pooling layer corresponding to conv3 to obtain a time compression feature vector of a specific dimension, for example, a time compression feature vector including K values ​​is obtained. Similarly, for conv1, conv5, conv7 and conv9, the above method can also be used to obtain their respective corresponding time compression feature vectors.

[0103] In this way, by performing feature extraction processing in the time dimension using the multi-scale 1D CNN, time feature information within a variety of different window ranges can be extracted, that is, fusion processing of features in the time dimension within different window ranges is achieved, thereby ensuring that the obtained time compression feature vector carries rich information.

[0104] After determining the time compression feature vector corresponding to each 1D CNN through the above multi-scale 1D CNN, the time compression feature vectors corresponding to multiple 1D CNNs can be spliced ​​together to obtain a spliced ​​time compression feature vector, and then, the global feature vector is determined based on the spliced ​​time compression feature vector.

[0105] In one possible implementation, the post-spatial feature fusion module can determine the post-fusion global feature vector based on the splicing time compression feature vector in the following manner: determine the gating parameters according to the gating mechanism and the splicing time compression feature vector; process the splicing time compression feature vector through a fully connected layer to obtain a reference time compression feature vector; and then determine the post-fusion global feature vector according to the gating parameters, the splicing time compression feature vector, and the reference time compression feature vector.

[0106] Since the convolution operation performed by each 1D CNN in the multi-scale 1D CNN is performed separately, the spliced ​​time compression feature vector obtained by simply splicing the time compression feature vectors generated by each 1D CNN is difficult to specifically reflect the information with more reference value for identifying facial liveness. In order to make the information carried by the spliced ​​time compression feature vector more targeted to reflect the more valuable information for identifying facial liveness, the post-spatiotemporal feature fusion module further processes the spliced ​​time compression feature vector through the Highway network structure; the Highway network structure is specifically used to perform element-level gating filtering and global feature fusion on the spliced ​​time compression feature vector, which is essentially equivalent to further gating filtering and feature conversion on the output results of each convolution kernel in the multi-scale 1DCNN; since the convolution window width of each 1D CNN is a hyperparameter, the above processing performed through the above Highway structure can further adaptively fuse the multi-scale features and the feature elements of each dimension, so that the final post-fusion global feature vector is more robust.

[0107] The specific working principle of the Highway structure is as follows:

[0108]

[0109]

[0110] output=trans⊙gate+Input⊙(1-gate) (3)

[0111] in, and They all represent the time compression feature vector in the concatenated time compression feature vector; gate is the gating parameter determined based on the gating mechanism; trans is the reference time compression feature vector obtained after processing by the fully connected layer; output is the output result of the Highway structure.

[0112] For the output result of the Highway structure, the post-spatial temporal feature fusion module can further process it using a fully connected layer Dense Layer to obtain a post-fusion global feature vector.

[0113] Introduced above Figure 6 The post-spatial feature fusion module shown is a post-fusion structure that first compresses space and then compresses time for the target feature map sequence data. On the basis that the shallow feature extraction module has extracted the target feature map sequence carrying the spatiotemporal information of adjacent frames based on the video image sequence, the post-spatial feature fusion module further characterizes the spatial features of the face through a deep 2DCNN, and then uses 1D CNN for time compression to obtain the post-fusion spatial-temporal feature vector representation of the target video.

[0114] It should be understood that Figure 6 The working method of the post-spatial-temporal feature fusion module shown is only an example. In actual applications, other structures of post-spatial-temporal feature fusion modules can also be designed to complete the processing of spatial compression and then temporal compression of multiple target feature maps. This application does not make any limitation on the specific working principle of the post-spatial-temporal feature fusion module.

[0115] Step 204: Perform feature extraction processing in the time dimension based on the multiple target feature maps to obtain a time compression feature map; perform feature extraction processing in the space dimension on the time compression feature map to obtain a pre-fusion global feature vector.

[0116] The facial liveness detection model completes the feature extraction processing of the input video image sequence through the shallow feature extraction module therein, and after obtaining the corresponding target feature map sequence (i.e., multiple target feature maps arranged in chronological order), it can further perform time compression first and then space compression processing based on multiple target feature maps in the target feature map sequence through the pre-temporal and spatial feature fusion module, thereby obtaining a pre-fusion global feature vector. That is, the pre-temporal and spatial feature fusion module can first perform feature extraction processing in the time dimension based on multiple target feature maps in the target feature map sequence to obtain a time compression feature map; then, the time compression feature map is subjected to feature extraction processing in the spatial dimension to obtain a pre-fusion global feature vector.

[0117] It should be noted that the above-mentioned pre-temporal and spatiotemporal feature fusion module is a processing structure for first temporal compression and then spatial compression of the target feature map sequence. On the basis that the shallow feature extraction module has extracted the spatiotemporal information of adjacent frames for each frame of the video image sequence, the pre-temporal and spatiotemporal feature fusion module can better characterize the information of the change of the spatial position in the target video over time by first temporal compression and then spatial compression based on the target feature map sequence, and can effectively capture the non-living face behavior features with only local mutations (for example, the rest of the face does not move, only the eyes blink quickly).

[0118] In a possible implementation, the target feature map can be obtained by performing multiple feature extraction processes on the shallow feature maps corresponding to each video image through a recurrent neural network structure. At this time, the front spatiotemporal feature fusion module can perform time compression first and then space compression based on the target feature map sequence in the following way: for each frame of video image, obtain multiple middle-level feature maps corresponding to the video image, where the multiple middle-level feature maps are generated in the process of performing multiple feature extraction processes on the shallow feature maps corresponding to the video image, and these multiple middle-level feature maps correspond to different feature extraction levels respectively; then, based on the multiple intermediate feature maps corresponding to each of the multiple frames of video images and the multiple target feature maps, perform feature extraction processing in the time dimension to obtain a time compression feature map; then, through the 2D CNN and maximum pooling structure, perform feature extraction processing in the spatial dimension on the time compression feature map to obtain a front fusion global feature vector.

[0119] As described in step 202 above, the shallow feature extraction module in the facial liveness detection model can first perform feature extraction processing on each frame of video image through 2D CNN to obtain a first-level feature map corresponding to the frame of video image; then, through the motion complement structure, according to the first-level feature map corresponding to the video image and the first-level feature map corresponding to the video image adjacent to the video image, perform motion complement processing on the first-level feature map corresponding to the video image to obtain a second-level feature map corresponding to the video image; then, perform short-time spatiotemporal feature fusion processing on the second-level feature maps corresponding to multiple video images through 3D CNN to obtain a third-level feature map corresponding to the video image; then, perform feature extraction processing on the third-level feature map corresponding to the video image multiple times through a recurrent neural network structure to obtain a target feature map corresponding to the video image, and each time the recurrent neural network performs feature extraction processing, an intermediate feature map with the same size as the input third-level feature map is generated.

[0120] In the processing process of the above-mentioned shallow feature extraction module, the obtained three-level feature map corresponding to the video image can be regarded as the shallow feature map corresponding to the video image; in the process of performing multiple feature extraction processes on the three-level feature maps corresponding to the video image through the recurrent neural network structure, the feature map generated by each feature extraction process can be regarded as the intermediate feature map corresponding to the video image, and different intermediate feature maps correspond to different feature extraction levels. For example, the feature extraction level corresponding to the intermediate feature map obtained by the first feature extraction process is 1, and the feature extraction level corresponding to the intermediate feature map obtained by the second feature extraction process is 2, and so on.

[0121] Figure 7 The schematic diagram of the working principle of the exemplary pre-temporal and spatial feature fusion module provided in the embodiment of the present application. Figure 7 As shown, for each target feature map, the front spatiotemporal feature fusion module can correspondingly obtain the intermediate feature maps generated in the process of generating the target feature map from the recurrent neural network structure in the shallow feature extraction module; then, based on the obtained intermediate feature maps and target feature maps, feature extraction processing in the time dimension, that is, time compression processing, is performed to obtain a time compression feature map.

[0122] As an example, the front spatiotemporal feature fusion module can obtain the above-mentioned time compression feature map in the following way: for each feature extraction level, determine the intermediate feature maps corresponding to the feature extraction level in the multiple intermediate feature maps corresponding to the multiple frames of video images; for each feature extraction level, perform maximum pooling processing along the time dimension on the intermediate feature maps corresponding to the feature extraction level to obtain the time feature map corresponding to the feature extraction level; then, splice the time feature maps corresponding to various feature extraction levels and the last target feature map to obtain the spliced ​​feature map; and determine the time compression feature map based on the spliced ​​feature map.

[0123] Specifically, assuming that the recurrent neural network structure used to process the shallow feature maps corresponding to each frame of video image is STLSTM, the front spatiotemporal feature fusion module can obtain the final output state of the STLSTM, that is, the target feature map corresponding to the last frame of video image, that is, the last target feature map in the target feature map sequence. The reason is that the last target feature map integrates the spatiotemporal feature information of all video images, and it focuses more on representing the features of temporal dependent changes.

[0124] Since STLSTM outputs an intermediate feature map of the same size each time it performs feature extraction processing on the shallow feature map corresponding to the video image, based on this, the front spatiotemporal feature fusion module can perform maximum pooling processing along the time dimension on each intermediate feature map corresponding to the same feature extraction level to obtain the temporal feature map corresponding to the feature extraction level. For example, suppose STLSTM performs four feature extraction processing on the shallow feature maps corresponding to video image 1, video image 2, ..., video image n, respectively. In the process of performing four feature extraction processing on the shallow feature map corresponding to video image 1, the intermediate feature maps are obtained in sequence. Fig.11 , intermediate features Fig.12 , intermediate feature map 13, and the target feature map corresponding to video image 1. In the process of performing four feature extraction processes on the shallow feature map corresponding to video image 2, intermediate feature map 21, intermediate feature map 22, intermediate feature map 23, and the target feature map corresponding to video image 2 are obtained in sequence, ..., in the process of performing four feature extraction processes on the shallow feature map corresponding to video image n, intermediate feature map n1, intermediate feature map n2, intermediate feature map n3, and the target feature map corresponding to video image n are obtained in sequence; when the front spatiotemporal feature fusion module is working specifically, the intermediate feature map corresponding to the first feature extraction level can be used. Fig.11 , intermediate feature map 21, ..., intermediate feature map n1, perform maximum pooling along the time dimension to obtain the time feature corresponding to the first feature extraction level Figure 1 Similarly, by performing maximum pooling processing along the time dimension on each intermediate feature map corresponding to other feature extraction levels in the above manner, the time feature maps corresponding to each other feature extraction level can be obtained. In this way, the time feature maps corresponding to each feature extraction level can correspondingly represent the maximum change point features at the same spatial position.

[0125] Furthermore, the front spatiotemporal feature fusion module can splice the time feature graphs corresponding to each feature extraction level and the last target feature graph obtained to obtain a spliced ​​feature graph, and determine the time compression feature graph based on the spliced ​​feature graph. Since the spliced ​​feature graph is a video clip feature graph carrying multi-dimensional information, the time compression feature graph determined based on the spliced ​​feature graph can also reflect the multi-dimensional information carried by the spliced ​​feature graph.

[0126] Considering that the spliced ​​feature map obtained by simple splicing is difficult to highlight which features are more important, and there is a certain amount of information redundancy, in order to make the determined time compression feature map better reflect the more important information for facial liveness detection, the front spatiotemporal feature fusion module can further fuse the information of each channel in the spliced ​​feature map through the feature map recalibration structure, and recalibrate the weight of each channel according to the overall global information, so as to strengthen the more important information for facial liveness recognition in the spliced ​​feature map based on the recalibrated weight, while reducing redundant information.

[0127] Specifically, the front-spatial feature fusion module can adopt a residual structure as the above-mentioned feature map recalibration structure; that is, the front-spatial feature fusion module can first perform average pooling and full connection processing on the spliced ​​feature map to obtain a reference weight; then, based on the reference weight, perform weighted processing on each element in the spliced ​​feature map to obtain a reference feature map; then, each element in the reference feature map is added to each element in the spliced ​​feature map to obtain a time compression feature map.

[0128] Figure 8 is a schematic diagram of the working principle of the above residual structure. Figure 8 As shown, the pre-temporal and spatial feature fusion module can input the spliced ​​feature map of size H*W*C (H is the height of the spliced ​​feature map, W is the width of the spliced ​​feature map, and C is the number of channels included in the spliced ​​feature map) into the residual structure. The residual structure can obtain the reference weight by performing average pooling and full connection processing on the spliced ​​feature map in sequence. The reference weight can reflect the importance of the information carried by each channel in the spliced ​​feature map. Then, the residual structure can multiply the obtained reference weight with the elements carried by the corresponding channel in the spliced ​​feature map to obtain the reference feature map; using the reference weight to perform corresponding weighting processing on the elements carried by the corresponding channel in the spliced ​​feature map, it can effectively strengthen the information in the spliced ​​feature map that is more valuable for identifying facial liveness, while weakening the redundant information in the spliced ​​feature map. In order to avoid excessive loss of the original input information, the residual structure can fuse the reference feature map with the original spliced ​​feature map, that is, add each element in the reference feature map to each element in the spliced ​​feature map to obtain a time-compressed feature map. The time-compressed feature map can more prominently reflect the information that is of reference value for facial liveness recognition while reducing redundant information.

[0129] In this way, the spliced ​​feature map is further processed through the residual structure to obtain a time-compressed feature map, which is conducive to strengthening the information with reference value for facial liveness recognition and reducing redundant information. At the same time, the residual structure fuses the spliced ​​feature map of the original input with the reference feature map, which is also conducive to better training and optimizing network parameters.

[0130] After the pre-spatial feature fusion module obtains the time compression feature map through the above processing, it can further pass through several layers (such as 5 layers) of 2D CNN and pooling layers (maximum pooling layer or average pooling layer) to perform spatial position compression processing on the obtained time compression feature map to obtain the pre-fusion global feature vector. Through multiple layers of standard two-dimensional convolution operations and pooling operations, deeper feature extraction is performed on the time compression feature map that retains the spatial structure, and the multi-channel time compression feature map is further compressed into a high-level semantic vector of a fixed size, and the high-level semantic vector is used to represent the pre-fusion global feature vector.

[0131] Introduced above Figure 7 The front-time and space feature fusion module shown is a front-fusion structure that first compresses time and then compresses space for the target feature map sequence data. On the basis that the shallow feature extraction module has extracted the target feature map sequence carrying the temporal and spatial information of adjacent frames based on the video image sequence, the front-time and space feature fusion module first performs time compression and fusion processing on the target feature map sequence to better characterize the change information of the spatial position in the target video over time, which is more beneficial for capturing non-living facial behaviors with only local area mutations. Then, a deep 2D CNN is used to spatially characterize the overall situation of the static and dynamic features of the face to obtain the front-fusion space-time feature vector representation of the target video.

[0132] It should be understood that Figure 7 The working method of the front-space-time feature fusion module shown is only an example. In practical applications, front-space-time feature fusion modules with other structures can also be designed to complete the processing of first time compression and then space compression of multiple target feature maps. This application does not make any limitation on the specific working principle of the front-space-time feature fusion module.

[0133] It should be noted that, in actual applications, the facial liveness detection model can first run the post-spatial feature fusion module and then the pre-spatial feature fusion module, or can first run the pre-spatial feature fusion module and then the pre-spatial feature fusion module, or can also run the post-spatial feature fusion module and the pre-spatial feature fusion module at the same time. The present application does not impose any limitation on the operating order of the post-spatial feature fusion module and the pre-spatial feature fusion module, that is, the present application does not impose any limitation on the execution order of step 203 and step 204.

[0134] Step 205: Determine the face detection result corresponding to the target object according to the post-fusion global feature vector and the pre-fusion global feature vector.

[0135] The facial liveness detection model obtains the post-fusion global feature vector and the pre-fusion global feature vector through the post-fusion global feature vector and the pre-fusion global feature vector respectively, and then can further determine whether the target object face in the target video is a live face based on the post-fusion global feature vector and the pre-fusion global feature vector.

[0136] For example, Figure 3 As shown, the facial liveness detection model can concatenate and merge the post-fusion global feature vector and the pre-fusion global feature vector to obtain a facial semantic feature vector; then, through the fully connected layer Dense Layer, the facial semantic feature vector is subjected to nonlinear processing and dimensionality conversion processing; finally, a prediction score is output through the fully connected classification layer, and the prediction score can reflect whether the target object face in the target video is a live face. For example, when the prediction score is lower than a preset score threshold, it can be determined that the target object face is not a live face.

[0137] In practical applications, when training the above-mentioned facial liveness detection model, the binary cross entropy objective function based on Softmax can be optimized. Specifically, the Adam algorithm can be used to optimize the parameters of each layer structure in the model, and the learning rate can be set to 0.0001; at the same time, in order to avoid overfitting, L1 and L2 regularization and some dropout operations can be added to the weight parameters of the last fully connected layer.

[0138] The above-mentioned image recognition method uses a facial liveness detection model to detect whether the target object in the target video is a live object. Through the post-spatial-temporal feature fusion module in the model, multiple target feature maps are first spatially compressed and then temporally compressed, so as to more carefully describe the facial contour and texture of the target object in a single-frame video image, and better characterize the facial features of the target object. In addition, through the pre-spatial-temporal feature fusion module in the model, multiple target feature maps are first temporally compressed and then spatially compressed, which can better describe the state change of each position in the multi-frame video images in the target video, that is, better describe the position change information of the target object's face in the target video. Finally, the post-fusion global feature vector and the pre-fusion global feature vector are combined to verify whether the target object in the target video is a live object, and the static and dynamic features of the target object's face are comprehensively considered, thereby ensuring the accuracy of the verification result determined accordingly.

[0139] In order to facilitate further understanding of the image recognition method provided in the embodiment of the present application, the following takes the application of the image recognition method in the scenario of unblocking a frozen game account through face verification as an example. Fig. 9 The implementation architecture diagram shown provides an overall exemplary introduction to the image recognition method.

[0140] In actual applications, the game backend server can detect whether the player has committed illegal acts during the game based on the game security policy. If it is detected that the player has committed illegal acts during the game, the game backend server can temporarily freeze the player's game account. After the player's game account is frozen, the player needs to unblock the frozen game account through face verification. In the above situation, illegal users usually use software to synthesize a large number of fake human videos, and use the synthesized fake human videos to continuously test the universal face verification system on the game backend server to find a way to produce fake human videos that can bypass the universal face verification system, so as to achieve the purpose of batch unblocking frozen game accounts.

[0141] In order to prevent the above situation from occurring, the embodiment of the present application deploys further post-filtering processing for the videos that have passed the universal face verification system, that is, using a pre-trained facial liveness detection model, the videos that have passed the universal face verification system are again subjected to liveness face detection processing, thereby covering and detecting more fake human videos, and at the same time, providing leak-filling and bad example (BadCase) feedback to the universal face verification system.

[0142] Specifically, Fig. 9 As shown in FIG. 1 , for each video that passes the universal face verification system, the server can perform frame processing on the video to obtain a corresponding video image sequence. Then, the video image sequence is input into a pre-trained face liveness detection model, which is the face liveness detection model mentioned above. Figure 2 The model based on the front-back space-time fusion dual-tower structure introduced in the illustrated embodiment analyzes and processes the input video image sequence, and outputs the facial liveness detection result accordingly, which is used to reflect whether the face in the video is a live face. For videos that are recognized by the model as including faces that are not live faces (i.e., face videos that are judged as black by the model), the server can further send the video to relevant reviewers for manual review. If the result of the manual review is also that the face included in the video is not a live face, the game account that uploaded the video can be further operated to reduce the credit level, reduce credit points, and seal the account; and the video can also be used as a counter-example feedback for the general face detection system, so as to use the video to perform subsequent training optimization on the general face detection system. For videos whose manual review results are different from the detection results of the facial liveness detection model, the video can be used as a counter-example feedback for the facial liveness detection model, so as to use the video to perform subsequent training optimization on the facial liveness detection model. In this way, the universal face detection system and the facial liveness detection model are regularly optimized and trained to enhance the overall security and reliability of the universal face detection system and the facial liveness detection model.

[0143] The following introduces the specific implementation process of using the facial liveness detection model provided in the embodiment of the present application to detect the video (hereinafter referred to as the target video) that passes the general face verification system.

[0144] After the server obtains the target video that has passed the general face verification system, it can first use the frame splitting tool provided by OpenCV to perform frame splitting processing on the target video to convert the target video into a video image sequence. In the face verification scenario, the length of the captured video is usually less than 8 seconds, with an average of about 5 seconds, and the video consists of 10 to 15 frames of video images per second; in order to facilitate the processing of subsequent models, the server can truncate the video image sequence data obtained by the frame splitting processing to retain the video image sequence data of a fixed length (such as a video image sequence including 60 frames of video images). Furthermore, since the size of the video screen recorded by different video recording devices is not the same, the server can also use the screen size adjustment tool provided by OpenCV to perform interpolation mapping processing on each frame of the video image so that the aspect ratio of the video image reaches a specific aspect ratio. At the same time, in order to ensure that the face shape in the video image is not deformed, the server can process each frame of the video image by first filling it and then resizing it to the same size.

[0145] The server can input the video image sequence obtained through the above processing into the face liveness detection model provided in the embodiment of the present application. The structure of the face liveness detection model is as follows: Figure 3 As shown, it mainly includes a shallow feature extraction module, a post-spatial feature fusion module, a front-spatial feature fusion module and a classification module; wherein the shallow feature extraction module is used to convert the input video image sequence into a target feature map sequence, the post-spatial feature fusion module and the front-spatial feature fusion module are used to model fusion features such as face image state and behavior action, and the classification module is used to fuse the feature vectors output by the post-spatial feature fusion module and the front-spatial feature fusion module, and determine the face liveness detection result according to the fused features.

[0146] When the shallow feature extraction module is working, it can first perform feature conversion and channel expansion processing on each frame of the video image sequence through two layers of 2D CNN to obtain the first-level feature map corresponding to each frame of the video image, that is, to obtain a first-level feature map sequence, so as to avoid the instability of the data range output after the difference is directly made on the original image information. Then, the first-level feature maps corresponding to adjacent video images are subtracted pairwise based on the channel gating mechanism through the motion supplement structure to obtain the motion weight corresponding to the video image, and the motion weight corresponding to the video image is multiplied with the corresponding element in the first-level feature map to obtain the motion feature corresponding to the video image; extracting motion information in this way is equivalent to simulating optical flow. Then, the first-level feature map corresponding to the video image and the corresponding elements in the motion feature are added to obtain the second-level feature map corresponding to the video image.

[0147] Then, the shallow feature extraction module can use 3D CNN to perform short-time spatiotemporal feature fusion processing on the secondary feature maps corresponding to each video image fused with motion information, and obtain the third-level feature maps corresponding to each frame of video image; deploying multiple layers of 3D CNN here can increase the nonlinear ability and expand the receptive field, thereby further abstracting the underlying features, which is more conducive to the extraction of important features. Furthermore, for the input video images of larger size, the image can also be compressed through the maximum pooling layer, thereby reducing redundant information, reducing the amount of calculation and reducing the use of video memory, saving computing resources. For example, for the secondary feature map of 60*320*200, two layers of 3D CNN (the two layers are 24 convolution kernels of size 2*3*3 and 2*3*3, respectively) can be used to simultaneously mine the connection and changes between adjacent video images from the two dimensions of time and space; then, through the maximum pooling layer with a window and step size of 1*2*2, the size of the feature map obtained by 3D CNN processing is reduced to 60*160*100.

[0148] For the three-level feature map sequence obtained after the short-term spatiotemporal feature fusion processing of 3D CNN, the shallow feature extraction module can further perform feature extraction processing on the three-level feature map corresponding to each frame of video image through STLSTM, that is, through STLSTM, a recurrent neural network structure containing two gating mechanisms of time and space is used to perform further long-term spatiotemporal fusion processing, and global time fusion and local space fusion are performed based on the entire secondary feature map sequence, while retaining the spatial position information, to obtain the target feature map corresponding to each frame of video image. Compared with the single storage unit of ConvLSTM, the STLSTM structure combining the time and space dual storage units can better integrate spatiotemporal information. At the same time, it is found in the ablation experiment that the prediction effect of STLSTM is better than that of ConvLSTM. The parameters set for STLSTM can be, for example, a spatiotemporal recurrent neural network based on 48 STLSTM units with a convolution kernel size of 3*3. Since the spatiotemporal fusion operation of STLSTM does not change the size of the input feature map, the size of the feature map mentioned after each feature extraction is the same, which is a 48-channel feature map with a size of 160*100.

[0149] The above-mentioned shallow feature extraction module converts the original input video image sequence data into a target feature map sequence. The target feature map sequence obtained by processing with 2D CNN, motion supplementation module, 3DCNN and STLSTM contains rich feature information such as static features of the face, action state features, time and space dependencies, background picture change features, etc. Facial liveness detection based on the target feature map sequence can ensure that the features used for detection are sufficient and reliable.

[0150] For the target feature map sequence output by the shallow feature extraction module, the post-spatial feature fusion module can first perform feature extraction processing on each target feature map in the spatial dimension through 2D CNN and pooling layers. Through 2D CNN, the features such as the texture of the object's face, the naturalness of lighting, and the naturalness of the face and background edges in each frame of video image can be deeply extracted from the spatial dimension. Using multiple layers of 2D CNN and pooling operations on each frame of target feature map in space can achieve further feature extraction, and can make a more detailed state description of the object's face in each frame of video image, and can better and more richly learn the distinguishing feature information between living faces and non-living faces, and reduce the misjudgment of face videos caused by factors such as stillness, changes in picture details (such as additional decorations added to the head), and background changes. 2D CNN compresses spatial information and converts the multi-channel target feature map sequence into a feature vector sequence.

[0151] After the post-spatial feature fusion module completes the spatial compression processing of each target feature map through 2D CNN and pooling layer, and obtains the feature vector corresponding to each target feature map, the post-spatial feature fusion module can further use multi-scale 1D CNN to characterize the changes in facial state between frames; multi-scale 1D CNN can prevent misjudgment caused by jitter between multiple frames, and at the same time can characterize the state characteristics of regular false movements of eyes, mouth and other parts between multiple frames. In specific implementation, the post-spatial feature fusion module can first form a feature matrix row by row according to the time sequence of the video images corresponding to each target feature map, and the feature vectors corresponding to each target feature map output by 2D CNN (that is, the first row carries the feature vector corresponding to the first target feature map, the second row carries the feature vector corresponding to the second target feature map, and so on), and then extract n-gram features of different sequence lengths through multi-scale one-dimensional continuous convolution operations. Figure 3 As shown, Figure 3 In the above, conv1, conv3, conv5, conv7 and conv9 represent one-dimensional continuous convolution operations of windows of different widths. At the same time, each convolution of width is operated separately, and there are multiple convolution kernels of each width, indicating that convolution kernels with different parameters can extract features of different aspects. Then, the convolution operation can be superimposed on multiple layers. For example, the second convolution layer is superimposed on the output of the first convolution layer, and the third convolution layer is superimposed on the output of the second convolution layer. The superposition of multiple convolution layers can expand the receptive field layer by layer and extract high-level abstract features hierarchically. Finally, the output results of each convolution of width are subjected to the maximum pooling operation to retain the most important features of each convolution of each width. Assume that there are M convolution kernels of width, each convolution has K convolution kernels, and the output is a feature vector of M*K dimensions. The above multi-scale 1D CNN compresses the feature vector sequence into a feature vector of fixed dimension, that is, it realizes feature fusion in the time dimension.

[0152] Since the convolution operation of each width of the multi-scale 1D CNN is performed separately, it is necessary to further fuse the output features of multiple convolution kernels, which is equivalent to the fusion of n-gram features. In specific implementation, the post-spatial-temporal feature fusion module can perform element-level gated filtering and global feature fusion on the feature vector output by the multi-scale 1D CNN, which is equivalent to further gated filtering and feature conversion processing on the output results of each convolution kernel. The convolution window width of the multi-scale 1D CNN is a hyperparameter. Through the above processing, the multi-scale features and the feature elements of each dimension can be further adaptively fused to make the result more robust. The HighWay network structure is used here, and its calculation formula is as follows, where is the input Input vector, the HighWay layer does not change the dimension of the input vector, and its output represents the global feature vector of the face sequence.

[0153]

[0154]

[0155] output=trans⊙gate+Input⊙(1-gate)

[0156] The above-mentioned post-spatial feature fusion module is a post-fusion structure that first compresses space and then compresses time for the target feature map sequence data. On the basis that the shallow feature extraction module has extracted the target feature map sequence carrying the spatiotemporal information of adjacent frames based on the video image sequence, the post-spatial feature fusion module further characterizes the spatial features of the face through a deep 2D CNN, and then uses 1D CNN for time compression to obtain the post-fusion spatiotemporal feature vector representation of the target video.

[0157] For the target feature map sequence output by the shallow feature extraction module, the pre-spatial-temporal feature fusion module can eliminate the time dimension of the multi-channel target feature map sequence based on the pre-fusion of spatial-temporal information, and compress it into a multi-channel feature map that only retains spatial information. Specifically, the pre-spatial-temporal feature fusion module can first obtain the final output state of STLSTM (which focuses more on the characteristics of temporal dependent changes), and perform a maximum pooling operation along the time dimension on the intermediate feature map obtained by each feature extraction process of STLSTM (the intermediate feature map arranged in sequence at the same feature extraction position), and obtain a feature map of global time dimension pooling (which focuses more on the maximum change point characteristics at the same spatial position); then, the feature maps obtained by the two operations are spliced ​​together to obtain a spliced ​​feature map, which is a video clip feature map representing multi-dimensional information.

[0158] Since simple splicing is difficult to better highlight which feature maps are more important, and there is a certain amount of information redundancy, the front spatiotemporal feature fusion module can further use the feature map recalibration module to fuse the information of each channel in the spliced ​​feature map, recalibrate the weights of each channel according to the overall global information, strengthen the information of important feature maps, and reduce the redundant feature map information. At the same time, it is also necessary to add the original spliced ​​feature map to obtain the time compression feature map. In this way, the use of residual connection can avoid excessive loss of original input information, which is not conducive to the feature learning of subsequent structures, and the residual structure is also conducive to better training and optimizing network parameters.

[0159] After the front spatiotemporal feature fusion module obtains the time compression feature map, it can further compress the spatial position of the time compression feature map through 2D CNN. Specifically, through multiple layers of standard two-dimensional convolution operations and pooling operations, deeper feature extraction is performed on the time compression feature map that retains the spatial structure, and the multi-channel time compression feature map is further compressed into a high-level semantic vector of a fixed size, thereby obtaining the front fusion global feature vector.

[0160] The above-mentioned pre-spatial feature fusion module is a pre-fusion structure that first compresses time and then compresses space for the target feature map sequence data. On the basis that the shallow feature extraction module has extracted the target feature map sequence carrying the spatiotemporal information of adjacent frames based on the video image sequence, the pre-spatial feature fusion module first performs time compression and fusion processing on the target feature map sequence to better characterize the change information of the spatial position in the target video over time, which is more beneficial for capturing non-living facial behaviors with only local area mutations. Then, a deep 2D CNN is used to spatially characterize the overall situation of the static and dynamic features of the face to obtain the pre-fused spatial and temporal feature vector representation of the target video.

[0161] Finally, the classification module can concatenate and merge the post-fusion global feature vector and the pre-fusion global feature vector to obtain a facial semantic feature vector; then, through the fully connected layer, the facial semantic feature vector is subjected to nonlinear processing and dimensionality conversion processing; finally, the prediction score is output through the fully connected classification layer, and the prediction score can reflect whether the face of the person in the target video is a living face.

[0162] When training the above-mentioned facial liveness detection model, the binary cross entropy objective function based on Softmax can be optimized. Specifically, the Adam algorithm can be used to optimize the parameters of each layer structure in the model, and the learning rate can be set to 0.0001. At the same time, in order to avoid overfitting, L1 and L2 regularization and some dropout operations can be added to the weight parameters of the final fully connected layer.

[0163] In order to verify the effect of the facial liveness detection model provided by the embodiment of the present application, the inventor of the present application evaluated the effect on a test sample set including 26,000 face videos, and the test sample set includes 63 dummy videos. The prediction effect of each model is shown in Table 1 below, where "NOME_STLSTM_B" represents a model that does not include a motion supplementary structure but includes STLSTM and a post-spatial-temporal feature fusion module, "ME_STLSTM_B" represents a model that includes a motion supplementary structure, STLSTM and a post-spatial-temporal feature fusion module, "NOME_STLSTM_FB" represents a model that does not include a motion supplementary structure but includes STLSTM, a post-spatial-temporal feature fusion module and a pre-spatial-temporal feature fusion module, and "ME_STLSTM_FB" represents a model that includes a motion supplementary structure, STLSTM, a post-spatial-temporal feature fusion module and a pre-spatial-temporal feature fusion module, that is, Figure 3 The model structure shown, “ME_CONVLTSM_FB” represents a model that includes a motion supplement structure, a ConvLSTM, a post-spatial temporal feature fusion module, and a pre-spatial temporal feature fusion module.

[0164] Table 1

[0165] Model Black number / black audit Accuracy Recall F1 value NOME_STLSTM_B 71 / 57 80.2% 90.4% 85% ME_STLSTM_B 67 / 59 88% 93.6% 90.7% NOME_STLSTM_FB 71 / 60 84.5% 95.2% 89.5% ME_STLSTM_FB 66 / 60 90.9% 95.2% 93% ME_CONVLTSM_FB 71 / 58 81.6% 92% 86.4%

[0166] It can be seen from the effect evaluation results shown in Table 1 that, whether it is a model structure that only includes a post-spatial-temporal feature fusion module, or a dual-tower model structure that includes both a post-spatial-temporal feature fusion module and a front-spatial-temporal feature fusion module, the effect of the model including the motion supplement structure is better than the model structure that only includes 3D CNN and STLSTM. In addition, the dual-tower model structure that includes both a post-spatial-temporal feature fusion module and a front-spatial-temporal feature fusion module is better than the model structure that only includes the post-spatial-temporal feature fusion module. Furthermore, under the dual-tower model structure that includes both a post-spatial-temporal feature fusion module and a front-spatial-temporal feature fusion module, the effect of the model including STLSTM is better than the model including ConvLSTM. In summary, the embodiments of the present application provide Figure 3 The model shown shows the best effect in experimental comparison.

[0167] With respect to the image recognition method described above, the present application also provides a corresponding image recognition device so that the above image recognition method can be applied and implemented in practice.

[0168] See also Fig.10 , Fig.10 It is the same as above Figure 2 The structure diagram of an image recognition device 1000 corresponding to the image recognition method shown in FIG. Fig.10 As shown, the image recognition device 1000 includes:

[0169] The video splitting module 1001 is used to obtain a target video, wherein the target video includes the face of the target object to be verified; perform frame processing on the target video to obtain multiple frames of video images arranged in sequence in the target video;

[0170] The primary feature extraction module 1002 is used to perform feature extraction processing on the multiple frames of video images to obtain multiple target feature maps arranged in sequence corresponding to the multiple frames of video images;

[0171] The post-fusion feature extraction module 1003 is used to perform feature extraction processing in the spatial dimension on the multiple target feature maps respectively to obtain feature vectors corresponding to the multiple target feature maps; based on the feature vectors corresponding to the multiple target feature maps respectively, perform feature extraction processing in the time dimension to obtain a post-fusion global feature vector;

[0172] The pre-fusion feature extraction module 1004 is used to perform feature extraction processing in the time dimension based on the multiple target feature maps to obtain a time compression feature map; perform feature extraction processing in the space dimension on the time compression feature map to obtain a pre-fusion global feature vector;

[0173] The verification module 1005 is used to determine the face detection result corresponding to the target object according to the post-fusion global feature vector and the pre-fusion global feature vector.

[0174] Optional, in Fig.10 Based on the image recognition device shown, the primary feature extraction module 1002 includes:

[0175] A feature extraction submodule, used to perform feature extraction processing on the multiple frames of video images respectively through a two-dimensional convolution structure to obtain primary feature maps corresponding to the multiple frames of video images respectively;

[0176] A motion supplement submodule, for determining, for each frame of the video image, a motion feature corresponding to the video image according to a primary feature map corresponding to the video image and a primary feature map corresponding to a video image adjacent to the video image; and determining a secondary feature map corresponding to the video image according to the primary feature map and the motion feature corresponding to the video image;

[0177] The feature map determination submodule is used to determine the multiple target feature maps based on the secondary feature maps corresponding to each of the multiple frames of video images.

[0178] Optionally, the motion supplement submodule is specifically used for:

[0179] Determine a video image that is arranged in front of the video image and adjacent to the video image as an adjacent video image of the video image;

[0180] Based on the channel gating mechanism, each element in the primary feature map corresponding to the video image is subtracted from each element in the primary feature map corresponding to its adjacent video image to obtain a motion feature weight;

[0181] Based on the motion feature weight, each element in the primary feature map corresponding to the video image is weighted to obtain the motion feature corresponding to the video image.

[0182] Optionally, the feature map determination submodule is specifically used for:

[0183] For each frame of the video image, according to the arrangement position of the video image and the preset window range, determining a reference video image related to the video image in the multiple frames of video images;

[0184] For each frame of the video image, a three-dimensional convolution structure is used to perform short-term spatiotemporal feature fusion based on a secondary feature map corresponding to the video image and secondary feature maps corresponding to each reference video image related to the video image, so as to obtain a tertiary feature map corresponding to the video image;

[0185] The multiple target feature maps are determined according to the three-level feature maps corresponding to each of the multiple frames of video images.

[0186] Optionally, the feature map determination submodule is specifically used for:

[0187] When the video image is a first frame of video image, multiple feature extraction processes are performed based on the three-level feature map corresponding to the video image through a corresponding recurrent neural network structure to obtain a target feature map corresponding to the video image; in the process of the multiple feature extraction processes, spatial accumulation information and temporal accumulation information corresponding to the video image are generated;

[0188] When the video image is not the first frame of video image, a video image located in front of the video image and adjacent to the video image is determined as an adjacent video image; through a corresponding recurrent neural network structure, multiple feature extraction processes are performed based on the three-level feature map corresponding to the video image, and the spatial accumulation information, temporal accumulation information and target feature map corresponding to the adjacent video image to obtain a target feature map corresponding to the video image.

[0189] Optional, in Fig.10 Based on the image recognition device shown, the post-fusion feature extraction module 1003 includes:

[0190] A spatial compression submodule, used to perform feature extraction processing of the spatial dimension on each of the target feature maps through a two-dimensional convolution structure and a pooling structure, to obtain a feature vector corresponding to each of the target feature maps;

[0191] A time compression submodule, configured to construct a feature matrix according to the feature vectors corresponding to the plurality of target feature maps; perform feature extraction processing on the feature matrix in the time dimension through a plurality of one-dimensional convolution structures to obtain a plurality of time compression feature vectors; the plurality of one-dimensional convolution structures correspond to different window widths respectively;

[0192] The post-fusion vector determination submodule is used to determine the post-fusion global feature vector according to the multiple time compression feature vectors.

[0193] Optionally, the space compression submodule is specifically used for:

[0194] For each of the one-dimensional convolution structures, based on the window width corresponding to the one-dimensional convolution structure, each feature vector in the feature matrix is ​​combined to obtain a combination of feature vectors to be processed corresponding to the one-dimensional convolution structure;

[0195] For each of the one-dimensional convolution structures, feature extraction processing is performed on each combination of feature vectors to be processed corresponding to the one-dimensional convolution structure through the one-dimensional convolution structure to obtain the time feature vectors corresponding to each combination of feature vectors to be processed; maximum pooling processing is performed on the time feature vectors corresponding to each combination of feature vectors to be processed to obtain the time compression feature vector.

[0196] Optionally, the post-fusion vector determination submodule is specifically used for:

[0197] splicing the multiple time-compressed feature vectors to obtain a spliced ​​time-compressed feature vector;

[0198] Determining gating parameters according to the gating mechanism and the splicing time compression feature vector;

[0199] Processing the concatenated time compression feature vector through a fully connected layer to obtain a reference time compression feature vector;

[0200] The post-fusion global feature vector is determined according to the gating parameter, the splicing time compression feature vector, and the reference time compression feature vector.

[0201] Optional, in Fig.10 Based on the image recognition device shown in FIG. 1 , the target feature map is obtained by performing multiple feature extraction processes on the shallow feature maps corresponding to the respective video images through a recurrent neural network structure; the pre-fusion feature extraction module 1004 includes:

[0202] A time compression submodule is used to obtain, for each frame of the video image, a plurality of middle-layer feature maps corresponding to the video image; the plurality of middle-layer feature maps are generated in the process of performing multiple feature extraction processes on the shallow-layer feature maps corresponding to the video image, and the plurality of middle-layer feature maps respectively correspond to different feature extraction levels; based on the plurality of intermediate feature maps corresponding to each of the plurality of frames of video images and the plurality of target feature maps, feature extraction processes in the time dimension are performed to obtain the time compression feature map;

[0203] The spatial compression submodule is used to perform feature extraction processing of the spatial dimension on the temporal compression feature map through a two-dimensional convolution structure and a pooling structure to obtain the pre-fusion global feature vector.

[0204] Optionally, the time compression submodule is specifically used for:

[0205] For each feature extraction level, among the plurality of intermediate feature maps corresponding to the plurality of frames of video images, determine each intermediate feature map corresponding to the feature extraction level;

[0206] For each feature extraction level, performing maximum pooling processing along the time dimension on each intermediate feature map corresponding to the feature extraction level to obtain a time feature map corresponding to the feature extraction level;

[0207] Concatenate the time feature maps corresponding to various feature extraction levels and the last target feature map to obtain a concatenated feature map;

[0208] The time compression feature map is determined according to the splicing feature map.

[0209] Optionally, the time compression submodule is specifically used for:

[0210] Performing average pooling and full connection processing on the concatenated feature map to obtain a reference weight;

[0211] Based on the reference weight, weighted processing is performed on each element in the spliced ​​feature map to obtain a reference feature map;

[0212] Each element in the reference feature map is correspondingly added to each element in the concatenated feature map to obtain the time compression feature map.

[0213] The above-mentioned image recognition device uses a facial liveness detection model to detect whether the target object in the target video is a live object. Through the post-spatial-temporal feature fusion module in the model, multiple target feature maps are first spatially compressed and then temporally compressed, so as to more carefully describe the facial contour and texture of the target object in a single-frame video image, and better characterize the facial features of the target object. In addition, through the pre-spatial-temporal feature fusion module in the model, multiple target feature maps are first temporally compressed and then spatially compressed, which can better describe the state change of each position in the multi-frame video images in the target video, that is, better describe the position change information of the target object's face in the target video. Finally, the post-fusion global feature vector and the pre-fusion global feature vector are combined to verify whether the target object in the target video is a live object, and the static and dynamic features of the target object's face are comprehensively considered, thereby ensuring the accuracy of the verification result determined accordingly.

[0214] The embodiment of the present application also provides a computer device for identifying an image, which may specifically be a terminal device or a server. The terminal device and server provided in the embodiment of the present application will be introduced below from the perspective of hardware instantiation.

[0215] See also Fig.11 , Fig.11 Schematic diagram of the structure of the terminal device provided in the embodiment of the present application. Fig.11 For the sake of convenience, only the parts related to the embodiments of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiments of the present application. The terminal can be any terminal device including a mobile phone, a tablet computer, a personal digital assistant, a point of sales (POS), a car computer, etc., taking the terminal as a computer as an example:

[0216] Fig.11 FIG. 1 is a block diagram showing a partial structure of a computer related to a terminal provided in an embodiment of the present application. Fig.11 The computer includes: a radio frequency (RF) circuit 1110, a memory 1120, an input unit 1130 (including a touch panel 1131 and other input devices 1132), a display unit 1140 (including a display panel 1141), a sensor 1150, an audio circuit 1160 (which can be connected to a speaker 1161 and a microphone 1162), a wireless fidelity (WiFi) module 1170, a processor 1180, and a power supply 1190. Those skilled in the art can understand that Fig.11 The computer structure shown in the figure does not constitute a limitation of the computer, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0217] The memory 1120 can be used to store software programs and modules. The processor 1180 executes various functional applications and data processing of the computer by running the software programs and modules stored in the memory 1120. The memory 1120 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the computer (such as audio data, a phone book, etc.), etc. In addition, the memory 1120 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0218] The processor 1180 is the control center of the computer. It uses various interfaces and lines to connect various parts of the entire computer. It executes various functions of the computer and processes data by running or executing software programs and / or modules stored in the memory 1120 and calling data stored in the memory 1120. Optionally, the processor 1180 may include one or more processing units; preferably, the processor 1180 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1180.

[0219] In the embodiment of the present application, the processor 1180 included in the terminal also has the following functions:

[0220] Acquire a target video, wherein the target video includes the face of the target object to be verified; perform frame processing on the target video to obtain a plurality of video frames arranged in sequence in the target video;

[0221] Performing feature extraction processing on the multiple frames of video images to obtain a plurality of target feature maps arranged in sequence corresponding to the multiple frames of video images;

[0222] Performing feature extraction processing on the spatial dimension for each of the multiple target feature maps to obtain feature vectors corresponding to each of the multiple target feature maps; performing feature extraction processing on the temporal dimension based on the feature vectors corresponding to each of the multiple target feature maps to obtain a post-fusion global feature vector;

[0223] Performing feature extraction processing in the time dimension based on the multiple target feature maps to obtain a time compression feature map; performing feature extraction processing in the space dimension on the time compression feature map to obtain a pre-fusion global feature vector;

[0224] A face detection result corresponding to the target object is determined according to the post-fusion global feature vector and the pre-fusion global feature vector.

[0225] Optionally, the processor 1180 is also used to execute the steps of any implementation method of the image recognition method provided in the embodiments of the present application.

[0226] See also Fig.12 , Fig.12 A schematic diagram of the structure of a server 1200 provided for an embodiment of the present application. The server 1200 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1222 (for example, one or more processors) and a memory 1232, and one or more storage media 1230 (for example, one or more mass storage devices) storing application programs 1242 or data 1244. Among them, the memory 1232 and the storage medium 1230 may be short-term storage or permanent storage. The program stored in the storage medium 1230 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 1222 may be configured to communicate with the storage medium 1230 to execute a series of instruction operations in the storage medium 1230 on the server 1200.

[0227] The server 1200 may also include one or more power supplies 1226, one or more wired or wireless network interfaces 1250, one or more input and output interfaces 1258, and / or one or more operating systems, such as Windows Server 2000. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM etc.

[0228] The steps performed by the server in the above embodiment can be based on the Fig.12 The server structure shown.

[0229] The CPU 1222 is used to execute the following steps:

[0230] Acquire a target video, wherein the target video includes the face of the target object to be verified; perform frame processing on the target video to obtain a plurality of video frames arranged in sequence in the target video;

[0231] Performing feature extraction processing on the multiple frames of video images to obtain a plurality of target feature maps arranged in sequence corresponding to the multiple frames of video images;

[0232] Performing feature extraction processing on the spatial dimension for each of the multiple target feature maps to obtain feature vectors corresponding to each of the multiple target feature maps; performing feature extraction processing on the temporal dimension based on the feature vectors corresponding to each of the multiple target feature maps to obtain a post-fusion global feature vector;

[0233] Performing feature extraction processing in the time dimension based on the multiple target feature maps to obtain a time compression feature map; performing feature extraction processing in the space dimension on the time compression feature map to obtain a pre-fusion global feature vector;

[0234] A face detection result corresponding to the target object is determined according to the post-fusion global feature vector and the pre-fusion global feature vector.

[0235] Optionally, the CPU 1222 may also be used to execute steps of any implementation method of the image recognition method provided in the embodiments of the present application.

[0236] An embodiment of the present application also provides a computer-readable storage medium for storing a computer program, wherein the computer program is used to execute any one of the implementations of an image recognition method described in the aforementioned embodiments.

[0237] The embodiment of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes any one of the implementations of the image recognition method described in the above embodiments.

[0238] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0239] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0240] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0241] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0242] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (full name in English: Read-Only Memory, English abbreviation: ROM), random access memory (full name in English: Random Access Memory, English abbreviation: RAM), disk or optical disk and other media that can store computer programs.

[0243] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0244] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. An image recognition method, characterized in that: The method comprises: Acquire a target video, wherein the target video includes the face of the target object to be verified; perform frame processing on the target video to obtain a plurality of video frames arranged in sequence in the target video; Through a two-dimensional convolution structure, feature extraction processing is performed on the multiple frames of video images respectively to obtain primary feature maps corresponding to the multiple frames of video images respectively; For each frame of the video image, determine the motion feature corresponding to the video image according to the primary feature map corresponding to the video image and the primary feature map corresponding to the video image adjacent to the video image; determine the secondary feature map corresponding to the video image according to the primary feature map and the motion feature corresponding to the video image; For each frame of the video image, according to the arrangement position of the video image and the preset window range, determining a reference video image related to the video image in the multiple frames of video images; For each frame of the video image, a three-dimensional convolution structure is used to perform short-term spatiotemporal feature fusion based on a secondary feature map corresponding to the video image and secondary feature maps corresponding to each reference video image related to the video image, so as to obtain a tertiary feature map corresponding to the video image; Determine, according to the three-level feature maps corresponding to the multiple frames of video images, a plurality of target feature maps arranged in order corresponding to the multiple frames of video images; Performing feature extraction processing on the spatial dimension for each of the multiple target feature maps to obtain feature vectors corresponding to each of the multiple target feature maps; performing feature extraction processing on the temporal dimension based on the feature vectors corresponding to each of the multiple target feature maps to obtain a post-fusion global feature vector; Performing feature extraction processing in the time dimension based on the multiple target feature maps to obtain a time compression feature map; performing feature extraction processing in the space dimension on the time compression feature map to obtain a pre-fusion global feature vector; A face detection result corresponding to the target object is determined according to the post-fusion global feature vector and the pre-fusion global feature vector.

2. The method according to claim 1, characterized in that The determining, according to the primary feature map corresponding to the video image and the primary feature map corresponding to the video image adjacent to the video image, the motion feature corresponding to the video image comprises: Determine a video image that is arranged in front of the video image and adjacent to the video image as an adjacent video image of the video image; Based on the channel gating mechanism, each element in the primary feature map corresponding to the video image is subtracted from each element in the primary feature map corresponding to its adjacent video image to obtain a motion feature weight; Based on the motion feature weight, each element in the primary feature map corresponding to the video image is weighted to obtain the motion feature corresponding to the video image.

3. The method according to claim 1, characterized in that The determining, according to the three-level feature maps corresponding to the multiple frames of video images respectively, a plurality of target feature maps arranged in sequence corresponding to the multiple frames of video images comprises: When the video image is a first frame of video image, multiple feature extraction processes are performed based on the three-level feature map corresponding to the video image through a corresponding recurrent neural network structure to obtain a target feature map corresponding to the video image; in the process of the multiple feature extraction processes, spatial accumulation information and temporal accumulation information corresponding to the video image are generated; When the video image is not the first frame of video image, a video image located in front of the video image and adjacent to the video image is determined as an adjacent video image; through a corresponding recurrent neural network structure, multiple feature extraction processes are performed based on the three-level feature map corresponding to the video image, and the spatial accumulation information, temporal accumulation information and target feature map corresponding to the adjacent video image to obtain a target feature map corresponding to the video image.

4. The method according to claim 1, characterized in that: The step of performing feature extraction processing on the spatial dimension for each of the plurality of target feature maps to obtain feature vectors corresponding to each of the plurality of target feature maps; and performing feature extraction processing on the temporal dimension based on the feature vectors corresponding to each of the plurality of target feature maps to obtain a post-fusion global feature vector includes: Through a two-dimensional convolution structure and a pooling structure, feature extraction processing of the spatial dimension is performed on each of the target feature maps to obtain a feature vector corresponding to each of the target feature maps; Constructing a feature matrix according to the feature vectors corresponding to each of the plurality of target feature maps; Through multiple one-dimensional convolution structures, the feature matrix is ​​subjected to feature extraction processing in the time dimension to obtain multiple time-compressed feature vectors; the multiple one-dimensional convolution structures correspond to different window widths respectively; The post-fusion global feature vector is determined according to the multiple time-compressed feature vectors.

5. The method according to claim 4, characterized in that The feature matrix is ​​subjected to feature extraction processing in the time dimension by using multiple one-dimensional convolution structures to obtain multiple time-compressed feature vectors, including: For each of the one-dimensional convolution structures, based on the window width corresponding to the one-dimensional convolution structure, each feature vector in the feature matrix is ​​combined to obtain a combination of feature vectors to be processed corresponding to the one-dimensional convolution structure; For each of the one-dimensional convolution structures, feature extraction processing is performed on each combination of feature vectors to be processed corresponding to the one-dimensional convolution structure through the one-dimensional convolution structure to obtain the time feature vectors corresponding to each combination of feature vectors to be processed; maximum pooling processing is performed on the time feature vectors corresponding to each combination of feature vectors to be processed to obtain the time compression feature vector.

6. The method according to claim 4, characterized in that The step of determining the post-fusion global feature vector according to the multiple time-compressed feature vectors includes: splicing the multiple time-compressed feature vectors to obtain a spliced ​​time-compressed feature vector; Determining gating parameters according to the gating mechanism and the splicing time compression feature vector; Processing the concatenated time compression feature vector through a fully connected layer to obtain a reference time compression feature vector; The post-fusion global feature vector is determined according to the gating parameter, the splicing time compression feature vector, and the reference time compression feature vector.

7. The method according to claim 1, characterized in that The target feature map is obtained by performing multiple feature extraction processes on the shallow feature maps corresponding to each of the video images through a recurrent neural network structure; The feature extraction process of the time dimension is performed based on the multiple target feature maps to obtain a time compression feature map; Performing feature extraction processing of the spatial dimension on the time compression feature map to obtain a pre-fusion global feature vector includes: For each frame of the video image, a plurality of middle-layer feature maps corresponding to the video image are obtained; the plurality of middle-layer feature maps are generated in the process of performing multiple feature extraction processes on the shallow-layer feature maps corresponding to the video image, and the plurality of middle-layer feature maps correspond to different feature extraction levels respectively; Based on the multiple intermediate feature maps corresponding to the multiple frames of video images and the multiple target feature maps, feature extraction processing in the time dimension is performed to obtain the time compression feature map; The spatial dimension feature extraction process is performed on the time compression feature map through a two-dimensional convolution structure and a pooling structure to obtain the pre-fusion global feature vector.

8. The method according to claim 7, characterized in that The step of performing feature extraction processing in a time dimension based on the multiple intermediate feature maps corresponding to the multiple frames of video images and the multiple target feature maps to obtain the time compression feature map includes: For each feature extraction level, among the plurality of intermediate feature maps corresponding to the plurality of frames of video images, determine each intermediate feature map corresponding to the feature extraction level; For each feature extraction level, performing maximum pooling processing along the time dimension on each intermediate feature map corresponding to the feature extraction level to obtain a time feature map corresponding to the feature extraction level; Concatenate the time feature maps corresponding to various feature extraction levels and the last target feature map to obtain a concatenated feature map; The time compression feature map is determined according to the splicing feature map.

9. The method according to claim 8, characterized in that The step of determining the time compression feature map according to the splicing feature map comprises: Performing average pooling and full connection processing on the concatenated feature map to obtain a reference weight; Based on the reference weight, weighted processing is performed on each element in the spliced ​​feature map to obtain a reference feature map; Each element in the reference feature map is correspondingly added to each element in the concatenated feature map to obtain the time compression feature map.

10. An image recognition device, characterized in that: The device comprises: The video splitting module is used to obtain a target video, wherein the target video includes the face of the target object to be verified; perform frame processing on the target video to obtain multiple frames of video images arranged in sequence in the target video; A feature extraction submodule, used to perform feature extraction processing on the multiple frames of video images respectively through a two-dimensional convolution structure to obtain primary feature maps corresponding to the multiple frames of video images respectively; A motion supplement submodule, for determining, for each frame of the video image, a motion feature corresponding to the video image according to a primary feature map corresponding to the video image and a primary feature map corresponding to a video image adjacent to the video image; and determining a secondary feature map corresponding to the video image according to the primary feature map and the motion feature corresponding to the video image; A feature map determination submodule is used to determine, for each frame of the video image, a reference video image related to the video image in the multiple frames of video images according to the arrangement position of the video image and a preset window range; for each frame of the video image, perform short-time spatiotemporal feature fusion based on the secondary feature map corresponding to the video image and the secondary feature maps corresponding to each reference video image related to the video image through a three-dimensional convolution structure to obtain a tertiary feature map corresponding to the video image; determine a plurality of target feature maps arranged in sequence corresponding to the multiple frames of video images according to the tertiary feature maps corresponding to each of the multiple frames of video images; A post-fusion feature extraction module is used to perform feature extraction processing in the spatial dimension on the multiple target feature maps respectively to obtain feature vectors corresponding to the multiple target feature maps; based on the feature vectors corresponding to the multiple target feature maps respectively, perform feature extraction processing in the time dimension to obtain a post-fusion global feature vector; A pre-fusion feature extraction module is used to perform feature extraction processing in the time dimension based on the multiple target feature maps to obtain a time compression feature map; perform feature extraction processing in the space dimension on the time compression feature map to obtain a pre-fusion global feature vector; A verification module is used to determine the face detection result corresponding to the target object according to the post-fusion global feature vector and the pre-fusion global feature vector.

11. The device according to claim 10, characterized in that The motion supplement submodule is specifically used for: Determine a video image that is arranged in front of the video image and adjacent to the video image as an adjacent video image of the video image; Based on the channel gating mechanism, each element in the primary feature map corresponding to the video image is subtracted from each element in the primary feature map corresponding to its adjacent video image to obtain a motion feature weight; Based on the motion feature weight, each element in the primary feature map corresponding to the video image is weighted to obtain the motion feature corresponding to the video image.

12. The device according to claim 10, characterized in that The feature map determination submodule is specifically used for: When the video image is a first frame of video image, multiple feature extraction processes are performed based on the three-level feature map corresponding to the video image through a corresponding recurrent neural network structure to obtain a target feature map corresponding to the video image; In the process of the multiple feature extraction processes, generating spatial accumulation information and temporal accumulation information corresponding to the video image; When the video image is not the first frame of the video image, determining a video image located before the video image and adjacent to the video image as an adjacent video image; Through the corresponding recurrent neural network structure, multiple feature extraction processes are performed based on the three-level feature map corresponding to the video image, and the spatial accumulation information, temporal accumulation information and target feature map corresponding to the adjacent video images to obtain the target feature map corresponding to the video image.

13. The device according to claim 10, characterized in that The post-fusion feature extraction module comprises: A spatial compression submodule, used to perform feature extraction processing of the spatial dimension on each of the target feature maps through a two-dimensional convolution structure and a pooling structure, to obtain a feature vector corresponding to each of the target feature maps; A time compression submodule, configured to construct a feature matrix according to the feature vectors corresponding to the plurality of target feature maps; perform feature extraction processing on the feature matrix in the time dimension through a plurality of one-dimensional convolution structures to obtain a plurality of time compression feature vectors; the plurality of one-dimensional convolution structures correspond to different window widths respectively; The post-fusion vector determination submodule is used to determine the post-fusion global feature vector according to the multiple time compression feature vectors.

14. The device according to claim 13, characterized in that The space compression submodule is specifically used for: For each of the one-dimensional convolution structures, based on the window width corresponding to the one-dimensional convolution structure, each feature vector in the feature matrix is ​​combined to obtain a combination of feature vectors to be processed corresponding to the one-dimensional convolution structure; For each of the one-dimensional convolution structures, feature extraction processing is performed on each combination of feature vectors to be processed corresponding to the one-dimensional convolution structure through the one-dimensional convolution structure to obtain the time feature vectors corresponding to each combination of feature vectors to be processed; maximum pooling processing is performed on the time feature vectors corresponding to each combination of feature vectors to be processed to obtain the time compression feature vector.

15. The device according to claim 13, characterized in that The post-fusion vector determination submodule is specifically used for: splicing the multiple time-compressed feature vectors to obtain a spliced ​​time-compressed feature vector; Determining gating parameters according to the gating mechanism and the splicing time compression feature vector; Processing the concatenated time compression feature vector through a fully connected layer to obtain a reference time compression feature vector; The post-fusion global feature vector is determined according to the gating parameter, the splicing time compression feature vector, and the reference time compression feature vector.

16. The device according to claim 10, characterized in that The target feature map is obtained by performing multiple feature extraction processes on the shallow feature maps corresponding to each of the video images through a recurrent neural network structure; The pre-fusion feature extraction module includes: A time compression submodule is used to obtain, for each frame of the video image, a plurality of middle-layer feature maps corresponding to the video image; the plurality of middle-layer feature maps are generated in the process of performing multiple feature extraction processes on the shallow-layer feature maps corresponding to the video image, and the plurality of middle-layer feature maps respectively correspond to different feature extraction levels; based on the plurality of intermediate feature maps corresponding to each of the plurality of frames of video images and the plurality of target feature maps, feature extraction processes in the time dimension are performed to obtain the time compression feature map; The spatial compression submodule is used to perform feature extraction processing of the spatial dimension on the temporal compression feature map through a two-dimensional convolution structure and a pooling structure to obtain the pre-fusion global feature vector.

17. The device according to claim 16, characterized in that The time compression submodule is specifically used for: For each feature extraction level, among the plurality of intermediate feature maps corresponding to the plurality of frames of video images, determine each intermediate feature map corresponding to the feature extraction level; For each feature extraction level, performing maximum pooling processing along the time dimension on each intermediate feature map corresponding to the feature extraction level to obtain a time feature map corresponding to the feature extraction level; Concatenate the time feature maps corresponding to various feature extraction levels and the last target feature map to obtain a concatenated feature map; The time compression feature map is determined according to the splicing feature map.

18. The device according to claim 17, characterized in that The time compression submodule is specifically used for: Performing average pooling and full connection processing on the concatenated feature map to obtain a reference weight; Based on the reference weight, weighted processing is performed on each element in the spliced ​​feature map to obtain a reference feature map; Each element in the reference feature map is correspondingly added to each element in the concatenated feature map to obtain the time compression feature map.

19. A computer device, characterized in that: The device includes a processor and a memory; The memory is used to store computer programs; The processor is configured to execute the image recognition method according to any one of claims 1 to 9 according to the computer program.

20. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the image recognition method according to any one of claims 1 to 9.

21. A computer program product, comprising a computer program or instructions, characterized in that: When the computer program or the instruction is executed by a processor, the image recognition method according to any one of claims 1 to 9 is implemented.