Disclosure of Invention
The invention aims to provide a method for nondestructively and rapidly detecting food quality, which can be applied to mass data while improving classification precision, can realize rapid detection of food quality under the condition of not damaging food, has a good effect particularly on identification of grains and vegetables, improves detection efficiency, ensures food safety and solves the problems in the background technology.
In order to achieve the purpose, the invention provides the following technical scheme:
a method for nondestructively and rapidly detecting food quality comprises the following steps:
s1: obtaining food units with uniform texture and no obstruction superposition, and obtaining data to be processed;
s2: performing data preprocessing on the data to be processed obtained in the step S1 to obtain processed data;
s3: and identifying the data after the characteristic processing of the food units through a nonlinear support vector machine decision tree model, training the nonlinear support vector machine decision tree model through a correction data set, updating and training the nonlinear support vector machine decision tree model through a prediction data set to obtain a model capable of classifying the food quality, and inputting the characteristic data of the detected new food units detected by a detection method into the model, thereby completing the quality detection of the food units.
As a still further scheme of the invention: in S3, the nonlinear support vector machine decision tree model can be trained and updated through a distributed training method.
As a still further scheme of the invention: the new detection method of the food units in the S3 comprises an infrared spectroscopy method, a resistance method, a microwave detection method and commercial wifi signal collection, namely, the water content in the food units is detected through the infrared spectroscopy method, the electric conductivity in the food units is detected through the resistance method, the microwave detection signals in the food units are detected through the microwave detection method, and the CSI data in the food units are collected through the commercial wifi signal collection.
As a still further scheme of the invention: the microwave used in the microwave detection method is 9-10 GHz.
As a still further scheme of the invention: the data preprocessing in S2 is data cleaning, which includes noise smoothing, outlier culling, missing value padding, and outlier interpolation.
As a still further scheme of the invention: the model for classifying food quality in S3 is divided into cereal food units with low water content and cereal food units with normal water content according to the characteristics of the cereal detection food units, the cereal food units with low water content are named as one type, the water content of one type is 12.8% -14%, the cereal food units with normal water content are named as two types, and the water content of the two types is more than 14%.
As a still further scheme of the invention: the food quality classification model in the S3 is divided into A type, B type and C type according to the characteristics of the water content food units, wherein the A type is the food unit with normal water content, the B type is the food unit with water content exceeding the water content of the normal food unit, and the C type is the food unit with water content less than the water content of the normal food unit.
As a still further scheme of the invention: the food quality classification model in the S3 includes constructing a plurality of nonlinear support vector machine models and a decision tree, starting from a root node of the decision tree, from top to bottom, respectively adopting one nonlinear support vector machine model as a classifier at each node of the decision tree, dividing the training data set into two classes layer by layer, and obtaining a final classification result, wherein the classification result is used for representing the quality of the food units to be tested.
Compared with the prior art, the invention has the beneficial effects that:
1. the nonlinear support vector machine decision tree model can realize classification of three categories of food unit quality (normal moisture content food units, moldy cereal food units or water-injected vegetable food or water-injected meat, food units with low moisture and dry food units, which are obtained by dividing the food units with more than normal moisture content into two categories through a first classifier, obtaining acategory 1 and acategory 2, obtaining a category 3 and a category 4 by dividing the food units with less moisture through a second classifier, and sequentially performing category division;
the method comprises the steps of obtaining food units with uniform texture and no obstruction superposition, detecting each food unit by using an infrared spectroscopy method, a resistance method, a microwave detection method and a commercial wifi signal respectively, and obtaining data to be processed; performing data preprocessing on the food data to be processed to obtain processed data, and identifying the characteristics of the food units through a nonlinear support vector machine decision tree model; after training, obtaining a model capable of classifying the food quality; the quality level of the new food units can be predicted by the model, a stronger final classifier is formed by integrating the model, the practicability is high, and the method can be applied to mass data while the classification precision is improved.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example 1
Referring to fig. 1-2, in an embodiment of the present invention, a method for nondestructive fast detection of food quality includes the following steps:
s1: obtaining food units with uniform texture and no obstruction superposition, and obtaining data to be processed;
s2: performing data preprocessing on the data to be processed obtained in the step S1 to obtain processed data;
s3: recognizing the data after the characteristic processing of the food units through a nonlinear support vector machine decision tree model, training the nonlinear support vector machine decision tree model through a correction data set, updating and training the nonlinear support vector machine decision tree model through a prediction data set to obtain a model capable of classifying the food quality, and inputting the characteristic data of the detected new food units detected by a detection method into the model so as to finish the quality detection of the food units;
the model for classifying the food quality is divided into a cereal food unit with low water content and a cereal food unit with normal water content according to the characteristics of the cereal food detection unit, the cereal food unit with low water content is named as a first type, the water content of the first type is 12.8% -14%, the cereal food unit with normal water content is named as a second type, the water content of the second type is more than 14%, and the first-type node classification is carried out.
In the step S3, the nonlinear support vector machine decision tree model can be trained and updated by a distributed training method, so as to store and update data in the nonlinear support vector machine decision tree model, thereby effectively ensuring timeliness of later-stage classification comparison, storage and quality detection.
The novel detection method of the food units in the S3 comprises an infrared spectroscopy method, a resistance method, a microwave detection method and commercial wifi signal collection, namely, the water content in the food units is detected through the infrared spectroscopy method, the electric conductivity in the food units is detected through the resistance method, microwave detection signals in the food units are detected through the microwave detection method, CSI data in the food units are collected through the commercial wifi signal collection, detection of each food unit is achieved, data to be processed are obtained, data preprocessing is conducted on the food data to be processed, processed data are obtained, the processed data are guided into a decision tree model of a nonlinear support vector machine to identify the characteristics of the food units, and quality detection of the food units is completed.
The microwave used in the microwave detection method is 9-10 GHz.
The data preprocessing in the S2 is data cleaning which comprises noise smoothing, abnormal value elimination, missing value filling and abnormal value interpolation, the obtained data precision is more accurate through normalization processing, the food unit characteristics are identified by a nonlinear support vector machine decision tree model, and the identification precision is improved.
The model for classifying food quality in S3 is divided into cereal food units with low water content and cereal food units with normal water content according to the characteristics of the cereal detection food units, the cereal food units with low water content are named as one type, the water content of one type is 12.8% -14%, the cereal food units with normal water content are named as two types, and the water content of the two types is more than 14%.
Example 2
Referring to fig. 1-2, in an embodiment of the present invention, a method for nondestructive fast detection of food quality includes the following steps:
s1: obtaining food units with uniform texture and no obstruction superposition, and obtaining data to be processed;
s2: performing data preprocessing on the data to be processed obtained in the step S1 to obtain processed data;
s3: recognizing the data after the characteristic processing of the food units through a nonlinear support vector machine decision tree model, training the nonlinear support vector machine decision tree model through a correction data set, updating and training the nonlinear support vector machine decision tree model through a prediction data set to obtain a model capable of classifying the food quality, and inputting the characteristic data of the detected new food units detected by a detection method into the model so as to finish the quality detection of the food units;
the model for classifying the food quality is divided into a cereal food unit with low water content and a cereal food unit with normal water content according to the characteristics of the cereal detection food unit, the cereal food unit with low water content is named as a first type, the water content of the first type is 12.8-14%, the cereal food unit with normal water content is named as a second type, and the water content of the second type is more than 14%;
the model that food quality carries out classification is divided into A type, B type and C type according to the characteristic of water content food unit, A type is the normal food unit of moisture, B type is the food unit that moisture surpassed normal food unit water content, C type is the food unit that moisture is less than normal food unit water content, carries out dual root node classification.
In the step S3, the nonlinear support vector machine decision tree model can be trained and updated by a distributed training method, so as to store and update data in the nonlinear support vector machine decision tree model, thereby effectively ensuring timeliness of later-stage classification comparison, storage and quality detection.
The novel detection method of the food units in the S3 comprises an infrared spectroscopy method, a resistance method, a microwave detection method and commercial wifi signal collection, namely, the water content in the food units is detected through the infrared spectroscopy method, the electric conductivity in the food units is detected through the resistance method, microwave detection signals in the food units are detected through the microwave detection method, CSI data in the food units are collected through the commercial wifi signal collection, detection of each food unit is achieved, data to be processed are obtained, data preprocessing is conducted on the food data to be processed, processed data are obtained, the processed data are guided into a decision tree model of a nonlinear support vector machine to identify the characteristics of the food units, and quality detection of the food units is completed.
The microwave used in the microwave detection method is 9-10 GHz.
The data preprocessing in the S2 is data cleaning which comprises noise smoothing, abnormal value elimination, missing value filling and abnormal value interpolation, the obtained data precision is more accurate through normalization processing, the food unit characteristics are identified by a nonlinear support vector machine decision tree model, and the identification precision is improved.
The food quality classification model in the S3 includes constructing a plurality of nonlinear support vector machine models and a decision tree, starting from a root node of the decision tree, from top to bottom, respectively adopting one nonlinear support vector machine model as a classifier at each node of the decision tree, dividing the training data set into two classes layer by layer, and obtaining a final classification result, wherein the classification result is used for representing the quality of the food units to be tested.
In summary, the combination of the support vector machine and the binary tree of the invention trains the classifiers after dividing the training data set into two classes layer by layer, and classifies unknown samples by a tree structure combination strategy, so that individual basic classifiers can be trained for different training sets, and then integrated to form a stronger final classifier.
Although the present invention has been described in detail with reference to the foregoing embodiments, it will be apparent to those skilled in the art that various changes in the embodiments and/or modifications of the invention can be made, and equivalents and modifications of some features of the invention can be made without departing from the spirit and scope of the invention.
While one embodiment of the present invention has been described in detail, the description is only a preferred embodiment of the present invention and should not be taken as limiting the scope of the invention. All equivalent changes and modifications made within the scope of the present invention shall fall within the scope of the present invention.