Face matching methods, devices, equipment and media
By obtaining and calculating user face features and filtering similar videos in the video library, the problem of inaccurate face matching in the existing technology is solved, the user experience is improved, and the video characters after face change are closer to the user's face.
Patent Information
- Application Number
- CN201910526561.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-06-18
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2040-06-13
AI Technical Summary
The existing face image changing technology cannot effectively match the user's face characteristics, resulting in too large differences between the video characters and the user's faces after the face change, and the user's experience is low.
By obtaining the user's face image, extracting face features, calculating the face similarity and hairstyle similarity to each video in the video library, and filtering the target video based on the consistency of gender characteristics, improving the accuracy of face matching in the video library sex.
It improves user experience, makes the video characters after face change closer to the user's face, and enhances user satisfaction.
Smart Images

Figure CN112101072B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of face replacement, and in particular to a face matching method, device, equipment and medium. Background Art
[0002] Face conversion is a popular application in the field of computer vision. Face conversion can generally be used for video synthesis, providing privacy services, portrait replacement or other innovative applications.
[0003] Currently, the face of a user in a video is too different from the user's face after it is replaced. It is impossible to recommend videos corresponding to faces that are closer to the user's face based on the user's facial features, resulting in a very low user experience. Summary of the invention
[0004] The embodiments of the present invention provide a face matching method, device, equipment and medium, which can filter out videos corresponding to faces similar to a user in a video library, so that the characters in the video after the face change are closer to the user's face, thereby improving the user experience.
[0005] In a first aspect, an embodiment of the present invention provides a face matching method, the method comprising:
[0006] Get the user's face image;
[0007] Extracting user's facial features from the face image;
[0008] Calculate the facial similarity between the user's face and the face in each video based on the user's facial features and the video facial features corresponding to each video in the pre-stored video library;
[0009] Using facial images to identify the gender characteristics of the user and the characteristics of the user's hairstyle;
[0010] Calculate the hairstyle similarity between the user's hairstyle features and the hairstyle features of the characters in each video;
[0011] According to the face similarity and the hairstyle similarity, a target video corresponding to the user is screened in the video library, wherein the gender characteristics of the characters in the target video are consistent with the gender characteristics of the user.
[0012] In a second aspect, an embodiment of the present invention provides a face matching device, the device comprising:
[0013] An acquisition module is used to acquire a user's face image;
[0014] An extraction module, used for extracting the user's facial features from the facial image;
[0015] A first calculation module, used to calculate the facial similarity between the user's face and the face in each video according to the user's facial features and the video facial features corresponding to each video in the pre-stored video library;
[0016] A recognition module, used to recognize the gender characteristics and hairstyle characteristics of a user using a face image;
[0017] The second calculation module is used to calculate the hairstyle similarity between the hairstyle features of the user and the hairstyle features of the characters in each video;
[0018] The selection module is used to screen a target video corresponding to the user in the video library according to the face similarity and the hairstyle similarity, wherein the gender characteristics of the characters in the target video are consistent with the gender characteristics of the user.
[0019] In a third aspect, an embodiment of the present invention provides a computer device, comprising: at least one processor, at least one memory, and computer program instructions stored in the memory, and when the computer program instructions are executed by the processor, the method of the first aspect is implemented.
[0020] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having computer program instructions stored thereon, wherein the method of the first aspect is implemented when the computer program instructions are executed by a processor.
[0021] The face matching method, device, equipment and medium provided by the embodiment of the present invention obtain the face image of the user; extract the face features of the user from the face image; calculate the face similarity between the face of the user and the face in each video according to the face features of the user and the face features of the video corresponding to each video in the pre-stored video library; use the face image to identify the gender features of the user and the hairstyle features of the user; calculate the hairstyle similarity between the hairstyle features of the user and the hairstyle features of the characters in each video; and select the target video corresponding to the user in the video library according to the face similarity and the hairstyle similarity, wherein the gender features of the characters in the target video are consistent with the gender features of the user. The embodiment of the present invention can select the video corresponding to the face similar to the user in the video library, so that the characters in the video after the face change are closer to the user's face, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solution of the embodiment of the present invention, the following briefly introduces the drawings required for use in the embodiment of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0023] Figure 1 A flow chart of a face matching method provided according to some embodiments of the present invention is shown;
[0024] Figure 2 A schematic structural diagram of a face matching device provided according to some embodiments of the present invention is shown;
[0025] Figure 3 A schematic diagram of the structure of a computing device provided according to some embodiments of the present invention is shown. DETAILED DESCRIPTION
[0026] The features and exemplary embodiments of various aspects of the present invention will be described in detail below. In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and Examples. It should be understood that the specific embodiments described herein are only configured to explain the present invention and are not configured to limit the present invention. For those skilled in the art, the present invention can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present invention by illustrating examples of the present invention.
[0027] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0028] See also Figure 1 As shown, an embodiment of the present invention provides a face matching method, which includes: S101-S106.
[0029] S101: Acquire a user's face image.
[0030] During specific implementation, the user's facial image can be a picture taken by the user using a terminal, or it can be a picture uploaded by the user before recording a face-changing video.
[0031] S102: Extracting facial features of the user from the facial image.
[0032] In a specific implementation, the user's facial features include the shape and position of the user's facial features. For example, a 3D morphable model (3DMM) can be used to extract feature point coordinates from the user's facial image. The extracted facial features can be a 1×P-dimensional vector, where P is an integer greater than 1.
[0033] S103: Calculate the facial similarity between the user's face and the face in each video based on the user's facial features and the video facial features corresponding to each video in the pre-stored video library.
[0034] In the specific implementation, the video face features corresponding to each video in the video library are pre-extracted, and the extracted video face features are converted into video feature vectors for storage. For example, if the total number of videos in the video library is M, then the video feature vector is M×P. The face similarity between the face features and the face in each video is calculated. For example, if the face features are 1×P dimensional vectors, and the face features of M videos are M×P dimensional vectors, then 1×P×(M×P) is calculated. T A 1×M-dimensional feature vector is obtained, which represents the facial similarities of M individuals. The facial similarities of M individuals correspond to the M videos one by one, that is, it represents the facial similarities of the user's face and the faces of the M videos.
[0035] In some embodiments, videos in which the facial similarity between the M video faces and the user's face is greater than a first preset value can be recommended to the user for face swapping.
[0036] S104: Using the facial image to identify the gender characteristics of the user and the hairstyle characteristics of the user.
[0037] During specific implementation, the user's gender characteristics and the user's hairstyle characteristics are identified based on the face image. For example, the user's hairstyle style, hair length, hair curl, hair color, and bangs shape are all the user's hairstyle characteristics.
[0038] S105: Calculate the hairstyle similarity between the hairstyle features of the user and the hairstyle features of the characters in each video.
[0039] During specific implementation, the hairstyle similarity between the hairstyle features of the user and the hairstyle features of the characters in each video is calculated.
[0040] In some embodiments, the hairstyle features include N types of hairstyle features, and the hairstyle features of the characters in each video in the video library include N types of hairstyle features. For each video, the hairstyle similarity between the user's hairstyle features and the hairstyle features of the characters in the first video is calculated by the following steps, wherein the first video is any video in the video library: traverse each of the N types and take each type as a type to be processed; calculate the hairstyle similarity between the hairstyle features of the user's type to be processed and the hairstyle features of the type to be processed of the characters in the first video.
[0041] For example, N hairstyle features include hairstyle style, hair length, hair curl, hair color, and bangs shape. The hairstyle similarity between the hairstyle features of the user's to-be-processed type and the hairstyle features of the character in the first video is calculated as follows:
[0042] The similarity between the hairstyle of the user and the hairstyle of the character in the first video is calculated as the hairstyle similarity of the first video.
[0043] The similarity between the hair length of the user and the hair length of the character in the first video is calculated as the hair length similarity of the first video.
[0044] The similarity between the hair curl of the user and the hair curl of the character in the first video is calculated as the hair curl similarity of the first video.
[0045] The similarity between the hair color of the user and the hair color of the character in the first video is calculated as the hair color similarity of the first video.
[0046] The similarity between the bangs shape of the user and the bangs shape of the characters in the first video library is calculated as the hair color similarity of the first video.
[0047] S106: Filtering a target video corresponding to the user in the video library according to the face similarity and the hairstyle similarity, wherein the gender characteristics of the characters in the target video are consistent with the gender characteristics of the user.
[0048] After calculating the hairstyle similarity between the hairstyle features of the type to be processed, the following two methods are used to screen the target video corresponding to the user in the video library through the hairstyle similarity and face similarity.
[0049] First:
[0050] Select videos with face similarity greater than a first preset value in the video library as the second video set, traverse each video in the video library, and take each video as the first video. If the hairstyle style similarity of the first video, the hair length similarity of the first video, the hair curl similarity of the first video, the hair color similarity of the first video, and the bangs shape similarity of the first video are all greater than the second preset value, then add the first video to the first video set. After traversing each video, take the intersection of the second video set and the first video set, select the target video from the videos in the intersection, and recommend the target video to the user.
[0051] Second:
[0052] For any video in the video library, a similarity calculation model is used to perform weighted summation on the face similarity of the first video, the hairstyle style similarity of the first video, the hair length similarity of the first video, the hair curl similarity of the first video, the hair color similarity of the first video, and the bangs shape similarity of the first video to obtain a comprehensive similarity between the user and the character in the first video, and each video is traversed to obtain a comprehensive similarity between the user and the character in each video; a target video whose comprehensive similarity is greater than a third preset value is screened in the video library, and the target video is recommended to the user.
[0053] Here, the gender characteristics of the characters in all target videos are consistent with the gender characteristics of the user. Gender characteristics can be identified through facial images, and the gender of the user can be identified based on the user's facial features and hairstyle features, or by collecting user information and marking the gender characteristics of the user's corresponding account.
[0054] In some embodiments, the face matching method provided by the embodiment of the present invention further includes training a similarity calculation model, specifically including:
[0055] A sample face image is obtained, and a plurality of models to be trained are used to respectively calculate the similarity and face similarity between the sample face image and the hairstyle features of the person corresponding to each video. The model to be trained includes a plurality of parameters, and each parameter corresponds to the face similarity and the hairstyle similarity one to one, that is, the weight corresponding to the face similarity and the hairstyle similarity. Here, a plurality of groups of parameters are preset, that is, a plurality of models to be trained are preset. For each model to be trained, a video whose face similarity is greater than a first preset value and whose hairstyle features are greater than a second preset value is selected; the sample face image is swapped onto the face of the person corresponding to the selected video using a face swap model to obtain a plurality of target face images; the face swap model can be a Generative Adversarial Networks (GAN) or a CycleGAN. The sample face image and multiple target face images are input into the face recognition model, and the similarity between the sample face image and the multiple target face images is calculated; the average value of the similarity of the multiple target face images corresponding to each model to be trained is calculated; and the model to be trained corresponding to the highest average value is selected as the similarity calculation model.
[0056] The face matching method provided by the embodiment of the present invention obtains the face image of the user; extracts the face features of the user from the face image; calculates the face similarity between the face of the user and the face in each video according to the face features of the user and the face features of the video corresponding to each video in the pre-stored video library; uses the face image to identify the gender features of the user and the hairstyle features of the user; calculates the hairstyle similarity between the hairstyle features of the user and the hairstyle features of the characters in each video; and selects the target video corresponding to the user in the video library according to the face similarity and the hairstyle similarity, wherein the gender features of the characters in the target video are consistent with the gender features of the user. The embodiment of the present invention can select videos corresponding to faces similar to the user in the video library, so that the characters in the video after the face change are closer to the user's face, thereby improving the user experience.
[0057] See also Figure 2 As shown, an embodiment of the present invention provides a face matching device, the device comprising:
[0058] An acquisition module 201 is used to acquire a user's face image;
[0059] Extraction module 202, used to extract the user's facial features from the facial image;
[0060] A first calculation module 203, used to calculate the facial similarity between the user's face and the face in each video according to the user's facial features and the video facial features corresponding to each video in the pre-stored video library;
[0061] Recognition module 204, used to recognize the gender characteristics of the user and the hairstyle characteristics of the user using the face image;
[0062] The second calculation module 205 is used to calculate the hairstyle similarity between the hairstyle feature of the user and the hairstyle feature of the character in each video;
[0063] The selection module 206 is used to select a target video corresponding to the user in the video library according to the face similarity and the hairstyle similarity, wherein the gender characteristics of the characters in the target video are consistent with the gender characteristics of the user.
[0064] In some embodiments, the hairstyle features of the user include N types of hairstyle features, the hairstyle features of the characters in each video include N types of hairstyle features, the total number of videos in the video library is M, and M and N are integers greater than 1 respectively;
[0065] The second calculation module 205 is used to calculate the hairstyle similarity between the hairstyle feature of the user and the hairstyle feature of the character in each video, including:
[0066] The hairstyle similarity between the hairstyle feature of the user and the hairstyle feature of the character in the first video is calculated by the following steps:
[0067] Traverse each type of N types and take each type as a type to be processed;
[0068] The hairstyle similarity between the hairstyle features of the user's to-be-processed type and the hairstyle features of the to-be-processed type of the person in the first video is calculated; wherein the first video is any video in the video library.
[0069] In some embodiments, the N types of hairstyle features include: hairstyle style, hair length, hair curl, hair color, and bangs shape;
[0070] The second calculation module 205 is specifically used to calculate the hairstyle similarity between the hairstyle feature of the to-be-processed type of the user and the hairstyle feature of the to-be-processed type of the character in the first video, including:
[0071] Calculate the similarity between the hairstyle of the user and the hairstyle of the character in the first video as the hairstyle similarity of the first video;
[0072] Calculate the similarity between the hair length of the user and the hair length of the character in the first video as the hair length similarity of the first video;
[0073] Calculate the similarity between the hair curl of the user and the hair curl of the character in the first video as the hair curl similarity of the first video;
[0074] Calculate the similarity between the hair color of the user and the hair color of the character in the first video as the hair color similarity of the first video;
[0075] The similarity between the user's bangs shape and the character's bangs shape in the first video is calculated as the hair color similarity of the first video.
[0076] The selection module 206 is used to select a target video corresponding to the user in the video library according to the face similarity and the hairstyle similarity, including:
[0077] Selecting videos with face similarity greater than a first preset value in the video library to form a second video set;
[0078] Traversing each video, taking each video as the first video, if the similarity of the hairstyle style of the first video, the similarity of the hair length of the first video, the similarity of the hair curl of the first video, the similarity of the hair color of the first video, and the similarity of the bangs shape of the first video are all greater than a second preset value, then adding the first video to the first video set;
[0079] After traversing each video, the intersection of the second video set and the first video set is obtained, and the target video is selected from the videos in the intersection.
[0080] In some embodiments, the face similarity includes the face similarity of the first video, the face similarity of the first video being the face similarity between the user's face and the face in the first video;
[0081] The selection module 206 is used to select a target video corresponding to the user in the video library according to the face similarity and the hairstyle similarity, including:
[0082] Using a similarity calculation model, weighted summation is performed on the face similarity of the first video, the hairstyle style similarity of the first video, the hair length similarity of the first video, the hair curl similarity of the first video, the hair color similarity of the first video, and the bangs shape similarity of the first video to obtain a comprehensive similarity between the user and the person in the first video;
[0083] Traverse each video and obtain the comprehensive similarity between the user and the characters in each video;
[0084] Target videos whose comprehensive similarity is greater than a third preset value are selected in the video library.
[0085] In some embodiments, it also includes: a training module 207, used to train a similarity calculation model;
[0086] The training module 207, used for training the similarity calculation model, includes:
[0087] Get sample face images.
[0088] Use multiple models to be trained to calculate the similarity between the sample face image and the hairstyle features and face similarity of the corresponding person in each video.
[0089] For each model to be trained, a video is selected whose face similarity is greater than a first preset value and whose hairstyle feature similarity is greater than a second preset value.
[0090] The face swap model is used to swap the sample face image onto the face of the corresponding person in the selected video to obtain multiple target face images.
[0091] The sample face image and multiple target face images are input into the face recognition model, and the similarity between the sample face image and the multiple target face images is calculated.
[0092] Calculate the average value of the similarities of multiple target face images corresponding to each model to be trained;
[0093] The model to be trained corresponding to the highest average value is selected as the similarity calculation model.
[0094] In some embodiments, it further includes a recommendation module 208;
[0095] The recommendation module 208 is used to recommend the target video to the user.
[0096] In addition, combined Figure 1 The face matching method of the described embodiment of the present invention may be implemented by a computing device. Figure 3 A schematic diagram of the hardware structure of a computing device provided by an embodiment of the present invention is shown.
[0097] The computing device may include a processor 301 and a memory 302 storing computer program instructions.
[0098] Specifically, the processor 301 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiment of the present invention.
[0099] The memory 302 may include a large capacity memory for data or instructions. For example, but not limitation, the memory 302 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 302 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 302 may be inside or outside the data processing device. In a specific embodiment, the memory 302 is a non-volatile solid-state memory. In a specific embodiment, the memory 302 includes a read-only memory (ROM). In appropriate cases, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM) or a flash memory or a combination of two or more of these.
[0100] The processor 301 implements any one of the face matching methods in the above embodiments by reading and executing computer program instructions stored in the memory 302 .
[0101] In one example, the computing device may further include a communication interface 303 and a bus 310. Figure 3 As shown, the processor 301, the memory 302, and the communication interface 303 are connected via a bus 310 and communicate with each other.
[0102] The communication interface 303 is mainly used to implement the communication between the modules, devices, units and / or equipment in the embodiment of the present invention.
[0103] Bus 310 includes hardware, software or both, and the components of computing devices are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 310 may include one or more buses. Although the embodiment of the present invention describes and shows a specific bus, the present invention considers any suitable bus or interconnection.
[0104] In addition, in combination with the face matching method in the above embodiment, the embodiment of the present invention can provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any one of the face matching methods in the above embodiment is implemented.
[0105] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present invention.
[0106] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0107] It should also be noted that the exemplary embodiments mentioned in the present invention describe some methods or systems based on a series of steps or devices. However, the present invention is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiments, or in a different order from the embodiments, or several steps can be performed simultaneously.
[0108] The above is only a specific implementation of the present invention. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the system, module and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. It should be understood that the protection scope of the present invention is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be covered within the protection scope of the present invention.
Claims
1. A face matching method, characterized in that: The method comprises: Get the user's face image; Extracting facial features of the user from the facial image; Calculate the facial similarity between the user's face and the face in each video according to the facial features of the user and the video facial features corresponding to each video in the pre-stored video library, wherein the hairstyle style, hair length, hair curl, hair color, and bangs shape of the user are all hairstyle features of the user; Using the facial image to identify the gender characteristics of the user and the hairstyle characteristics of the user; Calculating the hairstyle similarity between the hairstyle feature of the user and the hairstyle feature of the character in each video; According to the face similarity and the hairstyle similarity, selecting a target video corresponding to the user in the video library, wherein the gender characteristics of the characters in the target video are consistent with the gender characteristics of the user; The hairstyle features of the user include N types of hairstyle features, the hairstyle features of the characters in each video include the N types of hairstyle features, the total number of videos in the video library is M, and M and N are integers greater than 1 respectively; The calculating the hairstyle similarity between the hairstyle feature of the user and the hairstyle feature of the character in each video includes: The hairstyle similarity between the hairstyle feature of the user and the hairstyle feature of the character in the first video is calculated by the following steps: Traverse each type of the N types and take each type as a type to be processed; Calculate the hairstyle similarity between the hairstyle features of the user's to-be-processed type and the hairstyle features of the to-be-processed type of the person in the first video; wherein the first video is any video in the video library.
2. The method according to claim 1, characterized in that The N types of hairstyle features include: hairstyle style, hair length, hair curl, hair color, and bangs shape; The calculating the hairstyle similarity between the hairstyle feature of the to-be-processed type of the user and the hairstyle feature of the to-be-processed type of the person in the first video includes: Calculating the similarity between the hairstyle of the user and the hairstyle of the character in the first video as the hairstyle similarity of the first video; Calculating the similarity between the hair length of the user and the hair length of the character in the first video as the hair length similarity of the first video; Calculating the similarity between the hair curl of the user and the hair curl of the character in the first video as the hair curl similarity of the first video; Calculating the similarity between the hair color of the user and the hair color of the character in the first video as the hair color similarity of the first video; The similarity between the bangs shape of the user and the bangs shape of the character in the first video is calculated as the hair color similarity of the first video.
3. The method according to claim 2, characterized in that The step of selecting a target video corresponding to the user in the video library according to the face similarity and the hairstyle similarity includes: Selecting videos whose face similarity is greater than a first preset value from the video library to form a second video set; Traversing each of the videos, taking each of the videos as the first video, and if the similarity of the hairstyle style of the first video, the similarity of the hair length of the first video, the similarity of the hair curl of the first video, the similarity of the hair color of the first video, and the similarity of the bangs shape of the first video are all greater than a second preset value, then adding the first video to the first video set; After traversing each of the videos, the intersection of the second video set and the first video set is obtained, and the target video is selected from the videos in the intersection.
4. The method according to claim 2, characterized in that: The face similarity includes the face similarity of the first video, and the face similarity of the first video is the face similarity between the face of the user and the face in the first video; The step of selecting a target video corresponding to the user in the video library according to the face similarity and the hairstyle similarity includes: Using a similarity calculation model, weighted sum is performed on the face similarity of the first video, the hairstyle style similarity of the first video, the hair length similarity of the first video, the hair curl similarity of the first video, the hair color similarity of the first video, and the bangs shape similarity of the first video to obtain a comprehensive similarity between the user and the person in the first video; Traversing each of the videos to obtain a comprehensive similarity between the user and the characters in each of the videos; The target video whose comprehensive similarity is greater than a third preset value is selected in the video library.
5. The method according to claim 4, characterized in that The method further comprises: training the similarity calculation model; The training of the similarity calculation model comprises: Get a sample face image; Using a plurality of models to be trained, respectively calculating the similarity between the sample face image and the hairstyle features and the face similarity between the corresponding characters in each video; For each model to be trained, select a video whose face similarity is greater than a first preset value and whose hairstyle feature similarity is greater than a second preset value; Using a face swap model to swap the sample face image onto the face of a person corresponding to the selected video, to obtain a plurality of target face images; Inputting the sample face image and the multiple target face images into a face recognition model, and calculating the similarity between the sample face image and the multiple target face images; Calculating the average value of the similarities of the multiple target face images corresponding to each to-be-trained model; The model to be trained corresponding to the highest average value is selected as the similarity calculation model.
6. The method according to claim 1, characterized in that The method further comprises: The target video is recommended to the user.
7. A face matching device, characterized in that: The device comprises: An acquisition module is used to acquire a user's face image; An extraction module, used to extract the facial features of the user from the facial image; A first calculation module is used to calculate the facial similarity between the face of the user and the face in each video according to the facial features of the user and the video facial features corresponding to each video in the pre-stored video library, wherein the hairstyle style, hair length, hair curl, hair color, and bangs shape of the user are all hairstyle features of the user; A recognition module, used to recognize the gender characteristics of the user and the hairstyle characteristics of the user by using the face image; A second calculation module, used for calculating the hairstyle similarity between the hairstyle feature of the user and the hairstyle feature of the character in each video; A selection module, for screening a target video corresponding to the user in the video library according to the face similarity and the hairstyle similarity, wherein the gender characteristics of the characters in the target video are consistent with the gender characteristics of the user; The hairstyle features of the user include N types of hairstyle features, the hairstyle features of the characters in each video include the N types of hairstyle features, the total number of videos in the video library is M, and M and N are integers greater than 1 respectively; The second calculation module is used to calculate the hairstyle similarity between the hairstyle feature of the user and the hairstyle feature of the character in each video, including: The hairstyle similarity between the hairstyle feature of the user and the hairstyle feature of the character in the first video is calculated by the following steps: Traverse each type of the N types and take each type as a type to be processed; Calculate the hairstyle similarity between the hairstyle features of the user's to-be-processed type and the hairstyle features of the to-be-processed type of the person in the first video; wherein the first video is any video in the video library.
8. A computing device, characterized in that include: At least one processor, at least one memory and computer program instructions stored in the memory, when the computer program instructions are executed by the processor, implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.
