A method and system for constructing a quality grading prediction model for pleurotus ostreatus fruiting bodies

CN122888596APending Publication Date: 2026-10-09JILIN AGRICULTURAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611204557.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-10
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

[0007]本发明缓解了现有平菇子实体品质分级预测模型技术存在对于激光处理后的平菇子实体无法实现快速、无损的监测与关联分析的问题

Benefits of technology

[0019]本发明所述的一种平菇子实体品质分级预测模型构建方法和系统是基于高光谱成像技术实现的,有效缓解了现有平菇子实体品质分级预测模型技术存在对于激光处理后的平菇子实体无法实现快速、无损的监测与关联分析的问题。具体有益效果包括:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122888596A_ABST
    Figure CN122888596A_ABST
Patent Text Reader

Abstract

A method and system for constructing a prediction model for grading the quality of Pleurotus ostreatus fruiting bodies, related to the field of digital data processing, alleviate the problem that the existing technology cannot achieve rapid and non-destructive monitoring and correlation analysis for Pleurotus ostreatus fruiting bodies after laser treatment. A method for constructing a prediction model includes: performing radiation correction on the hyperspectral image of the Pleurotus ostreatus fruiting body; based on the reflectivity of the corrected spectral image, extracting the effective area of the Pleurotus ostreatus fruiting body in the hyperspectral image to obtain the average spectral reflectivity of all pixels, and then combining them into original spectral data; pre-processing and screening the original spectral data to obtain characteristic bands; based on the characteristic bands and the corresponding quality grades, obtaining the weights of several basic models; and then performing POSV weighted soft voting integration on the several basic models to obtain the final prediction model for grading the quality of Pleurotus ostreatus fruiting bodies. The present application is suitable for the field of intelligent grading of edible fungi and precise regulation of light environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electronic digital data processing, and more specifically to the field of model building. Background Technology

[0002] Oyster mushrooms (Pleurotus ostreatus) are a mainstream cultivated edible fungus globally. Their complete growth cycle consists of three stages: mycelium, primordia, and mature fruiting bodies. Only the mature fruiting bodies possess commercial value. Composed of a cap, gills, and stipe, they are rich in polysaccharides, proteins, natural pigments, and other active substances, making them the sole criterion for market quality grading. The appearance and internal nutrition of the fruiting body directly determine its commercial grade. Traditional manual grading suffers from significant subjective bias and low efficiency, making it unsuitable for large-scale production.

[0003] The light environment is one of the key abiotic factors regulating the growth and development of edible fungi. In recent years, lasers, as a novel light source with good monochromaticity and concentrated energy, have attracted attention for their biostimulation effects in agriculture. Studies have shown that laser treatment at specific wavelengths can affect seed germination, seedling growth, and crop yield and quality. In the field of edible fungi, preliminary studies have explored the effects of different light qualities (including lasers) on growth and development stages such as mycelial growth and primordium differentiation. For example, some studies have found that short-term red and blue laser irradiation can promote mycelial growth; others have indicated that continuous irradiation with blue LEDs inhibits the mycelial growth of oyster mushrooms. These studies mainly focus on the biological effects of lasers on the growth process (mycelia, primordia) of edible fungi. Regarding the investigation of intrinsic material differences, traditional destructive chemical methods are often used for assessment, which cannot achieve rapid, non-destructive monitoring and correlation analysis.

[0004] Hyperspectral imaging technology, as a novel detection method integrating spectral analysis and image information, can simultaneously acquire the spatial and spectral information of the object being measured. It has been widely applied to detect the internal quality and external defects of agricultural products such as fruits, vegetables, grains, and meats. In the field of edible fungi, studies have used this technology to monitor the storage quality degradation of button mushrooms, detect browning in mushrooms, and analyze the moisture distribution during the drying process of shiitake mushrooms. These applications demonstrate that hyperspectral imaging technology can effectively capture changes in physical properties (such as color and texture) and chemical fundamentals (such as moisture and cell structure) closely related to the quality of edible fungi.

[0005] Mature oyster mushroom fruiting bodies inherently possess characteristics such as irregular morphology, uneven cap thickness, strong surface scattering interference, and overlapping spectral signals of pigments and polysaccharides. Superimposed laser irradiation further alters the pigment deposition on the surface of the fruiting body and the internal nutrient distribution, significantly increasing the heterogeneity of spectral data and drastically increasing the difficulty of extracting characteristic bands. At the same time, the high-dimensional spectra of the fruiting body exhibit multicollinearity, making it easy for single machine learning models to overfit and have poor generalization ability in grading. Therefore, few studies have explored quality grading of oyster mushroom fruiting bodies after laser irradiation.

[0006] In summary, existing research on laser irradiation of edible fungi only focuses on the early development of mycelium and primordia and relies on destructive chemical detection. Although hyperspectral imaging can non-destructively characterize the quality of edible fungi, laser irradiation of oyster mushroom fruiting bodies has technical challenges such as mixed spectral signals and overfitting in high-dimensional modeling, making it difficult to perform non-destructive quality grading for laser-treated oyster mushroom fruiting bodies. Summary of the Invention

[0007] This invention alleviates the problem that existing oyster mushroom fruiting body quality grading prediction models cannot achieve rapid and non-destructive monitoring and correlation analysis of oyster mushroom fruiting bodies after laser treatment.

[0008] This invention provides the following solution: Option 1: A method for constructing a predictive model for the quality grading of oyster mushroom fruiting bodies, comprising the following stages: During the data acquisition phase, a sample set is obtained, which includes hyperspectral images of oyster mushroom fruiting bodies and their corresponding quality grades. In the spectral data extraction stage, radiometric correction is performed on the hyperspectral image to obtain the reflectance of the corrected spectral image; based on the reflectance of the corrected spectral image, the effective region of the oyster mushroom fruiting body in the hyperspectral image is extracted to obtain the average spectral reflectance of all pixels, and then combined into the original spectral data; In the data processing stage, the raw spectral data is preprocessed and filtered to obtain characteristic bands; In the model building phase, a training set is obtained based on the feature bands and their corresponding quality levels; several basic models are trained based on the training set to obtain the corresponding macro-average F1 scores; and the corresponding basic model weights are obtained based on the macro-average F1 scores of the several basic models. Based on the basic model weights of the aforementioned basic models, POSV weighted soft voting integration is performed on the aforementioned basic models to obtain the final oyster mushroom fruit body quality grading prediction model.

[0009] Furthermore, in one embodiment of the present invention, the preprocessing in the data processing stage includes mean centering and Z-score normalization.

[0010] Furthermore, in one embodiment of the present invention, the filtering method in the data processing stage is as follows: The preprocessed raw spectral data are used to obtain corresponding feature band subsets through several feature selection methods; the feature selection methods are scored by a nested cross-validation composite scoring method, and the feature band subset of the feature selection method with the highest score is taken as the candidate feature band. Based on the feature selection interval, the candidate feature bands are subjected to 5-fold nested cross-validation to obtain the feature bands.

[0011] Furthermore, in one embodiment of the present invention, the plurality of feature selection methods include the PLS-VIP variable projection importance method, the CARS method, the SPA method, and the Fisher Score method.

[0012] Furthermore, in one embodiment of the present invention, the feature filtering interval is (20, 40).

[0013] Furthermore, in one embodiment of the present invention, the plurality of basic models in the model building stage include an SVM model, a LightGBM model, and an MLP model.

[0014] Furthermore, in one embodiment of the present invention, during the model building stage, the formula for the POSV weighted soft voting integration is:

[0015] in, Quality grade The predicted probability, The number of the aforementioned basic models. For the first The base model weights of each base model For the first The quality levels of the basic models The predicted probability.

[0016] Option 2: A system for constructing a prediction model for the quality grading of oyster mushroom fruiting bodies, the system comprising the following modules: The data acquisition module is used to obtain a sample set, which includes hyperspectral images of oyster mushroom fruiting bodies and their corresponding quality grades. The spectral data extraction module is used to perform radiometric correction on the hyperspectral image to obtain the reflectance of the corrected spectral image; based on the reflectance of the corrected spectral image, the effective region of the oyster mushroom fruiting body in the hyperspectral image is extracted to obtain the average spectral reflectance of all pixels, and then combined into the original spectral data. The data processing module is used to preprocess and filter the raw spectral data to obtain characteristic bands; The model building module is used to obtain a training set based on the feature bands and the corresponding quality levels; to train several basic models based on the training set to obtain the corresponding macro-average F1 scores; and to obtain the corresponding basic model weights based on the macro-average F1 scores of the several basic models. It is also used to perform POSV weighted soft voting integration on the several basic models based on the basic model weights of the several basic models to obtain the final oyster mushroom fruit body quality grading prediction model.

[0017] Option 3: An electronic device, comprising a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus; Memory, used to store computer programs; When a processor executes a computer program stored in memory, it implements the method described in Scheme 1.

[0018] Option 4: A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the method described in Option 1.

[0019] The present invention discloses a method and system for constructing a quality grading prediction model for oyster mushroom fruiting bodies, based on hyperspectral imaging technology. This effectively alleviates the problem of existing oyster mushroom fruiting body quality grading prediction models being unable to achieve rapid and non-destructive monitoring and correlation analysis of oyster mushroom fruiting bodies after laser treatment. Specific beneficial effects include: 1. The method for constructing a quality grading prediction model for oyster mushroom fruiting bodies described in this invention provides a different technical concept for predicting the quality of oyster mushroom fruiting bodies under laser treatment. Existing technologies mostly focus on predicting single quality indicators or detecting diseases, lacking a method based on hyperspectral imaging that can comprehensively reflect multiple quality characteristics of oyster mushrooms and achieve accurate grade discrimination. The current technological status quo has two gaps: first, the application of hyperspectral imaging technology in the intelligent grading of comprehensive post-harvest quality of oyster mushrooms needs further development; for oyster mushrooms subjected to bio-regulation with specific wavelength lasers, there is a lack of detection methods that can simultaneously achieve non-destructive, rapid, and accurate grading of their post-harvest appearance and commercial quality, and correlate with the response of internal metabolites; second, there is a lack of rapid and non-destructive analytical methods for the impact of laser treatment on the quality of oyster mushroom fruiting bodies. Therefore, how to deeply analyze the characteristic spectral bands selected by the model, construct an accurate quality grading model, and then reverse-analyze and infer the key internal metabolites (such as pigments, polysaccharides, proteins, etc.) that may be affected by different laser treatments is a technical challenge in this field.

[0020] This invention fills a technological gap by establishing a post-harvest quality grading model for oyster mushrooms using hyperspectral imaging technology. Furthermore, analysis of the model's selected characteristic bands reveals their correlation with quality grades under different laser treatments. This invention combines hyperspectral imaging with machine learning to achieve oyster mushroom quality grading, and spectral-metabolite correlation analysis reveals the laser-induced quality regulation patterns. 2. The method for constructing a quality grading prediction model for oyster mushroom fruiting bodies described in this invention, if only using hyperspectral technology combined with machine learning to predict the quality of oyster mushroom fruiting bodies, has the following problems: First, under the condition of "high-dimensional and small sample" hyperspectral data, single machine learning models (such as SVM, LightGBM, MLP) are prone to overfitting or underfitting, resulting in poor generalization ability and insufficient stability of hierarchical models. Second, traditional model ensemble methods (such as equal-weighted voting) cannot adaptively evaluate and integrate the advantages of different structural models, have limited discrimination accuracy on complex classification boundaries, and cannot provide highly reliable feature evidence for mechanism analysis.

[0021] This invention provides a refined, closed-loop technical solution, encompassing eight interconnected and progressive steps: sample collection and labeling, spectral data preprocessing, feature band optimization, dataset construction, heterogeneous model training, weighted ensemble modeling, quality grading inference, and metabolite correlation analysis. Each step is designed to address the output problem of the preceding step, ensuring a seamless data flow. This achieves high-precision grading while simultaneously allowing for the reverse derivation of the regulatory mechanisms of laser light quality on oyster mushroom metabolite accumulation. It overcomes the technical bottlenecks in existing oyster mushroom quality detection and laser regulation research. Based on the innovative POSV ensemble algorithm, it eliminates the need for chemical detection and sample loss, enabling rapid three-level classification of oyster mushroom quality after harvest, and achieving multiple improvements in detection accuracy, stability, and mechanistic analysis capabilities.

[0022] This invention achieves a grading accuracy and F1 score of 87% on the test set. Compared with the shortcomings of traditional manual grading, which is characterized by strong subjectivity, low efficiency and large error, it significantly improves the level of grading standardization and intelligence, and is suitable for large-scale edible fungi production and sorting scenarios.

[0023] Furthermore, this invention uses oyster mushroom fruiting bodies cultivated with red and blue lasers as the object, and utilizes spectral reflectance information to construct a dedicated discrimination model to achieve batch non-destructive and accurate grading, providing reliable technical support for the standardized sorting of edible fungi.

[0024] 3. The method for constructing a quality grading prediction model for oyster mushroom fruiting bodies described in this invention employs the POSV ensemble algorithm, which has the following advantages: Heterogeneous models complement each other, completely solving the fitting defects of single models. Traditional spectral modeling often uses a single SVM, LightGBM, or MLP algorithm, which has obvious limitations: LightGBM is prone to overfitting the training set and poor generalization ability; SVM and MLP suffer from underfitting and insufficient feature mining. This invention integrates the advantages of three types of heterogeneous models, and balances model bias and variance through adaptive dynamic weighting. The final model's training F1 and testing F1 difference is only 0.03, which is at the optimal fitting state, without overfitting or underfitting problems, and its generalization stability is significantly better than traditional algorithms.

[0025] The dynamic weighted soft voting mechanism improves the accuracy of classification. Compared with the shortcomings of traditional hard voting, which has fixed voting and cannot distinguish the differences in model performance, this invention dynamically allocates model weights using cross-validation F1 scores, allowing the better-performing model to dominate the decision-making process. At the same time, it retains the probability information of the entire model, smooths the discrimination bias of a single model, significantly reduces the misclassification rate of adjacent-level mushrooms, and almost eliminates cross-level misclassification, greatly improving the balance and accuracy of classification.

[0026] The algorithm is robust and highly reproducible. This invention uses a fixed random seed throughout the process, unified cross-validation rules and parameter optimization criteria, and a sample balancing and overfitting penalty mechanism. The model is unaffected by sample distribution or minor spectral noise interference, and is adaptable to the detection of oyster mushroom samples from different batches and cultivation environments. Its versatility and engineering feasibility are far superior to traditional single models, and it can be widely applied to various edible fungi hyperspectral non-destructive grading tasks.

[0027] This invention belongs to the interdisciplinary technology of non-destructive testing of agricultural products and smart agriculture. It is applicable to the field of intelligent grading of edible fungi and precise control of light environment, and provides a theoretical basis and technical solution for intelligent grading of edible fungi and precise control of light environment. Attached Figure Description

[0028] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 This is a flowchart of a method for constructing a quality grading prediction model for oyster mushroom fruiting bodies as described in Implementation Method 1; Figure 2 This is a schematic diagram of the quality grades described in Implementation Method 1, wherein (a) is Special Grade, (b) is Grade 1, and (c) is Grade 2; Figure 3 This is a bar chart comparing the proportions of premium, first-grade, and second-grade oyster mushroom samples under light-free control (ck group), red laser, and blue laser treatment, as described in Implementation Method 1. Figure 4 This is a schematic diagram of the confusion matrix described in Implementation Method Nine; Figure 5 This is a comparison diagram of the different spectral preprocessing methods described in Implementation Method Nine; Figure 6 This is the result diagram of the PLS-VIP characteristic band screening described in Implementation Method Nine; Figure 7 This is a diagram showing the SPA characteristic band screening results as described in Implementation Method Nine; Figure 8 This is the Fisher Score feature band screening result diagram described in Implementation Method Nine; Figure 9This is a diagram showing the results of the CARS feature band screening described in Implementation Method Nine. Detailed Implementation

[0029] Various embodiments of the present invention will now be clearly and completely described with reference to the accompanying drawings. The embodiments described with reference to the drawings are exemplary and intended to explain the present invention, and should not be construed as limiting the present invention.

[0030] Implementation Method 1: The method for constructing a grading prediction model for the fruiting bodies of *Pleurotus ostreatus* as described in this implementation method includes the following stages: During the data acquisition phase, a sample set is obtained, which includes hyperspectral images of oyster mushroom fruiting bodies and their corresponding quality grades. In the spectral data extraction stage, radiometric correction is performed on the hyperspectral image to obtain the reflectance of the corrected spectral image; based on the reflectance of the corrected spectral image, the effective region of the oyster mushroom fruiting body in the hyperspectral image is extracted to obtain the average spectral reflectance of all pixels, and then combined into the original spectral data; In the data processing stage, the raw spectral data is preprocessed and filtered to obtain characteristic bands; In the model building phase, a training set is obtained based on the feature bands and their corresponding quality levels; several basic models are trained based on the training set to obtain the corresponding macro-average F1 scores; and the corresponding basic model weights are obtained based on the macro-average F1 scores of the several basic models. Based on the basic model weights of the aforementioned basic models, POSV weighted soft voting integration is performed on the aforementioned basic models to obtain the final oyster mushroom fruit body quality grading prediction model.

[0031] In this embodiment, the data acquisition stage also includes the process of obtaining a sample set. The sample set is obtained from experimental samples obtained through laser-controlled cultivation experiments, with strict control over sample consistency and labeling accuracy. The experiment included three cultivation treatments: blue laser (450 nm), red laser (660 nm), and a no-light control (CK). A uniform cultivation environment was maintained at 20℃ and 80%–90% relative humidity. The laser treatment group received a fixed irradiation for 12 hours daily. Oyster mushrooms were harvested after they matured and exhibited typical morphological characteristics. Damaged, deformed, and diseased samples were discarded, retaining only high-quality fruiting bodies with intact morphology. Figure 3 As shown, blue laser can significantly increase the proportion of premium oyster mushrooms, red laser is more likely to produce secondary oyster mushrooms, and the blank group is mainly composed of primary oyster mushrooms. Different wavelengths of laser induce significant differentiation in the quality of oyster mushrooms.

[0032] Based on the national standard GB / T 23189-2025 "Standard for Grading the Quality of Oyster Mushrooms", the collected samples were manually divided into three quality grades: premium, grade one, and grade two, and the sample categories were labeled. A total of 1065 valid oyster mushroom samples were collected, and the corresponding laser cultivation treatment group for each sample was recorded simultaneously, providing sample support for subsequent spectral modeling, grade distribution statistics, and laser-metabolite correlation analysis.

[0033] The quality level is as follows Figure 2 As shown, (a) the cap edge of the premium mushroom is rolled inward and the flesh is thick; (b) the cap edge of the first grade mushroom is slightly open and the flesh is relatively thick; (c) the cap edge of the second grade mushroom is thinner and the flesh is thin. All three types of mushrooms have the natural color of oyster mushrooms and no abnormal discoloration.

[0034] In this embodiment, during the data acquisition phase, the sample set is acquired using the SPECIM-IQ hyperspectral imaging system. The system has a wavelength coverage of 400–1000 nm, a total of 204 continuous bands, and a spectral resolution of 7 nm. The equipment is preheated for 30 minutes before acquisition to ensure stability.

[0035] In this embodiment, during the spectral data extraction stage, the radiometric correction is a standard black and white plate radiometric correction, used to eliminate system noise, dark current interference, and uneven illumination.

[0036] The formula for radiation correction of the standard black and white board is:

[0037] in, The reflectance of the corrected spectral image, For hyperspectral images, This is a blackboard reference image. This is a reference image for the whiteboard.

[0038] In this embodiment, the raw spectral data is saved in ASCII format.

[0039] In this embodiment, during the model construction phase, the training set is partitioned using a stratified random sampling strategy. The 1065 preprocessed valid samples are divided into a training set and an independent test set in a 7:3 ratio, with 745 samples in the training set and 320 samples in the test set. The class distribution ratio of top-level, first-level, and second-level samples in the original data is strictly preserved. This ensures consistency in data distribution between model training and testing, avoiding evaluation distortion caused by class bias. A fixed random seed RANDOM_SEED=42 is used to ensure the reproducibility of the dataset partitioning process; a balanced sample weight strategy is also introduced. The class-balanced sample weight calculation function (compute_sample_weight) automatically allocates training weights according to the sample size of each level, which alleviates the training bias caused by the uneven distribution of oyster mushroom special grade, first grade, and second grade samples, reduces the model's fitting bias to the higher sample proportion level, and improves the recognition effect of niche level sub-entities.

[0040] The method for constructing a quality grading prediction model for oyster mushroom fruiting bodies described in this embodiment progressively selects the optimal data processing strategy through a series of stages: data acquisition, spectral data extraction, data processing, and model construction. Addressing the inherent characteristics of oyster mushroom fruiting bodies—irregular morphology, uneven cap thickness, strong surface scattering interference, overlapping spectral signals of pigments and polysaccharides, and the further exacerbation of spectral confounding by laser irradiation—this method, while fully preserving the characteristic spectral information corresponding to core metabolites such as pigments, polysaccharides, and proteins, eliminates 92.8% of redundant bands and noise interference. It effectively resolves the baseline drift problem of the original spectrum caused by surface scattering and thickness differences, significantly improving the inter-class discrimination of oyster mushroom fruiting body spectra of different grades, while also significantly reducing model computation costs and mitigating the overfitting defects of a single model caused by multicollinearity in high-dimensional spectra. This provides a standardized data processing paradigm for high-spectral precision grading modeling of edible fungi fruiting bodies under laser regulation.

[0041] Implementation Method 2: This implementation method further defines the method for constructing a grading prediction model for the fruiting body of Pleurotus ostreatus as described in Implementation Method 1. In this implementation method, the preprocessing in the data processing stage includes mean centering and Z-score standardization.

[0042] In this embodiment, mean centering is achieved by subtracting the band mean from the data of each band, thereby eliminating common baseline interference and spectral differences between magnification levels.

[0043] In this embodiment, the formula for Z-score standardization is:

[0044] in, The standardized single-band spectral reflectance value, For the raw spectral data, This represents the mean of single-band spectral data. This represents the standard deviation of single-band spectral data.

[0045] This implementation scheme designs a mean-centering combined with Z-score standardization preprocessing scheme to address the inherent characteristics of oyster mushroom fruiting bodies: Oyster mushroom fruiting bodies have problems such as uneven cap thickness and large differences in surface scattering, which will cause an overall baseline shift across the entire spectrum. Mean centering can subtract the average reflectance baseline of the sample for each band, eliminating the uniform background shift caused by mushroom thickness and scattering. At the same time, the reflectance amplitudes of different spectral bands vary greatly, and the numerical dimensions of each band are not uniform. Direct modeling will naturally give higher weights to high-amplitude bands. Z-score standardization completes independent scaling of each band based on the global mean and standard deviation of the training set, unifying the dimensions of all spectral features and ensuring fair allocation of feature weights during modeling. This preprocessing method addresses the defects of baseline drift, random noise, and dimensional imbalance in the original spectrum by focusing on the physical structure and spectral numerical distribution characteristics of the mushroom body. It can amplify the inter-class spectral differences among premium, first-grade, and second-grade oyster mushrooms, maximizing the distinguishability of spectral features among different quality grades. This implementation method was tested using 13 mainstream preprocessing schemes as control experiments. A comprehensive scoring system was constructed using inter-class Euclidean distance, profile coefficient, and JM distance to verify the optimal performance. The mean centering + Z-score combination preprocessing based on spectral feature matching of oyster mushroom fruiting bodies demonstrated the best overall performance.

[0046] Implementation Method 3: This implementation method further defines the method for constructing a grading prediction model for the fruiting body quality of *Pleurotus ostreatus* described in Implementation Method 1. In this implementation method, the screening method in the data processing stage is as follows: The preprocessed raw spectral data are used to obtain corresponding feature band subsets through several feature selection methods; the feature selection methods are scored by a nested cross-validation composite scoring method, and the feature band subset of the feature selection method with the highest score is taken as the candidate feature band. Based on the feature selection interval, the candidate feature bands are subjected to 5-fold hierarchical nested cross-validation to obtain the feature bands.

[0047] In this embodiment, the nested cross-validation composite scoring method is as follows: The feature band subsets obtained from the various feature selection methods are input into the hierarchical model, and a 5-fold hierarchical nested cross-validation method is used for evaluation to obtain the corresponding composite score. The hierarchical model is a POSV hierarchical model with preset weights.

[0048] In this embodiment, the nested cross-validation composite scoring method is the validation set macro average F1 value minus the overfitting penalty term.

[0049] This implementation further refines the data processing stage and details the hyperspectral feature band selection process. This scheme addresses the inherent physicochemical optical characteristics of *Pleurotus ostreatus* fruiting bodies, such as uneven cap thickness, strong surface scattering interference, and overlapping spectra of quality metabolites like melanin, polysaccharides, and proteins. It specifically tackles the problems of dimensionality explosion, excessive redundant noise, and the curse of dimensionality across the entire hyperspectral spectrum. Compared to existing studies that rely solely on internal algorithm indicators for band selection without considering the generalization effect of the grading model, where the number of bands is determined manually based on experience and no overfitting penalty mechanism is implemented, resulting in features that fail to balance class discrimination and stable model generalization performance, this implementation simultaneously compares several feature selection methods. It utilizes the POSV grading model with a 5-fold hierarchical nested cross-validation composite score selection method. Therefore, it can accurately eliminate invalid noise bands, significantly reduce the computational cost of the grading model, retain feature spectra strongly correlated with the quality of *Pleurotus ostreatus* fruiting bodies, alleviate single-model overfitting, and improve the generalization accuracy of the laser-irradiated non-destructive grading model for *Pleurotus ostreatus*.

[0050] Implementation Method 4: This implementation method further defines the method for constructing a grading prediction model for the fruiting body of Pleurotus ostreatus as described in Implementation Method 3. In this implementation method, the various feature selection methods include the PLS-VIP variable projection importance method, the CARS method, the SPA method, and the Fisher Score method.

[0051] In this embodiment, the core calculation formula of the PLS-VIP variable projection importance method is:

[0052] in, For the first The importance score of variables for each band, Total number of bands The number of latent variables in the PLS model. For the first Y-loading of a latent variable, For the first X score of each latent variable For the first The band in the first The weight coefficients of each latent variable.

[0053] The higher the VIP value, the stronger the correlation between that band and the quality grade of oyster mushrooms.

[0054] This implementation further defines the data processing stage and explains the feature selection method. Oyster mushroom caps exhibit strong scattering interference, and the absorption peaks of polysaccharides and melanin overlap. A single selection strategy is prone to losing key metabolic features or retaining redundant bands. Therefore, four algorithms—PLS-VIP, SPA, CARS, and Fisher Score—were selected for horizontal comparison. Fisher Score relies solely on single-band variance selection, lacks collinearity constraints, and easily retains a large number of overlapping spectra. SPA simplifies variables through orthogonal projection but easily loses weakly discriminative bands. CARS iteratively retains high-weight features, but its large candidate set size easily introduces noise. PLS-VIP, based on partial least squares modeling, directly correlates the oyster mushroom quality grade label to calculate band contributions, automatically weakening highly collinear redundant spectra and accurately locking onto effective features such as pigments and polysaccharides. The four algorithms form complementary selection logics. Using 5-fold nested cross-validation for composite score quantification comparison, the results show that PLS-VIP has the best fit with the grading model, preserving subtle spectral differences in oyster mushroom grades while suppressing the curse of dimensionality, significantly improving the discrimination accuracy and model generalization stability of niche mushroom samples.

[0055] Implementation Method 5: This implementation method further defines the method for constructing the oyster mushroom fruit body quality grading prediction model described in Implementation Method 3. In this implementation method, the feature selection interval is (20, 50).

[0056] This implementation further defines the data processing stage, explaining the feature selection interval. This interval was specifically designed for this study to address the technical challenges of band redundancy and noise in oyster mushroom hyperspectral data. The rationale for this setting is as follows: selecting fewer than 20 features will result in the loss of key discrimination bands corresponding to pigments, polysaccharides, and proteins, leading to insufficient information for grade differentiation and potential underfitting; selecting more than 50 features will introduce a large number of irrelevant noise bands, exacerbating the curse of dimensionality and making the model prone to overfitting. This study uses a 5-fold hierarchical nested cross-validation to traverse all feature counts from 20 to 50, using the composite score of the validation set F1 score minus the overfitting penalty term as the evaluation criterion. The number of bands within the interval can maximize the removal of redundant information while preserving the core spectra for oyster mushroom quality discrimination, balancing the data dimensionality reduction effect with the model's generalization ability.

[0057] Implementation Method Six: This implementation method further defines the method for constructing a quality grading prediction model for mushroom fruit bodies described in Implementation Method One. In this implementation method, the several basic models in the model construction stage include a Support Vector Machine (SVM) model, a Lightweight Gradient Boosting Machine (LightGBM) model, and a Multilayer Perceptron (MLP) model.

[0058] In this implementation, the optimal hyperparameters of each model are found through grid search (GridSearchCV), and stratified K-fold cross-validation (5-fold K-fold) and macro-average F1 score are used as evaluation metrics. The specific model training configuration is as follows: The SVM model employs the RBF kernel function, enables probability output mode, sets the hyperparameter search range to C=[1,2,5,10] and gamma=['scale',0.005,0.01,0.05], introduces balanced class weights, adapts to small sample nonlinear classification scenarios, and accurately captures the nonlinear boundary features of spectral data.

[0059] The LightGBM model, with its maximum decision tree depth [7,9,11], learning rate [0.05,0.08,0.1], and number of iterations [200,300], coupled with L1 and L2 regularization coefficients to suppress overfitting, excels at uncovering the interactive correlations and implicit patterns of high-dimensional spectral features.

[0060] The MLP model has a multi-layer hidden layer structure [(128,),(256,),(128,64),(256,128)], uses ReLU / Tanh as the activation function, enables early stopping, has a maximum number of iterations of 3000, and has the ability to perform deep feature abstraction and fine fitting.

[0061] All model training is configured with parallel computing resources in a unified manner, with 16 cores of computing power and 2 parallel tasks to maximize training efficiency. At the same time, a fixed random seed is used to ensure that the model training results are reproducible.

[0062] This implementation further defines the model construction phase, explaining several basic models. This method selects three heterogeneous complementary models—SVM, LightGBM, and MLP—as basic learners. These three models correspond to three independent machine learning paradigms: maximum margin classification, gradient boosting decision tree, and deep neural network, respectively. Their structural differences enable complementary feature information. Considering the characteristics of oyster mushrooms—uneven cap thickness, strong scattering noise, highly overlapping pigment, polysaccharide, and protein spectral signals, and subtle spectral differences between grades—SVM constructs a high-dimensional margin hyperplane using kernel functions to adapt to the nonlinear spectral distribution of the mushroom body; LightGBM efficiently mines the band-interactive absorption features corresponding to metabolites; and MLP uses deep networks to extract subtle spectral differences. These three models capture oyster mushroom grade discrimination information from different dimensions, avoiding the shortcomings of single models that are biased towards the majority of samples and prone to overfitting and underfitting. This provides multivariate probability inputs for subsequent adaptive weighted soft voting ensemble, balancing model bias and variance, and improving the generalization stability of laser-treated oyster mushrooms across sample grades.

[0063] Implementation Method Seven: This implementation method further defines the method for constructing a grading prediction model for the fruiting body quality of *Pleurotus ostreatus* described in Implementation Method One. In this implementation method, the formula for the POSV weighted soft voting integration during the model construction stage is:

[0064] in, Quality grade The predicted probability, The number of the aforementioned basic models. For the first The base model weights of each base model For the first The quality levels of the basic models The predicted probability.

[0065] In this embodiment, the first The base model weights of each base model The formula is:

[0066] in, For the first The cross-validation macro-average F1 score of the basic models.

[0067] The cross-validation macro-average F1 score The macro-average F1 score of the three base models on the training set was obtained through 5-fold cross-validation.

[0068] In this embodiment, the minimum value of the basic model weight is set to 0.1 to avoid the failure of a single model due to excessively low weight.

[0069] In this embodiment, the number of the plurality of basic models Preferably, option 3 is used, and the plurality of basic models include the SVM model, the LightGBM model, and the MLP model.

[0070] This implementation further defines the model construction stage and explains the POSV weighted soft voting ensemble. This method constructs a POSV (SVM+LightGBM+MLP) weighted soft voting ensemble model, using the oyster mushroom quality grade corresponding to the highest probability after weighted fusion of each category as the final discrimination result to complete the grade prediction. This scheme abandons the traditional voting method of manually setting fixed weights and innovatively adopts an adaptive dynamic weighting mechanism based on the macro F1 score of 5-fold hierarchical cross-validation. Each basic model outputs the predicted probability of oyster mushrooms for three quality categories: premium, first-grade, and second-grade. The probability fusion of multiple models is achieved by weighted summation of category probabilities based on cross-validation performance weights. Combining the inherent characteristics of oyster mushrooms—variable cap thickness, overlapping pigment and polysaccharide spectral signals, and weak spectral differentiation between high and low-grade samples—this approach fully integrates the advantages of the three models and compensates for the identification bias of a single algorithm. SVM excels at capturing the nonlinear spectral boundaries of mushrooms, LightGBM can uncover the interaction patterns of metabolite association features, and MLP has a strong ability to abstract subtle spectral differences. The three complement each other to effectively avoid the defects of a single model overfitting to niche premium samples of oyster mushrooms and underfitting to secondary samples, balance model bias and variance, and significantly improve the stability of cross-sample non-destructive grading of oyster mushroom fruiting bodies in different laser treatment groups and the generalization accuracy of the test set.

[0071] Implementation Method Eight: This implementation method further defines the method for constructing a oyster mushroom fruiting body quality grading prediction model as described in Implementation Method One. In this implementation method, the method further includes a model performance evaluation and optimal model solidification stage. The model performance was evaluated using multiple dimensions, including accuracy, precision, recall, macro-average F1 score, and Kappa coefficient. The fitting status and generalization ability of single-model, dual-model ensemble, and three-model POSV ensemble were compared. The model status was determined by the fitting difference (training F1 - test F1): a difference ≤0.05 indicates normal fitting, 0.05–0.1 indicates slight overfitting, and ≥0.1 indicates severe overfitting.

[0072] The POSV ensemble model with the best performance on the test set and the most stable fitting state was selected. The model weights, feature bands, and standardized parameters were fixed, and the model file, scaler parameters, and feature index were saved to realize the lightweight implementation of the oyster mushroom quality grading model.

[0073] Implementation Method Eight: This implementation method further defines the method for constructing a grading prediction model for oyster mushroom fruiting bodies described in Implementation Method One. In this implementation method, the method further includes a stage for analyzing the correlation between spectral and metabolite characteristics and the laws governing laser modulation. Based on 35 core characteristic bands screened using the POSV model, and combined with spectral response mechanisms and existing literature, the regulatory effect of laser on oyster mushroom metabolites was deduced in reverse. The characteristic bands were divided into two core regions: the visible light region (400–500 nm) and the near-infrared region (700–1000 nm). Differences in reflectance in the visible light region correspond to the accumulation levels of carotenoids, melanin, and flavonoids in oyster mushrooms; the 800 nm trough in the near-infrared region corresponds to the characteristic absorption of polysaccharides, and the 950–1000 nm range corresponds to the absorption characteristics of nutrients such as proteins and water.

[0074] By combining the differences in spectral reflectance gradients and the distribution patterns of quality grades among different laser treatment groups, it was found that: blue laser can promote the synthesis and accumulation of pigments, polysaccharides, and proteins in oyster mushrooms, increasing the proportion of premium grade products; red laser has a weak promoting effect on nutrient synthesis and inhibits cap development; the CK group had no laser induction and the overall level of metabolite accumulation was relatively low, thus realizing a closed-loop correlation between cultivation light environment, metabolite changes, and post-harvest quality grades.

[0075] This implementation method further refines the method for constructing a predictive model for the quality grading of oyster mushroom fruiting bodies. It elucidates the stages of analyzing the correlation between spectral density and metabolites and the dynamic regulation of laser light, thus breaking down the barriers between cultivation regulation and post-harvest quality. Existing technologies only conduct separate observations of laser-induced cultivation phenotypes or post-harvest spectral grading, failing to establish an intrinsic correlation. This implementation method relies on the spectral mechanisms of metabolites corresponding to characteristic wavelength bands, using hyperspectral data to infer the regulatory mechanisms of laser light quality on core metabolites such as pigments, polysaccharides, and proteins in oyster mushrooms. It clarifies the superior regulatory effect of blue laser light, filling a research gap in the intrinsic mechanism of laser regulation of oyster mushroom quality and providing theoretical support for the precise and targeted regulation of the light environment for edible fungi.

[0076] Implementation Method Nine: The method for constructing the oyster mushroom fruit body quality grading prediction model described in this implementation method is based on the method for constructing the oyster mushroom fruit body quality grading prediction model described in Implementation Method One, combined with the optimized methods from Implementation Methods Two to Eight.

[0077] In this embodiment, such as Figure 4 The figure shows the accuracy of the POSV model based on PLS-VIP feature selection in distinguishing three quality grades of oyster mushrooms on the test set. The correct discrimination rates for the Special, First, and Second grades of oyster mushrooms reached 89%, 86%, and 85%, respectively, with extremely low misclassification rates for each type of sample. This proves that the POSV model constructed in this invention, after PLS-VIP feature selection, has a high accuracy in distinguishing the three quality grades of oyster mushrooms and has excellent detection and differentiation effects.

[0078] In this embodiment, as shown in Table 1, a comparison table of the grading performance indicators of different single-model, dual-model, and POSV models under PLS-VIP feature selection on the training and test sets is presented. It can be seen that after PLS-VIP feature selection, compared with single LightGBM, SVM, MLP models and any combination of two types of dual models, the SVM+LightGBM+MLP weighted soft voting POSV ensemble model constructed in this invention achieves the best test set accuracy and F1 score (test set accuracy 0.87, F1 score 0.87), and the model has stronger generalization and discrimination performance. This proves that the multi-model ensemble strategy of this invention can effectively improve the accuracy of oyster mushroom quality grading.

[0079]

[0080] In this embodiment, such as Figure 5 The image shows a horizontal bar chart comparing the comprehensive discrimination scores of different spectral preprocessing methods. The vertical axis represents the 14 oyster mushroom spectral preprocessing correction methods, and the horizontal axis represents the comprehensive discrimination score, which is calculated by weighting the average Euclidean distance, profile coefficient, and average JM distance. The right side of the bars is simultaneously labeled with the values ​​of three sub-evaluation indicators for a direct comparison of the separation effects of various preprocessing methods on the spectra of premium, first-grade, and second-grade oyster mushroom samples. The results show that the MC + Z-score (mean centering + Z-score normalization) comprehensive score of 0.998 ranks first among all preprocessing schemes, demonstrating the best ability to distinguish the spectra of oyster mushrooms of different qualities.

[0081] In this embodiment, such as Figures 6 to 9 The images shown represent the results of PLS-VIP, SPA, Fisher Score, and CARS feature band selection, respectively. In the PLS-VIP feature band selection result image, the blue curve represents the average reflectance spectrum of the oyster mushroom group samples, and the red scatter points represent the 35 key characteristic wavelengths for quality grading obtained by the PLS-VIP algorithm. The images also mark the band positions within the 400-1000 nm range that contribute the most to the discrimination of oyster mushrooms into premium, first-grade, and second-grade grades.

[0082] In the SPA feature band screening results diagram, the blue curve is the average reflectance spectrum of the oyster mushroom group samples, and the red scatter points are the 32 key feature wavelengths for quality grading obtained by the SPA algorithm. The positions of the bands in the 400~1000 nm range that contribute significantly to the oyster mushroom grade discrimination are marked.

[0083] In the Fisher Score feature band screening results image, the blue curve is the average reflectance spectrum of the oyster mushroom group samples, and the red scatter points are the 43 key feature wavelengths for quality grading obtained by the Fisher Score algorithm, marking the core bands in the 400~1000nm range that distinguish the three types of oyster mushroom quality.

[0084] In the CARS feature band screening results figure, the blue curve is the average reflectance spectrum of the oyster mushroom group samples, and the red scatter points are the 43 key feature wavelengths for quality grading obtained by the CARS algorithm. The feature bands in the 400~1000 nm range that are highly correlated with the quality of oyster mushrooms are marked.

[0085] The above-mentioned four mainstream feature wavelength screening algorithms—PLS-VIP, CARS, SPA, and Fisher Score—extract key bands for oyster mushroom quality assessment from the optimal preprocessed (MC+Z-score) spectrum. Four figures visually illustrate the distribution of feature wavelengths selected by each algorithm and the differences in the number of screened bands, providing a visual basis for selecting the optimal feature screening algorithm in subsequent modeling. Spectral feature bands were screened using PLS-VIP variable projection importance method, SPA continuous projection algorithm, CARS competitive adaptive reweighted sampling, and Fisher Score method, respectively, and quality assessment models were built based on various feature subsets. After comprehensive model performance comparison, the feature bands extracted by the PLS-VIP method showed the best combination with the recognition model, resulting in the highest accuracy in hierarchical recognition, making it the preferred feature screening method in this implementation.

Claims

1. A method for constructing a predictive model for the quality grading of Pleurotus ostreatus fruiting bodies, characterized in that, Includes the following stages: During the data acquisition phase, a sample set is obtained, which includes hyperspectral images of oyster mushroom fruiting bodies and their corresponding quality grades. In the spectral data extraction stage, radiometric correction is performed on the hyperspectral image to obtain the reflectance of the corrected spectral image; based on the reflectance of the corrected spectral image, the effective region of the oyster mushroom fruiting body in the hyperspectral image is extracted to obtain the average spectral reflectance of all pixels, and then combined into the original spectral data; In the data processing stage, the raw spectral data is preprocessed and filtered to obtain characteristic bands; In the model building phase, a training set is obtained based on the feature bands and their corresponding quality levels; several basic models are trained based on the training set to obtain the corresponding macro-average F1 scores; and the corresponding basic model weights are obtained based on the macro-average F1 scores of the several basic models. Based on the basic model weights of the aforementioned basic models, POSV weighted soft voting integration is performed on the aforementioned basic models to obtain the final oyster mushroom fruit body quality grading prediction model.

2. The method for constructing the oyster mushroom fruiting body quality grading prediction model according to claim 1, characterized in that, In the data processing stage, the preprocessing includes mean centering and Z-score standardization.

3. The method for constructing the oyster mushroom fruiting body quality grading prediction model according to claim 1, characterized in that, In the data processing stage, the filtering method is as follows: The preprocessed raw spectral data were used to obtain corresponding feature band subsets through several feature filtering methods; The nested cross-validation composite scoring method is used to score the various feature selection methods, and the feature band subset of the feature selection method with the highest score is selected as the candidate feature band. Based on the feature selection interval, the candidate feature bands are subjected to 5-fold nested cross-validation to obtain the feature bands.

4. The method for constructing the oyster mushroom fruiting body quality grading prediction model according to claim 3, characterized in that, The aforementioned feature selection methods include the PLS-VIP variable projection importance method, the CARS method, the SPA method, and the FisherScore method.

5. The method for constructing the oyster mushroom fruiting body quality grading prediction model according to claim 3, characterized in that, The feature selection interval is (20, 40).

6. The method for constructing the oyster mushroom fruiting body quality grading prediction model according to claim 1, characterized in that, In the model building phase, the basic models include SVM model, LightGBM model and MLP model.

7. The method for constructing the oyster mushroom fruiting body quality grading prediction model according to claim 1, characterized in that, In the model building phase, the formula for the POSV weighted soft voting integration is: in, Quality grade The predicted probability, The number of the aforementioned basic models. For the first The base model weights of each base model For the first The quality levels of the basic models The predicted probability.

8. A system for constructing a predictive model for the quality grading of oyster mushroom fruiting bodies, characterized in that, The system includes the following modules: The data acquisition module is used to obtain a sample set, which includes hyperspectral images of oyster mushroom fruiting bodies and their corresponding quality grades. The spectral data extraction module is used to perform radiometric correction on the hyperspectral image to obtain the reflectance of the corrected spectral image; based on the reflectance of the corrected spectral image, the effective region of the oyster mushroom fruiting body in the hyperspectral image is extracted to obtain the average spectral reflectance of all pixels, and then combined into the original spectral data. The data processing module is used to preprocess and filter the raw spectral data to obtain characteristic bands; The model building module is used to obtain a training set based on the feature bands and the corresponding quality levels; to train several basic models based on the training set to obtain the corresponding macro-average F1 scores; and to obtain the corresponding basic model weights based on the macro-average F1 scores of the several basic models. It is also used to perform POSV weighted soft voting integration on the several basic models based on the basic model weights of the several basic models to obtain the final oyster mushroom fruit body quality grading prediction model.

9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a computer program stored in memory, implements the method of any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method of any one of claims 1-7.