A Chinese medicine facial diagnosis method and system based on fusion of multiple facial features
By integrating multiple features of the face, the TCM facial diagnosis method uses facial key point detection, infrared thermal imaging cameras, principal component analysis and other technologies, combined with color and texture features, to solve the accuracy and real-time problems of traditional facial diagnosis methods and achieve Provides more accurate and objective facial diagnosis results.
Patent Information
- Application Number
- CN202410850309.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-06-28
AI Technical Summary
Traditional Chinese medicine face-to-face diagnosis methods are greatly affected by time, space and external conditions, and require a high degree of professionalism in Chinese medicine, resulting in subjective and low accuracy of diagnostic results. The existing technology only extracts a small amount of feature information such as the color and gloss of the human face area. , affecting the accuracy of face-to-face diagnosis results.
The traditional Chinese medicine facial diagnosis method based on the fusion of multiple facial features is used to achieve comprehensive fusion of facial features through facial key point detection, facial temperature feature extraction with infrared thermal imaging cameras, principal component analysis and decision tree classification prediction models, combined with color and texture features. and diagnosis.
It improves the accuracy and real-time performance of face-to-face diagnosis, provides objective quantitative analysis data of local and global facial areas, assists clinical diagnosis of traditional Chinese medicine, and promotes the development of objectivity and standardization of medical diagnosis.
Smart Images

Figure CN118430050B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a traditional Chinese medicine facial diagnosis method and system based on the fusion of multiple facial features, belonging to the technical field of medical and health information processing. Background Art
[0002] Traditional Chinese medicine has a long history in my country. As the book "Lingshu: Benzang Pian" says: "Observe the external response to know the internal organs, and then know the disease." Through "looking, smelling, asking, and palpating", the cause of the disease can be diagnosed and the location of the disease can be found. "Looking" means observing the facial contours, skin color and luster of the patient to know the state of the internal organs and qi and blood functions, determine the development trend of the patient's systemic or local diseases, and prevent the disease from worsening in a timely and effective manner.
[0003] However, traditional facial diagnosis is seriously affected by time, space and external conditions, and requires a high level of professionalism of traditional Chinese medicine. Since the level of each traditional Chinese medicine practitioner is inconsistent, the diagnosis results are subjective and the accuracy is not high. With the development of image recognition technology, a method of assisting diagnosis through facial image recognition has emerged. Patent CN 115830009 A discloses a facial diagnosis system and method based on expert knowledge graph reasoning, a region division module, which is used to use a face analysis model to divide the facial image to be diagnosed taken at several angles corresponding to the diagnosis target into regions to obtain multiple regions to be detected; a feature fusion module, which is used to extract features of the facial image to be diagnosed and the region to be detected respectively through a preset residual network model, and to fuse the extracted features to obtain fused features; a feature prediction module, which is used to identify and predict the fused features using a preset decision model to obtain feature prediction results; a diagnostic reasoning module, which is used to perform facial diagnosis knowledge reasoning based on feature prediction results and preset expert knowledge graphs to obtain facial diagnosis results. Patent CN 107516312 A discloses a method for automatic classification of TCM complexion using shallow neural networks. The method includes an offline model training phase and an online complexion classification phase. The facial complexion classification based on statistical decision-making, firstly, in the division of facial regions, it does not adopt different angles to segment the regions, but only needs to take a picture of the face, then call the Dlib toolbox to locate the key points, and then use the crop function to segment the face using the point coordinates; secondly, in the diagnosis module, the classic machine learning model is selected, which has greatly improved the diagnosis time. However, these existing technologies only extract a small amount of feature information such as the color and gloss of the facial region, so most of the facial diagnosis results are single-faceted, and the reference of these extracted features is low, which affects the accuracy of the facial diagnosis results.
[0004] Increasing feature information is necessary to improve the accuracy of facial diagnosis, but the flexibility and real-time performance of facial diagnosis must also be considered comprehensively. How to improve accuracy while improving the flexibility and real-time performance of facial diagnosis is an urgent problem to be solved. Summary of the invention
[0005] The purpose of the present invention is to overcome the above-mentioned shortcomings and provide a Chinese medicine facial diagnosis method based on the fusion of multiple facial features to improve the accuracy and real-time performance of facial diagnosis.
[0006] The technical solution adopted by the present invention is:
[0007] A traditional Chinese medicine facial diagnosis method based on the fusion of multiple facial features comprises the following steps:
[0008] S1. Collect facial images and store them in the image sample library;
[0009] S2. Preprocess the images in the sample library and add labels;
[0010] S3. Detect facial key points on the face image, divide the face into regions and three parts using the coordinates of the key points, and determine the face shape based on the distances calculated by the three parts;
[0011] S4. Preliminary prediction of health abnormalities using overall facial features;
[0012] S5. extracting facial temperature features Tem according to the feedback of the infrared thermal imager; extracting facial color features and texture features of the entire face and the sub-regions; combining all the features of a facial image extracted into a vector X expressing the features of the facial image;
[0013] S6. Using the principal component analysis (PCA) algorithm to fuse the facial image feature vector X, a fused feature vector Y is obtained;
[0014] S7. Use the decision tree method to train the sample set and establish a classification prediction model for the diagnostic classification variables based on the fused features;
[0015] S8. Input the collected facial data to be diagnosed into the classification prediction model for prediction, and combine it with the preliminary prediction in step S4 to finally give a diagnosis of the health status of the human body and internal organs.
[0016] In the above method, the region division described in step S3 first performs facial key point detection on the face image through the Dlib library, detects the key points of the face image, forms an image with facial key points, and calls out the coordinates of its key points. According to the coordinates of the key points, the crop function is used to crop the region of interest, and the face is divided into three parts and 11 regions.
[0017] The color features described in step S5 include RGB (red, green, and blue), HSV (hue, saturation, brightness), and Lab (brightness, red, green, yellow, and blue); specifically, the normalized red ratio of the three primary colors r , Green proportion g , blue proportion b ,tone H , Saturation S ,brightness V The calculation formula of color features is:
[0018] ,
[0019] ,
[0020] ,
[0021] in, r + g + b =1, r , g , b Respectively represent the proportion of red, green, and blue in the normalized color space, R (red), G (green), B (Blue) represents the value of the three primary colors given to each pixel in the image.
[0022] Convert the RGB color space to the HSV color space by K 1. K 2 Calculation H , S , V :
[0023] ,
[0024] ,
[0025] ,
[0026] ,
[0027] ,
[0028] in H (Hue) is the hue, S (Saturation) is saturation, V (Value) is the brightness.
[0029] The texture features described in step S5 are the extraction and analysis of the grayscale spatial distribution pattern, including energy ( Asm), correlation( Corr )、Contrast( Con ),entropy( Ent ) and local binary patterns LBP (Local Binary Pattern), the calculation formula is:
[0030] ,
[0031] ,
[0032] ,
[0033] ,
[0034] in, P ( i , j ) refers to the joint probability density of facial grayscale image pixels i and j, Asm Indicates the uniformity of grayscale distribution and texture of facial images. Corr represents its local grayscale correlation, Con Indicates the clarity and depth of the texture grooves. Ent Indicates the degree of texture non-uniformity in facial images;
[0035] Local Binary Patterns LBP An operator used to describe the local texture features of an image. This feature takes a certain pixel value in the facial image as a threshold, performs threshold processing on the pixels around it, sets the pixel value to zero if it is less than the threshold, and sets it to one if it is greater than the threshold, and obtains a set of binary data. LBP The encoding calculation formula is as follows:
[0036] ,
[0037] in, T lbp The center point c LBP coding,( x c , y c ) is the horizontal and vertical coordinates of the center point, g c is the center pixel ( x c , y c ), g p For field points p The gray value of the image, N is the number of pixels in the surrounding area, s(·) is a step function, c is a central pixel of the gray image, p For the field point.
[0038] In step S5, all features of a facial image extracted are combined into a vector X expressing the features of the facial image:
[0039] ,
[0040] ,
[0041] ,
[0042] in, X whole The features extracted when the input image is a complete facial image; The features extracted when the images of 11 facial regions are input are X subi ; The corresponding features are facial temperature features Tem , the proportion of red in the three primary colors r , Green proportion g , blue proportion b ,tone H , Saturation S ,brightness V , texture feature energy Asm , Correlation Corr , Contrast Con ,entropy Ent , operator of local texture features LBP coding.
[0043] In step S6, the process of fusing the vector X of facial image features using the principal component analysis (PCA) algorithm is as follows:
[0044] Suppose there are n images and p features are extracted from each image, then the original data feature matrix is:
[0045] ,
[0046] The feature data is Gaussian normalized, and the new comprehensive variable is composed of the original variable Linear representation:
[0047] ,
[0048] Satisfy the constraints: , Y i The variance of is recorded as: ,
[0049] beg U 1 Make Var ( Y 1) reaches the maximum, thus UThe random variable determined by 1 is called If the first principal component Y 1 is not enough to reflect the information of the original variable. Y 2. In order to Y 1 and Y 2 The information reflected does not overlap, Y 1 and Y 2 Not relevant, please U 2 Make Var ( Y 2) reaches the maximum, thus U 2 Determined random variables Y 2 is called The second principal component of Y i and Y j are independent of each other until we obtain Y n ;
[0050] The resulting are respectively called the first, second, ..., pth principal component and eigenvector of the original variable , and the corresponding non-zero characteristic root is recorded as , we can define the front m principal components The cumulative contribution rate is ,when m The cumulative contribution rate of the principal components reaches 80% to 90%. m The principal components can replace the original variables, and finally the fused feature vector Y is obtained.
[0051] The goal of establishing a decision tree in step S7 is to establish a classification prediction model of the target variable with respect to each input variable through the training sample set, fully realize data grouping under different values of the input facial feature variables and the target variable, and then use it to classify new facial data objects.
[0052] According to the key features of the internal organs and the labels of health level corresponding to the face images in the image sample library, a training sample set is established. The sample set is represented by Y, where the number of samples is n. The class labels in the samples are represented by Represents that the number of categories is m , a category C i The number of samples in is Y i Then the expected value of information I The representation is:
[0053] ,
[0054] in, p i Any sample belongs to C i The probability of To estimate,
[0055] Set attribute A have v Subset ;in, y j Include Y There are some samples like this, they are in A The value is a j , by definition A is the attribute of the current branch to be made. Now the branch divided by the node is A The subset of is represented by, let the category be C i , the sample belongs to the subset y j Samples for y ij Indicates that the current attribute A The information entropy is:
[0056] ,
[0057] in, As the j The weight of a sample subset is equal to the subset of samples (i.e. A Value is a j ) divided by the number of samples Y The total number of samples, for a given subset y j There is a formula:
[0058] ,
[0059] in, p ij yes y j The samples in belong to class C i The probability of To express.
[0060] Through the above representation of information expectation and information entropy, we can obtain A The encoded information obtained by branching can be expressed as:
[0061] ,
[0062] By attribute A Split sample set Y The breadth and uniformity of the information can be expressed by splitting calculate:
[0063] ,
[0064] in, y 1 arrive y c It means that it contains v Attributes with attribute values A Split Sample y formed v Sample subset
[0065] At this time, for the attributes A , the final information gain rate is the ratio of the amount of encoded information to the amount of split information:
[0066] ,
[0067] The specific modeling process is as follows:
[0068] (1) Create root node N;
[0069] (2) If all candidate attribute samples belong to the same class C, their candidate attributes are not considered, and the returned node N is a leaf node with the label C.
[0070] (3) Calculate the information gain rate GainRation for all attributes in the candidate attribute sample set;
[0071] (4) Select the attribute with the highest information gain rate (bestAttribute) in the attribute set and find the highest attribute partition mark node N;
[0072] (5) For each unknown value ai in bestAttribute, a branch with the condition bestAttribute = ai is generated from node N;
[0073] (6) Let yi be the set of facial image samples with bestAttribute=ai in the sample;
[0074] (7) Add a node returned by the decision tree (yi, attribute-bestAttribute), that is, recursively call the dataset subset yi;
[0075] (8) Generate the final decision tree, import the facial images of the test set, and output the health label corresponding to the image.
[0076] The TCM facial diagnosis system based on the fusion of multiple facial features includes:
[0077] An image acquisition module is used to acquire facial images and store them in a picture sample library;
[0078] Image preprocessing module, used to preprocess the images in the sample library and add labels;
[0079] The region division module is used to detect key points of the face image and divide the face into three regions and segment it into three parts using the coordinates of the key points.
[0080] The face shape judgment module is used to judge the face shape based on the distance calculated by the three parts of the face;
[0081] Feature extraction module, used to extract facial temperature feature Tem; extract facial color features and texture features of the entire face and by region;
[0082] Feature fusion module, used to fuse all features of facial images using principal component analysis (PCA) algorithm;
[0083] The classification prediction model building module uses the decision tree method to train the sample set and establish a classification prediction model for the diagnostic classification variables with respect to the fused feature variables;
[0084] The diagnosis module is used to combine the prediction of the classification prediction model with the preliminary prediction based on the face shape to finally give a diagnosis of the health status of the human body and internal organs.
[0085] The beneficial effects of the present invention are:
[0086] In terms of facial feature collection, the method of the present invention extracts color and texture features from the human face, and also adds the extraction of facial thermal temperature data and face shape information; in terms of facial segmentation, the collected human face is segmented into facial regions, and the color, temperature and texture features of the entire face and each sub-region are simultaneously analyzed to achieve local and overall parallel diagnosis. In terms of feature fusion: the features such as distance, thermal temperature, color and texture are fused, and the improvement of running time is taken into account on the basis of ensuring full expression of facial information. In terms of diagnosis: the face shape is output as a whole, and it can be predicted whether the patient's brain or lungs are prone to abnormalities, and local analysis can output the health status of each organ. The method of the present invention extracts comprehensive features, the feature fusion is efficient and accurate, and the modeling classification and recognition speed is fast, which greatly improves the accuracy and real-time performance of facial diagnosis. The present invention provides objective local and global facial region quantitative analysis data for Chinese medicine doctors, assists in Chinese medicine clinical diagnosis, and will greatly promote the development of objectivity and standardization of medical diagnosis. BRIEF DESCRIPTION OF THE DRAWINGS
[0087] Figure 1 is a flow chart of the method of the present invention;
[0088] Figure 2 This is a diagram of facial key point calibration according to the present invention;
[0089] Figure 3 A decision tree flow chart is constructed for the present invention. DETAILED DESCRIPTION
[0090] The following is further described in conjunction with specific embodiments.
[0091] Embodiment 1 A TCM facial diagnosis method based on the fusion of multiple facial features comprises the following steps:
[0092] S1. Collect facial images and store them in the image sample library:
[0093] When collecting image data, in order to control variables and ensure the uniformity of light, a standard light source box for visual diagnosis is used, and a binocular vision system combining an infrared thermal imager and a visible light camera is selected. This can not only make up for the shortcomings of a single sensor in the past, but also provide thermal temperature data information for visual diagnosis.
[0094] Before the shooting, the volunteers were informed of the shooting conditions: no makeup on the face, no bangs allowed, the forehead must be fully exposed, the beard must be trimmed in advance, and the emotions must be kept stable. During the shooting, the volunteers were required to sit upright, facing the artificial light source, and ensure that the light on the face was bright and even. Facial images were collected and stored in the image sample library.
[0095] S2. Preprocess the images in the sample library and add labels:
[0096] Input the pictures in the sample image library, flip each face image left and right to form a new image copy, and update it to the sample image library to increase the number of samples. Use Labelme software to add healthy and abnormal labels to the facial images in the sample image library, as well as healthy and abnormal labels for the internal organs corresponding to the facial area.
[0097] S3. Detect key points of the face image, divide the face into three regions and segment it into three parts using the coordinates of the key points, and determine the face shape based on the distance calculated by the three parts:
[0098] The Dlib library is used to detect facial key points of face images. Its powerful image feature extraction function can accurately and quickly detect 68 key points of face images, form an image with facial key points, and call out the coordinates of its key points. Based on the coordinates of the key points, the crop function is used to crop the area of interest. According to the theory of traditional Chinese medicine, the face is divided into three parts and 11 areas.
[0099] The length of the forehead area (i.e., area 1 in the figure) is the distance between the horizontal coordinates of point 25 and point 20, the width is half of the length, and the lowest point of the width is the maximum value of the vertical coordinates of point 25 and point 26. The formulas are:
[0100] ,
[0101] ,
[0102] ,
[0103] .
[0104] The lung color area refers to the area between the two eyebrows, between the two eyebrows, and the beginning of the upper end of the nose bridge. Figure 2 The length of area 2) is the distance between the horizontal coordinates of points 22 and 23, and the width is the midpoint of the distance from the lowest point of the forehead to the first point of the nose (point 28). The formula is:
[0105] ,
[0106] .
[0107] The length of the eye area 3 is the distance between point 38 and point 39, and the width is the distance from eyebrow point 21 to eye point 39. Area 4 can be compared to area 3, and the formula is as follows:
[0108] ,
[0109] ,
[0110] ,
[0111] .
[0112] Figure 2 The middle area 5 to 11 can be divided similarly to the area 1 to 4. The heart color part is Figure 2 Area 5 is located between the inner corners of the two eyes, at the lowest point of the bridge of the nose, also known as the root of the nose. Figure 2 Areas 6 and 7) are the color parts of the liver and other internal organs. Figure 2 Area 8 in the middle is the nose, which is the orifice of the lungs, allowing breathing and controlling lung qi. Therefore, the color of the spleen and lung diseases can be observed from here. The spleen color area is located at the tip of the nose (i.e. Figure 2 Area 9). Area 10 is the mouth, and the color of the lips can reflect the spleen and stomach. Figure 2 The area 11 is the chin area corresponding to the gastrointestinal part of a person.
[0113] Using the key point coordinates, divide the three regions of the face: the upper region is from the hairline point to the glabella point, which is the height of region 1; the middle region is from the glabella point to the subnasale point, which is the distance between point 23 and point 34; the lower region is from the subnasale point to the menton point, which is the distance between point 34 and point 9. Based on the distances calculated for the three regions, determine the face shape.
[0114] S4. Use the overall face shape characteristics to preliminarily predict health abnormalities:
[0115] The human face is divided into three parts, namely the three regions. According to the proportions of the three regions, the face shape of the patient can be judged: if the upper region is too wide or too high, it is a "Jia" face shape, which is called the brain type, indicating underdevelopment of the nervous system. Usually, such people are prone to diseases related to the brain and mental aspects such as insomnia and dreaminess; the middle region, especially the cheek area, is mainly related to the health of the liver and lungs. For the "Shen" face shape with a wide middle region, this face shape is called the respiratory type and is prone to respiratory diseases; if the lower region is particularly wide, it is called the digestive type and is prone to digestive system diseases; if the three regions are all uneven, it is the muscle type and is prone to joint and muscle diseases. Only those with well-proportioned three regions are the healthiest people.
[0116] S5. Extract the facial temperature feature Tem according to the feedback of the infrared thermal imager; extract the facial color features and texture features for the entire face and sub-regions; combine all the features of a single facial image into a vector X that represents the features of the facial image:
[0117] First, according to the feedback of the infrared thermal imager, automatically store the facial temperature feature Tem. Based on the relationship between the abnormal activation or reduction of local metabolism caused by various diseases and the facial temperature difference, obtain continuous and dynamic infrared information of the face, and at the same time obtain the thermal temperature data Tem of the facial sub-regions, providing a diagnostic basis for automated traditional Chinese medicine face diagnosis.
[0118] The color features include: RGB (red, green, blue), HSV (hue, saturation, value), and Lab (lightness, a* (red - green chromaticity), b* (yellow - blue chromaticity)) are extracted using the technology of multi-color space information fusion. RGB is the three primary colors. By changing the amounts of the three primary colors, various colors can be mixed: Color = R (percentage of red) + G (percentage of green) + B (percentage of blue). In the chromaticity system, the ratio values of RGB - chromaticity coordinates ( r 、 g 、 b ) are expressed as:
[0119] ,
[0120] ,
[0121] ,
[0122] where r +g + b =1, r , g , b Respectively represent the proportion of red, green, and blue in the normalized color space. R (red), G (green), B (Blue) represents the value of the three primary colors given to each pixel in the image.
[0123] The HSV color space is similar to the way humans perceive color, and the color classification is simple and has a strong perception. The RGB color space can be converted to the HSV color space using the following formula:
[0124] ,
[0125] ,
[0126] ,
[0127] ,
[0128] ,
[0129] in H (Hue) is the hue, S (Saturation) is saturation, V (Value) is the brightness.
[0130] Image texture features are the extraction and analysis of the grayscale spatial distribution pattern. The statistical features of the color histogram reflect the skin color type as well as the texture characteristics of the skin. Therefore, the statistical features of the facial area are extracted, including energy ( Asm ), correlation( Corr )、Contrast( Con ),entropy( Ent ):
[0131] ,
[0132] ,
[0133] ,
[0134] ,
[0135] in, P ( i , j ) refers to the joint probability density of facial grayscale image pixels i and j. AsmIndicates the uniformity of grayscale distribution and texture of facial images. Corr represents its local grayscale correlation, Con Indicates the clarity and depth of the texture grooves. Ent Indicates the degree of texture non-uniformity in facial images.
[0136] LBP (Local Binary Pattern) is an operator used to describe the local texture features of an image. This feature uses a certain pixel value in a facial image as a threshold and performs threshold processing on the pixels around it. If the pixel value is less than the threshold, it is set to zero, and if it is greater than the threshold, it is set to one, resulting in a set of binary data.
[0137] LBP The encoding calculation formula is as follows:
[0138] ,
[0139] in, T lbp The center point c LBP coding,( x c , y c ) is the horizontal and vertical coordinates of the center point, g c is the center pixel ( x c , y c ), g p For field points p The gray value of the image, N is the number of pixels in the surrounding area, s(·) is a step function, c is a central pixel of the gray image, p For the field point.
[0140] Combine all the features of a facial image into a vector that can express the features of the facial image:
[0141] ,
[0142] ,
[0143] ,
[0144] in, X whole The features extracted when the input image is a complete facial image; The features extracted when the images of 11 facial regions are input are X subi ; The corresponding features are facial temperature features Tem , the proportion of red in the three primary colors r , Green proportion g , blue proportion b ,tone H , Saturation S ,brightness V , texture feature energy Asm , Correlation Corr , Contrast Con ,entropy Ent , operator of local texture features LBP coding.
[0145] S6. Use the principal component analysis (PCA) algorithm to fuse the facial image feature vector X to obtain the fused feature vector Y:
[0146] The PCA method combines local color and texture features that have strong ability to express facial information with facial temperature, distance features, and overall color and texture features of the face. This not only takes into account the overall information of the face, but also takes into account the local information, so that the feature parameters can reflect the face as comprehensively as possible, thus improving the accuracy of facial diagnosis.
[0147] The PCA method is to construct a series of linear combinations of the original variables so that each linear combination can reflect as much information of the original variables as possible under the premise of being independent of each other, so as to maximize its variance.
[0148] Suppose there are n images and p features are extracted from each image, then the original data feature matrix is:
[0149] ,
[0150] Different feature variables often have different dimensions. Since different dimensions will cause the dispersion of the values of each variable to vary greatly, the feature data is Gaussian normalized before the PCA method is used for fusion. Linear representation:
[0151] ,
[0152] Satisfy the constraints: , Y i The variance of is recorded as: ;
[0153] beg U 1 Make Var ( Y 1) reaches the maximum, thus U The random variable determined by 1 is called If the first principal component Y1 is not enough to reflect the information of the original variable. Y 2. In order to Y 1 and Y 2 The information reflected does not overlap, Y 1 and Y 2 Not relevant, please U 2 Make Var ( Y 2) reaches the maximum, thus U 2 Determined random variables Y 2 is called The second principal component of Y i and Y j are independent of each other until we obtain Y n ;
[0154] The resulting are respectively called the first, second, ..., pth principal component and eigenvector of the original variable , and the corresponding non-zero characteristic root is recorded as , we can define the front m principal components The cumulative contribution rate is when m The cumulative contribution rate of the principal components reaches a certain proportion (80% to 90%). m The principal components can replace the original variables, and finally the fused feature vector Y is obtained.
[0155] S7. Use the decision tree method to train the sample set and establish a classification prediction model for diagnostic classification variables based on the fused features:
[0156] The classification algorithm can adopt machine learning or neural network classification. Considering the later service for doctors' diagnosis and the real-time requirement for diagnosis, the decision tree algorithm with faster classification and recognition speed is selected.
[0157] Decision Tree (also known as decision tree) is a classification model expressed in the form of a tree structure. Decision tree classifiers are widely used in the field of image processing. The algorithm itself has low complexity, high classification accuracy, and fast recognition speed.
[0158] The goal of establishing a decision tree is to establish a classification prediction model of the target variable with respect to each input variable through a training sample set, to fully realize data grouping under different values of the input facial feature variables and the target variable, and then to use it to classify new facial data objects.
[0159] According to the key features of the internal organs and the labels of health level corresponding to the face images in the image sample library, a training sample set is established. The sample set is represented by Y, where the number of samples is n. The class labels in the samples are represented by Represents that the number of categories is m , a category C i The number of samples in is Y i Then the expected value of information I The representation is:
[0160] ,
[0161] in, p i Any sample belongs to C i The probability of To estimate,
[0162] Set attribute A have v Subset ;in, y j Include Y There are some samples like this, they are in A The value is a j , by definition A is the attribute of the current branch to be made. Now the branch divided by the node is A The subset of is represented by, let the category be C i , the sample belongs to the subset y j Samples for y ij Indicates that the current attribute A The information entropy is:
[0163] ,
[0164] in, As the j The weight of a sample subset is equal to the subset of samples (i.e. A Value is a j ) divided by the number of samples Y The total number of samples, if the value of information entropy is smaller, then the purity of the classification according to a certain attribute is higher. For a given subset y j There is a formula:
[0165] ,
[0166] in, p ij yes y j The samples in belong to class C i The probability of To express.
[0167] Through the above representation of information expectation and information entropy, we can obtain A The encoded information obtained by branching can be expressed as:
[0168] ,
[0169] By attribute A Split sample set Y The breadth and uniformity of the information can be expressed by splitting ,
[0170] ,
[0171] in, y 1 to y c It means that it contains v Attributes with attribute values A Split Sample y formed v Sample subset
[0172] At this time, for the attributes A , the final information gain rate is the ratio of the amount of encoded information to the amount of split information:
[0173] .
[0174] The specific modeling process is as follows:
[0175] (1) Create root node N;
[0176] (2) If all candidate attribute samples belong to the same class C, their candidate attributes are not considered, and the returned node N is a leaf node with the label C.
[0177] (3) Calculate the information gain rate GainRation for all attributes in the candidate attribute sample set;
[0178] (4) Select the attribute with the highest information gain rate (bestAttribute) in the attribute set and find the highest attribute partition
[0179] Mark node N;
[0180] (5) For each unknown value ai in bestAttribute, a branch with the condition bestAttribute = ai grows out from node N;
[0181] (6) Let yi be the set of facial image samples with bestAttribute=ai in the sample;
[0182] (7) Add a node returned by the decision tree (yi, attribute-bestAttribute). That is, recursively call the dataset subset yi;
[0183] (8) Generate the final decision tree, import the facial images of the test set, and output the health label corresponding to the image.
[0184] By using the information gain rate, the decision tree algorithm can select split attributes more balanced and build a more accurate and effective classification model. Finally, the overall health of the face in the sample library and the health of the sub-regions are obtained.
[0185] S8. Input the collected facial data to be diagnosed into the classification prediction model for prediction, and combine the preliminary prediction in step S4 to finally give a diagnosis of the health status of the human body and internal organs:
[0186] Combining the facial distance features and health status, the output is the volunteer's face shape, that is, the internal organs areas that are more prone to problems, and the health status of each internal organ.
[0187] Embodiment 2 A TCM facial diagnosis system based on fusion of multiple facial features that implements the method described in Embodiment 1 comprises:
[0188] An image acquisition module is used to acquire facial images and store them in a picture sample library;
[0189] Image preprocessing module, used to preprocess the images in the sample library and add labels;
[0190] The region division module is used to detect key points of the face image and divide the face into three regions and segment it into three parts using the coordinates of the key points.
[0191] The face shape judgment module is used to judge the face shape based on the distance calculated by the three parts of the face;
[0192] Feature extraction module, used to extract facial temperature feature Tem; extract facial color features and texture features of the entire face and by region;
[0193] Feature fusion module, used to fuse all features of facial images using principal component analysis (PCA) algorithm;
[0194] The classification prediction model building module uses the decision tree method to train the sample set and establish a classification prediction model for the diagnostic classification variables with respect to the fused feature variables;
[0195] The diagnosis module is used to combine the prediction of the classification prediction model with the preliminary prediction based on the face shape to finally give a diagnosis of the health status of the human body and internal organs.
[0196] The above is a further description of the present invention in conjunction with specific embodiments, and the protection scope of the present invention is not limited thereto.
Claims
1. A Chinese medicine facial diagnosis method based on the fusion of multiple facial features. Its characteristics are: The steps include: S1. Collect facial images and store them in the image sample library; S2. Preprocess the images in the sample library and add labels; S3. Detect facial key points on the face image, divide the face into regions and three parts using the coordinates of the key points, and determine the face shape based on the distances calculated by the three parts; S4. Preliminary prediction of health abnormalities using overall facial features; S5. extracting facial temperature features Tem according to the feedback of the infrared thermal imager; extracting facial color features and texture features of the entire face and the sub-regions; combining all the features of a facial image extracted into a vector X expressing the features of the facial image; , , , in, X whole The features extracted when the input image is a complete facial image; The features extracted when the images of 11 facial regions are input are X subi ; The corresponding features are facial temperature features Tem , the proportion of red in the three primary colors r , Green proportion g , blue proportion b ,tone H , Saturation S ,brightness V , texture feature energy Asm , Correlation Corr , Contrast Con ,entropy Ent , operator of local texture features LBP coding; S6. Using the principal component analysis (PCA) algorithm to fuse the facial image feature vector X, a fused feature vector Y is obtained; S7. Use the decision tree method to train the sample set and establish a classification prediction model for the diagnostic classification variables based on the fused features; S8. Input the collected facial data to be diagnosed into the classification prediction model for prediction, and combine it with the preliminary prediction in step S4 to finally give a diagnosis of the health status of the human body and internal organs.
2. A Chinese medicine facial diagnosis method based on fusion of multiple facial features according to claim 1, Its characteristics are: The region division described in step S3 first detects the key points of the face image through the Dlib library, detects the key points of the face image, forms an image with the key points of the face, and calls out the coordinates of the key points. According to the coordinates of the key points, the region is cropped using the crop function to divide the face into three parts and 11 regions.
3. A Chinese medicine facial diagnosis method based on fusion of multiple facial features according to claim 1, Its characteristics are: The color features described in step S5 include RGB, HSV and Lab; specifically include the normalized red ratio of the three primary colors r , Green proportion g , blue proportion b ,tone H , Saturation S ,brightness V .
4. A Chinese medicine facial diagnosis method based on fusion of multiple facial features according to claim 3, Its characteristics are: The calculation formula of the color feature in step S5 is: , , , in, r + g + b =1, r , g , b Respectively represent the proportion of red, green, and blue in the normalized color space, R , G , B Respectively represent the values of the three primary colors given to each pixel in the image; Convert the RGB color space to the HSV color space by K 1 , K 2 calculate H , S , V : , , , , , in H It's the color tone. S is saturation, V For brightness.
5. According to claim 1, a method for traditional Chinese medicine facial diagnosis based on fusion of multiple facial features, Its characteristics are: The texture features described in step S5 are the extraction and analysis of the grayscale spatial distribution pattern, including energy Asm , Correlation Corr , Contrast Con ,entropy Ent Local Binary Patterns LBP , the calculation formula is: , , , , in, P ( i , j ) refers to the joint probability density of facial grayscale image pixels i and j, Asm Indicates the uniformity of grayscale distribution and texture of facial images. Corr represents its local grayscale correlation, Con Indicates the clarity and depth of the texture grooves. Ent Indicates the degree of texture non-uniformity in facial images; Local Binary Patterns LBP An operator used to describe the local texture features of an image. This feature takes a certain pixel value in the facial image as a threshold, performs threshold processing on the pixels around it, sets the pixel value to zero if it is less than the threshold, and sets it to one if it is greater than the threshold, and obtains a set of binary data. LBP The encoding calculation formula is as follows: , in, T lbp The center point c LBP coding,( x c , y c ) is the horizontal and vertical coordinates of the center point, g c is the center pixel ( x c , y c ), g p For field points p The gray value of the image, N is the number of pixels in the surrounding area, s(·) is a step function, c is a central pixel of the gray image, p For the field point.
6. A Chinese medicine facial diagnosis method based on fusion of multiple facial features according to claim 1, Its characteristics are: In step S6, the process of fusing the vector X of facial image features using the principal component analysis (PCA) algorithm is as follows: Suppose there are n images and p features are extracted from each image, then the original data feature matrix is: , The feature data is Gaussian normalized, and the new comprehensive variable is composed of the original variable Linear representation: , Satisfy the constraints: , Y i The variance of is recorded as: ; beg U 1 make Var ( Y 1 ) reaches its maximum, thus U 1 The random variable determined is called If the first principal component Y 1 It is not enough to reflect the information of the original variable. Y 2 , in order to Y 1 and Y 2 The information reflected does not overlap. Y 1 and Y 2 Not relevant, please U 2 make Var ( Y 2 ) reaches its maximum, thus U 2 The random variable determined Y 2 called The second principal component of Y i and Y j are independent of each other until we obtain Y n ; The resulting are respectively called the first, second, ..., pth principal component and eigenvector of the original variable , and the corresponding non-zero characteristic root is recorded as , we can define the front m principal components The cumulative contribution rate is ,when m The cumulative contribution rate of the principal components reaches 80% to 90%. m The principal components can replace the original variables, and finally the fused feature vector Y is obtained.
7. A Chinese medicine facial diagnosis method based on fusion of multiple facial features according to claim 1, Its characteristics are: The modeling process in step S7 is as follows: (1) Create root node N; (2) If all candidate attribute samples belong to the same class C, their candidate attributes are not considered, and the returned node N is a leaf node with the label C. (3) Calculate the information gain rate of all attributes in the candidate attribute sample set; (4) Select the attribute bestAttribute with the highest information gain rate in the attribute set and find the highest attribute partition Mark node N; (5) For each unknown value ai in bestAttribute, a branch with the condition bestAttribute = ai is generated from node N; (6) Let yi be the set of facial image samples with bestAttribute=ai in the sample; (7) Add a node returned by the decision tree, that is, recursively call the dataset subset yi; (8) Generate the final decision tree, import the facial images of the test set, and output the health label corresponding to the image.
8. Traditional Chinese medicine facial diagnosis system based on the fusion of multiple facial features, Its characteristics are: include: An image acquisition module is used to acquire facial images and store them in a picture sample library; Image preprocessing module, used to preprocess the images in the sample library and add labels; The region division module is used to detect key points of the face image and divide the face into three regions and segment it into three parts using the coordinates of the key points. The face shape judgment module is used to judge the face shape based on the distance calculated by the three parts of the face; The feature extraction module is used to extract the facial temperature feature Tem; extract the facial color feature and texture feature of the entire face and the sub-regions, and combine all the features of a facial image into a vector X that expresses the features of the facial image: , , , in, X whole The features extracted when the input image is a complete facial image; The features extracted when the images of 11 facial regions are input are X subi ; The corresponding features are facial temperature features Tem , the proportion of red in the three primary colors r , Green proportion g , blue proportion b ,tone H , Saturation S ,brightness V , texture feature energy Asm , Correlation Corr , Contrast Con ,entropy Ent , operator of local texture features LBP coding; Feature fusion module, used to fuse all features of facial images using principal component analysis (PCA) algorithm; The classification prediction model building module uses the decision tree method to train the sample set and establish a classification prediction model for the diagnostic classification variables with respect to the fused feature variables; The diagnosis module is used to combine the prediction of the classification prediction model with the preliminary prediction based on the face shape to finally give a diagnosis of the health status of the human body and internal organs.
Citation Information
Patent Citations
TCM complexion automatic sorting method applying superficial layer neural network
CN107516312A
Face diagnosis system, method and equipment based on expert knowledge graph reasoning and medium
CN115830009A
Traditional Chinese medicine face diagnosing system and face diagnosing method based on face region segmentation
CN106971147A
Multi-feature fusion facial paralysis automatic evaluation method
CN111613306A
