A hair quality detection method and system for beauty and hairdressing

Through dynamic time regularization algorithm and neural network analysis, the poor dyeing effect caused by the mismatch between hair quality and hair dye in the existing technology is solved, and the accurate matching degree of hair dye and hair quality is achieved, which improves the quality of hair salon services.

CN118483169BActive Publication Date: 2024-11-29SHANGHAI QISHENG NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410940114.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2024-11-29
Estimated Expiration
2044-07-12

AI Technical Summary

Technical Problem

Existing hair quality detection methods are difficult to accurately estimate the matching degree between hair dye and customer hair, resulting in poor dyeing effect and fading.

Method used

The dynamic time regularization algorithm is used to match the hair quality spectrum curve and the hair dye spectrum curve, and the reflectivity and wavelength information are corrected. The adaptability of the hair dye is obtained through neural network analysis, and the most suitable hair dye is recommended.

Benefits of technology

It improves the accuracy of the matching evaluation between hair dye and hair quality, avoids poor dyeing effects and fading problems, and provides more personalized hair salon services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118483169B_ABST
    Figure CN118483169B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of hair quality detection based on spectral analysis, and specifically to a hair quality detection method and system for beauty and hairdressing. The method first obtains the hair quality spectrum curve of the customer's hair, matches the hair quality spectrum curve of the customer's hair with the hair dye spectrum curves of different hair dyes to obtain a matching pair; combines the chemical spectral properties of the hair quality and the hair dye, and corrects the matching pairs of different matching types; based on the matching distance of the corrected matching pair, determines the fitness of the hair quality spectrum curve and the hair dye spectrum curve; inputs the customer's hair quality spectrum curve, fitness and hair dye spectrum curve into a neural network to obtain the fitness of the hair quality spectrum curve and the hair dye spectrum curve. The present invention tests and analyzes the hair quality and the hair dye by combining the chemical spectral properties of the hair quality and the hair dye, and obtains the corresponding fitness, which can more accurately reflect whether the customer's hair quality and the hair dye match.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of hair quality detection based on spectral analysis, and in particular to a hair quality detection method and system for beauty and hairdressing. Background Art

[0002] Before hairdressing, it is very important to test the hair quality. Hair quality testing can help understand the current condition of the hair, including its oily, dry, neutral and other properties, as well as the toughness, smoothness and possible damage of the hair. According to the test results, appropriate care methods and hairdressing products can be selected to avoid further damage to the hair. In the existing methods, a hair salon spectrometer is often used to test the hair quality, and then the spectrometer will output data of various indicators for reference. According to the data, it can be seen whether the customer's hair is insufficiently hydrated, whether there is protein loss and other problems, but when the customer's hair can be dyed with a variety of hair dyes, a hair dye required by the customer is often selected based on experience, and it is impossible to predict in advance whether a better dyeing effect can be achieved. When the selected hair dye does not match the customer's hair quality or the matching degree is low, the dyeing effect will be poor and easy to fade after the customer's hair is dyed. Summary of the invention

[0003] In order to solve the technical problem of poor dyeing effect caused by mismatch between hair quality and hair dye, the present invention aims to provide a hair quality detection method and system for beauty and hairdressing. The technical solution adopted is as follows:

[0004] In a first aspect, an embodiment of the present invention provides a hair quality detection method for beauty and hairdressing, the method comprising:

[0005] Acquire a hair quality spectrum curve of the customer's hair; use a dynamic time warping algorithm to match the hair quality spectrum curve with hair dye spectrum curves of different hair dyes to obtain a matching pair consisting of matching points;

[0006] For matching pairs of different matching types, the matching pairs of different matching types are corrected by combining the reflectances of different points and corresponding matching points on the hair quality spectrum curve, the reflectances of points with the same wavelength on the hair dye spectrum curve, the positions of the matching points in the matching pairs, and the associated points to be matched;

[0007] Based on the corrected matching distance of the matching pair, the fitness of the hair quality spectral curve and the spectral curves of different hair dyes is determined; the customer's hair quality spectral curve, fitness and hair dye spectral curve are input into the trained neural network to obtain the fitness of the customer's hair quality spectral curve and the spectral curves of different hair dyes.

[0008] Preferably, for the matching pairs of different matching types, the matching pairs of different matching types are corrected by combining the reflectances of different points and corresponding matching points on the hair quality spectrum curve, the reflectances of points with the same wavelength on the hair dye spectrum curve, the positions of the matching points in the matching pairs, and the associated points to be matched, including:

[0009] The matching types of matching pairs are divided into: one-to-one matching, one-to-many matching, and many-to-one matching;

[0010] For a one-to-one matching pair, a matching probability is determined by combining the reflectances of different points on the hair quality spectrum curve and the corresponding matching points, and the reflectances of points with the same wavelength on the hair dye spectrum curve, and the matching pair is retained based on the matching probability;

[0011] For a one-to-many matching pair, the matching pair is modified by analyzing the position of the matching point and the matching probability;

[0012] For the matching pairs of many-to-one matching, the matching pairs are corrected by analyzing the positions of the matching points and the associated points to be matched.

[0013] Preferably, for the one-to-one matching pair, the matching probability is determined by combining the reflectances of different points on the hair quality spectrum curve and the corresponding matching points, and the reflectances of points with the same wavelength on the hair dye spectrum curve, including:

[0014] Taking any point on the hair quality spectrum curve as the point to be analyzed, obtaining the matching pair to which the point to be analyzed belongs and the matching point within the matching pair, and obtaining the point on the hair dye spectrum curve with the same wavelength as the point to be analyzed as the point to be matched;

[0015] The normalized value of the difference between the reflectance of the point to be analyzed and the corresponding point to be matched is used as the first analysis value;

[0016] The normalized value of the difference between the point to be analyzed and the corresponding matching point in the matching pair is used as the second analysis value;

[0017] The normalized value of the difference between the first analysis value and the second analysis value is weighted with the first analysis value as the weight to obtain the matching probability of the matching pair.

[0018] Preferably, retaining the matching pairs based on the matching probability includes:

[0019] The matching pairs whose corresponding matching probabilities are greater than the preset matching threshold are retained.

[0020] Preferably, for the one-to-many matching pair, the matching pair is corrected by analyzing the positions of the matching points and the matching probability, including:

[0021] Calculate the matching probability between each point to be analyzed and the corresponding matching point, which is recorded as the first matching probability;

[0022] Calculate the normalized value of the position difference between the matching point and the point to be matched corresponding to each point to be analyzed;

[0023] According to the order of the order values, the matching points corresponding to the points to be analyzed are sorted to obtain a standard sequence;

[0024] Sort the matching points corresponding to the points to be analyzed according to the order of the first matching probabilities to obtain a matching sequence;

[0025] Calculate the position difference of the same element in the standard sequence and the matching sequence to determine the matching probability difference;

[0026] Determine a second match type correctness by combining the match probability difference and the normalized value of the position difference value;

[0027] Based on the second match type correction, the matching pair is corrected.

[0028] Preferably, for the many-to-one matching matching pairs, the matching pairs are corrected by analyzing the positions of the matching points and the associated points to be matched, including:

[0029] Calculate the order difference between the matching point of the point to be analyzed and the point to be matched;

[0030] Get the number of matching pairs corresponding to the points to be matched, recorded as the number of matches to be matched;

[0031] Determine the third matching type correctness based on the order difference and the number to be matched;

[0032] Based on the third match type correctness, the matching pair is corrected.

[0033] Preferably, the modifying of the matching pair based on the third matching type modifying property comprises:

[0034] When the third matching type correctness is greater than a preset correction threshold, the point to be analyzed and the point to be matched are connected to obtain a corresponding matching pair.

[0035] Preferably, the determining the adaptability of the hair quality spectrum curve and the spectrum curves of different hair dyes based on the corrected matching distance of the matching pair includes:

[0036] For the hair dye spectrum curve of any hair dye, the negative correlation normalized mapping value of the mean of the dynamic time warping distance of each matching pair after correction is used as the fitness of the hair quality spectrum curve and the hair dye spectrum curve.

[0037] Preferably, after obtaining the compatibility of the hair quality spectrum curve of the customer's hair and the spectrum curves of different hair dyes, the method further includes:

[0038] The hair dye corresponding to the hair dye spectrum curve with the greatest degree of suitability is taken as the hair dye that best matches the customer's hair.

[0039] In a second aspect, a hair quality detection system for beauty and hairdressing is provided, the system comprising the following modules:

[0040] A preprocessing module is used to obtain a hair quality spectrum curve of a customer's hair; and a dynamic time warping algorithm is used to match the hair quality spectrum curve with the hair dye spectrum curves of different hair dyes to obtain a matching pair consisting of matching points.

[0041] The spectrum analysis module corrects the matching pairs of different matching types by combining the reflectances of different points and corresponding matching points on the hair quality spectrum curve, the reflectances of points with the same wavelength on the hair dye spectrum curve, the positions of the matching points in the matching pairs, and the associated points to be matched;

[0042] The fitness analysis module determines the fitness of the hair quality spectrum curve and the spectrum curves of different hair dyes based on the corrected matching distance of the matching pair; the customer's hair quality spectrum curve, fitness and hair dye spectrum curve are input into the trained neural network to obtain the fitness of the customer's hair quality spectrum curve and the spectrum curves of different hair dyes.

[0043] In a third aspect, an embodiment of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, various possible embodiments of the first aspect are implemented.

[0044] In a fourth aspect, an embodiment of the present invention provides a computer program product, which includes: a computer program code, which, when executed on a computer, enables the computer to execute the method in the first aspect or any possible implementation of the first aspect.

[0045] In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, enables the computer to execute various possible implementations of the first aspect.

[0046] The embodiments of the present invention have at least the following beneficial effects:

[0047] The present invention first matches the hair quality spectrum curve of the customer's hair with the hair dye spectrum curves of different hair dyes through the existing dynamic time warping algorithm. However, the dynamic time warping algorithm calculates the trend of the match. However, in this embodiment, the matching of the corresponding bands is desired to be achieved. Therefore, the matching result determined by the dynamic time warping algorithm needs to be corrected within a reasonable range. For matching pairs of different matching types, the hair quality spectrum curve and the hair dye spectrum curve are analyzed by combining the chemical spectral properties of the hair quality and the hair dye to achieve the correction of matching pairs of different matching types. The fitness of the hair dye spectrum curve is determined by the matching distance of the corrected matching pair, and the fitness is obtained by objectively analyzing the data. The customer's hair quality spectral curve, fitness and hair dye spectral curve are then input into the trained neural network to obtain the fitness of the customer's hair quality spectral curve and the spectral curves of different hair dyes. By combining the chemical spectral properties of the hair quality and the hair dye, the hair quality and the hair dye are tested and analyzed to obtain the corresponding fitness, which can more accurately reflect whether the customer's hair quality and the hair dye match, thereby avoiding the problem of poor dyeing effect due to mismatch between the customer's hair quality and the hair dye. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0049] Figure 1 A method flow chart of a hair quality detection method for beauty and hairdressing provided by one embodiment of the present invention;

[0050] Figure 2 A schematic diagram of DTW matching of a hair quality spectrum curve and a hair dye spectrum curve of a hair dye provided by an embodiment of the present invention;

[0051] Figure 3 A flow chart of a method for correcting matching pairs of different matching types provided by one embodiment of the present invention;

[0052] Figure 4 A matching schematic diagram of a matching pair of a one-to-many matching type provided by an embodiment of the present invention;

[0053] Figure 5 A schematic diagram of a matching pair of a many-to-one matching type provided by an embodiment of the present invention;

[0054] Figure 6It is a structural schematic diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0055] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined purpose of the invention, the following, in combination with the accompanying drawings and preferred embodiments, a hair quality detection method and system for beauty and hairdressing proposed by the present invention, its specific implementation method, structure, characteristics and effects are described in detail as follows.

[0056] In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.

[0057] Among them, in the description of the embodiments of the present invention, unless otherwise specified, " / " means or, for example, A / B can mean A or B: "and / or" in the text is only a way to describe the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present invention, "multiple" refers to two or more than two.

[0058] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.

[0059] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0060] The embodiments of the present invention are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.

[0061] The embodiment of the present invention provides a specific implementation method of a hair quality detection method and system for beauty and hairdressing, and the method is applicable to the hair quality detection scenario. In this scenario, the spectrum of the hair dye is collected by a professional spectrometer, and the hair quality spectrum curve of the customer is collected by a hair salon spectrometer. Among them, the hair salon spectrometer is a professional testing instrument that can perform a comprehensive analysis of the customer's hair. Before using the spectrometer, it needs to be calibrated first. Calibration can ensure the accuracy of the test results. Only accurate test results can help the hair salon better understand the customer's hair quality and provide more personalized services. When calibrating the spectrometer, automatic calibration or manual calibration can be adopted. After calibrating the spectrometer, align the position of the test hair with the detection head of the spectrometer and press the test key. The following points should be noted when testing hair:

[0062] (1) The hair should be dry for testing. It is best to let the hair air dry naturally after shampooing. Do not wipe the hair dry.

[0063] (2) In order to obtain better test results, the hair can be divided into multiple parts for testing. Generally, the hair is divided into three parts: the top, the sides and the back, and tested separately to obtain more accurate results. In the embodiment of the present invention, for the convenience of analysis, the hair of one part is tested and analyzed first.

[0064] After getting the test results, you need to analyze them. The spectrometer will output data of various indicators for reference.

[0065] The following is a detailed description of a hair quality detection method and system for hairdressing provided by the present invention in conjunction with the accompanying drawings.

[0066] See also Figure 1 , which shows a flow chart of a hair quality detection method for beauty and hairdressing provided by an embodiment of the present invention, the method comprising the following steps:

[0067] Step S100, obtaining a hair quality spectrum curve of a customer's hair; using a dynamic time warping algorithm, matching the hair quality spectrum curve with hair dye spectrum curves of different hair dyes to obtain a matching pair consisting of matching points.

[0068] In this scenario, when the hairdresser has multiple similar hair color options for the customer's current hair condition and requirements, the hair dyeing effect can be estimated by calculating the matching of the hair spectrum and the spectra of different hair dyes, and reference suggestions can be provided for the customer to choose hair dyes. It can use spectrum matching to see which hair dye can achieve a more ideal hair color for the customer's hair quality. If the absorption peak of the dye is close to or complementary to the absorption peak of the natural pigment in the hair, it means that the pigment in the dye can effectively combine with the pigment in the customer's hair, making it easier to color. If the spectrum of the customer's hair shows a low reflectivity, it often means that the hair surface is relatively rough, and the dye tends to penetrate and adhere more easily.

[0069] The spectral curve of each hair dye sample is measured by a professional spectrometer to obtain the spectral curve of each hair dye. For customers who need hair dyeing, the hair quality spectral curve of the customer's hair is obtained through a hair salon spectrometer.

[0070] When a hairdresser has multiple hair color options for a customer's current hair, he can use spectrum matching to see which hair dye can achieve a more ideal hair color. If the absorption peak of the dye is close to or complementary to the absorption peak of the natural pigment in the hair, it means that the pigment in the dye can effectively combine with the pigment in the hair, making it easier to color. Therefore, here we first calculate the match of the overall change trend of the hair spectrum and the dye spectrum.

[0071] The hair quality spectrum curve is matched with the hair dye spectrum curves of different hair dyes to obtain a matching pair consisting of matching points.

[0072] The dynamic time warping algorithm is used to match the data points on the hair quality spectrum curve and the hair dye spectrum curve to obtain a matching pair consisting of matching points, wherein the matching points belong to the hair quality spectrum curve and the hair dye spectrum curve respectively.

[0073] More specifically: the hair quality spectrum curve and the hair dye spectrum curve of the hair dye are used as the input of the Dynamic Time Warping (DTW) algorithm to obtain multiple matching pairs. Figure 2 , Figure 2 Schematic diagram of DTW matching between the hair quality spectral curve and the hair dye spectral curve of the hair dye. Figure 2 The upper middle curve is the hair quality spectrum curve, and the lower middle curve is the hair dye spectrum curve. The points on the two curves connected by the straight line between the two curves are matching point pairs.

[0074] See also Figure 2 It can be seen that the matching pairs in the figure have one-to-one, one-to-many and many-to-one relationships, which are called matching pairs of different matching types.

[0075] Step S200, for matching pairs of different matching types, the matching pairs of different matching types are corrected by combining the reflectances of different points and corresponding matching points on the hair quality spectrum curve, the reflectances of points with the same wavelength on the hair dye spectrum curve, the positions of the matching points in the matching pairs, and the associated points to be matched.

[0076] Since the existing matching based on the DTW algorithm is a matching of calculation trends, but in the embodiment of the present invention, the matching of corresponding bands is desired, it is necessary to correct the matching results based on the DTW algorithm within a reasonable range. When the spectral intensity of the dye is high, it indicates that its pigment concentration is high, and it is often easier to cover the original color of the hair, especially when dark dyeing is required. If the spectrum of the hair shows a lower reflectivity, it often means that the surface of the hair is relatively rough, and the dye is often easier to penetrate and adhere.

[0077] In some embodiments, for matching pairs of different matching types, the present invention combines the reflectance of different points and corresponding matching points on the hair quality spectrum curve, the reflectance of points with the same wavelength on the hair dye spectrum curve, the position of the matching points in the matching pairs, and the associated points to be matched, to correct the matching pairs of different matching types.

[0078] In some embodiments, the matching pairs of different matching types are modified, that is, the above step S200 can be performed by Figure 3 The steps shown achieve:

[0079] The matching types of the matching pairs are: one-to-one matching pairs, one-to-many matching pairs, and many-to-one matching pairs.

[0080] Step S210, for a one-to-one matching pair, the matching probability is determined by combining the reflectances of different points on the hair quality spectrum curve and the corresponding matching points, and the reflectances of points with the same wavelength on the hair dye spectrum curve, and the matching pair is retained based on the matching probability.

[0081] For one-to-one matching pairs, first filter out the matching pairs with inconsistent wavelengths. It should be noted that the inconsistent wavelengths here refer to the different wavelengths corresponding to the two data points in the matching pair. Taking the spectrum of hair as the standard, calculate the probability that the point data belonging to the hair band on each matching pair can be connected with the point data of the same band on the hair dye spectrum curve.

[0082] Take any point on the hair quality spectrum curve as the point to be analyzed, obtain the matching pair to which the point to be analyzed belongs and the matching point within the matching pair, and obtain the point on the hair dye spectrum curve with the same wavelength as the point to be analyzed as the point to be matched.

[0083] The normalized value of the difference between the reflectance of the point to be analyzed and the corresponding matching point is used as the first analysis value;

[0084] As an embodiment of the present invention, the absolute value of the difference between the reflectance of the point to be analyzed and the corresponding point to be matched can be used as the numerator, the maximum value of the reflectance of the point to be analyzed and the corresponding point to be matched can be used as the denominator, and the ratio formed by the numerator and the denominator can be used as the normalized value of the difference, that is, the first analysis value.

[0085] As another embodiment of the present invention, the absolute value of the difference between the reflectivity of the point to be analyzed and the corresponding point to be matched may be normalized by using a maximum-minimum normalization method to obtain a first analysis value.

[0086] The normalized value of the difference between the point to be analyzed and the corresponding matching point in the matching pair is used as the second analysis value.

[0087] As an embodiment of the present invention, the absolute value of the difference in reflectivity between the point to be analyzed and the corresponding matching point in the matching pair can be used as the numerator, the maximum value of the reflectivity between the point to be analyzed and the corresponding matching point in the matching pair can be used as the denominator, and the ratio formed by the numerator and the denominator can be used as the second analysis value.

[0088] As another embodiment of the present invention, the absolute value of the difference between the reflectivity of the point to be analyzed and the corresponding matching point in the matching pair may be normalized by using a maximum-minimum normalization method to obtain a second analysis value.

[0089] The normalized value of the difference between the first analysis value and the second analysis value is weighted using the first analysis value as a weight to obtain a matching probability.

[0090] As an optional embodiment of the present invention, the absolute value of the difference between the first analysis value and the second analysis value can be used as the numerator, the maximum value of the first analysis value and the second analysis value can be used as the denominator, and the ratio formed by the numerator and the denominator can be used as the normalized value of the difference between the first analysis value and the second analysis value.

[0091] The first analysis value is used as the weight of the normalized value of the difference between the first analysis value and the second analysis value, and the normalized value of the difference between the first analysis value and the second analysis value is weighted to obtain the matching probability.

[0092] As an embodiment of the present invention, the calculation formula of the matching probability is:

[0093] ;

[0094] in, is the matching probability; a is the reflectivity corresponding to the point to be analyzed; b is the reflectivity of the point to be matched with the same wavelength as the point to be analyzed; is the reflectivity of the matching point in the matching pair corresponding to the point to be analyzed; max is the maximum value function.

[0095] If the reflectance difference between the point data of the hair quality spectrum curve on the one-to-one matching pair and the point data of the same wavelength on the hair dye spectrum curve is greater than the reflectance difference of the matching pair, and the greater the difference, the point data belonging to the hair quality spectrum curve on the matching pair can be connected with the point of the same wavelength on the hair dye spectrum curve, and then the original matching pair is cancelled. This calculation can reflect the logic: especially when dyeing is needed, correcting such corresponding points and retaining corresponding points with large differences can reflect the need for dyeing.

[0096] After obtaining the matching probabilities of the matching pairs on the hair quality spectrum curve and the hair dye spectrum curve, the matching pairs are retained based on the obtained matching probabilities. More specifically, when the matching probability of the matching pairs is greater than a preset matching threshold, the corresponding matching pairs are retained. In the embodiment of the present invention, the preset matching threshold is set to 0.6, and in other embodiments, the implementer adjusts the value according to actual conditions.

[0097] Step S220: for the one-to-many matching pairs, the matching pairs are corrected by analyzing the positions of the matching points and the matching probabilities.

[0098] For the calculated one-to-many matching pairs, i.e., one point on the hair quality spectrum curve corresponds to multiple points on the hair dye spectrum curve; or many-to-one matching pairs, i.e., multiple points on the hair quality spectrum curve correspond to one point on the hair dye spectrum curve, the correction process is as follows:

[0099] For each match, if there is a data point with the same wavelength as that of point f on the hair quality spectrum curve among the matching points on the hair dye spectrum curve that match the point f on the hair quality spectrum curve, then there is no need to correct the matching points with the same wavelength. If there is a data point with a different wavelength from that of point f on the hair quality spectrum curve among the matching points on the hair dye spectrum curve that match the point f on the hair quality spectrum curve, then it is necessary to correct the matching points with different wavelengths. Therefore, firstly, among the matching points on the hair dye spectrum curve that match the point f on the hair quality spectrum curve, the matching points with different wavelengths from that of point f on the hair quality spectrum curve are screened out, and the matching points are corrected.

[0100] See also Figure 4 , Figure 4 A matching diagram of a matching pair of a one-to-many matching type. Figure 4 The point in the upper middle is the point on the spectrum curve of the hair dye. Figure 4The points in the middle and lower part are points on the hair quality spectrum curve. The black points and the points connected to the black points by lines constitute a one-to-many match, and the gray points and the points connected to the gray points by lines constitute a one-to-one match. The gray points are points on the hair dye spectrum curve with the same wavelength as the black points. The points on the hair dye spectrum curve and the hair quality spectrum curve with the same wavelength are connected by dotted lines.

[0101] Similarly, any point on the hair quality spectrum curve is used as the point to be analyzed, and the matching pair to which the point to be analyzed belongs and the matching point within the matching pair are obtained, and the point on the hair dye spectrum curve with the same wavelength as the point to be analyzed is obtained as the point to be matched.

[0102] exist Figure 4 If the black point is the point to be analyzed, the corresponding point connected to the black point by a line segment is the matching point, and the corresponding point connected to the black point by a dotted line is the point to be matched.

[0103] The smaller the order difference between the matching point of the current point to be analyzed and the point to be matched, the greater the probability that after the point to be matched matches the current analysis point, the smaller the impact on the overall matching, and the easier it is to make corrections.

[0104] Each matching point and the point to be analyzed can obtain a matching probability. When the matching probability of the matching point closer to the point to be matched is smaller, it means that after the point to be matched is matched with the current point to be analyzed, the matching effect is more prominent, and the current point to be analyzed and the point to be matched can be connected more, that is, the current matching pair needs to be corrected more.

[0105] First, a pre-matching pair is formed by the point to be analyzed and the corresponding matching point, and a to-be-matched pair is formed by the point to be analyzed and the corresponding to-be-matched point. By analyzing each pre-matching pair and to-be-matched pair, a first matching probability can be calculated; that is, the matching probability of each point to be analyzed and the corresponding matching point is calculated, which is recorded as the first matching probability.

[0106] The absolute value of the order difference between the matching point and the point to be matched corresponding to each point to be analyzed is calculated to obtain the order difference between the matching point and the point to be matched. The mean value of the order difference between the matching point and the point to be matched corresponding to each point to be analyzed is used as the position difference value, and it is normalized to obtain the normalized value of the position difference between the matching point and the point to be matched corresponding to each point to be analyzed.

[0107] According to the order of the order values ​​of the matching points, the matching points corresponding to the points to be analyzed are sorted to obtain a standard sequence;

[0108] Sort the matching points corresponding to the points to be analyzed according to the order of the first matching probabilities to obtain a matching sequence;

[0109] As one embodiment of the present invention, when arranging in the order of the size of the order values ​​of the matching points and in the order of the size of the first matching probabilities, the arrangement is based on the order from small to large. As another embodiment of the present invention, when arranging in the order of the size of the order values ​​of the matching points and in the order of the size of the first matching probabilities, the arrangement can also be based on the order from large to small.

[0110] Calculate the position difference of the same element in the standard sequence and the matching sequence to determine the matching probability difference. For example, first, for the first element in the standard sequence, the difference between the order value of the first element in the matching sequence and the order value in the standard sequence is recorded as the first element position difference; for the second element in the standard sequence, the difference between the order value of the second element in the matching sequence and the order value in the standard sequence is recorded as the second element position difference; for the third element in the standard sequence, the difference between the order value of the third element in the matching sequence and the order value in the standard sequence is recorded as the third element position difference.

[0111] The element position difference of each element is normalized and recorded as the position difference of each element; the mean value of the position difference of the same element in the standard sequence and the matching sequence is calculated as the matching probability difference.

[0112] The normalized values ​​of the match probability difference and the position difference are combined to determine the second match type correctness.

[0113] Among them, the normalized values ​​of the matching probability difference and the position difference are both negatively correlated with the second matching type correctness. Because the larger the matching difference and the larger the position difference, the greater the feasibility of the corresponding matching pair. The second matching type correctness reflects the correctability of the points to be analyzed and the matching points, that is, the feasibility of connecting the points to be matched and the points to be analyzed. It should be noted that the normalization in the embodiment of the present invention can be achieved by normalizing the values ​​to be normalized by taking the ratio of the values ​​to be normalized to the corresponding maximum value; other existing normalization algorithms can also be used to normalize the values ​​to be normalized.

[0114] As an embodiment of the present invention, the calculation formula of the second matching type correction is: ; Wherein, x1 is the second matching type correction; e is a natural constant; n is the number of matching points corresponding to the point to be analyzed; is the element position difference of the i-th element; j is the position difference value; is the normalized value of the position difference value; is the matching probability difference.

[0115] The correctability of the current points to be analyzed and the matching points is obtained through calculation, that is, the feasibility of connecting the points to be matched with the current analysis points.

[0116] After obtaining the second match type correction of each one-to-many matching pair, the matching pair is corrected based on the second match type correction. More specifically, when the second match type correction is greater than a preset correction threshold, the point to be analyzed and the point to be matched are connected to obtain a corresponding matching pair. In the embodiment of the present invention, the preset correction threshold is set to 0.7, and in other embodiments, the value can be adjusted by the implementer according to actual conditions.

[0117] Step S230: for the many-to-one matching pairs, the matching pairs are corrected by analyzing the positions of the matching points and the associated points to be matched.

[0118] See also Figure 5 , Figure 5 A matching diagram of a matching pair of a many-to-one matching type. Figure 5 The point in the upper middle is the point on the spectrum curve of the hair dye. Figure 5 The points in the middle and lower part are points on the hair quality spectrum curve. The black points and the points connected to the black points by lines constitute a many-to-one match, and the gray points and the points connected to the gray points by lines constitute a one-to-one match. The gray points are points on the hair dye spectrum curve with the same wavelength as the black points. The points on the hair dye spectrum curve and the hair quality spectrum curve with the same wavelength are connected by dotted lines.

[0119] Similarly, any point on the hair quality spectrum curve is used as the point to be analyzed, and the matching pair to which the point to be analyzed belongs and the matching point within the matching pair are obtained, and the point on the hair dye spectrum curve with the same wavelength as the point to be analyzed is obtained as the point to be matched.

[0120] exist Figure 5 If the black point is the point to be analyzed, the corresponding point connected to the black point by a line segment is the matching point, and the corresponding point connected to the black point by a dotted line is the point to be matched.

[0121] The smaller the order difference between the matching point of the current point to be analyzed and the point to be matched, the greater the probability that the impact on the overall matching will be smaller after the point to be matched matches the current analysis point, and the easier it is to make corrections.

[0122] The fewer the corresponding hair points connected to the to-be-matched point, the smaller the impact on the overall match caused by connecting the current analysis point with the to-be-matched point, and the easier it is to make corrections.

[0123] Calculate the order difference between the matching point of the point to be analyzed and the point to be matched; obtain the number of matching pairs corresponding to the point to be matched, and record it as the number to be matched. Combine the order difference and the number to be matched to determine the third matching type correction.

[0124] As an embodiment of the present invention, the calculation formula of the third matching type correction is: ; Among them, x2 is the third matching type correction; e is a natural constant; a is the order difference between the matching point to be analyzed and the point to be matched; b is the number of matching pairs to be matched corresponding to the point to be matched.

[0125] The third matching type correctability reflects the correctability when the current point to be analyzed belongs to a many-to-one situation. After obtaining the calculation formula of the third matching type correctability, the matching pair is corrected based on the third matching type correctability. More specifically: when the third matching type correctability is greater than the preset correction threshold, the point to be analyzed and the point to be matched are connected to obtain the corresponding matching pair. In the embodiment of the present invention, the preset correction threshold value is 0.7, and in other embodiments, the implementer can adjust the value according to the actual situation.

[0126] Step S300, based on the corrected matching distance of the matching pair, determine the fitness of the hair quality spectrum curve and the spectrum curves of different hair dyes; input the customer's hair quality spectrum curve, fitness and hair dye spectrum curve into the trained neural network to obtain the fitness of the customer's hair quality spectrum curve and the spectrum curves of different hair dyes.

[0127] After obtaining the corrected matching pairs, the fitness of the hair quality spectrum curve and the different hair dye spectrum curves is determined based on the matching distance of the corrected matching pairs. As an embodiment of the present invention, for the hair dye spectrum curve of any hair dye, the mean of the matching distances between all matching pairs in the hair quality spectrum curve and the hair dye spectrum curve, that is, the mean of the DTW distance, that is, the negatively correlated normalized mapping value of the mean of the dynamic time warping distance, is recorded as the fitness.

[0128] The corresponding fitness is determined by analyzing the hair quality spectrum curve and the hair dye spectrum curve in the neural network training set. Experts manually analyze and score the fitness of the hair quality spectrum curve and the hair dye spectrum curve. The more suitable the customer's hair quality is for the hair dye, the higher the corresponding fitness is. The neural network is trained by the hair quality spectrum curve and the hair dye spectrum curve, the corresponding fitness, and the corresponding fitness in the neural network training set, so that after the calculated fitness, hair spectrum, and hair dye spectrum data are input into the trained neural network, the corresponding fitness can be obtained, instead of still needing experts to manually label. And by combining the fitness obtained by data analysis and the fitness evaluated by experts for scoring, the subjective and objective are combined to obtain the fitness of the hair dye that better matches the customer's hair.

[0129] When constructing a Convolutional Neural Networks (CNN) model, the calculated fitness, hair quality spectrum curve, and hair dye spectrum curve are used as inputs of the trained neural network. These input data are properly preprocessed, such as normalization and dimension adjustment, to ensure that they can be effectively processed by the network. The goal of the embodiment of the present invention is to predict a scalar value, namely, fitness, through this convolutional neural network model, which quantifies the compatibility between a specific hair dye and a hair sample.

[0130] Among them, the loss function of the convolutional neural network is the cross entropy loss function. This is because the output is a scalar value, and the cross entropy loss function is suitable for scalar value classification problems and can effectively measure the difference between the predicted value and the true value. The output layer of the convolutional neural network is designed to have only one neuron, which outputs a value between 0 and 1 through an activation function to represent the probability of fitness. During the training process, the weights and biases of the network are continuously adjusted to minimize the cross entropy loss between the predicted fitness and the actual fitness, thereby improving the prediction accuracy of the model. In addition, in order to enhance the generalization ability of the model, regularization techniques such as random inactivation (dropout) or L2 regularization can be introduced into the convolutional neural network to prevent overfitting. In this way, it is expected that the trained model will not only perform well on the training data, but also make accurate fitness predictions on new and unseen data.

[0131] As a preferred embodiment of the present invention, the implementer may also select the hair dye corresponding to the hair dye spectrum curve with the greatest adaptability corresponding to the hair quality spectrum curve of the customer's hair to be tested as the most suitable hair dye, and make corresponding recommendations to the customer; the implementer may also select and arrange the hair dyes from top to bottom in order of adaptability from large to small, with the hair dye with the greatest adaptability ranked first.

[0132] The embodiment of the present invention provides a hair quality detection system for beauty and hairdressing, and the system includes the following modules:

[0133] A preprocessing module is used to obtain a hair quality spectrum curve of a customer's hair; and a dynamic time warping algorithm is used to match the hair quality spectrum curve with the hair dye spectrum curves of different hair dyes to obtain a matching pair consisting of matching points.

[0134] The spectrum analysis module corrects the matching pairs of different matching types by combining the reflectances of different points and corresponding matching points on the hair quality spectrum curve, the reflectances of points with the same wavelength on the hair dye spectrum curve, the positions of the matching points in the matching pairs, and the associated points to be matched;

[0135] The fitness analysis module determines the fitness of the hair quality spectrum curve and the spectrum curves of different hair dyes based on the corrected matching distance of the matching pair; the customer's hair quality spectrum curve, fitness and hair dye spectrum curve are input into the trained neural network to obtain the fitness of the customer's hair quality spectrum curve and the spectrum curves of different hair dyes.

[0136] Optionally, the transmission medium may be a wired link, such as but not limited to coaxial cable, optical fiber, and digital subscriber line, or a wireless link, such as but not limited to Wireless Fidelity (WIFI), Bluetooth, and mobile device network.

[0137] It should be noted that: the device provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device is divided into different functional modules to complete all or part of the functions described above. In addition, the shopping guide device provided in the above embodiment and the image extension method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0138] Figure 6 is a schematic diagram of the structure of a computer device provided by an embodiment of the present invention. Figure 6 As shown, the computer device 600 includes: a memory 610, a processor 620, and a computer program 630 stored in the memory 610 and running on the processor 620, wherein when the processor 620 executes the computer program 630, the computer device can execute any one of the hair quality detection methods for beauty and hairdressing introduced above.

[0139] In addition, an embodiment of the present invention also protects a device, which may include a memory and a processor, wherein the memory stores an executable program code, and the processor is used to call and execute the executable program code to execute a hair quality detection method for beauty and hairdressing provided by an embodiment of the present invention.

[0140] The embodiment of the present invention can divide the functional modules of the device according to the above method example. For example, each functional module can be corresponded, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0141] In the case of dividing each module according to each function, the device may also include a signal uploading module, a determining module, an adjusting module, etc. It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, which will not be repeated here.

[0142] It should be understood that the device provided in the embodiment of the present invention is used to execute the above-mentioned hair quality detection method for beauty and hairdressing, and thus can achieve the same effect as the above-mentioned implementation method.

[0143] In the case of an integrated unit, the device may include a processing module and a storage module. When the device is applied to a device, the processing module may be used to control and manage the actions of the device. The storage module may be used to support the device to execute mutual program codes, etc. The processing module may be a processor or a controller, which may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of the present invention. The processor may also be a combination that implements a computing function, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module may be a memory.

[0144] In addition, the device provided in the embodiment of the present invention may specifically be a chip, a component or a module, and the chip may include a connected processor and a memory; wherein the memory is used to store instructions, and when the processor calls and executes the instructions, the chip can execute a hair quality detection method for beauty and hairdressing provided in the above embodiment.

[0145] An embodiment of the present invention also provides a computer-readable storage medium, in which a computer program code is stored. When the computer program code is run on a computer, the computer executes the above-mentioned related method steps to implement a hair quality detection method for beauty and hairdressing provided in the above embodiment.

[0146] An embodiment of the present invention further provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement a hair quality detection method for beauty and hairdressing provided in the above embodiment.

[0147] Among them, the device, computer-readable storage medium, computer program product or chip provided in the embodiments of the present invention are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here. Through the description of the above implementation methods, technicians in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways.

[0148] The device embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division. There may be other divisions in actual implementation. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection of devices or units, which may be electrical, mechanical or other forms.

[0149] It should also be noted that, in this article, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0150] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0151] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

[0152] The above contents are only specific implementation modes of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered within the protection scope of the present invention.

Claims

1. A hair quality detection method for beauty and hairdressing, It is characterized in that The method comprises the following steps: Acquire a hair quality spectrum curve of the customer's hair; use a dynamic time warping algorithm to match the hair quality spectrum curve with hair dye spectrum curves of different hair dyes to obtain a matching pair consisting of matching points; For matching pairs of different matching types, the matching pairs of different matching types are corrected by combining the reflectances of different points and corresponding matching points on the hair quality spectrum curve, the reflectances of points with the same wavelength on the hair dye spectrum curve, the positions of the matching points in the matching pairs, and the associated points to be matched; Based on the corrected matching distance of the matching pair, the fitness of the hair quality spectrum curve and the spectrum curves of different hair dyes is determined; the customer's hair quality spectrum curve, the fitness and the hair dye spectrum curve are input into the trained neural network to obtain the fitness of the customer's hair quality spectrum curve and the spectrum curves of different hair dyes; The matching pairs of different matching types are corrected by combining the reflectances of different points and corresponding matching points on the hair quality spectrum curve, the reflectances of points with the same wavelength on the hair dye spectrum curve, the positions of the matching points in the matching pairs, and the associated points to be matched, including: The matching types of matching pairs are divided into: one-to-one matching, one-to-many matching, and many-to-one matching; For a one-to-one matching pair, a matching probability is determined by combining the reflectances of different points on the hair quality spectrum curve and the corresponding matching points, and the reflectances of points with the same wavelength on the hair dye spectrum curve, and the matching pair is retained based on the matching probability; For a one-to-many matching pair, the matching pair is modified by analyzing the position of the matching point and the matching probability; For many-to-one matching pairs, the matching pairs are corrected by analyzing the positions of the matching points and the associated points to be matched; Wherein, for the one-to-one matching pair, determining the matching probability by combining the reflectances of different points and corresponding matching points on the hair quality spectrum curve and the reflectances of points with the same wavelength on the hair dye spectrum curve comprises: Taking any point on the hair quality spectrum curve as the point to be analyzed, obtaining the matching pair to which the point to be analyzed belongs and the matching point within the matching pair, and obtaining the point on the hair dye spectrum curve with the same wavelength as the point to be analyzed as the point to be matched; The normalized value of the difference between the reflectance of the point to be analyzed and the corresponding point to be matched is used as the first analysis value; The normalized value of the difference between the point to be analyzed and the corresponding matching point in the matching pair is used as the second analysis value; Taking the first analysis value as a weight, weighting the normalized value of the difference between the first analysis value and the second analysis value to obtain a matching probability of a matching pair; Wherein, retaining the matching pairs based on the matching probability includes: The matching pairs whose corresponding matching probability is greater than a preset matching threshold are retained; Wherein, for the one-to-many matching pair, the matching pair is corrected by analyzing the position of the matching point and the matching probability, including: Calculate the matching probability between each point to be analyzed and the corresponding matching point, which is recorded as the first matching probability; Calculate the normalized value of the position difference between the matching point and the point to be matched corresponding to each point to be analyzed; According to the order of the order values, the matching points corresponding to the points to be analyzed are sorted to obtain a standard sequence; Sort the matching points corresponding to the points to be analyzed according to the order of the first matching probabilities to obtain a matching sequence; Calculate the position difference of the same element in the standard sequence and the matching sequence to determine the matching probability difference; Determine a second match type correctness by combining the match probability difference and the normalized value of the position difference value; Based on the second matching type correctness, correcting the matching pair; Wherein, for the matching pairs of many-to-one matching, the matching pairs are corrected by analyzing the positions of the matching points and the associated points to be matched, including: Calculate the order difference between the matching point of the point to be analyzed and the point to be matched; Get the number of matching pairs corresponding to the points to be matched, recorded as the number of matches to be matched; Determine the third matching type correctness based on the order difference and the number to be matched; Based on the third matching type correctability, correcting the matching pair; The step of correcting the matching pair based on the third matching type correctability includes: When the third matching type correctability is greater than a preset correction threshold, the point to be analyzed and the point to be matched are connected to obtain a corresponding matching pair; Wherein, determining the adaptability of the hair quality spectrum curve and the spectrum curves of different hair dyes based on the corrected matching distance of the matching pair includes: For the hair dye spectrum curve of any hair dye, the negative correlation normalized mapping value of the mean of the dynamic time warping distance of each matching pair after correction is used as the fitness of the hair quality spectrum curve and the hair dye spectrum curve.

2. The hair quality detection method for hairdressing and beauty according to claim 1, It is characterized in that After obtaining the compatibility of the hair quality spectrum curve of the customer's hair and the spectrum curves of different hair dyes, the method further includes: The hair dye corresponding to the hair dye spectrum curve with the greatest degree of suitability is taken as the hair dye that best matches the customer's hair.

3. A hair quality detection system for beauty and hairdressing, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the steps of the hair quality detection method for beauty and hairdressing as described in any one of claims 1 to 2 are implemented.