Facial and tongue coating recognition and tea recommendation method and system based on artificial intelligence
By using dynamic parameter optimization convolutional neural network and multi-dimensional fusion extreme learning machine algorithm in the facial and tongue coating recognition system, the problems of feature extraction and classification instability and low accuracy in the prior art are solved, and higher recognition accuracy and system stability are achieved.
Patent Information
- Application Number
- CN202510096928.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-01-22
AI Technical Summary
The existing recommended methods for facial and tongue coating recognition and tea drinks have problems of instability and low accuracy in feature extraction and classification, resulting in inaccurate recognition of facial images and tongue coating images.
A convolutional neural network algorithm based on dynamic parameter optimization is used for feature extraction, and a collaborative optimization mechanism is established by dynamically adjusting the hierarchical distance and quality differences of parameters. In the classification process, an extreme learning machine algorithm based on multi-dimensional fusion is used to improve decision accuracy.
The stability and accuracy of the feature extraction model are improved, the adaptability and generalization ability of the classification model to complex data features is enhanced, and the recognition accuracy of facial images and tongue coating images is significantly improved.
Smart Images

Figure CN119540662B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image recognition or understanding, and in particular to a method and system for face and tongue coating recognition and tea recommendation based on artificial intelligence. Background Art
[0002] In recent years, the tea beverage industry has expanded rapidly, and more and more consumers have developed the habit of drinking tea. At the same time, consumers' health awareness has gradually strengthened, and they have begun to pursue tea beverages that are more beneficial to health. Therefore, healthy tea beverages have emerged. With the development of artificial intelligence technology, methods and technologies for recognizing facial images and tongue coating images based on artificial intelligence have emerged (for example, the technology disclosed in the invention patent with authorization announcement number CN118697293B and name Multi-spectral Chinese Medicine Tongue Facial Image Information Analysis Equipment and Method). However, the well-known tea beverage health knowledge believes that people with red faces and eyes and thick yellow tongue coating should drink red wolfberry tea, people with slightly red cheeks and thin yellow tongue coating should drink Sterculia lychnophora tea, people with dull complexion and white and greasy tongue coating and fat tongue should drink jasmine tea, people with pale complexion and pale and fat tongue coating should drink Eucommia tea, and people with blue-gray complexion and thin white tongue coating should drink rose tea. Therefore, the healthy tea beverage industry has applied such technology to start using tea drinking machines in stores that can recognize facial images and tongue coating images and make tea recommendations.
[0003] The tea machine is equipped with a face and tongue recognition and tea recommendation system. The face and tongue recognition and tea recommendation system uses the face and tongue recognition and tea recommendation method to recognize facial images and tongue images, and gives recommended teas corresponding to the facial images and tongue images based on the effects of different teas.
[0004] Existing facial and tongue coating recognition and tea recommendation methods mainly include obtaining facial images and tongue coating images, using traditional gradient descent algorithm to train feature extraction model to extract features from facial images and tongue coating images, and then using neural network, extreme learning machine or support vector machine and other algorithms to train classification model to identify and classify the data after feature extraction to obtain recommended teas corresponding to the facial images and tongue coating images.
[0005] However, in the feature extraction process, the traditional gradient descent algorithm is limited by the fixed optimization strategy and cannot adapt to the data features. It is difficult to effectively deal with the high-dimensional and complex features of facial images and tongue coating images. Therefore, it is easy to fall into local optimality or gradient anomaly during the training process, which will cause the feature extraction model to be unstable, thereby affecting the feature extraction effect of the feature extraction model; in the classification process, algorithms such as neural networks, extreme learning machines or support vector machines are limited by a single feature fusion and fixed weight mechanism, which makes the trained classification model insufficiently adaptable to the distribution of diversified data, resulting in inaccurate classification results. Therefore, when the feature extraction model is not effective and the classification model is not effective, the face and tongue coating recognition and tea recommendation methods will not be accurate enough in recognizing facial images and tongue coating images.
[0006] Therefore, the existing face and tongue coating recognition and tea recommendation methods and systems of tea machines have the problem of inaccurate recognition of facial images and tongue coating images. Summary of the invention
[0007] The technical problem to be solved by the present invention is to overcome the shortcomings of the above-mentioned prior art and provide an artificial intelligence-based face and tongue coating recognition and tea recommendation method and system that can more accurately recognize facial images and tongue coating images.
[0008] In order to solve the above technical problems, the face and tongue coating recognition and tea recommendation method based on artificial intelligence provided by the present invention includes:
[0009] S1. Obtain multiple images, manually identify the multiple images and label each of the images to obtain multiple labeled images;
[0010] The images include a plurality of facial images and a plurality of tongue coating images;
[0011] The labels include recommending drinking red wolfberry tea, recommending drinking jasmine tea, recommending drinking eucommia tea, recommending drinking sterculia lychnophora tea, and recommending drinking rose tea;
[0012] S2. Inputting the plurality of annotated images into a feature extraction model, training the feature extraction model using a convolutional neural network algorithm based on dynamic parameter optimization, and obtaining a plurality of feature-extracted images and a trained feature extraction model;
[0013] The convolutional neural network algorithm based on dynamic parameter optimization adopts a dynamic parameter optimization strategy for parameter optimization. The dynamic parameter optimization strategy is to consider that weights with larger absolute values will have an impact on other parts of the network when optimizing parameters. Therefore, the hierarchical distance and quality difference of the parameters are dynamically adjusted by introducing a dynamic adjustment function to establish a collaborative optimization mechanism between the parameters.
[0014] S3. Inputting the plurality of feature-extracted images into a classification model, and training the classification model using an extreme learning machine algorithm based on multi-dimensional fusion to obtain a trained classification model;
[0015] The extreme learning machine algorithm based on multi-dimensional fusion is to perform multi-dimensional fusion on the hidden layer output and dynamically adjust the weight of each feature in the classification decision, perform weighted summation on the feature outputs of different hidden layers according to their importance and sensitivity to the current sample, and improve the accuracy of decision-making through nonlinear transformation in the classification stage;
[0016] S4. Capture a new image, input the new image into the trained feature extraction model for feature extraction, obtain a new image after feature extraction, input the new image after feature extraction into the trained classification model for classification, and obtain a label for the new image.
[0017] As a further improvement of the present invention: the pixel width of the image is greater than or equal to 3000px, and the height is greater than or equal to 2000px.
[0018] As a further improvement of the present invention: the step of training the feature extraction model using a convolutional neural network algorithm based on dynamic parameter optimization in S2 includes:
[0019] S201. Initialize the parameters of the convolutional neural network;
[0020] S202. Calculate the quality of convolutional neural network parameters;
[0021] S203. According to the quality of each parameter of the convolutional neural network, their influence on other parameters is calculated. The influence between parameters is calculated by a dynamically adjusted function. Considering the relative position and quality difference between the parameters of the convolutional neural network, the hierarchical distance and quality difference of the parameters are introduced by the dynamic adjustment function. The calculation formula is:
[0022] ,
[0023] In the formula, For the convolutional neural network parameters and The mutual influence between the parameters For the The convolutional neural network of the first iteration The quality of the weights, For the The convolutional neural network of the first iteration The quality of the weights, For the parameters and The layer distance of parameters in convolutional neural networks, is a small constant used to prevent the denominator from being zero;
[0024] S204. Based on the current gradient, the influence between parameters and the local fitness adjustment item, an optimization path is generated for each parameter. The calculation formula of the local fitness adjustment item is:
[0025] ,
[0026] In the formula, For the The local fitness adjustment term of the iteration, is the local fitness adjustment coefficient, For the The convolutional neural network of the first iteration The quality of the weights, For the The convolutional neural network of the first iteration weights, For the The convolutional neural network of the first iteration The increment of weight;
[0027] S205. Convolutional Neural Network The increment of weights is used as the optimization path, and the parameters are updated according to the calculated optimization path. At the same time, the weight parameters of the convolutional neural network are dynamically optimized in combination with the quality of the convolutional neural network weights. For the dynamic changes and subtle differences that may exist in the image, the learning efficiency of the convolutional neural network and the accuracy of feature extraction are improved, which is expressed as:
[0028] ,
[0029] In the formula, For the The weights of the convolutional neural network at the iteration, For the The weights of the convolutional neural network at the iteration, The convolutional neural network The weight update amount for each iteration;
[0030] S206. Evaluate the performance of the convolutional neural network using a loss function, wherein the loss function is a cross entropy loss function, and the cross entropy loss function is calculated based on the labels of the data, and the labels of the data are classified by a preset Softmax function on the output image feature vector of the convolutional neural network;
[0031] S207. Repeat iterations S202 to S206 until a preset stop iteration condition is met.
[0032] Preferably, the parameters of the convolutional neural network initialized in S201 include initializing the weights and biases of the convolutional neural network, and the initialization method is expressed as:
[0033] ,
[0034] In the formula, is the initial weight of the convolutional neural network, To obey a specific distribution, is a normal distribution, is the initialization variance of the convolutional neural network weights, is the initial bias of the convolutional neural network, is the initialization variance of the convolutional neural network bias.
[0035] Preferably, the calculation formula for calculating the quality of the convolutional neural network parameters in S202 is:
[0036] ,
[0037] In the formula, For the The quality of the convolutional neural network weights at iterations, For the The weights of the convolutional neural network at iteration .
[0038] As a further improvement of the present invention: the step of training the classification model using an extreme learning machine algorithm based on multi-dimensional fusion in S3 includes:
[0039] S301. Initialize the weights and biases of the extreme learning machine;
[0040] S302. The input feature-extracted image is sent to the hidden layer of the model and is mapped to a high dimension through a nonlinear activation function. Each input feature is connected to the corresponding hidden layer node to obtain a feature transformation result, retaining more nonlinear information in the feature-extracted image to enhance the classification effect. The feature-extracted image is mapped to a high-dimensional space through a nonlinear activation function in the hidden layer, retaining more nonlinear information, enhancing the extreme learning machine model's perception of complex sample characteristics, and improving the model's robustness to the input feature-extracted image through regularization constraints, thereby improving the classification effect and generalization ability. The calculation method is expressed as:
[0041] ,
[0042] In the formula, is the nonlinear mapping function of the hidden layer, is the initial weight matrix between the input layer and the hidden layer of the extreme learning machine, is the image extracted from the features of the input extreme learning machine, is the bias between the input layer and the hidden layer of the extreme learning machine, is the regularization coefficient; is the L2 norm, which constrains the input feature length to improve the stability of the weight update process; is the Sigmoid activation function;
[0043] S303. During training iterations, the training speed and stability of the model are dynamically optimized through an adaptive learning rate adjustment mechanism. The learning rate is controlled by comprehensively considering the current gradient size and gradient direction changes, so that the model reduces the learning rate when the error is large to avoid violent fluctuations, and increases the learning rate when the error is small to accelerate convergence. For complex data distribution, the gradient size and direction changes are comprehensively considered for adjustment, which not only ensures the high efficiency of training, but also improves the classification accuracy of the extreme learning machine model for the image after feature extraction, especially the sensitivity processing of abnormal samples. The calculation method is expressed as:
[0044] ,
[0045] In the formula, For extreme learning machine The learning rate at the iteration, For extreme learning machine The learning rate at the iteration, is the dynamic gradient direction coefficient, For the The L2 norm of the gradient at iteration , For the The L2 norm of the gradient at iteration , is the attenuation factor;
[0046] S304. In each round of training of the extreme learning machine, the weights and biases are dynamically optimized. Not only are the parameters updated according to the standard back-propagation gradient, but also the error size of the extreme learning machine and the influence of the regular term are combined to make the area with large errors obtain more updated weights, thereby improving the recognition ability of complex samples. In the case of distribution diversity and subtle differences in the features of the image, the applicability and classification effect of the extreme learning machine model are improved, which is expressed as:
[0047] ,
[0048] In the formula, For extreme learning machine The weight matrix between the input layer and the hidden layer at the iteration, For extreme learning machine The weight matrix between the input layer and the hidden layer at the iteration, For extreme learning machine The learning rate at the iteration; is the symbol of partial derivative, is the loss function of the extreme learning machine, is the weight matrix between the input layer and the hidden layer of the extreme learning machine, is the regularization factor of the extreme learning machine, is the first adjustment coefficient of the extreme learning machine, For extreme learning machine The loss function at the iteration is: For extreme learning machine The bias between the input layer and the hidden layer at the iteration, For extreme learning machine The bias between the input layer and the hidden layer at the iteration, is the bias between the input layer and the hidden layer of the extreme learning machine, is the second adjustment coefficient of the extreme learning machine;
[0049] S305. In order to enhance the model's ability to process images after multi-dimensional feature extraction, the extreme learning machine performs multi-dimensional fusion of the hidden layer output and dynamically adjusts the weight of each feature in the classification decision. The feature outputs of different hidden layers are weighted and summed according to their importance and sensitivity to the current sample, and the accuracy of the decision is improved through nonlinear transformation in the classification stage. For data with large differences in feature distribution of images, it helps to balance the importance of global and local features, and can enhance the adaptability of the extreme learning machine model to complex feature distribution, thereby improving the classification accuracy, which is expressed as:
[0050] ,
[0051] In the formula, is the fused feature vector output by the hidden layer of the extreme learning machine, is the number of neurons in the hidden layer of the extreme learning machine, is the hidden layer front of the extreme learning machine The fusion weight of neurons, The image sample after feature extraction is placed before the hidden layer of the extreme learning machine. The output produced by a neuron is is the fusion correction coefficient used for additional weighting according to the feature contribution, The image sample after feature extraction is placed before the hidden layer of the extreme learning machine. The normalized form of the output feature covariance matrix produced by neurons;
[0052] S306. Repeat iterations S302 to S305 until a preset stop iteration condition is met.
[0053] Preferably, the initializing the weights and biases of the extreme learning machine in S301 includes:
[0054] Initializing the bias of the extreme learning machine to 0;
[0055] The weight initialization method of the extreme learning machine is:
[0056] ,
[0057] In the formula, is the initial weight matrix between the input layer and the hidden layer of the extreme learning machine, is a normal distribution, It means the mean is 0 and the variance is The normal distribution of is the normalized form of the feature covariance matrix of the image after feature extraction of the input extreme learning machine, A weight adjustment factor used to control the value range of the weight during initialization.
[0058] The present invention also provides a facial and tongue coating recognition and tea recommendation system based on artificial intelligence, which applies the facial and tongue coating recognition and tea recommendation method based on artificial intelligence, and comprises:
[0059] Data collection and storage module, used for collecting and storing data;
[0060] A data processing module is used to extract features from input data;
[0061] A data analysis module is used to classify the input data and obtain labels corresponding to the input data;
[0062] A control module, used for obtaining specific operation instructions according to the labels output by the data analysis module and sending the operation instructions to the execution module;
[0063] The execution module is used to receive the operation instruction and execute the operation instruction.
[0064] The beneficial effects of the present invention are as follows: The artificial intelligence-based face and tongue coating recognition and tea recommendation method provided by the present invention is more accurate in recognizing face images and tongue coating images.
[0065] This method uses a convolutional neural network to train the feature extraction model. The convolutional neural network adopts a dynamic parameter optimization strategy. The dynamic parameter optimization strategy is inspired by the gravitational lens effect. When optimizing parameters, the hierarchical distance and quality difference of the parameters are dynamically adjusted by dynamically adjusting the function, and a collaborative optimization mechanism is established between the parameters. The learning process of the entire convolutional neural network is optimized by dynamically adjusting the mutual influence between the parameters, avoiding the gradient vanishing and gradient explosion problems that may occur in the traditional gradient descent algorithm, and solving the problem of insufficient efficiency and accuracy in high-dimensional feature extraction, so that the feature extraction model has better feature extraction performance. This method also uses an extreme learning machine algorithm based on multi-dimensional fusion for classification. The extreme learning machine algorithm based on multi-dimensional fusion enhances the processing ability of the classification model for the image extracted by feature extraction through dynamic weighting and nonlinear transformation, improves the classification effect of complex data features, solves the problems of poor adaptability of the existing classification model to the distribution of diversified data and low classification accuracy, and ensures a higher training speed while achieving better generalization ability and accuracy, thereby improving the classification accuracy of the classification model. In summary, this method is relatively accurate in recognizing facial images and tongue coating images, and the artificial intelligence-based facial and tongue coating recognition and tea recommendation system that applies this method is also relatively accurate in recognizing facial images and tongue coating images. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 A principle block diagram of the method provided by the present invention;
[0067] Figure 2 This is an experimental data diagram of the relationship between weight quality and convergence performance in S2 of the present invention;
[0068] Figure 3 This is the experimental data of the impact of dynamic adjustment and local fitness adjustment on performance in S2 of the present invention. DETAILED DESCRIPTION
[0069] The specific implementation modes of the present invention are further described in detail below in conjunction with the accompanying drawings.
[0070] The features, operations or characteristics described in the present invention may be combined in any appropriate manner to form various embodiments. At the same time, the steps or actions described in the present invention may also be interchanged or adjusted in a manner that is obvious to those skilled in the art. Therefore, the various sequences in the present invention and the accompanying drawings, such as "S1", are only for the purpose of clearly describing a certain embodiment and are not intended to be a necessary sequence, unless otherwise specified that a certain sequence must be followed.
[0071] (1) Gravitational lens effect: It is a special optical effect in a strong gravitational field. Specifically, it refers to the distortion of spacetime near a massive celestial body, which causes the propagation path of light near the massive celestial body to bend. Its effect is similar to the refraction of light by a lens. If we assume that there is a celestial body with a strong gravitational field between the earth and a distant celestial body, and the three are almost in a straight line, the curvature of spacetime near the celestial body with a strong gravitational field will prevent the light from the distant celestial body from reaching the earth in a straight line, and the image observed on the earth will deviate from its original direction.
[0072] like Figure 1 As shown, the face and tongue coating recognition and tea recommendation method based on artificial intelligence provided by the present invention includes:
[0073] S1. Acquire multiple images through the data acquisition and storage module, manually identify multiple images and label each image, obtain multiple labeled images, and store them in the data acquisition and storage module;
[0074] There are many ways to obtain multiple images, such as collecting them through the image acquisition device that comes with the tea machine, or having the user shoot with a smart phone or camera and then upload them to the data acquisition module of the tea machine. Among them, it is more recommended to collect them through the image acquisition device that comes with the tea machine. The image acquisition device must be a high-resolution device, the user's position in front of the tea machine is relatively fixed, and the acquisition mode is also the same. The final image obtained is relatively more standardized, which can solve the problem of inconsistent quality of source data acquisition and ensure that the acquired image has high resolution and detail fidelity.
[0075] Each image comes from a user, and the images include multiple facial images and multiple tongue coating images; the facial images include a frontal facial image, a left side facial image, and a right side facial image showing the facial color; the tongue coating images include a frontal tongue image, a side tongue image, and a close-up tongue image showing the tongue coating color, tongue coating distribution area, and tongue coating thickness.
[0076] Those who perform manual recognition are domain experts.
[0077] All images are high-definition images, which are required to meet certain resolution standards. The pixel width of the image is greater than or equal to 3000px and the height is greater than or equal to 2000px to ensure the clarity of details and maintain the authenticity of the original image. Images are stored in standard image formats (JPEG or PNG).
[0078] The labels include recommending drinking red wolfberry tea, recommending drinking jasmine tea, recommending drinking eucommia tea, recommending drinking sterculia lychnophora tea, and recommending drinking rose tea; after labeling, all images in each image will be associated with the label of the image.
[0079] S2. Inputting a plurality of annotated images into a feature extraction model of a data processing module, training the feature extraction model using a convolutional neural network algorithm based on dynamic parameter optimization, and obtaining a plurality of feature-extracted images and a trained feature extraction model;
[0080] The convolutional neural network algorithm based on dynamic parameter optimization uses a dynamic parameter optimization strategy for parameter optimization. The dynamic parameter optimization strategy is inspired by the gravitational lens effect in astrophysics, that is, the gravity of large mass celestial bodies will affect the light path. Considering that when optimizing parameters during training, large mass parameters (weights with large absolute values) will also have a greater impact on other parts of the network. The dynamic parameter optimization strategy is to take into account the impact of weights with large absolute values on other parts of the network when optimizing parameters. Therefore, the hierarchical distance and mass difference of the parameters are dynamically adjusted through the dynamic adjustment function to establish a collaborative optimization mechanism between the parameters; the learning process of the entire convolutional neural network is optimized through the dynamic adjustment of the mutual influence between the parameters, avoiding the gradient vanishing and gradient explosion phenomena caused by the traditional gradient descent method, and at the same time improving the learning efficiency of the convolutional neural network, accelerating convergence, and improving the robustness of the convolutional neural network. Such as Figure 2 As shown in , according to the weight quality of the convolutional neural network (the larger the absolute value, the higher the quality), the loss value of every 100 steps in the network training process is evaluated, which is Figure 2 It can be seen that large-mass parameters (weights with large absolute values) converge quickly in the early stages of training.
[0081] The structure of the convolutional neural network is as follows:
[0082] 1) Input layer
[0083] The data format of the input layer is a multidimensional array of images. For example, the image input to the convolutional neural network is A tensor of is the height of the image multidimensional array, is the width of the image multidimensional array, is the number of channels of the image multidimensional array.
[0084] 2) Convolutional Layer
[0085] The convolution layer performs convolution operation on the image of the input layer to extract local features. Multiple convolution layers can perform continuous convolution operations. The convolution operation is implemented through the convolution kernel. The moving step size of the convolution operation is preset manually. For example, if the step size is 1, zeros are filled at the edge of the image of the input layer to control the size of the output.
[0086] 3) Pooling layer
[0087] The pooling layer reduces the size of the feature map through downsampling operations, reduces computational complexity, and retains the main features. The pooling layer can use maximum pooling (taking the maximum value in the pooling window) or average pooling (taking the average value in the pooling window). The pooling window size is preset manually, such as 2 x 2.
[0088] 4) Fully connected layer
[0089] The fully connected layer flattens the high-dimensional feature map into a one-dimensional vector and performs calculations with the fully connected neurons. The output of the fully connected layer obtains the output features of the convolutional neural network.
[0090] The convolutional neural network algorithm used in S2 to train the feature extraction model includes:
[0091] S201. Initialize the parameters of the convolutional neural network;
[0092] Initializing the parameters of the convolutional neural network includes initializing the weights and biases of the convolutional neural network. All weights and biases of the convolutional neural network are initialized from a small random distribution, so that the convolutional neural network has the ability to explore image diversity in the initial stage, which can effectively prevent the network from falling into the local optimum too early and ensure that the network has sufficient generalization ability in the initial state, which plays a key role in capturing subtle differences in image feature extraction. The initialization method is expressed as:
[0093] ,
[0094] In the formula, is the initial weight of the convolutional neural network, To obey a specific distribution, is a normal distribution; is the initialization variance of the convolutional neural network weights, set to 0.01; is the initial bias of the convolutional neural network; is the initialization variance of the convolutional neural network bias, Set to 0.04;
[0095] S202. Calculate the quality of the convolutional neural network parameters; calculate the quality of the parameters according to their absolute values to determine the relative importance of network optimization. The larger the absolute value of the weight, the greater the corresponding quality. In the task of extracting image features, these key features may have obvious weight concentration areas, and emphasizing the importance of these areas can improve the network's learning effect on key features. The calculation formula for calculating the quality of the convolutional neural network parameters is:
[0096] ,
[0097] In the formula, For the The quality of the convolutional neural network weights at iterations, For the The weights of the convolutional neural network at the iteration;
[0098] S203. According to the quality of each parameter of the convolutional neural network, their influence on other parameters is calculated. The influence between parameters is calculated by a dynamically adjusted function. The relative position (hierarchical difference) and quality difference between the parameters of the convolutional neural network are considered. The hierarchical distance and quality difference of the parameters are introduced by dynamically adjusting the function, so that the convolutional neural network can adapt to the complex hierarchical relationship of image features, establish a more reasonable collaborative optimization mechanism between parameters, and improve the ability to process the hierarchical information existing in complex tongue coating texture features or facial texture features. The calculation formula is:
[0099] ,
[0100] In the formula, For the convolutional neural network parameters and The mutual influence between the parameters For the The convolutional neural network of the first iteration The quality of the weights, For the The convolutional neural network of the first iteration The quality of the weights, For the parameters and The layer distance of parameters in convolutional neural networks, is a small constant used to prevent the denominator from being zero, Set to ;
[0101] S204. The current gradient, the influence between parameters and the local fitness adjustment item are integrated to generate an optimization path for each parameter. By integrating the current gradient, the influence between parameters and the local fitness adjustment item, the adaptability of the convolutional neural network to different image features is improved. The local fitness adjustment item can help the convolutional neural network to optimize and adjust the extraction of local details in the image features, so that the network is better at processing complex data with local characteristics. The calculation formula of the local fitness adjustment item is:
[0102] ,
[0103] In the formula, For the The local fitness adjustment term of the iteration, is the local fitness adjustment coefficient, For the The convolutional neural network of the first iteration The quality of the weights, For the The convolutional neural network of the first iteration weights, For the The convolutional neural network of the first iteration The increment of weight;
[0104] The optimization path formula updates the incremental calculation of the weights of the convolutional neural network as follows:
[0105] ,
[0106] In the formula, For the The increment of the convolutional neural network weights for each iteration, is the learning rate of the convolutional neural network, For the The gradient of the convolutional neural network loss function with respect to the weight parameters of the iteration, To adjust the coefficient of the affected proportion of the weight, For the convolutional neural network parameters and The mutual influence between the parameters For the The local fitness adjustment term for the iteration.
[0107] like Figure 3 As shown in the figure, by comparing the network that applies local fitness adjustment during training with the network that does not apply adjustment, analyzing the decline curve of the loss function and the performance difference under the same number of training iterations, it can be seen that dynamic adjustment can make the convergence process of the loss function smoother.
[0108] S205. Convolutional Neural Network The increment of the weight is used as the optimization path, and the parameters are updated according to the calculated optimization path. At the same time, the weight parameters of the convolutional neural network are dynamically optimized in combination with the quality of the convolutional neural network weights, making the learning process of the convolutional neural network more efficient. For the dynamic changes and subtle differences that may exist in the image, the learning efficiency of the convolutional neural network and the accuracy of feature extraction are improved, which is expressed as:
[0109] ,
[0110] In the formula, For the The weights of the convolutional neural network at the iteration, For the The weights of the convolutional neural network at the iteration, The convolutional neural network The weight update amount for each iteration;
[0111] S206. Evaluate the performance of the convolutional neural network using a loss function, where the loss function is a cross entropy loss function. The cross entropy loss function is calculated based on the labels of the data. The labels of the data are classified by a preset Softmax function on the output image feature vector of the convolutional neural network.
[0112] The loss function is constrained during the training process of the convolutional neural network, which can ensure that the network can effectively distinguish the categories of image features. At the same time, the loss value of the loss function is used as the performance evaluation result, and the mechanism of dynamically adjusting the weight influence ratio and learning rate can enable the network to more accurately optimize the image feature extraction performance in the later stage of training;
[0113] According to the results of the performance evaluation, the coefficients of the affected weight ratio and the learning rate of the convolutional neural network are adjusted to achieve more accurate performance improvement in subsequent iterations to adapt to the real-time changes in network performance, which is expressed as:
[0114] ,
[0115] In the formula, For the The coefficient of the affected proportion of the adjustment weight of the iteration, For the The coefficient of the affected proportion of the adjustment weight of the iteration; is the learning rate adjustment coefficient, set to 0.1; is the loss function of the convolutional neural network, For the The weights of the convolutional neural network at the iteration, For the The learning rate of the convolutional neural network for each iteration; The learning rate adjustment strength is set to 0.5; The convolutional neural network The weight update amount for each iteration;
[0116] S207. Repeat iterations S202 to S206 until a preset stop iteration condition is met, indicating that the model training is completed. The preset stop iteration condition is reaching a preset maximum number of iterations, and the preset maximum number of iterations is set to 1000 times.
[0117] S3. The data processing module inputs the plurality of feature-extracted images into the classification model of the data analysis module, and trains the classification model using an extreme learning machine algorithm based on multi-dimensional fusion to obtain a trained classification model;
[0118] The extreme learning machine algorithm based on multi-dimensional fusion performs multi-dimensional fusion of the hidden layer output and dynamically adjusts the weight of each feature in the classification decision (i.e., dynamic weighting). The feature outputs of different hidden layers are weighted and summed according to their importance and sensitivity to the current sample. In the classification stage, nonlinear transformation is used to improve the accuracy of the decision, so as to enhance the classification model's processing ability for images with feature extraction, especially when faced with data with large differences in feature distribution between facial images and tongue coating images. It helps to balance the importance of global and local features, enhance the adaptability of the extreme learning machine model to complex feature distribution, and thus improve classification accuracy.
[0119] The classification model trained by the extreme learning machine algorithm based on multi-dimensional fusion in S3 includes:
[0120] S301. Initializing the weights and biases of the extreme learning machine; Initializing the weights and biases of the extreme learning machine includes:
[0121] Initialize the bias of the extreme learning machine to 0. Consider the feature distribution of the image after feature extraction to reduce the difficulty of convergence in the early stage of training and improve the stability of the model. Use a normal distribution with a mean of zero and related to the feature covariance matrix to achieve efficient initialization to accelerate training and reduce the risk of overfitting. The weight initialization method of the extreme learning machine is:
[0122] ,
[0123] In the formula, is the initial weight matrix between the input layer and the hidden layer of the extreme learning machine, is a normal distribution, It means the mean is 0 and the variance is The normal distribution of It is the normalized form of the feature covariance matrix of the image after feature extraction input into the extreme learning machine; is the weight adjustment factor used to control the value range of the weight during initialization, set to 0.1;
[0124] S302. The input feature-extracted image is sent to the hidden layer of the model and is mapped to a high dimension through a nonlinear activation function. Each input feature is connected to the corresponding hidden layer node to obtain a feature transformation result, retaining more nonlinear information in the feature-extracted image to enhance the classification effect. The feature-extracted image is mapped to a high-dimensional space through a nonlinear activation function in the hidden layer, retaining more nonlinear information, enhancing the extreme learning machine model's perception of complex sample characteristics, and improving the model's robustness to the input feature-extracted image through regularization constraints, thereby improving the classification effect and generalization ability. The calculation method is expressed as:
[0125] ,
[0126] In the formula, is the nonlinear mapping function of the hidden layer, is the initial weight matrix between the input layer and the hidden layer of the extreme learning machine, is the image extracted from the features of the input extreme learning machine, is the bias between the input layer and the hidden layer of the extreme learning machine, is the regularization coefficient used to adjust the nonlinear complexity of the input feature map, Set to 0.01; is the L2 norm, which constrains the input feature length to improve the stability of the weight update process; is the Sigmoid activation function;
[0127] S303. During training iterations, the training speed and stability of the model are dynamically optimized through an adaptive learning rate adjustment mechanism. The learning rate is controlled by comprehensively considering the current gradient size and gradient direction changes, so that the model reduces the learning rate when the error is large to avoid violent fluctuations, and increases the learning rate when the error is small to accelerate convergence. For complex data distribution, the gradient size and direction changes are comprehensively considered for adjustment, which not only ensures the high efficiency of training, but also improves the classification accuracy of the extreme learning machine model for the image after feature extraction, especially the sensitivity processing of abnormal samples. The calculation method is expressed as:
[0128] ,
[0129] In the formula, For extreme learning machine The learning rate at the iteration, For extreme learning machine The learning rate at the iteration, It is a dynamic gradient direction coefficient used to correct the learning rate adjustment caused by the sharp change of gradient direction. Set to 0.1; For the The L2 norm of the gradient at iteration , For the The L2 norm of the gradient at iteration , is the attenuation factor used to control the learning rate decay speed when the gradient scale is large, Set to 0.95;
[0130] S304. In each round of training of the extreme learning machine, the weights and biases are dynamically optimized. Not only are the parameters updated according to the standard back-propagation gradient, but also the error size of the extreme learning machine and the influence of the regular term are combined to make the area with large errors obtain more updated weights, thereby improving the recognition ability of complex samples. In the case of distribution diversity and subtle differences in the features of the image, the applicability and classification effect of the extreme learning machine model are improved, which is expressed as:
[0131] ,
[0132] In the formula, For extreme learning machine The weight matrix between the input layer and the hidden layer at the iteration, For extreme learning machine The weight matrix between the input layer and the hidden layer at the iteration, For extreme learning machine The learning rate at the iteration; is the symbol of partial derivative; is the loss function of the extreme learning machine, which is calculated using cross entropy loss; is the weight matrix between the input layer and the hidden layer of the extreme learning machine; is the regularization factor of the extreme learning machine, Set to 0.5; is the first adjustment coefficient of the extreme learning machine, Set to 0.1; For extreme learning machine The loss function at the iteration; For extreme learning machine The bias between the input layer and the hidden layer at the iteration, For extreme learning machine The bias between the input layer and the hidden layer at the iteration, is the bias between the input layer and the hidden layer of the extreme learning machine; is the second adjustment coefficient of the extreme learning machine, Set to 0.1;
[0133] S305. In order to enhance the model's ability to process images after multi-dimensional feature extraction, the extreme learning machine performs multi-dimensional fusion of the hidden layer output and dynamically adjusts the weight of each feature in the classification decision. The feature outputs of different hidden layers are weighted and summed according to their importance and sensitivity to the current sample, and the accuracy of the decision is improved through nonlinear transformation in the classification stage. For data with large differences in feature distribution of images, it helps to balance the importance of global and local features, and can enhance the adaptability of the extreme learning machine model to complex feature distribution, thereby improving the classification accuracy, which is expressed as:
[0134] ,
[0135] In the formula, is the fused feature vector output by the hidden layer of the extreme learning machine, is the number of neurons in the hidden layer of the extreme learning machine, is the hidden layer front of the extreme learning machine The fusion weight of neurons represents the hidden layer of the extreme learning machine The importance of the output of each neuron in the final fusion; The image sample after feature extraction is placed before the hidden layer of the extreme learning machine. The output produced by each neuron; is the fusion correction coefficient used for additional weighting according to the feature contribution, Set to 0.2; The image sample after feature extraction is placed before the hidden layer of the extreme learning machine. The normalized form of the output feature covariance matrix produced by neurons;
[0136] The fused feature vector is passed through the output layer of the extreme learning machine for final decision making. Through appropriate nonlinear adjustment and high-dimensional feature contribution control, the model can better capture subtle differences under diverse feature distributions and improve recognition accuracy, which can be expressed as:
[0137] ,
[0138] In the formula, The final prediction result of the extreme learning machine is consistent with the labeled categories of the training data. The label corresponding to each image is, such as "recommended to drink red wolfberry tea" and "recommended to drink jasmine tea"; is a nonlinear activation function, is the output layer weight of the extreme learning machine, is the fused feature vector output by the hidden layer of the extreme learning machine, is the output layer bias of the extreme learning machine.
[0139] The nonlinear decision function calculates the norm of the fused feature vector output by the hidden layer of the extreme learning machine, so that the extreme learning machine can have a higher recognition ability under the image distribution after complex feature extraction, which is expressed as:
[0140] ,
[0141] In the formula, is a nonlinear activation function, is the output layer weight of the extreme learning machine, The fused feature vector output by the hidden layer of the extreme learning machine, is the output layer bias of the extreme learning machine; It is the influencing parameter of the fusion feature vector, which is used to appropriately adjust the contribution of high-dimensional complex features. Set to 0.5; is the coefficient that controls the strength of the nonlinearity, Set to 0.2;
[0142] S306. Repeat iterations S302 to S305 until a preset stop iteration condition is met, indicating that the model training is completed. The preset stop iteration condition is reaching a preset maximum number of iterations, which is set to 1000 times.
[0143] S4. The new image is collected and stored by the data collection and storage module, and the new image is input into the trained feature extraction model of the data processing module for feature extraction to obtain a new image after feature extraction. The data processing module inputs the new image after feature extraction into the trained classification model of the data analysis module for classification to obtain a label of the new image;
[0144] The present invention also provides a facial and tongue coating recognition and tea recommendation system based on artificial intelligence, which uses the facial and tongue coating recognition and tea recommendation method based on artificial intelligence, including:
[0145] Data collection and storage module, used for collecting and storing data;
[0146] A data processing module is used to extract features from input data;
[0147] A data analysis module is used to classify the input data and obtain labels corresponding to the input data;
[0148] A control module, used to obtain specific operation instructions according to the labels output by the data analysis module and send the operation instructions to the execution module;
[0149] The execution module is used to receive operation instructions and execute the operation instructions.
[0150] The execution modules include:
[0151] The tea beverage recipe management unit is used for recipe configuration and storage as well as dynamic adjustment and optimization. Recipe configuration and storage means that users can configure tea beverage raw material parameters (such as raw material name, storage location, weight) through the management interface and automatically store the recipe and associate user tags to facilitate subsequent query and production. Dynamic adjustment and optimization means providing parameter adjustment function to optimize raw material ratio and production parameters according to user needs.
[0152] The precision metering unit is used for weighing, unloading and automatic feeding; weighing and unloading refer to configuring the high-precision HX711 weighing module to achieve microgram-level raw material metering and using a stepper motor to control the movement of the raw material bin to ensure accurate unloading; automatic feeding refers to regulating the DC motor and servo according to the recipe parameters to complete the automatic feeding of raw materials and ensure the consistency and stability of the ingredients.
[0153] The extraction production unit is used for precise heating and extraction, as well as automatic cleaning and drainage. Precision heating and extraction refers to the precise control of water temperature (such as 45°C) with the help of heating wires and temperature sensors (such as NTC_3950). In particular, the extraction process will also fully extract the essence of the raw materials through a heating-standing cycle to retain the flavor and nutrition of the tea. Automatic cleaning and drainage means that the cleaning module combines high-temperature water flow, air flow and suction cycles during the cleaning process to ensure the hygiene of the equipment; the drainage module removes residual liquid through solenoid valves and drainage pumps to prepare for the next use. The combination of the precise metering unit and the extraction production unit can solve the problem of low automation in the tea production process.
[0154] The control and interaction unit is used for user input and feedback, and performs automated control. User input and feedback refers to users placing orders through the touch screen or mobile device client, and receiving device status, recommendation results and production progress in real time; automated control refers to the controller integrating the final tea recipe and adjusting the production process in real time, including water supply, heating, liquid extraction, drainage and other links.
Claims
1. The facial and tongue coating recognition and tea recommendation method based on artificial intelligence is characterized by: include: S1. Obtain multiple images, manually identify the multiple images and label each of the images to obtain multiple labeled images; The images include a plurality of facial images and a plurality of tongue coating images; The labels include recommending drinking red wolfberry tea, recommending drinking jasmine tea, recommending drinking eucommia tea, recommending drinking sterculia lychnophora tea, and recommending drinking rose tea; S2. Inputting the plurality of annotated images into a feature extraction model, training the feature extraction model using a convolutional neural network algorithm based on dynamic parameter optimization, and obtaining a plurality of feature-extracted images and a trained feature extraction model; The convolutional neural network algorithm based on dynamic parameter optimization adopts a dynamic parameter optimization strategy for parameter optimization. The dynamic parameter optimization strategy is to consider that weights with larger absolute values will have an impact on other parts of the network when optimizing parameters. Therefore, the hierarchical distance and quality difference of the parameters are dynamically adjusted by introducing a dynamic adjustment function to establish a collaborative optimization mechanism between the parameters. S3. Inputting the plurality of feature-extracted images into a classification model, and training the classification model using an extreme learning machine algorithm based on multi-dimensional fusion to obtain a trained classification model; The extreme learning machine algorithm based on multi-dimensional fusion is to perform multi-dimensional fusion on the hidden layer output and dynamically adjust the weight of each feature in the classification decision, perform weighted summation on the feature outputs of different hidden layers according to their importance and sensitivity to the current sample, and improve the accuracy of decision-making through nonlinear transformation in the classification stage; S4. Capture a new image, input the new image into the trained feature extraction model for feature extraction, obtain a new image after feature extraction, input the new image after feature extraction into the trained classification model for classification, and obtain a label for the new image.
2. The method for facial and tongue coating recognition and tea recommendation based on artificial intelligence according to claim 1, characterized in that: The pixel width of the image is greater than or equal to 3000px, and the height is greater than or equal to 2000px.
3. The method for facial and tongue coating recognition and tea recommendation based on artificial intelligence according to any one of claims 1 to 2, characterized in that: The method of using a convolutional neural network algorithm based on dynamic parameter optimization to train the feature extraction model in S2 includes: S201. Initialize the parameters of the convolutional neural network; S202. Calculate the quality of convolutional neural network parameters; S203. According to the quality of each parameter of the convolutional neural network, their influence on other parameters is calculated. The influence between parameters is calculated by a dynamically adjusted function. Considering the relative position and quality difference between the parameters of the convolutional neural network, the hierarchical distance and quality difference of the parameters are introduced by the dynamic adjustment function. The calculation formula is: , In the formula, For the convolutional neural network parameters and The mutual influence between the parameters For the The convolutional neural network of the first iteration The quality of the weights, For the The convolutional neural network of the first iteration The quality of the weights, For the parameters and The layer distance of parameters in convolutional neural networks, is a small constant used to prevent the denominator from being zero; S204. Based on the current gradient, the influence between parameters and the local fitness adjustment item, an optimization path is generated for each parameter. The calculation formula of the local fitness adjustment item is: , In the formula, For the The local fitness adjustment term of the iteration, is the local fitness adjustment coefficient, For the The convolutional neural network of the first iteration The quality of the weights, For the The convolutional neural network of the first iteration weights, For the The convolutional neural network of the first iteration The increment of weight; S205. Convolutional Neural Network The increment of weights is used as the optimization path, and the parameters are updated according to the calculated optimization path. At the same time, the weight parameters of the convolutional neural network are dynamically optimized in combination with the quality of the convolutional neural network weights. For the dynamic changes and subtle differences in the image, the learning efficiency of the convolutional neural network and the accuracy of feature extraction are improved, which is expressed as: , In the formula, For the The weights of the convolutional neural network at the iteration, For the The weights of the convolutional neural network at the iteration, The convolutional neural network The weight update amount for each iteration; S206. Evaluate the performance of the convolutional neural network using a loss function, wherein the loss function is a cross entropy loss function, and the cross entropy loss function is calculated based on the labels of the data, and the labels of the data are classified by a preset Softmax function on the output image feature vector of the convolutional neural network; S207. Repeat iterations S202 to S206 until a preset stop iteration condition is met.
4. The method for facial and tongue coating recognition and tea recommendation based on artificial intelligence according to claim 3, characterized in that: Initializing the parameters of the convolutional neural network in S201 includes initializing the weights and biases of the convolutional neural network. The initialization method is expressed as: , In the formula, is the initial weight of the convolutional neural network, To obey a specific distribution, is a normal distribution, is the initialization variance of the convolutional neural network weights, is the initial bias of the convolutional neural network, is the initialization variance of the convolutional neural network bias.
5. The method for facial and tongue coating recognition and tea recommendation based on artificial intelligence according to claim 3, characterized in that: The calculation formula for calculating the quality of the convolutional neural network parameters in S202 is: , In the formula, For the The quality of the convolutional neural network weights at iterations, For the The weights of the convolutional neural network at iteration .
6. The method for facial and tongue coating recognition and tea recommendation based on artificial intelligence according to any one of claims 1 to 2, characterized in that: The step of training the classification model using an extreme learning machine algorithm based on multi-dimensional fusion in S3 includes: S301. Initialize the weights and biases of the extreme learning machine; S302. The input feature-extracted image is sent to the hidden layer of the model and is mapped to a high dimension through a nonlinear activation function. Each input feature is connected to the corresponding hidden layer node to obtain a feature transformation result, retaining more nonlinear information in the feature-extracted image to enhance the classification effect. The feature-extracted image is mapped to a high-dimensional space through a nonlinear activation function in the hidden layer, retaining more nonlinear information, enhancing the extreme learning machine model's perception of complex sample characteristics, and improving the model's robustness to the input feature-extracted image through regularization constraints, thereby improving the classification effect and generalization ability. The calculation method is expressed as: , In the formula, is the nonlinear mapping function of the hidden layer, is the initial weight matrix between the input layer and the hidden layer of the extreme learning machine, is the image extracted from the features of the input extreme learning machine, is the bias between the input layer and the hidden layer of the extreme learning machine, is the regularization coefficient; is the L2 norm, which constrains the input feature length to improve the stability of the weight update process; is the Sigmoid activation function; S303. During the training iteration, the training speed and stability of the model are dynamically optimized through the adaptive learning rate adjustment mechanism. The learning rate is controlled by comprehensively considering the current gradient size and gradient direction changes, so that the model reduces the learning rate when the error is large to avoid violent fluctuations, and increases the learning rate when the error is small to accelerate convergence. For complex data distribution, the gradient size and direction changes are comprehensively considered for adjustment, which not only ensures the high efficiency of training, but also improves the classification accuracy of the extreme learning machine model for the image after feature extraction and the sensitivity processing of abnormal samples. The calculation method is expressed as: , In the formula, For extreme learning machine The learning rate at the iteration, For extreme learning machine The learning rate at the iteration, is the dynamic gradient direction coefficient, For the The L2 norm of the gradient at iteration , For the The L2 norm of the gradient at iteration , is the attenuation factor; S304. In each round of training of the extreme learning machine, the weights and biases are dynamically optimized. Not only are the parameters updated according to the standard back-propagation gradient, but also the error size of the extreme learning machine and the influence of the regular term are combined to make the area with large errors obtain more updated weights, thereby improving the recognition ability of complex samples. In the case of distribution diversity and subtle differences in the features of the image, the applicability and classification effect of the extreme learning machine model are improved, which is expressed as: , In the formula, For extreme learning machine The weight matrix between the input layer and the hidden layer at the iteration, For extreme learning machine The weight matrix between the input layer and the hidden layer at the iteration, For extreme learning machine The learning rate at the iteration; is the symbol of partial derivative, is the loss function of the extreme learning machine, is the weight matrix between the input layer and the hidden layer of the extreme learning machine, is the regularization factor of the extreme learning machine, is the first adjustment coefficient of the extreme learning machine, For extreme learning machine The loss function at the iteration is: For extreme learning machine The bias between the input layer and the hidden layer at the iteration, For extreme learning machine The bias between the input layer and the hidden layer at the iteration, is the bias between the input layer and the hidden layer of the extreme learning machine, is the second adjustment coefficient of the extreme learning machine; S305. In order to enhance the model's ability to process images after multi-dimensional feature extraction, the extreme learning machine performs multi-dimensional fusion of the hidden layer output and dynamically adjusts the weight of each feature in the classification decision. The feature outputs of different hidden layers are weighted and summed according to their importance and sensitivity to the current sample, and the accuracy of the decision is improved through nonlinear transformation in the classification stage. For data with large differences in feature distribution of images, it helps to balance the importance of global and local features, and can enhance the adaptability of the extreme learning machine model to complex feature distribution, thereby improving the classification accuracy, which is expressed as: , In the formula, is the fused feature vector output by the hidden layer of the extreme learning machine, is the number of neurons in the hidden layer of the extreme learning machine, is the hidden layer front of the extreme learning machine The fusion weight of neurons, The image sample after feature extraction is placed before the hidden layer of the extreme learning machine. The output produced by a neuron is is the fusion correction coefficient used for additional weighting according to the feature contribution, The image sample after feature extraction is placed before the hidden layer of the extreme learning machine. The normalized form of the output feature covariance matrix produced by neurons; S306. Repeat iterations S302 to S305 until a preset stop iteration condition is met.
7. The method for facial and tongue coating recognition and tea recommendation based on artificial intelligence according to claim 6, characterized in that: Initializing the weights and biases of the extreme learning machine in S301 includes: Initializing the bias of the extreme learning machine to 0; The weight initialization method of the extreme learning machine is: , In the formula, is the initial weight matrix between the input layer and the hidden layer of the extreme learning machine, is a normal distribution, It means the mean is 0 and the variance is The normal distribution of is the normalized form of the feature covariance matrix of the image after feature extraction of the input extreme learning machine, A weight adjustment factor used to control the value range of the weight during initialization.
8. The facial and tongue recognition and tea recommendation system based on artificial intelligence is characterized by: The method for face and tongue coating recognition and tea recommendation based on artificial intelligence according to any one of claims 1 to 7 is applied, comprising: Data collection and storage module, used for collecting and storing data; A data processing module is used to extract features from input data; A data analysis module is used to classify the input data and obtain labels corresponding to the input data; A control module, used for obtaining specific operation instructions according to the labels output by the data analysis module and sending the operation instructions to the execution module; The execution module is used to receive the operation instruction and execute the operation instruction.
Citation Information
Patent Citations
Multi-spectral TCM tongue image information analysis device and method
CN118697293B
System and method to reduce weight storage bits for deep-learning network
CN108288087A
Deep convolutional neural network-based CT image processing method and processing device, and electronic equipment
CN114862766A