Fermentation state identification method and system for straw feed
By combining full-band hyperspectral imaging with RGB images, a spectral acidity spatial mapping model and a lightweight 3D convolutional network were constructed. This solved the problem of accurately locating early localized hidden decay in straw feed, improved the accuracy and stability of quantitative inversion of organic acids, and enabled accurate differentiation between high-humidity decay and secondary fermentation.
Patent Information
- Application Number
- CN202610051994.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-15
- Publication Date
- 2026-04-17
AI Technical Summary
Existing technologies struggle to accurately locate early, localized, and hidden decay within straw feed under non-destructive conditions. They also fail to effectively eliminate the strong interference and masking effect of high-moisture environments on organic acid spectral signals. Furthermore, they lack diagnostic logic for the causes of spoilage based on multidimensional indicators, resulting in low detection sensitivity and poor quantitative inversion accuracy of organic acids, making it difficult to distinguish between high-moisture decay and secondary fermentation.
A method combining full-band hyperspectral imaging and RGB images was adopted. Key feature band data were extracted through a feature band selection network, a spectral acidity spatial mapping model was constructed, a pH spatial distribution heatmap was generated, local moisture content was extracted by combining a lightweight 3D convolutional network, and fermentation status was identified by an adaptive weighted stacking ensemble model.
It enables precise cutting and extraction of tiny hot spots inside straw feed, improves the quantitative inversion accuracy of lactic acid, acetic acid and propionic acid in high humidity and drastic moisture fluctuation environments, can accurately distinguish between localized putrefaction and secondary fermentation caused by high humidity, and improves the stability and accuracy of detection.
Smart Images

Figure CN121883991A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of state recognition technology, and in particular to a method and system for recognizing the fermentation state of straw as feed. Background Technology
[0002] Straw, as an abundant agricultural waste resource, plays a vital role in promoting sustainable agricultural development and environmental protection through efficient treatment and resource utilization. Currently, microbial fermentation technology is one of the effective ways to achieve straw resource utilization. Through the degradation process of microorganisms, macromolecules in straw can be converted into volatile fatty acids and biogas products. Therefore, straw microbial fermentation pretreatment technology has become one of the current research directions for the resource utilization of agricultural waste.
[0003] Currently, Chinese invention application number 202511213790.6 discloses a microbial fermentation pretreatment system based on straw treatment. It calculates the fermentation efficiency score by measuring the physical, chemical and microbial parameters of the fermentation process in a sealed fermenter in real time, and automatically controls the straw crushing particle size, fermentation temperature and inoculum amount through a closed-loop control module. However, the above technologies have the following shortcomings: the detection of organic acids still relies on offline wet chemical analysis methods using high-performance liquid chromatography, which has a long detection cycle and requires sample destruction, making it difficult to achieve real-time full inspection on the production line; pH monitoring relies on contact industrial electrodes, which can only reflect the overall acidity and alkalinity of the liquid in the fermenter and cannot sense changes in acidity inside solid feed under non-contact conditions; they lack spatial resolution and cannot locate localized hidden spoilage, only monitoring macroscopic average environmental parameters inside the fermenter and unable to obtain spatial distribution information on the surface and inside of the feed; when there are early and small localized spoilage areas in the feed, the abnormal signals are easily masked by the overall background signal, leading to missed detection; and they do not utilize machine vision and spectral imaging technologies, making it impossible to combine mold morphology and chemical composition for joint analysis of abnormal areas, and difficult to distinguish whether the abnormality is due to localized spoilage caused by high humidity or secondary fermentation caused by sealing failure. Summary of the Invention
[0004] The technical problem solved by this invention is that existing technologies are unable to accurately locate early localized hidden decay inside straw feed under non-destructive conditions, cannot effectively eliminate the strong interference and masking effect of high moisture environment on organic acid spectral signals, and lack a deterioration cause diagnosis logic based on multi-dimensional indicators, resulting in low detection sensitivity and poor quantitative inversion accuracy of organic acids, making it difficult to distinguish between high moisture decay and secondary fermentation.
[0005] To solve the above-mentioned technical problems, the present invention provides the following technical solution: a method for identifying the fermentation state of straw as feed, comprising the following steps: Step S1: Collect full-band hyperspectral image data and RGB image data of straw feed samples, input the full-band hyperspectral image data into the feature band selection network, output key feature band data, and form a multimodal raw database with the RGB image data; Step S2: Select a subset of pH-sensitive feature bands from the key feature band data, construct a spectral acidity spatial mapping model, perform pH value inversion on the pixels in the multimodal original database, generate a pH value spatial distribution heat map, obtain anomaly region masks based on the pH value spatial distribution heat map, map them back to the multimodal original database, and cut out the target data block to be tested. Step S3: Reconstruct the key band reflectance data of the target data block into a three-dimensional tensor, input it into a lightweight 3D convolutional network, extract the joint feature vector of the spectral space, and output the local moisture content. Step S4: Extract robust visual feature vectors and organic acid feature spectral vectors from the target data block to be tested, construct a moisture-corrected feature vector by combining local moisture content, and obtain acetic acid content and propionic acid content based on the moisture-corrected feature vector; Step S5: Identify the fermentation state of straw feed based on the abnormal area mask, local moisture content, acetic acid content, and propionic acid content.
[0006] Preferably, step S1 includes the following sub-steps: Step S101: Collect raw full-band hyperspectral image data of straw feed samples using a hyperspectral imager and RGB image data of straw feed samples using a high-resolution industrial camera. The raw full-band hyperspectral image data is composed of a two-dimensional spatial dimension and a one-dimensional spectral dimension to form a three-dimensional hyperspectral data cube. Step S102: Extract key feature band data from the full-band hyperspectral image data using a feature band selection network. The processing logic is as follows: The feature band selection network includes a global information compression unit, a channel adaptive attention unit, and a band filtering and reweighting unit. The channel adaptive attention unit includes a two-layer fully connected neural network, which in turn includes a dimensionality reduction layer, a ReLU activation layer, and a dimensionality increase layer. The three-dimensional hyperspectral data cube is input into the global information compression unit in the feature band selection network. The global average pooling algorithm is used to aggregate and compress the spatial dimension of the three-dimensional hyperspectral data cube, and output a one-dimensional global spectral feature vector. The one-dimensional global spectral feature vector is input into the channel adaptive attention unit. The nonlinear interdependence between each spectral channel is modeled through a fully connected neural network to generate a channel-dependent response vector. The Sigmoid activation function is used to map each element in the channel-dependent response vector to the interval between 0 and 1 to generate a channel importance weight vector. The band filtering and reweighting unit is used to perform element-wise multiplication of the channel importance weight vector with the three-dimensional hyperspectral data cube, and all spectral channels are sorted in descending order based on the weight values. The K bands with the largest weight values are selected as key feature band data, and the key feature band data is selected from the three-dimensional hyperspectral data cube. Using the band filtering and reweighting unit, the channel importance weight vector is multiplied element-wise with the three-dimensional hyperspectral data cube to achieve feature recalibration. Based on the weight values, all spectral channels are sorted in descending order, and the K bands with the largest weight values are selected as key feature band data. Step S103: The key feature band data is kept in its original spatial dimension. The RGB image data and the key feature band data are merged to form a multimodal original database. The original spatial dimension is the number of pixel rows and columns of the hyperspectral data cube on a two-dimensional plane.
[0007] Preferably, step S2 includes the following sub-steps: Step S201: Construct a partial least squares regression sub-model using the self-service soft contraction algorithm. Extract the absolute value of the regression coefficient of each key feature band in the key feature band data in each partial least squares regression sub-model. Calculate the frequency and average weight of each key feature band selected by the partial least squares regression sub-model and generate the importance statistics of the key feature band. A soft contraction strategy is used to assign selection probabilities to key feature bands based on importance statistics. Key feature bands with weights less than the preset weights are eliminated by iterative sampling. A partial least squares regression model is constructed based on the remaining key feature bands. When the cross-validation error of the partial least squares regression model reaches the minimum, the remaining key feature bands that have not been eliminated are output as pH-sensitive feature bands. All pH-sensitive feature bands are combined into a subset of pH-sensitive feature bands.
[0008] Preferably, step S2 further includes the following sub-steps: Step S202: Based on the subset of pH-sensitive characteristic bands, a spectral acidity spatial mapping model is constructed, and its processing logic is as follows: The key band reflectance data of the pH-sensitive characteristic band subset are extracted as independent variables, and the real pH value of the samples obtained in advance is used as the dependent variable to construct a sample dataset. The sample dataset is then randomly divided into a training set and a validation set. An Extreme Learning Machine (ELM) regression network is established, and its topology is set as a single hidden layer feedforward neural network. The number of hidden layer neurons is set, and the total dimension of the network parameters is determined based on the number of input layer nodes and the number of hidden layer neurons. The key band reflectance data in the training set is mapped to the input layer data of the ELM regression network. Using the bald eagle search optimization algorithm, the connection weights of the first input layer and the biases of the neurons in the first hidden layer of the extreme learning machine regression network are mapped to the position vectors of the bald eagle population in the multidimensional search space corresponding to the total dimension of the network parameters. The biomimetic behavioral logic of bald eagle populations during the search space selection phase, search space search phase, and dive-and-capture phase includes: During the search space selection phase, the prey area is determined based on the search information of other bald eagles; During the search phase, the spiral flight mode is used to search the prey area from different directions. During the dive capture phase, a dive approximation in polar coordinates is performed toward the current optimal position. The fitness function is to minimize the root mean square error of the predictions made by the extreme learning machine regression network on the validation set. The population position is then iteratively updated and optimized using the fitness function. The global optimal position vector is locked, decoded into the connection weights of the second input layer and the biases of the neurons of the second hidden layer, and assigned to the extreme learning machine regression network to obtain the spectral acidity space mapping model.
[0009] Preferably, step S2 further includes the following sub-steps: Step S203 involves performing pH value inversion on pixels in the multimodal original database based on the spectral acidity spatial mapping model to generate a pH value spatial distribution heatmap, specifically including: The key band reflectance data of each pixel in the multimodal original database is input into the spectral acidity space mapping model. A full-pixel pH value matrix with the same spatial dimension as the original image is generated through point-to-point operation. The full-pixel pH value matrix is then mapped into a pH value spatial distribution heatmap. Anomaly region masks are obtained based on the spatial distribution heatmap of pH values using a threshold segmentation method. These masks are then mapped back to the multimodal original database, and the target data blocks for the anomaly regions are cropped out. Specifically, this includes: Set a putrefaction acidity threshold, mark pixels with pH values greater than the putrefaction acidity threshold as foreground, and mark pixels with pH values less than or equal to the putrefaction acidity threshold as background, and generate an abnormal area mask; The abnormal region mask is used as a spatial index and mapped back to the multimodal original database. The RGB texture data and key band reflectance data corresponding to the foreground region are retained, the background region is removed, and a target data block to be tested is constructed. The target data block to be tested includes information on the deteriorated region.
[0010] Preferably, step S3 includes the following sub-steps: Step S301: Extract key band reflectance data from the target data block to be tested, reorganize the key band reflectance data into a three-dimensional spectral tensor, input the three-dimensional spectral tensor into the lightweight 3D convolution backbone of the lightweight 3D convolutional network, and use 3D depth separable convolutional units to perform layer-by-layer convolution operations on the three-dimensional spectral tensor to extract multi-scale feature maps of different resolutions. The multi-scale feature maps include shallow texture details and deep semantic information. Step S302: Input the multi-scale feature map into the weighted bidirectional feature pyramid network in the lightweight 3D convolutional network, propagate features through bidirectional paths, and use learnable weights to adaptively weight and fuse features of different scales to generate cross-scale interactive fused feature representations. The bidirectional paths include top-down paths and bottom-up paths. Step S303: Perform 3D global pooling on the fused feature representation to generate a global spectral feature vector. Use the hybrid feature attention fusion unit in the lightweight 3D convolutional network to perform global average pooling on the global spectral feature vector. Perform cross-modal dynamic weighted fusion on the global spectral feature vector and the key band reflectance data to generate a spectral space joint feature vector. Input the spectral space joint feature vector into the fully connected regression layer to output the local moisture content of the abnormal region.
[0011] Preferably, step S4 includes the following sub-steps: Step S401: Extract the RGB texture data of the RGB image data in the target data block to be tested, calculate the color moment features and gray-level co-occurrence matrix texture features of the RGB texture data respectively, and combine the color moment features and gray-level co-occurrence matrix texture features into high-dimensional visual features; The high-dimensional visual features are sparsified by using the Lasso regression algorithm. The penalty coefficient is adjusted by cross-validation to remove multicollinearity features and retain key feature terms with non-zero regression coefficients to construct a robust visual feature vector. Step S402: Extract key band reflectance data from the target data block to be tested, perform second derivative preprocessing on the key band reflectance data, and use a variable selection algorithm to screen out the characteristic band combinations with the highest contribution for lactic acid, acetic acid and propionic acid respectively, to obtain lactic acid characteristic band combination, acetic acid characteristic band combination and propionic acid characteristic band combination, and construct organic acid characteristic spectral vector based on lactic acid characteristic band combination, acetic acid characteristic band combination and propionic acid characteristic band combination.
[0012] Preferably, step S4 further includes the following sub-steps: Step S403: The robust visual feature vector, the organic acid feature spectral vector, and the local moisture content are spliced together to construct a moisture-corrected feature vector; An adaptive weighted stacked ensemble model is established. The moisture-corrected feature vector is input into the adaptive weighted stacked ensemble model. The random forest algorithm is used to predict the local errors of each basic learner. The dynamic weights are calculated by the LogSumExp function. The prediction results of each basic learner are weighted and fused to output the lactic acid content, acetic acid content and propionic acid content of the abnormal region.
[0013] Preferably, step S5 identifies the fermentation state of straw feed based on the abnormal area mask, local moisture content, acetic acid content, and propionic acid content, specifically including: Step S501: Count the number of foreground pixels in the abnormal region mask, calculate the proportion of the number of foreground pixels in the abnormal region relative to the total number of pixels in the target data block to be tested, and if the proportion of the abnormal region is less than the preset noise filtering threshold, it is determined that the straw feed sample has not deteriorated and the output recognition result is that the overall fermentation is of high quality. Step S502: If the proportion of the abnormal area is greater than or equal to the preset noise filtering threshold, it is determined that the straw feed sample is abnormal. The local moisture content is compared with the preset local moisture content threshold. If the local moisture content is greater than the preset local moisture content threshold, it is determined that the abnormal area is caused by local decay due to high humidity. The identification result is output as local decay. Step S503: If the local moisture content is less than or equal to a preset local moisture content threshold, the acetic acid content and propionic acid content are compared with preset acid content thresholds respectively. If the acetic acid content or propionic acid content is greater than the preset acid content threshold, the abnormal area is determined to be caused by secondary fermentation, and the identification result is output as secondary fermentation. If the acetic acid content and propionic acid content are less than or equal to the preset acid content threshold, the abnormal area is determined to be caused by atypical fermentation abnormality, and the identification result is output as atypical fermentation abnormality.
[0014] A fermentation state identification system for straw feed production includes a data acquisition module, a data trimming module, a sensing module, a data fusion module, and an identification module. The acquisition module is used to acquire full-band hyperspectral image data and RGB image data of straw feed samples, input the full-band hyperspectral image data into the feature band selection network, output key feature band data, and combine the RGB image data and key feature band data into a multimodal raw database. The trimming module is used to filter key feature band data to obtain a subset of pH-sensitive feature bands, construct a spectral acidity spatial mapping model based on the subset of pH-sensitive feature bands, perform pH value inversion on pixels in the multimodal original database, generate a pH value spatial distribution heatmap, obtain an abnormal region mask based on the pH value spatial distribution heatmap through threshold segmentation, map the abnormal region mask back to the multimodal original database, and trim out the target data block to be tested in the abnormal region. The sensing module is used to reorganize the key band reflectance data in the target data block into a three-dimensional tensor, input it into a lightweight 3D convolutional network, extract the spectral spatial joint feature vector of the abnormal region, and output the local moisture content of the abnormal region. The fusion module is used to extract robust visual feature vectors and organic acid feature spectral vectors from the target data block to be tested, construct a moisture correction feature vector by combining local moisture content, input the moisture correction feature vector into an adaptive weighted stacked ensemble model, and output the lactic acid content, acetic acid content and propionic acid content of the abnormal region. The identification module is used to identify the fermentation state of straw feed based on abnormal area masking, local moisture content, acetic acid content, and propionic acid content.
[0015] The beneficial effects of this invention are as follows: By constructing a spectral acidity spatial mapping model to invert pH values and generate anomaly region masks, precise cutting and extraction of tiny hot spots inside feed are achieved, effectively eliminating signal interference from normal background regions. This solves the problem in existing technologies where local hidden putrefaction signals are diluted and difficult to identify due to regional average spectra. The local moisture content extracted through a lightweight 3D convolutional network is used as a correction feature, deeply integrated with organic acid content. This moisture compensation strategy effectively decouples the spectral overlap signals of moisture and organic acids, significantly improving the detection of lactic acid, acetic acid, and propionic acid under high humidity and drastic moisture fluctuations. The quantitative inversion accuracy is based on logical judgment using pH anomaly mask, moisture threshold, and organic acid content. It can accurately distinguish whether the anomaly is caused by localized decay or secondary fermentation due to high humidity. This breaks through the limitation of existing technologies that can only evaluate good and bad, and significantly improves the straw feed processing technology. It uses channel adaptive attention units to screen key bands from massive hyperspectral data and combines the features of RGB textures to perform cross-modal feature fusion. This not only solves the problems of large data volume and computational redundancy across all bands, but also makes full use of the complementarity between visual texture and chemical spectrum, improving the detection stability of the model under complex lighting and physical conditions. Attached Figure Description
[0016] Figure 1 A flowchart illustrating the steps of a method for identifying the fermentation state of straw as feed, provided in one embodiment of the present invention; Figure 2 This is a basic flowchart of a fermentation state identification system for straw feed, provided as an embodiment of the present invention. Detailed Implementation
[0017] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0018] Example 1, referring to Figure 1 A method for identifying the fermentation state of straw as feed is provided, comprising the following steps: Step S1: Collect full-band hyperspectral image data and RGB image data of straw feed samples. Input the full-band hyperspectral image data into the feature band selection network, output key feature band data, and combine the RGB image data and key feature band data into a multimodal raw database.
[0019] Step S2: Select a subset of pH-sensitive feature bands from the key feature band data, construct a spectral acidity spatial mapping model based on the subset of pH-sensitive feature bands, perform pH value inversion on the pixels in the multimodal original database, generate a pH value spatial distribution heatmap, obtain an abnormal region mask based on the pH value spatial distribution heatmap using the threshold segmentation method, map the abnormal region mask back to the multimodal original database, and cut out the target data block to be tested in the abnormal region.
[0020] Step S3: Reconstruct the key band reflectance data in the target data block into a three-dimensional tensor, input it into a lightweight 3D convolutional network, extract the spectral spatial joint feature vector of the abnormal region, and output the local moisture content of the abnormal region.
[0021] Step S4: Extract robust visual feature vectors and organic acid feature spectral vectors from the target data block to be tested, construct a moisture correction feature vector by combining local moisture content, input the moisture correction feature vector into the adaptive weighted stacked ensemble model, and output the lactic acid content, acetic acid content and propionic acid content of the abnormal area.
[0022] Step S5: Identify the fermentation state of straw feed based on the abnormal area mask, local moisture content, acetic acid content, and propionic acid content.
[0023] This invention achieves precise cropping and extraction of minute hotspots within feed by constructing a spectral acidity spatial mapping model to invert pH values and generate anomaly region masks. This effectively eliminates signal interference from normal background regions, solving the problem in existing technologies where localized, hidden putrefaction signals are diluted and difficult to identify due to regional average spectra. The invention uses local moisture content extracted through a lightweight 3D convolutional network as a correction feature, deeply integrating organic acid content. This moisture compensation strategy effectively decouples the spectral overlap between moisture and organic acids, significantly improving the quantitative analysis of lactic acid, acetic acid, and propionic acid under high humidity and drastic moisture fluctuations. The model improves accuracy by using a pH anomaly mask, moisture threshold, and organic acid content for logical judgment. It can accurately distinguish between localized decay caused by high humidity and secondary fermentation, overcoming the limitation of existing technologies that can only evaluate good and bad. This significantly improves the straw feed processing technology. It uses a channel adaptive attention unit to screen key bands from massive hyperspectral data and combines RGB texture features for cross-modal feature fusion. This solves the problems of large data volume and computational redundancy across all bands, and makes full use of the complementarity between visual texture and chemical spectrum, improving the detection stability of the model under complex lighting and physical conditions.
[0024] In a specific embodiment, step S1 includes the following sub-steps: Step S101: Collect raw full-band hyperspectral image data of straw feed samples using a hyperspectral imager and RGB image data of straw feed samples using a high-resolution industrial camera. The raw full-band hyperspectral image data consists of a three-dimensional hyperspectral data cube composed of a two-dimensional spatial dimension and a one-dimensional spectral dimension.
[0025] Step S102: Extract key feature band data from the full-band hyperspectral image data using a feature band selection network. The processing logic is as follows: The feature band selection network includes a global information compression unit, a channel adaptive attention unit, and a band filtering and reweighting unit. The channel adaptive attention unit includes a two-layer fully connected neural network, which consists of a dimensionality reduction layer, a ReLU activation layer, and a dimensionality increase layer.
[0026] It should be noted that the channel adaptive attention unit embeds the ReLU nonlinear activation function between the dimensionality reduction layer and the dimensionality increase layer, which improves the fitting ability of the fully connected neural network to the complex inter-band dependencies. The band selection and reweighting unit enhances the expression of key bands and suppresses noise by multiplying the normalized channel importance weight vector back into the original features, and then performs selection.
[0027] The three-dimensional hyperspectral data cube is input into the global information compression unit in the feature band selection network. The global average pooling algorithm is used to aggregate and compress the spatial dimension of the three-dimensional hyperspectral data cube, and output a one-dimensional global spectral feature vector.
[0028] A one-dimensional global spectral feature vector is input into the channel adaptive attention unit. The nonlinear interdependence between each spectral channel is modeled through a fully connected neural network to generate a channel-dependent response vector. The Sigmoid activation function is then used to map each element in the channel-dependent response vector to the interval between 0 and 1 to generate a channel importance weight vector.
[0029] By using the band selection and reweighting unit, the channel importance weight vector is multiplied element-wise with the three-dimensional hyperspectral data cube to achieve feature recalibration. Based on the weight values, all spectral channels are sorted in descending order, and the K bands with the largest weight values are selected as key feature band data. Key feature band data are selected from the three-dimensional hyperspectral data cube.
[0030] It should be noted that the K value is a hyperparameter designed to balance computational efficiency and detection accuracy. The preferred range for K is 10 to 30. Retaining the 10 to 30 bands with the highest weights can effectively cover the characteristic response peaks of organic acids and water, thus avoiding the dimensionality curse of full-band data and preventing the loss of key biochemical information.
[0031] Step S103: The key feature band data is kept in its original spatial dimension. The RGB image data and the key feature band data are merged to form a multimodal original database. The original spatial dimension is the number of pixel rows and columns of the hyperspectral data cube on a two-dimensional plane.
[0032] It should be noted that due to objective differences in physical resolution, focal length, and field of view between hyperspectral imagers and high-resolution industrial cameras, direct merging would lead to data spatial misalignment. Therefore, before performing the merging in step S103, the homography matrices of the two devices were obtained in advance using the checkerboard calibration method. The homography matrices were then used to perform geometric correction on the acquired RGB image data, and a bicubic interpolation algorithm was used for resampling. This downsampled the high-resolution RGB image to the same spatial resolution as the key feature band data, achieving strict alignment between the RGB image data and the key feature band data at the pixel level, thus ensuring the consistency of spatial semantics during subsequent feature extraction.
[0033] To address the issue that fermented straw feed products exhibit weak and nonlinear spectral responses across all wavelengths, making it prone to accidental deletion of key fingerprint bands in traditional linear dimensionality reduction, this invention constructs a channel-adaptive attention network with an embedded ReLU activation layer. This network utilizes feature recalibration to proactively amplify latent band signals highly correlated with pH and moisture and suppress background noise before physical screening, achieving high-fidelity characterization of complex fermentation biochemical information. Furthermore, to resolve the spatial misalignment of multimodal data caused by differences in field of view and resolution between the hyperspectral imager and the RGB camera, a homography matrix combined with bicubic interpolation is employed for sub-pixel-level geometric correction. This ensures strict alignment of RGB image data and key feature band data in microscopic physical coordinates, providing a zero-bias data benchmark for subsequent accurate inversion of localized spoilage.
[0034] In a specific embodiment, step S2 includes the following sub-steps: Step S201: Construct a partial least squares regression sub-model using the self-service soft contraction algorithm. Extract the absolute value of the regression coefficient of each key feature band in the key feature band data from each partial least squares regression sub-model. Calculate the frequency and average weight of each key feature band selected by the partial least squares regression sub-model and generate the importance statistics of the key feature bands.
[0035] A soft contraction strategy is used to assign selection probabilities to key feature bands based on importance statistics. Key feature bands with weights less than the preset weights are eliminated by iterative sampling. A partial least squares regression model is constructed based on the remaining key feature bands. When the cross-validation error of the partial least squares regression model reaches the minimum, the remaining key feature bands that have not been eliminated are output as pH-sensitive feature bands. All pH-sensitive feature bands are combined into a subset of pH-sensitive feature bands.
[0036] Step S202: Based on a subset of pH-sensitive characteristic bands, a spectral acidity spatial mapping model is constructed. The processing logic is as follows: The key band reflectance data of the pH-sensitive characteristic band subset were extracted as independent variables, and the real pH value of the samples obtained in advance was used as the dependent variable to construct a sample dataset. The sample dataset was then randomly divided into a training set and a validation set.
[0037] An Extreme Learning Machine (ELM) regression network is established, with its topology set as a single-hidden-layer feedforward neural network. The number of hidden-layer neurons is set, and the total dimension of the network parameters is determined based on the number of input-layer nodes and the number of hidden-layer neurons. The key band reflectance data in the training set is then mapped to the input-layer data of the ELM regression network.
[0038] By using the bald eagle search optimization algorithm, the connection weights of the first input layer and the biases of the neurons in the first hidden layer of the Extreme Learning Machine regression network are mapped to the position vectors of the bald eagle population in the multidimensional search space corresponding to the total dimension of the network parameters.
[0039] The biomimetic behavioral logic of bald eagle populations during the search space selection phase, search space search phase, and dive-and-capture phase includes: During the search space selection phase, the prey area is determined based on the search information of other bald eagles.
[0040] During the search phase, the spiral flight mode is used to search the prey area from different directions.
[0041] During the dive-capture phase, the dive is performed towards the current optimal position in polar coordinates.
[0042] The fitness function is to minimize the root mean square error of the predictions made by the Extreme Learning Machine regression network on the validation set. The population position is then iteratively updated and optimized using the fitness function.
[0043] The global optimal position vector is locked, decoded into the connection weights of the second input layer and the biases of the neurons of the second hidden layer, and assigned to the extreme learning machine regression network to obtain the spectral acidity space mapping model.
[0044] It's important to clarify that the first input layer connection weights, first hidden layer neuron biases, second input layer connection weights, and second hidden layer neuron biases do not imply the addition of extra input and hidden layers to the physical topology of the Extreme Learning Machine Regression Network. Instead, they serve to distinguish the logical states of the same set of network parameters at different algorithm stages. The first input layer connection weights and first hidden layer neuron biases represent the dynamic variables to be optimized, mapped to population position coordinates during the Bald Eagle Search optimization algorithm iterations—essentially, the randomly initialized set of candidate solutions. The second input layer connection weights and second hidden layer neuron biases represent the final optimal values obtained by decoding the locked global optimal position vector after the algorithm iterations conclude and converge. The Extreme Learning Machine Regression Network maintains a standard single-input-layer and single-hidden-layer structure; essentially, it evolves the random parameters from the first state into the optimal parameters of the second state and assigns them back to the Extreme Learning Machine Regression Network.
[0045] Step S203 involves performing pH value inversion on pixels in the multimodal original database based on the spectral acidity spatial mapping model to generate a pH value spatial distribution heatmap, specifically including: The key band reflectance data of each pixel in the multimodal original database is input into the spectral acidity space mapping model. A full-pixel pH value matrix with the same spatial dimension as the original image is generated through point-to-point operation. The full-pixel pH value matrix is then mapped into a pH value spatial distribution heatmap.
[0046] Anomaly region masks are obtained based on the spatial distribution heatmap of pH values using a threshold segmentation method. These masks are then mapped back to the multimodal original database, and the target data blocks for the anomaly regions are cropped out. Specifically, this includes: A putrefaction acidity threshold is set, and pixels with pH values greater than the putrefaction acidity threshold are marked as foreground, while pixels with pH values less than the putrefaction acidity threshold are marked as background, thus generating an abnormal region mask.
[0047] It should be noted that the putrefaction acidity threshold is set at 4.2. The pH value of high-quality straw feed is typically between 3.8 and 4.2. When the pH value is greater than 4.2, it means that the lactic acid bacteria-dominated fermentation process is hindered, putrefaction bacteria become active, and protein degradation produces an ammonia odor. The background represents normal conditions, and the foreground represents abnormal conditions; therefore, 4.2 is used as the critical point to distinguish between normal and abnormal conditions. The putrefaction acidity threshold is used for binarization segmentation to extract areas with abnormally high pH values from the complex background.
[0048] The abnormal region mask is used as a spatial index and mapped back to the multimodal original database. The RGB texture data and key band reflectance data corresponding to the foreground region are retained, the background region is removed, and the target data block to be tested is constructed. The target data block to be tested includes information on the deteriorated region.
[0049] It should be noted that the information on the altered region includes RGB texture data and key band reflectance data corresponding to the foreground region of the mask in the anomalous region.
[0050] To address the challenges of missed detection in existing straw fermentation detection methods, where localized minute decay signals are easily masked by large areas of normal background spectrum, and the unstable acidity inversion accuracy of conventional extreme learning machine (ELM) models due to random parameter initialization, this invention first utilizes a self-administered soft contraction algorithm to eliminate redundant bands and select robust feature subsets strongly correlated with pH values. Then, it introduces the Bald Eagle Search algorithm, leveraging its unique spiral flight search and polar coordinate dive capture mechanism to overcome the randomness of input weights in ELM models. This allows for the training of a high-precision spectral acidity spatial mapping model. The model is then used to perform point-by-point pH inversion across the entire field of view to generate a heatmap. A binary mask is generated based on the decay acidity threshold as a spatial index, precisely cropping the target data block containing only the deteriorated areas from the multimodal data. This physically eliminates background noise interference, achieving zero-interference and high signal-to-noise ratio extraction of early, hidden decay areas.
[0051] In a specific embodiment, step S3 includes the following sub-steps: Step S301: Extract key band reflectance data from the target data block to be tested, and reorganize the key band reflectance data into a three-dimensional spectral tensor. The three-dimensional spectral tensor has height, width and number of spectral channels. Input the three-dimensional spectral tensor into the lightweight 3D convolution backbone of the lightweight 3D convolutional network, and use 3D depth separable convolutional units to perform layer-by-layer convolution operations on the three-dimensional spectral tensor to extract multi-scale feature maps of different resolutions. The multi-scale feature maps include shallow texture details and deep semantic information.
[0052] It should be noted that the 3D depthwise separable convolutional unit includes a 3D depthwise convolutional layer and a 3D pointwise convolutional layer connected in sequence.
[0053] Step S302: Input the multi-scale feature map into the weighted bidirectional feature pyramid network in the lightweight 3D convolutional network, propagate the feature through the bidirectional path, and use learnable weights to adaptively weight and fuse features of different scales to generate a cross-scale interactive fused feature representation. The bidirectional path includes a top-down path and a bottom-up path.
[0054] Step S303: Perform 3D global pooling on the fused feature representation to generate a global spectral feature vector. Use the hybrid feature attention fusion unit in the lightweight 3D convolutional network to perform global average pooling on the global spectral feature vector. Perform cross-modal dynamic weighted fusion on the global spectral feature vector and the key band reflectance data to generate a spectral space joint feature vector. Input the spectral space joint feature vector into the fully connected regression layer to output the local moisture content of the abnormal region.
[0055] It should be noted that, in order to process high-dimensional spectral tensors with limited computational resources, the 3D depthwise separable convolutional unit does not employ conventional 3D convolution. Instead, it decomposes standard convolution into two steps: depthwise convolution and pointwise convolution. Specifically, the depthwise convolution uses a size of... The convolution kernel performs spatial and spectral convolutions separately for each spectral channel of the input to extract local spatial texture and spectral waveform features. No channel-to-channel fusion is performed. The pointwise convolution uses a size of [missing information - likely a specific value]. The convolutional kernels are linearly combined along the channel dimension to fuse feature information from different channels. Compared to standard 3D convolution, this reduces the number of parameters, enabling the model to be quickly deployed on edge computing devices.
[0056] The learnable scalar weights are not fixed values, but rather parameters that the network automatically optimizes during training. When performing feature fusion, a fast normalization fusion method is used for the input features. The output after fusion The mathematical expression is: ; in, The output feature map after fusion. These are the corresponding learnable weights, which are guaranteed to be non-negative using ReLU. For the first Each input feature map To prevent small constants with a denominator of zero, Setting it to 0.0001 ensures that the model can automatically assign importance weights to features at different scales based on their contribution to moisture prediction. When dealing with large-area uniform decay, the weight of deep semantic features is automatically increased, while when dealing with tiny spots, the weight of shallow detail features is increased.
[0057] The role of the hybrid feature attention fusion unit is to achieve dynamic complementarity between global deep features and key band reflectance data. Let the global deep feature vector be... The key band reflectance data are The specific integration process includes: and The joint vector is obtained by concatenation. ,Will The input is a fully connected bottleneck structure, which includes both dimensionality reduction and dimensionality increase structures, and a normalized gating coefficient is generated using the Sigmoid function. The final joint eigenvector in the spectral space The mathematical expression is: ; When complex image textures make deep features unreliable, the network will automatically reduce its speed. The value relies more on key band reflectivity data, and vice versa, thus achieving robust prediction against interference.
[0058] To address the issues of large localized moisture content fluctuations and low inversion accuracy due to the susceptibility of single spectral features to interference from straw roughness in moisture detection of straw feed, This invention innovatively constructs a joint spectral-spatial inversion mechanism based on a lightweight 3D convolutional network. Considering that traditional spectral detection only utilizes point spectral information, ignoring the spatial diffusion texture of water stains within anomalous regions, this invention employs 3D depthwise separable convolution to directly process the three-dimensional spectral tensor. It simultaneously extracts chemical absorption features in the spectral dimension and distribution features in the spatial dimension with extremely low computational cost. A hybrid feature attention fusion unit is specifically designed, abandoning simple feature concatenation. Instead, through concatenation and sigmoid weighting, the model automatically learns the complementary relationship between the deep spatial semantics extracted by 3D convolution and the shallow original input spectrum. This is equivalent to equipping the model with a dynamic regulator. In regions with complex textures, the model automatically increases the weight of deep spatial features to resist physical noise; in regions with clear spectral signals, it increases the weight of the original spectrum to ensure chemical accuracy. This achieves a significant improvement in robust prediction capability for water content in localized minor anomalous regions with minimal computational cost.
[0059] In a specific embodiment, step S4 includes the following sub-steps: Step S401: Extract the RGB texture data of the RGB image data in the target data block to be tested, calculate the color moment features and gray-level co-occurrence matrix texture features of the RGB texture data in multiple color spaces, and combine the color moment features and gray-level co-occurrence matrix texture features into high-dimensional visual features.
[0060] High-dimensional visual features characterize mold morphology.
[0061] It should be noted that multiple color spaces include RGB color space, HSV color space and CIELab color space. RGB texture data is converted to HSV color space and CIELab color space, and the first-order color moment, second-order color moment and third-order color moment are calculated in each of the multiple color spaces. The first-order color moment, second-order color moment and third-order color moment are used as color moment features.
[0062] The Lasso regression algorithm is used to perform sparsification screening of high-dimensional visual features. The penalty coefficient is adjusted by 10-fold cross-validation to eliminate multicollinear features and retain key feature terms with non-zero regression coefficients to construct a robust visual feature vector.
[0063] Step S402: Extract key band reflectance data from the target data block to be tested, perform second derivative preprocessing on the key band reflectance data, and use a variable selection algorithm to screen out the characteristic band combinations with the highest contribution for lactic acid, acetic acid and propionic acid respectively, to obtain lactic acid characteristic band combination, acetic acid characteristic band combination and propionic acid characteristic band combination, and construct organic acid characteristic spectral vector based on lactic acid characteristic band combination, acetic acid characteristic band combination and propionic acid characteristic band combination.
[0064] It should be noted that the variable selection algorithm is a competitive adaptive reweighted sampling algorithm.
[0065] Step S403: The robust visual feature vector, the organic acid feature spectral vector, and the local moisture content are spliced together to construct a moisture-corrected feature vector.
[0066] An adaptive weighted stacked ensemble model is established. The moisture-corrected feature vector is input into the adaptive weighted stacked ensemble model. The random forest algorithm is used to predict the local errors of each basic learner. The dynamic weights are calculated by the LogSumExp function based on the negative error exponent. The prediction results of each basic learner are weighted and fused to output the lactic acid content, acetic acid content and propionic acid content of the abnormal region.
[0067] It should be noted that the base learners in the adaptive weighted stacked ensemble model preferably include three types of models with significant differences to ensure the diversity of the ensemble. Specifically, these are support vector regression, extreme gradient boosting tree, and optical gradient boosting machine. The adaptive weighted stacked ensemble model includes several heterogeneous base learners and a random forest model as an error predictor.
[0068] It should be noted that the weighted fusion of the predictions from each base learner is not a simple summation, but rather a variant of Softmax where smaller errors result in larger weights. Let the... The local mean square error of the predictions made by the random forest for the current sample $x$ using the base learners is: Then the first Dynamic weights of each basic learner The mathematical expression is: ; in, The total number of basic learners, This is a scaling factor used to control the sensitivity of weight allocation; it is set between 1 and 5. The larger the value, the higher the weight the best-performing model receives.
[0069] The denominator of the above formula involves the LogSumExp operation during logarithmic field calculations to prevent numerical overflow, resulting in the final predicted value. for: ; in, For the first The initial predictions of the base learners.
[0070] Conventional ensemble learning typically uses static weights, ignoring the performance differences between models under different sample distributions. This invention, in addition to the base learner, trains an extra random forest error predictor specifically for predicting the model's error rate. It equips the system with a referee who, for each test sample, predicts which base model has the largest prediction error and automatically reduces its weight using a LogSumExp mechanism, while increasing the weights of more reliable base models. This sample-level dynamic weighting significantly improves the model's robustness when dealing with extremely high error rates or severe corruption.
[0071] Water has strong absorption in the near-infrared region, which can mask the weak signals of acetic acid and propionic acid, leading to false negatives or quantitative bias.
[0072] This invention does not treat passive moisture interference as noise to be eliminated. Instead, it uses the precise local moisture content obtained from the inversion in step S3 as an explicit feature dimension, directly concatenating it into the organic acid feature vector. Combined with specific bands selected by a competitive adaptive reweighted sampling algorithm, this allows the downstream regression model to learn the nonlinear compensation relationship between moisture, spectrum, and organic acids. When the moisture content is too high, the model automatically adjusts the prediction intercept of organic acids based on the moisture feature value, achieving dry matter correction at the algorithm level and significantly improving the accuracy of organic acid quantification in moist feed.
[0073] In a specific embodiment, step S5 identifies the fermentation state of straw feed based on anomaly area masking, local moisture content, acetic acid content, and propionic acid content, specifically including: Step S501: Count the number of foreground pixels in the abnormal region mask, calculate the proportion of the number of foreground pixels to the total number of pixels in the abnormal region of the target data block, and if the proportion of the abnormal region is less than the preset noise filtering threshold, it is determined that the straw feed sample has not deteriorated and the output recognition result is that the overall fermentation is of high quality.
[0074] To address the issue of discrimination criterion drift caused by variations in image acquisition distance, scale-invariant discrimination is achieved using the proportion of abnormal regions. Using absolute pixel count as a threshold makes the model highly susceptible to changes in camera resolution and shooting distance, lacking versatility. By using the proportion of abnormal regions as a noise filtering standard, the model can accurately filter out sensor thermal noise or rice husk reflections in the background based on relative area, regardless of whether the image is captured from high altitude by a drone or from close-up shots by a handheld device. This ensures that an alarm is triggered only when a truly large-scale area of decay appears, significantly reducing the system's false alarm rate.
[0075] Step S502: If the proportion of abnormal areas is greater than or equal to the preset noise filtering threshold, the straw feed sample is determined to be abnormal. The local moisture content is compared with the preset local moisture content threshold. If the local moisture content is greater than the preset local moisture content threshold, the abnormal area is determined to be caused by local decay due to high humidity. The recognition result is output as local decay.
[0076] Step S503: If the local moisture content is less than or equal to the preset local moisture content threshold, the acetic acid content and propionic acid content are compared with the preset acid content threshold respectively. If the acetic acid content or propionic acid content is greater than the preset acid content threshold, the abnormal area is determined to be caused by secondary fermentation, and the identification result is output as secondary fermentation. If the acetic acid content and propionic acid content are less than or equal to the preset acid content threshold, the abnormal area is determined to be caused by atypical fermentation abnormality, and the identification result is output as atypical fermentation abnormality.
[0077] It should be noted that secondary fermentation is caused by low moisture and high organic acid content. This is because when straw feed undergoes aerobic deterioration, aerobic microorganisms oxidize and decompose lactic acid, inducing the activity of heterologous lactic acid bacteria, leading to a significant increase in acetic acid content. Some preservatives may become ineffective, or specific putrefactive metabolic pathways may be activated, causing abnormal fluctuations in propionic acid. Secondary fermentation is usually accompanied by a rise in pH and localized high temperatures, which must be addressed by isolating the feed from air.
[0078] Atypical fermentation anomalies are caused by low moisture, low organic acid, and high pH, representing a specific type of substandard fermentation state. This is typically due to insufficient soluble sugars in the raw materials, leading to fermentation initiation failure, or excessive protein decomposition producing ammonia nitrogen, which neutralizes the acidity through ammoniation. Although the pH level may appear abnormal, there is no high concentration of organic acid accumulation, nor does it exhibit high humidity characteristics. Identifying atypical fermentation anomalies can guide users in adjusting their feedstock formulations.
[0079] Fermentation and spoilage is a multi-factor coupled process. Simply looking at the pH value only indicates that it has spoiled, and simply looking at the moisture content only indicates that it is wet; it cannot distinguish between cause and effect. High moisture content can be the cause of spoilage, or it can be a result of metabolic water produced during spoilage.
[0080] This invention employs a progressive diagnostic logic, prioritizing the identification of moisture as the primary cause, since high humidity is a direct physical factor leading to fermentation failure. After excluding moisture interference, it then uses acetic acid and propionic acid to determine whether secondary fermentation is caused by the disruption of aerobic stability. This tiered logic perfectly aligns with the biological mechanism of straw fermentation, enabling it not only to detect spoilage but also to diagnose the cause, guiding users on whether to sun-dry the raw materials or compact and seal them.
[0081] Example 2, refer to Figure 2A fermentation state identification system for straw feed production is provided, comprising a data acquisition module, a data trimming module, a sensing module, a data fusion module, and an identification module.
[0082] The acquisition module is used to acquire full-band hyperspectral image data and RGB image data of straw feed samples. The full-band hyperspectral image data is input into the feature band selection network, which outputs key feature band data. The RGB image data and key feature band data are combined to form a multimodal raw database.
[0083] The cropping module is used to filter key feature band data to obtain a subset of pH-sensitive feature bands. Based on the subset of pH-sensitive feature bands, a spectral acidity spatial mapping model is constructed. The pH value is inverted for the pixels in the multimodal original database to generate a pH value spatial distribution heatmap. Based on the pH value spatial distribution heatmap, anomaly region masks are obtained through threshold segmentation. The anomaly region masks are mapped back to the multimodal original database to crop out the target data blocks of the anomaly regions.
[0084] The perception module is used to reorganize the key band reflectance data in the target data block into a three-dimensional tensor, input it into a lightweight 3D convolutional network, extract the spectral spatial joint feature vector of the abnormal region, and output the local moisture content of the abnormal region.
[0085] The fusion module is used to extract robust visual feature vectors and organic acid feature spectral vectors from the target data block to be tested, and to construct a moisture-corrected feature vector by combining the local moisture content. The moisture-corrected feature vector is then input into an adaptive weighted stacked ensemble model, which outputs the lactic acid content, acetic acid content, and propionic acid content of the abnormal region.
[0086] The identification module is used to identify the fermentation status of straw feed based on abnormal area masking, local moisture content, acetic acid content, and propionic acid content.
[0087] This invention integrates a feature band selection network into the acquisition module to screen key feature band data at the source and construct a multimodal raw database, effectively reducing data redundancy across all bands. A cropping module constructs a spectral acidity spatial mapping model to generate a pH spatial distribution heatmap and anomaly region masks. The system accurately crops target data blocks from the anomaly regions of the multimodal raw database, achieving physical denoising and targeted localization of locally hidden decay areas. Furthermore, a perception module uses a lightweight 3D convolutional network to extract joint spectral spatial feature vectors from the target data blocks to obtain precise local moisture content. The fusion module extracts robust visual feature vectors and organic acid feature spectral vectors, and explicitly splices local moisture content into the features to construct a moisture-corrected feature vector. This vector is then input into an adaptive weighted stacked ensemble model, effectively overcoming the masking interference of high humidity environments on organic acid spectral signals. This enables accurate inversion of lactic acid, acetic acid, and propionic acid content. Finally, the identification module performs multi-dimensional logical diagnosis based on abnormal region masks, local moisture content, and organic acid content, accurately identifying the fermentation state of straw feed and distinguishing the causes of spoilage. This achieves intelligent, high-precision, and non-destructive monitoring of straw feed fermentation quality throughout the entire process.
[0088] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0089] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the protection scope of the present invention.
Claims
1. A method for identifying the fermentation state of straw as feed, characterized in that, Includes the following steps: Step S1: Collect full-band hyperspectral image data and RGB image data of straw feed samples, input the full-band hyperspectral image data into the feature band selection network, output key feature band data, and form a multimodal raw database with the RGB image data; Step S2: Select a subset of pH-sensitive feature bands from the key feature band data, construct a spectral acidity spatial mapping model, perform pH value inversion on the pixels in the multimodal original database, generate a pH value spatial distribution heat map, obtain anomaly region masks based on the pH value spatial distribution heat map, map them back to the multimodal original database, and cut out the target data block to be tested. Step S3: Reconstruct the key band reflectance data of the target data block into a three-dimensional tensor, input it into a lightweight 3D convolutional network, extract the joint feature vector of the spectral space, and output the local moisture content. Step S4: Extract robust visual feature vectors and organic acid feature spectral vectors from the target data block to be tested, construct a moisture-corrected feature vector by combining local moisture content, and obtain acetic acid content and propionic acid content based on the moisture-corrected feature vector; Step S5: Identify the fermentation state of straw feed based on the abnormal area mask, local moisture content, acetic acid content, and propionic acid content.
2. The method for identifying the fermentation state of straw as feed as described in claim 1, characterized in that, Step S1 includes the following sub-steps: Step S101: Collect raw full-band hyperspectral image data of straw feed samples using a hyperspectral imager and RGB image data of straw feed samples using a high-resolution industrial camera. The raw full-band hyperspectral image data is composed of a two-dimensional spatial dimension and a one-dimensional spectral dimension to form a three-dimensional hyperspectral data cube. Step S102: Extract key feature band data from the full-band hyperspectral image data using a feature band selection network. The processing logic is as follows: The feature band selection network includes a global information compression unit, a channel adaptive attention unit, and a band filtering and reweighting unit. The channel adaptive attention unit includes a two-layer fully connected neural network, which in turn includes a dimensionality reduction layer, a ReLU activation layer, and a dimensionality increase layer. The three-dimensional hyperspectral data cube is input into the global information compression unit in the feature band selection network. The global average pooling algorithm is used to aggregate and compress the spatial dimension of the three-dimensional hyperspectral data cube, and output a one-dimensional global spectral feature vector. The one-dimensional global spectral feature vector is input into the channel adaptive attention unit. The nonlinear interdependence between each spectral channel is modeled through a fully connected neural network to generate a channel-dependent response vector. The Sigmoid activation function is used to map each element in the channel-dependent response vector to the interval between 0 and 1 to generate a channel importance weight vector. The band filtering and reweighting unit is used to perform element-wise multiplication of the channel importance weight vector with the three-dimensional hyperspectral data cube, and all spectral channels are sorted in descending order based on the weight values. The K bands with the largest weight values are selected as key feature band data, and the key feature band data is selected from the three-dimensional hyperspectral data cube. Using the band filtering and reweighting unit, the channel importance weight vector is multiplied element-wise with the three-dimensional hyperspectral data cube to achieve feature recalibration. Based on the weight values, all spectral channels are sorted in descending order, and the K bands with the largest weight values are selected as key feature band data. Step S103: The key feature band data is kept in its original spatial dimension. The RGB image data and the key feature band data are merged to form a multimodal original database. The original spatial dimension is the number of pixel rows and columns of the hyperspectral data cube on a two-dimensional plane.
3. The method for identifying the fermentation state of straw as feed as described in claim 2, characterized in that, Step S2 includes the following sub-steps: Step S201: Construct a partial least squares regression sub-model using the self-service soft contraction algorithm. Extract the absolute value of the regression coefficient of each key feature band in the key feature band data in each partial least squares regression sub-model. Calculate the frequency and average weight of each key feature band selected by the partial least squares regression sub-model and generate the importance statistics of the key feature band. A soft contraction strategy is used to assign selection probabilities to key feature bands based on importance statistics. Key feature bands with weights less than the preset weights are eliminated by iterative sampling. A partial least squares regression model is constructed based on the remaining key feature bands. When the cross-validation error of the partial least squares regression model reaches the minimum, the remaining key feature bands that have not been eliminated are output as pH-sensitive feature bands. All pH-sensitive feature bands are combined into a subset of pH-sensitive feature bands.
4. The method for identifying the fermentation state of straw as feed as described in claim 3, characterized in that, Step S2 further includes the following sub-steps: Step S202: Based on the subset of pH-sensitive characteristic bands, a spectral acidity spatial mapping model is constructed, and its processing logic is as follows: The key band reflectance data of the pH-sensitive characteristic band subset are extracted as independent variables, and the real pH value of the samples obtained in advance is used as the dependent variable to construct a sample dataset. The sample dataset is then randomly divided into a training set and a validation set. An Extreme Learning Machine (ELM) regression network is established, and its topology is set as a single hidden layer feedforward neural network. The number of hidden layer neurons is set, and the total dimension of the network parameters is determined based on the number of input layer nodes and the number of hidden layer neurons. The key band reflectance data in the training set is mapped to the input layer data of the ELM regression network. Using the bald eagle search optimization algorithm, the connection weights of the first input layer and the biases of the neurons in the first hidden layer of the extreme learning machine regression network are mapped to the position vectors of the bald eagle population in the multidimensional search space corresponding to the total dimension of the network parameters. The biomimetic behavioral logic of bald eagle populations during the search space selection phase, search space search phase, and dive-and-capture phase includes: During the search space selection phase, the prey area is determined based on the search information of other bald eagles; During the search phase, the spiral flight mode is used to search the prey area from different directions. During the dive capture phase, a dive approximation in polar coordinates is performed toward the current optimal position. The fitness function is to minimize the root mean square error of the predictions made by the extreme learning machine regression network on the validation set. The population position is then iteratively updated and optimized using the fitness function. The global optimal position vector is locked, decoded into the connection weights of the second input layer and the biases of the neurons of the second hidden layer, and assigned to the extreme learning machine regression network to obtain the spectral acidity space mapping model.
5. The method for identifying the fermentation state of straw as feed as described in claim 4, characterized in that, Step S2 further includes the following sub-steps: Step S203 involves performing pH value inversion on pixels in the multimodal original database based on the spectral acidity spatial mapping model to generate a pH value spatial distribution heatmap, specifically including: The key band reflectance data of each pixel in the multimodal original database is input into the spectral acidity space mapping model. A full-pixel pH value matrix with the same spatial dimension as the original image is generated through point-to-point operation. The full-pixel pH value matrix is then mapped into a pH value spatial distribution heatmap. Anomaly region masks are obtained based on the spatial distribution heatmap of pH values using a threshold segmentation method. These masks are then mapped back to the multimodal original database, and the target data blocks for the anomaly regions are cropped out. Specifically, this includes: Set a putrefaction acidity threshold, mark pixels with pH values greater than the putrefaction acidity threshold as foreground, and mark pixels with pH values less than or equal to the putrefaction acidity threshold as background, and generate an abnormal area mask; The abnormal region mask is used as a spatial index and mapped back to the multimodal original database. The RGB texture data and key band reflectance data corresponding to the foreground region are retained, the background region is removed, and a target data block to be tested is constructed. The target data block to be tested includes information on the deteriorated region.
6. The method for identifying the fermentation state of straw as feed as described in claim 5, characterized in that, Step S3 includes the following sub-steps: Step S301: Extract key band reflectance data from the target data block to be tested, reorganize the key band reflectance data into a three-dimensional spectral tensor, input the three-dimensional spectral tensor into the lightweight 3D convolution backbone of the lightweight 3D convolutional network, and use 3D depth separable convolutional units to perform layer-by-layer convolution operations on the three-dimensional spectral tensor to extract multi-scale feature maps of different resolutions. The multi-scale feature maps include shallow texture details and deep semantic information. Step S302: Input the multi-scale feature map into the weighted bidirectional feature pyramid network in the lightweight 3D convolutional network, propagate features through bidirectional paths, and use learnable weights to adaptively weight and fuse features of different scales to generate cross-scale interactive fused feature representations. The bidirectional paths include top-down paths and bottom-up paths. Step S303: Perform 3D global pooling on the fused feature representation to generate a global spectral feature vector. Use the hybrid feature attention fusion unit in the lightweight 3D convolutional network to perform global average pooling on the global spectral feature vector. Perform cross-modal dynamic weighted fusion on the global spectral feature vector and the key band reflectance data to generate a spectral space joint feature vector. Input the spectral space joint feature vector into the fully connected regression layer to output the local moisture content of the abnormal region.
7. The method for identifying the fermentation state of straw as feed as described in claim 6, characterized in that, Step S4 includes the following sub-steps: Step S401: Extract the RGB texture data of the RGB image data in the target data block to be tested, calculate the color moment features and gray-level co-occurrence matrix texture features of the RGB texture data respectively, and combine the color moment features and gray-level co-occurrence matrix texture features into high-dimensional visual features; The high-dimensional visual features are sparsified by using the Lasso regression algorithm. The penalty coefficient is adjusted by cross-validation to remove multicollinearity features and retain key feature terms with non-zero regression coefficients to construct a robust visual feature vector. Step S402: Extract key band reflectance data from the target data block to be tested, perform second derivative preprocessing on the key band reflectance data, and use a variable selection algorithm to screen out the characteristic band combinations with the highest contribution for lactic acid, acetic acid and propionic acid respectively, to obtain lactic acid characteristic band combination, acetic acid characteristic band combination and propionic acid characteristic band combination, and construct organic acid characteristic spectral vector based on lactic acid characteristic band combination, acetic acid characteristic band combination and propionic acid characteristic band combination.
8. The method for identifying the fermentation state of straw as feed as described in claim 7, characterized in that, Step S4 further includes the following sub-steps: Step S403: The robust visual feature vector, the organic acid feature spectral vector, and the local moisture content are spliced together to construct a moisture-corrected feature vector; An adaptive weighted stacked ensemble model is established. The moisture-corrected feature vector is input into the adaptive weighted stacked ensemble model. The random forest algorithm is used to predict the local errors of each basic learner. The dynamic weights are calculated by the LogSumExp function. The prediction results of each basic learner are weighted and fused to output the lactic acid content, acetic acid content and propionic acid content of the abnormal region.
9. The method for identifying the fermentation state of straw as feed as described in claim 8, characterized in that, Step S5 identifies the fermentation state of straw feed based on the abnormal area mask, local moisture content, acetic acid content, and propionic acid content, specifically including: Step S501: Count the number of foreground pixels in the abnormal region mask, calculate the proportion of the number of foreground pixels in the abnormal region relative to the total number of pixels in the target data block to be tested, and if the proportion of the abnormal region is less than the preset noise filtering threshold, it is determined that the straw feed sample has not deteriorated and the output recognition result is that the overall fermentation is of high quality. Step S502: If the proportion of the abnormal area is greater than or equal to the preset noise filtering threshold, it is determined that the straw feed sample is abnormal. The local moisture content is compared with the preset local moisture content threshold. If the local moisture content is greater than the preset local moisture content threshold, it is determined that the abnormal area is caused by local decay due to high humidity. The identification result is output as local decay. Step S503: If the local moisture content is less than or equal to a preset local moisture content threshold, the acetic acid content and propionic acid content are compared with preset acid content thresholds respectively. If the acetic acid content or propionic acid content is greater than the preset acid content threshold, the abnormal area is determined to be caused by secondary fermentation, and the identification result is output as secondary fermentation. If the acetic acid content and propionic acid content are less than or equal to the preset acid content threshold, the abnormal area is determined to be caused by atypical fermentation abnormality, and the identification result is output as atypical fermentation abnormality.
10. A fermentation state identification system for straw feed, applied in a fermentation state identification method for straw feed as described in any one of claims 1-9, characterized in that, It includes an acquisition module, a cropping module, a perception module, a fusion module, and a recognition module; The acquisition module is used to acquire full-band hyperspectral image data and RGB image data of straw feed samples, input the full-band hyperspectral image data into the feature band selection network, output key feature band data, and combine the RGB image data and key feature band data into a multimodal raw database. The trimming module is used to filter key feature band data to obtain a subset of pH-sensitive feature bands, construct a spectral acidity spatial mapping model based on the subset of pH-sensitive feature bands, perform pH value inversion on pixels in the multimodal original database, generate a pH value spatial distribution heatmap, obtain an abnormal region mask based on the pH value spatial distribution heatmap through threshold segmentation, map the abnormal region mask back to the multimodal original database, and trim out the target data block to be tested in the abnormal region. The sensing module is used to reorganize the key band reflectance data in the target data block into a three-dimensional tensor, input it into a lightweight 3D convolutional network, extract the spectral spatial joint feature vector of the abnormal region, and output the local moisture content of the abnormal region. The fusion module is used to extract robust visual feature vectors and organic acid feature spectral vectors from the target data block to be tested, construct a moisture correction feature vector by combining local moisture content, input the moisture correction feature vector into an adaptive weighted stacked ensemble model, and output the lactic acid content, acetic acid content and propionic acid content of the abnormal region. The identification module is used to identify the fermentation state of straw feed based on abnormal area masking, local moisture content, acetic acid content, and propionic acid content.
Citation Information
Patent Citations
Microbial fermentation pretreatment system based on straw treatment
CN121064942A