Machine learning-based head portrait image recognition method and device, and storage medium
Through avatar image recognition method based on machine learning, combined with hairpin density and facial state analysis, the problem of low avatar recognition efficiency in the prior art is solved, and accurate judgment of user health trends is achieved.
Patent Information
- Application Number
- CN202510580772.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-07
- Publication Date
- 2025-06-24
AI Technical Summary
The prior art fails to effectively analyze the user status reflected by the user's avatar image in facial recognition, resulting in low recognition efficiency.
Using a machine learning-based avatar image recognition method, by collecting user's avatar images, historical user's avatar data and ambient light data, the user's avatar images are processed and divided into areas, analyzing the user's hair density status and facial status, and finally determining the user's avatar trend.
It realizes efficient identification of user avatar images, can accurately analyze the healthy development trend of users, and improves the efficiency of judging user status.
Smart Images

Figure CN120198948A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and particularly to a method, device and storage medium for avatar image recognition based on machine learning. Background Art
[0002] With the development of information technology, biometric technologies have been gradually applied to various fields. In the medical industry, it is crucial to understand the user's status in real time. In addition to real-time monitoring by instruments, the monitoring and analysis of the user's avatar image are also equally important for judging the user's status; therefore, it is necessary to develop a more stable and reliable avatar image recognition system.
[0003] Chinese Patent Publication No. CN108491794A discloses a method and device for face recognition, belonging to the technical field of image processing. The method includes: obtaining a face image to be recognized and extracting a target feature vector of the face image; calculating the distance between each target feature vector and the mean vector corresponding to each face identifier to obtain a first distance set, and determining a first recognition result corresponding to the face image and its corresponding first confidence according to each first distance set; calculating the distance between each target feature vector and each feature vector corresponding to each face identifier to obtain a second distance set, and determining a second recognition result corresponding to the face image and its corresponding second confidence according to each second distance set; determining a face recognition result corresponding to the face image and the confidence corresponding to the face recognition result according to the first recognition result, the first confidence, the second recognition result and the second confidence; thus, it can be seen that the invention aims to improve the recognition accuracy and does not analyze the user status reflected by the user's avatar image, resulting in the problem of low efficiency in recognizing the user's avatar. Summary of the Invention
[0004] The purpose of the present invention is to provide a method for avatar image recognition based on machine learning to solve at least one of the problems existing in the prior art.
[0005] To achieve the above purpose, according to one aspect of the present application, the present invention provides a method for avatar image recognition based on machine learning, including:
[0006] Collecting the user's avatar image, historical user avatar data and environmental light data;
[0007] Processing the user's avatar image and then dividing the area of the user's avatar image;
[0008] Analyzing the hair density status of the user based on the divided user's avatar image;
[0009] Identifying the average hair diameter of the user's avatar image and processing the process of the user's hair density status according to the recognition result;
[0010] Determine the facial features of the user based on the regional division result of the user's avatar image and the historical user avatar data, and then obtain the facial state of the user through numerical analysis based on the facial features of the user;
[0011] Judge the avatar trend of the user based on the hair density state of the user and the facial state of the user.
[0012] Optionally, the process of processing the user's avatar image is as follows:
[0013] Collect the contrast α of the user's avatar image, process the user's avatar image according to the contrast α of the user's avatar image, and when α ≤ A, perform a filtering operation on the user's avatar image in the way of Gaussian filtering; where A is a preset image contrast.
[0014] Optionally, the process of regional division of the processed user's avatar image is as follows:
[0015] Calculate the fuzziness parameter m, and set the calculation process of the fuzziness parameter m as: m = exp{(A - α) / A};
[0016] Perform fuzzy clustering on the processed user's avatar image based on the fuzziness parameter m to obtain each fuzzy clustering cluster D(i), where D(i) represents the i-th fuzzy clustering cluster;
[0017] Classify the types of each fuzzy clustering cluster into a background cluster, a facial cluster, and a hair cluster according to the gray value Gray(i) of the central pixel point of each fuzzy clustering cluster. When the type of the fuzzy clustering cluster is a facial cluster, divide the pixel points in the fuzzy clustering cluster into a facial area, and when the type of the fuzzy clustering cluster is a hair cluster, divide the pixel points in the fuzzy clustering cluster into a hair area.
[0018] Optionally, statistically calculate the average gray value Pg in the hair area, and analyze the hair density state of the user based on the average gray value Pg of the hair area and the preset hair density gray value PG. The hair density state of the user includes low hair density and normal hair density.
[0019] Optionally, identify the average hair diameter of the user's avatar image, and process the process of the user's hair density state according to the recognition result;
[0020] Analyze the light state of the user's avatar image according to the environmental light data, and further process the process of processing the user's hair density state according to the analysis result of the light state;
[0021] Identify the diameter d(z) of each hair in the user's avatar image, calculate the average hair diameter D based on the recognition result, analyze the user's hair diameter state according to the average hair diameter D. The user's hair diameter state includes thin hair diameter, normal hair diameter, and thick hair diameter. When the user's hair diameter is thin, set the preset hair density gray value to PG'; when the user's hair diameter is thick, set the preset hair density gray value to PG".
[0022] Analyze the light state of the user's avatar image according to the ambient light data. The light state of the user's avatar image includes low light state, normal, and strong light state. When the light state of the user's avatar image is in the low light state, set the second preset hair diameter to YD2'; when the light state of the user's avatar image is in the strong light state, set the first preset hair diameter to YD1'.
[0023] Optionally, calculate the average gray value of the pixel points in the facial area of the user's head image, and then extract the user's facial features by setting a judgment threshold.
[0024] Based on the numerical analysis of the user's facial features and historical user avatar data to obtain the user's facial state.
[0025] Record the average gray value of the pixel points in the facial area of the user's head image as Pm. The process of extracting the user's facial features is as follows:
[0026] If Pm is less than PM1, determine that the user's facial features are a type of abnormal feature and set the facial abnormal feature index to γ1; if Pm is greater than or equal to PM1 and less than PM2, determine that the user's facial features are normal features and set the facial abnormal feature index to γ2; if Pm is greater than or equal to PM2, the facial feature analysis unit determines that the user's facial features are a type of abnormal feature and sets the facial abnormal index to γ3; where PM1 is the first preset facial gray value and PM2 is the second preset facial gray value.
[0027] Process and regionally divide each historical user avatar image to obtain each historical facial area.
[0028] Optionally, count the historical average gray value SD(t) of each historical facial area and calculate the historical change coefficient η; where SD(t) represents the historical average gray value of the t-th historical facial area, and analyze the user's facial state based on the historical change coefficient and the user's facial feature extraction result. The analysis result of the user's facial state includes normal and abnormal.
[0029] Optionally, the trend judgment module is used to judge the user's avatar trend based on the analysis results of the user's hair density state and the analysis results of the user's facial state, and store the judgment results and the user's avatar image: if the user's facial state is normal and the user's hair density is normal, the trend judgment module determines that the user's avatar trend is normal, and stores the user's avatar image as a normal image; if the user's facial state is abnormal and the user's hair density is normal, the trend judgment module determines that the user's avatar trend is an abnormality of the user's dominant features, and stores the user's avatar image as a secondary abnormal image; if the user's facial state is normal and the user's hair density is low, the trend judgment module determines that the user's avatar trend is an abnormality of the user's recessive features, and stores the user's avatar image as a tertiary abnormal image; if the user's facial state is abnormal and the user's hair density is low, the trend judgment module determines that the user's avatar trend is a crisis abnormality, and stores the user's avatar image as a primary abnormal image.
[0030] According to another aspect of the present application, there is provided a machine learning-based avatar image recognition device, including:
[0031] An image data acquisition module for acquiring the user's avatar image and historical user avatar data;
[0032] An ambient light acquisition module for acquiring ambient light data;
[0033] A user image analysis module for processing the user's avatar image and dividing the area of the user's avatar image;
[0034] A hair volume recognition module for analyzing the user's hair density state according to the area division result of the user's avatar image, and further for identifying the average hair diameter of the user's avatar image, and iterating the analysis process of the user's hair density state according to the recognition result. The hair volume recognition module is further for analyzing the light state of the user's avatar image according to the ambient light data, and performing a secondary iteration on the analysis process of processing the user's hair density state according to the analysis result of the light state;
[0035] A face recognition module for analyzing the user's facial state according to the area division result of the user's avatar image and the historical user avatar data;
[0036] A trend judgment module for judging the user's avatar trend according to the analysis results of the user's hair density state and the analysis results of the user's facial state.
[0037] According to another aspect of the present application, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program, wherein the computer program is used to control an electronic device where the computer-readable storage medium is located to execute the above-mentioned machine learning-based avatar image recognition method when running.
[0038] Compared with the prior art, the beneficial effects of the present invention are as follows: By analyzing the color states of the hair covering area and the facial skin area of the user's avatar image, machine learning-based image analysis is realized, and then two-dimensional state analysis of the user based on the avatar image is realized. Furthermore, according to the analysis results, the actual tendency state of the user's physique is judged, and this is used as the user's state certificate, improving the efficiency of recognizing the user's avatar image. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following-described drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0040] Figure 1 It is a flowchart of the method for recognizing an avatar image based on machine learning in this embodiment.
[0041] Figure 2 It is a flowchart of the method for dividing regions of the avatar image in this embodiment.
[0042] Figure 3 It is a flowchart of the method for updating the hair density state in this embodiment.
[0043] Figure 4 It is a flowchart of the method for analyzing the facial state in this embodiment.
[0044] Figure 5 It is a schematic structural diagram of the electronic device provided in this embodiment.
[0045] Figure 6 It is a schematic structural diagram of the device for recognizing an avatar image based on machine learning provided in this embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0046] In order to more clearly illustrate the present invention, the present invention will be further described below in conjunction with preferred embodiments and the drawings. Similar components in the drawings are denoted by the same reference numerals. Those skilled in the art should understand that the content specifically described below is illustrative rather than restrictive, and should not be used to limit the protection scope of the present invention.
[0047] It should be noted that although terms such as first, second, and third may be used in the embodiments of the present application for description, these descriptions should not be limited to these terms. These terms are only used to distinguish the descriptions. For example, without departing from the scope of the embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first.
[0048] Specifically, a method for recognizing avatar images based on machine learning described in this embodiment is applied to the recognition of avatar images of patients in a hospital; at the same time, the system described in this embodiment is installed in the internal server of the hospital; a plurality of user avatar images are stored in the internal server of the hospital described in this embodiment; the patients described in this embodiment are specifically patients with hair loss sequelae. The avatar recognition of such patients needs to combine the hair volume and facial status to identify the user in order to judge the change trend reflected by the user's avatar; it should be noted that the avatar images and user data of the users involved in this embodiment are all data and information authorized by the users or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant laws, regulations, and standards of the country and region.
[0049] Based on the above application scenario, please refer to Figure 1 As shown, it is a schematic flowchart of a method for recognizing avatar images based on machine learning provided in this embodiment, including:
[0050] Step S101, collect the user's avatar image, historical user avatar data, and environmental light data; the specific format of the user's avatar image is a 4K image in RGB format, and its acquisition method is to obtain the user's avatar image through an avatar image acquisition device. The avatar image acquisition devices described in this embodiment include, but are not limited to, intelligent devices carried by users, hospital avatar acquisition devices, etc.; the historical user avatar data includes each historical user avatar image, and the historical user avatar image is the avatar image collected by the user historically; the user's avatar image described in this embodiment is specifically a high-definition image of the user's head.
[0051] It can be understood that the environmental light data includes the environmental light intensity; the moment of collecting the environmental light data in this embodiment is the same as the moment of collecting the user's avatar image; the specific acquisition method of the environmental light intensity is not limited in this embodiment, and the environmental light data is collected by a light sensor in this embodiment.
[0052] Please continue to refer to Figure 1 As shown, the method for recognizing avatar images based on machine learning further includes:
[0053] Step S102, process the user's avatar image, and then divide the area of the user's avatar image.
[0054] To achieve the accuracy of the region division of the user's avatar image, before performing the region division, the present application needs to execute Figure 2 Step S201 in the region division method of the avatar image shown in the figure to process the user's avatar image, so as to overcome the phenomenon of blurred boundary between hair and face in the user's avatar image.
[0055] Specifically, the process of processing the user's avatar image is as follows:
[0056] Collect the contrast α of the user's avatar image, and process the user's avatar image according to the contrast α of the user's avatar image: if α > A, it is determined that the contrast of the user's avatar image is normal and the avatar image is not processed; otherwise, it is determined that the contrast of the user's avatar image is abnormal, and the avatar image of the user is filtered by using Gaussian filtering; where A is a preset image contrast.
[0057] Exemplarily, the contrast of the user's avatar image in this embodiment is specifically the RNS contrast, and the process of collecting the contrast of the user's avatar image is to collect through professional image processing software; the specific operation process of "filtering the user's avatar image by using Gaussian filtering" in this embodiment is a publicly known technology in existing image processing. In this embodiment, the Gaussian filtering method of two-dimensional Gaussian blur is adopted, and the specific process is not described in detail in this embodiment; at the same time, the value of the preset image contrast A is not specifically limited in this embodiment, and those skilled in the art can freely set it as long as the value requirement of the preset image contrast A is met. In this embodiment, the preset image contrast A can be set to 20.
[0058] Specifically, the present application judges the contrast of the user's avatar image and processes the avatar image according to the judgment result, and filters the user's avatar image by using Gaussian filtering, so as to achieve accurate region division of the avatar image.
[0059] Please continue to refer to Figure 2 As shown in the figure, the region division method of the avatar image further includes:
[0060] Step S202, perform region division on the processed user's avatar image, exclude background interference through the region division operation, and segment the hair strands and the face.
[0061] Specifically, the process of performing region division on the processed user's avatar image is as follows:
[0062] Calculate the blur degree parameter m, and the calculation process of setting the blur degree parameter m is: m = exp{(A - α) / A};
[0063] Perform fuzzy clustering on the processed avatar image of the user based on the fuzziness parameter m to obtain each fuzzy clustering cluster D(i), where D(i) represents the i-th fuzzy clustering cluster;
[0064] Analyze the types of each fuzzy clustering cluster according to the gray value Gray(i) of the central pixel point of each fuzzy clustering cluster: If Gray(i) is greater than or equal to G1, determine that the fuzzy clustering cluster is a background cluster; if Gray(i) is greater than or equal to G2 and less than G1, determine that the fuzzy clustering cluster is a face cluster, and divide the pixel points within the fuzzy clustering cluster into the face area; otherwise, determine that the fuzzy clustering cluster is a hair cluster, and divide the pixel points within the fuzzy clustering cluster into the hair area; where G1 is the first preset pixel point gray value, G2 is the second preset pixel point gray value, and G1 > G2.
[0065] Exemplarily, the "gray value Gray(i) of the central pixel point of each fuzzy clustering cluster" described in this embodiment converts the gray value of the RGB image into the gray value of the grayscale image. The specific conversion process is prior art and will not be elaborated in this embodiment; at the same time, this embodiment does not specifically limit the values of the first preset pixel point gray value G1 and the second preset pixel point gray value G2. Those skilled in the art can freely set them as long as they meet the value requirements of the first preset pixel point gray value G1 and the second preset pixel point gray value G2. In this embodiment, the best value of the first preset pixel point gray value G1 is set to 205, and the best value of the second preset pixel point gray value G2 is set to 55.
[0066] Specifically, by performing fuzzy clustering on the avatar image, accurate division of the significantly different regions of the hair, background, and face is achieved. Using the contrast offset degree as the parameter to control the degree of fuzzy clustering, adjustment in the process of processing the user's avatar image is realized, and thus the fuzzy clustering result is more accurate.
[0067] Please continue to refer to Figure 1 As shown, the avatar image recognition method based on machine learning further includes:
[0068] Step S103, analyze the hair density state of the user based on the region division result of the user's avatar image; use the hair density state shown in the image as an implicit factor for judging the user's state, and achieve an accurate judgment of the user's healthy development trend.
[0069] Specifically, in step S103, the average gray value Pg within the hair area is statistically calculated, and Pg = Σfgray(j) / N is set; where fgray(j) represents the gray value of the j-th pixel point within the hair area, and N is the number of pixel points within the hair area;
[0070] Analyze the hair strand density status of the user based on the average gray value Pg of the hair strand area and the preset hair strand density gray value PG: If Pg is less than PG, the hair volume recognition unit determines that the user has a low hair strand density; otherwise, the hair volume recognition unit determines that the user's hair strand density is normal.
[0071] Specifically, analyzing the user's hair strand density in the image realizes accurate analysis of the user's hair strand density. Using the pixel gray value as the target data and comparing it with the standard data obtained by big data statistics realizes efficient and accurate judgment of the user's hair strand density status.
[0072] Exemplarily, in this embodiment, the value of the preset hair strand density gray value PG is determined by big data statistics: By statistically analyzing the gray values of the hair strand areas of the head images of 1000 non-hair loss patients, and taking the average value of the statistical results as the preset hair strand density gray value PG.
[0073] Please continue to refer to Figure 1 As shown, the head image recognition method based on machine learning further includes:
[0074] Step S104, recognize the average hair strand diameter of the user's head image, and process the process of the user's hair strand density status according to the recognition result. Then, analyze the light state of the user's head image according to the environmental light data, and further process the process of processing the user's hair strand density status according to the analysis result of the light state; This step reasonably adjusts and optimizes the analysis process of the hair strand density status through the recognition of the hair strand diameter, thereby avoiding the phenomenon that the user's hair strand density status is higher than the actual due to the thick hair strand diameter of the user and the user's hair strand density status is lower than the actual due to the thin hair strand diameter of the user. At the same time, by combining the environmental light, the adjustment and optimization of the hair strand diameter status are realized to eliminate the glare interference of the environmental light and avoid the occurrence of the blurring phenomenon caused by the light intensity.
[0075] To implement the above step S104, please refer to Figure 3 As shown, it is a flow chart of the hair strand density status update method of the present application, including:
[0076] Step S401, recognize the average hair strand diameter of the user's head image, and process the process of the user's hair strand density status according to the recognition result.
[0077] Specifically, recognize the hair strand diameters d(z) of the user's head image through the Canny operator, and calculate the average hair strand diameter D according to the recognition result, and set D = Σd(z); where d(z) represents the hair strand diameter of the z-th recognized hair strand.
[0078] Furthermore, the hair diameter state of the user is analyzed based on the average hair diameter D, and the process of the hair follicle density state of the user is processed according to the analysis result: if D is less than YD1, it is determined that the hair diameter of the user is thin, and the preset hair follicle density gray value is processed as PG’, and PG’ = PG × ln[e + (D - YD1) / YD1] is set; if D is greater than or equal to YD1 and less than YD2, it is determined that the hair diameter of the user is normal and no processing is performed; otherwise, it is determined that the hair diameter of the user is thick, and the preset hair follicle density gray value is processed as PG”, and PG” = PG × exp[(D - YD2) / YD2] is set; where e is the natural logarithm, YD1 is the first preset hair diameter, YD2 is the second preset hair diameter, and YD1 < YD2.
[0079] Exemplarily, in this embodiment, the obtaining methods of the first preset hair diameter YD1 and the second preset hair diameter YD2 are the same as the obtaining method of the preset hair follicle density gray value PG above, and will not be elaborated in this embodiment.
[0080] Specifically, step S401 identifies the hair diameter by combining the prior art, and then analyzes the hair diameter state of the user, and further adjusts and optimizes the process of analyzing the hair follicle density state of the user, so as to realize the accurate judgment of the user's health trend.
[0081] Please continue to refer to Figure 3 As shown, the method for updating the hair follicle density state further includes:
[0082] Step S402, analyzes the light state of the user's head image according to the environmental light data, and further processes the process of processing the hair follicle density state of the user according to the analysis result of the light state: if gq is less than GQ1, it is determined that the light state of the user's head image is a low light state, and the second preset hair diameter is processed as YD2’, and YD2’ = YD2 × [1 - (GQ1 - gq) / GQ1] is set; if gq is greater than or equal to GQ1 and less than GQ2, it is determined that the light state of the user's head image is normal and no processing is performed; otherwise, it is determined that the light state of the user's head image is a high light state, and the first preset hair diameter is processed as YD1’, and YD1’ = YD1 × exp{(gq - GQ2) / GQ2} is set; where GQ1 is the first preset environmental light intensity, GQ2 is the second preset environmental light intensity, and GQ1 < GQ2.
[0083] Exemplarily, in this embodiment, the values of the first preset ambient light intensity GQ1 and the second preset ambient light intensity GQ2 are not specifically limited, and those skilled in the art can freely set them as long as the value requirements of the first preset ambient light intensity GQ1 and the second preset ambient light intensity GQ2 are met. In this embodiment, the optimal value of the first preset ambient light intensity GQ1 is 55 lx, and the optimal value of the second preset ambient light intensity GQ2 is 200 lx.
[0084] Specifically, in step S402, by combining ambient light, the adjustment and optimization of the hair diameter state are realized to exclude the glare interference of ambient light and avoid the occurrence of blurring phenomena caused by light intensity.
[0085] Please continue to refer to Figure 1 As shown, the machine learning-based avatar image recognition method further includes:
[0086] Step S105, determining the facial features of the user based on the region division result of the user's avatar image and the historical user avatar data, and then obtaining the facial state of the user through numerical analysis based on the facial features of the user.
[0087] Please refer to Figure 4 As shown, which is a schematic flowchart of the facial state analysis method described in this embodiment, including:
[0088] Step S501, calculating the average gray value of the pixel points in the facial area of the user's head image, and then extracting the facial features of the user by setting a judgment threshold.
[0089] Specifically, denoting the average gray value of the pixel points in the facial area of the user's head image as Pm, the process of extracting the facial features of the user is as follows:
[0090] If Pm is less than PM1, it is determined that the facial feature of the user is a type of abnormal feature, and the facial abnormal feature index is set as γ1, and γ1 = (Pm - PM1) / PM1 is set;
[0091] If Pm is greater than or equal to PM1 and less than PM2, it is determined that the facial feature of the user is a normal feature, and the facial abnormal feature index is set as γ2, and γ2 = 0 is set;
[0092] If Pm is greater than or equal to PM2, the facial feature analysis unit determines that the facial feature of the user is a type of abnormal feature, and sets the facial abnormal index as γ3, and γ3 = (Pm - PM2) / PM2; where PM1 is the first preset facial gray value, PM2 is the second preset facial gray value, and G2 < PM1 < PM2 < G1.
[0093] Specifically, by combining image information, the facial features of the user are extracted, and the grayscale value data in the image information is used as the color information of the user's face, thereby achieving accurate analysis of the user's facial features and accurate setting of the facial abnormality index.
[0094] Exemplarily, the present application does not specifically limit the values of the first preset facial grayscale value PM1 and the second preset facial grayscale value PM2. Those skilled in the art can freely set them as long as the value requirements of the first preset facial grayscale value PM1 and the second preset facial grayscale value PM2 are met. In this embodiment, the first preset facial grayscale value PM1 is set to 100, and the second preset facial grayscale value PM2 is set to 180.
[0095] Please continue to refer to Figure 4 As shown, the facial state analysis method further includes:
[0096] Step S502: Based on the numerical analysis of the user's facial features and historical user avatar data, the facial state of the user is obtained. In the present application, the facial state of the user refers to the change state of the user's face within a continuous period of time.
[0097] Specifically, in step S502, each historical user avatar image is processed and regionally divided to obtain each historical facial region;
[0098] The historical average grayscale value SD(t) of each historical facial region is statistically calculated, and the historical change coefficient η is calculated. Set where SD(t) represents the historical average grayscale value of the t-th historical facial region, SD(t + 1) represents the historical average grayscale value of the (t + 1)-th historical facial region, and T is the number of historical user avatar images;
[0099] Based on the historical change coefficient and the facial feature extraction result of the user, the facial state of the user is analyzed: if the facial abnormality feature index × (1 + η) is less than Y, the facial state of the user is normal; if the facial abnormality feature index × (1 + η) is greater than or equal to Y, the facial state of the user is abnormal; where Y is the facial grayscale abnormality threshold.
[0100] Exemplarily, the present embodiment does not specifically limit the value of the facial grayscale abnormality threshold Y. Those skilled in the art can freely set it as long as the value requirement of the facial grayscale abnormality threshold Y is met. In this embodiment, the best value of the facial grayscale abnormality threshold Y is 1.5.
[0101] Specifically, by combining historical user avatar data and the current avatar image, the facial state of the user is analyzed, and this analysis result reflects whether the current facial state of the user meets the expectation under the historical change rate, achieving accurate analysis of the user's facial state.
[0102] Please continue to refer to Figure 1 As shown, the machine learning-based avatar image recognition method further includes:
[0103] Step S106: Judge the avatar trend of the user based on the analysis result of the user's hair density state and the analysis result of the user's facial state, and then store the judgment result and the user's avatar image.
[0104] Specifically, the process of judging the avatar trend of the user is as follows:
[0105] If the user's facial state is normal and the user's hair density is normal, it is determined that the user's avatar trend is normal, and the user's avatar image is stored as a normal image; if the user's facial state is abnormal and the user's hair density is normal, it is determined that the user's avatar trend is an abnormal dominant feature of the user, and the user's avatar image is stored as a secondary abnormal image; if the user's facial state is normal and the user's hair density is low, it is determined that the user's avatar trend is an abnormal hidden feature of the user, and the user's avatar image is stored as a tertiary abnormal image; if the user's facial state is abnormal and the user's hair density is low, it is determined that the user's avatar trend is a crisis anomaly, and the user's avatar image is stored as a primary abnormal image.
[0106] Specifically, in this embodiment, the tertiary anomaly, secondary anomaly, and primary anomaly respectively represent that the state of the patient user is good, general, and dangerous.
[0107] To implement the machine learning-based avatar image recognition method, the present application also provides a computer-readable storage medium at the hardware level, which is disposed in an electronic device. Please refer to Figure 5 As shown, the electronic device includes: a processor 1, a memory 2, an input port 3, an output port 4, and a data bus 5; the memory 2 is composed of one or more computer-readable media; the processor 1 performs data transmission with the memory 2 through the data bus 5, and both the input port 3 and the output port 4 perform data transmission with the processor 1 through the data bus 5. The input port is used to receive data, and the output port is used to send data.
[0108] In the present application, the computer-readable storage medium is a tangible physical storage medium, which can store the above computer program and various types of data used in the program; this physical storage medium includes, but is not limited to, existing physical storage media or combinations of media such as random access memory, read-only memory, optical discs, and hard disks.
[0109] In this embodiment, the above-mentioned machine learning-based avatar image recognition method can be implemented as a runnable computer program. When the computer program is loaded into the processor and, when the computer program is loaded into the memory 2 and processed by the data bus 5 by the processor 1, one or more steps of the above-mentioned machine learning-based avatar image recognition method can be executed.
[0110] Please refer to Figure 6 As shown, it is an avatar image recognition device provided by the present application, including:
[0111] An image data acquisition module for acquiring the user's avatar image and historical user avatar data;
[0112] An ambient light acquisition module for acquiring ambient light data;
[0113] A user image analysis module for processing the user's avatar image and dividing the area of the user's avatar image;
[0114] A hair volume recognition module for analyzing the hair strand density state of the user according to the area division result of the user's avatar image, and also for identifying the average hair strand diameter of the user's avatar image, and processing the analysis process of the user's hair strand density state according to the recognition result. The hair volume recognition module is also used to analyze the light state of the user's avatar image according to the ambient light data, and further process the process of processing the user's hair strand density state according to the analysis result of the light state;
[0115] A face recognition module for analyzing the user's facial state according to the area division result of the user's avatar image and the historical user avatar data;
[0116] A trend judgment module for judging the avatar trend of the user according to the analysis result of the user's hair strand density state and the analysis result of the user's facial state.
[0117] So far, the technical solution of the present invention has been described in conjunction with the preferred embodiments shown in the drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the protection scope of the present invention.
Claims
1. A head image recognition method based on machine learning, characterized in that: include: Collect user's head portrait image, historical user head portrait data and ambient light data; Processing the user's head portrait image, and then dividing the user's head portrait image into regions; Analyze the hair density status of users based on the divided user's avatar images; Identify the average hair diameter of the user's head image, and process the user's hair density status according to the identification result; Determine the user's facial features based on the regional division result of the user's head portrait image and historical user head portrait data, and then obtain the user's facial state through numerical analysis based on the user's facial features; The user's avatar tendency is judged based on the user's hair density state and the user's facial state.
2. The head image recognition method based on machine learning according to claim 1 is characterized in that: The process of processing the user's avatar image is as follows: Collect the user's head portrait image contrast α, and process the user's head portrait image according to the user's head portrait image contrast α, and when α≤A, use Gaussian filtering to perform filtering operation on the user's head portrait image; wherein A is the preset image contrast.
3. The head image recognition method based on machine learning according to claim 2 is characterized in that: The process of dividing the processed user's avatar image into regions is as follows: Calculate the blur degree parameter m, and set the calculation process of the blur degree parameter m as follows: m=exp{(A-α) / A}; Based on the fuzziness degree parameter m, the processed user's head portrait image is fuzzy clustered to obtain each fuzzy clustering cluster D(i), where D(i) represents the i-th fuzzy clustering cluster; According to the gray value Gray(i) of the central pixel point of each fuzzy cluster, each fuzzy cluster is divided into a background cluster, a face cluster and a hair cluster. When the type of the fuzzy cluster is a face cluster, the pixels in the fuzzy cluster are divided into a face area. When the type of the fuzzy cluster is a hair cluster, the pixels in the fuzzy cluster are divided into a hair area.
4. The head image recognition method based on machine learning according to claim 3 is characterized in that: The average grayscale value Pg in the hair plant area is counted, and the hair plant density status of the user is analyzed according to the average grayscale value Pg of the hair plant area and the preset hair plant density grayscale value PG. The hair plant density status of the user includes low hair plant density and normal hair plant density.
5. The head image recognition method based on machine learning according to claim 4 is characterized in that: Identify the average hair diameter of the user's head image, and process the user's hair density status according to the identification result; Analyze the light state of the user's head portrait image according to the ambient light data, and further process the process of processing the user's hair density state according to the analysis result of the light state; Recognize the diameters d(z) of the hair strands of the user's head portrait image, calculate the average hair strand diameter D according to the recognition result, analyze the hair strand diameter status of the user according to the average hair strand diameter D, the hair strand diameter status of the user includes thin hair strand diameter, normal hair strand diameter and thick hair strand diameter, and when the hair strand diameter of the user is thin, set the preset hair strand density grayscale value to PG'; when the hair strand diameter of the user is thick, set the preset hair strand density grayscale value to PG". The light state of the user's portrait image is analyzed according to the ambient light data, the light state of the user's portrait image includes a low light state, a normal light state and a strong light state, and when the light state of the user's portrait image is a low light state, the second preset hair diameter is set to YD2'; when the light state of the user's portrait image is a strong light state, the first preset hair diameter is set to YD1'.
6. The head image recognition method based on machine learning according to claim 5 is characterized in that: Calculate the average grayscale value of the pixels in the facial area of the user's head image, and then extract the user's facial features by setting a judgment threshold; Based on the numerical analysis of the user's facial features and historical user avatar data, the user's facial state is obtained; The average gray value of the pixels in the facial area of the user's head image is recorded as Pm, and the process of extracting the user's facial features is as follows: If Pm is less than PM1, the facial feature of the user is determined to be a type I abnormal feature, and the facial abnormal feature index is set to γ1; if Pm is greater than or equal to PM1 and less than PM2, the facial feature of the user is determined to be a normal feature, and the facial abnormal feature index is set to γ2; if Pm is greater than or equal to PM2, the facial feature analysis unit determines that the facial feature of the user is a type II abnormal feature, and sets the facial abnormality index to γ3; wherein PM1 is a first preset facial grayscale value, and PM2 is a second preset facial grayscale value; Each historical user portrait image is processed and divided into regions to obtain each historical facial region.
7. The head image recognition method based on machine learning according to claim 6 is characterized in that: The historical average grayscale value SD(t) of each historical facial area is counted, and the historical variation coefficient η is calculated; wherein SD(t) represents the historical average grayscale value of the t-th historical facial area, and the user's facial state is analyzed based on the historical variation coefficient and the user's facial feature extraction result, and the user's facial state analysis results include normal and abnormal.
8. The head image recognition method based on machine learning according to claim 7 is characterized in that: The trend judgment module is used to judge the user's avatar trend according to the analysis results of the user's hair density state and the user's facial state, and store the judgment result and the user's avatar image: if the user's facial state is normal and the user's hair density is normal, the trend judgment module determines that the user's avatar trend is normal, and stores the user's avatar image as a normal image; if the user's facial state is abnormal and the user's hair density is normal, the trend judgment module determines that the user's avatar trend is abnormal in the user's dominant features, and stores the user's avatar image as a secondary abnormal image; if the user's facial state is normal and the user's hair density is low, the trend judgment module determines that the user's avatar trend is abnormal in the user's invisible features, and stores the user's avatar image as a tertiary abnormal image; if the user's facial state is abnormal and the user's hair density is low, the trend judgment module determines that the user's avatar trend is critical abnormal, and stores the user's avatar image as a primary abnormal image.
9. A head image recognition device based on machine learning, characterized in that: include: An image data acquisition module is used to collect user avatar images and historical user avatar data; An ambient light collection module, used to collect ambient light data; A user image analysis module is used to process the user's head portrait image and divide the user's head portrait image into regions; A hair volume recognition module, used to analyze the user's hair density status according to the region division result of the user's head portrait image, and also used to identify the average hair diameter of the user's head portrait image, and iterate the analysis process of the user's hair density status according to the recognition result, and the hair volume recognition module is also used to analyze the light status of the user's head portrait image according to the ambient light data, and perform a second iteration of the analysis process of processing the user's hair density status according to the analysis result of the light status; A facial recognition module is used to analyze the user's facial state based on the regional division result of the user's head portrait image and historical user head portrait data; The trend judgment module is used to judge the trend of the user's avatar based on the analysis results of the user's hair density status and the user's facial status.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program is used to control the electronic device where the computer-readable storage medium is located to execute the head image recognition method based on machine learning described in any one of claims 1 to 8 during operation.
Citation Information
Patent Citations
Facial recognition method and device
CN108491794A
Gray level image segmentation method based on multi-objective fuzzy clustering
CN103473786A
Face recognition-based public place health monitoring system and method
CN109215806A
Health state diagnosis system based on facial image
CN110459304A
Image processing method and device, and training method and device of image generation model
CN114187633A