Method and system for detecting quality of silage corn feed
By adopting the adaptive information fusion method of olfactory visualization and visible near -infrared spectrum in silage corn feed detection, to extract and integrate the characteristics, build a stacked prediction model, solve the problem of low accuracy in the existing technologies, and unable to fail to detect. The accuracy and non -destructive detection of silage corn feed quality is achieved.
Patent Information
- Application Number
- CN202411477788.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-01-24
AI Technical Summary
The prior art has low detection accuracy in the quality testing of silage corn feed and cannot achieve non-destructive testing.
A detection method based on adaptive information fusion of olfactory visualization and visible near-infrared spectrum is adopted. By constructing a silage sample data set, preprocessing the data, using the slime mold algorithm and support vector machine to extract features, and performing feature fusion, a stacked prediction model is constructed to conduct quality assessment. detection.
The accuracy and non -destructive detection of silage corn feed quality can be comprehensively and sophisticated to comprehensively and finely signs the quality characteristics of the landscape officials and improve the detection effect.
Smart Images

Figure CN119360107A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of nondestructive detection of silage corn feed quality, and in particular, relates to a silage corn feed quality detection method and system. Background Art
[0002] Corn silage is one of the most commonly used roughage sources for ruminants worldwide. High-quality silage can provide livestock with optimal nutrition while reducing the input of concentrated feed. Poor-quality silage is nutritionally deficient and may endanger livestock health. The evaluation of silage quality can not only guide the scientific configuration of the diet, but also ensure the safety of livestock feeding. There are many quality indicators of silage, including pH value, quality grade, fatty acids and ammonia nitrogen. The laboratory determination methods of the above quality indicators are cumbersome, time-consuming and costly, and are not suitable for batch testing. Non-destructive testing methods have become an effective means for batch testing of agricultural product quality. It is an inevitable development trend to use this method to quickly and scientifically evaluate the quality of silage. Therefore, there is an urgent need for non-destructive testing of silage quality.
[0003] At present, non-destructive detection methods for silage quality include hyperspectral imaging (HSI), visible-near infrared spectroscopy (VIS-NIRS) and machine vision (MV). Visible-near infrared spectrometers can obtain key compound information that characterizes silage quality. Machine vision can extract information related to the color and texture of silage surface. HSI not only contains key compound information, but also provides color and texture information because it integrates the spectrum and image information of silage. However, the limitations of the above technologies are as follows: their penetration is too weak to perceive the deep information of silage; the sensory quality characteristics of silage include structure, color and smell. Existing methods cannot fully and finely obtain silage quality information, especially ignoring the smell information of silage. A method for comprehensively and finely characterizing the sensory quality characteristics of silage and then accurately detecting silage quality has not yet been seen; its detection effect on different quality indicators is uneven. Colorimetric sensor arrays (CSA) induce color changes by chemical reactions with volatile compounds. Intelligent algorithms can sense and quantify this color change. This can achieve accurate detection of the odor characteristics of food and agricultural products. Therefore, it is necessary to integrate CSA and VIS-NIRS information to comprehensively and finely obtain information related to silage quality and realize accurate and nondestructive detection of multiple quality indicators.
[0004] In terms of information dimension, the dimension of VIS-NIRS greatly exceeds that of CSA data. VIS-NIRS usually contains hundreds or thousands of dimensions. Conventional CSA is limited to dozens of dimensions, namely 9N dimensions, where "9" corresponds to the R, G, and B color components of the RGB space; the H, S, and V components of the HSV space; the L, a, and b components of the Lab space, and "N" represents the number of color-sensitive points. This dimensional imbalance may cause the CSA information to be partially obscured by the VIS-NIRS information. In addition, the composition of volatile compounds in silage of different qualities is complex. The limited dimensionality of CSA response information may not fully reflect the quality of silage. Therefore, it is necessary to expand the CSA color component to improve the effect of non-destructive detection of silage quality based on the fusion of VIS-NIRS and CSA information.
[0005] There are obvious differences in smell and color as well as other internal and external characteristics in silage of different qualities. To accurately detect silage quality, it is necessary to adopt a data fusion strategy to fully capture these changes. Data-level and feature-level data fusion are widely used in agricultural product quality detection. However, these two strategies have relatively limited improvements in the generalization and robustness of the prediction model. Decision-level data fusion integrates the prediction results of a single technology, which can greatly improve the prediction performance. Stacking-decision-level data fusion is a typical decision-level data fusion method. It first builds a basic model based on each information source, then uses the prediction results of these basic models to build a meta-model, and uses the prediction results of the meta-model as the final prediction result. In stacking-decision-level data fusion, configuring the basic learner and meta-learner corresponding to each information source is crucial to performance. At present, learners rely heavily on manual selection. However, this method is too cumbersome and ignores the performance improvement brought by stacking learners of different types and performances. Therefore, it is not suitable for non-destructive detection of multiple quality indicators of silage. Intelligent algorithms that adaptively fuse sensor information based on quality indicators, i.e., feed characteristics, have not yet been seen.
[0006] Therefore, the prior art urgently needs a silage corn feed quality detection method and system to solve the problems of low detection accuracy and inability to perform non-destructive detection in the prior art. Summary of the invention
[0007] The technical problem to be solved by the present invention is to provide a method and system for detecting the quality of silage corn feed in view of the shortcomings of the above technical solutions, so as to solve the problems of low detection accuracy and inability to perform non-destructive detection in the prior art.
[0008] In order to achieve the above object, according to one aspect of the present invention, a method for detecting the quality of silage corn feed is provided, comprising:
[0009] S1: Silage sample collection system collects silage data;
[0010] S2: constructing a silage sample data set according to the silage feed data;
[0011] S3: preprocessing the silage sample data set;
[0012] S4: extracting CSA features and VIS-NIRS features from the silage sample data set preprocessed by S3 using a slime mold algorithm and a support vector machine;
[0013] S5: performing feature fusion on the CSA feature and the VIS-NIRS feature to obtain a CSA-VIS-NIRS fusion feature;
[0014] S6: Construct a stacking prediction model for silage quality;
[0015] S7: Performing quality testing on the silage sample according to the silage quality stacking prediction model.
[0016] Preferably, the S1 is specifically:
[0017] S1.1: Preparation of olfactory visualization chip;
[0018] S1.2: using the olfactory visualization chip to collect the original CSA image and the CSA image after reaction of the silage;
[0019] S1.3: 108 new color components are constructed based on five color spaces to comprehensively and finely extract CSA response information. At the same time, CMY and YIQ spaces are used to construct CSA color components.
[0020] S1.4: performing an extraction operation on the original CSA image of the silage and the CSA image after the reaction to obtain the CSA response information of the silage;
[0021] S1.5: Collecting the VIS-NIRS spectrum information of the silage through the VIS-NIRS information system.
[0022] Preferably, in S2, the silage data and the pH value, quality grade, fatty acid and ammonia nitrogen quality indicators of the silage measured in the laboratory are used to construct a silage sample data set.
[0023] Preferably, in S2, the silage sample data set is divided into a training set and a prediction set using the Kennard-Stone method, and then the training set is divided into 5 folds using 5-fold cross validation, wherein any 4 folds are used as calibration sets and the remaining 1 fold is used as a validation set.
[0024] Preferably, in S3, the CSA response information is preprocessed using standard scaling, and the VIS-NIRS spectral information is preprocessed using maximum absolute scaling and normalization.
[0025] Preferably, S4 is specifically:
[0026] S4.1: Initialize slime mold algorithm parameters and population;
[0027] S4.2: Discretize the population into 0 and 1;
[0028] S4.3: Calculate the fitness of the population;
[0029] S4.4: Update the best fitness, best feature combination and population;
[0030] S4.5: Iterate S4.3-S4.4 until the maximum number of iterations T is reached, and output the optimal fitness and optimal feature combination.
[0031] Preferably, in S6, the silage quality stacking prediction model adopts a stacking integrated learning framework, uses a slime mold algorithm to configure basic learners corresponding to CSA features, VIS-NIRS features and CSA-VIS-NIRS fusion features, and a meta-learner to construct a stacking prediction model.
[0032] Preferably, the S6 is specifically:
[0033] S6.1: Build a metadata subset pool containing all feature and base learner combinations;
[0034] S6.2: Initialize slime mold algorithm parameters and population;
[0035] S6.3: Discretize the population;
[0036] S6.4: Calculate fitness value;
[0037] S6.5: Update the best fitness, best feature combination and population;
[0038] S6.6: Iterate S6.4-S6.5 until the maximum number of iterations T is reached, output the best fitness, best feature combination and population, and establish a silage quality stacking prediction model based on this.
[0039] Preferably, the silage quality stacking prediction model is used to predict the silage quality grade, including: pH value prediction, pH quality grade prediction and sensory quality grade prediction.
[0040] According to another aspect of the present invention, there is also a silage corn feed quality detection system, the system adopts the above-mentioned silage corn feed quality detection method, comprising:
[0041] Silage sample collection system, used to collect silage data;
[0042] A sample data set construction module, used to construct a silage sample data set according to the silage feed data;
[0043] A preprocessing module, used for preprocessing the silage sample data set;
[0044] A feature extraction module, used for extracting CSA features and VIS-NIRS features from the silage sample data set preprocessed by the preprocessing module using a slime mold algorithm and a support vector machine;
[0045] A feature fusion module, used to fuse the CSA feature and the VIS-NIRS feature to obtain a CSA-VIS-NIRS fusion feature;
[0046] Model building module, used to build a stacking prediction model for silage quality;
[0047] A feed detection module is used to perform quality detection on the silage sample according to the silage quality stacking prediction model.
[0048] According to another aspect of the present invention, a computer-readable storage medium is also included, on which a data processing program is stored, and the data processing program is executed by a processor to implement the above-mentioned method for detecting the quality of silage corn feed.
[0049] Based on the above technical solution, the present application provides a method and system for detecting the quality of silage corn feed, which has the following technical effects:
[0050] The present invention proposes a method and system for detecting the quality of corn silage based on olfactory visualization and adaptive information fusion of visible near infrared spectroscopy. The method comprises: constructing an information collection system, using the system to collect corn silage olfactory sensor (CSA) and visible near infrared spectroscopy (VIS-NIRS) information, constructing a silage sample data set, preprocessing the two sets of information, extracting CSA and VIS-NIRS features using a slime mold algorithm, obtaining CSA-VIS-NIRS features by feature-level data fusion, and given a stacking ensemble learning (stacking) framework, using a slime mold algorithm to configure the basic learners corresponding to CSA, VIS-NIRS features and CSA-VIS-NIRS fusion features, as well as a meta-learner, to construct a stacking prediction model. The method can adaptively fuse CSA and VIS-NIRS information according to the silage sample to be tested and its quality index characteristics, thereby realizing accurate and non-destructive detection of the quality of corn silage;
[0051] At the same time, the fusion of VIS-NIRS and CSA in the present invention is used for the first time for non-destructive detection of silage quality. The fusion method comprehensively and finely characterizes the sensory quality characteristics of silage, namely structure, color and smell; and for each color sensitive point of CSA, 108 color components in 5 color spaces are constructed, and CMY and YIQ spaces are used for the first time to construct CSA color components. The newly constructed components can fully characterize the CSA response and improve the anti-interference ability of the response information. In addition, the data dimension imbalance problem in the fusion of VIS-NIRS and CSA is improved;
[0052] In this invention, an intelligent and adaptive fusion method, namely SMA-stacking-decision-level datafusion, is proposed. Features and all learners can be efficiently and adaptively configured, and the effect of non-destructive detection of silage quality is greatly improved. This study provides theoretical basis and technical support for the rapid and scientific evaluation of silage quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The accompanying drawings constituting a part of this document are used to provide a further understanding of this document. The exemplary embodiments and descriptions of this document are used to explain this document and do not constitute an improper limitation on this document. In the accompanying drawings:
[0054] Figure 1 This is a schematic diagram of the overall structure of the CSA information collection system used in this embodiment;
[0055] Figure 2 for Figure 1 The internal structure diagram of the CSA information collection system is shown;
[0056] Figure 3 A flow chart of a method for detecting the quality of corn silage provided in an embodiment of the present application;
[0057] Figure 4 The effect diagram of CSA feature extraction provided in the embodiment of the present application;
[0058] Figure 5 The effect diagram of the silage pH prediction model constructed by the SMA-stacking-decision-level data fusion provided in the embodiment of the present application;
[0059] Fig. 6A and Figure 6B The effect diagram of the pH quality grade prediction model constructed for the SMA-stack-decision-level data fusion provided in the embodiment of the present application;
[0060] Fig. 7A and Figure 7B The SMA-stacking-decision-level data fusion provided in the embodiment of the present application constructs a rendering of a sensory quality grade prediction model. DETAILED DESCRIPTION
[0061] In order to make the purpose, technical solutions and advantages of the embodiments of this article clearer, the technical solutions in the embodiments of this article will be clearly and completely described below in conjunction with the drawings in the embodiments of this article. Obviously, the described embodiments are part of the embodiments of this article, not all of the embodiments. Based on the embodiments in this article, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this article. It should be noted that the embodiments in this article and the features in the embodiments can be combined with each other arbitrarily without conflict.
[0062] Unless the context clearly requires otherwise, throughout the specification and claims, the words "include", "comprising" and similar words should be interpreted in an inclusive sense rather than an exclusive or exhaustive sense; that is, in the sense of "including but not limited to".
[0063] Embodiment 1
[0064] like Figure 3 As shown, a method for detecting the quality of corn silage feed is used for silage feed detection, comprising the following steps:
[0065] S1: Silage sample collection system collects silage data;
[0066] Wherein, the silage sample collection system includes a CSA information collection system and a VIS-NIRS information collection system;
[0067] like Figure 1 As shown, the CSA information collection system includes an airtight reaction box, which includes a box body 1 and a box cover 2, wherein the left side of the box cover 2 is connected to the box body 1 through a hinge 5, and two sealing clips 4 for fixing the box cover 2 are arranged on the right side of the box body 1, and a handle 3 is arranged on the right side of the box cover 2. To ensure the airtightness of the airtight reaction box, a sealing ring 17 is arranged at the edge where the box body 1 contacts the box cover 2. Figure 2 As shown, the CSA information collection system also includes an iron frame arranged in the box 1, the lower part of the iron frame is a base 6, the upper part is a vertically installed column 7, and a silage sample placement box 16 for containing silage samples is placed on the base 6. Figure 2It can be seen that a mobile phone fixing fixture 8, a light source frame, and an olfactory visualization chip holder fixture 15 are arranged on the column 7 from top to bottom in sequence; wherein a smart phone 9 is installed on the mobile phone fixing fixture 8 (with the camera facing downward); the light source frame used includes a fixing frame 10 arranged horizontally in the left-right direction, two cantilevers 11 pointing to the box cover 2 are horizontally arranged at both ends of the fixing frame 10, and an LED light source 12 is installed below the cantilever 11; an olfactory visualization chip holder 13 is placed on the olfactory visualization chip holder fixture 15, and the olfactory visualization chip holder 13 is located directly above the silage sample placement box 16 and contains an olfactory visualization chip 14, the aforementioned LED light source 12 is used to illuminate the olfactory visualization chip 14 below from the left and right sides, and the smart phone 9 is used to collect the reaction image of the olfactory visualization chip 14 in real time.
[0068] In this embodiment, the reaction images of the olfactory visualization chip are collected in real time by a smart phone and transmitted to a computer wirelessly, thereby enhancing the real-time nature of CSA information acquisition;
[0069] The VIS-NIRS information system consists of a spectrometer, a bare optical fiber, a halogen lamp light source, a 1.2m×0.5m×1.4m darkroom and a computer.
[0070] The silage data includes silage CSA response information and silage VIS-NIRS spectrum information;
[0071] Wherein, the S1 is specifically:
[0072] S1.1: Preparation of olfactory visualization chip;
[0073] Two porphyrins and two pH indicators were selected as color-sensitive materials, including 5, 10, 15, 20-tetrakis (4-methoxyphenyl) -21H, 23H-porphine cobalt (II) (CH3OTPPCo), 5, 10, 15, 20-tetraphenyl-21H, 23H-porphine zinc (II) (TPPZn), bromocresol green and cresol red. First, each porphyrin and each pH indicator were dissolved in dichloromethane and anhydrous ethanol, respectively, and after ultrasonication for 30 minutes, a 2 mg / ml solution was prepared; then, a 0.3 mm capillary pipette was used to drop the prepared solutions on a 2×2 cm C2 reverse silica gel plate to form a 2×2 array. Finally, the chip was dried in a fume hood for ten minutes and then immediately placed in a ziplock bag to form an olfactory visualization chip;
[0074] It is worth noting that the prepared chip needs to be used within five hours.
[0075] S1.2: using the olfactory visualization chip to collect the original CSA image and the CSA image after reaction of the silage;
[0076] The SS1.2 is specifically as follows: open the airtight reaction box, put 100g of silage sample in the silage sample placement box, put the olfactory visualization chip in the olfactory visualization chip holder, immediately close and open the airtight reaction box, turn on the LED light source, remotely operate the smart phone to collect the original CSA image of the olfactory visualization chip, let the silage sample react with the olfactory visualization chip for 5 minutes, remotely operate the smart phone to collect the post-reaction image of the olfactory visualization chip, and obtain the post-reaction CSA image;
[0077] S1.3: performing an extraction operation on the original CSA image of the silage and the CSA image after the reaction to obtain the CSA response information of the silage;
[0078] In this embodiment, S1.3 specifically includes: extracting R, G and B components of each color-sensitive point in the original CSA image of the silage and the CSA image after the reaction.
[0079] Then use OpenCV to convert the extracted R, G, and B components into H, S, V, L, a, b, C, M, Y, Y_1, I, and Q components, and construct the R, G, B, H, S, V, L, a, b, C, M, Y, Y_1, I, and Q components into 21, 21, 21, 24, and 21 new components respectively, for a total of 108 components per color-sensitive point;
[0080] Table 1 Newly constructed color component names
[0081]
[0082]
[0083]
[0084] In this embodiment, as for the color components that characterize the CSA response, as mentioned above, there are usually only 9 components. These conventional color components lack sufficient color space, and each color space variable is relatively small. This phenomenon leads to insufficient utilization of CSA response information. In addition, during data acquisition, CSA information is easily interfered by factors such as lighting and equipment conditions. There are too few existing color components and it may be difficult to suppress these interferences. CMY was developed through the three-primary color subtractive model, and its principle is related to printing and pigment mixing. As for YIQ, color information is divided into brightness Y and color I and Q, and its color information is not affected by lighting. Additional details of the CSA color response, such as brightness and chromaticity, may be characterized by these two color spaces. Therefore, RGB, HSV, Lab, CMY and YIQ spaces are used to construct CSA color components, and a total of 108 color components are constructed.
[0085] Calculate the difference between the color component after the reaction and the initial color component, and obtain the response information of OSA to the silage as the CSA response information of the silage, thereby obtaining a total of 432 response information, which is equivalent to 4 color sensitive points multiplied by 108 color components;
[0086] Among them, the color component CSA after the reaction is calculated 反应后 With the initial color component CSA 原始 The difference between CSA 响应 The formula is:
[0087] CS4 响应 =ABS|CS4 反应后 -CSA 原始 |.
[0088] S1.4: Collecting the VIS-NIRS spectrum information of the silage through the VIS-NIRS information system;
[0089] In this step, the VIS-NIRS information system is subjected to dark current correction and whiteboard correction, and parameters such as integration time are automatically optimized. The feed sample is placed under a bare optical fiber, and the feed spectrum is collected three times. The spectrum is wired to a computer, and the average spectrum collected three times is used as the actual spectrum of the feed sample. Among them, the spectral range of the VIS-NIRS spectral information collected is 350-1830nm, including 1481 variables. Since the VIS-NIRS signal-to-noise ratio of 350-400nm is relatively low, the VIS-NIRS spectrum between 401-1830nm (including 1430 variables) is used for collection.
[0090] S2: Construct a silage sample data set based on the silage feed data:
[0091] The silage data and the quality indicators of all feeds measured in the laboratory, such as pH value, quality grade, fatty acid and ammonia nitrogen, were used to construct a silage sample data set.
[0092] The Kennard-Stone (KS) method is used to divide the data set into a training set and a prediction set for subsequent use. The training set is then divided into 5 folds using 5-fold cross validation, of which any 4 folds are used as calibration sets and the remaining 1 fold is used as a validation set, generating 5 sets of cross-validation data sets. The calibration set and validation set are used for feature extraction and stacking-decision-level data fusion configuration to ensure the generalization and stability of the feature extraction and data fusion configuration results.
[0093] The pH value, pH quality grade and sensory quality grade of 148 corn silage samples were collected and tested. The pH value of the feed ranged from 3.7 to 8.4. The pH quality grade was divided according to the "Silage Quality Evaluation Standard", which divides silage into four grades: high quality (grade 1), good (grade 2), general (grade 3) and poor (grade 4). The pH value ranges from 1 to 4 are less than 4.0, 4.0-4.4, 4.4-5.0 and greater than 5.0, respectively. A total of 49 feeds with pH quality grade 1, 45 feeds with pH quality grade 2, 3 feeds with pH quality grade 3, and 53 feeds with pH quality grade 4 were obtained. The sensory quality grade was determined using the "German Agricultural Association (DLG) Sensory Evaluation Method", which divides silage into four grades: high quality (grade 1), good (grade 2), general (grade 3) and poor (grade 4). A total of 39 feeds with sensory quality grade 1, 49 feeds with sensory quality grade 2, 20 feeds with sensory quality grade 3, and 10 feeds with sensory quality grade 4 were obtained. Subsequently, based on the Kennard-Stone (KS) method, the data set was divided into a training set and a prediction set, consisting of 111 and 37 samples, respectively. Then use 5-fold cross validation to divide the training set into 5 folds to construct a cross-validation data set.
[0094] S3: preprocessing the silage sample data set;
[0095] In this step, standard scaling is used to preprocess the CSA information, and maximum absolute scaling and normalization are used to preprocess the VIS-NIRS information.
[0096] S4: extracting CSA features and VIS-NIRS features from the silage sample data set preprocessed by S3 using a slime mold algorithm (SMA) and a support vector machine (SVM);
[0097] Wherein, the S4 is specifically:
[0098] S4.1: Initialize slime mold algorithm parameters and population;
[0099] The initialization parameters and population of the slime mold algorithm are as follows: the maximum number of iterations is 100, the population size is 10, the likelihood threshold z is 0.03, and the upper and lower limits are 1 and 0 respectively;
[0100] S4.2: Discretize the population into 0 and 1;
[0101] Specifically, the S4.2 formula is:
[0102]
[0103] Among them, X is the population, BX is the discretized population;
[0104] S4.3: Calculate the fitness of the population;
[0105] In this step, features are extracted based on the variables with a value of 1 in the population, and five SVM models are constructed using the extracted features and the five cross-validation data sets obtained in S2. The prediction performance of the models is calculated, and the average of the prediction performance is taken to calculate the fitness of the population.
[0106] Among them, the population fitness Fit i The calculation formula is:
[0107]
[0108] Among them, R 2 CV is the average coefficient of determination of the five validation sets, RMSECV is the average root mean square error of the five validation sets, and RPDCV is the average performance to bias ratio of the five validation sets.
[0109] S4.4: Update the best fitness, best feature combination and population;
[0110] In this step, the best fitness, best feature combination and population are updated according to the principle of minimizing the fitness value;
[0111] S4.5: Iterate S4.3-S4.4 until the maximum number of iterations T is reached, and output the optimal fitness and optimal feature combination;
[0112] The CSA features extracted by SMA are shown in the attached figure. Figure 4 As shown, a total of 10 features were extracted. For TPPZn, I_min_Y and Y_min_I_nor, as well as B_min_G_nor, hue_mod, CIVE_Lab, CYDI and EII of bromocresol green were selected; for cresol red, B_min_G_nor, CIVE_Lab and Y color components were selected. The expressions of the above features are shown in the following table. Only the color-sensitive points of TPPZn, bromocresol green and cresol red were selected, which further reduced the material consumption of CSA. The reason why CH3OTPPCo was not selected may be that its response to silage of different qualities is unclear. Only features were extracted from RGB, Lab, CMY and YIQ spaces, indicating that these spaces are suitable for detecting silage quality. According to the mechanism analysis, the above three color-sensitive points (TPPZn, cresol green, cresol red) are sensitive to acetic acid, butyric acid, valeric acid, hexanoic acid, heptanoic acid, phenylacetic acid, 2-methoxy-4-vinylphenol, 2,6-dimethoxyphenol and vanillin in silage.
[0113] The VIS-NIRS features extracted by SMA extracted a total of 11 features, among which the features of 401, 412, 531 and 735 nm may be related to the coloring of silage, because the spectra of 401 and 412 nm are close to purple, the spectrum of 531 nm is close to green, and the spectrum of 735 nm is close to red. The features of 936 and 946 nm are related to the CH groups of lactic acid, lignin and cellulose, respectively. The feature of 1014 nm is related to lactic acid, which is an important compound that determines the pH of silage. The feature of 1204 nm is related to the CH group, which is related to lactic acid, lignin and cellulose. The feature of 1637 nm is related to the CH of cellulose. The features of 1762 and 1790 nm can characterize the CH of lignin and the CH of cellulose.
[0114] As the degree of aerobic deterioration increases, the sensory quality characteristics of silage, namely structure, color and smell, change significantly. According to the quality evaluation criteria, the structure of silage gradually changes from loose and complete to sticky lumps. The color changes from bright yellow to dark brown. The smell changes from sour and fragrant to musty. Among them, the structural changes are related to the degradation of starch, protein, lignin and cellulose. The degradation of these substances not only leads to the destruction of the main structure of silage, but also their degradation products may be related to the adhesion phenomenon. The darkening of silage color is caused by the degradation of chlorophyll. Volatile fatty acids, phenolic substances such as phenylacetic acid and vanillin, fatty acid ethyl esters and terpenes have sour and fragrant compounds, and the smell of high-quality silage is contributed by these compounds. 2-Methoxy-4-vinylphenol contributes to the musty smell of silage. In addition, lactic acid is closely related to the quality of silage, and it is constantly consumed in the early stage of aerobic deterioration.
[0115] For the above compounds and sensory quality characteristics, lignin, cellulose, lactic acid and silage color can be sensed by VIS-NIRS. Acetic acid, propionic acid, butyric acid, valeric acid, hexanoic acid, heptanoic acid, phenylacetic acid, 2-methoxy-4-vinylphenol, 2,6-dimethoxyphenol and vanillin can be sensed by CSA. This phenomenon shows that VIS-NIRS can characterize the structure and color characteristics of silage, and CSA can characterize the odor of silage. The fusion of the two technologies can comprehensively and finely characterize the sensory quality characteristics of silage, and then accurately predict the quality of silage.
[0116] S5: performing feature fusion on the CSA feature and the VIS-NIRS feature to obtain a CSA-VIS-NIRS fusion feature;
[0117] In this step, the VIS-NIRS feature and the CSA feature are connected to obtain a CSA-VIS-NIRS fusion feature; wherein the CSA-VIS-NIRS fusion feature is a feature-level fusion feature;
[0118] S6: Construct a stacking prediction model for silage quality;
[0119] In this embodiment, the silage quality stacking prediction model adopts a stacking ensemble learning (stacking) framework, and uses the slime mold algorithm to configure the basic learners corresponding to the CSA, VIS-NIRS features and CSA-VIS-NIRS fusion features, as well as the meta-learner to construct a stacking prediction model;
[0120] In this embodiment, selecting appropriate basic learners for VIS-NIRS features, CSA features, and CSA-VIS-NIRS fusion features, as well as configuring appropriate meta-learners, are crucial for effectively integrating multi-source information. To this end, this embodiment proposes an SMA stacking decision-level data fusion method to adaptively configure the basic learners and meta-learners corresponding to each source feature, thereby constructing a silage quality prediction model.
[0121] Specifically, the S6 is as follows:
[0122] S6.1: Build a metadata subset pool containing all feature and base learner combinations;
[0123] Specifically, based on the 5 sets of cross-validation data sets, candidate learners are pre-trained to generate prediction values of the 5 sets of cross-validation data sets, thereby constructing a metadata subset pool containing all feature and base learner combinations to minimize computational costs;
[0124] Wherein, all the features include VIS-NIRS features, CSA features and CSA-VIS-NIRS features; the basic learner combination includes a basic learner for quantitative prediction tasks and a basic learner for qualitative prediction tasks;
[0125] Among them, the basic learners for quantitative prediction tasks include partial least squares regression model (PLSR), least absolute shrinkage and selection operator (LASSO), support vector machine (SVM), random forest model (RF), gradient boosting decision tree model (GBDT), adaptive boosting model (AdaBoost), optimized gradient boosting decision tree model (XGBoost) and lightweight gradient boosting machine tree model (LightGBM) models, and the basic learners for qualitative prediction tasks include ridge classifier (RC), logistic regression model (LR), SVM, RF, GBDT, AdaBoost, XGBoost and LightGBM models.
[0126] It is worth emphasizing that both the quantitative prediction and qualitative prediction tasks generate 24 metadata subsets from 3 features and 8 base learners, constituting the metadata subset pool;
[0127] S6.2: Initialize slime mold algorithm parameters and population;
[0128] The maximum number of iterations is set to 30, the population size is 18, and the upper and lower limits of the population are [8, 8, 8, 8, 8] and [0, 0, 0, 0, 0, 1] respectively.
[0129] In this embodiment, codes 0-8 represent learning algorithms; for quantitative prediction tasks, codes 0-8 represent not selecting a learner, PLSR, LASSO, SVM, RF, GBDT, AdaBoost, XGBoost, and LightGBM, respectively;
[0130] For qualitative prediction tasks, codes 0-8 correspond to not selecting a learner, RC, LR, SVM, RF, GBDT, AdaBoost, XGBoost, and LightGBM, respectively;
[0131] Among them, the first six bits of the population code represent the configuration of the basic learner, and the seventh bit code determines the meta-learner. The learners corresponding to the first to second, third to fourth, and fifth to sixth bits of the population code take VIS-NIRS features, CSA features, and CSA-VIS-NIRS features as inputs, respectively. Therefore, the first six bits of the population code are used to call all features and configure the basic learner. A maximum of six basic learners are configured in the stack, and no more than two learners are configured for each set of features.
[0132] S6.3: Discretize the population;
[0133] Wherein, the discretization formula is:
[0134] DX=round(X)
[0135] In the formula, DX is the discretized population, and X is the population;
[0136] S6.4: Calculate fitness value;
[0137] In this step, the base learner and the meta learner are configured according to the population code corresponding to each learner, the prediction of the base learner is directly called from the metadata subset pool, and the meta learner is trained according to the metadata data set, and 5 stacked decision-level data fusion models are constructed according to the cross-validation data set, the prediction performance of the model is calculated, the average of the prediction performance is taken, and the fitness value is calculated;
[0138] Among them, the fitness calculation formula for the quantitative prediction task is:
[0139]
[0140] In the formula, is the average coefficient of determination of the five calibration sets, and RMSEC is the average root mean square error of the five calibration sets;
[0141] Among them, the fitness calculation formula for the qualitative prediction task is:
[0142] Fit i =-0.5×Accuracy c -0.5×Accuracy CV
[0143] Where, Accuracy c is the average accuracy of the five calibration sets. CV is the average correct judgment rate of 5 validation sets;
[0144] S6.5: Update the best fitness, best feature combination and population;
[0145] S6.6: Iterate S6.4-S6.5 until the maximum number of iterations T is reached, output the best fitness, best feature combination and population, and establish a silage quality stacking prediction model based on this;
[0146] The silage quality stacking prediction model is used to predict the silage quality grade, including: pH value prediction, pH quality grade prediction and sensory quality grade prediction;
[0147] S7: performing quality testing on the silage sample according to the silage quality stacking prediction model;
[0148] The silage quality stacking prediction model was constructed by using SMA-stacking-decision-level data fusion to predict the pH value of silage. The performance of the model is shown in the attached figure. Figure 5 As shown. The coefficient of determination in the prediction set The performance of SMA-stacked-decision-level data fusion is outstanding in terms of the root mean square error RMSEP of the prediction set and the performance to deviation ratio RPD of the prediction set, which are 0.9932, 0.1359 and 12.1408 respectively. This shows that the VIS-NIRS and CSA information contain rich information related to the pH value of silage, and the SMA-stacked-decision-level data fusion strategy is good at digging deep into this information. The fusion configuration process took 17533.2 seconds on a desktop computer with Windows 10 operating system, Intel Core i7-12700F CPU and 64GB memory. This phenomenon shows that the fusion strategy can be configured in a few hours. The configured model was then used to predict the silage of the prediction set. The mean prediction time was 10.3 seconds. This phenomenon shows that batch samples can be accurately predicted in more than ten seconds. The configured model can quickly predict unknown samples. In actual production, it can be inferred that the SMA-stacked decision-level data fusion model can be configured offline the day before. The configured model can be used for real-time prediction of silage on the same day. The proposed method has the potential for real-time detection of batch silage.
[0149] The reason for such a short time is the introduction of metadata subset pooling. When using SMA to configure stacked decision-level data fusion, hundreds or thousands of stacked models need to be built. With metadata subset pooling, only the meta-learner needs to be predicted when building the stacked model, thus avoiding redundant training of the same combination of features and base learners. In addition, because SMA can quickly build high-performance models for different batches of silage, this method has great potential for efficient and real-time detection of silage pH.
[0150] The silage quality stacking prediction model was constructed using SMA-stacking-decision-level data fusion to determine the pH quality grade of silage. The above-mentioned VIS-NIRS, CSA and CSA-VIS-NIRS features were selected as candidate features. The SMA stacking decision-level data fusion configured five basic learners and one GBDT meta-learner. The calculation process took 12152.9 seconds. The proposed algorithm has the potential for real-time detection of feed quality. The training set accuracy of the pH quality grade discrimination model constructed by this method reached 99.1%, and the prediction set accuracy reached 100% (such as Fig. 6A and Figure 6B In conclusion, the SMA stacking fusion configuration can not only accurately predict the pH value of silage, but also accurately distinguish the pH quality grades, and the quality of silage can be evaluated quickly and non-destructively.
[0151] The silage quality stacking prediction model was constructed using SMA-stacked-decision-level data fusion to distinguish the sensory quality grades of silage. The above-mentioned VIS-NIRS, CSA and CSA-VIS-NIRS features were selected as candidate features. The SMA stacked decision-level data fusion configured three basic learners and one SVM meta-learner for the CSA and CSA-VIS-NIRS features. The calculation process took 10376.1 seconds. The proposed algorithm has the potential for real-time detection of feed quality. The quality grade discrimination model constructed by this method has a training set accuracy of 91% and a prediction set accuracy of 89.2% (e.g. Fig. 7A and 7B In the prediction set, the classification accuracy of silage grades 1 to 4 was 87.5%, 87.21%, 100%, and 100%, respectively, which shows that the classification accuracy of relatively high-quality grade 1 and 2 silages needs to be improved, while the classification accuracy of lower-quality grade 3 and 4 silages is already very high. In conclusion, the SMA stacking fusion configuration can not only accurately predict the pH value of silage, but also accurately distinguish the quality grades. The quality of silage can be quickly and non-destructively evaluated.
[0152] Embodiment 2
[0153] The present invention also includes a silage corn feed quality detection system, wherein the identification system adopts the feed quality detection method in the first embodiment, including:
[0154] Silage sample collection system, used to collect silage data;
[0155] A sample data set construction module is used to construct a silage sample data set according to the silage feed data:
[0156] A preprocessing module, used for preprocessing the silage sample data set;
[0157] A feature extraction module, used for extracting CSA features and VIS-NIRS features from the silage sample data set preprocessed by the preprocessing module using a slime mold algorithm and a support vector machine;
[0158] A feature fusion module, used to fuse the CSA feature and the VIS-NIRS feature to obtain a CSA-VIS-NIRS fusion feature;
[0159] Model building module, used to build a stacking prediction model for silage quality;
[0160] A feed detection module is used to perform quality detection on the silage sample according to the silage quality stacking prediction model.
[0161] Embodiment 3
[0162] This embodiment includes a computer-readable storage medium, on which a data processing program is stored. The data processing program is executed by a processor to implement a method for detecting the quality of corn silage feed in embodiment 1.
[0163] It should be understood by those skilled in the art that the embodiments of this article can be provided as methods, devices (equipment), or computer program products. Therefore, this article can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this article can adopt the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program codes. Computer storage media include volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data), including but not limited to RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassette, magnetic tape, disk storage or other magnetic storage device, or any other medium that can be used to store desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media generally contain computer-readable instructions, data structures, program modules or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0164] This document is described with reference to flowcharts and / or block diagrams of methods, apparatuses (devices) and computer program products according to the embodiments of this document. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0165] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0166] Although the preferred embodiments of this invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of this invention.
[0167] Obviously, those skilled in the art can make various changes and modifications to this article without departing from the spirit and scope of this article. Thus, if these modifications and variations of this article fall within the scope of the claims and their equivalents, then the intention of this article also includes these modifications and variations.
Claims
1. A method for detecting the quality of corn silage, used for non-destructive detection of silage quality, characterized in that: The following steps are involved: S1: Silage sample collection system collects silage data; S2: constructing a silage sample data set according to the silage feed data; S3: preprocessing the silage sample data set; S4: extracting CSA features and VIS-NIRS features from the silage dataset preprocessed by S3 using a slime mold algorithm and a support vector machine; S5: performing feature fusion on the CSA feature and the VIS-NIRS feature to obtain a CSA-VIS-NIRS fusion feature; S6: Construct a stacking prediction model for silage quality; S7: Performing quality testing on the silage sample according to the silage quality stacking prediction model.
2. A method for detecting the quality of corn silage according to claim 1, characterized in that: The S1 is specifically: S1.1: Preparation of olfactory visualization chip; S1.2: using the olfactory visualization chip to collect the original CSA image and the CSA image after reaction of the silage; S1.3: 108 new color components are constructed based on five color spaces to comprehensively and finely extract CSA response information; at the same time, CMY and YIQ spaces are used to construct CSA color components; S1.4: performing an extraction operation on the original CSA image of the silage and the CSA image after the reaction, and obtaining the CSA response information of the silage according to the constructed color components; S1.5: Collecting the VIS-NIRS spectrum information of the silage through the VIS-NIRS information system.
3. A method for detecting the quality of corn silage according to claim 1, characterized in that: In S2, the silage data and the pH value, quality grade, fatty acid and ammonia nitrogen quality indicators of the silage measured in the laboratory are used to construct a silage sample data set.
4. A method for detecting the quality of silage corn feed according to claim 3, characterized in that: In S2, the Kennard-Stone method is used to divide the silage sample data set into a training set and a prediction set, and then the training set is divided into 5 folds using 5-fold cross validation, wherein any 4 folds are used as calibration sets and the remaining 1 fold is used as a validation set.
5. A method for detecting the quality of silage corn feed according to claim 2, characterized in that: In S3, the CSA response information is preprocessed using standard scaling, and the VIS-NIRS spectral information is preprocessed using maximum absolute scaling and normalization.
6. A method for detecting the quality of corn silage according to claim 1, characterized in that: The S4 is specifically: S4.1: Initialize slime mold algorithm parameters and population; S4.2: Discretize the population into 0 and 1; S4.3: Calculate the fitness of the population; S4.4: Update the best fitness, best feature combination and population; S4.5: Iterate S4.3-S4.4 until the maximum number of iterations T is reached, and output the optimal fitness and optimal feature combination.
7. A method for detecting the quality of corn silage according to claim 1, characterized in that: In S6, the silage quality stacking prediction model adopts a stacking integrated learning framework, uses the slime mold algorithm to configure the basic learners corresponding to the CSA features, VIS-NIRS features and CSA-VIS-NIRS fusion features, and the meta-learner to construct a stacking prediction model.
8. A method for detecting the quality of silage corn feed according to claim 7, characterized in that: The S6 is specifically: S6.1: Build a metadata subset pool containing all feature and base learner combinations; S6.2: Initialize slime mold algorithm parameters and population; S6.3: Discretize the population; S6.4: Calculate fitness value; S6.5: Update the best fitness, best feature combination and population; S6.6: Iterate S6.4-S6.5 until the maximum number of iterations T is reached, output the best fitness, best feature combination and population, and establish a silage quality stacking prediction model based on this.
9. A method for detecting the quality of silage corn feed according to claim 8, characterized in that: The silage quality stacking prediction model is used to predict the silage quality grade, including: pH value prediction, pH quality grade prediction and sensory quality grade prediction.
10. A silage corn feed quality detection system, characterized in that: The system adopts a silage corn feed quality detection method according to any one of claims 1 to 9, comprising: Silage sample collection system, used to collect silage data; A sample data set construction module, used to construct a silage sample data set according to the silage feed data; A preprocessing module, used for preprocessing the silage sample data set; A feature extraction module, used for extracting CSA features and VIS-NIRS features from the silage sample data set preprocessed by the preprocessing module using a slime mold algorithm and a support vector machine; A feature fusion module, used to fuse the CSA feature and the VIS-NIRS feature to obtain a CSA-VIS-NIRS fusion feature; Model building module, used to build a stacking prediction model for silage quality; A feed detection module is used to perform quality detection on the silage sample according to the silage quality stacking prediction model.
Citation Information
Cited By
Method for detecting quality of silage, mobile terminal and system
CN122793690A