Method for rapidly evaluating compost maturity based on hyperspectral imaging and machine learning

By combining hyperspectral imaging with machine learning, key feature bands were screened and an IMS scoring system was constructed, which solved the problems of long time consumption and high cost in compost maturity assessment, and achieved rapid and accurate compost maturity assessment, which is suitable for real-time monitoring and automatic early warning of different raw material systems.

CN121366652APending Publication Date: 2026-01-20SICHUAN AGRI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511407436.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-29
Publication Date
2026-01-20

AI Technical Summary

Technical Problem

Existing technologies are insufficient for quickly, economically, and reliably assessing compost maturity, and traditional methods are time-consuming and costly, failing to meet the precise classification needs of industrial-scale operations.

Method used

By combining hyperspectral imaging with machine learning, five characteristic bands with clear physical significance were selected through permutation importance analysis. Combined with RF and XGB models, an IMS scoring system was constructed to achieve rapid and non-destructive assessment of compost maturity.

Benefits of technology

It enables rapid and accurate assessment of compost maturity, reducing testing time from 24 hours to 5 minutes, lowering hardware costs by 50%, achieving an accuracy rate of 98.72%, and is applicable to different raw material systems, supporting real-time monitoring and automatic early warning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121366652A_ABST
    Figure CN121366652A_ABST
Patent Text Reader

Abstract

The invention provides a method for rapidly evaluating the maturity of compost based on hyperspectral imaging and machine learning, which comprises the following steps: acquiring hyperspectral data of a compost sample at the wave band of 700-1700nm, and covering vibration information of C-H and O-H functional groups; light source unevenness is eliminated through black and white correction, 32 low-signal-to-noise-ratio wave bands are provided, and 203 effective wave bands are reserved; s201, PCA dimension reduction: extracting the first five principal components from the hyperspectral data in the step 1, reflecting the overall change of humus by PC1, and capturing 1335nm and 1460nm characteristic peaks by PC3-PC4; s202, analyzing the hyperspectral data in the step 1 through feature importance to identify five'feature wavebands', and improving the efficiency by 40%; weighting the C / N ratio, NH4 < + >-N, NO3 <->-N and GI into a comprehensive maturity score according to the screened compost maturity key indexes, and solving the single index threshold contradiction; the method comprises the following steps of: realizing mature / immature dichotomy by using RF (radiofrequency) (wherein the radiofrequency is equal to 200) and XGB (wherein the radiofrequency is equal to 0.05); for a mature sample, continuous indexes such as IMS, GI, C / N ratio and the like are predicted by using RF. According to the method, rapid, lossless and accurate maturity evaluation is realized, and a key technical support is provided for intelligent compost production.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of composting, and particularly relates to a method for rapidly evaluating compost maturity based on hyperspectral imaging and machine learning. BACKGROUND

[0002] Composting is a typical aerobic biodegradation process that can recover organic matter and nutrients from waste, effectively reduce pathogens and environmental pollution, and simultaneously produce stable organic fertilizers. This process can bring great benefits to sustainable agriculture. The safe and effective use of compost mainly depends on its maturity, which reflects the degree of microbial degradation, organic matter stabilization, and toxin elimination. Immature compost may release plant toxic compounds, compete with crops for oxygen and nitrogen, and produce harmful byproducts such as ammonia and organic acids, thereby inhibiting seed germination and plant growth. Therefore, accurate and scientific evaluation of compost maturity is a prerequisite for safe agricultural application of compost.

[0003] Compost maturity evaluation is usually based on three types of indicators: chemical indicators, biological indicators, and physical indicators. Chemical indicators (such as C / N ratio, ammonium nitrogen (NH4 + -N), nitrate nitrogen (NO3 - -N), and biological indicators (such as germination index (GI), respiratory activity)) are usually more objective than physical indicators (such as color, odor, temperature change) because they can more reliably reflect the internal biochemical processes of compost. However, these measurement methods often lack standardized thresholds, resulting in significant differences in "maturity standards" among different studies. For example, some researchers define mature compost as having a C / N ratio of less than 5, while others set the threshold at 23. This inconsistency hinders the comparability of results and limits the establishment of universally applicable compost product quality control and intelligent management systems. In addition, traditional measurement methods (such as GI) require laboratory analysis, which is time-consuming, costly, and not suitable for rapid, large-scale evaluation, so there is a need for a rapid, economical, and reliable method to predict compost maturity.

[0004] Recent advances in spectroscopy and data mining techniques offer promising solutions for rapid evaluation of biomass and compost materials. Compared with traditional chemical analysis, hyperspectral imaging has obvious advantages, including rapid analysis, simple sample preparation, non-destructive measurement, and the ability to conduct continuous online monitoring. However, most current research is based on single-point spectral analysis, which is insufficient to capture the spatial and compositional heterogeneity of compost and cannot meet the precision requirements of industrial-scale maturity classification. In addition, compost is a complex and dynamic process influenced by the intricate interactions between microbial activity and initial raw material composition. These interactions produce highly nonlinear and unpredictable patterns during the maturation process, posing significant challenges to accurate maturity evaluation.

[0005] Prior art discloses a method and device for classifying the maturity of flue-cured tobacco, application number 202411555850.8. The flue-cured tobacco maturity samples of the upper, middle and lower parts are prepared by tobacco grading experts, the spectral data of the flue-cured tobacco maturity is collected by an imaging system, the noise in the spectral data of the flue-cured tobacco maturity is eliminated by using the moving average filtering method and the multivariate scatter correction method, the SWO-ResNet model is established by integrating the spider intelligent optimization algorithm into the 1D-ResNet model, the batch_size and epochs parameters in the 1D-Res model are intelligently optimized by using SWO, and the spectral characteristic waveband of the flue-cured tobacco maturity is extracted by using the SWO-ResNet model.

[0006] The defects are: 1) Feature selection mechanism: flue-cured tobacco research relies on deep learning model to automatically learn feature waveband, the process is black-box and needs to optimize parameters such as batch_size and epochs.

[0007] 2) Waveband number and efficiency: the number of flue-cured tobacco research feature wavebands is not clear and needs to be extracted through a complex network.

[0008] 3) Robustness design: flue-cured tobacco research feature extraction relies on sample spectral data distribution and is easily disturbed by noise. SUMMARY

[0009] The purpose of the present application is to solve the defects of the prior art and provide a method for rapidly evaluating the maturity of compost based on hyperspectral imaging and machine learning.

[0010] The present application directly selects five fingerprint characteristic wavebands (1060 / 1228 / 1335 / 1460 / 1620nm) with clear physical meaning through permutation importance analysis, which is significantly different from the method of extracting characteristic wavebands by SWO-ResNet model in existing flue-cured tobacco research: flue-cured tobacco research relies on deep learning model to automatically learn features and needs to optimize parameters such as batch_size and epochs, the process is complex and black-box. The present application quantifies the contribution of each waveband to the model performance, directly locks the key wavebands corresponding to C-H and O-H functional group vibration, has clear physical meaning, does not need complex model training, reduces the feature dimension to five, and realizes the unity of explainability and engineering practicability of feature extraction.

[0011] The present application adopts the following technical scheme: The method for rapidly evaluating the maturity of compost based on hyperspectral imaging and machine learning comprises: Step 1. Comprehensive index construction The key indicators of compost maturity are screened in the compost samples, the C / N ratio, NH4 + -N and NO3- -N, GI maturity index weight is comprehensive maturity IMS score; Step 2. Maturity discrimination of compost samples Use RF and XGB models to realize maturity / immaturity binary classification. When the comprehensive maturity score IMS ≥ 0, it indicates that the compost has reached maturity, otherwise it is immature; Where, the maturity index C / N ratio, NH4 + -N, NO3 - -N, GI of the sample is predicted by RF and XGB to determine the comprehensive maturity score IMS by the following formula: The actual value of the model of the i-th maturity index, Weighti represents the weight of the i-th maturity index, and the weight is assigned by the analytic hierarchy process, The statistical maturity threshold of the i-th maturity index is represented; Step 3. Hyperspectral data acquisition and preprocessing Get the hyperspectral data of the compost samples in step 1 in the 900-1700nm waveband, covering the C-H and O-H functional group vibration information; black and white correction eliminates light source unevenness, and 32 low signal-to-noise ratio bands are proposed, and 203 effective bands are retained; Step 4. Feature extraction and dimensionality reduction The hyperspectral data in step 1 is reduced by principal component analysis, and 12 principal components are extracted; Step 5. Hyperspectral feature compression Through feature importance analysis of the 12 principal components in step 4, the first 5 principal components are identified, and the first 5 principal components contribute to the main variance; Step 6. Establishing machine learning model of spectrum S601. Assign key parameters to RF and XGB models through experimental verification and hyperparameter optimization, respectively. The parameters of the RF model are: The parameter settings of the RF model: the model type is from sklearn.ensemble import RandomForestRegressor, and the hyperparameters include n_estimators=200, max_depth=8, max_features='sqrt', min_samples_leaf=2, min_samples_split=5, bootstrap=True, random_state=42.

[0012] Parameter setting of XGB model: the model type is from sklearn.ensemble import xgboostRegressor, and the hyperparameters include n_estimators=100, max_depth=3, learning_rate=0.05, subsample=0.8, colsample_bytree=0.8, gamma=0, random_state=42.

[0013] S602. Training process and prediction The hyperspectral data obtained from the compost samples in step 3 were divided into a training set and a test set according to a random seed, and the first five principal components of the 12 extracted principal components were used in the RF and XGB models for prediction, to obtain the predicted values of C / N ratio, NH4 + -N, NO3 - -N, GI, respectively. + -N, NO3 - -N, GI, and the value of the comprehensive maturity score IMS was obtained through the following formula: The model prediction value of the i-th maturity index, Weighti represents the weight of the i-th maturity index, and the weight is assigned by the analytic hierarchy process, The statistical maturity threshold of the i-th maturity index; The predicted values of C / N ratio, NH4 + -N, NO3 - -N, GI, and the value of the comprehensive maturity score IMS were used to establish a mapping relationship with the actual measured values of C / N ratio, NH4 + -N, NO3 - -N, GI, and the value of the comprehensive maturity score IMS, so as to realize maturity prediction by using the constructed spectral machine learning models RF and XGB.

[0014] Further, in step 5, the wavebands of the five principal components are 1060 nm, 1228 nm, 1335 nm, 1460 nm, and 1620 nm, respectively. The principal component PC1 reacts to the overall change of humus, the principal components PC2-PC4 capture the C-H lignin characteristic peak at 1335 nm and the O-H humus hydroxyl characteristic peak at 1460 nm, and the principal component PC5 captures the O-H bending vibration at 1228 nm and the O-H / C-H stretching vibration characteristic peak at 1420 nm.

[0015] Further, the steps of the calculation formula in step 2 are as follows: in specific calculation, first, the threshold value is determined: the value of the model threshold is C / N ratio ≤19.10; GI≥83.34%, NO3 - -N≤0.50 g / kg, NH4 + -N≥0.02 g / kg; then, the standardization processing is performed: the model prediction value is compared with the statistical threshold value, the difference value is calculated and normalized to 0-1, and it is considered that the index threshold is higher than 0.8; then, the weighted summation is performed: the normalized value is multiplied by the respective weight and then added, and the weight value of the model is GI 47.62%, C / N ratio 28.88%, NO3 — -N is 17.59%, NH4 + -N is 5.91%.

[0016] Further, the grid search hyperparameter, 5-fold cross-validation and PauTa criterion extreme value test are also included, and finally, RF is selected as the core model as the spectrum prediction model.

[0017] The beneficial effects of the present application relative to the deep learning model of flue-cured tobacco are: 1) The present application breaks through the technical bottleneck of "non-uniform standard, long detection time and low precision" in traditional compost maturity evaluation through "comprehensive index construction-feature spectrum extraction-secondary machine learning modeling", and the core lies in the quantitative integration of IMS index and the collaborative optimization of characteristic waveband-integrated learning, which realizes rapid, non-destructive and accurate maturity evaluation, and provides key technical support for intelligent compost production.

[0018] 2) The present application quantifies the contribution of each waveband to the model performance through permutation importance analysis, and directly locks the five key wavebands near 1060nm (C-H stretching vibration), 1228nm (O-H bending vibration), 1335nm (lignin C-H), 1460nm (humus O-H) and 1620nm (cellulose C-O), which have clear physical meaning and do not require model parameter optimization.

[0019] 3) The present application simplifies multiple effective wavebands to five, and the model operation efficiency is improved by 40%, and the hardware cost is reduced by 50% (a multispectral camera can be used instead of a hyperspectral device).

[0020] 4) The five wavebands selected by the present application correspond to the core functional groups (C-H / O-H) of compost maturity, and have higher stability (accuracy fluctuation <3%) under different raw materials (cow dung / straw / biochar) and environmental conditions.

[0021] 5) The accuracy is significantly improved, and the maturity determination accuracy of XGB classification reaches 98.72%, which is improved by 31.6% compared with the traditional C / N ratio method (75%). The extreme value prediction RF has a high accuracy of 98.72% for GI (R 2= 0.947, MSE = 0.0008) and C / N ratio (R 2 = 0.931, MRE = 0.015) than linear models. Efficiency and cost optimization, detection speed: single sample detection time is shortened from 24 hours (traditional chemical method) to 5 minutes without sample pretreatment; hardware cost: feature band instead of full spectrum, hardware cost is reduced by 50% (low-cost multispectral camera can be used), model training time is shortened from 2 hours to 45 minutes.

[0022] 6) Practicality and universality, raw material adaptability: suitable for mixed systems such as cow dung, straw and biochar, the accuracy fluctuation is less than 3% in 6 groups of processing; real-time monitoring: support embedded system deployment, can be integrated into a compost reactor to realize automatic maturity warning. Environmental and economic benefits, reduce pollution: reduce the use of chemical reagents (such as K2Cr2O7), reduce environmental pollution; agricultural income: avoid crop yield reduction (reduce loss by about 20%) caused by immature compost, and promote the resource utilization rate of agricultural waste by 15%. BRIEF DESCRIPTION OF DRAWINGS

[0023] Figure 1 is a hyperspectral test original image; Figure 2 is a principal component analysis number and its corresponding cumulative variance contribution rate; Figure 3 is a machine learning model and an evaluation of different principal component numbers on the classification result, (a) is accuracy, (b) is precision, (c) is recall rate, and (d) is F1 index; Figure 4 is a machine learning model prediction result image and evaluation of IMS, (a) is an ANN prediction result image, (b) is an XGB prediction result image, (c) is an RF prediction result image, (d) is an SVR prediction result image, (e) is an IMS validation set result evaluation radar chart, and (f) is an IMS test set result evaluation radar chart; Figure 5 is a prediction result image of each index of the machine learning model, (a) is GI, (b) is C / N ratio, (c) is NO3 - -N, (d) is NH4 + -N; Figure 6 is an RF and XGB extreme value prediction and sensitivity analysis result, (a) is an XGB extreme value prediction, (b) is an RF extreme value prediction, (c) is a sensitivity analysis of each principal component, and (d) is a sensitivity analysis quantitative result; Figure 7 is a method step flowchart of the application. DETAILED DESCRIPTION

[0024] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention are described clearly and completely below. Obviously, the described embodiments are only some embodiments of this invention, not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0025] like Figure 7 As shown, the method for rapidly assessing compost maturity based on hyperspectral imaging and machine learning of the present invention includes: First, the hyperspectral images were standardized and dimensionality was reduced using principal component analysis (PCA). Then, four machine learning models—random forest (RF), artificial neural network (ANN), extreme gradient boosting (XGB), and support vector machine (SVM)—were trained for predictive analytics.

[0026] Secondly, a compost maturity index system was constructed, and key indicators for compost maturity were systematically screened, including chemical indicators (C / N ratio, NH4+, etc.). + -N, NO3 - -N), biological indicators (germination index GI), and innovatively integrated them into the Integrated Maturity Score (IMS), which solves the problem of inconsistent evaluation standards of traditional single indicators and provides a quantitative basis for subsequent modeling (this part is existing, referencing patent application number 202510325830.X, invention title A method for achieving rapid composting based on prediction and reverse regulation).

[0027] This study investigates a fusion method of hyperspectral imaging and machine learning. Hyperspectral data (900-1700 nm band) from compost samples were collected. Preprocessing (black and white correction, noise band removal) and principal component analysis (PCA) were used for dimensionality reduction to extract 12 principal components (PCs). The correlation between characteristic bands such as 1335 nm and 1460 nm and substances like lignin and humic substances (corresponding to CH and OH functional group vibrations) was analyzed. Four types of machine learning models—random forest (RF), extreme gradient boosting (XGB), artificial neural network (ANN), and support vector machine (SVM)—were constructed and used for binary classification of maturity (mature / immature) and regression prediction of continuous indicators such as IMS, GI, and C / N ratio, respectively. By testing hyperspectral data from compost samples and then performing PCA dimensionality reduction (PCs), the PCA results were input into the machine learning models (classification / regression) to predict maturity indicators, thus establishing a nonlinear mapping relationship between hyperspectral data and maturity indicators. Using principal components (PCs) extracted by PCA as a bridge, spectral features and chemical processes (such as lignin degradation and humus formation) were integrated, and finally, rapid classification of maturity status and accurate prediction of key indicators were achieved through RF and XGB models.

[0028] Model optimization and verification, the model hyperparameters (such as RF n_estimators=200, XGB learning_rate=0.05) are optimized by grid search, and the model stability is verified by 5-fold cross-validation and extreme value test (PauTa criterion), and finally RF and XGB are selected as the optimal model.

[0029] In this process, the application solves the problem of high dimension and redundant information of hyperspectral data, which leads to low training efficiency and easy overfitting.

[0030] Based on the finding of the application that the original hyperspectral data contains 256 bands, of which 32 bands have very low signal-to-noise ratio, and there is strong correlation between adjacent bands, the application solves the problems of high dimension and redundant information of hyperspectral data in the following ways:

[0031] PCA dimension reduction is used to extract the first 5 principal components (cumulative variance contribution rate>95%), retain key spectral features (such as PC1 reacting 96% of the variance, corresponding to the overall change of humus; PC2-4 capturing characteristic peaks at 1335nm, 1460nm, etc.), and reducing redundant information. By comparing the influence of different principal component numbers on the model performance, it is found that when 5 principal components, the classification accuracy (RF: 98%, XGB: 99%) and regression R 2 (IMS: 0.917 / RF, 0.886 / XGB) reach the optimal, avoiding the curse of dimensionality.

[0032] In addition, the application solves the problem of complex chemical composition of compost samples, significant nonlinear relationship, and low prediction accuracy of traditional linear models.

[0033] Based on the finding that during the composting process, GI is negatively correlated with C / N ratio in a nonlinear manner, and NH + , NO3 - , etc. fluctuate greatly, and linear models (such as multiple linear regression) are difficult to capture complex relationships. The application introduces ensemble learning models (RF, XGB) to process nonlinear data using decision tree ensemble characteristics. For example, RF reduces the sensitivity to noise data by voting 500 decision trees; XGB optimizes the loss function by gradient boosting to enhance the fitting ability to small samples. The results show that the prediction R 2 of RF for C / N ratio extreme value reaches 0.955, and the MSE is only 0.168, which is significantly better than linear models (such as SVM R 2 =0.811).

[0034] The present application solves the problem of quickly judging maturity in actual production, and the full-spectrum analysis is time-consuming and high in hardware cost. At the same time, it is found that the full-spectrum (256 wavebands) analysis needs high-performance computing support, and it is difficult to meet the real-time monitoring demand, and there is high-dimensional redundancy in some wavebands (such as 1400-1640nm), which may introduce noise.

[0035] The present application identifies 5 key feature wavebands (1060nm, 1228nm, 1335nm, 1460nm, 1620nm) through feature importance analysis (Permutation Importance), which correspond to C-H, O-H functional group vibration, and are directly related to lignin degradation and humus generation. The feature waveband is used to replace the full-spectrum modeling, so that the model operation speed is improved by 40%, and at the same time, high accuracy (classification recall rate > 96%, regression R 2 >0.88) is maintained, which lays a foundation for the development of low-cost online monitoring equipment.

[0036] The present application finds the correlation between key spectral features and maturity indicators, and for the first time finds that the reflectivity of 1335nm (C-H stretching vibration) and 1460nm (O-H stretching vibration) wavebands is significantly correlated (R 2 >0.9) with GI and C / N ratio, which can be used as a "fingerprint waveband" for rapid diagnosis of maturity, replacing traditional laboratory detection. Based on this, a hybrid framework of "feature waveband + ensemble learning" is proposed, which avoids the dependence on full-spectrum equipment and reduces the technical landing threshold. The innovative application of IMS index is confirmed by principal component sensitivity analysis, and the correlation between IMS and PCI (humus content) and PC3 (cellulose degradation) reaches 0.92, which can be directly predicted through hyperspectral data, solving the evaluation contradiction of traditional indicators (such as non-uniform C / N ratio threshold), making the maturity determination standard more objective. The robustness of extreme value is improved, and in the model verification stage, the inventors find that the prediction of RF to extreme samples (C / N > 22 or GI < 0.6) cannot (MRE = 0.015) be significantly lower than XGB (MRE = 0.025), and the reason is that the Bagging mechanism of RF reduces the influence of extreme values on the model. Therefore, RF is finally selected as the core model for classification and regression, ensuring the fault tolerance of abnormal samples in actual application.

[0037] Embodiment The experiment was conducted at Sichuan Agricultural University and its Chongzhou base. The experiment started on January 3, 2025 and ended on April 30, 2025. Fresh cow dung and straw were obtained from Sichuan Gang Food Co., Ltd. and Sichuan Agricultural University Chongzhou Base. According to previous studies, compost was prepared in a 100-liter reactor, and six different treatment methods were designed, with 3 parallel groups for each treatment method, and 3-4 tests for each group (error more than 5% test 4 times). The dry weight ratio of fresh straw to straw was 2:1. The temperature during composting and the ambient temperature were monitored three times a day, and the average value was recorded. After mixing, about 100 liters of each composting material was loaded into the reactor. Air was pumped from the bottom of the reactor using an automatic device, and the aeration rate was maintained at 0.3 liters per kilogram of dry matter per minute.

[0038] The hyperspectral reflectance data set of the compost samples (492 samples, including 6 groups of treatments, 3 repetitions), the original records of chemical indicators detection (GI, C / N ratio, etc.); Hyperspectral imaging system: black and white correction was used to eliminate light source unevenness and dark current interference (PTFE white board and black board were used); low signal-to-noise ratio bands were removed (the first 32 bands and the last 21 bands), and 203 effective bands (such as Figure 1 shown) were retained between 980-1660 nm. Through principal component analysis (PCA), the first 12 principal components (PCs) were extracted, retaining more than 95% of the variance information (such as Figure 2 shown). Data set division: 492 samples (6 groups x 3 repetitions x 9 sampling points x 3-4 times of spectral repetition) were randomly divided into a training set (392 samples) and a test set (100 samples) according to random_state=42, with IMS>0 as "mature" (label 1) and IMS≤0 as "immature" (label 0). The test results are shown in Table 1 (due to length, only the average values of all groups are shown).

[0039] Table 1. Test of indicators of each group and IMS results and maturity judgment As shown in Figure 3 , the classification performance of RF and XGB under different principal component numbers (1-12 PCs) is shown. The results show that when 4-5 PCs are used, the recall rate of RF reaches 96.30%, and the recall rate of XGB reaches 98.72%, verifying that the "feature compression + machine learning" method can efficiently realize maturity classification. Regression model training and key indicator prediction (such as Figure 4 , Figure 5Input features: top 5 PCs (cumulative variance >99%) were used as input to build RF and XGB regression models to predict IMS and key indicators (GI, C / N ratio), Model validation: five-fold cross-validation was used to evaluate MSE, MAE, R2, and compare errors of training, validation, and test sets, Figure 4 Figure 6 shows IMS prediction results.

[0040] RF (test set R2=0.771, MSE=0.0049) and XGB (test set R2=0.783, MSE=0.0046) had no significant overfitting, verifying the model's quantitative prediction ability for comprehensive maturity; Figure 5 Figure 7 shows single indicator prediction results. RF predicted C / N ratio with R2=0.931, and XGB predicted GI with R2=0.938, indicating that the model can accurately capture the dynamic changes of key physicochemical indicators during composting maturity. Model robustness and sensitivity analysis, Robustness test: IQR method (upper and lower bounds = Q1 ± 0.3 x IQR) was used to identify extreme samples to evaluate the model's prediction ability for outliers. Sensitivity analysis: Permutation Importance was used to calculate the impact of principal components on model output (R2 reduction ratio and standard deviation). End value prediction (e.g. Figure 6 Figure 7(a), Figure 6 Figure 7(b), and principal component sensitivity (e.g. Figure 6 Figure 7(c), Figure 6 Figure 7(d). RF had RMSE <0.05 in extreme value prediction, and was most sensitive to PC1 (humus) and PC3 (lignin) (std <8%), verifying the model's interference resistance and feature importance.

[0041] Through the above research, the inventors successfully constructed a complete technical chain of "hyperspectral imaging-machine learning-maturity evaluation", achieving rapid, non-destructive, and accurate detection of compost maturity, and providing core technical support for intelligent compost production.

[0042] Finally, it should be noted that the above examples are used to illustrate the technical solutions of the present application, but are not limiting; although the present application has been described in detail with reference to the foregoing examples, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing examples, or make equivalent substitutions for some technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for rapid assessment of compost maturity based on hyperspectral imaging and machine learning, characterized in that, Comprise: Step 1. Comprehensive index construction The key indicators of compost maturity screened in the compost samples, the C / N ratio, NH4 + -N, NO3 - The maturity indicators of N, GI are weighted as the comprehensive maturity IMS score; Step 2. Discrimination of maturity of compost samples Use RF and XGB models to realize maturity / immaturity binary classification. When the comprehensive maturity score IMS is greater than or equal to 0, it indicates that the compost has reached maturity, otherwise it is immature. Wherein, the maturity index C / N ratio, NH4 + -N, NO3 - -N, GI to the sample with RF and XGB prediction of integrated maturity score IMS is determined by the following formula: Yi represents the model actual value of the i-th maturity indicator, Weighti represents the weight of the i-th maturity indicator, and the weight is assigned by the analytic hierarchy process, Yi represents the statistical maturity threshold of the i-th maturity indicator; Step 3. Hyperspectral data acquisition and preprocessing Obtain the hyperspectral data of the compost samples in the 900-1700nm waveband in step 1, which covers the C-H and O-H functional group vibration information; black and white correction eliminates light source unevenness, and 32 low signal-to-noise ratio bands are proposed, and 203 effective bands are retained. Step 4. Feature extraction and dimensionality reduction The hyperspectral data in step 1 are reduced in dimension by principal component analysis, and 12 principal components are extracted. Step 5. Hyperspectral feature compression Through feature importance analysis of the 12 principal components in step 4, the first 5 principal components are identified, and the first 5 principal components contribute to the main variance. Step 6. Establishing a machine learning model for the spectrum S601. Assign key parameters to RF and XGB models through experimental verification and hyperparameter optimization, respectively. The parameters of the RF model are: The parameter settings of the RF model: the model type is from sklearn.ensemble import RandomForestRegressor, and the hyperparameters include n_estimators=200, max_depth=8, max_features='sqrt', min_samples_leaf=2, min_samples_split=5, bootstrap=True, and random_state=42.

2. Parameter settings of XGB model: model type is from sklearn.ensemble import xgboostRegressor, and hyperparameters include n_estimators=100, max_depth=3, learning_rate=0.05, subsample=0.8, colsample_bytree=0.8, gamma=0, and random_state=42.

3. S602. Training process and prediction The hyperspectral data obtained from the compost samples in step 3 were divided into training set and test set according to random number seed, and the first 5 principal components of the extracted 12 principal components were used in RF and XGB models for prediction, respectively obtaining C / N ratio, NH4 + -N, NO3 - -N, GI prediction value, and using C / N ratio, NH4 + -N, NO3 - -N, GI prediction value, and the value of comprehensive maturity score IMS was obtained by the following formula: Mpredi represents the model predicted value of the i-th maturity indicator, Weighti represents the weight of the i-th maturity indicator, which is assigned by the analytic hierarchy process, Mstat represents the statistical maturity threshold of the i-th maturity indicator Using the predicted C / N ratio and NH4 + -N, NO3 - -N, GI predicted values ​​and IMS values ​​compared with the C / N ratio and NH4+ actually measured in step 2. + -N, NO3 - A mapping relationship is established between the predicted values ​​of -N, GI, and the comprehensive maturity score IMS, thereby using the constructed spectral machine learning models RF and XGB to achieve maturity prediction.

4. The method of claim 1, wherein, In step 5, the 5 principal components are 1060nm, 1228nm, 1335nm, 1460nm, and 1620nm. Principal component PC1 reflects the overall change of humus, principal components PC2-PC4 capture the C-H lignin characteristic peak at 1335nm and the O-H humus hydroxyl characteristic peak at 1460nm, and principal component PC5 captures the O-H bending vibration at 1228nm and the O-H / C-H stretching vibration characteristic peak at 1420nm.

5. The method of claim 1, wherein, Step 2 and / or the step of calculating the formula in step S602 are as follows: first, determine the threshold value: the value of the model threshold is C / N ratio ≤ 19.10; GI ≥ 83.34%, NO3 - -N ≤ 0.50 g / kg, NH4 + -N ≥ 0.02 g / kg; then standardization: compare the model predicted value with the statistical threshold value, calculate the difference and normalize it to 0-1, and consider that higher than 0.8 is the index threshold; then weighted summation: add the normalized values after multiplying by their respective weights, the weight value of the model is GI 47.62%, C / N ratio 28.88%, NO3 - -N is 17.59%, NH4 + -N is 5.91%.

6. The method of claim 1, wherein, Step 6 also includes using grid search hyperparameters, 5-fold cross-validation, and PauTa criterion extreme value test to finally select RF as the core model as the spectral prediction model.

Citation Information

Patent Citations

  • Flue-cured tobacco maturity classification method and device

    CN119438096A

  • Method for realizing rapid composting based on prediction and reverse adjustment

    CN120260690A