Facial color classification method, device, computer readable program medium and electronic device

By combining global and local neural networks, aggregating feature vectors and introducing associated information, the problem of insufficient performance of existing complexion classification methods is solved, and more accurate complexion classification is achieved to meet the needs of traditional Chinese medicine interviews.

CN115100723BActive Publication Date: 2024-10-29PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210823389.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-13
Publication Date
2024-10-29
Estimated Expiration
2042-07-13

AI Technical Summary

Technical Problem

Existing facial color classification methods have insufficient performance and generalization capabilities, cannot effectively consider the subtle differences in color in local facial areas, and cannot meet the needs of traditional Chinese medicine face-to-face diagnosis.

Method used

Using the method of combining global neural network and local neural network, by dividing the face image into multiple face area images, inputting the global and local neural networks respectively to obtain feature maps, performing feature vector aggregation and cascading, and introducing associated information generation Feature vectors are used for facial color classification.

Benefits of technology

It significantly improves the performance of complexion classification, can more accurately consider the characteristics of local facial areas, meets the needs of traditional Chinese medicine facial diagnosis, and improves the accuracy and generalization ability of complexion classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115100723B_ABST
    Figure CN115100723B_ABST
Patent Text Reader

Abstract

The present disclosure relates to the field of artificial intelligence, and discloses a method, device, computer-readable program medium, and electronic device for facial color classification. The method comprises: inputting a facial image to be classified of a target user into a global neural network, and obtaining a first feature map output by the last convolution layer of the global neural network; dividing the facial image to be classified into a plurality of facial region images, and inputting the plurality of facial region images into a local neural network, and obtaining a second feature map corresponding to each facial region image output by the last convolution layer of the local neural network; performing aggregation operations on the first feature map and each second feature map, respectively, to obtain a first feature vector and a second feature vector; cascading the first feature vector, the second feature vector, and the third feature vector to obtain a target feature vector; and classifying the target feature vector to obtain a facial color classification result. This method improves the accuracy of facial color classification.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] Image classification and image recognition are one of the core topics in the field of computer vision.

[0003] To classify facial color, existing methods mainly use neural networks to identify the entire face photo.

[0004] In this way, the performance and generalization ability of the neural network are limited by the training data, which often makes the performance and generalization ability of the trained neural network insufficient. Summary of the invention

[0005] In the field of artificial intelligence technology, in order to solve the problem of low performance and generalization ability of complexion classification models in the prior art, the purpose of the present disclosure is to provide a complexion classification method, device, computer-readable program medium and electronic device.

[0006] According to one aspect of the present disclosure, a method for complexion classification is provided, the method comprising:

[0007] Inputting the target user's face image to be classified into the global neural network to obtain a first feature map output by the last convolutional layer of the global neural network;

[0008] Segmenting the face image to be classified into a plurality of face region images, and inputting the plurality of face region images into a local neural network to obtain a second feature map corresponding to each face region image output by the last convolutional layer of the local neural network;

[0009] Performing an aggregation operation on the first feature map to obtain a first feature vector;

[0010] Performing an aggregation operation on each of the second feature maps to obtain a second feature vector;

[0011] Acquire a third feature vector generated according to the associated information of the target user;

[0012] Cascading the first feature vector, the second feature vector and the third feature vector to obtain a target feature vector;

[0013] The target feature vector is classified to obtain a facial color classification result.

[0014] According to another aspect of the present disclosure, a facial color classification device is provided, the device comprising:

[0015] An input module is configured to input the face image to be classified of the target user into the global neural network to obtain a first feature map output by the last convolutional layer of the global neural network;

[0016] A segmentation module is configured to segment the face image to be classified into a plurality of face region images, and input the plurality of face region images into a local neural network to obtain a second feature map corresponding to each face region image output by the last convolutional layer of the local neural network;

[0017] A first aggregation module is configured to perform an aggregation operation on the first feature map to obtain a first feature vector;

[0018] A second aggregation module is configured to perform an aggregation operation on each of the second feature maps to obtain a second feature vector;

[0019] An acquisition module, configured to acquire a third feature vector generated according to the associated information of the target user;

[0020] a cascade module, configured to cascade the first feature vector, the second feature vector and the third feature vector to obtain a target feature vector;

[0021] The classification module is configured to classify the target feature vector to obtain a facial color classification result.

[0022] According to another aspect of the present disclosure, a computer-readable program medium is provided, which stores computer program instructions. When the computer program instructions are executed by a computer, the computer is caused to execute the method as described above.

[0023] According to another aspect of the present disclosure, an electronic device is provided, the electronic device comprising:

[0024] processor;

[0025] A memory having computer-readable instructions stored therein, wherein the computer-readable instructions, when executed by the processor, implement the aforementioned method.

[0026] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:

[0027] For the facial color classification method, device, computer-readable program medium and electronic device provided by the present disclosure, the method includes the following steps: inputting the target user's facial image to be classified into the global neural network to obtain a first feature map output by the last convolution layer of the global neural network; dividing the facial image to be classified into multiple facial area images, and inputting the multiple facial area images into the local neural network to obtain a second feature map corresponding to each facial area image output by the last convolution layer of the local neural network; performing an aggregation operation on the first feature map to obtain a first feature vector; performing an aggregation operation on each of the second feature maps to obtain a second feature vector; obtaining a third feature vector generated according to the associated information of the target user; cascading the first feature vector, the second feature vector and the third feature vector to obtain a target feature vector; classifying the target feature vector to obtain a facial color classification result.

[0028] In this method, the entire facial color classification model includes a global neural network and a local neural network. On the one hand, the global neural network is used to obtain the first feature map corresponding to the face image to be classified. On the other hand, the face image to be classified is segmented into multiple face region images, and the local neural network is used to obtain the second feature map corresponding to each face region image. Then, by performing aggregation operations on the first feature map and the second feature map, the corresponding first feature vector and second feature vector are obtained, and the target feature vector for facial color classification is generated based on the first feature vector and the second feature vector. Therefore, this method introduces implicit knowledge information of the local area of ​​the face when performing facial color classification, which can improve the accuracy and generalization ability of facial color classification; at the same time, since the third feature vector generated according to the associated information of the target user is also introduced when generating the target feature vector, the performance of the facial color classification model can be further improved.

[0029] It is to be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0031] Figure 1 is a schematic diagram of a system architecture of an application complexion classification method according to an exemplary embodiment;

[0032] Figure 2 is a flow chart of a method for complexion classification according to an exemplary embodiment;

[0033] Figure 3is a schematic diagram of an algorithm framework capable of implementing a facial color classification method according to an exemplary embodiment;

[0034] Figure 4 is a flowchart of training a local neural network according to an exemplary embodiment;

[0035] Figure 5 is a flowchart of training a global neural network according to an exemplary embodiment;

[0036] Figure 6 is a block diagram of a facial color classification device according to an exemplary embodiment;

[0037] Figure 7 is an example block diagram of an electronic device for implementing the above-mentioned facial color classification method according to an exemplary embodiment;

[0038] Figure 8 A program product for implementing the above-mentioned facial color classification method is shown according to an exemplary embodiment. DETAILED DESCRIPTION

[0039] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.

[0040] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings represent the same or similar parts, and their repeated descriptions will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities.

[0041] In related technologies, image classification is one of the more common application scenarios of neural network algorithms such as deep learning. However, there are almost no complexion classification schemes in the field of traditional Chinese medicine.

[0042] Observation is one of the four diagnostic methods in TCM. Observation refers to the method in which doctors purposefully observe the spirit, color, shape, and posture of the patient's whole body, parts, and excretions, and analyze the patient's physical health and detect the condition based on their own clinical practice experience and knowledge. Facial diagnosis is an important part of TCM observation and a unique method of TCM disease diagnosis. Facial color is the most important facial feature in TCM facial diagnosis, and facial color recognition is the core of TCM facial diagnosis.

[0043] At present, the way people may propose to use artificial intelligence methods to identify complexion is basically the same as other image classification methods, that is, the face image is input into a deep network, and the complexion classification result is output through feature engineering and classifier.

[0044] However, since this method only focuses on the overall color classification of facial images, it cannot take into account the subtle differences in local color between different complexions, resulting in poor complexion classification performance and cannot meet the requirements of TCM diagnosis.

[0045] The inventors have discovered that the color of local facial areas is closely related to the internal organs of the human body and is one of the key factors to be considered when conducting disease differentiation.

[0046] To this end, the present disclosure first provides a complexion classification method. This method can overcome the above defects and further introduces subtle differences in local facial regions into the complexion classification model, which can significantly improve the performance of complexion classification and meet the requirements of actual TCM clinical facial diagnosis.

[0047] The implementation terminal of the present disclosure can be any device with computing and processing functions, which can be connected to an external device for receiving or sending data. Specifically, it can be a portable mobile device, such as a smart phone, a tablet computer, a laptop computer, a PDA (Personal Digital Assistant), etc., or it can be a fixed device, such as a computer device, a field terminal, a desktop computer, a server, a workstation, etc.

[0048] Optionally, the implementation terminal of the present disclosure may be a computer device or a server.

[0049] Figure 1 FIG. 1 is a schematic diagram of a system architecture for applying a facial color classification method according to an exemplary embodiment. Figure 1 As shown, the system architecture includes a user terminal 110, a server 120, a database 130 and a physician terminal 140. The user terminal 110 may be a smart phone, and the physician terminal 140 may be a desktop computer. The user terminal 110, the database 130 and the physician terminal 140 are all connected to the server 120 via a communication link for data transmission. The communication link may be a wired communication link or a wireless communication link. The user terminal 110 is provided with a photographing device, and photos can be taken by the photographing device. The server 120 is deployed with a server for providing services to the client on the user terminal 110. The server includes a complexion classification model. Therefore, the server 120 can be used as an implementation terminal for executing the complexion classification method provided in the present disclosure. When the complexion classification method provided in the present disclosure is applied to Figure 1In the system architecture shown, a process may be as follows: first, the user uses the user terminal 110 to input personal information in the client, the user terminal 110 sends the personal information to the server 120, and the server 120 stores the personal information in the database 130 with which the communication connection is established. Next, the user of the user terminal 110 triggers the execution of the photo function in the client, calls the camera to take a photo of the user's face, and then the user terminal 110 sends the face photo to the server 120. Next, the server 120 obtains personal information from the database 130, and inputs the personal information and the face photo into the complexion classification model to obtain a classification result output by the complexion classification model, wherein the complexion classification model includes a global neural network, a local neural network, a first aggregation module, a second aggregation module, a segmentation module, a generation module, a cascade module and a classification module, and the process executed in the complexion classification model is as follows: after the face photo is input into the global neural network, the last convolutional layer of the global neural network is used to output the corresponding first feature map; the face photo is segmented into multiple face area images by the segmentation module, and the second convolutional layer of the local neural network is used to output the second feature map corresponding to each face area image; the first aggregation module is used to perform a aggregation operation on the first feature map to obtain a first feature vector, and the second aggregation module is used to perform a aggregation operation on all the second feature maps to obtain a second feature vector; the generation module generates a third feature vector using the personal information; the cascade module cascades the first feature vector, the second feature vector and the third feature vector to obtain a target feature vector, and the target feature vector is input into the classification module, and the classification module outputs the complexion classification result. Finally, the server 120 sends the face photo and the corresponding complexion classification result to the physician terminal 140 so that the physician can review it or refer to it during diagnosis and treatment.

[0050] In one embodiment of the present disclosure, the personal information is submitted by the user terminal to the server when the user initiates registration with the service end in the server using the client in the user terminal.

[0051] In one embodiment of the present disclosure, the facial color classification model is trained based on a facial image sample set including multiple facial image samples, the facial image samples include facial images and facial color category labels corresponding to the facial images, the facial images and the facial color category labels corresponding to the facial images are submitted to the server by the physician terminal 140, and the facial color category labels of the facial images are annotated for the facial images using the physician terminal 140.

[0052] It is worth mentioning that Figure 1 This is only one embodiment of the present disclosure. Figure 1The embodiment only shows one user terminal, one physician terminal, one server and one database, but in other embodiments of the present disclosure, multiple user terminals, multiple physician terminals and multiple databases can be set up at the same time, and the server can also be a server cluster composed of multiple servers. When multiple physician terminals are set up, a face image sample set for training the complexion classification model can be constructed by summarizing the face image samples submitted by each physician terminal; although in Figure 1 In the embodiment, the complexion classification method uses four different terminal devices, namely, a user terminal, a physician terminal, a server, and a database. However, in other embodiments of the present application, less than four terminal devices may be used to implement the complexion classification method. For example, the complexion classification model may be deployed on the physician terminal, and the personal information and face photos may be directly input into the physician terminal when the physician performs on-site clinical diagnosis, that is, the complexion classification method may be implemented only through the physician terminal. The present disclosure does not make any limitation to this, and the protection scope of the present disclosure shall not be limited in any way.

[0053] Figure 2 The figure is a flow chart of a method for facial color classification according to an exemplary embodiment. Figure 2 The complexion classification method provided in the illustrated embodiment can be executed by various terminal devices with computing and processing functions, such as servers or computer devices, in which a complexion classification model is deployed. Figure 2 As shown, the complexion classification method may specifically include the following steps:

[0054] Step 210: input the target user's face image to be classified into the global neural network to obtain the first feature map output by the last convolutional layer of the global neural network.

[0055] The face image to be classified of the target user may be a face photo or a face picture, and its format may be various formats such as .bmp, .jpg, etc.

[0056] In one embodiment of the present disclosure, before inputting the target user's facial image to be classified into the global neural network, the facial color classification method further includes: performing facial capture on a picture containing the target user to obtain the target user's facial image to be classified.

[0057] In this embodiment, the face image to be classified of the target user is obtained by intercepting the area containing the face in the picture containing the target user.

[0058] The global neural network includes a backbone network, and the last convolutional layer of the global neural network is the last convolutional layer of the backbone network.

[0059] Figure 3FIG. 1 is a schematic diagram of an algorithm framework for implementing a facial color classification method according to an exemplary embodiment. Figure 3 As shown, the algorithm framework includes a global neural network and a local neural network, and the global neural network includes a first backbone network 310. After the face image 301 to be classified is input into the first backbone network 310, the first backbone network 310 performs feature extraction, thereby outputting a first feature map 302 corresponding to the face image 301 to be classified. The first backbone network 310 can be any deep convolutional neural network, such as ResNet, DenseNet, VGG, MobileNet, HRNet, etc.

[0060] Step 220, segment the face image to be classified into multiple face area images, and input the multiple face area images into the local neural network to obtain a second feature map corresponding to each face area image output by the last convolutional layer of the local neural network.

[0061] The face image to be classified can be segmented according to various methods and rules, and the number of face region images formed by segmenting the face image to be classified can be set as needed.

[0062] The face image to be classified can be segmented using a pre-trained face region segmentation model, which can be constructed by using a deep learning algorithm.

[0063] In one embodiment of the present disclosure, the plurality of facial region images are facial region images corresponding to the five internal organs in the field of traditional Chinese medicine.

[0064] The facial area images corresponding to the five internal organs are the five local areas of the face corresponding to the internal organs of the human body as defined in clinical Chinese medicine.

[0065] Specifically, the five internal organs in the field of traditional Chinese medicine are heart, liver, spleen, lungs, and kidneys, and the multiple facial region images are five facial region images corresponding to the five internal organs, namely, a forehead region image corresponding to the heart, a left region image corresponding to the liver, a nose region image corresponding to the spleen, a right region image corresponding to the lungs, and a lower region image corresponding to the kidneys, wherein the left and the right refer to the directions perceived by the user himself.

[0066] The face area image is input into the backbone network of the local neural network, and the backbone network of the local neural network outputs a second feature map corresponding to the face area image. The last convolution layer of the local neural network can also be located in the backbone network of the local neural network.

[0067] Please continue to see Figure 3As shown, the local neural network includes a second backbone network 330, which divides the face image 301 to be classified into a plurality of face region images 302, and inputs each face region image into the second backbone network 330, which extracts features, thereby outputting a second feature map 305 corresponding to each face region image. The plurality of face region images 302 are five face region images corresponding to the five internal organs, respectively. The position of the face region image can be identified in the face image 301 to be classified, and a cropping frame is marked at the corresponding position, and then the corresponding face region image is cropped out in the face image to be classified according to the cropping frame.

[0068] Similar to the first backbone network 310, the second backbone network 330 may also be any deep convolutional neural network, for example, ResNet, DenseNet, VGG, MobileNet, HRNet, etc.

[0069] Figure 4 is a flowchart of training a local neural network according to an exemplary embodiment. Figure 4 As shown, the local neural network can be trained through the following process:

[0070] Step 410, obtaining a face region sample set, wherein the face region sample set includes a plurality of face region samples, and the face region samples include a plurality of face region images segmented from a face image and disease category labels and complexion category labels corresponding to the face images.

[0071] A face image sample set including a plurality of face image samples may be provided, each face image sample including a face image, and then a corresponding face region sample may be generated according to the face image in a face image sample.

[0072] In one embodiment of the present disclosure, the facial color category label is any one of the following: normal, cyan, red, yellow, white, and black.

[0073] In one embodiment of the present disclosure, the disease category label is the organ where the disease occurs.

[0074] Specifically, the disease category label may be at least one of the following: heart, liver, spleen, lung, and kidney. That is, the disease category label corresponding to the face image may be one or more.

[0075] The face region samples in the face region sample set can be generated based on clinical diagnosis data. Specifically, the complexion category label can be obtained by Chinese medicine practitioners by annotating face images based on experience, and the disease category label can also be obtained by Chinese medicine practitioners. Of course, it can also be extracted from data such as Chinese medicine diagnosis reports. The multiple face region images segmented from face images in the face region sample set can be segmented using a pre-trained face region segmentation model, or can be manually segmented by experts based on experience.

[0076] Step 420, input each face region image in the face region sample into the local neural network respectively, and obtain a classification result corresponding to each face region image.

[0077] The classification result corresponding to the face area image corresponds to the aforementioned complexion category label. Therefore, the classification result corresponding to the face area image can also be any one of the following: normal, cyan, red, yellow, white, and black.

[0078] Please continue to see Figure 3 As shown, the local neural network also includes a local classifier located after the second backbone network 330. After the face area image is input into the second backbone network 330 of the local neural network, the second backbone network 330 outputs a second feature map 305, and the second feature map 305 is input into the local classifier to obtain a second classification result 306 output by the local classifier.

[0079] Step 430, determining the cross entropy loss corresponding to each face area image based on the classification result corresponding to each face area image and the complexion category label, and determining the overall cross entropy loss corresponding to the face area sample based on the cross entropy loss corresponding to each face area image and the disease category label.

[0080] Cross Entropy Loss describes the distance between the probability distributions of the classification result and the true facial color category label. The smaller the cross entropy, the closer the two probability distributions are.

[0081] In one embodiment of the present disclosure, determining the overall cross entropy loss corresponding to the facial area sample based on the cross entropy loss corresponding to each facial area image and the disease category label includes: determining the weight corresponding to each facial area image based on the disease category label; determining the overall cross entropy loss corresponding to the facial area sample based on the cross entropy loss and weight corresponding to each facial area image.

[0082] Specifically, the sum of the weights corresponding to each face region image can be set to 1. Since the disease category label corresponds to the face region image, the weight of the face region image corresponding to the disease category label among the face region images can be set to the maximum. When a face image corresponds to all disease category labels, the weight corresponding to the face region image can be set in an average manner.

[0083] The overall cross entropy loss corresponding to a face area sample can be determined according to the cross entropy loss and weight corresponding to each face area image by the following formula:

[0084] L local =λ heart ·L CE1 +λ nose ·L CE2 +λ left ·L CE3 +λ rihgt ·L CE4 +λ chin ·L CE5 ,

[0085] Among them, L local is the overall cross entropy loss corresponding to the face area samples, L CE1 is the cross entropy loss corresponding to the frontal region image, L CE2 is the cross entropy loss corresponding to the nose area image, L CE3 is the cross entropy loss corresponding to the left region image, L CE4 is the cross entropy loss corresponding to the image in the right area, L CE5 is the cross entropy loss corresponding to the image in the lower region, λ heart is the weight corresponding to the forehead area image, λ nose is the weight corresponding to the nose area image, λ left is the weight corresponding to the left area image, λ rihgt is the weight corresponding to the image in the right area, λ chin is the weight corresponding to the image in the lower area.

[0086] If the disease corresponding to the face image is a heart-related disease, that is, the disease category label is heart, then the weight of the face region image corresponding to the heart can be set to the maximum. For example, the overall cross entropy loss can be determined by the following formula:

[0087] L local =0.6·L CE1 +0.1 L CE2 +0.1 L CE3 +0.1 L CE4 +0.1 L CE5 .

[0088] If the disease corresponding to the face image is a comprehensive disease, that is, the disease category label is multiple internal organs, then the weights corresponding to the images of various face regions can be set to the same weight.

[0089] Step 440, obtaining a local neural network loss according to the overall cross entropy loss corresponding to each face region sample, and updating the parameters of the local neural network according to the local neural network loss to train the local neural network.

[0090] The local neural network loss can be obtained by calculating the average value of the overall cross entropy loss corresponding to each face area sample or calculating the sum of the overall cross entropy loss corresponding to each face area sample. Taking the local neural network loss as the objective function, the parameters of the local neural network are continuously adjusted by means such as the back propagation algorithm to minimize the value of the objective function, thereby realizing the training of the local neural network.

[0091] Figure 5 is a flowchart of training a global neural network according to an exemplary embodiment. Figure 5 As shown, the global neural network can be trained through the following process:

[0092] Step 510: Acquire a facial image sample set, wherein the facial image sample set includes a plurality of facial image samples, and the facial image samples include a facial image and a facial color category label corresponding to the facial image.

[0093] The face image sample set includes multiple face images and a complexion category label corresponding to each face image. A face image sample set including multiple face image samples can be first established, and then the face region sample set in the above embodiment can be established based on the face image sample set.

[0094] Step 520: Input the facial images in each of the facial image samples into the global neural network to obtain classification results corresponding to each facial image.

[0095] In one embodiment of the present disclosure, the facial images in each facial image sample are respectively input into the global neural network to obtain classification results corresponding to each facial image, including: obtaining a second feature map set corresponding to each facial image output by the local neural network, the second feature map set including multiple second feature maps; processing each second feature map set based on the channel attention mechanism to obtain an attention feature map set including multiple attention feature maps; inputting the facial images in each facial image sample into the global neural network to obtain a first feature map corresponding to each facial image output by the last convolutional layer of the global neural network; for each facial image, fusing the first feature map corresponding to the facial image with the attention feature map set corresponding to the facial image through a fusion module in the global neural network to obtain a fused feature corresponding to the facial image; obtaining the classification results corresponding to each fused feature output by the global neural network as the classification results corresponding to each facial image.

[0096] For each face image, multiple face region images corresponding to the face image are input into the local neural network, and the second feature map corresponding to each face region image output by the last convolutional layer of the local neural network can be obtained, thereby obtaining a second feature map set. The channel attention mechanism is used to automatically obtain the importance of each feature channel.

[0097] Please continue to see Figure 3 As shown, the local neural network also includes a channel attention mechanism module 340.

[0098] For each face image, the five face area images {V1, V2, V3, V4, V5} corresponding to the face image can be input into the second backbone network 330 of the local neural network, and the second backbone network 330 outputs the second feature maps corresponding to the five face area images respectively, thereby obtaining the second feature map set {F1, F2, F3, F4, F5} corresponding to the face image; the second feature map set {F1, F2, F3, F4, F5} corresponding to the face image is input into the channel attention mechanism module 340, and the channel attention mechanism module 340 will output the attention feature map set {A1, A2, A3, A4, A5}.

[0099] The global neural network also includes a fusion module 320 and a global classifier located after the first backbone network 310. After the face image is input into the first backbone network 310 of the global neural network, the first backbone network 310 outputs a first feature map 302, which is input into the fusion module 320. The fusion module 320 also receives a set of attention feature maps from the channel attention mechanism module 340. The fusion module 320 fuses the first feature map and the set of attention feature maps corresponding to each face image to obtain a fusion feature map corresponding to each face image. The fusion module 320 combines the fusion features corresponding to each face image The first classification result 303 is input into the global classifier to obtain the first classification result 303 output by the global classifier.

[0100] Step 530, determining the global neural network loss according to the classification results corresponding to each face image and the facial color category label corresponding to each face image.

[0101] The global neural network loss is similar to the local neural network loss and can also be a cross entropy loss. The global neural network loss is used to measure the distance between the two probability distributions of the classification result and the true facial color category label.

[0102] Step 540, determining a global loss based on the global neural network loss and the local neural network loss, and updating the parameters of the global neural network based on the global loss to train the global neural network.

[0103] The weighted sum of the global neural network loss and the local neural network loss can be determined as the global loss. Taking the global loss as the objective function, the parameters of the global neural network are continuously adjusted by means such as the back propagation algorithm to minimize the value of the objective function, thereby realizing the training of the global neural network.

[0104] Specifically, the global loss can be determined using the following formula:

[0105] L global =λ g ·L g +λ l ·L l ,

[0106] Among them, λ g is the weight of the global neural network loss, L g is the global neural network loss, λ l is the weight of the local neural network loss, L l is the local neural network loss, L global is the global loss.

[0107] You can set default values ​​for weights as: The weight is an adjustable parameter and can be adjusted as needed.

[0108] In one embodiment of the present disclosure, the global neural network and the local neural network are trained alternately.

[0109] Specifically, the local neural network can be trained first, and then the parameters of the local neural network are fixed and the global neural network is trained; then the local neural network is trained again, and this cycle is repeated until a preset training stop condition is obtained.

[0110] Please continue to see Figure 2 , step 230, performing an aggregation operation on the first feature map to obtain a first feature vector.

[0111] In one embodiment of the present disclosure, performing an aggregation operation on the first feature map to obtain a first feature vector includes: performing a convolution operation on the first feature map using a 1×1 convolution module to obtain a first feature vector.

[0112] In the disclosed embodiment, an aggregation operation is implemented using a 1×1 convolution module.

[0113] Please continue to see Figure 3 As shown, the first feature map 302 output by the first backbone network 310 of the global neural network is aggregated to obtain a 512-dimensional first feature vector 304.

[0114] Step 240: performing an aggregation operation on each of the second feature maps to obtain a second feature vector.

[0115] The aggregation operation on the second feature map can also be implemented using a 1×1 convolution module. Figure 3 As shown, the second feature map 305 corresponding to each face region image output by the second backbone network 330 is aggregated to obtain a 512-dimensional second feature vector 307.

[0116] Step 250: Obtain a third feature vector generated according to the associated information of the target user.

[0117] The associated information of the target user may be various information related to the target user.

[0118] In one embodiment of the present disclosure, the associated information includes medical consultation data and basic personal information.

[0119] Specifically, information related to complexion, such as organ names, makeup, and long-term working environment, can be extracted from the medical interview data, and information such as gender and age can be extracted from basic personal information; the extracted information is quantified according to the rules to obtain multiple eigenvalues, and then the eigenvalues ​​are adaptively and repeatedly set according to the actual number of features, thereby generating a 512-dimensional feature vector with equal effect.

[0120] Therefore, the third eigenvector is a knowledge eigenvector constructed using knowledge in the field of traditional Chinese medicine.

[0121] In one embodiment of the present disclosure, the association information also includes color gamut feature information of skin color. Specifically, the color gamut feature of a preset skin region can be introduced as a reference color gamut feature, so as to calculate the color gamut feature of the currently recognized face image, thereby improving the accuracy of facial color classification.

[0122] Step 260: cascade the first feature vector, the second feature vector and the third feature vector to obtain a target feature vector.

[0123] Cascading is a concatenation operation. Please continue to refer to Figure 3 As shown, the plus sign represents a concatenation operation, and the first feature vector 304, the second feature vector 307 and the third feature vector 308 are concatenated to obtain a target feature vector 309.

[0124] Step 270: classify the target feature vector to obtain a facial color classification result.

[0125] In one embodiment of the present disclosure, the target feature vector is classified to obtain a facial color classification result, including: inputting the target feature vector into a multilayer perceptron so that after the multilayer perceptron processes the target feature vector, the processing result is input into a classification layer; and obtaining the facial color classification result output by the classification layer according to the processing result.

[0126] Specifically, see Figure 3 As shown, the algorithm framework also includes an MLP (Multilayer Perceptron) classifier. The MLP classifier includes a multilayer perceptron and a classification layer. After the target feature vector 309 is input into the MLP classifier, the MLP classifier will output a facial color classification result 3100.

[0127] The complexion classification result can be one of the following: normal, blue, red, yellow, white, black.

[0128] In summary, TCM complexion diagnosis is a complex process. The complexion classification method provided by the embodiment of the present invention introduces two kinds of visual features, namely global features and local features, as well as associated features generated according to the user's associated information, and uses implicit knowledge information, which can improve the accuracy and generalization ability of complexion classification. At the same time, the model is trained in a multi-task manner, that is, the global neural network and the local neural network are trained using rules that are both independent and mutually constrained, which helps to improve the accuracy of feature discrimination, solves the problem of long-tail categories, and can suppress overfitting caused by the imbalance of data categories, making the output results of the model more parseable.

[0129] The present disclosure also provides a facial color classification device, and the following are device embodiments of the present disclosure.

[0130] Figure 6 FIG. 1 is a block diagram of a facial color classification device according to an exemplary embodiment. Figure 6 As shown, the device 600 includes:

[0131] An input module 610 is configured to input the face image to be classified of the target user into the global neural network to obtain a first feature map output by the last convolutional layer of the global neural network;

[0132] The segmentation module 620 is configured to segment the face image to be classified into a plurality of face region images, and input the plurality of face region images into a local neural network to obtain a second feature map corresponding to each face region image output by the last convolution layer of the local neural network;

[0133] A first aggregation module 630 is configured to perform an aggregation operation on the first feature map to obtain a first feature vector;

[0134] A second aggregation module 640 is configured to perform an aggregation operation on each of the second feature maps to obtain a second feature vector;

[0135] An acquisition module 650 is configured to acquire a third feature vector generated according to the associated information of the target user;

[0136] A cascading module 660 is configured to cascade the first feature vector, the second feature vector and the third feature vector to obtain a target feature vector;

[0137] The classification module 670 is configured to classify the target feature vector to obtain a facial color classification result.

[0138] In one embodiment of the present disclosure, based on the above solution, the facial color classification device further includes a local neural network training module, and the local neural network training module is configured as follows:

[0139] Acquire a face region sample set, the face region sample set comprising a plurality of face region samples, the face region samples comprising a plurality of face region images segmented from a face image and disease category labels and complexion category labels corresponding to the face images;

[0140] Inputting each face region image in the face region sample into the local neural network respectively to obtain a classification result corresponding to each face region image;

[0141] Determine the cross entropy loss corresponding to each face region image according to the classification result corresponding to each face region image and the complexion category label, and determine the overall cross entropy loss corresponding to the face region sample according to the cross entropy loss corresponding to each face region image and the disease category label;

[0142] According to the overall cross entropy loss corresponding to each face area sample, a local neural network loss is obtained, and the parameters of the local neural network are updated according to the local neural network loss to train the local neural network.

[0143] In one embodiment of the present disclosure, based on the above solution, the local neural network training module is further configured as follows:

[0144] Determining the weight corresponding to each face region image according to the disease category label;

[0145] The overall cross entropy loss corresponding to the face region sample is determined according to the cross entropy loss and weight corresponding to each face region image.

[0146] In one embodiment of the present disclosure, based on the above solution, the facial color classification device further includes a global neural network training module, and the global neural network training module is configured as follows:

[0147] Acquire a facial image sample set, wherein the facial image sample set includes a plurality of facial image samples, and the facial image samples include facial images and facial color category labels corresponding to the facial images;

[0148] Inputting the face images in each of the face image samples into the global neural network respectively to obtain classification results corresponding to each face image;

[0149] Determine a global neural network loss based on the classification results corresponding to each face image and the facial color category label corresponding to each face image;

[0150] A global loss is determined according to the global neural network loss and the local neural network loss, and a parameter of the global neural network is updated according to the global loss to train the global neural network.

[0151] In one embodiment of the present disclosure, based on the above solution, the global neural network training module is further configured as follows:

[0152] Obtaining a second feature map set corresponding to each face image output by the local neural network, wherein the second feature map set includes a plurality of second feature maps;

[0153] Processing each of the second feature map sets based on the channel attention mechanism to obtain an attention feature map set including a plurality of attention feature maps;

[0154] Inputting the face images in each of the face image samples into the global neural network respectively, and obtaining a first feature map corresponding to each face image output by the last convolutional layer of the global neural network;

[0155] For each face image, fusing the first feature map corresponding to the face image with a set of attention feature maps corresponding to the face image through a fusion module in the global neural network to obtain a fusion feature corresponding to the face image;

[0156] The classification results corresponding to the fusion features output by the global neural network are obtained as the classification results corresponding to the face images.

[0157] In one embodiment of the present disclosure, based on the above-mentioned solution, the multiple facial region images are facial region images corresponding to the five internal organs in the field of traditional Chinese medicine.

[0158] In one embodiment of the present disclosure, based on the above-mentioned solution, the first aggregation module 630 is further configured to: use a 1×1 convolution module to convolve the first feature map to obtain a first feature vector.

[0159] According to a third aspect of the present disclosure, an electronic device capable of implementing the above method is also provided.

[0160] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".

[0161] Refer to the following Figure 7 An electronic device 700 according to this embodiment of the present invention will be described. Figure 7 The electronic device 700 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0162] like Figure 7As shown, the electronic device 700 is in the form of a general computing device. The components of the electronic device 700 may include but are not limited to: at least one processing unit 710, at least one storage unit 720, and a bus 730 connecting different system components (including the storage unit 720 and the processing unit 710).

[0163] The storage unit stores program codes, which can be executed by the processing unit 710, so that the processing unit 710 executes the steps according to various exemplary embodiments of the present invention described in the above “Embodiment Method” section of this specification.

[0164] The storage unit 720 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 721 and / or a cache memory unit 722 , and may further include a read-only memory unit (ROM) 723 .

[0165] The storage unit 720 may also include a program / utility 724 having a set (at least one) of program modules 725, such program modules 725 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0166] Bus 730 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0167] The electronic device 700 may also communicate with one or more external devices 900 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 700, and / or communicate with any device that enables the electronic device 700 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 750, such as communicating with a display unit 740. Furthermore, the electronic device 700 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 760. As shown, the network adapter 760 communicates with other modules of the electronic device 700 via a bus 730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0168] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0169] According to a fourth aspect of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to perform the steps according to various exemplary implementations of the present invention described in the above "Exemplary Method" section of the present specification.

[0170] refer to Figure 8 As shown, a program product 800 for implementing the above method according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0171] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0172] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0173] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0174] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0175] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0176] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be performed without departing from its scope. The scope of the present invention is limited only by the appended claims.

Claims

1. A complexion classification method, characterized in that: The method comprises: Inputting the target user's face image to be classified into the global neural network to obtain a first feature map output by the last convolutional layer of the global neural network; Segmenting the face image to be classified into a plurality of face region images, and inputting the plurality of face region images into a local neural network, obtaining a second feature map corresponding to each face region image output by the last convolutional layer of the local neural network, wherein the plurality of face region images are face region images corresponding to the five internal organs in the field of traditional Chinese medicine; Performing an aggregation operation on the first feature map to obtain a first feature vector; Performing an aggregation operation on each of the second feature maps to obtain a second feature vector; Acquire a third feature vector generated according to the associated information of the target user, wherein the associated information includes medical consultation data and basic personal information; Cascading the first feature vector, the second feature vector and the third feature vector to obtain a target feature vector; The target feature vector is classified to obtain a facial color classification result.

2. The method for complexion classification according to claim 1, characterized in that: The local neural network is trained in the following way: Acquire a face region sample set, the face region sample set comprising a plurality of face region samples, the face region samples comprising a plurality of face region images segmented from a face image and disease category labels and complexion category labels corresponding to the face images; Inputting each face region image in the face region sample into the local neural network respectively to obtain a classification result corresponding to each face region image; Determine the cross entropy loss corresponding to each face region image according to the classification result corresponding to each face region image and the complexion category label, and determine the overall cross entropy loss corresponding to the face region sample according to the cross entropy loss corresponding to each face region image and the disease category label; According to the overall cross entropy loss corresponding to each face area sample, a local neural network loss is obtained, and the parameters of the local neural network are updated according to the local neural network loss to train the local neural network.

3. The method for complexion classification according to claim 2, characterized in that: The determining, according to the cross entropy loss corresponding to each face region image and the disease category label, the overall cross entropy loss corresponding to the face region sample comprises: Determining the weight corresponding to each face region image according to the disease category label; The overall cross entropy loss corresponding to the face region sample is determined according to the cross entropy loss and weight corresponding to each face region image.

4. The method for complexion classification according to claim 2, characterized in that: The global neural network is trained in the following way: Acquire a facial image sample set, wherein the facial image sample set includes a plurality of facial image samples, and the facial image samples include facial images and facial color category labels corresponding to the facial images; Inputting the face images in each of the face image samples into the global neural network respectively to obtain classification results corresponding to each face image; Determine a global neural network loss based on the classification results corresponding to each face image and the facial color category label corresponding to each face image; A global loss is determined according to the global neural network loss and the local neural network loss, and a parameter of the global neural network is updated according to the global loss to train the global neural network.

5. The method for complexion classification according to claim 4, characterized in that: The step of inputting the face images in each face image sample into the global neural network to obtain classification results corresponding to each face image includes: Obtaining a second feature map set corresponding to each face image output by the local neural network, wherein the second feature map set includes a plurality of second feature maps; Processing each of the second feature map sets based on the channel attention mechanism to obtain an attention feature map set including a plurality of attention feature maps; Inputting the face images in each of the face image samples into the global neural network respectively, and obtaining a first feature map corresponding to each face image output by the last convolutional layer of the global neural network; For each face image, fusing the first feature map corresponding to the face image with a set of attention feature maps corresponding to the face image through a fusion module in the global neural network to obtain a fusion feature corresponding to the face image; The classification results corresponding to the fusion features output by the global neural network are obtained as the classification results corresponding to the face images.

6. The method for complexion classification according to any one of claims 1 to 5, characterized in that: The performing an aggregation operation on the first feature map to obtain a first feature vector includes: The first feature map is convolved using a 1×1 convolution module to obtain a first feature vector.

7. A facial color classification device, characterized in that: The device comprises: An input module is configured to input the face image to be classified of the target user into the global neural network to obtain a first feature map output by the last convolutional layer of the global neural network; A segmentation module is configured to segment the face image to be classified into a plurality of face region images, and input the plurality of face region images into a local neural network to obtain a second feature map corresponding to each face region image output by the last convolutional layer of the local neural network, wherein the plurality of face region images are face region images corresponding to the five internal organs in the field of traditional Chinese medicine; A first aggregation module is configured to perform an aggregation operation on the first feature map to obtain a first feature vector; A second aggregation module is configured to perform an aggregation operation on each of the second feature maps to obtain a second feature vector; an acquisition module configured to acquire a third feature vector generated according to the associated information of the target user, wherein the associated information includes the medical consultation data and basic personal information; a cascade module, configured to cascade the first feature vector, the second feature vector and the third feature vector to obtain a target feature vector; The classification module is configured to classify the target feature vector to obtain a facial color classification result.

8. A computer-readable program medium, characterized in that The computer program instructions are stored therein, and when the computer program instructions are executed by a computer, the computer is caused to execute the method according to any one of claims 1 to 6.

9. An electronic device, characterized in that: The electronic device comprises: processor; A memory having computer-readable instructions stored thereon, wherein when the computer-readable instructions are executed by the processor, the method according to any one of claims 1 to 6 is implemented.