A method for training a model for early detection of tomato bacterial wilt, a method for detecting tomato bacterial wilt, and a computer readable storage medium

CN123016207APending Publication Date: 2026-10-30ZHEJIANG FORESTRY UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611217141.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-12
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0006]其一,感染初期的生理扰动极为微弱,所引起的光谱差异往往小于品种基因型差异、生育期动态变化、叶片空间异质性及田间环境噪声(光照角度、云量变化、土壤背景反射等),致使有效信号淹没于强背景干扰之中,由此导致早期病害识别精度差

Benefits of technology

[0045]1:本发明,通过训练得到的CWT-STNet模型,克服因早期微弱光谱信号难以提取、多尺度特征难以融合、长程依赖难以建模而导致的青枯病早期检测不精的技术难题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123016207A_ABST
    Figure CN123016207A_ABST
Patent Text Reader

Abstract

The application discloses a tomato early detection model training method and a detection method for tomato bacterial wilt, and a computer readable storage medium. The training method comprises the following steps: obtaining a training sample set, which comprises hyperspectral images of a tomato canopy in a near-infrared to short-wave infrared band range; extracting a region of interest of the tomato canopy; obtaining average spectra of pixel spectra in the region of interest and performing preprocessing; converting the average spectra into wavelength-scale two-dimensional wavelet coefficient features through continuous wavelet transform; fusing the preprocessed spectral features and the wavelet coefficient features to obtain fused features; inputting the fused features into a CWT-STNet model for training, outputting a prediction probability distribution of a tomato bacterial wilt severity grade, taking a bacterial wilt severity grade label as a supervision target, calculating a loss function, and iteratively updating the model until the loss function converges to a preset value, so that a trained model is obtained. According to the application, early detection of bacterial wilt is more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of agricultural disease technology, specifically to a training method for an early detection model of bacterial wilt in tomatoes, a detection method, and a computer-readable storage medium. Background Technology

[0002] Bacterial wilt of tomatoes is a typical soil-borne, devastating vascular disease caused by Ralstonia solanacearum. After invading the roots, the pathogen multiplies rapidly within the xylem vessels and secretes extracellular polysaccharides, leading to blockage of the xylem vessels and degradation of the cell walls, thereby disrupting the plant's water transport system. Under suitable conditions such as temperatures of 25–35℃, high humidity, and slightly acidic soil, the disease has a short incubation period and breaks out rapidly, often causing irreversible wilting of the entire tomato plant. In severe cases, yield losses can reach 50%–80%, or even total crop failure.

[0003] The early infection stage of bacterial wilt (i.e., the incubation period or asymptomatic period) typically lasts from several days to two weeks. During this period, the plants do not exhibit typical wilting appearance; only subtle physiological disturbances are observed, including decreased stomatal conductance, reduced transpiration rate, slight fluctuations in leaf water potential, minor shifts in chlorophyll content and fluorescence parameters, and submicroscopic changes in the waxy layer and intercellular structure of the leaf surface. Although these responses provide a potential characterization window for early diagnosis, their low signal intensity, large individual variability, and susceptibility to fluctuations in ambient light, temperature, and humidity make effective identification through manual field inspections or routine morphological observations almost impossible.

[0004] In the field of non-destructive sensing, hyperspectral imaging (HSI) technology has been gradually applied to crop nutrition diagnosis and abiotic stress detection due to its ability to simultaneously acquire spectral reflectance information of targets in dozens to hundreds of consecutive narrow bands within the visible-near-infrared (400-2500 nm) range, and its unique advantage of "image-spectrum integration". Theoretically, disease-induced leaf pigment degradation, water redistribution, changes in cell wall structure, and variations in canopy geometry will all leave measurable spectral imprints in specific bands (such as green peaks, red edges, near-infrared plateaus, and water absorption bands), providing a physical basis for early disease identification based on spectral characteristics.

[0005] However, in practical detection of the early asymptomatic stage of bacterial wilt in tomatoes, hyperspectral technology faces the following challenges:

[0006] Firstly, the physiological disturbances in the early stages of infection are extremely weak, and the resulting spectral differences are often smaller than those caused by varietal genotypic differences, dynamic changes in the growth period, spatial heterogeneity of leaves, and field environmental noise (light angle, cloud cover changes, soil background reflection, etc.). This causes the effective signal to be submerged in strong background interference, resulting in poor accuracy in early disease identification.

[0007] Secondly, hyperspectral data is characterized by high correlation between bands, nonlinear coupling, and strong redundancy. Disease information is not only reflected in the absorption depth changes of a single band, but also contained in the narrowband absorption peak morphology, broadband reflectance slope drift, and cross-regional (such as visible light and shortwave infrared) cooperative variation patterns. Traditional single-scale spectral indices (such as NDVI, PRI) or simple difference transformations are difficult to fully capture these multi-order interactive features, resulting in poor accuracy of early disease identification.

[0008] Third, existing mainstream machine learning methods (such as support vector machines and random forests) and shallow convolutional neural networks have limited receptive fields or single feature extraction scales, and are not capable of modeling the dependencies between long-distance bands, which leads to poor accuracy in early disease identification.

[0009] Fourth, the lack of an explicit explanation mechanism for the basis of model decision-making leads to low reliability of detection results, making it difficult to meet the stringent requirements for risk of misjudgment in agricultural production. Summary of the Invention

[0010] To address the shortcomings of existing technologies, the purpose of this application is to provide a training method for an early detection model of bacterial wilt in tomatoes, an early detection method for bacterial wilt in tomatoes, and a computer-readable storage medium, thereby solving at least one of the technical problems.

[0011] A training method for a CWT-STNet tomato bacterial wilt early detection model includes:

[0012] Step 1: Obtain the training sample set, which contains hyperspectral images of tomato canopy in the near-infrared to short-wave infrared band.

[0013] Step 2: Extract the region of interest (ROI) from the hyperspectral image of the tomato canopy;

[0014] Step 3: Calculate the average spectrum of the pixel spectra within the region of interest and perform preprocessing;

[0015] Step 4: Convert the average spectrum into wavelength-scale two-dimensional wavelet coefficient features using continuous wavelet transform;

[0016] Step 5: Fuse the preprocessed spectral features with the wavelet coefficient features to obtain the fused features;

[0017] Step 6: Input the fused features into the CWT-STNet model for training. The model models the global dependencies between different bands and different wavelet scales in the fused features and outputs the predicted probability distribution of the severity level of bacterial wilt in tomatoes. During training, the bacterial wilt severity level label corresponding to the training sample set is used as the supervision target. The loss function is used to calculate the loss value between the predicted probability distribution and the supervision target, and the CWT-STNet model is iteratively updated until the loss function converges to the preset value to obtain the trained model.

[0018] This technical solution acquires hyperspectral images in the near-infrared to short-wave infrared band. This specific band range covers the water absorption band and the spectral region related to cell wall structure changes, ensuring the physical correlation between the data and the physiological mechanism of disease infection from the source. Based on this, the region of interest in the tomato canopy is extracted and the average spectrum is calculated, effectively eliminating non-target background interference such as flower pots and substrates. This allows subsequent analysis to accurately target the reflectance signal of the canopy tissue itself. A synergistic purification effect is then achieved through a preprocessing process, initially suppressing strong background interference and highlighting weak disease fingerprints before the signal enters the model. Subsequently, continuous wavelet transform converts the preprocessed one-dimensional average spectrum into wavelength-scale two-dimensional wavelet coefficient features. Low-scale coefficients are used to accurately capture local high-frequency weak absorption peaks related to early infection, separating and selectively enhancing weak signals originally masked by broad background changes in the original spectrum from the strong background. Finally, the preprocessed spectral features are fused with these wavelet coefficient features, ensuring that the original spectrum carrying the overall reflectance baseline information is integrated with the wavelet coefficient features. The enhanced local high-frequency details from wavelet transform complement each other, preserving the global context for disease identification while injecting multi-level interactive features that traditional single-scale spectral indices cannot capture. Furthermore, the fused features are input into the CWT-STNet model, which models the global dependencies between different bands and different wavelet scales within the fused features. This model can autonomously learn and forcibly capture cross-band reflectivity co-variation patterns caused by bacterial wilt infection, enabling weak disease signals originally scattered across multiple bands and scales to be perceived and amplified holistically through global correlation. This overcomes the inherent limitations of traditional convolutional networks (limited receptive field) and traditional machine learning (inability to model long-range dependencies). At the training and optimization level, bacterial wilt severity level labels are used as the supervised target. A loss function is employed to calculate the loss value between the predicted probability distribution and the supervised target, iteratively updating the CWT-STNet model until the loss function converges to a preset value. This allows the model parameters to be continuously optimized during training towards accurately identifying early, weak disease signals.

[0019] The aforementioned technical features form a complete causal chain from "source data targeted acquisition → background removal and signal purification → selective enhancement of weak signals in the time and frequency domain → multi-scale complementary feature fusion → global self-attention cross-band correlation modeling → end-to-end parameter optimization until convergence", which together solves the technical problem of inaccurate early detection of bacterial wilt caused by the difficulty in extracting early weak spectral signals, the difficulty in fusing multi-scale features, and the difficulty in modeling long-range dependence in existing technologies.

[0020] Preferably, in step 2, the extraction method of the region of interest in the canopy is as follows: a band ratio image is constructed based on 1353.5 nm and 1445.0 nm, and an initial canopy mask is generated by combining the threshold constraint that the reflectance of 1450.0 nm is greater than 0.08, and then small noise areas are removed.

[0021] Preferably, in step 3, the preprocessing includes baseline correction, Savitzky-Golay smoothing with a window size of 15 and a polynomial order of 3, multivariate scattering correction, minimum-maximum normalization to the [0, 1] interval, first-order derivative transformation with a difference window of 1, and deconvolution based on Wiener filtering with a window size of 5.

[0022] Preferably, in step 4, the continuous wavelet transform is calculated according to the following formula: ,in, This is the pre-processed average canopy spectrum. For the mother wavelet, For scale parameters, For wavelength shift parameters, These are the wavelet coefficients corresponding to the wavelength-scale position.

[0023] Preferably, the mother wavelet is a Mexican Hat wavelet; the spectral sampling interval is... Continuous wavelet transform was performed on the 850–1700 nm hyperspectral data to extract the scale parameters. =1 to =5 corresponds to the wavelet coefficient W(a,b) as the wavelet coefficient feature; where the scale parameter is... With equivalent characteristic wavelength width Satisfying the relation: ,scale =1 to =5 corresponds to spectral characteristics in the range of approximately 3.5Δλ to 20Δλ.

[0024] Preferably, the CWT-STNet model includes:

[0025] An input embedding layer is used to convert the fused features into a feature label sequence and map it to a high-dimensional embedding space through linear projection. The projected feature labels are encoded with position and scale to preserve the relative relationship between different bands and different scales, generating an embedding label sequence with position and scale information.

[0026] A Transformer encoder is used to receive the embedded tag sequence, model the global dependencies between different tags in the embedded tag sequence through a multi-head self-attention mechanism, capture the reflectance covariance pattern associated with bacterial wilt pathogen infection, and output an encoded feature sequence containing global context information.

[0027] The prediction head receives the encoded feature sequence, maps it to the probability distribution of each level of tomato bacterial wilt through a fully connected layer and a Softmax function, and outputs the probability distribution of tomato bacterial wilt levels.

[0028] Preferably, the loss function is a weighted cross-entropy loss function, expressed as:

[0029] ,

[0030] in, The total number of categories, For the first Class sample weights, For real labels, The model predicts the first... The probability of a class.

[0031] This invention also discloses a method for early detection of bacterial wilt in tomatoes, comprising:

[0032] Step 1: Acquire hyperspectral images of the tomato canopy in the near-infrared to short-wave infrared band;

[0033] Step 2: Extract the region of interest (ROI) from the hyperspectral image of the tomato canopy;

[0034] Step 3: Calculate the average spectrum of the pixel spectra within the region of interest and perform preprocessing;

[0035] Step 4: Convert the average spectrum into wavelength-scale two-dimensional wavelet coefficient features using continuous wavelet transform;

[0036] Step 5: Fuse the preprocessed spectral features with the wavelet coefficient features to obtain the fused features;

[0037] Step 6: Input the fused features into the CWT-STNet model trained by any of the above training methods, and output the severity level of tomato bacterial wilt.

[0038] This method for early detection of bacterial wilt in tomatoes first involves acquiring hyperspectral images of the tomato canopy in the near-infrared to short-wave infrared band. This ensures the physical correlation between the data and the physiological processes induced by disease infection, such as leaf water redistribution, pigment degradation, and changes in cell wall structure. Next, the region of interest (ROI) of the tomato canopy is extracted from the hyperspectral images, and the average spectrum is calculated. Preprocessing is then performed to effectively remove background interference from pots and substrates, and to correct for non-disease-related redundant variations introduced by differences in leaf surface morphology and uneven light exposure. This ensures that subsequent analysis accurately targets the pure reflectance signal of the canopy tissue itself. Based on this, continuous wavelet transform converts the preprocessed one-dimensional average spectrum into wavelength-scale two-dimensional wavelet coefficient features. Low-scale coefficients are used to accurately capture local weak absorption peaks and high-frequency details related to early infection, separating weak disease signals that were originally masked by broad background variations in the original spectrum from strong background noise. The process involves selective enhancement, followed by fusion of the preprocessed spectral features with multi-scale wavelet coefficient features. This allows the original spectrum, carrying the overall reflectance baseline information, to complement the enhanced local high-frequency detail information through wavelet transform. This preserves the global contextual basis for disease identification while injecting multi-order interactive features that traditional single-scale spectral indices cannot capture. Furthermore, the fused features are input into the CWT-STNet model pre-trained using the training method described in Example 1. This model models the global dependencies between different bands and different wavelet scales in the fused features. It can overcome the limitations of the restricted receptive field of traditional convolutional networks, autonomously learn and forcibly capture the cross-band reflectance co-variation pattern caused by bacterial wilt infection, enabling the weak disease signals originally scattered across multiple bands and scales to be perceived and amplified by the model as a whole through global correlation. Finally, the prediction head accurately outputs the severity level of tomato bacterial wilt.

[0039] Preferred options also include:

[0040] The contribution of the CWT-STNet model output to each input feature was calculated using the SHAP (SHapley Additive exPlanations) method, and the wavelength interpretation results of the output have a key discriminative role in the early detection of bacterial wilt in tomato.

[0041] Furthermore, the CWT-STNet model is applied pixel-by-pixel to the effective pixels of the canopy hyperspectral image to generate a pixel-level infection probability map, and the spatial expansion of tomato bacterial wilt is quantitatively characterized based on the proportion of infected pixels to effective canopy pixels.

[0042] By outputting key wavelength interpretation results, these key wavelengths precisely correspond to the characteristic spectral bands of physiological processes such as leaf water redistribution, pigment degradation, and cell wall degradation caused by bacterial wilt infection. This provides plant protection personnel with explanatory evidence that can be directly corroborated with crop physiological mechanisms, greatly improving the credibility and acceptability of model diagnostic results in agricultural production decisions. At the same time, the trained CWT-STNet model is applied pixel by pixel to all effective pixels of the canopy hyperspectral image and a pixel-level infection probability map is generated, upgrading the detection results from "whole plant single value level" to "canopy spatial distribution heatmap". This not only intuitively shows the specific location and aggregation area of ​​disease infection points on leaves and in the canopy space, but also accurately quantifies the spatial expansion degree of disease from local infection to whole plant wilting based on the proportion of infected pixels to effective canopy pixels. This allows for clear identification of the weak trend of lesions expanding from local areas to leaf margins in the early infection stage, and fully reflects the spatial dynamic process of disease spreading from the lower leaves to the upper canopy in the later stage. These two points provide comprehensive, reliable, and operationally guiding technical support for early warning, precise pesticide application, and evaluation of control effects in the precise disease monitoring of greenhouse tomatoes.

[0043] The present invention also discloses a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described methods for early detection of bacterial wilt in tomatoes.

[0044] In summary, the present invention has the following beneficial effects:

[0045] 1: This invention overcomes the technical difficulties in early detection of bacterial wilt caused by the difficulty in extracting weak early spectral signals, the difficulty in fusing multi-scale features, and the difficulty in modeling long-range dependencies through the CWT-STNet model obtained through training.

[0046] 2. This invention uses the SHAP method to calculate the contribution of the CWT-STNet model output to each input feature, outputs wavelength interpretation results that play a key discriminative role in the early detection of bacterial wilt in tomatoes, and applies the CWT-STNet model pixel by pixel to the effective pixels of the canopy hyperspectral image to generate a pixel-level infection probability map. Based on the proportion of infected pixels to effective canopy pixels, the spatial expansion of bacterial wilt in tomatoes is quantitatively characterized. This provides comprehensive, reliable, and operationally guiding technical support for early warning, precise application of pesticides, and evaluation of control effects in precise disease monitoring of greenhouse tomatoes. Attached Figure Description

[0047] Figure 1 This is a flowchart of the training method for early detection models.

[0048] Figure 2This image shows representative symptoms of different severity levels of bacterial wilt in tomatoes.

[0049] Figure 3 This is a schematic diagram of the hyperspectral image acquisition platform used in this invention.

[0050] Figure 4 This is a flowchart of the canopy region of interest extraction and average spectrum preprocessing of the present invention.

[0051] Figure 5 This is a canopy spectral reflectance curve for different severity levels of bacterial wilt in tomatoes after spectral pretreatment.

[0052] Figure 6 The images show the original spectrum of bacterial wilt in tomatoes and the spectral features at scales 1 to 5 after continuous wavelet transform.

[0053] Figure 7 This is a schematic diagram of the CWT-STNet model and its internal module structure according to the present invention.

[0054] Figure 8 This is a comparison of the confusion matrix between the traditional model and the CWT-STNet model for identifying the severity level of bacterial wilt in tomatoes.

[0055] Figure 9 This is a graph showing the importance of key wavelengths for early diagnosis of bacterial wilt in tomato using the CWT-STNet model in conjunction with SHAP.

[0056] Figure 10 A pixel-level infection probability map of the tomato canopy generated for the CWT-STNet model. Detailed Implementation

[0057] The present invention will be further described below with reference to the accompanying drawings and specific embodiments.

[0058] Example 1: A training method for an early detection model of bacterial wilt in tomatoes, comprising the following steps:

[0059] Step 1: Obtain the training sample set, which contains hyperspectral images of tomato canopy in the near-infrared to short-wave infrared band (850–1700 nm band);

[0060] Specifically, Ailsa Craig tomato plants with uniform growth and no obvious pests or diseases were selected as experimental materials. Seeds were treated with 55 ℃ warm water for 15 min and then placed in moist filter paper for germination under 30 ℃ darkness. After germination, one plant was transplanted into each plastic pot containing 0.5 kg of sterilized substrate. The plants were cultured in an artificial climate chamber under the following conditions: 25±1 ℃, 16 h light / 8 h darkness, light intensity of 2000 lux, and relative humidity of 60% to 70%.

[0061] Thirty days after transplanting, 75 tomato plants with uniform growth were selected for a bacterial wilt inoculation experiment. Sixty-five plants were inoculated with Ralstonia solanacearum FJ91-LUX via root drenching, while ten plants served as healthy controls treated with 20 mL of sterile distilled water. The day of inoculation was recorded as 0 days after inoculation (0 DAI). Subsequently, disease symptoms were recorded daily at 13:00, and canopy hyperspectral images were acquired simultaneously.

[0062] The severity of bacterial wilt in tomatoes is classified into levels 0 to 4 based on the proportion of wilted leaves. Figure 2 The classification is as follows: Level 0 is healthy and asymptomatic; Level 1 is plants with no obvious wilting and a wilting rate of 1% to 25%; Level 2 is 26% to 50%; Level 3 is 51% to 75%; and Level 4 is 76% to 100%. Levels 1 and 2 are considered early infection stages.

[0063] The hyperspectral image acquisition platform includes a GaiaField-N17E-HR hyperspectral camera, four 150 W halogen lamps, a light source controller, and a computer with acquisition software installed. Figure 3 The camera acquires images in the 850 nm to 1700 nm band, totaling 512 bands, with an image spatial resolution of 640 lines × 700 pixels. Black and white correction is performed before each scan to convert the raw image into a reflectance image.

[0064] Step 2: Extract the region of interest (ROI) from the hyperspectral image of the tomato canopy;

[0065] Specifically, to separate tomato canopy pixels from hyperspectral images, this embodiment utilizes the difference in reflectance between tomato leaves and the background in the short-wave infrared region for mask construction. Specifically, the ratio images of the 1353.5 nm and 1445.0 nm bands are calculated, and a threshold constraint of 1450.0 nm reflectance greater than 0.08 is superimposed to generate an initial canopy mask. Then, small noise areas are removed to obtain a refined canopy region of interest. Figure 4 ).

[0066] Step 3: Calculate the average spectrum of the pixel spectra within the region of interest and perform preprocessing;

[0067] Specifically, the reflectance of all effective pixels within the region of interest is averaged to obtain the average spectrum of the tomato canopy for each plant. Figure 5 Subsequently, the average spectrum was subjected to baseline correction, Savitzky-Golay smoothing with a window size of 15 and a polynomial order of 3, multivariate scattering correction, minimum-maximum normalization to the [0,1] interval, first derivative transformation with a difference window of 1, and deconvolution processing based on Wiener filtering with a window size of 5.

[0068] In the above preprocessing steps, Savitzky-Golay smoothing is used to eliminate high-frequency random noise while preserving the main peak and valley features of the spectrum; multivariate scattering correction is used to correct light scattering differences caused by the uneven distribution of tomato canopy leaves and particles; first-order derivative transformation is used to eliminate baseline drift and enhance the slope variation information in the spectrum; and Wiener filtering deconvolution is used to recover spectral detail information blurred by the instrument response function. The selection of the above preprocessing parameters is based on the optimization objectives of the signal-to-noise ratio of the preprocessed spectrum and the classification accuracy of the subsequent model, and the optimal value range of each parameter was determined experimentally.

[0069] Step 4: Convert the average spectrum into wavelength-scale two-dimensional wavelet coefficient features using continuous wavelet transform;

[0070] Specifically, this embodiment uses continuous wavelet transform to perform multi-scale decomposition on the preprocessed average spectrum. Figure 6 a) Continuous wavelet transform can convert a one-dimensional spectral signal into a two-dimensional wavelength-scale wavelet coefficient space, while preserving local information in the wavelength domain and frequency information in the scale domain. Continuous wavelet transform is calculated using the following formula: ,in, This is the pre-processed average canopy spectrum. For the mother wavelet, For scale parameters, For wavelength shift parameters, These are the wavelet coefficients corresponding to the wavelength-scale position.

[0071] In this embodiment, Mexican Hat wavelet is specifically used as the mother wavelet, and wavelet coefficients at scales 1 to 5 are extracted as the wavelet coefficient features. Figure 6 b).

[0072] For Mexican Hat wavelets, the scaling parameter With equivalent characteristic wavelength width The following conversion relationship is satisfied:

[0073] ,in, The spectral sampling interval for the hyperspectral data in the 850–1700 nm band is defined as follows. In this embodiment, the hyperspectral imaging system used has a spectral resolution of 3.5 nm. =3.5 nm, based on this, the scale =1 to The equivalent characteristic wavelength width and spectral characteristic type corresponding to =5 are shown in the table below:

[0074]

[0075] As shown in the table, low-scale coefficients (1-2) are used to capture local weak absorption peaks and high-frequency details associated with early infection, while high-scale coefficients (4-5) are used to represent broadband background changes. The selection of scales 1 to 5 is based on the following: ① Experimental verification shows that when the scale is greater than 5 (e.g., scales 6 and 7), the wavelet coefficients mainly reflect instrument noise and macroscopic tilted background, and their correlation with local cell wall and water structure changes caused by bacterial wilt infection is significantly reduced; ② As shown in the ablation experiment in Table 2, the overall accuracy of the model reaches 96.77% when scales 1 to 5 are fused, while the accuracy when any scale is used alone is between 92.67% and 94.72%, indicating that multi-scale fusion can significantly improve the accuracy of disease identification, and the introduction of higher-scale features does not bring further performance improvement.

[0076] For wavelength shift parameters This represents the position of the mother wavelet ψ on the wavelength axis. In discrete computation, We sequentially take the sampling points λi (i=1,2,…,N, where N is the number of wavelength sampling points) on the wavelength axis within the 850-1700 nm band of hyperspectral data, and then change... Make the scale The scaled mother wavelet slides point by point along the wavelength axis to calculate the wavelet coefficients at different wavelength positions. .

[0077] Step 5: Fuse the preprocessed spectral features with the wavelet coefficient features to obtain fused features; specifically, scales 1 to 5 are retained and fused with the spectral features during the construction of the fused features. Through fusion, basic spectral information and disease-related local features can be preserved simultaneously, improving the accuracy of early detection.

[0078] Step 6: Input the fused features into the pre-built and trained CWT-STNet model to output the severity level of tomato bacterial wilt. The Transformer encoder in the CWT-STNet model models the global dependencies between different bands and different wavelet scales in the fused features to capture the reflectance covariance pattern associated with bacterial wilt infection. The prediction head in the CWT-STNet model outputs the severity level of tomato bacterial wilt.

[0079] Specifically, the CWT-STNet model includes an input embedding layer, a Transformer encoder, and a prediction head ( Figure 7 ).

[0080] The input embedding layer fuses the spectral features and wavelet coefficients from scale 1 to scale 5 obtained by continuous wavelet transform, and converts them into a feature label sequence, which is then mapped to a high-dimensional embedding space through linear projection. The projected feature labels are then encoded with wavelength position and scale to preserve the relative relationships between different bands and scales.

[0081] Its input embedding is represented as: ,in, The spectral features are the preprocessed features, and W1 to W5 are the wavelet coefficient features at scales 1 to 5. Encoding the wavelength position, It is scale-coded.

[0082] The Transformer encoder consists of stacked layers of encoding modules. Each encoding module includes a multi-head self-attention mechanism, a feedforward network, a normalization layer, and a Dropout layer. Figure 7 a). In one specific implementation, the Transformer encoder consists of a stack of one layer of encoding modules, each layer containing four attention heads, with a model embedding dimension of 64 and a feedforward network dimension of 256. A multi-head self-attention mechanism models the global dependencies between different markers in the embedded marker sequence to capture reflectance covariance patterns associated with *Ralstonia solanacearum* infection, i.e., capturing subtle cross-band responses caused by changes in water state, cell structure, and pigmentation during the early infection stage. Figure 7 b) This self-attention mechanism adopts a scaled dot product attention form:

[0083] ,in, , , These are query, key, and value matrices, respectively. Representation matrix With matrix Multiplying by the transpose of , Let be the dimension of the key vector, and Softmax(⋅) represent the row-normalized exponential function. In this invention, the... , , The matrix represents the feature markers of specific disease-sensitive bands. Its learning objective is to capture the co-variation patterns of reflectance in the 850-1700 nm band associated with tomato bacterial wilt infection, rather than general semantic features. The feedforward network is used to enhance nonlinear representation capabilities. Figure 7 c). Normalization layers (using layer normalization) standardize each sample independently, stabilizing the training process and accelerating convergence. Dropout layers randomly discard the outputs of some neurons during training to prevent overfitting and improve generalization performance.

[0084] The prediction head receives the encoded feature sequence, maps it to the probability distribution of each level of tomato bacterial wilt through a fully connected layer and a Softmax function, and outputs the probability distribution of tomato bacterial wilt levels. Figure 7 d).

[0085] The model training employs a two-stage strategy: The first stage uses a masked autoencoder for self-supervised pre-training, randomly masking 75% of the input embeddings and reconstructing complete spectral features using the remaining unmasked labels. This encourages the encoder to learn robust disease-related representations, avoiding overfitting caused by difficulties in labeling early disease samples. The second stage loads the pre-trained encoder weights into the CWT-STNet model backbone network, using disease level labels for supervised fine-tuning, and employs a weighted cross-entropy loss function to address the imbalance in the number of samples across different disease levels. The weighted cross-entropy loss function is expressed as: ,in, The total number of categories, For the first Class sample weights, For real labels, The model predicts the first... The probability of a class.

[0086] For model optimization and evaluation, a random search strategy was employed to conduct 20 hyperparameter combination searches, using the Kappa coefficient as the optimization criterion. The Kappa coefficient was chosen instead of solely relying on accuracy because disease level samples naturally exhibit an imbalanced distribution (healthy and late-stage samples are usually more numerous than early-stage mild-symptom samples). The Kappa coefficient can eliminate the influence of random consistency, more realistically reflecting the model's consistency discrimination ability across different levels. The searched set of hyperparameters included: learning rate decay, batch size, Dropout rate, weight decay, number of attention heads, model dimensionality, feedforward network dimensionality, data augmentation probability, and noise standard deviation. During training, a normalization layer and Gaussian noise augmentation were introduced to improve model robustness, with the noise standard deviation set to 0.01 and the data augmentation probability set to 0.5. Model performance was evaluated using five-fold cross-validation, with mean precision, mean recall, mean F1 score, overall accuracy, and Kappa coefficient as evaluation metrics. When the model's Kappa coefficient on the validation set no longer improved, the model was considered converged, training was stopped, and the finally trained CWT-STNet model was obtained.

[0087] The trained CWT-STNet model identifies the severity level of bacterial wilt in tomatoes and is compared with support vector machine (SVM), random forest (RF), convolutional neural network (CNN) and STNet model without continuous wavelet transform (Table 1).

[0088] All models were trained and evaluated under uniform data conditions; among them, SVM, RF, CNN and STNet all showed improved performance after the introduction of continuous wavelet transform, indicating that continuous wavelet transform can effectively enhance the disease discrimination features in hyperspectral data and reduce redundant noise.

[0089] Among all the comparative models, the CWT-STNet model performed best, achieving an average precision of 95.84%, an average recall of 94.97%, an average F1 score of 95.41, an overall accuracy of 97.11%, and a Kappa coefficient of 95.95. Compared to the STNet model without continuous wavelet transform, the overall accuracy of the CWT-STNet model improved from 89.95% to 97.11%, an increase of 7.16 percentage points. Especially in the early infection stages of levels 1 and 2, CWT-STNet reduced false positives between adjacent levels, demonstrating high sensitivity and robustness to weak disease signals. Figure 8 Ablation experiments showed that the model performed best when the original spectral branches were preserved and all wavelet features from scale 1 to scale 5 were fused. If the original spectral branches were removed, even if the multi-scale wavelet features were preserved, the overall accuracy of the model dropped to 84.15%, indicating that the original spectral information and the multi-scale wavelet features have a complementary effect (Table 2).

[0090] Table 1 below shows the performance comparison of the CWT-STNet model with traditional models (RF, SVM, CNN) and the STNet model in identifying the early stages of bacterial wilt in tomatoes.

[0091]

[0092] Table 2 below shows the ablation experiment results of the CWT-STNet model under different input combinations.

[0093]

[0094] Example 2:

[0095] A method for early detection of bacterial wilt in tomatoes, comprising:

[0096] Step 1: Acquire hyperspectral images of the tomato canopy in the near-infrared to short-wave infrared band;

[0097] Step 2: Extract the region of interest (ROI) from the hyperspectral image of the tomato canopy;

[0098] Step 3: Calculate the average spectrum of the pixel spectra within the region of interest and perform preprocessing;

[0099] Step 4: Convert the average spectrum into wavelength-scale two-dimensional wavelet coefficient features using continuous wavelet transform;

[0100] Step 5: Fuse the preprocessed spectral features with the wavelet coefficient features to obtain the fused features;

[0101] Step 6: Input the fused features into the CWT-STNet model trained by the training method in Example 1, and output the severity level of tomato bacterial wilt.

[0102] In a further embodiment, the method further includes:

[0103] The contribution of the CWT-STNet model output to each input feature was calculated using the SHAP method, and the wavelength interpretation results of the output played a key discriminative role in the early detection of bacterial wilt in tomatoes.

[0104] Furthermore, the CWT-STNet model is applied pixel-by-pixel to the effective pixels of the canopy hyperspectral image to generate a pixel-level infection probability map, and the spatial expansion of tomato bacterial wilt is quantitatively characterized based on the proportion of infected pixels to effective canopy pixels.

[0105] By outputting key wavelength interpretation results, these key wavelengths precisely correspond to the characteristic spectral bands of physiological processes such as leaf water redistribution, pigment degradation, and cell wall degradation caused by bacterial wilt infection. This provides plant protection personnel with explanatory evidence that can be directly corroborated with crop physiological mechanisms, greatly improving the credibility and acceptability of model diagnostic results in agricultural production decisions. At the same time, the trained CWT-STNet model is applied pixel by pixel to all effective pixels of the canopy hyperspectral image and a pixel-level infection probability map is generated, upgrading the detection results from "whole plant single value level" to "canopy spatial distribution heatmap". This not only intuitively shows the specific location and aggregation area of ​​disease infection points on leaves and in the canopy space, but also accurately quantifies the spatial expansion degree of disease from local infection to whole plant wilting based on the proportion of infected pixels to effective canopy pixels. This allows for clear identification of the weak trend of lesions expanding from local areas to leaf margins in the early infection stage, and fully reflects the spatial dynamic process of disease spreading from the lower leaves to the upper canopy in the later stage. These two points provide comprehensive, reliable, and operationally guiding technical support for early warning, precise pesticide application, and evaluation of control effects in the precise disease monitoring of greenhouse tomatoes.

[0106] Example 3:

[0107] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the early detection method for bacterial wilt of tomato in Embodiment 2.

[0108] The above embodiments are merely preferred embodiments of the present invention and are not intended to limit the technical solutions of the present invention. Any technical solution can be implemented based on the above embodiments without creative effort.

Claims

1. A method for training an early detection model for bacterial wilt of tomato, characterized in that, Include: Step 1: Obtain the training sample set, which contains hyperspectral images of tomato canopy in the near-infrared to short-wave infrared band. Step 2: Extract the region of interest (ROI) from the hyperspectral image of the tomato canopy; Step 3: Calculate the average spectrum of the pixel spectra within the region of interest and perform preprocessing; Step 4: Convert the average spectrum into wavelength-scale two-dimensional wavelet coefficient features using continuous wavelet transform; Step 5: Fuse the preprocessed spectral features with the wavelet coefficient features to obtain the fused features; Step 6: Input the fused features into the CWT-STNet model for training. The model models the global dependencies between different bands and different wavelet scales in the fused features and outputs the predicted probability distribution of the severity level of bacterial wilt in tomatoes. During training, the bacterial wilt severity level label corresponding to the training sample set is used as the supervision target. The loss function is used to calculate the loss value between the predicted probability distribution and the supervision target, and the CWT-STNet model is iteratively updated until the loss function converges to the preset value to obtain the trained model.

2. The method for training an early detection model for bacterial wilt of tomato according to claim 1, characterized in that, In step 2, the extraction method of the region of interest in the canopy is as follows: a band ratio image is constructed based on 1353.5 nm and 1445.0 nm, and an initial canopy mask is generated by combining the threshold constraint that the reflectivity of 1450.0 nm is greater than 0.08, and then small noise areas are removed.

3. The method for training an early detection model for bacterial wilt of tomato according to claim 1, characterized in that, In step 3, the preprocessing includes baseline correction, Savitzky-Golay smoothing with a window size of 15 and a polynomial order of 3, multivariate scattering correction, minimum-maximum normalization to the [0, 1] interval, first-order derivative transformation with a difference window of 1, and deconvolution based on Wiener filtering with a window size of 5.

4. The method for training an early detection model for bacterial wilt of tomato according to claim 1, characterized in that, In step 4, the continuous wavelet transform is calculated according to the following formula: ,in, This is the pre-processed average canopy spectrum. For the mother wavelet, For scale parameters, For wavelength shift parameters, These are the wavelet coefficients corresponding to the wavelength-scale position.

5. The method for training an early detection model for bacterial wilt of tomato according to claim 4, characterized in that, In step 4, the mother wavelet is the Mexican Hat wavelet; the spectral sampling interval is... Continuous wavelet transform was performed on the 850–1700 nm hyperspectral data to extract the scale parameters. =1 to =5 corresponds to the wavelet coefficient W(a,b) as the wavelet coefficient feature; Among them, scale parameter With equivalent characteristic wavelength width Satisfying the relation: ,scale =1 to =5 corresponds to spectral characteristics in the range of approximately 3.5Δλ to 20Δλ.

6. The method for training an early detection model for bacterial wilt of tomato according to claim 1, characterized in that, The CWT-STNet model includes: An input embedding layer is used to convert the fused features into a feature label sequence and map it to a high-dimensional embedding space through linear projection. The projected feature labels are encoded with position and scale to preserve the relative relationship between different bands and different scales, generating an embedding label sequence with position and scale information. A Transformer encoder is used to receive the embedded tag sequence, model the global dependencies between different tags in the embedded tag sequence through a multi-head self-attention mechanism, capture the reflectance covariance pattern associated with bacterial wilt pathogen infection, and output an encoded feature sequence containing global context information. The prediction head receives the encoded feature sequence, maps it to the probability distribution of each level of tomato bacterial wilt through a fully connected layer and a Softmax function, and outputs the probability distribution of tomato bacterial wilt levels.

7. The method for training an early detection model for bacterial wilt of tomato according to claim 1, characterized in that, The loss function is the weighted cross-entropy loss function, expressed as: , in, The total number of categories, For the first Class sample weights, For real labels, The model predicts the first... The probability of a class.

8. A method for early detection of bacterial wilt in tomatoes, characterized in that, Include: Step 1: Acquire hyperspectral images of the tomato canopy in the near-infrared to short-wave infrared band; Step 2: Extract the region of interest (ROI) from the hyperspectral image of the tomato canopy; Step 3: Calculate the average spectrum of the pixel spectra within the region of interest and perform preprocessing; Step 4: Convert the average spectrum into wavelength-scale two-dimensional wavelet coefficient features using continuous wavelet transform; Step 5: Fuse the preprocessed spectral features with the wavelet coefficient features to obtain the fused features; Step 6: Input the fused features into the CWT-STNet model trained by the training method according to any one of claims 1 to 7, and output the severity level of tomato bacterial wilt.

9. The method for early detection of bacterial wilt in tomatoes according to claim 8, characterized in that, Also includes: The contribution of the CWT-STNet model output to each input feature was calculated using the SHAP method, and the wavelength interpretation results of the output played a key discriminative role in the early detection of bacterial wilt in tomatoes. Furthermore, the CWT-STNet model is applied pixel-by-pixel to the effective pixels of the canopy hyperspectral image to generate a pixel-level infection probability map, and the spatial expansion of tomato bacterial wilt is quantitatively characterized based on the proportion of infected pixels to effective canopy pixels.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method for early detection of bacterial wilt of tomato as described in any one of claims 8 to 9.