Special effects display method, device, computer equipment and storage medium
By tracking the key points of the user's face during filming or live broadcasting, the problem of special effects disappearing or deforming due to face detection failure is solved, and the continuous and stable display of special effects is achieved.
Patent Information
- Application Number
- CN202110501904.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-08
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-05-08
AI Technical Summary
During filming or live broadcasting, the user's face may not always be facing the terminal, causing face detection to fail, causing the face special effects to suddenly disappear or deform.
Adopting a special effects display method based on facial key point tracking, when the face cannot be detected, the facial key points detected in the previous image frame are used to track the facial key points of the current image frame to ensure that it continues when specific conditions are met. Show special effects.
It avoids the sudden disappearance or deformation of special effects caused by face detection failure, ensuring the continuous display and stability of special effects.
Smart Images

Figure CN113139919B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a special effects display method, device, computer equipment and storage medium. Background Art
[0002] With the continuous development of Internet technology, using special effects when shooting or live broadcasting has become a new form of entertainment. Users can use face effects, such as beauty effects, cute face effects, etc. At this time, the terminal will add the face effect to the user's face in the corresponding picture.
[0003] At present, the special effects display method is usually as follows: the terminal performs face detection on the collected image frames to obtain face detection results of the image frames, and based on the face detection results, adds face special effects to the user's face in the corresponding image frames.
[0004] However, during shooting or live broadcasting, since the user's face may not always be facing the terminal, the terminal may sometimes be unable to detect the user's face, and the face effects may suddenly disappear or become deformed. Summary of the invention
[0005] The embodiments of the present application provide a special effect display method, device, computer equipment and storage medium, and provide a special effect display method based on face key point tracking to avoid the problem of sudden disappearance or deformation of subsequent face special effects due to face detection failure. The technical solution is as follows:
[0006] On the one hand, a special effect display method is provided, which is executed by a terminal, and the method includes:
[0007] In response to a display instruction for a target special effect, display the target special effect at a face position of a first image frame, the face position being determined based on a plurality of first face key points, the plurality of first face key points being obtained based on face detection of the first image frame;
[0008] In response to a failure in face detection of the second image frame, tracking face key points of the second image frame based on the multiple first face key points to obtain multiple second face key points, the second image frame being an image frame subsequent to the first image frame;
[0009] In response to the plurality of second facial key points satisfying a target condition, the target special effect is displayed at a facial position determined based on the plurality of second facial key points.
[0010] In some embodiments, in response to the plurality of second facial key points satisfying a target condition, displaying the target special effect at a facial position determined based on the plurality of second facial key points includes:
[0011] For the second facial key point, a first image feature of the first image frame and a second image feature of the second image frame are obtained, wherein the first image feature is an image feature of an area associated with the first facial key point corresponding to the second facial key point, and the second image feature is an image feature of an area associated with the second facial key point;
[0012] Determine the image similarity between the first image feature and the second image feature of the plurality of second facial key points;
[0013] In response to the image similarities corresponding to the plurality of second facial key points all reaching a first threshold, the target special effect is displayed at the facial position determined based on the plurality of second facial key points.
[0014] In some embodiments, after determining the image similarity between the first image feature and the second image feature of the plurality of second facial key points, the method further comprises:
[0015] Based on the image similarities corresponding to the plurality of second facial key points, determining a target ratio, where the target ratio is the ratio of the number of second facial key points whose image similarities reach a first threshold to the total number of second facial key points;
[0016] In response to the target ratio reaching a ratio threshold, the step of displaying the target special effect at the face position determined based on the plurality of second face key points is performed.
[0017] In some embodiments, in response to the plurality of second facial key points satisfying a target condition, displaying the target special effect at a facial position determined based on the plurality of second facial key points includes:
[0018] Determine a facial similarity between a first facial contour and a second facial contour, the first facial contour being a facial contour corresponding to the plurality of first facial key points, and the second facial contour being a second facial contour corresponding to the plurality of second facial key points;
[0019] In response to the facial similarity reaching a second threshold, the target special effect is displayed at the facial position determined based on the plurality of second facial key points.
[0020] In some embodiments, before determining the facial similarity between the first facial contour and the second facial contour, the method further includes:
[0021] Inputting the position information of the plurality of first facial key points and the plurality of second facial key points into a feature extraction network respectively, extracting facial features through the feature extraction network to obtain first facial features of the first facial contour and second facial features of the second facial contour;
[0022] Based on the first facial feature and the second facial feature, the step of determining the facial similarity between the first facial contour and the second facial contour is performed.
[0023] In some embodiments, based on the multiple first facial key points, tracking the facial key points of the second image frame to obtain the multiple second facial key points includes:
[0024] The multiple first facial key points are input into a face tracking network, and the face key points of the second image frame are tracked by the face tracking network to obtain the multiple second facial key points.
[0025] In one aspect, a special effect display device is provided, the device comprising:
[0026] A first display module, configured to display a target special effect at a face position of a first image frame in response to a display instruction for the target special effect, wherein the face position is determined based on a plurality of first face key points, and the plurality of first face key points are obtained based on face detection of the first image frame;
[0027] A tracking module, configured to, in response to a failure in face detection of the second image frame, track face key points of the second image frame based on the plurality of first face key points to obtain a plurality of second face key points, wherein the second image frame is an image frame subsequent to the first image frame;
[0028] The second display module is used to display the target special effect at the face position determined based on the multiple second face key points in response to the multiple second face key points satisfying the target condition.
[0029] In some embodiments, the second display module includes:
[0030] An acquisition submodule, for acquiring, for the second facial key point, a first image feature of the first image frame and a second image feature of the second image frame, wherein the first image feature is an image feature of an area associated with the first facial key point corresponding to the second facial key point, and the second image feature is an image feature of an area associated with the second facial key point;
[0031] A determination submodule, used to determine the image similarity between the first image feature and the second image feature of the plurality of second facial key points;
[0032] The display submodule is used to display the target special effect at the face position determined based on the multiple second face key points in response to the image similarities corresponding to the multiple second face key points reaching the first threshold.
[0033] In some embodiments, the determination submodule is further used to determine a target ratio based on the image similarities corresponding to the plurality of second facial key points, the target ratio being the ratio of the number of second facial key points whose image similarities reach a first threshold to the total number of second facial key points;
[0034] The display submodule is also used to execute the step of displaying the target special effect at the face position determined based on the multiple second face key points in response to the target ratio reaching the ratio threshold.
[0035] In some embodiments, the second display module includes:
[0036] a determination submodule, configured to determine a facial similarity between a first face contour and a second face contour, wherein the first face contour is a face contour corresponding to the plurality of first face key points, and the second face contour is a second face contour corresponding to the plurality of second face key points;
[0037] The display submodule is used for displaying the target special effect at the face position determined based on the plurality of second face key points in response to the face similarity reaching a second threshold.
[0038] In some embodiments, the device further includes a feature extraction module, which is used to input the position information of the plurality of first facial key points and the plurality of second facial key points into a feature extraction network, extract facial features through the feature extraction network, and obtain a first facial feature of the first facial contour and a second facial feature of the second facial contour;
[0039] The determination submodule is further used to execute the step of determining the facial similarity between the first facial contour and the second facial contour based on the first facial feature and the second facial feature.
[0040] In some embodiments, the tracking module is used to:
[0041] The multiple first facial key points are input into a face tracking network, and the face key points of the second image frame are tracked by the face tracking network to obtain the multiple second facial key points.
[0042] On the one hand, a computer device is provided, which includes a processor and a memory, wherein at least one program code is stored in the memory, and the at least one program code is loaded and executed by the processor to implement the above-mentioned special effect display method.
[0043] On the one hand, a computer-readable storage medium is provided, in which at least one program code is stored. The at least one program code is loaded and executed by a processor to implement the above-mentioned special effect display method.
[0044] On the one hand, a computer program product is provided, which includes a computer program code, the computer program code is stored in a computer-readable storage medium, a processor of a computer device reads the computer program code from the computer-readable storage medium, and the processor executes the computer program code, so that the computer device executes the above-mentioned special effect display method.
[0045] The technical solution provided in the embodiment of the present application, when displaying special effects in a face image frame, if the current image frame cannot detect a face, the face key points of the current image frame are tracked based on the face key points detected in the previous image frame, so that the face key points of the current image frame can be tracked, and a special effects display method based on face key point tracking is provided. Furthermore, when the face key points corresponding to the image frame meet the target conditions, the special effects are displayed based on the face key points tracked by the face, thereby avoiding the problem of sudden disappearance or deformation of subsequent face special effects due to face detection failure, thereby ensuring the continuous display of special effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0047] Figure 1 It is a schematic diagram of an implementation environment of a special effect display method provided in an embodiment of the present application;
[0048] Figure 2 is a flow chart of a special effects display method provided in an embodiment of the present application;
[0049] Figure 3 is a flow chart of a special effects display method provided in an embodiment of the present application;
[0050] Figure 4 is a structural schematic diagram of a special effect display device provided in an embodiment of the present application;
[0051] Figure 5 It is a structural diagram of a terminal provided in an embodiment of the present application. DETAILED DESCRIPTION
[0052] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0053] Figure 1 Schematic diagram of an implementation environment of a special effect display method provided in an embodiment of the present application. Figure 1, the implementation environment includes: terminal 101.
[0054] The terminal 101 may be at least one of a smart phone, a smart watch, a desktop computer, a laptop, a virtual reality terminal, an augmented reality terminal, a wireless terminal, and a laptop computer. The terminal 101 has a communication function and can access a wired network or a wireless network. The terminal 101 may generally refer to one of a plurality of terminals. This embodiment is only illustrated by taking the terminal 101 as an example. Those skilled in the art may know that the number of the above terminals may be more or less.
[0055] In the embodiment of the present application, the terminal 101 runs a target application with a special effect display function, such as a shooting application, a social application, a live broadcast application, etc. Among them, the special effect refers to a face special effect, for example, a beauty special effect, a cute special effect, an accessory special effect, and the like.
[0056] The following is an explanation of the application scenarios of the special effects display method provided by this application:
[0057] In some embodiments, the special effects display method provided by the present application is applied to the special effects display in the shooting scene. For example, when a user uses a shooting application to take a photo or record a video, the shooting application interface displays multiple face special effects, and the user can select any face special effect displayed by the shooting application. Then, in response to the selection operation of any face special effect, the terminal 101 displays the selected face special effect at the face position of the shooting screen of the terminal 101.
[0058] In some embodiments, the special effects display method provided by the present application is applied to the special effects display in a live broadcast scenario. In this embodiment, the terminal 101 is a terminal operated by the anchor user. In an optional embodiment, when the anchor user uses a live broadcast application to broadcast live, multiple face special effects are displayed in the live broadcast room interface. The anchor user can select any face special effect displayed by the live broadcast application. Then, the terminal 101 responds to the selection operation of any face special effect and displays the selected face special effect at the face position of the anchor user in the live broadcast screen. In another optional embodiment, when the anchor user uses a live broadcast application to broadcast live, the audience users in the live broadcast room can give special effects gifts to the anchor user. In response to the audience users giving special effects gifts to the anchor user, the terminal 101 displays the corresponding face special effect at the face position of the anchor user in the live broadcast screen.
[0059] When special effects are displayed in the above scenario, since the user's face may not always face the terminal 101, the terminal 101 may sometimes be unable to detect the user's face, and the face special effects may suddenly disappear or deform, thereby affecting the shooting effect or live broadcast effect. In an embodiment of the present application, a special effects display method is provided. When the terminal 101 cannot detect the user's face, the special effects display method provided by the embodiment of the present application can ensure the continuous display of the face special effects, avoid the sudden disappearance or deformation of the face special effects, and ensure the shooting effect or live broadcast effect.
[0060] It should be noted that, in the above-mentioned live broadcast scenario, the implementation environment of the special effects display method also includes: server 102.
[0061] Server 102 can be a background server of a live broadcast application. Server 102 can be an independent physical server, or a server cluster or distributed file system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Server 102 and terminal 101 can be directly or indirectly connected via wired or wireless communication, which is not limited in this embodiment of the present application. Optionally, the number of the above-mentioned servers 102 can be more or less, which is not limited in this embodiment of the present application. Of course, server 102 can also include other functional servers to provide more comprehensive and diversified services.
[0062] In some embodiments, the server 102 is used to respond to the audience user in the live broadcast room giving the anchor user a special effect gift, and send a special effect gift notification to the terminal 101, and the special effect gift notification is used to trigger the terminal 101 to display the corresponding special effect in the live broadcast screen. In other embodiments, the server 102 is also used to obtain the live broadcast data stream of the terminal 101, and send the live broadcast data stream to the terminals corresponding to multiple audience users in the live broadcast room, and then the terminals corresponding to the multiple audience users display the corresponding face special effects at the face position of the anchor user in the live broadcast screen. At this time, the audience users watching the live broadcast can see the corresponding face special effects appearing on the face of the anchor user.
[0063] Figure 2 is a flowchart of a special effect display method provided in an embodiment of the present application, which is executed by a terminal, see Figure 2 , the embodiment comprises:
[0064] 201. In response to a display instruction for a target special effect, the terminal displays the target special effect at a face position in a first image frame, where the face position is determined based on a plurality of first face key points, and the plurality of first face key points are obtained based on face detection of the first image frame.
[0065] In the embodiment of the present application, the target special effect refers to the special effect to be displayed, wherein the special effect refers to the face special effect, for example, beauty special effect, cute special effect, accessory special effect, etc.
[0066] In some embodiments, the terminal performs face detection on the currently acquired first image frame in response to an instruction to display the target special effects, obtains multiple first face key points, determines the face position of the first image frame based on the multiple first face key points, and then displays the target special effects at the face position of the first image frame.
[0067] 202. In response to the failure of face detection in the second image frame, the terminal tracks the face key points of the second image frame based on the multiple first face key points to obtain multiple second face key points. The second image frame is an image frame subsequent to the first image frame.
[0068] In some embodiments, when the terminal cannot detect a face, the terminal tracks the face key points of the second image frame based on the multiple first face key points obtained through face detection in the first image frame to obtain multiple second face key points.
[0069] 203. In response to the multiple second facial key points satisfying the target condition, the terminal displays the target special effect at the facial position determined based on the multiple second facial key points.
[0070] In the embodiment of the present application, the target condition is a pre-set judgment condition used to determine whether the facial key points are tracked successfully.
[0071] In some embodiments, when the facial key points are tracked successfully, the terminal determines the face position of the second image frame based on the multiple second facial key points, and then displays the target special effects at the face position of the second image frame.
[0072] The technical solution provided in the embodiment of the present application, when displaying special effects in a face image frame, if the current image frame cannot detect a face, the face key points of the current image frame are tracked based on the face key points detected in the previous image frame, so that the face key points of the current image frame can be tracked, and a special effects display method based on face key point tracking is provided. Furthermore, when the face key points corresponding to the image frame meet the target conditions, the special effects are displayed based on the face key points tracked by the face, thereby avoiding the problem of sudden disappearance or deformation of subsequent face special effects due to face detection failure, thereby ensuring the continuous display of special effects.
[0073] Above Figure 2 The basic process of this application is shown below. The solution provided by this application is further described based on a specific implementation method. Figure 3 is a flowchart of a special effect display method provided in an embodiment of the present application, which is executed by a terminal, see Figure 3 , the embodiment comprises:
[0074] 301. In response to a display instruction for a target special effect, the terminal performs face detection on a first image frame to obtain a plurality of first face key points.
[0075] In some embodiments, the display instruction of the target special effect is triggered based on the selection operation of the target special effect. For example, the user selects the target special effect when shooting, or the user selects the target special effect during live broadcast, which can trigger the display instruction of the target special effect. In other embodiments, the display instruction of the target special effect is triggered based on the audience user in the live broadcast room giving the anchor user a special effect gift. For example, the server sends a special effect gift notification to the terminal in response to the audience user giving the anchor user a special effect gift. The special effect gift notification is also the display instruction for the target special effect.
[0076] In the embodiment of the present application, the first image frame is the image frame collected by the terminal at the current moment. Face detection is face key point detection, and face key point detection refers to locating the key points of the face in the face image. The first face key point refers to the face key point corresponding to the first image frame. The face key point refers to the key point of the face, including eyebrows, eyes, nose, mouth and facial contour points. Optionally, the number of the first face key points is 106 points.
[0077] In some embodiments, the terminal performs face detection on the first image frame based on a face key point detection algorithm to obtain a plurality of first face key points corresponding to the first image frame.
[0078] Optionally, the face detection algorithm is any one of an ASM (Active Shape Model) algorithm, an AAM (Active Appearance Models) algorithm, a TCNN (Tweaked Convolutional Neural Networks) algorithm, and a DAN (Deep Alignment Network) algorithm. The embodiment of the present application does not limit which face detection algorithm is used.
[0079] 302. The terminal displays a target special effect at the face position determined based on the multiple first face key points.
[0080] In some embodiments, the terminal performs curve fitting based on multiple first facial key points in the first image frame to obtain a first facial contour corresponding to the multiple first facial key points, determines the facial position corresponding to the target special effect based on the first facial contour and special effect parameters of the target special effect, and then displays the target special effect at the facial position in the first image frame.
[0081] In the above embodiment, in response to the display instruction for the target special effect, the terminal performs face detection on the collected image frames in sequence, starting from the first image frame, obtains the face key points of the corresponding image frame, and then displays the target special effect in the corresponding image frame. In the case that the face detection of the image frame after the first image frame fails, the special effect display method shown in the subsequent steps is executed.
[0082] 303. In response to the failure of face detection in the second image frame, the terminal tracks the face key points of the second image frame based on the multiple first face key points to obtain multiple second face key points. The second image frame is an image frame subsequent to the first image frame.
[0083] In the embodiment of the present application, the second image frame is an image frame after the first image frame where face detection fails. For example, the second image frame may be the next image frame of the first image frame.
[0084] In some embodiments, in response to the failure of face detection in the second image frame, the terminal inputs the multiple first face key points into a face tracking network, and tracks the face key points of the second image frame through the face tracking network to obtain the multiple second face key points. The face tracking network is a face key point tracking network, which is used to track face key points of the image frame. In this embodiment, the face tracking network is used to track face key points, which can quickly determine multiple face key points in the second image frame, thereby improving face tracking efficiency.
[0085] In some embodiments, after obtaining multiple second facial key points through facial key point tracking, the terminal determines whether the multiple second facial key points meet the target condition. In an optional embodiment, in response to the multiple second facial key points meeting the target condition, the terminal displays the target special effect at the face position determined based on the multiple second facial key points; in another optional embodiment, in response to the multiple second facial key points not meeting the target condition, the terminal stops displaying the target special effect. In this embodiment, by setting the target condition, it is ensured that when the target condition is met, the second facial key points obtained by face tracking are determined as the face detection results of the second image frame, thereby improving the accuracy of the special effect display. The following is an explanation of the process of determining whether the multiple second facial key points meet the target condition based on steps 304 to 310:
[0086] 304. For the second facial key point, the terminal obtains a first image feature of the first image frame and a second image feature of the second image frame, the first image feature being an image feature of an area associated with the first facial key point corresponding to the second facial key point, and the second image feature being an image feature of an area associated with the second facial key point.
[0087] In the embodiment of the present application, the first image feature refers to the image feature of the facial key point associated area in the first image frame, and the second image feature refers to the image feature of the facial key point associated area in the second image frame. Optionally, the image feature is any one of a texture feature, a color feature, a shape feature, and a spatial relationship feature.
[0088] In some embodiments, taking the first image feature as an example, the process of the terminal acquiring the first image feature is as follows: the terminal determines the image area including the multiple first facial key points in the first image frame, and determines the image feature of the image area as the first image feature; or, the terminal determines the image area adjacent to the multiple first facial key points in the first image frame, and determines the image feature of the image area as the first image feature. The image area is also an image block. The process of the terminal acquiring the second image feature is similar to the process of acquiring the first image feature, and will not be repeated.
[0089] 305. The terminal determines the image similarity between the first image features and the second image features of the plurality of second facial key points.
[0090] In some embodiments, after obtaining the first image feature of the first image frame and the second image feature of the second image frame, the terminal calculates the distance between the first image feature and the second image feature, and determines the calculated distance as the image similarity between the first image feature and the second image feature.
[0091] In the embodiment of the present application, the image similarity is represented by the distance between the first image feature and the second image feature. Optionally, the distance is any one of cosine distance, Euclidean distance, Manhattan distance, Chebyshev distance, chi-square distance and Hamming distance, and the embodiment of the present application does not limit the selection of the distance. It should be understood that the smaller the distance, the greater the image similarity, and the larger the distance, the smaller the image similarity.
[0092] 306. The terminal determines a target ratio based on the image similarities corresponding to the plurality of second facial key points, where the target ratio is the ratio of the number of second facial key points whose image similarity reaches a first threshold to the total number of second facial key points.
[0093] The first threshold is a preset fixed threshold, such as 0.8. In the embodiment of the present application, if the image similarity reaches the first threshold, it is used to indicate that the facial key points corresponding to the image similarity are correctly tracked; if the image similarity does not reach the first threshold, it is used to indicate that the facial key points corresponding to the image similarity are incorrectly tracked. By setting the first threshold, it is possible to determine whether the facial key points are correctly tracked.
[0094] For example, take key points 1A, 2A and 3A in the first face key points, and key points 1B, 2B and 3B in the second face key points as examples, where key point 1B is a point tracked based on key point 1A, key point 2B is a point tracked based on key point 2A, and key point 3B is a point tracked based on key point 3A. Assuming that the image similarity between key point 1A and key point 1B is 0.5, the image similarity between key point 2A and key point 2B is 0.8, and the image similarity between key point 3A and key point 3B is 0.9. It can be found that if the image similarity between key point 1A and key point 1B does not reach the first threshold of 0.8, key point 1A is tracked incorrectly; if the image similarity between key point 2A and key point 2B reaches the first threshold of 0.8, key point 2A is tracked correctly; if the image similarity between key point 3A and key point 3B reaches the first threshold of 0.8, key point 3A is tracked correctly.
[0095] Correspondingly, the target ratio is the ratio of the number of correctly tracked key points to the total number of key points. Therefore, the target ratio can characterize the tracking accuracy of face key point tracking. The larger the target ratio, the higher the tracking accuracy, and the smaller the target ratio, the lower the tracking accuracy.
[0096] In some embodiments, the terminal determines the number of second facial key points whose image similarities reach a first threshold among the image similarities corresponding to multiple second facial key points, and determines the ratio of this number to the total number of second facial key points as the target ratio.
[0097] 307. In response to the target ratio reaching the ratio threshold, the terminal executes step 308.
[0098] Among them, the ratio threshold is a pre-set percentage threshold, such as 60%. In the embodiment of the present application, the target ratio reaches the ratio threshold, which is used to characterize that the overall tracking of the key points of the face is correct, that is, most of the key points of the face are tracked correctly; the image similarity does not reach the first threshold, which is used to characterize that the overall tracking of the key points of the face is wrong, that is, most of the key points of the face are tracked wrong. By setting the ratio threshold, it is possible to determine whether the key points of the face are tracked correctly as a whole, so as to know the tracking accuracy of the face tracking, and then, when the target ratio reaches the ratio threshold, the subsequent process is executed to ensure that the subsequent process is executed when the key points of the face are tracked correctly as a whole, thereby improving the accuracy of the special effects display.
[0099] The above steps 304 to 307 provide a scheme for determining the effectiveness of tracking. By setting a first threshold and a ratio threshold, it is possible to determine whether any facial key point is tracked correctly and whether multiple facial key points are tracked correctly as a whole, thereby achieving the determination of the effectiveness and accuracy of facial key point tracking.
[0100] 308. The terminal determines the facial similarity between a first facial contour and a second facial contour, wherein the first facial contour is a facial contour corresponding to the plurality of first facial key points, and the second facial contour is a second facial contour corresponding to the plurality of second facial key points.
[0101] In the embodiment of the present application, the first face contour refers to the face contour formed by multiple first face key points in the first image frame; the second face contour refers to the face contour formed by multiple second face key points in the second image frame. In the embodiment of the present application, face similarity refers to the rigid body similarity between the first face contour and the second face contour. Among them, a rigid body refers to an object whose size, shape and relative positions of internal points remain unchanged after being subjected to force. In the embodiment of the present application, rigid body similarity is used to represent the similarity between the size, shape and relative positions of internal points of the two face contours when the first face contour is transformed into the second face contour. It should be understood that the greater the rigid body similarity, the more similar the first face contour and the second face contour are; the smaller the rigid body similarity, the less similar the first face contour and the second face contour are.
[0102] In some embodiments, the terminal inputs the position information of the multiple first facial key points and the multiple second facial key points into a feature extraction network, extracts facial features through the feature extraction network, obtains the first facial features of the first facial contour and the second facial features of the second facial contour, and determines the facial similarity between the first facial contour and the second facial contour based on the first facial features and the second facial features.
[0103] The position information refers to the coordinates of the facial key points in the corresponding image frame, such as the coordinates of the first facial key point in the first image frame and the coordinates of the second facial key point in the second image frame. The coordinates of the facial key points are two-dimensional coordinates, including a horizontal coordinate and a vertical coordinate. The first facial feature and the second facial feature can be in the form of vectors.
[0104] In an embodiment of the present application, the feature extraction network is also a rigid feature extraction network, which is used to extract the rigid features of the facial contour. Optionally, the feature extraction network is a convolutional neural network, which is a type of neural network that includes convolution calculations and has a deep structure. The convolutional neural network includes an input layer, a fusion layer, and a convolution layer. The input layer can perform preprocessing such as de-averaging on the input features to standardize the input features. The fusion layer includes weight parameters corresponding to each input feature, and the input features can be further processed based on the weight parameters. The convolution layer can perform multiple convolution calculations on the input features to obtain output features. Optionally, taking the number of key points of the first face as 106 points as an example, the input features of the feature extraction network are 106*2 dimensions.
[0105] In some embodiments, the process of the terminal determining the facial similarity is: the terminal calculates the distance between the first facial feature and the second facial feature, and determines the calculated distance as the facial similarity between the first facial feature and the second facial feature.
[0106] In the embodiment of the present application, the face similarity is represented by the distance between the first face feature and the second face feature. Optionally, the distance is any one of cosine distance, Euclidean distance, Manhattan distance, Chebyshev distance, chi-square distance and Hamming distance, and the embodiment of the present application does not limit the distance to be selected. It should be understood that the smaller the distance, the greater the face similarity, and the larger the distance, the smaller the face similarity.
[0107] For example, the terminal calculates the cosine similarity between the first facial feature and the second facial feature (that is, calculates the cosine distance between the first facial feature and the second facial feature), and determines the calculated cosine similarity as the facial similarity between the first facial feature and the second facial feature.
[0108] In some embodiments, before inputting the position information into the feature extraction network, the terminal also normalizes the position information of the multiple first facial key points and the position information of the multiple second facial key points to obtain the normalized position information, and then inputs the normalized position information into the feature extraction network to obtain the first facial feature and the second facial feature. In this way, by pre-processing the position information, it is convenient for the subsequent feature extraction network to perform data processing on the input position information, thereby improving the efficiency of feature extraction.
[0109] 309. In response to the face similarity reaching the second threshold, the terminal executes step 310.
[0110] The second threshold is a preset fixed threshold, such as 0.8. In the embodiment of the present application, if the face similarity reaches the second threshold, it is used to indicate that the face tracking is successful; if the face similarity does not reach the second threshold, it is used to indicate that the face tracking fails.
[0111] The above steps 308 to 309 provide a method for determining facial similarity, by determining whether the facial similarity between the facial features of two facial contours reaches a second threshold, thereby ensuring that the subsequent process is executed when the facial similarity is high, thereby improving the accuracy of special effects display.
[0112] 310. The terminal displays the target special effect at the facial position determined based on the multiple second facial key points.
[0113] In some embodiments, the terminal performs curve fitting based on multiple second facial key points in the second image frame to obtain the second facial contour corresponding to the multiple second facial key points, determines the facial position corresponding to the target special effect based on the second facial contour and the special effect parameters of the target special effect, and then displays the target special effect at the facial position of the second image frame. In this way, the continuous display of the target special effect is achieved, the jump of the special effect is reduced, the problem of the special effect jump can be improved, and the special effect experience of the user is enhanced.
[0114] The above steps 304 to 309 are to determine whether the multiple second face key points meet the target condition by first determining whether the image similarity reaches the first threshold, then determining whether the target ratio reaches the ratio threshold, and then determining whether the face similarity reaches the second threshold. In other embodiments, the terminal can also determine whether the multiple second face key points meet the target condition according to one or two of the determination processes, and the corresponding process is as follows:
[0115] In an optional embodiment, steps 306 to 309 are optional steps. Accordingly, after the terminal obtains the image similarities corresponding to the multiple second facial key points, it determines whether the image similarities corresponding to the multiple second facial key points reach the first threshold. In response to the image similarities corresponding to the multiple second facial key points reaching the first threshold, the step of displaying the target special effect at the facial position determined based on the multiple second facial key points is executed. In this embodiment, by judging the image similarities of each facial key point, it is possible to determine whether the multiple second facial key points meet the target conditions, without the need to perform the subsequent process of judging whether the target ratio reaches the ratio threshold and judging whether the facial similarity reaches the second threshold, thereby reducing the processing content of the terminal and improving the processing efficiency of the terminal.
[0116] In another optional embodiment, steps 308 to 309 are optional steps. Accordingly, in response to the target ratio reaching the ratio threshold, the terminal executes the step of displaying the target special effect at the face position determined based on the multiple second face key points. In this embodiment, by judging the target ratio (tracking accuracy) of multiple face key points, it is possible to determine whether the multiple second face key points meet the target conditions, without the need to perform the subsequent process of judging whether the face similarity reaches the second threshold, thereby reducing the processing content of the terminal and improving the processing efficiency of the terminal.
[0117] After step 310, the terminal continues to execute the above process in a loop, that is, the terminal continues to perform face detection on the next image frame collected. In response to successful face detection of the next image frame, the target special effects are displayed based on the detected facial key points. In response to failed face detection of the next image frame, the target special effects are displayed based on the special effects display method shown in steps 303 to 310 above.
[0118] In the above steps 301 to 310, multiple first face key points in the first image frame are used as an example to track the face key points of the second image frame. The second image frame may be an image frame after the first image frame. It should be noted that, in the case where the face detection of the second image frame fails, a selection strategy for the first image frame can also be set as follows:
[0119] In some embodiments, in response to the failure of face detection in the second image frame, the terminal preferentially selects an image frame adjacent to the second image frame, that is, selects the previous image frame of the second image frame, determines the selected image frame as the first image frame, and then performs a subsequent process of tracking facial key points on the second image frame. In this embodiment, by selecting an image frame adjacent to the current image frame to track facial key points on the current image frame, the effectiveness and accuracy of facial key point tracking can be improved due to the large correlation between adjacent image frames.
[0120] In other embodiments, in response to the failure of face detection in the second image frame, the terminal preferentially selects an image frame in which face detection is successful before the second image frame, determines the selected image frame as the first image frame, and then performs a subsequent process of tracking facial key points on the second image frame. Of course, ideally, the terminal selects an image frame adjacent to the second image frame and in which face detection is successful. In this embodiment, facial key points are tracked on the current image frame by selecting an image frame in which face detection is successful before the current image frame. Since the result obtained by face detection is more accurate than the result obtained by face tracking, the accuracy of subsequent special effects display can be improved based on the image frame in which face detection is successful.
[0121] For example, for image frame 1, image frame 2, and image frame 3, it is assumed that face detection of image frame 1 succeeds, face detection of image frame 2 fails, and face detection of image frame 3 fails. Among them, for image frame 2, image frame 1 can be selected to perform face tracking on image frame 2. For image frame 3, image frame 2 adjacent to image frame 3 can be selected to perform face tracking on image frame 3, or image frame 1 with successful face detection before image frame 3 can be selected to perform face tracking on image frame 3.
[0122] In a specific example, in response to a display instruction for a target special effect, the terminal performs face detection on the currently collected image frame to obtain the face key points of the Nth frame (current frame), where N is a positive integer greater than 1; when the face detection of the N+1th frame fails, based on the face key points of the Nth frame, each face key point is tracked, and the image similarity corresponding to each face key point is counted; when the image similarity is greater than a first threshold (such as 0.8), it is recorded as correct tracking, otherwise the tracking is wrong, and the tracking accuracy (target ratio) of all face key points is counted. If the tracking accuracy is greater than the ratio threshold (such as 60%), the key point tracking is successful as a whole; then determine the rigid body similarity (face similarity) between the face contour S0 formed by the face key points of the Nth frame and the face contour S1 formed by the face key points of the N+1th frame. If the rigid body similarity is greater than a second threshold (such as 0.8), it is determined that the face tracking is successful, and the face tracking result is used as the face detection result of the N+1th frame to display the target special effects to ensure the continuous display of the special effects and reduce the problem of special effects jumping; when the face detection of the N+2th frame is successful, the special effects are continued to be displayed based on the detected face key points; and the above process is executed in a loop.
[0123] The technical solution provided in the embodiment of the present application, when displaying special effects in a face image frame, if the current image frame cannot detect a face, the face key points of the current image frame are tracked based on the face key points detected in the previous image frame, so that the face key points of the current image frame can be tracked, and a special effects display method based on face key point tracking is provided. Furthermore, when the face key points corresponding to the image frame meet the target conditions, the special effects are displayed based on the face key points tracked by the face, thereby avoiding the problem of sudden disappearance or deformation of subsequent face special effects due to face detection failure, thereby ensuring the continuous display of special effects.
[0124] Figure 4 is a structural diagram of a special effect display device provided in an embodiment of the present application, see Figure 4 , the device comprises:
[0125] A first display module 401 is used to display a target special effect at a face position of a first image frame in response to a display instruction for a target special effect, where the face position is determined based on a plurality of first face key points, and the plurality of first face key points are obtained based on face detection of the first image frame;
[0126] A tracking module 402 is used for tracking facial key points of the second image frame based on the plurality of first facial key points in response to failure of face detection in the second image frame to obtain a plurality of second facial key points, wherein the second image frame is an image frame subsequent to the first image frame;
[0127] The second display module 403 is used to display the target special effect at the face position determined based on the multiple second face key points in response to the multiple second face key points satisfying the target condition.
[0128] The technical solution provided in the embodiment of the present application, when displaying special effects in a face image frame, if the current image frame cannot detect a face, the face key points of the current image frame are tracked based on the face key points detected in the previous image frame, so that the face key points of the current image frame can be tracked, and a special effects display method based on face key point tracking is provided. Furthermore, when the face key points corresponding to the image frame meet the target conditions, the special effects are displayed based on the face key points tracked by the face, thereby avoiding the problem of sudden disappearance or deformation of subsequent face special effects due to face detection failure, thereby ensuring the continuous display of special effects.
[0129] In some embodiments, the second display module 403 includes:
[0130] An acquisition submodule, for acquiring, for the second facial key point, a first image feature of the first image frame and a second image feature of the second image frame, wherein the first image feature is an image feature of an area associated with the first facial key point corresponding to the second facial key point, and the second image feature is an image feature of an area associated with the second facial key point;
[0131] A determination submodule, used to determine the image similarity between the first image feature and the second image feature of the plurality of second facial key points;
[0132] The display submodule is used to display the target special effect at the face position determined based on the multiple second face key points in response to the image similarities corresponding to the multiple second face key points reaching the first threshold.
[0133] In some embodiments, the determination submodule is further used to determine a target ratio based on the image similarities corresponding to the plurality of second facial key points, the target ratio being the ratio of the number of second facial key points whose image similarities reach a first threshold to the total number of second facial key points;
[0134] The display submodule is also used to execute the step of displaying the target special effect at the face position determined based on the multiple second face key points in response to the target ratio reaching the ratio threshold.
[0135] In some embodiments, the second display module 403 includes:
[0136] a determination submodule, configured to determine a facial similarity between a first face contour and a second face contour, wherein the first face contour is a face contour corresponding to the plurality of first face key points, and the second face contour is a second face contour corresponding to the plurality of second face key points;
[0137] The display submodule is used for displaying the target special effect at the face position determined based on the plurality of second face key points in response to the face similarity reaching a second threshold.
[0138] In some embodiments, the device further includes a feature extraction module, which is used to input the position information of the plurality of first facial key points and the plurality of second facial key points into a feature extraction network, extract facial features through the feature extraction network, and obtain a first facial feature of the first facial contour and a second facial feature of the second facial contour;
[0139] The determination submodule is further used to execute the step of determining the facial similarity between the first facial contour and the second facial contour based on the first facial feature and the second facial feature.
[0140] In some embodiments, the tracking module 402 is used to:
[0141] The multiple first facial key points are input into a face tracking network, and the face key points of the second image frame are tracked by the face tracking network to obtain the multiple second facial key points.
[0142] It should be noted that: the special effect display device provided in the above embodiment only uses the division of the above functional modules as an example when displaying special effects. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the special effect display device provided in the above embodiment and the special effect display method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0143] Figure 5The structure block diagram of a terminal 500 provided by an exemplary embodiment of the present application is shown. The terminal 500 may be: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, Moving Picture Experts Group Audio Layer 3), an MP4 player (Moving Picture Experts Group Audio Layer IV, Moving Picture Experts Group Audio Layer 4), a laptop computer or a desktop computer. The terminal 500 may also be called a user device, a portable terminal, a laptop terminal, a desktop terminal or other names.
[0144] Typically, the terminal 500 includes a processor 501 and a memory 502 .
[0145] The processor 501 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 501 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 501 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 501 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 501 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0146] The memory 502 may include one or more computer-readable storage media, which may be non-transitory. The memory 502 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 502 is used to store at least one program code, which is used to be executed by the processor 501 to implement the content executed by the terminal in the special effect display method provided in the method embodiment of the present application.
[0147] In some embodiments, the terminal 500 may also optionally include: a peripheral device interface 503 and at least one peripheral device. The processor 501, the memory 502 and the peripheral device interface 503 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 503 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 504, a display screen 505, a camera assembly 506, an audio circuit 507, a positioning assembly 508 and a power supply 509.
[0148] The peripheral device interface 503 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 501 and the memory 502. In some embodiments, the processor 501, the memory 502, and the peripheral device interface 503 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 501, the memory 502, and the peripheral device interface 503 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0149] The radio frequency circuit 504 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 504 communicates with the communication network and other communication devices through electromagnetic signals. The radio frequency circuit 504 converts the electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 504 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 504 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: a metropolitan area network, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 504 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.
[0150] The display screen 505 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 505 is a touch display screen, the display screen 505 also has the ability to collect touch signals on the surface or above the surface of the display screen 505. The touch signal can be input to the processor 501 as a control signal for processing. At this time, the display screen 505 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 505 can be one, set on the front panel of the terminal 500; in other embodiments, the display screen 505 can be at least two, respectively set on different surfaces of the terminal 500 or in a folding design; in other embodiments, the display screen 505 can be a flexible display screen, set on a curved surface or a folding surface of the terminal 500. Even, the display screen 505 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 505 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), etc.
[0151] The camera assembly 506 is used to capture images or videos. Optionally, the camera assembly 506 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize the panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 506 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0152] The audio circuit 507 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 501 for processing, or input them into the radio frequency circuit 504 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal 500. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 501 or the radio frequency circuit 504 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 507 may also include a headphone jack.
[0153] The positioning component 508 is used to locate the current geographical location of the terminal 500 to implement navigation or LBS (Location Based Service). The positioning component 508 can be a positioning component based on the US GPS (Global Positioning System), China's Beidou system, Russia's Grenas system or the European Union's Galileo system.
[0154] The power supply 509 is used to power various components in the terminal 500. The power supply 509 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 509 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0155] In some embodiments, the terminal 500 further includes one or more sensors 510 , including but not limited to: an acceleration sensor 511 , a gyroscope sensor 512 , a pressure sensor 513 , a fingerprint sensor 514 , an optical sensor 515 , and a proximity sensor 516 .
[0156] The acceleration sensor 511 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the terminal 500. For example, the acceleration sensor 511 can be used to detect the components of gravity acceleration on the three coordinate axes. The processor 501 can control the display screen 505 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 511. The acceleration sensor 511 can also be used to collect game or user motion data.
[0157] The gyro sensor 512 can detect the body direction and rotation angle of the terminal 500, and the gyro sensor 512 can cooperate with the acceleration sensor 511 to collect the user's 3D actions on the terminal 500. The processor 501 can implement the following functions based on the data collected by the gyro sensor 512: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0158] The pressure sensor 513 can be set on the side frame of the terminal 500 and / or the lower layer of the display screen 505. When the pressure sensor 513 is set on the side frame of the terminal 500, it can detect the user's holding signal of the terminal 500, and the processor 501 performs left and right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 513. When the pressure sensor 513 is set on the lower layer of the display screen 505, the processor 501 controls the operability controls on the UI interface according to the user's pressure operation on the display screen 505. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0159] The fingerprint sensor 514 is used to collect the user's fingerprint, and the processor 501 identifies the user's identity based on the fingerprint collected by the fingerprint sensor 514, or the fingerprint sensor 514 identifies the user's identity based on the collected fingerprint. When the user's identity is identified as a trusted identity, the processor 501 authorizes the user to perform relevant sensitive operations, including unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings. The fingerprint sensor 514 can be set on the front, back, or side of the terminal 500. When a physical button or a manufacturer logo is set on the terminal 500, the fingerprint sensor 514 can be integrated with the physical button or the manufacturer logo.
[0160] The optical sensor 515 is used to collect the ambient light intensity. In one embodiment, the processor 501 can control the display brightness of the display screen 505 according to the ambient light intensity collected by the optical sensor 515. Specifically, when the ambient light intensity is high, the display brightness of the display screen 505 is increased; when the ambient light intensity is low, the display brightness of the display screen 505 is reduced. In another embodiment, the processor 501 can also dynamically adjust the shooting parameters of the camera component 506 according to the ambient light intensity collected by the optical sensor 515.
[0161] The proximity sensor 516, also called a distance sensor, is usually disposed on the front panel of the terminal 500. The proximity sensor 516 is used to collect the distance between the user and the front of the terminal 500. In one embodiment, when the proximity sensor 516 detects that the distance between the user and the front of the terminal 500 is gradually decreasing, the processor 501 controls the display screen 505 to switch from the screen-on state to the screen-off state; when the proximity sensor 516 detects that the distance between the user and the front of the terminal 500 is gradually increasing, the processor 501 controls the display screen 505 to switch from the screen-off state to the screen-on state.
[0162] Those skilled in the art will understand that Figure 5 The structure shown in the figure does not constitute a limitation on the terminal 500, and the terminal 500 may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.
[0163] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including a program code, and the program code can be executed by a processor in a terminal to complete the special effect display method in the above embodiment. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc (Compact-Disc Read-Only Memory), a magnetic tape, a floppy disk, and an optical data storage device.
[0164] A person skilled in the art will appreciate that all or part of the steps for implementing the above embodiments may be accomplished by hardware or by hardware associated with a program code, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0165] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A special effect display method, characterized in that: Executed by a terminal, the method includes: In response to a display instruction for a target special effect, display the target special effect at a face position of a first image frame, the face position being determined based on a plurality of first face key points, the plurality of first face key points being obtained based on face detection of the first image frame; In response to a failure in face detection of the second image frame, inputting the plurality of first face key points into a face tracking network, and tracking the face key points of the second image frame through the face tracking network to obtain a plurality of second face key points, wherein the second image frame is an image frame subsequent to the first image frame; In response to the multiple second facial key points satisfying the target condition, displaying the target special effect at the facial position determined based on the multiple second facial key points, including: determining the facial similarity between a first facial contour and a second facial contour, the first facial contour being the facial contour corresponding to the multiple first facial key points, and the second facial contour being the second facial contour corresponding to the multiple second facial key points; in response to the facial similarity reaching a second threshold, displaying the target special effect at the facial position determined based on the multiple second facial key points.
2. The method according to claim 1, characterized in that Before displaying the target special effect, the method further includes: For the second facial key point, obtaining a first image feature of the first image frame and a second image feature of the second image frame, wherein the first image feature is an image feature of a first facial key point associated region corresponding to the first facial key point, and the second image feature is an image feature of a second facial key point associated region; Determine the image similarity between the first image features and the second image features of the plurality of second facial key points; In response to the image similarities corresponding to the plurality of second facial key points all reaching a first threshold, a step of displaying the target special effect is performed at a facial position determined based on the plurality of second facial key points.
3. The method according to claim 2, characterized in that After determining the image similarity between the first image feature and the second image feature of the plurality of second facial key points, the method further includes: Determine a target ratio based on image similarities corresponding to the plurality of second facial key points, where the target ratio is the ratio of the number of second facial key points whose image similarities reach a first threshold to the total number of second facial key points; In response to the target ratio reaching a ratio threshold, the step of displaying the target special effect at the face position determined based on the plurality of second face key points is performed.
4. The method according to claim 1, characterized in that Before determining the facial similarity between the first facial contour and the second facial contour, the method further includes: Inputting the position information of the plurality of first facial key points and the plurality of second facial key points into a feature extraction network respectively, extracting facial features through the feature extraction network to obtain first facial features of the first facial contour and second facial features of the second facial contour; Based on the first facial feature and the second facial feature, the step of determining the facial similarity between the first facial contour and the second facial contour is performed.
5. A special effect display device, characterized in that: The device comprises: A first display module, configured to display a target special effect at a face position of a first image frame in response to a display instruction for the target special effect, wherein the face position is determined based on a plurality of first face key points, and the plurality of first face key points are obtained based on face detection of the first image frame; A tracking module, configured to input the plurality of first face key points into a face tracking network in response to failure of face detection in the second image frame, and track the face key points of the second image frame through the face tracking network to obtain a plurality of second face key points, wherein the second image frame is an image frame subsequent to the first image frame; A second display module, configured to display the target special effect at a face position determined based on the plurality of second face key points in response to the plurality of second face key points satisfying a target condition; The second display module is specifically used to determine the facial similarity between a first facial contour and a second facial contour, the first facial contour being the facial contour corresponding to the multiple first facial key points, and the second facial contour being the second facial contour corresponding to the multiple second facial key points; in response to the facial similarity reaching a second threshold, displaying the target special effect at the facial position determined based on the multiple second facial key points.
6. The device according to claim 5, characterized in that The second display module further includes: an acquisition submodule, configured to acquire, for the second facial key point, a first image feature of the first image frame and a second image feature of the second image frame, wherein the first image feature is an image feature of an area associated with a first facial key point corresponding to the first facial key point, and the second image feature is an image feature of an area associated with the second facial key point; a determination submodule, configured to determine image similarities between the first image features and the second image features of a plurality of the second facial key points; The display submodule is used for executing the step of displaying the target special effect at the face position determined based on the plurality of second face key points in response to the image similarities corresponding to the plurality of second face key points all reaching a first threshold.
7. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one program code, and the at least one program code is loaded and executed by the processor to implement the special effect display method according to any one of claims 1 to 4.
8. A computer-readable storage medium, characterized in that: At least one program code is stored in the computer-readable storage medium, and the at least one program code is loaded and executed by the processor to implement the special effect display method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Method and device for generating special effect video
CN109754383A
Method and device for acquiring position of face part, electronic device and storage medium
CN110263695A
High-speed face searching method for attendance
CN110728225A
Method, device and equipment for processing live broadcast cute face gift and storage medium
CN110933454A
Video special effect processing method and device, terminal and storage medium
CN111753784A
