A Personal Image Recommendation Method and System Based on Facial Recognition and Data Processing

Through the method of combining face alignment program and autoencoder, accurate face features are extracted and clustered recommendations are performed through graph structures, which solves the problem of inaccurate feature extraction caused by faces not being in the center of the image or being side faces in the prior art, and improves the accuracy of makeup recommendations and the convenience of data set collection.

CN116127114BActive Publication Date: 2025-05-27ZHIFU TECH (FUJIAN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310078251.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-08
Publication Date
2025-05-27
Estimated Expiration
2043-02-08

AI Technical Summary

Technical Problem

The existing makeup recommendation method is inaccurate in feature extraction because the face is not in the center of the image or is a side face, and the image data is required to be trimmed, which increases the difficulty of collecting data sets.

Method used

The facial facial features mask is obtained through the face alignment program, and the facial features mask is used as an attention map to guide the training of the autoencoder, extract more accurate facial features, and construct the features between the user's face and the makeup face dataset through the graph structure for clustering recommendations.

Benefits of technology

It improves the accuracy of feature extraction and the accuracy of makeup recommendations, and reduces the difficulty of data collection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116127114B_ABST
    Figure CN116127114B_ABST
Patent Text Reader

Abstract

The present invention provides a personal image recommendation method based on facial recognition and data processing. The facial features of a user are obtained through an autoencoder according to the user's face and mask. An undirected weighted graph is constructed based on the facial features of the user and the facial image features in the database of made-up face data sets. A graph clustering algorithm is used to obtain the makeup recommended for the user. This method uses a face mask as an attention map, and the attention map guides the autoencoder to pay more attention to the facial feature regions, making the facial features output by the autoencoder more suitable for makeup recommendation. At the same time, a graph structure is used to construct the relationship between the user's face and the made-up face features in the database, which can further improve the accuracy of the recommendation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of intelligent terminals, and particularly relates to a personal image recommendation method and system based on face recognition and data processing. Background Art

[0002] The theory of deep learning has been widely applied to the field of video image processing, and convolutional neural networks have good effects on image feature extraction. In current makeup recommendation methods, autoencoders are used for feature extraction and then makeup matching recommendations are made. Since general autoencoders regard all pixels in an image as equally important, when the face is not at the center of the image or the face in the image is a profile face, the obtained features often cannot well represent the face, and the feature extraction and makeup recommendation are inaccurate. Therefore, in current makeup recommendation methods, especially for the feature extraction of facial features, in order to ensure the accuracy of feature extraction and thus the accuracy of makeup recommendation, it is often necessary to crop the picture data, which makes it very inconvenient to collect the data set. Summary of the Invention

[0003] Embodiments of the present invention provide a personal image recommendation method and system based on face recognition and data processing to solve the problems existing in the prior art.

[0004] To achieve the above object, the technical solution of the present invention is implemented as follows:

[0005] The present invention provides a personal image recommendation method based on face recognition and data processing, the method comprising the following steps:

[0006] S11: Obtain a strip-shaped face picture and construct a data set of the strip-shaped face;

[0007] S12: Obtain a facial feature mask of the face with makeup according to the data set of the face with makeup;

[0008] S13: Obtain the face feature of the face with makeup through a trained autoencoder according to the data set of the face with makeup and the facial feature mask of the face with makeup;

[0009] S14: Obtain a facial feature mask of the front of the user's face according to a photo of the user's face;

[0010] S15: Obtain the user's face feature through a trained autoencoder according to the photo of the user's face and the facial feature mask of the user's face;

[0011] S16: Construct a graph structure according to the face feature of the face with makeup and the user's face feature;

[0012] S17: Initialize the clustering list with the user's facial features. Select one of the made-up facial features with the highest module gain with respect to the user's facial feature module according to the graph structure, and add it to the clustering list. Each made-up facial feature in the clustering list corresponds to a makeup look recommended to the user.

[0013] S18: Combine all the nodes in the clustering list into a new supernode, and calculate the module gain between the supernode and the remaining nodes. The remaining nodes are the nodes that have not been combined into the supernode.

[0014] S19: Among the remaining nodes, add the node with the highest module gain with respect to the supernode to the clustering list. Repeat steps S18 and S19 until the number of nodes in the clustering list reaches the threshold α.

[0015] S110: If the number of nodes in the clustering list reaches the threshold α, recommend the makeup looks corresponding to the made-up facial features stored in the nodes of the clustering list to the user in order. If the user is not satisfied with a makeup look, recommend the next makeup look corresponding to the made-up facial feature stored in the node of the clustering list. If the user selects a makeup look, exit the recommendation. If the user does not select any makeup look in the clustering list, return to step S18.

[0016] S111: If the number of nodes in the clustering list does not reach the threshold α, return to step S18.

[0017] In some embodiments, constructing the graph structure according to the made-up facial features and the user's facial features includes:

[0018] In response to the similarity between the made-up facial feature and the user's facial feature being greater than the threshold θ, connect the corresponding nodes with an edge to construct the graph structure. The nodes of the graph structure are facial features.

[0019] In some embodiments, obtaining the facial feature masks of the made-up face according to the dataset of the made-up face includes:

[0020] According to the dataset of the made-up face, obtain the facial feature masks of the made-up face according to the calculation strategy of the face alignment program.

[0021] Obtaining the facial feature masks of the front of the user's face according to the photo of the user's face includes:

[0022] Obtain a photo of the user's face, and according to the photo of the user's face, obtain the facial feature masks of the user's face according to the calculation strategy of the face alignment program.

[0023] Based on the facial feature mask of the user's face, determine whether the photo of the user's face is a frontal view or a side view;

[0024] In response to the photo of the user's face being a side view, obtain the photo of the user's face again.

[0025] In some embodiments, forming a new supernode from all the nodes in the clustering list includes:

[0026] Taking the edges and the weights of the edges between all the nodes in the clustering list and other nodes as the edges and the weights of the edges of a new node, thereby forming a new supernode.

[0027] In some embodiments, the autoencoder model includes an encoding part and a decoding part. The encoding part is used to extract facial features, and the decoding part is used to restore the face according to the facial features extracted by the encoding part.

[0028] In some embodiments, the autoencoder model is composed of a convolutional neural network and is trained in a supervised training manner. The training steps of the autoencoder model include:

[0029] Concatenate the attention map and the features output by the first-layer convolution in the channel dimension. Specifically, Feature 2 = G 2 (concat(G 1 (image), attention)), where Feature 2 is the feature output after the second-layer convolution, concat represents concatenation in the channel dimension, G 1 and G 2 represent the first-layer convolution and the second-layer convolution respectively, image represents the pixels of the face image used to train the autoencoder model, attention represents the attention map, and the loss function is the mean square error between the face image output by the decoding part and the original input face image.

[0030] In some embodiments, obtaining the photo of the user's face includes:

[0031] Using the camera of the mobile device to obtain the photo of the user's face.

[0032] The present invention also provides a personal image recommendation system based on facial recognition and data processing, including:

[0033] An acquisition and construction module, configured to acquire face-with-makeup images and construct a dataset of the face with makeup;

[0034] A first determination module, configured to obtain the facial feature mask of the face with makeup according to the dataset of the face with makeup;

[0035] A second determination module, configured to obtain the made-up face features according to the dataset of the made-up face and the facial feature masks of the made-up face according to the calculation strategy of the autoencoder model;

[0036] A third determination module, configured to obtain the facial feature masks of the front face of the user according to the photo of the user's face;

[0037] A fourth determination module, configured to obtain the user's face features according to the photo of the user's face and the facial feature masks of the user's face according to the calculation strategy of the autoencoder model;

[0038] A first construction module, configured to construct a graph structure according to the made-up face features and the user's face features;

[0039] A second construction module, configured to construct a clustering list according to one of the made-up face features with the largest module gain in the graph structure and the user's face features, wherein each of the made-up face features in the clustering list corresponds to a makeup recommended to the user;

[0040] A module gain calculation module, configured to form all nodes in the clustering list into a new supernode, and calculate the module gain between the supernode and the remaining nodes, wherein the remaining nodes are the nodes that have not formed the supernode;

[0041] An addition module, configured to add, among the remaining nodes, the node with the largest module gain with the supernode to the clustering list;

[0042] A recommendation judgment module, configured to, if the number of nodes in the clustering list reaches a threshold α, recommend the makeup corresponding to the made-up face features stored in the nodes in the clustering list to the user in sequence. If the user is not satisfied with the makeup, recommend the next makeup corresponding to the made-up face features stored in the nodes in the clustering list. If the user selects a certain makeup, the recommendation is exited. If the user does not select any makeup in the clustering list, return to step S18;

[0043] A judgment module, configured to, if the number of nodes in the clustering list does not reach the threshold α, return to step S18.

[0044] The present invention further provides a computer device, including: a processor and a memory for storing a computer program capable of running on the processor, wherein when the processor is used to run the computer program, the recommended method described above is implemented.

[0045] The present invention also provides a computer storage medium storing an executable program, which, when executed by a processor, implements the recommended method described above.

[0046] For the makeup recommendation method provided above, a face alignment program is used to obtain a face feature mask, and the feature mask is used as an attention map to guide the training of the autoencoder, making the face features output by the autoencoder more accurate, and the face does not need to be in the center of the image. Through this method, the accuracy of feature extraction is improved, thereby improving the accuracy of makeup recommendation. At the same time, the difficulty of data collection is reduced. On the other hand, the method uses a graph structure to construct the features between the user's face and the dataset of faces with makeup, which can further improve the accuracy of makeup recommendation. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 It is a flowchart of the face makeup recommendation method provided by an embodiment of the present invention;

[0048] Figure 2 It is a flowchart of constructing an undirected weighted graph provided by an embodiment of the present invention;

[0049] Figure 3 It is a flowchart of obtaining a recommendation list provided by an embodiment of the present invention;

[0050] Figure 4 It is a schematic diagram of the modules of the system provided by an embodiment of the present invention;

[0051] Figure 5 It is a schematic diagram of the structure of the computer device provided by an embodiment of the present invention; DETAILED DESCRIPTION OF THE EMBODIMENTS

[0052] The present invention will be further described in detail below with reference to the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present invention belongs. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.

[0054] In the current makeup recommendation method, an autoencoder is used for feature extraction and then for matching makeup recommendations. Since a general autoencoder treats all pixels in an image as equally important, when the face is not in the center of the image or the face in the image is a profile face, the obtained features often cannot well represent the face, and the feature extraction and makeup recommendation are inaccurate. Therefore, in the current makeup recommendation method, especially for the feature extraction of facial features, in order to ensure the accuracy of feature extraction and thus the accuracy of makeup recommendation, it is often necessary to crop the picture data, which makes it very inconvenient to collect the data set.

[0055] Based on this, how to provide a makeup recommendation method with higher accuracy and convenient data collection is a technical problem that urgently needs to be solved.

[0056] It should be noted that this method is executed by a computer device. Here, the computer device refers to any device with computing and processing capabilities, including but not limited to fixed terminal devices or mobile terminal devices. The fixed terminal device may include but not limited to desktop computers or computer devices, etc., and the mobile terminal device may include but not limited to mobile phones, tablets, wearable devices or laptop computers, etc.

[0057] The technical solution of the present invention will be further elaborated in detail below with reference to the accompanying drawings and specific embodiments.

[0058] Reference Figures 1-3 , an embodiment of the present invention provides a personal image recommendation method based on face recognition and data processing. A face alignment program is used to obtain a mask of the user's face. According to the user's face and the obtained mask, the face features are obtained through an autoencoder. An undirected weighted graph is constructed with the features and the face picture features in the database of made-up face data sets. A graph clustering algorithm is used to obtain the makeup recommended to the user. Before executing this method, a pre-trained autoencoder model needs to be used. The specific process is as follows:

[0059] Step 1: Input each face in the pre-prepared training sample face data set into the face alignment program to obtain its corresponding face mask. To facilitate faster reading of face data and its mask during subsequent training, the face pictures and their corresponding face masks in the face data set will be saved as h5 files in the format of numpy matrices using h5py.

[0060] Step 2: Read the data in the h5 file constructed in the above step to train the autoencoder. Here, the input of the autoencoder is a face image and its corresponding facial feature mask, and this feature mask will be used as an attention map to guide the model training. Since in the deeper layers of the neural network, the feature maps no longer have spatial information, the attention map is concatenated with the features output by the first-layer convolution in the channel dimension, as follows:

[0061] Feature 2 = G 2 (concat(G 1 (image), attention))

[0062] where Feature 2 is the feature output after the second-layer convolution, concat represents concatenation in the channel dimension, G 1 and G 2 represent the first-layer convolution and the second-layer convolution respectively, image represents the pixels of the face image used to train the autoencoder model, attention represents the attention map, and the loss function is the mean square error between the face image output by the decoding part and the original input face image. The loss function is as follows:

[0063]

[0064] where M and N are the length and width of the image respectively, and Img(I,j) represents the pixel at the i-th row and j-th column in the image.

[0065] In this embodiment, an autoencoder model trained using a face dataset and its corresponding facial feature masks is used. This autoencoder model is divided into an encoding part and a decoding part. The encoding part extracts the features of the face, and the decoding part restores the face according to the extracted face features. The autoencoder model is trained in a supervised manner until the loss function no longer decreases. At this time, the face features extracted by the encoding part can well represent the entire face.

[0066] After the autoencoder model is trained, it is built into the recommendation system that runs this recommendation method. This recommendation method specifically includes the following steps:

[0067] S11: Obtain a made-up face image and construct a dataset of the made-up face;

[0068] S12: Obtain the facial feature mask of the made-up face according to the dataset of the made-up face;

[0069] Specifically, in step S12, a face alignment program calculation strategy is adopted to extract the facial feature masks of the made-up faces in the made-up face dataset. When the size of the mask is the same as that of the face image, each value in the mask corresponds to a pixel in the face image. In particular, the values at the corresponding positions in the facial feature regions of the mask are larger, while the values in non-facial feature regions are smaller.

[0070] S13: According to the made-up face dataset and the facial feature masks of the made-up faces, the made-up face features are obtained according to the calculation strategy of the autoencoder model;

[0071] S14: According to the photo of the user's face, the facial feature mask of the front of the user's face is obtained;

[0072] It should be noted that in step S14, when obtaining the facial feature mask of the front of the user's face, it is determined whether the photo of the user's face is frontal or side. If the photo of the user's face is side, the photo of the user's face is obtained again.

[0073] S15: According to the photo of the user's face and the facial feature mask of the user's face, the user face features are obtained according to the calculation strategy of the autoencoder model;

[0074] S16: According to the made-up face features and the user face features, a graph structure is constructed;

[0075] Specifically, in step S16, in response to the similarity between the made-up face features and the user face features being greater than the threshold θ, the corresponding nodes are connected by an edge, thereby constructing the graph structure. The graph is an undirected weighted graph, which is saved in the form of its adjacency matrix, in the format of a numpy matrix, and saved as an h5 file using h5py. Among them, the nodes of the graph structure are face features. Among them, the face feature similarity is measured using the Mahalanobis distance. The face feature similarity calculation formula is as follows:

[0076]

[0077] In the formula, x and y are two face features respectively, and Σ is the covariance matrix of x and y.

[0078] S17: According to one of the made-up face features with the largest module gain in the graph structure and the user face features, a clustering list is constructed, where each made-up face feature in the clustering list corresponds to a makeup recommended to the user;

[0079] Specifically, in step S17, the undirected weighted graph constructed in step S16 should be read first. The adjacency matrix of the undirected weighted graph is obtained by reading the h5 file, and then the user's face features are used to initialize the clustering list. At this time, only the user's face features are in the clustering list. Add the most cosmetized face feature with the largest modular gain of the node module corresponding to the user's face feature in the graph structure to the clustering list.

[0080] S18: Combine all the nodes in the clustering list into a new supernode, and calculate the modular gain between the supernode and the remaining nodes, where the remaining nodes are the nodes that have not formed the supernode;

[0081] Specifically, the calculation formula for the modular gain between the supernode and the remaining nodes is as follows:

[0082]

[0083] In the formula, out c represents the weight of the edge between the user's face node and the face node c, all c represents the sum of the weights of the edges connected to the node c, and in u represents the total weight of the edges connected to the user node. It should be noted that the above formula is used to calculate the modular gain between two nodes, which can be the user's face node and the cosmetized face node, or the supernode and the cosmetized face node.

[0084] S19: Among the remaining nodes, add the node with the largest modular gain with the supernode to the clustering list; repeat steps S18 and S19 until the number of nodes in the clustering list reaches the threshold α.

[0085] S110: If the number of nodes in the clustering list reaches the threshold α, recommend the corresponding makeup of the cosmetized face features stored in the nodes of the clustering list to the user in order. If the user is not satisfied with this makeup, recommend the next makeup corresponding to the cosmetized face features stored in the nodes of the clustering list. If the user selects a certain makeup, exit the recommendation. If the user does not select any makeup in the clustering list, return to step S18. At this time, the threshold α is adjusted to twice the previous threshold α;

[0086] It should be noted that the cosmetized face features stored in the nodes of the clustering list will be sorted in ascending order according to the Mahalanobis distance between the face features and the user's face features.

[0087] S111: If the number of nodes in the clustering list does not reach the threshold α, return to step S18.

[0088] Generally speaking, for the makeup recommendation method implemented based on the embodiments of the present invention, a face alignment program is used to obtain a face feature mask of facial features, and the feature mask is used as an attention map to guide the training of the autoencoder, so that the facial features output by the autoencoder are more accurate, and it is not necessary for the face to be in the center of the image. Through this method, the accuracy of feature extraction is improved, and thus the accuracy of makeup recommendation is improved. At the same time, the difficulty of data collection is reduced. On the other hand, the method uses a graph structure to construct the features between the user's face and the dataset of faces with makeup, which can further improve the accuracy of makeup recommendation.

[0089] As Figure 4 shown, the embodiments of the present invention further provide a personal image recommendation system based on face recognition and data processing, including:

[0090] An acquisition and construction module 41, configured to acquire pictures of faces with makeup and construct a dataset of the faces with makeup;

[0091] A first determination module 42, configured to obtain a feature mask of the facial features of the face with makeup according to the dataset of the faces with makeup;

[0092] A second determination module 43, configured to obtain the facial features of the face with makeup according to the dataset of the faces with makeup and the feature mask of the facial features of the face with makeup according to the calculation strategy of the autoencoder model;

[0093] A third determination module 44, configured to obtain a feature mask of the front facial features of the user's face according to a photo of the user's face;

[0094] A fourth determination module 45, configured to obtain the facial features of the user's face according to the photo of the user's face and the feature mask of the facial features of the user's face according to the calculation strategy of the autoencoder model;

[0095] A first construction module 46, configured to construct a graph structure according to the facial features of the face with makeup and the facial features of the user's face;

[0096] A second construction module 47, configured to construct a clustering list according to one of the facial features of the face with makeup having the largest module gain degree with respect to the facial feature node module in the graph structure and the facial features of the user's face, where each of the facial features of the face with makeup in the clustering list corresponds to a makeup recommended for the user;

[0097] A module gain degree calculation module 48, configured to form all nodes in the clustering list into a new supernode and calculate the module gain degree between the supernode and the remaining nodes, where the remaining nodes are the nodes that have not formed the supernode;

[0098] An adding module 49 is configured to add, among the remaining nodes, the node with the largest module gain degree with respect to the super node to the clustering list; steps S18 and S19 are repeated until the number of nodes in the clustering list reaches a threshold α.

[0099] A recommendation judgment module 410 is configured to, if the number of nodes in the clustering list reaches the threshold α, recommend the makeup looks corresponding to the made-up face features stored by the nodes in the clustering list to the user in sequence; if the user is not satisfied with the makeup look, recommend the next makeup look corresponding to the made-up face features stored by the nodes in the clustering list; if the user selects a certain makeup look, the recommendation is exited; if the user does not select any makeup look in the clustering list, return to step S18.

[0100] A judgment module 411 is configured to, if the number of nodes in the clustering list does not reach the threshold α, return to step S18.

[0101] It should be noted here that the descriptions of the above system items are similar to those of the above method items, and the beneficial effects of the method will not be elaborated. For the technical details not disclosed in the device embodiment of the present invention, please refer to the description of the method embodiment of the present invention.

[0102] As Figure 5 shown, an embodiment of the present invention further provides a computer device, including a processor 51 and a memory 52 for storing a computer program that can run on the processor, wherein when the processor is used to run the computer program, the method described above is implemented.

[0103] In some embodiments, the memory 52 in the embodiments of the present invention may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable ROM (PROM), an erasable programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and direct rambus RAM (DRRAM). The memory 52 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memories.

[0104] The processor 51 may be an integrated circuit chip with the ability to process signals. In the implementation process, each step of the above method can be completed by the integrated logic circuit in hardware or the instructions in software form in the processor 51. The above-mentioned processor 51 may be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute each method, step, and logic block diagram disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present invention can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 52, and the processor 51 reads the information in the memory 52 and combines its hardware to complete the steps of the above method.

[0105] In some embodiments, these embodiments described herein can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For a hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application, or a combination thereof.

[0106] For a software implementation, the technologies described herein can be implemented by modules (e.g., procedures, functions, etc.) that execute the functions described herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented inside or outside the processor.

[0107] Another embodiment of the present invention provides a computer storage medium. The computer-readable storage medium stores an executable program. When the executable program is executed by a processor 51, the steps applicable to the method can be implemented. For example, one or more of the recommendation methods as Figure 1 shown.

[0108] In some embodiments, the computer storage medium may include: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs.

[0109] It should be noted that: among the technical solutions described in the embodiments of the present invention, they can be arbitrarily combined without conflict.

[0110] As mentioned above, the above is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.

Claims

1. A personal image recommendation method based on face recognition and data processing, characterized in that, the method comprises the following steps: S11: Obtain a made-up face image and construct a dataset of the made-up face; S12: Obtain the facial feature masks of the made-up face according to the dataset of the made-up face; S13: Obtain made-up face features through a trained autoencoder according to the dataset of the made-up face and the facial feature masks of the made-up face; S14: Obtain the facial feature masks of the user's face according to the photo of the user's face; S15: Obtain user face features through a trained autoencoder according to the photo of the user's face and the facial feature masks of the user's face; S16: Construct a graph structure according to the made-up face features and the user face features; S17: Initialize a clustering list with the user face features, and select one of the made-up face features with the maximum module gain corresponding to the user face feature module according to the graph structure, and add it to the clustering list, wherein each of the made-up face features in the clustering list corresponds to a makeup recommended to the user; S18: Combine all the nodes in the clustering list into a new supernode, and calculate the module gain between the supernode and the remaining nodes, wherein the remaining nodes are the nodes that have not been combined into the supernode; S19: Among the remaining nodes, add the node with the maximum module gain with the supernode to the clustering list; repeat steps S18 and S19 until the number of nodes in the clustering list reaches the threshold α; S110: If the number of nodes in the clustering list reaches the threshold α, recommend the makeup corresponding to the made-up face features stored in the nodes of the clustering list to the user in sequence. If the user is not satisfied with the makeup, recommend the next makeup corresponding to the made-up face features stored in the nodes of the clustering list. If the user selects a certain makeup, exit the recommendation. If the user does not select any makeup in the clustering list, return to step S18; S111: If the number of nodes in the clustering list does not reach the threshold α, return to step S18; The autoencoder is composed of a convolutional neural network and is trained in a supervised training manner. The training steps of the autoencoder include: Concatenate the attention map and the features output by the first - layer convolution in the channel dimension. Specifically, Feature 2 = G 2 (concat(G 1 (image), attention)), where Feature 2 is the feature output after the second - layer convolution, concat represents concatenation in the channel dimension, G 1 and G 2 represent the first - layer convolution and the second - layer convolution respectively, image represents the pixels of the face image used to train the auto - encoder, attention represents the attention map, and the loss function is the mean square error between the face image output by the decoding part and the original input face image; The step of combining all the nodes in the clustering list into a new supernode includes: Regarding the edges and the weights of the edges between all the nodes in the clustering list and other nodes as the edges and the weights of a new node, thereby forming a new supernode.

2. The method according to claim 1, characterized in that, the step of constructing a graph structure according to the made-up face features and the user face features includes: In response to the similarity between the made-up face features and the user face features being greater than the threshold θ, the corresponding nodes are connected by an edge, thereby constructing the graph structure, wherein the nodes of the graph structure are face features.

3. The method according to claim 1, characterized in that, the step of obtaining the facial feature masks of the made-up face according to the dataset of the made-up face includes: According to the dataset of the made-up face, the five - sense organ mask of the made-up face is obtained according to the calculation strategy of the face alignment program; The obtaining the five - sense organ mask of the front of the user's face from the photo of the user's face includes: Obtain a photo of the user's face, and according to the photo of the user's face, obtain the five - sense organ mask of the user's face according to the calculation strategy of the face alignment program; Judge whether the photo of the user's face is frontal or side according to the five - sense organ mask of the user's face; In response to the photo of the user's face being side, obtain the photo of the user's face again.

4. According to the method described in claim 1, wherein, The auto - encoder includes an encoding part and a decoding part. The encoding part is used to extract face features, and the decoding part is used to restore the face according to the face features extracted by the encoding part.

5. According to the method described in claim 3, wherein, The obtaining the photo of the user's face includes: Using the camera of the mobile terminal to obtain the photo of the user's face.

6. A personal image recommendation system based on face recognition and data processing, including: An acquisition and construction module, used to acquire made-up face pictures and construct the dataset of the made-up face; A first determination module, used to obtain the five - sense organ mask of the made-up face according to the dataset of the made-up face; A second determination module, used to obtain made-up face features according to the dataset of the made-up face and the five - sense organ mask of the made-up face according to the calculation strategy of the auto - encoder model; A third determination module, used to obtain the five - sense organ mask of the front of the user's face from the photo of the user's face; A fourth determination module, used to obtain user face features according to the photo of the user's face and the five - sense organ mask of the user's face according to the calculation strategy of the auto - encoder model; A first construction module, used to construct a graph structure according to the made-up face features and the user face features; A second construction module, used to construct a clustering list according to one of the made-up face features with the largest module gain degree corresponding to the user face feature node module in the graph structure and the user face features, wherein each of the made-up face features in the clustering list corresponds to a makeup recommended to the user; A module gain degree calculation module, used to form all the nodes in the clustering list into a new super - node, and calculate the module gain degree between the super - node and the remaining nodes, wherein the remaining nodes are the nodes that have not formed the super - node; An addition module, used to add the node with the largest module gain degree between the super - node and the remaining nodes to the clustering list among the remaining nodes; A recommendation judgment module, used to if the number of nodes in the clustering list reaches the threshold α, recommend the makeup corresponding to the made-up face features stored in the nodes of the clustering list to the user in order. If the user is not satisfied with the makeup, recommend the next makeup corresponding to the made-up face features stored in the nodes of the clustering list. If the user selects a certain makeup, exit the recommendation. If the user does not select any makeup in the clustering list, return to step S18; A judgment module, configured to return to step S18 if the number of nodes in the clustering list does not reach the threshold α; The autoencoder is composed of a convolutional neural network and is trained in a supervised training manner. The training steps of the autoencoder include: Concatenate the attention map and the features output by the first-layer convolution in the channel dimension. Specifically, Feature 2 = G 2 (concat(G 1 (image), attention)), where Feature 2 is the feature output after the second-layer convolution, concat represents concatenation in the channel dimension, G 1 and G 2 represent the first-layer convolution and the second-layer convolution respectively, image represents the pixels of the face image used to train the autoencoder, attention represents the attention map, and the loss function is the mean square error between the face image output by the decoding part and the original input face image; The forming a new supernode by using all the nodes in the clustering list includes: Taking the edges and the weights of the edges between all the nodes in the clustering list and other nodes as the edges and the weights of a new node, so as to form a new supernode.

7. A computer device Characterized in that It includes: A processor and a memory for storing a computer program that can run on the processor, wherein when the processor is used to run the computer program, the method according to any one of claims 1 to 5 is implemented.

8. A computer storage medium Characterized in that It stores an executable program, and when the executable program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Face recognition photo classification method and device, electronic equipment and storage medium

    CN113343920A

  • Makeup recommendation method and device, electronic equipment and storage medium

    CN114003746A