Non-contact detection method and system for water content of straw based on near-infrared hyperspectrum

By combining near-infrared hyperspectral detection with multiple sensors to acquire straw and environmental data, and utilizing feature extraction and attention fusion techniques, the accuracy and reliability issues of detecting the moisture content of loose straw were solved, achieving stable detection in complex environments.

CN121453710AActive Publication Date: 2026-02-03SHANGHAI HENGZE FUHUI INTELLIGENT TECHNOLOGY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202610013181.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-07
Publication Date
2026-02-03
Estimated Expiration
2046-01-07

AI Technical Summary

Technical Problem

Existing straw moisture content detection technologies have unstable detection accuracy in loose pile scenarios, making it difficult to maintain reliability in complex environments, and traditional methods cannot achieve real-time and reliable batch detection.

Method used

A non-contact detection method based on near-infrared hyperspectral imaging was adopted, combining a hyperspectral camera, temperature and humidity sensor, light sensor and laser rangefinder to acquire straw hyperspectral data and environmental parameters. Moisture content was predicted through a feature extraction subnetwork, an attention fusion subnetwork and a multi-scale regression output module, and data correction was performed using representative scores and multi-source matching weights.

Benefits of technology

Stable moisture content detection was achieved under non-uniform stacking and environmental change conditions, improving the volume representativeness and cross-scenario consistency of the detection, and obtaining more reliable online detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121453710A_ABST
    Figure CN121453710A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of water content detection, in particular to a straw water content non-contact detection method and system based on near-infrared hyperspectrum, and provides the following scheme: obtaining straw hyperspectral data in a preset wave band range through a hyperspectral camera; and environment parameters and stacking density information are synchronously acquired by utilizing a temperature and humidity sensor, an illumination sensor and a laser distance measuring sensor. And after carrying out wave band cutting, wavelet denoising and standard normal variable correction on the hyperspectral data, inputting the hyperspectral data, the normalized environmental parameters and the straw basic information into a detection network together. The detection network realizes water content prediction through a feature extraction sub-network, an attention fusion sub-network and a multi-scale regression output module, and performs weighted correction on hyperspectral data and environmental parameters based on disturbance spectrum difference when a representative score is relatively high so as to improve the matching degree and volume representativeness of multi-source data.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to the technical field of water content detection, in particular to a non-contact straw water content detection method and system based on near-infrared hyperspectrum. BACKGROUND

[0002] As a key indicator affecting the efficiency of returning to the field, feed quality and biomass energy conversion performance, the detection method of straw water content has long been dominated by the drying method and portable moisture meter. Although the drying method can obtain relatively accurate results, it has a long detection period and cannot meet the needs of on-site batch processing, and cannot provide real-time feedback on the material state. The sampling representativeness of the portable measurement method is insufficient in the scattered material scene, and the detection results fluctuate greatly between different batches, making it difficult to be used for quality control in continuous working conditions.

[0003] In recent years, the near-infrared reflective detection device can realize non-contact measurement, but its detection accuracy in the scattered straw scene is unstable, and the prediction values in different stacking forms have poor consistency. Some near-infrared equipment is based on fixed waveband measurement, which is difficult to give accurate judgment for non-uniformly stacked areas, and the detection results have obvious deviation in spatial position. In addition, the existing spectral detection device is prone to cross-batch model failure in complex environments, and the detection results drift with the change of the scene, making it difficult for the detection equipment to maintain reliability in actual production for a long time.

[0004] To solve the above problems, the application designs a non-contact straw water content detection method and system based on near-infrared hyperspectrum. SUMMARY

[0005] The technical problem to be solved by the application is to provide a non-contact straw water content detection method and system based on near-infrared hyperspectrum to solve the problems of the prior art. The hyperspectral camera is used to obtain the hyperspectral data of the straw in the preset waveband range, and the temperature and humidity sensor, the light sensor and the laser ranging sensor are used to synchronously collect the environmental parameters and the stacking density information. After the hyperspectral data are subjected to waveband clipping, wavelet denoising and standard normal variable correction, the data are input into the detection network together with the normalized environmental parameters and the straw basic information. The detection network realizes water content prediction through the feature extraction sub-network, the attention fusion sub-network and the multi-scale regression output module, and when the representative score is high, the hyperspectral data and the environmental parameters are weighted and corrected based on the perturbation spectral difference to improve the matching degree and the volume representativeness of the multi-source data.

[0006] To achieve the above purpose, the application provides the following technical solutions:

[0007] The application discloses a non-contact detection method for straw moisture content based on near-infrared hyperspectrum, which is applied to a detection device, wherein the detection device comprises a near-infrared hyperspectrum imaging device and a processor, the near-infrared hyperspectrum imaging device comprises a hyperspectrum camera, a temperature and humidity sensor, an illumination sensor and a laser ranging sensor, and the method comprises the following steps:

[0008] Straw hyperspectrum data covering a preset wavelength range are acquired, and environment parameter data and straw basic information are synchronously collected, wherein the straw basic information is straw stacking density information collected by the laser ranging sensor.

[0009] The straw hyperspectrum data are subjected to wave band clipping, wavelet denoising and standard normal variable correction to obtain spectral pretreatment data, and the environment parameter data and the straw basic information are subjected to normalization coding to obtain a condition vector.

[0010] The spectral pretreatment data and the condition vector are input as input parameters into a preset detection network, the input parameters are processed through the detection network, and a straw moisture content detection value is obtained.

[0011] The straw hyperspectrum data are subjected to wave band clipping, wavelet denoising and standard normal variable correction to obtain spectral pretreatment data, including the following steps:

[0012] A target wave band data is obtained by selecting a target wave band matched with water absorption from a preset spectral range.

[0013] The target wave band data is subjected to multi-scale wavelet decomposition based on a DB4 wavelet base, the coefficients are compressed under a preset decomposition layer number, and the compressed coefficients are subjected to wavelet reconstruction to obtain denoised spectral data.

[0014] Each spectral vector of the denoised spectral data is subjected to standard normal variable correction, including mean centering processing of the spectral vector and normalization according to a standard deviation, to obtain the spectral pretreatment data.

[0015] The detection network comprises a feature extraction subnetwork, an attention fusion subnetwork and an output module, wherein:

[0016] The feature extraction subnetwork is composed of three feature extraction modules and is used for extracting spectral-spatial joint features of three scales from the spectral pretreatment data, each feature extraction module comprises a spectral convolution layer and a spatial convolution layer, and each feature extraction module further comprises a residual block, the residual block comprises a batch normalization layer and a nonlinear activation layer, and is used for performing jump connection on the output of the feature extraction module in a feature transmission process.

[0017] The spectral convolution layer is configured as one-dimensional convolution, which is used for convolution operation on the spectral dimension, the convolution kernel size of the one-dimensional convolution is 1*10, and the convolution channel number is increased step by step in each feature extraction module; the spatial convolution layer is configured as two-dimensional convolution, which is used for convolution operation on the spatial dimension corresponding to the spectral pretreatment data, the convolution kernel size of the two-dimensional convolution is 3*3;

[0018] The attention fusion subnetwork is used for weighted fusion of the three-scale spectral-spatial joint features according to the environmental parameter data and the straw basic information, and outputs the fused features.

[0019] The attention fusion subnetwork comprises:

[0020] A query vector generation unit is configured to linearly map the three-scale spectral-spatial joint features output by the three feature extraction modules respectively, and generate corresponding query vectors;

[0021] A conditional encoding layer is configured to fuse and map the environmental parameter data and the straw basic information, and generate key vectors and value vectors for attention calculation;

[0022] A conditional attention calculation layer is configured to perform attention weight calculation based on the query vectors, the key vectors and the value vectors, and obtain weight coefficients for each scale feature, wherein the weight coefficients are used to represent the credibility of different spectral regions under the current temperature and humidity and stacking density conditions;

[0023] A feature weighting layer is configured to perform channel-by-channel weighting adjustment on the corresponding spectral-spatial joint features according to the weight coefficients, so as to obtain fused features.

[0024] The output module comprises:

[0025] A first granularity regression branch is configured to perform regression fitting on the spectral-spatial joint features corresponding to the first scale in the fused features, and output a first granularity moisture content detection value, which is used for preliminary screening of the straw moisture content;

[0026] A second granularity regression branch is configured to perform regression fitting on the spectral-spatial joint features corresponding to the second scale in the fused features, and generate a second granularity moisture content detection value in combination with the straw variety;

[0027] A third granularity regression branch is configured to perform regression fitting on the spectral-spatial joint features corresponding to the third scale in the fused features, so as to output a third granularity moisture content detection value;

[0028] The multi-scale loss weighting branch is configured to calculate mean square error losses for the first, second and third granularity moisture content detection values respectively, and calculate a straw moisture content detection value according to the mean square error losses.

[0029] The near-infrared hyperspectral imaging device further comprises an airflow nozzle, and the straw hyperspectral data covering the preset wavelength range is acquired by:

[0030] The static spectrum of the straw in the detection area is acquired;

[0031] The airflow nozzle is used to disturb the airflow of the straw to rearrange the surface layer of the straw, and a spectrum sequence is collected;

[0032] According to the spectral difference features between the static spectrum and the spectrum sequence, a representative score for representing the stacking volume of the straw in the detection area is calculated;

[0033] If the representative score is less than or equal to a preset difference threshold, the static spectrum is taken as the straw hyperspectral data;

[0034] If the representative score is greater than the difference threshold, the static spectrum is weighted according to the spectral difference features, and the weighted static spectrum is taken as the straw hyperspectral data.

[0035] If the representative score is greater than the difference threshold, the method further comprises:

[0036] The environmental parameter data and the straw basic information are collected;

[0037] A plurality of candidate environmental parameter sets are extracted from the environmental parameter data and the straw basic information;

[0038] A spectral feature vector is constructed according to the spectral difference features, and a corresponding matching score is calculated based on the matching correlation between the spectral feature vector and each candidate environmental parameter in the candidate environmental parameter set;

[0039] The matching scores are normalized to obtain matching weights of each candidate environmental parameter, and each candidate environmental parameter set is weighted according to the matching weights to obtain environmental parameter data and straw basic information matched with the straw hyperspectral data.

[0040] The attention fusion subnetwork further comprises:

[0041] The key vector and the value vector are scaled according to the matching weights to adjust the attention distribution of the attention fusion subnetwork, wherein the scaling comprises:

[0042] generate a scaling factor matrix corresponding to the key vector and the value vector based on the matching weight;

[0043] perform secondary normalization on the key vector and the value vector according to the scaling factor matrix to generate an adjusted key vector and a value vector consistent with a representative score of the straw hyperspectral data.

[0044] The non-contact detection system for the water content of the straw based on near-infrared hyperspectral imaging includes:

[0045] The near-infrared hyperspectral imaging module is configured to acquire straw hyperspectral data covering a preset wavelength range through a hyperspectral camera and to synchronously acquire environmental parameter data and straw basic information through a temperature and humidity sensor, an illumination sensor, and a laser ranging sensor; the near-infrared hyperspectral imaging module includes an air flow nozzle for air flow disturbance of the straw to acquire a spectral sequence and calculate a representative score;

[0046] The multi-source data processing module is configured to perform band clipping, wavelet denoising, and standard normal variable correction on the straw hyperspectral data to form spectral pretreatment data and to generate a condition vector according to the environmental parameter data and the straw basic information; when the representative score is greater than a preset difference threshold, the matching weight is calculated according to a plurality of candidate environmental parameter sets, and target environmental parameter data and straw basic information matched with the straw hyperspectral data are generated based on the matching weight.

[0047] The water content detection module is configured to input the spectral pretreatment data, the target environmental parameter data, and the straw basic information into a preset detection network, process them through a feature extraction subnetwork, an attention fusion subnetwork, and an output module, and generate a straw water content detection value.

[0048] The multi-source data processing module includes:

[0049] The spectral pretreatment unit is configured to perform band clipping, wavelet denoising, and standard normal variable correction on the straw hyperspectral data to generate spectral pretreatment data;

[0050] The condition vector generation unit is configured to normalize and encode the environmental parameter data and the straw basic information to form an initial condition vector for attention fusion;

[0051] The matching weight calculation unit is configured to calculate the matching weight corresponding to the spectral difference feature from a plurality of candidate environmental parameter sets when the representative score is greater than a preset difference threshold, and to generate target environmental parameter data and straw basic information matched with the straw hyperspectral data based on the matching weight.

[0052] Compared with the prior art, the application has the following beneficial effects:

[0053] The application can reflect the spectral characteristics and the actual state of the pile through the cooperative design of hyperspectral imaging, environmental parameter acquisition and condition attention fusion, and can still maintain stable output under the conditions of non-uniform stacking and environmental changes. The representative score and multi-source matching weight are used to realize data self-correction, improve the volume representativeness and cross-scene consistency of detection, and obtain more reliable moisture content results in the online detection of scattered straw. BRIEF DESCRIPTION OF DRAWINGS

[0054] Other characteristics, objects and advantages of the application will become more apparent through reading the following detailed description of the non-limiting embodiments made with reference to the accompanying drawings:

[0055] Figure 1 An exemplary application scenario provided for the embodiments of the application is shown in the following figure:

[0056] Figure 2 A structural schematic diagram of a detection device provided for the embodiments of the application is shown in the following figure:

[0057] Figure 3 A module schematic diagram of a processor provided for the embodiments of the application is shown in the following figure:

[0058] Figure 4 A flowchart of a near-infrared hyperspectral-based non-contact detection method for straw moisture content provided for the embodiments of the application is shown in the following figure:

[0059] Figure 5 A structural schematic diagram of a detection network provided for the embodiments of the application is shown in the following figure:

[0060] Figure 6 A structural schematic diagram of a feature extraction sub-network provided for the embodiments of the application is shown in the following figure:

[0061] Figure 7 A structural schematic diagram of another near-infrared hyperspectral imaging device provided for the embodiments of the application is shown in the following figure. DETAILED DESCRIPTION

[0062] The technical solutions in the embodiments of the application will be described clearly and completely below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only part of the embodiments of the application, rather than all the embodiments of the application.

[0063] In this document, "embodiments" means that the specific features, structures or characteristics described in connection with the embodiments can be included in at least one embodiment of the application. The appearance of this phrase in various places in the specification does not necessarily all refer to the same embodiment, nor is it necessarily mutually exclusive or alternative to other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0064] The straw moisture content non-contact detection method proposed in the application mainly faces the online quality monitoring needs of crop straw in the scenarios of field returning, feed processing, and biomass energy conversion, etc.

[0065] In actual engineering, straw is often in the form of bundled stacking, bulk conveying or temporary stacking, and the moisture content directly affects the composting rate, briquetting strength, fermentation stability and combustion efficiency, but traditional detection relies on manual sampling and offline determination by drying method, which not only destroys the sample, but also is difficult to cover the whole batch of materials, and can only be used for post-tracing but cannot be used for real-time control of the process. In the feed production line of large-scale breeding farms, the straw bundling station and the raw material pretreatment workshop of biomass power plants, the operators generally reflect that the moisture content cannot be detected in time, which has become a common bottleneck restricting the high-value utilization of straw resources.

[0066] In order to improve the detection efficiency, the existing technology attempts to introduce a portable near-infrared moisture meter or a fixed single-point near-infrared sensor to directly measure the reflectance spectrum of the surface of the straw. However, as a natural fiber material, straw has obvious near-infrared absorption characteristics of cellulose, hemicellulose and lignin components in its composition, and the spectral differences of straw of different varieties, different origins and different harvesting periods are significant; at the same time, the bulk density, impurity level and light conditions of the bulk material under stacking state will introduce additional spectral distortion, so that the moisture content inversion method which simply relies on a few characteristic wavebands or empirical models can be used in laboratory conditions, but in the complex environment of the field or production line, the model transferability is poor and frequent recalibration is required. Especially in the working conditions of high-speed conveying of the conveying belt and dynamic change of the stacking thickness, single-point near-infrared measurement can only reflect the instantaneous state of a small area on the surface, and it is difficult to give a representative judgment of the volume average moisture content of the whole batch of materials.

[0067] The near-infrared hyperspectral imaging technology expands the spatial dimension to some extent, and by simultaneously acquiring two-dimensional spatial distribution and one-dimensional spectral information, it can more finely describe the unevenness of the moisture on the stacking surface. However, the existing schemes in the field usually regard the hyperspectral data as a single source signal, mainly focusing on spectral pretreatment and selection of regression models, and regarding environmental temperature and humidity, light intensity and straw stacking density as noise factors, which are simply removed, and cannot be used as a priori condition to describe the detection scene and explicitly introduced into the moisture content inversion process. With the migration of the detection scene in time and space, the sensitivity of the model to these implicit conditions will be amplified in the form of prediction bias, so that the same model has large differences in application effect for summer wheat straw, autumn corn straw and different regions, increasing the maintenance cost and use threshold.

[0068] On the other hand, in the non-contact detection mode, the hyperspectral camera can only image the surface layer of the straw stack from a certain distance and angle, and the moisture distribution state inside the stack can only be indirectly inferred through limited surface response.

[0069] As can be appreciated by those skilled in the art, the change in stacking form, local stack tip or pit structure will cause obvious differences in the representativeness of point cloud and spectral information in different areas within the same picture; but the existing methods are mostly through simple area clipping or mask means to avoid serious occlusion areas, and there is still a lack of a systematic solution that can quantitatively evaluate the volume representativeness of different field of view areas without the need to explicitly divide the structure area in advance, and feedback the evaluation results to the subsequent multi-source data fusion and model reasoning process.

[0070] Based on the foregoing problems, the present application is not limited to modeling the hyperspectral reflectance curve itself in the specific implementation process, but takes whether the detection result can stably represent the true moisture state of the current batch of straws as the starting point, and regards the near-infrared hyperspectral data, environmental parameters and straw stacking density as multiple source observations that jointly constrain the same physical scene. By arranging hyperspectral cameras, temperature and humidity sensors, light sensors and laser ranging sensors on the production line or stack yard, a non-contact imaging link covering the 900nm-1700nm band is constructed, and multi-source data representing the appearance of straws, the tightness of internal structure and the environmental boundary conditions are simultaneously obtained. On this basis, the present application proposes that the hyperspectral data is input into the monitoring network after preprocessing, and the environmental parameters and stacking density are encoded into a conditional vector, and the feature weights of different bands and different spatial regions are adjusted through the conditional attention fusion mechanism, so that the model can adaptively select more reliable spectral features for moisture content estimation under different conditions such as high temperature and humidity, sparse stacking or tight stacking.

[0071] Further, in view of the problem that the surface spectrum may not be consistent with the volume state of the stack in the stacking scene, the present application rearranges the surface layer of the straws in the detection area through air disturbance in the embodiment, collects the spectral sequences before and after the disturbance, and constructs a difference index reflecting the volume representativeness of the stack. When the representative index indicates that the current field of view can only reflect the local abnormal area, the present application does not simply discard this area, but selects multiple candidate condition combinations from the time neighborhood and spatial neighborhood, calculates the matching weight between the spectral difference features and the candidate conditions, and reconstructs the target environmental parameters and stacking density that are most consistent with the current hyperspectral data through weighting, and then inputs them as conditions into the attention fusion subnetwork, so as to weaken the influence of multi-source data mismatch and local sampling distortion on the moisture content inversion result, and improve the detection representativeness and cross-scene stability in the non-contact three-dimensional stacking scene in principle.

[0072] Reference Figure 1 ,Figure 1 An exemplary application scenario graph provided for an embodiment of the present application.

[0073] As shown in Figure 1 Generally, the straw is in the form of scattered or stacked in the process of transportation, temporary storage or raw material pretreatment in the field. The stacking mode is affected by the harvesting method, wind direction, impurity content, compaction degree of the stack, etc., showing obvious randomness and heterogeneity. Although multiple stacking areas may be in the same open environment, the temperature and humidity inside the stack are often inconsistent due to limited airflow exchange, different light levels between the surface and the inside, and inconsistent local compaction, which can easily cause spectral shifts caused by local moisture differences in spectral collection.

[0074] In addition, even if the overall temperature and humidity are similar, different stacking areas may differ in wind direction, surface radiation, stack height, and surface roughness. These small environmental disturbances can directly affect the reflectance intensity and baseline shape of near-infrared hyperspectral through changes in optical path, scattering path, and surface reflection conditions, making the collected data of similar straws at different locations show obvious scene dependence. Based on the common characteristics of such stacking scenarios, the present application introduces environmental parameters and stacking density as conditional inputs based on spectral preprocessing, enabling the model to obtain more stable and representative moisture content prediction results in complex stacking environments.

[0075] It should be noted that Figure 1 The relative positions of the straw stacking arrangement and the detection device shown in

[0076] Reference is made to Figure 2 , Figure 2 A structural schematic diagram of the detection device provided for an embodiment of the present application.

[0077] Figure 2 The detection device includes a near-infrared hyperspectral imaging device and a processor electrically connected thereto. The near-infrared hyperspectral imaging device is used for non-contact optical acquisition of the target straw stacking area, and can simultaneously obtain spectral information, environmental boundary conditions, and stacking structure characteristics to form a multi-source input for moisture content estimation.

[0078] In a specific implementation, the near-infrared hyperspectral imaging device includes a hyperspectral camera, a temperature and humidity sensor, an illumination sensor, and a laser ranging sensor. The hyperspectral camera is configured to collect hyperspectral reflectance data of the straw covering a preset wavelength range; the temperature and humidity sensor is configured to collect temperature and relative humidity of an environment where the detection area is located, so as to represent an influence of external air state on a possible spectral form; the illumination sensor is configured to monitor changes in ambient light intensity, for correcting light source disturbance in a complex scene; and the laser ranging sensor is configured to obtain thickness, undulation, and compactness of the straw in the detection area, so as to reflect an influence of spatial geometric structure on a spectral scattering path.

[0079] It can be understood that the hyperspectral camera can adopt a line scanning or area array hyperspectral imaging device, and spectral resolution, spatial resolution, and imaging frame rate of the hyperspectral camera can be selected according to a moving speed of the stacked material and a detection accuracy requirement. In a specific application, the hyperspectral camera can adopt a push scanning structure to realize line-by-line acquisition along a certain direction, or can adopt a snapshot structure to simultaneously obtain full-spectrum cube data in a single frame; an optical part of the camera can be configured with a fixed focal length lens or a near-infrared special-purpose achromatic lens, so as to enhance imaging consistency of different wavebands.

[0080] In addition, the hyperspectral camera can be additionally provided with an external near-infrared auxiliary light source or a diffuse illumination module, so as to eliminate non-uniformity of ambient light in an outdoor or semi-open environment; and the camera can be installed in a top view, a side view, or a multi-angle joint manner, so as to adapt to different stacking forms and detection distances.

[0081] The processor is configured to perform preprocessing operations such as cropping, denoising, and standardization on the collected spectral data, and to encode the environmental parameters and the stacking density to construct a condition vector; then the spectral preprocessing data and the condition vector are input into a preset detection network, and a moisture content detection result of the straw is generated through a feature extraction unit, an attention fusion unit, and an output module.

[0082] In some optional specific implementations, the processor is configured with a near-infrared hyperspectral-based non-contact straw moisture content detection system provided in the embodiments.

[0083] Reference Figure 3 , Figure 3 A module schematic diagram of the processor provided in the embodiments is shown in FIG. 2.

[0084] As Figure 3 shown, the processor includes a near-infrared hyperspectral imaging module, a multi-source data processing module, and a moisture content detection module, wherein:

[0085] The near-infrared hyperspectral imaging module is configured to acquire straw hyperspectral data covering a preset wavelength range by a hyperspectral camera, and simultaneously acquire environmental parameter data and straw basic information by a temperature and humidity sensor, an illumination sensor, and a laser ranging sensor; the near-infrared hyperspectral imaging module includes an airflow nozzle for airflow disturbance to the straw to acquire a spectral sequence and calculate a representative score;

[0086] The multi-source data processing module is configured to perform band clipping, wavelet denoising, and standard normal variable correction on the straw hyperspectral data to form spectral pretreatment data, and generate a condition vector according to the environmental parameter data and the straw basic information; when the representative score is greater than a preset difference threshold, further calculate a matching weight according to a plurality of candidate environmental parameter sets and generate target environmental parameter data and straw basic information matched with the straw hyperspectral data based on the matching weight;

[0087] The water content detection module is configured to input the spectral pretreatment data, the target environmental parameter data, and the straw basic information into a preset detection network, and process them by a feature extraction subnetwork, an attention fusion subnetwork, and an output module to generate a straw water content detection value.

[0088] In one example, the multi-source data processing module includes:

[0089] A spectral pretreatment unit configured to perform band clipping, wavelet denoising, and standard normal variable correction on the straw hyperspectral data to generate spectral pretreatment data;

[0090] A condition vector generation unit configured to normalize and encode the environmental parameter data and the straw basic information to form an initial condition vector for attention fusion;

[0091] A matching weight calculation unit configured to, when the representative score is greater than a preset difference threshold, calculate a matching weight corresponding to a spectral difference feature from a plurality of candidate environmental parameter sets, and generate target environmental parameter data and straw basic information matched with the straw hyperspectral data based on the matching weight.

[0092] Next, the method for non-contact detection of straw water content based on near-infrared hyperspectral provided by the embodiments of the application will be further described in combination with the drawings, Figure 4 The method shown is applied to a detection device, the detection device includes a near-infrared hyperspectral imaging device and a processor, the near-infrared hyperspectral imaging device includes a hyperspectral camera, a temperature and humidity sensor, an illumination sensor, and a laser ranging sensor, and the method includes:

[0093] S1: Acquire straw hyperspectral data covering a preset wavelength range, and simultaneously acquire environmental parameter data and straw basic information;

[0094] The straw basic information is the straw stacking density information collected by the laser ranging sensor.

[0095] In the embodiment, due to the fact that the straw in the actual stacking state often has structure undulations such as pile tip, pit, and local compaction, it is difficult to accurately evaluate the real moisture content by relying on spectrum data alone, therefore, the stacking thickness and density distribution are synchronously obtained by the laser ranging sensor, for representing the compaction degree of the local level. Meanwhile, the temperature and humidity sensor and the illumination sensor record the temperature, humidity and illumination intensity of the instantaneous environment, which are closely related to the phenomena such as spectrum baseline drift and characteristic peak shift.

[0096] It can be understood that the environmental parameter data described in the application can specifically include temperature, relative humidity, and environmental illumination intensity, and the like, which are physical quantities for representing the external air state and illumination disturbance; and the straw stacking density information can be calculated according to the stacking height distribution, surface undulation change or statistical result of multiple ranging output by the laser ranging sensor, for reflecting the compaction degree and spatial geometric difference of the scattered stacking area. The collection and conversion mode of the above data can be realized by the person skilled in the art based on the existing sensor and conventional signal processing method, and the application does not make redundant description here.

[0097] S2: performing wave band clipping, wavelet denoising and standard normal variable correction on the straw hyperspectral data to obtain spectrum pretreatment data, and performing normalization coding on the environmental parameter data and the straw basic information to obtain a condition vector;

[0098] In the embodiment, the pretreatment link follows the basic physical law of near-infrared imaging in scattering medium, the original spectrum is subjected to wave band clipping to retain the characteristic wave band related to water absorption, so as to avoid the introduction of noise by invalid spectrum dimension; the multi-scale wavelet denoising technology can effectively suppress the high-frequency interference caused by the surface roughness of the pile body, the light source micro-perturbation and the sensor dark noise, so that the spectrum profile is more stable. Further, the standard normal variable correction method is adopted to perform mean centering and variance normalization processing on the spectrum at different positions and different frames, so as to weaken the spectrum amplitude difference caused by the randomness of stacking.

[0099] In the present step, the temperature and humidity, illumination and stacking density and the like are also coded into the condition vector, so that the subsequent model can adaptively adjust the feature weight based on the scene state during reasoning, and avoid the decline of model generalization caused by ignoring the scene condition.

[0100] It can be understood that the specific normalization encoding can be realized by dimension elimination, interval scaling or statistical standardization of various environmental parameters and stacking density data, for example, using minimum-maximum scaling, Z-score standardization, segmented normalization or converting multi-dimensional parameters into fixed length vector representation through a simple linear mapping network. The selection of the above encoding method can be adjusted according to the range of the field sensor output and the stability of the data, and the person skilled in the art can complete the corresponding implementation based on the conventional data preprocessing method, and the application does not limit the encoding method itself.

[0101] S3: inputting the spectral pretreatment data and the condition vector as input parameters into a preset detection network, processing the input parameters through the detection network, and obtaining a straw moisture content detection value;

[0102] In the embodiment, the detection network is composed of a feature extraction sub-network, an attention fusion sub-network and an output module. The feature extraction sub-network is used to capture multi-scale joint features of spectral dimension and spatial dimension, so that the model can not only identify the change of traditional moisture absorption peak, but also perceive the difference of pile structure reflected by spectral texture and spatial texture. The attention fusion sub-network extracts scene state information from the condition vector, and gives different weights to different spectral regions in the feature fusion process, so as to enhance the credible wave band and suppress the unstable wave band. It is suitable for scattered pile material detection in non-laboratory environment, and can significantly alleviate the problem of spectral drift caused by scene change. Finally, the output module generates a moisture content prediction value based on a multi-scale regression strategy, so that the comprehensive information of sensitive wave band, intermediate wave band and overall wave band in hyperspectrum can be effectively utilized, thereby improving the detection accuracy.

[0103] Next, the technical content of the method of the application about spectral pretreatment data is further expanded.

[0104] In one example, the straw hyperspectral data is subjected to wave band clipping, wavelet denoising and standard normal variable correction to obtain spectral pretreatment data, including:

[0105] The target wave band data is obtained by selecting the target wave band matched with moisture absorption from the preset spectral range.

[0106] In the field of related spectral analysis technology, the selection of water content sensitive band is generally based on the characteristic absorption mechanism of water in the near-infrared region. It is well known that water has significant stretching vibration absorption peaks near the waveband of 1150 nm-1250 nm, 1400 nm-1500 nm and 1800 nm-1950 nm; and in addition to water, the components of plant fiber materials (such as straw) such as cellulose, hemicellulose and lignin also have certain degree of overlapping absorption in adjacent wavebands. Therefore, when cutting the hyperspectral data, the present application determines the target waveband set according to the energy change trend of spectral transmittance or reflectance to eliminate the spectral band which is weakly related to water content and is easily affected by environmental light and optical path disturbance.

[0107] Based on the DB4 wavelet basis, the target cutting waveband data is subjected to multi-scale wavelet decomposition, the coefficients are compressed at a preset decomposition level, and then the compressed coefficients are subjected to wavelet reconstruction to obtain denoised spectral data;

[0108] For the suppression of spectral noise, the existing technology generally uses a multi-scale analysis method based on wavelet transform. Taking DB4 wavelet basis as an example, its compact support and good smoothness make it have more stable reconstruction ability when dealing with high-frequency noise caused by scattering noise, environmental light disturbance or equipment dark noise.

[0109] In some optional specific implementations, the spectral data is first subjected to multi-scale decomposition by setting the decomposition level to obtain approximation components and detail components; then the high-frequency part of the detail components is subjected to coefficient compression according to an empirical threshold or a statistical threshold to eliminate impulse noise and interference texture; finally, the processed coefficients are subjected to inverse wavelet transform to obtain reconstructed spectra. The high-frequency noise of the spectrum can be locally suppressed without damaging the overall shape of the waveband absorption peak, so that the final spectral curve is closer to the true physical response. Those skilled in the art can adjust the decomposition level or threshold strategy according to the device sampling frequency, target signal-to-noise ratio and data smoothing degree requirement.

[0110] Each spectral vector of the denoised spectral data is subjected to standard normal variate correction, including mean centering of the spectral vector and normalization according to the standard deviation to obtain the spectral pretreatment data.

[0111] It can be understood that the standard normal variate correction (SNV) is one of the most common correction methods in spectral pretreatment, which is used to reduce the problems of direct current offset and scale inconsistency caused by sample surface roughness, uneven illumination and scattering changes. The basic principle of SNV is to perform mean centering and standard deviation normalization on each spectral vector respectively, so that the corrected spectrum has a uniform amplitude scale, thereby enhancing the comparability between spectra at different sampling positions and different angles of view.

[0112] The skilled person only needs to process the spectral data point by point according to the formula to complete the correction. The introduction of SNV can effectively reduce the overall reflection intensity difference caused by different piling tightness, slight changes in sampling angle or local brightening of the light source, so that the subsequent feature extraction process is more stable and reliable.

[0113] Next, the technical content of the method of the application about detecting network is further expanded.

[0114] Reference Figure 5 , Figure 5 The structure schematic diagram of detecting network provided by the embodiment of the application is shown.

[0115] Figure 5 It is shown that the detecting network includes a feature extraction sub-network, an attention fusion sub-network and an output module, wherein:

[0116] The input of the feature extraction sub-network is spectral pretreatment data, which is used to extract three scales of spectral-spatial joint features;

[0117] The input of the attention fusion sub-network is a conditional vector, which is used to weight and fuse the three scales of spectral-spatial joint features according to the environmental parameter data and the straw basic information, and output the fused features;

[0118] The input of the output module is the fused features, which is used to output the straw water content detection value.

[0119] It can be understood that the three scales in the application specifically refer to the multi-level representations formed by the feature extraction sub-network under different convolution depths and different receptive fields, including a shallow local scale mainly based on original spectral texture, a middle related scale mainly based on band correlation structure, and a deep global scale comprehensively considering long-distance dependence between bands and spatial distribution information, which are used to depict the structural changes of hyperspectral data from different resolutions. There is no hard boundary between different scales, but hierarchical feature representation naturally formed by step-by-step convolution, and the skilled person in the art can adjust the number of scales according to the device resolution and data complexity.

[0120] Further, the spectral-spatial joint feature specifically refers to the band reflection information in the spectral dimension and the local neighborhood structure in the spatial dimension in the same feature tensor, for example, while one-dimensional spectral convolution is used to model the continuous absorption relationship between bands, two-dimensional convolution is used to capture the texture, roughness or piling fluctuation features of the sample in the spatial neighborhood, so that the network can simultaneously represent the intensity change of the water absorption peak and the influence of the surface structure of the pile on the optical path and scattering in a single feature map.

[0121] It can be understood that the spectral-spatial joint feature can more truly reflect the spectral behavior of the bulk material under non-uniform structure and complex environmental conditions, and the application performs condition weighted fusion on this basis to improve the stability and scene adaptability of the final moisture content prediction.

[0122] It should be noted that the detection network of the present application can be adaptively adjusted according to the scale of the data collected on site, the target detection accuracy and the algorithmic constraints of the deployment end. For example, in a lightweight deployment scenario, the real-time performance can be improved by reducing the number of convolution layers, reducing the feature channel dimension or using a shallow attention structure. In a scenario with high precision requirements or high sample complexity, deeper feature extraction modules can be introduced, multi-scale cross-layer connections can be added, or higher-dimensional conditional encoding methods can be used to enhance the sensitivity of the network to spectral details and environmental coupling relationships. The specific structure can be selected by a person skilled in the art according to the actual engineering constraints and data performance to select a reasonable network width and depth, and the present application does not limit this.

[0123] Reference Figure 6 , Figure 6 The structural diagram of the feature extraction sub-network provided by the embodiment of the present application is shown.

[0124] As Figure 6 shown, to adapt to the non-homogeneity of the straw near-infrared hyperspectral data in the waveband dimension and the spatial dimension, the feature extraction sub-network adopts a hierarchical structure formed by sequentially stacking multiple feature extraction modules, specifically including a first feature extraction module, a second feature extraction module and a third feature extraction module, each level including a spectral convolution layer, a spatial convolution layer and a residual block for maintaining gradient stability. Through such layered design, the network can capture local differences in water absorption peaks in the shallow stage, model the associated patterns between spectral wavebands in the middle stage, and integrate the effects of surface texture, roughness and local morphological changes on spectral behavior in the deep stage, thereby obtaining spectral-spatial joint features with different receptive fields and abstraction levels, specifically spectral-spatial joint feature one, spectral-spatial joint feature two and spectral-spatial joint feature three.

[0125] In a specific structure, the spectral convolution layer adopts a one-dimensional convolution manner to act on the spectral dimension, and the convolution kernel covers adjacent wavebands to learn the trend of the change in absorption intensity; the convolution layer can extract local patterns directly related to the water absorption mechanism, such as the broadening of the characteristic peak, the shift of the peak position or the attenuation of the intensity, and the like. The spatial convolution layer adopts a two-dimensional convolution manner to act on the spatial dimension, and captures the texture structure of the stacking surface layer by aggregating features of different pixel neighborhoods, for example, the reflection difference caused by the arrangement direction of the straw fiber, the surface roughness or the local shadow. After the two types of convolution features are processed in parallel in the same module, the residual block is used for jump connection, and the spectral-spatial joint features corresponding to the scale of the module are output, so that the network can maintain the integrity of the original spectral structure while deepening, and the problems of gradient disappearance or representation deviation are avoided. The residual block includes a batch normalization layer and a nonlinear activation layer, which are used to jump connect the output of the feature extraction module during feature transmission.

[0126] In one example, the spectral convolution layer is configured as a one-dimensional convolution for convolution operation on the spectral dimension, the convolution kernel size of the one-dimensional convolution is 1x10, and the convolution channel number increases step by step in each feature extraction module; the spatial convolution layer is configured as a two-dimensional convolution for convolution operation on the spatial dimension corresponding to the spectral pretreatment data, and the convolution kernel size of the two-dimensional convolution is 3x3.

[0127] It can be understood that the specific difference between different feature extraction modules in the present application lies in the different convolution channel numbers, wherein the convolution channel number can be understood as the number of feature maps generated by one-dimensional convolution on the spectral dimension, which is used to represent the change pattern and local correlation of the spectrum in different absorption sections. With the increase of the convolution channel number, the network can learn the subtle changes of the water absorption peak, the correlation between adjacent wavebands and the spectral disturbance caused by the stacking form in a higher dimension, so that the spectral representation from the shallow layer to the deep layer gradually transitions from a simple local curve pattern to a composite feature that can depict the relationship between a longer range of wavebands. Those skilled in the art can adjust the channel number of one-dimensional convolution according to the spectral sampling interval, the number of effective wavebands and the target detection accuracy, to obtain a more suitable spectral feature decomposition ability for the scene.

[0128] In some optional specific embodiments, the number of convolution channels can also be understood as the number of feature planes output by a two-dimensional convolution in the spatial dimension, for capturing the texture differences, local reflection intensity changes, and spatial distribution characteristics affected by environmental light or roughness of the straw surface in the detection area. The setting of the number of two-dimensional convolution channels determines whether the network can distinguish spatial disturbances of different scales, such as high-frequency textures in loose fiber areas, low-frequency brightness changes in compacted areas, or local shadow structures caused by light angles. In scenes with large changes in imaging conditions or complex stacking forms, appropriately increasing the number of spatial convolution channels can enhance the network's ability to distinguish spatial textures, making the generated spectral-spatial joint features more stable in responding to scene conditions in the subsequent fusion stage.

[0129] In one example, the attention fusion subnetwork includes:

[0130] A query vector generation unit configured to linearly map the spectral-spatial joint features of the three scales output by the three feature extraction modules respectively, to generate corresponding query vectors;

[0131] A conditional encoding layer configured to fuse and map the environmental parameter data and the straw basic information to generate key vectors and value vectors for attention calculation;

[0132] A conditional attention calculation layer configured to perform attention weight calculation based on the query vectors, the key vectors, and the value vectors to obtain weight coefficients for each scale feature, wherein the weight coefficients are used to represent the credibility of different spectral regions under the current temperature and humidity and stacking density conditions;

[0133] A feature weighting layer configured to perform channel-by-channel weighting adjustment on the corresponding spectral-spatial joint features according to the weight coefficients to obtain fused features.

[0134] In this embodiment, the attention fusion subnetwork takes the mutual matching relationship between the spectral-spatial joint features and the condition vectors as the core of modeling. The different scale features output by the three feature extraction modules are first projected to a unified dimension via independent linear mapping or small fully connected networks, forming a corresponding query vector sequence, each query vector corresponding to one spectral-spatial position in the feature map. The environmental parameter data and the straw stacking density information are first fused and mapped in the conditional encoding layer: for example, the temperature, humidity, light intensity, stacking height, etc. are concatenated and input into a multi-layer perceptron, and a fixed-length vector is output, and then two linear transformations are performed to generate key vectors and value vectors respectively. In this way, the condition information is encoded into a potential representation of which feature patterns the model should focus on in the current scene, rather than just being a simple auxiliary feature attached to the input end.

[0135] Further, the conditional attention calculation layer can adopt scaled dot-product attention or other equivalent calculation forms in implementation:

[0136] The inner product or correlation measure of the query vector at each scale and the conditional key vector is obtained, and an evaluation value representing the degree of fit of the position feature to the current environment-piled state is obtained; then the evaluation value is scaled and Softmax normalized to generate a weight coefficient sequence. The weight coefficient reflects the credibility of different spectral regions under the given temperature and humidity and stacking density conditions on the one hand, and reflects the relative importance of the features of different scales in the current scene on the other hand. In parameter implementation, the key vector and the value vector can be broadcast to the entire feature map in the channel dimension, so that the same scene condition produces a consistent modulation effect on all positions. Different condition mapping branches can also be configured for different scales to highlight the role difference between shallow and deep features in complex scenes. Those skilled in the art can make a selection according to the computing resources and accuracy requirements.

[0137] Further, the feature weighting layer adjusts the spectral-spatial joint features of each scale after receiving the attention weight. Specifically, the attention weight can be regarded as a set of scaling factors for channels or wavebands, and is multiplied with the original feature element by element or channel by channel to realize the suppression of unstable wavebands or spatial regions disturbed by the environment, while enhancing the feature response that is more matched to the current scene condition. The weighted multi-scale features are integrated into unified fusion features through cascading, adding or cross-scale fusion, which are used for subsequent water content regression detection.

[0138] In one example, the output module comprises:

[0139] The first granularity regression branch is configured to regress and fit the spectral-spatial joint features corresponding to the first scale in the fusion features, output a first granularity water content detection value, and perform preliminary screening on the straw moisture;

[0140] The second granularity regression branch is configured to regress and fit the spectral-spatial joint features corresponding to the second scale in the fusion features, and generate a second granularity water content detection value in combination with the straw variety;

[0141] The third granularity regression branch is configured to regress and fit the spectral-spatial joint features corresponding to the third scale in the fusion features to output a third granularity water content detection value;

[0142] The multi-scale loss weighting branch is configured to calculate the mean square error loss of the first granularity water content detection value, the second granularity water content detection value and the third granularity water content detection value respectively, and calculate a straw water content detection value according to the mean square error loss.

[0143] Specifically, in related spectral modeling and deep learning regression tasks, multi-scale regression structures are commonly used to process input data with hierarchical feature distribution. Such structures usually input feature maps from different depths into independent regression heads to capture different levels of information from coarse to fine. For example, shallow features are more likely to reflect local intensity fluctuations and short-range absorption structures of the original spectral curve, mid-level features can depict the correlation between wavebands, spectral segmentation trends, and spatial textures with a certain range, while deep features contain global absorption patterns across regions and wavebands. Traditional single-scale regression methods may ignore obvious near-surface absorption differences if they only rely on deep features, or lack robustness to changes in stacking density or light disturbances if they only rely on shallow features.

[0144] In some optional specific implementations, each regression branch in the embodiment can use a lightweight regression subnetwork with one or more fully connected layers. The input of the subnetwork is a fusion feature tensor of the corresponding scale, which is converted into a fixed-length feature vector after flattening or global average pooling, and then output the corresponding moisture content prediction value through the regression layer. For the mid-scale branch that needs to combine variety information, the feature vector and the variety encoding vector can be spliced or linearly fused to enable the network to adaptively correct the differences in absorption characteristics of different varieties. Such fusion methods have been widely used in existing agricultural product spectral classification and regression tasks, and their implementation relies on conventional fully connected layers and activation functions, which can be directly constructed by those skilled in the art according to conventional deep learning frameworks.

[0145] Further, for the weighting of multi-scale loss, the existing deep supervision strategy usually calculates the regression loss for each level of prediction result respectively, and performs weighted summation based on the preset or learned weights, so that the network can optimize the feature extraction capability of different levels during backpropagation. The theoretical basis is that shallow features are more sensitive to local absorption structures, and deep features are more robust to overall absorption trends. By joint optimization, shallow and deep layers can constrain each other in the convergence direction, thereby avoiding the situation that shallow layers overfit noise or deep layers ignore local waveband information. The embodiment uses mean square error as a single loss, and those skilled in the art can adjust the loss weight or use an adaptive weighting method based on gradient amplitude to further improve the training stability. Through multi-scale supervision and weighted convergence, the final output result has both local sensitivity and overall stability, which is suitable for the moisture content estimation of loose structure straw and spectral data significantly disturbed by the environment under different stacking conditions.

[0146] Next, the technical content of the method of the application about straw hyperspectral data acquisition is further expanded.

[0147] Reference Figure 7 ,Figure 7 FIG. 1 is a schematic diagram of a near-infrared hyperspectral imaging device according to an embodiment of the present application.

[0148] Figure 7 It is shown that the near-infrared hyperspectral imaging device not only includes a hyperspectral camera and other sensors (not shown in the figure), but also is additionally provided with an airflow nozzle for applying a controllable disturbance to the straw stacking area before or during the acquisition of the spectrum. This structure is particularly suitable for natural stacking or bulk material scenarios.

[0149] It can be understood that the airflow nozzle is used to spray a short-time pulse airflow to the straw stacking area to cause a slight deformation or fiber rearrangement of the surface layer of the stack, thereby changing the scattering path of light in the local area, so that the hyperspectral camera can acquire the change sequence of the spectrum before and after the disturbance. Since the bulk straw has a high void ratio and an unstable surface layer structure, the transient change of the spectrum can often reflect whether the internal hierarchy is representative more than the static structure.

[0150] For example, in the case of large differences in stacking density or local existence of shadow shielding, the change amplitude of the spectrum obtained after slight disturbance can be used to infer whether the spectrum of the region is dominated by accidental factors of the surface layer, and then determine whether the region can be used as an effective sample for subsequent modeling.

[0151] In some optional specific implementations, the airflow nozzle can be controlled by an electromagnetic valve, an air pump or a compressed air pipeline, and the spraying intensity can be set according to the loose degree of the stack, the stacking height and the detection area size. Those skilled in the art can select different nozzle shapes or spraying angles according to actual needs to obtain more uniform or more localized disturbance effects. The present application does not limit the type and specific implementation of the nozzle as long as it can apply a controllable disturbance without damaging the structure of the stack.

[0152] In one example, the acquisition of the straw hyperspectral data covering a preset wavelength range includes:

[0153] S1.1: acquiring a static spectrum of the straw in the detection area;

[0154] Specifically, during static acquisition, the airflow nozzle is kept closed, and the hyperspectral camera continuously acquires several frames of hyperspectral data in the undisturbed state, and a group of stable static spectrum cubes is obtained through inter-frame averaging or median filtering, which is used to depict the original surface response under the current stacking form and environmental conditions.

[0155] S1.2: rearranging the surface layer of the straw by airflow disturbance through the airflow nozzle to acquire a spectrum sequence;

[0156] Specifically, the airflow disturbance stage controls the airflow nozzle to spray a short-time, directional airflow above or aside the detection area, causing the straw fibers on the surface layer of the stack to produce slight displacement or rearrangement, while the overall structure of the stack remains basically stable. The disturbance intensity and duration need to be matched with the height and compactness of the stack, so that the surface layer deforms enough to change the local light scattering path, while the straw is not blown out of the field of view or the stack form is not damaged. Before the airflow is triggered, the hyperspectral camera remains in continuous acquisition state, recording the start and end time of the airflow through time stamp or synchronous trigger signal, forming a spectral sequence before and after the disturbance, to reflect the spectral evolution of the stack in the dynamic process.

[0157] In the present embodiment, the airflow nozzle can be connected to an adjustable compressed air source, and the millisecond-level switch control is realized through a solenoid valve. The nozzle outlet shape can be a fan shape or a porous array, so that the airflow forms a relatively uniform velocity field in the detection area; the injection direction can be slightly inclined to the surface of the stack, so that the airflow slides along the slope rather than impinges directly, to reduce the risk of large-scale overturning. The hyperspectral camera is set to a higher frame rate in this stage, for example several frames to several tens of frames per second, so as to capture the spectral changes in the initial moment of disturbance and the gradual stabilization process of the surface layer.

[0158] S1.3: According to the spectral difference characteristics between the static spectrum and the spectral sequence, a representative score for representing the volume of the straw stack in the detection area is calculated;

[0159] Specifically, the calculation of the representative score takes the static spectrum as the baseline, and the spectral sequence during the disturbance is regarded as a series of observations of the same stack under different surface layer arrangement states. For the area with good volume representation, i.e. the area where the moisture distribution inside the stack is relatively uniform and the surface layer and the internal optical properties are close, the slight rearrangement of the surface layer has limited effect on the overall reflectance characteristics, and the difference between the static spectrum and the disturbance spectrum mainly shows small amplitude and random disturbance. For areas with poor representation, such as the peak of the stack or the local collapse area, the surface layer may be composed of straws or impurities that are significantly different from the internal components, or there may be strong shadow blocking, and the exposure state of the surface layer material will change greatly after the airflow disturbance, causing the spectrum to produce a significant shift in a specific wavelength band or spatial position. By comparing the difference distribution between the static spectrum and the spectrum at each time point, the sensitivity of the spectrum in this area to the random changes of the surface layer can be indirectly reflected.

[0160] In the present embodiment, the static spectrum and the perturbed spectra in the spectral sequence can be pre-processed uniformly, including but not limited to waveband clipping, wavelet denoising and standard normal variate correction, to eliminate system noise and overall brightness changes in the acquisition process. Subsequently, the difference vectors between the spectra at each time point during the perturbation and the static spectrum can be calculated within each spatial sub-block, and the waveband distribution of the difference vectors can be statistically analyzed, such as evaluating the difference range, change direction and evolution trend over time of the water content sensitive waveband. If the difference values are mainly concentrated in the non-sensitive waveband or show zero mean and low variance distribution at multiple time points, it indicates that the airflow disturbance only changes the microscopic arrangement without significantly changing the volume absorption characteristics, and this region can be considered to have higher representativeness; on the contrary, if there is a persistent and consistent strong deviation in the key water absorption waveband, it indicates that there is a large difference between the surface structure and the interior, and the static spectrum of this region is less representative of the overall stack moisture content. The representativeness score can be constructed as a comprehensive index reflecting the spectral change amplitude, stability and coupling degree with the moisture sensitive waveband, and then normalized and mapped to a preset interval for comparison with the difference threshold.

[0161] S1.4: if the representativeness score is less than or equal to a preset difference threshold, the static spectrum is taken as the straw hyperspectral data;

[0162] Specifically, when the representativeness score of a certain detection region is below the difference threshold, it indicates that the spectral change of this region before and after the airflow disturbance is mainly small-scale random disturbance, which is not sufficient to indicate that there is a systematic difference between the surface and the interior. In this case, the static spectrum can well reflect the optical response of the region in the current stacking state, and further complex processing of the perturbation sequence has limited benefits. Based on this judgment, the static spectrum can be directly used as the hyperspectral data for subsequent modeling, which simplifies the data processing process and avoids introducing additional noise due to unnecessary transformation.

[0163] In the present embodiment, the difference threshold can be obtained by statistically analyzing a large number of samples with high representativeness, for example, selecting a stack with uniform interior as a reference after artificial inspection or offline verification, calculating the distribution interval of the representativeness score, and taking a certain quantile as the threshold. In this way, when the score of a new detection region is less than or equal to the threshold, it can be highly probable that the spectrum has sufficient representativeness.

[0164] S1.5: if the representativeness score is greater than the difference threshold, the static spectrum is weighted according to the spectral difference characteristics, and the weighted static spectrum is taken as the straw hyperspectral data;

[0165] Specifically, when the representative score exceeds the difference threshold, it indicates that there is a certain degree of consistent deviation between the static spectrum and the perturbation sequence in the key waveband, reflecting that there is a difference between the surface structure and the internal state of the detection area. If the static spectrum is directly used for modeling, it may cause the water content estimation to deviate from the bulk volume average. In this case, the spectrum information closer to the internal true state in the perturbation sequence can be used to correct the static spectrum, so that the obtained weighted spectrum still maintains a single frame structure in form, but its waveband intensity and morphology are closer to the steady-state response after multi-frame integration. The weighting process can assign different weights to different wavebands or different time points based on spectral difference characteristics, so as to emphasize the internal layer information while suppressing the influence of the surface layer accidental state.

[0166] In the present embodiment, the difference between each frame of the perturbation sequence and the static spectrum can be analyzed first, and the time period in which the change in the moisture sensitive waveband converges in the same direction is identified, and these time points are regarded as the window of internal information release. Then, the contribution weight of each time point is calculated according to the difference amplitude and stability, and the static spectrum and the spectrum at these time points are linearly combined or segmented combined according to the weight. For example, some wavebands can retain more static spectrum information to reflect the overall structural characteristics of the pile; other wavebands can draw more on the spectrum that tends to be stable after perturbation to make up for the deviation caused by the surface layer anomaly. Through this waveband adaptive weighting method, the information in the time dimension can be folded back into a single frame spectrum without increasing the data dimension, so that the weighted spectrum contains both the overall characteristics of the static observation and the internal properties revealed by the perturbation response.

[0167] In some optional specific embodiments, if the representative score is greater than the difference threshold, the environmental parameter data and the straw basic information also need to be further corrected, because:

[0168] The representative score has shown that there is a certain degree of inconsistency between the surface spectrum of the current detection area and the bulk volume state, and this inconsistency is not only reflected in the spectrum itself, but also often accompanied by a mislocation in space and time, for example, there is a distance difference between the installation position of the environmental sensor and the field of view of the hyperspectral camera, and the surface layer of the pile moves locally during the perturbation process, so that the temperature and humidity data and the stacking density data originally associated with the spectrum of this region are actually closer to the state of the adjacent region or different time slices. If the original environmental parameters and the stacking density are still directly used for subsequent conditional modeling, the hyperspectral data will tend to the true volume state after weighted correction, while the conditional vector will still remain in the mislocation scenario, resulting in a new mismatch between the two, which will drive the subsequent attention fusion and regression network with contradictory information, weakening the effect brought by the aforementioned representative correction.

[0169] In this embodiment, by appropriately modifying the environmental parameter data and straw basic information under the condition that the representative score exceeds the threshold value, the condition quantities can be realigned to the effective scene consistent with the weighted spectrum. For example, based on the time series of environmental parameters during the disturbance, the temperature and humidity, illumination and stacking density values can be selected or reconstructed within a time window more consistent with the spectral change trend, and the stacking density of the current area can also be interpolated or weighted smoothed according to the representative score and density distribution of the adjacent detection area. The modified condition quantities thus obtained no longer simply reflect the original readings of the sensor at a certain moment, but maintain a closer logical association with the state of the representative corrected spectrum data. When the modified condition vector is input into the detection network, the scene clues on which the attention fusion subnetwork relies when assigning feature weights are directed to the same physical state as the spectral representation, which helps the network to focus its learning on the true moisture-related changes rather than being disturbed by pseudo-differences introduced by temporal and spatial mismatches, thereby improving the stability and credibility of the moisture content prediction results as a whole.

[0170] In one example, if the representative score is greater than the difference threshold, the method further comprises:

[0171] Collecting environmental parameter data and straw basic information;

[0172] Extracting a plurality of candidate environmental parameter sets from the environmental parameter data and straw basic information;

[0173] Constructing a spectral feature vector according to the spectral difference feature, and calculating a corresponding matching score based on the matching correlation between the spectral feature vector and each candidate environmental parameter in the candidate environmental parameter set;

[0174] Normalizing the matching scores to obtain the matching weights of each candidate environmental parameter, and weighting each candidate environmental parameter set according to the matching weights to obtain the environmental parameter data and straw basic information matched with the straw hyperspectral data.

[0175] Specifically, when the representative score exceeds the difference threshold, it indicates that the static spectrum and the disturbed spectrum have shown a directional, non-random systematic difference, and the change trend is related to the influence of the stack structure, the local optical path, the air humidity or the stacking density. In hyperspectral imaging, environmental temperature and humidity and illumination conditions can cause measurable effects on the spectrum by changing the depth of the water absorption band, the baseline height of the scattering peak, and the effective optical path of near-infrared diffuse reflection, so there is a discernible correlation between the spectral difference pattern and the specific environmental parameters.

[0176] In this embodiment, to obtain the environmental scenario that is most consistent with the spectral behavior, multiple candidate environmental parameter sets can be selected from the time-series environmental data recorded by the detection device, such as the sampling points of temperature, humidity, illumination and stacking density within a certain time window before and after the disturbance, or the synchronously recorded environmental information collected from the spatially adjacent area. Each candidate environmental parameter set contains a possible combination of environmental state values, which is used to provide a reference scenario for spectral changes. Subsequently, feature extraction can be performed on the disturbed spectral sequence, and the difference between the static spectrum and the disturbed frame is integrated by waveband and spatial position to form a spectral feature vector. This feature vector can be generated by weighted average, principal component extraction or a lightweight sub-network, so as to highlight the change intensity and direction of the moisture-sensitive waveband. The calculation of the matching score can be based on correlation coefficient, vector angle, Mahalanobis distance, spectral line slope similarity, etc., to measure the consistency between the spectral difference structure and the environmental change trend of each candidate environmental parameter set. For example, when the temperature and humidity in the candidate environmental set show a rising trend, and the spectral feature vector shows a consistent direction of absorption peak enhancement, the matching score is higher.

[0177] Further, the matching scores of all candidate environmental parameter sets are normalized to form a set of weighted matching weights, which are used to measure the credibility of each candidate environmental parameter set in explaining the spectral difference. Subsequently, by weighting and fusing the candidate environmental parameter sets according to the matching weights, a revised environmental parameter set can be obtained, which is statistically more consistent with the actual spectral performance and can reflect the real scene state behind the spectral difference. For example, if the humidity of a certain candidate parameter set is high, and the spectral difference shows a deepening trend of the absorption section that is often seen when the humidity rises, then this candidate set will have a larger proportion in the weighting, while other candidate sets that do not conform to the spectral features will automatically decay. The revised environmental parameter data obtained in this way not only retains the authenticity of the collected data, but also automatically calibrates through the physical mechanism of spectral difference, so that the subsequent attention fusion network can obtain more matched scene clues when assigning waveband weights, reducing the disturbance caused by the spatio-temporal misalignment between the original environmental data and the weighted spectrum to the model reasoning, and helping to improve the stability of the final water content prediction. Those skilled in the art can implement this process using conventional numerical similarity calculation methods and linear weighting methods without relying on complex model structures.

[0178] In one example, the attention fusion sub-network further comprises:

[0179] scaling the key vector and the value vector according to the matching weights to adjust an attention distribution of the attention fusion sub-network, wherein the scaling comprises:

[0180] generating a scaling factor matrix corresponding to the key vector and the value vector based on the matching weights;

[0181] The key vector and the value vector are twice normalized according to the scaling factor matrix to generate an adjusted key vector and a value vector consistent with the representative score of the straw hyperspectral data.

[0182] Specifically, a set of scaling factors can be generated in the channel dimension or the feature dimension in combination with the matching weight of the representative score and each candidate environmental parameter, so that in the scenario with higher matching degree, the key vector and the value vector of the corresponding dimension are amplified, thereby producing a higher attention response in the subsequent dot product operation; while for the scenario with lower matching degree, the influence of this part of the conditional information in the attention space is automatically weakened by reducing the corresponding scaling factor. In this way, the attention mechanism when calculating the Query- Key similarity no longer depends only on the parameter distribution implicitly learned in the network training process, but is additionally subject to external weight constraints related to the current representative of the hyperspectral data, so that the attention distribution is closer to the real coupling relationship between multi-source data.

[0183] Although the embodiments of the present application have been shown and described above, it should be understood that the above embodiments are exemplary and should not be construed as limiting the present application, and those of ordinary skill in the art can make changes, modifications, replacements and variations to the above embodiments within the scope of the present application.

Claims

1. A non-contact detection method for straw moisture content based on near-infrared hyperspectrum, applied to a detection device, characterized in that, The detection device comprises a near-infrared hyperspectral imaging device and a processor, the near-infrared hyperspectral imaging device comprises a hyperspectral camera, a temperature and humidity sensor, an illumination sensor and a laser ranging sensor, and the method comprises: Acquiring straw hyperspectral data covering a preset wavelength range, and synchronously collecting environmental parameter data and straw basic information, wherein the straw basic information is straw stacking density information collected by the laser ranging sensor; Performing wave band clipping, wavelet denoising and standard normal variable correction on the straw hyperspectral data to obtain spectral pretreatment data, and performing normalization coding on the environmental parameter data and the straw basic information to obtain a condition vector; Inputting the spectral pretreatment data and the condition vector as input parameters into a preset detection network, processing the input parameters through the detection network, and obtaining a straw moisture content detection value.

2. The method according to claim 1, wherein the method is characterized by, Performing wave band clipping, wavelet denoising and standard normal variable correction on the straw hyperspectral data to obtain spectral pretreatment data, comprising: Selecting a target wave band matched with water absorption from a preset spectral range from the hyperspectral data to obtain target clipped wave band data; Performing multi-scale wavelet decomposition on the target clipped wave band data based on a DB4 wavelet basis, compressing the coefficients at a preset decomposition level, and then performing wavelet reconstruction on the compressed coefficients to obtain denoised spectral data; Performing standard normal variable correction on each spectral vector of the denoised spectral data, comprising mean centering processing of the spectral vector and normalization according to the standard deviation, to obtain the spectral pretreatment data.

3. The method according to claim 1, wherein the method is characterized by, The detection network comprises a feature extraction subnetwork, an attention fusion subnetwork and an output module, wherein: The feature extraction subnetwork is composed of three feature extraction modules, which are used to extract three scales of spectral-spatial joint features from the spectral pretreatment data, each feature extraction module comprises a spectral convolution layer and a spatial convolution layer, and each feature extraction module further comprises a residual block, the residual block comprises a batch normalization layer and a nonlinear activation layer, and is used to perform jump connection on the output of the feature extraction module in the feature transmission process; The spectral convolution layer is configured as one-dimensional convolution, which is used for convolution operation on the spectral dimension, the convolution kernel size of the one-dimensional convolution is 1x10, and the convolution channel number increases gradually in each feature extraction module; the spatial convolution layer is configured as two-dimensional convolution, which is used for convolution operation on the spatial dimension corresponding to the spectral pretreatment data, and the convolution kernel size of the two-dimensional convolution is 3x3; The attention fusion subnetwork is used to weight and fuse the three scales of spectral-spatial joint features according to the environmental parameter data and the straw basic information, and outputs fused features.

4. The method according to claim 3, wherein the method is characterized by, The attention fusion subnetwork comprises: A query vector generation unit configured to linearly map the three scales of spectral-spatial joint features output by the three feature extraction modules to generate corresponding query vectors; A condition coding layer configured to fuse and map the environmental parameter data and the straw basic information to generate key vectors and value vectors for attention calculation; a conditional attention calculation layer configured to perform attention weight calculation based on the query vector, the key vector, and the value vector to obtain a weight coefficient for each scale feature, wherein the weight coefficient is used to represent the reliability of different spectral regions under the current temperature and humidity and stacking density conditions; a feature weighting layer configured to perform channel-by-channel weighting adjustment on the corresponding spectral-spatial joint feature according to the weight coefficient to obtain a fused feature.

5. The method according to claim 3, wherein the method is characterized by, The output module includes: a first granularity regression branch configured to perform regression fitting on the spectral-spatial joint feature corresponding to the first scale in the fused feature to output a first granularity moisture content detection value for preliminary screening of the straw moisture content; a second granularity regression branch configured to perform regression fitting on the spectral-spatial joint feature corresponding to the second scale in the fused feature and combine the straw variety to generate a second granularity moisture content detection value; a third granularity regression branch configured to perform regression fitting on the spectral-spatial joint feature corresponding to the third scale in the fused feature to output a third granularity moisture content detection value; a multi-scale loss weighting branch configured to calculate a mean square error loss for the first granularity moisture content detection value, the second granularity moisture content detection value, and the third granularity moisture content detection value, respectively, and calculate a straw moisture content detection value according to the mean square error loss.

6. The method according to claim 4, wherein the method is characterized by, The near-infrared hyperspectral imaging device further includes an airflow nozzle, and the acquisition of the straw hyperspectral data covering a preset wavelength range includes: acquiring a static spectrum of the straw in the detection area; rearranging the surface layer of the straw by airflow disturbance of the airflow nozzle to collect a spectrum sequence; calculating a representative score for representing the stacking volume of the straw in the detection area according to a spectral difference feature between the static spectrum and the spectrum sequence; if the representative score is less than or equal to a preset difference threshold, taking the static spectrum as the straw hyperspectral data; if the representative score is greater than the difference threshold, weighting the static spectrum according to the spectral difference feature, and taking the weighted static spectrum as the straw hyperspectral data.

7. The method according to claim 6, wherein the method is characterized by, If the representative score is greater than the difference threshold, the method further includes: collecting environmental parameter data and straw basic information; extracting a plurality of candidate environmental parameter sets from the environmental parameter data and the straw basic information; constructing a spectral feature vector according to the spectral difference feature, and calculating a corresponding matching score based on the matching correlation between the spectral feature vector and each candidate environmental parameter in the candidate environmental parameter set; normalizing the matching score to obtain a matching weight of each candidate environmental parameter, and weighting each candidate environmental parameter set according to the matching weight to obtain environmental parameter data and straw basic information matched with the straw hyperspectral data.

8. The method according to claim 7, wherein the method is characterized by, The attention fusion subnetwork further includes: scaling the key vector and the value vector according to the matching weight to adjust the attention distribution of the attention fusion subnetwork, wherein the scaling includes: generating a scaling factor matrix corresponding to the key vector and the value vector based on the matching weight; The key vector and the value vector are twice normalized according to the scaling factor matrix to generate adjusted key vectors and value vectors consistent with a representative score of the straw hyperspectral data.

9. A non-contact detection system for straw moisture content based on near-infrared hyperspectrum, for realizing the non-contact detection method for straw moisture content based on near-infrared hyperspectrum as claimed in any one of claims 1-8, characterized in that, The system comprises: A near-infrared hyperspectral imaging module configured to acquire straw hyperspectral data covering a preset wavelength range through a hyperspectral camera, and to synchronously acquire environmental parameter data and straw basic information through a temperature and humidity sensor, an illumination sensor, and a laser ranging sensor; the near-infrared hyperspectral imaging module comprises an airflow nozzle for airflow disturbance of the straw to acquire a spectral sequence and calculate a representative score; A multi-source data processing module configured to perform band clipping, wavelet denoising, and standard normal variable correction on the straw hyperspectral data to form spectral pretreatment data, and to generate a condition vector according to the environmental parameter data and the straw basic information; when the representative score is greater than a preset difference threshold, to calculate a matching weight according to a plurality of candidate environmental parameter sets and to generate target environmental parameter data and straw basic information matched with the straw hyperspectral data based on the matching weight; A water content detection module configured to input the spectral pretreatment data, the target environmental parameter data, and the straw basic information into a preset detection network, to process through a feature extraction subnetwork, an attention fusion subnetwork, and an output module, and to generate a straw water content detection value.

10. The non-contacting system for detecting the moisture content of straw based on near-infrared hyperspectrum according to claim 9, characterized in that, The multi-source data processing module comprises: A spectral pretreatment unit configured to perform band clipping, wavelet denoising, and standard normal variable correction on the straw hyperspectral data to generate spectral pretreatment data; A condition vector generation unit configured to normalize and encode the environmental parameter data and the straw basic information to form an initial condition vector for attention fusion; A matching weight calculation unit configured to, when the representative score is greater than a preset difference threshold, calculate a matching weight corresponding to a spectral difference feature from a plurality of candidate environmental parameter sets, and to generate target environmental parameter data and straw basic information matched with the straw hyperspectral data based on the matching weight.

Citation Information

Patent Citations

  • Method for determining maize straw components by near-infrared spectrometer

    CN106932365A

  • Capacitance acquisition device and method for predicting moisture content of straw

    CN114062448A

  • Rice straw decomposition process full life cycle monitoring system based on cloud platform

    CN121074669A