Dragon fruit stem and leaf disease image classification and recognition method based on improved MSF-Net

CN122737591APending Publication Date: 2026-09-11NANNING INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610861810.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-15
Publication Date
2026-09-11

AI Technical Summary

Technical Problem

三类病害在早期阶段均表现为茎表面的斑点状病变,外观高度相似,极易混淆,但三者的防治方案存在显著差异,误判将导致错误施药或延误防治时机

Benefits of technology

通过设置并行的第一特征提取通道和第二特征提取通道,分别配置标准多尺度卷积模块和空洞多尺度卷积模块,使两个通道在特征提取层面形成分工:第一通道通过不同尺寸的卷积核并行提取病斑边缘、蜡质层反光过渡带等局部纹理信息,第二通道通过不同空洞率的卷积核并行提取茎体棱边分布、刺座排列规律等全局结构信息。两类信息在后续融合时互为补充,为区分溃疡病与炭疽病早期相似病斑提供了更丰富的特征来源。与单通道串行网络依赖网络深度间接获得多尺度特征的方式相比,双通道并行架构能够同时感知病斑的局部细节和其在茎体上的空间分布模式,对早期微小病斑的纹理变化和发病阶段差异具有更强的捕捉能力。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122737591A_ABST
    Figure CN122737591A_ABST
Patent Text Reader

Abstract

This invention relates to a method for image classification and recognition of dragon fruit stem and leaf diseases based on an improved MSF-Net, belonging to the field of agricultural disease image recognition technology. Addressing the problems of existing methods' low discrimination between minor and similar diseases of dragon fruit stems and leaves, and the lack of specific adaptation for multi-scale feature fusion, this invention inputs stem and leaf images into an improved MSF-Net model, which includes parallel first and second feature extraction channels. The first feature extraction channel is composed of multiple cascaded multi-scale convolutional modules, containing convolutional branches of different sizes connected to CReLU activation layers. The second feature extraction channel is composed of multiple cascaded dilated multi-scale convolutional modules, containing convolutional branches with different dilation rates connected to CReLU activation layers. The output features of the two channels are concatenated along the channel dimensions to obtain a multi-scale fused feature map, which is then global average pooled and fed into a fully connected classification layer to output the disease category. This invention can enhance the ability to capture subtle lesions and differences in disease stages, and can be used for real-time disease identification and control in dragon fruit plantations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of agricultural disease image recognition technology. Specifically, it relates to a method for classifying and recognizing dragon fruit stem and leaf diseases based on an improved MSF-Net. Background Technology

[0002] Timely and accurate identification of stem and leaf diseases in dragon fruit is crucial for ensuring yield and quality. Canker, anthracnose, and soft rot are common stem and leaf diseases in dragon fruit cultivation. Canker initially manifests as circular, sunken, chlorotic lesions; anthracnose initially produces small, purplish-brown sunken spots; and soft rot lesions initially appear as infiltrated, translucent spots. All three diseases present as spot-like lesions on the stem surface in their early stages, making them highly similar in appearance and easily confused. However, their control measures differ significantly, and misdiagnosis can lead to incorrect pesticide application or delayed treatment.

[0003] Deep learning-based image classification methods have made some progress in the field of crop disease identification. In dragon fruit disease identification, existing research has employed general convolutional neural networks such as ResNet18 and ResNet34. For example, the 2025 paper by Wang Xuejian and Peng Shunzheng, "Research on Dragon Fruit Disease and Pest Identification Based on ResNet Network," used transfer learning to build a classification model, which was validated on datasets containing categories such as stem rot and stem spot. Another study (CAF Magahis, RA Ugale and JF Villaverde, "Classification of Common Stem-Based Dragon Fruit Diseases Using Convolutional Neural Network," 2025 19th International Conference on Ubiquitous Information Management and Communication (IMCOM), Bangkok, Thailand, 2025) built a portable device based on ResNet-50 to classify anthracnose, cactus virus X, and stem canker (with an accuracy of approximately 91.67% in a controlled environment).

[0004] However, the aforementioned existing technologies face the following technical challenges in practical applications.

[0005] First, existing solutions all use standard general convolutional neural networks as the backbone network, and the network structure is not adapted to the unique characteristics of dragon fruit stem and leaf diseases. The surface of dragon fruit stems has a waxy layer, longitudinal edges, and regularly distributed areoles, and the distribution of lesions on the stem is related to these structures. Early lesions of canker and anthracnose are both sunken spot-like lesions, and the distinction between the two highly depends on the local texture differences at the edge of the lesion and the spatial distribution pattern along the direction of the stem edges. Standard convolutional neural networks use a single-channel serial structure, and multi-scale feature extraction relies on indirect acquisition through network depth. Texture features of small-sized lesions are easily lost during layer-by-layer downsampling, and the global spatial distribution pattern of lesions is also difficult to fully perceive. In existing studies, ResNet alleviates the degradation of deep networks through residual connections, and DenseNet achieves feature reuse through dense connections, but neither of them designs a parallel extraction mechanism for local texture and global structure at the architectural level.

[0006] Second, the waxy layer on the surface of the dragon fruit stem reflects light under natural light, forming a brightness transition zone from bright areas to normal tissue. This transition zone contains weak gradient information from the edges of lesions. The stem edges, however, produce strong shadows under sidelight, resulting in large negative responses in the activation function. The standard ReLU activation function sets all negative responses to zero, discarding both the weak texture gradient from the waxy layer's reflective transition zone and the strong signal from the edge shadows. While the CReLU activation function reduces feature redundancy by preserving the absolute values ​​of negative responses (Wenling Shang, KihyukSohn, Diogo Almeida, Honglak Lee: Understanding and Improving Convolutional Neural Networks via ConcatenatedRectified Linear Units. ICML 2016: 2217-2225), its indiscriminate preservation of negative values ​​causes the weak gradient signal from the waxy layer's reflective transition zone to be suppressed by the strong signal from the edge shadows during subsequent feature fusion, preventing the effective utilization of this weak texture information. Furthermore, in the batch normalization process after CReLU splices the absolute values ​​of the positive and negative semi-axis, the two types of activation values ​​from different sources are treated as a whole and subjected to unified statistical normalization. Their distribution differences are forcibly smoothed out, further weakening the effect of CReLU in preserving negative responses.

[0007] Third, dragon fruit stem and leaf images collected in natural field environments suffer from complex backgrounds, uneven lighting, and occlusion between stems and leaves. Existing preprocessing strategies (such as histogram equalization and Retinex illumination correction) are mostly performed independently before the images are fed into the network, lacking a collaborative design with the network's internal feature extraction mechanism. Especially under strong direct sunlight, the specular reflection of the waxy layer causes local pixels to reach a saturation value of 255, completely erasing the texture of lesion edges within the saturated area, forming a flat area without texture. This texture truncation represents a loss of physical information at the image acquisition end. Global illumination correction in the preprocessing stage cannot recover the lost texture details in the saturated area, and improvements to the activation function within the network cannot handle the problem of positive saturation truncation.

[0008] The aforementioned technical challenges collectively result in the existing methods' insufficient ability to distinguish between early-stage similar lesions of dragon fruit canker and anthracnose, and poor robustness in identification under varying natural light conditions and complex background interference. Summary of the Invention

[0009] One objective of this invention is to address the following problem: Existing methods for identifying stem and leaf diseases in dragon fruit generally employ standard convolutional neural networks with a single-channel, serial design. These networks rely on network depth to indirectly acquire disease features at different scales in images. The surface of dragon fruit stems has a waxy layer, longitudinal edges, and regularly distributed areoles. Early lesions of both canker and anthracnose are sunken, spot-like lesions. Distinguishing between the two requires simultaneously perceiving the local texture differences at the lesion edges and the global spatial distribution pattern of the lesions along the stem edges. Existing single-channel architectures lack explicit parallel extraction mechanisms for local texture and global structure. Textures of small lesions are easily lost during layer-by-layer downsampling, and global morphological features are difficult to capture fully, resulting in insufficient accuracy in distinguishing early-stage similar diseases.

[0010] To achieve the above objectives, this invention provides a method for image classification and recognition of stem and leaf diseases in dragon fruit based on an improved MSF-Net, comprising the following steps: S1. Obtain images of the dragon fruit stems and leaves to be identified; S2. Input the dragon fruit stem and leaf image into the improved MSF-Net model, which contains a parallel first feature extraction channel and a second feature extraction channel; The first feature extraction channel consists of M cascaded multi-scale convolutional modules, where M ≥ 2. Each multi-scale convolutional module contains a first convolutional kernel branch and a second convolutional kernel branch arranged in parallel. The kernel size of the first convolutional kernel branch is a × a, and the kernel size of the second convolutional kernel branch is b × b, where a ≠ b. The first and second convolutional kernel branches are each connected to a CReLU activation layer and a batch normalization layer in sequence. The outputs of the two branches are concatenated along the channel dimension and then fed into a 1 × 1 convolutional layer for channel compression. The CReLU activation layer performs channel compression on the input features. The feature map performs the following operations: the input feature map is divided into a first part and a second part along the channel dimension; positive values ​​in the first part are retained and negative values ​​are set to zero; the absolute values ​​of negative values ​​in the second part are taken and positive values ​​are set to zero; the two parts are concatenated along the channel dimension and then output; at least one of the M cascaded multi-scale convolutional modules has a convolution stride greater than 1 in its convolutional branch, so that the spatial resolution of the feature map output by the module is halved relative to its input feature map, and the spatial resolution of the output feature map of the first feature extraction channel is smaller than its input feature map; The second feature extraction channel consists of N cascaded dilated multi-scale convolutional modules, where N≥2. Each dilated multi-scale convolutional module contains a first dilated convolutional kernel branch and a second dilated convolutional kernel branch arranged in parallel. The kernel size of the first dilated convolutional kernel branch is c×c and the dilation rate is d1. The kernel size of the second dilated convolutional kernel branch is c×c and the dilation rate is d2, where d1≠d2. The first and second dilated convolutional kernel branches are each connected to a CReLU activation layer and a batch normalization layer in sequence. The outputs of the two branches are concatenated along the channel dimension and then fed into a 1×1 convolutional layer for channel compression. At least one of the N cascaded dilated multi-scale convolutional modules has a convolutional stride greater than 1 in its convolutional branch, so that the spatial resolution of the feature map output by the module is halved relative to its input feature map. Furthermore, the spatial resolution of the output feature map of the second feature extraction channel is smaller than that of its input feature map. S3. The output feature maps of the first feature extraction channel and the second feature extraction channel are concatenated along the channel dimension to obtain a multi-scale fused feature map; S4. Perform global average pooling on the multi-scale fused feature map to obtain the feature vector, and feed the feature vector into the fully connected classification layer to output the disease category to which the dragon fruit stem and leaf image belongs; Among them, the output nodes of the fully connected classification layer correspond to at least: dragon fruit canker, dragon fruit anthracnose, and dragon fruit soft rot.

[0011] Preferably, in step S2, a first channel-wise attention weighting module is set before the input of the first feature extraction channel. The first channel-wise attention weighting module assigns a learnable weight coefficient to each channel of the input feature map, broadcasts the weight coefficient to all spatial positions of the input feature map, and multiplies it element-wise with the activation value of the corresponding channel to obtain the first channel input feature map and output it. Before the input of the second feature extraction channel, a second channel-wise attention weighting module and an image pyramid step-by-step downsampling structure are set. The image pyramid uses the dragon fruit stem and leaf image obtained in step S1 as the 0th level image. Each time, the previous level image is downsampled with a stride of 2 to generate the 1st level image and the 2nd level image in sequence. After the 0th level image, the 1st level image, and the 2nd level image are each processed by a convolutional layer to extract features, the feature maps corresponding to the 1st level image and the 2nd level image are upsampled to... At level 0 image resolution, the feature maps of the three levels are concatenated along the channel dimension and then fed into the second channel-wise attention weighting module. The second channel-wise attention weighting module assigns a learnable weight coefficient to each channel of the concatenated feature map, broadcasts the weight coefficient to all spatial locations of the concatenated feature map, and multiplies it element-wise with the activation value of the corresponding channel to obtain the second channel input feature map, which is then output. The multi-scale convolutional modules of the first feature extraction channel receive the first channel input feature map, and the dilated multi-scale convolutional modules of the second feature extraction channel receive the second channel input feature map. The parameters of the first and second channel-wise attention weighting modules are initialized, trained, and updated independently, and are not shared with each other. The resolution of level 1 image is one-quarter of that of level 0 image, and the resolution of level 2 image is one-sixteenth of that of level 0 image.

[0012] Preferably, in the first feature extraction channel, within each multi-scale convolutional module, the output of the a×a-th convolutional branch, after being processed by a CReLU activation layer and a batch normalization layer, is fed into the depthwise separable convolutional layer corresponding to that branch for channel compression. This depthwise separable convolutional layer is composed of sequentially connected channel-wise convolutional layers and pointwise convolutional layers. The kernel size of the channel-wise convolutional layer is 1×1, and its number of groups is equal to the number of channels in the output feature map of the batch normalization layer of that branch. The pointwise convolutional layer compresses the number of channels to half the number of channels in the output feature map of the batch normalization layer of that branch, thus obtaining... The a-branch compresses the feature map; the b×b-th convolutional branch is processed in the same way to obtain the b-branch compressed feature map; the a-branch compressed feature map and the b-branch compressed feature map are concatenated along the channel dimension, and the number of channels after concatenation is the same as the number of channels of the input feature map of the multi-scale convolutional module. The concatenation result is used as the output of the module; the depthwise separable convolutional layers corresponding to the two convolutional branches do not share parameters with each other, and the depthwise separable convolutional layers of the corresponding convolutional branches in different multi-scale convolutional modules within the same first feature extraction channel are also trained and updated independently and do not share parameters with each other.

[0013] Preferably, in the second feature extraction channel, within each dilated multi-scale convolutional module, the convolutional kernel weight parameters of the first dilated convolutional kernel branch and the convolutional kernel weight parameters of the second dilated convolutional kernel branch are initialized and trained independently, and do not share parameters with each other; within the same second feature extraction channel, in the i-th cascaded dilated multi-scale convolutional module and the (i+1)-th cascaded dilated multi-scale convolutional module, the convolutional kernel weight parameters of the corresponding dilation rate branches are also initialized and trained independently, and do not share parameters with each other, where i=1, 2, …, N-1.

[0014] Preferably, the CReLU activation layer connected after each convolutional kernel branch in the first and second feature extraction channels performs the following operations on the input feature map: dividing the input feature map into a first part and a second part along the channel dimension; retaining all positive values ​​and setting all negative values ​​to zero in the first part; setting all positive values ​​to zero in the second part, and for negative values, taking the sum of the absolute values ​​of all negative pixels in the feature map of that channel, dividing by the total number of negative pixels, and then multiplying by a scaling factor α to obtain the negative value amplitude threshold θ, where α ranges from 0.5 to 2.0; retaining the absolute values ​​of negative pixels with absolute values ​​less than or equal to θ, and setting the absolute values ​​of negative pixels with absolute values ​​greater than θ to zero; concatenating the output of the first part and the output of the second part along the channel dimension and then feeding them into the subsequent normalization layer; wherein, the scaling factor α is set to an initial value before model training and remains unchanged during training.

[0015] Preferably, in the first and second feature extraction channels, after each convolutional kernel branch within each multi-scale convolutional module and each dilated multi-scale convolutional module, the batch normalization layer connected after the CReLU activation layer is a group normalization layer. The group normalization layer performs group normalization operation on the output feature map after the CReLU activation layer is concatenated. The number of groups for group normalization is 2, and the group boundary is aligned with the equal division boundary when the CReLU activation layer divides the input feature map into two parts along the channel dimension, so that the first group includes all channels of the first part of the output of the CReLU activation layer, and the second group... This includes all channels output from the second part of the CReLU activation layer. The grouped normalization layer calculates and normalizes the mean and variance along the channel dimension for the first group separately, then performs an affine transformation using the first group scaling parameter γ1 and offset parameter β1. Similarly, it calculates and normalizes the mean and variance along the channel dimension for the second group separately, then performs an affine transformation using the second group scaling parameter γ2 and offset parameter β2. Finally, the two sets of results are concatenated along the channel dimension and output. γ1 and γ2 are initialized and trained and updated independently, as are β1 and β2, and the two sets of parameters are not shared.

[0016] Preferably, step S3 includes: S31. For the output feature map of the first feature extraction channel, calculate the mean and variance of each channel along the channel dimension, and normalize the channel using the mean and variance of each channel itself to obtain the normalized feature map of the first channel; S32. The output feature map of the second feature extraction channel is used in the same way to obtain the normalized feature map of the second channel. The distribution equalization processing of the two channels is performed independently, using only the internal statistics of each channel; S33. The normalized feature map of the first channel is multiplied channel-by-channel by a learnable first channel scaling parameter vector γ1, and the normalized feature map of the second channel is multiplied channel-by-channel by a learnable second channel scaling parameter vector γ2. The dimensions of γ1 and γ2 are equal to the number of channels of the corresponding channels. They are initialized and trained and updated independently, without sharing parameters; S34. The scaled feature map of the first channel is subjected to average pooling and max pooling along the channel dimension to obtain two spatial descriptors. After concatenation, they are passed through a convolutional layer with a kernel size of 7×7 to generate the spatial attention weight map of the first channel. Multiplying this feature map spatially by the feature map to obtain the weighted feature map of the first channel; S35. The spatial attention weight map of the second channel is generated in the same way to obtain the weighted feature map of the second channel. The 7×7 convolutional kernel parameters for generating the two spatial attention weight maps are not shared; S36. The first channel weighted feature map and the second channel weighted feature map are concatenated along the channel dimension to obtain a multi-scale fused feature map.

[0017] Preferably, the method for global average pooling of the multi-scale fused feature map in step S4 is as follows: For each channel of the multi-scale fused feature map, calculate the mean μ_c of the activation values ​​at all spatial locations within that channel; for each spatial location activation value within that channel, determine a significance weight based on its deviation from μ_c; spatial locations with activation values ​​higher than μ_c are assigned a weight greater than 1, with the weight increasing as the value exceeds the mean; the weight has an upper limit w_max, which is 2.0; spatial locations with activation values ​​lower than μ_c are assigned a weight greater than 1. Suppression weights are less than 1 but always greater than 0, with the weight decreasing as the value decreases below the mean. The weight is 1 when the activation value equals μ_c. The weighted pooling scalar value of a channel is obtained by multiplying the activation value of each spatial location in the channel by its corresponding significance weight and summing the results, then dividing by the sum of the significance weights of all spatial locations in the channel. The weighted pooling scalar values ​​of all channels together constitute the feature vector. When the activation values ​​of all spatial locations in a channel are equal, the significance weights of all spatial locations are 1, and the weighted pooling operation of that channel degenerates into standard global average pooling.

[0018] Preferably, the fully connected classification layer has 7 output nodes, corresponding to early stage of dragon fruit canker, late stage of dragon fruit canker, early stage of dragon fruit anthracnose, late stage of dragon fruit anthracnose, early stage of dragon fruit soft rot, late stage of dragon fruit soft rot, and healthy. In step S4, after the feature vector is fed into the predicted probability of each node output by the fully connected classification layer, the node corresponding to the maximum probability is taken as the preferred category. Each output node has a preset confidence threshold. The confidence threshold of the node corresponding to the early lesion is higher than that of the node corresponding to the late lesion, and the confidence threshold of the healthy node is lower than that of the late lesion node. If the probability value of the preferred category reaches its preset confidence threshold, then the preferred category is used as the final classification result. If it does not reach the threshold, when the preferred category is an early subcategory of a disease, the probability value of the late subcategory of the same disease is summed with it; when the preferred category is a late subcategory of a disease, the probability value of the early subcategory of the same disease is summed with it. If the sum of probabilities reaches the comprehensive confidence threshold, then the basic category name of the disease is output along with a pending confirmation marker for the disease stage. If the sum of probabilities still does not reach the comprehensive confidence threshold, then the preferred category is output as the final classification result.

[0019] Preferably, before inputting the dragon fruit stem and leaf image into the improved MSF-Net model in step S2, the method further includes: traversing each pixel of the dragon fruit stem and leaf image, marking pixels with a value equal to 255 in any of the R, G, and B channels as saturated pixels, obtaining a binary saturation mask M_sat, where the saturated pixel position is set to 1 and the unsaturated pixel position is set to 0; performing a filling operation on the R, G, and B channels of the image respectively, using the original image of that channel as the guide image, and the position marked as a saturated pixel by M_sat as the area to be filled, taking a local window of size r×r centered on each saturated pixel, where r is an integer greater than or equal to 3 and r≥a, and a is the convolution kernel size of the first convolution kernel branch, calculating the coefficients of the local linear model using only unsaturated pixels within the window, and then reconstructing the saturated pixels at the center of the window using this model to obtain the filled image. After filling each of the three channels, the filled image is obtained and used as the input image to the improved MSF-Net model. M_sat is downsampled to the same spatial resolution as the input feature map of the first multi-scale convolution module in the first feature extraction channel to obtain the downsampled saturation mask M'_sat. In step S2, after the first channel-wise attention weighting module generates learnable weight coefficients, it first multiplies the weight coefficients with the activation values ​​of the corresponding channels element by element to obtain the intermediate feature map. Then, the activation values ​​of all channels corresponding to the spatial position where M'_sat is 1 in the intermediate feature map are multiplied by a learnable compensation factor λ greater than 1. λ is independently trained and updated during model training. The activation values ​​corresponding to the spatial position where M'_sat is 0 are not changed. The intermediate feature map after spatial position compensation is used as the input feature map of the first channel.

[0020] The present invention has at least the following beneficial effects: By setting up parallel first and second feature extraction channels, and configuring standard multi-scale convolutional modules and dilated multi-scale convolutional modules respectively, the two channels achieve a division of labor at the feature extraction level: the first channel extracts local texture information such as lesion edges and reflective transition zones of the waxy layer in parallel using convolutional kernels of different sizes; the second channel extracts global structural information such as the distribution of stem edges and the arrangement of areoles in parallel using convolutional kernels with different dilation rates. These two types of information complement each other during subsequent fusion, providing a richer source of features for distinguishing between early-stage similar lesions of ulcer disease and anthracnose. Compared to the method of obtaining multi-scale features indirectly through network depth in a single-channel serial network, the dual-channel parallel architecture can simultaneously perceive the local details of lesions and their spatial distribution patterns on the stem, exhibiting a stronger ability to capture the texture changes and disease stage differences of early-stage small lesions.

[0021] A segmented thresholding process is introduced into the CReLU activation layer. The threshold is calculated by multiplying the mean absolute value of negative pixels within a channel by a scaling factor α. Low-amplitude negative values ​​below the threshold are retained, while high-amplitude negative values ​​above the threshold are set to zero. The effect is that the brightness attenuation gradient generated by the reflective transition zone of the dragon fruit stem's waxy layer is typically small, while the negative response amplitude generated by the shadows on the stem edges is typically large. Thresholding allows the former to be retained and continued, while the latter, as a signal that does not carry lesion discrimination information, is removed. Compared to the standard CReLU approach of indiscriminately retaining both types of negative values, segmented thresholding helps reduce the suppression of weak texture signals by high-amplitude background signals, allowing lesion edge information that may be carried in the reflective transition zone to be more effectively utilized in subsequent network layers.

[0022] Instead of batch normalization following CReLU concatenation, grouped normalization is used. The activation values ​​on the positive and negative semi-axis are divided into two groups, and statistics are calculated independently, then normalized and affine transformed. Since the two activation values ​​originate from different physical sources, their distribution centers are originally offset. Grouped normalization allows each group of signals to adjust based on its own distribution characteristics, avoiding the information weakening caused by uniform normalization forcibly pulling them to the same distribution center. The two independent scaling and offset parameters also enable the network to learn gain configurations suitable for the positive and negative semi-axis texture signals respectively, providing more stable propagation conditions for the weak texture information preserved by CReLU.

[0023] This multi-scale convolutional module employs a method where each convolutional branch undergoes independent depthwise separable convolutional compression before concatenation, replacing the standard Inception structure's approach of directly concatenating multiple branches and then uniformly compressing them. Independent compression ensures that features extracted by convolutional branches of different sizes maintain information independence before fusion; the weak gradients at lesion edges captured by smaller branches are not interfered with by the stem structure signals of larger branches during compression. Channel-wise 1×1 convolution performs independent scalar weighting on each channel, avoiding cross-spatial convolution operations and preventing the blurring effect of neighborhood pixel averaging on weak gradient signals during compression. The compression layer parameters of the two convolutional branches are independent of each other, allowing each branch to learn the optimal compression configuration based on its own feature distribution.

[0024] In the dilated multi-scale convolution module of the second feature extraction channel, the kernel weights of convolution branches with different dilation rates are set to be initialized, trained, and not shared. The corresponding branch parameters of different layers within the same channel are also independent. Parameter independence structurally cuts off the gradient competition path between different receptive field branches, allowing branches with small dilation rates to focus on learning local texture features of lesions, and branches with large dilation rates to focus on learning global morphological features. The two types of features remain independent in terms of parameter source. Compared to the shared weight scheme where the parameter optimization of small receptive field branches is dominated by the gradient of large receptive field branches, parameter independence helps to extract local texture information and global structural information in a balanced way.

[0025] Before the dual-channel feature stitching and fusion, the outputs of the two channels undergo three steps: distribution equalization, independent channel scaling, and independent spatial attention weighting. Distribution equalization adjusts the statistical distribution of the feature maps of the two channels to a comparable benchmark through independent normalization, avoiding mutual suppression after stitching due to the difference in numerical range between the sparse and sharp distribution of the first channel and the uniform and spread distribution of the second channel. Independent channel scaling parameters and spatial attention weights enable each channel to obtain optimal gain adjustment and spatial focus. The spatial attention of the first channel can focus on local texture-sharp areas such as the edges of lesions, while the spatial attention of the second channel can focus on structurally significant areas such as stem edges and areole distribution. Each focuses on its own preferred spatial location, forming information complementarity during stitching and fusion.

[0026] In the global pooling stage, saliency-weighted pooling based on activation value deviation is employed. Spatial saliency weights are generated by the deviation of the activation value at each spatial location within each channel from the channel's mean. High-activation regions are assigned enhancement weights, while low-activation regions are assigned suppression weights, but not completely zeroed. Weighted pooling ensures that the gradient signal at the edge of lesions concentrated in narrow regions receives a higher contribution during pooling, reducing signal dilution caused by the averaging of high-activation signals with a large number of low-activation background values ​​in standard global average pooling. The constraint that the suppression weight is greater than zero ensures that the spatial extension information of structural signals such as stem edges is preserved after pooling, avoiding the problem of max pooling completely discarding the second-highest activation regions. The upper limit of the enhancement weight prevents the excessive influence of a single anomalous pixel on the channel's scalar value.

[0027] The fully connected classification layer outputs seven nodes, subdividing the three diseases into early and late stages, and setting differentiated pre-set confidence thresholds and cross-stage probability and discrimination mechanisms. The confidence threshold for the early stage subclass is higher than that for the late stage subclass, taking into account the actual situation that the early lesion texture is blurry and the classification uncertainty is high. When the probability of the preferred category does not reach the threshold, the probabilities of the two stages of the same disease are combined to determine the disease type, providing reference information on the disease level for prevention and control decisions. If the sum of probabilities still does not reach the comprehensive confidence threshold, the preferred category is used as the final classification result, providing a relatively reasonable output without forcing a misclassification when the model's classification certainty is insufficient.

[0028] Before the image is fed into the improved MSF-Net, guided filtering is used to fill the saturated regions caused by specular reflection in the wax layer. The saturation mask information is then passed to the first channel-wise attention weighting module for spatial location compensation of the intermediate feature maps. Guided filtering utilizes the structural information of unsaturated pixels surrounding the saturated regions to reconstruct the lost texture. The size of the filling window is correlated with the minimum convolutional kernel size of the first feature extraction channel, ensuring that the spatial extent of the reconstructed texture matches the granularity of subsequent feature extraction. The saturation mask, after downsampling, is used for spatial location compensation of the intermediate feature maps, enhancing the network's attention to the originally saturated regions and, to some extent, compensating for the discrepancy between the filled texture and the original true texture.

[0029] Other advantages, objectives and features of the present invention will become apparent in part from the following description, and in part from those skilled in the art through study and practice of the invention. Attached Figure Description

[0030] Figure 1 This is an overall flowchart of the dragon fruit stem and leaf disease image classification and recognition method based on the improved MSF-Net of the present invention; Figure 2 This is a schematic diagram of the saturation region detection, guided filtering filling, and first channel-by-channel attention compensation processing flow of the present invention. Detailed Implementation

[0031] The present invention will now be described in further detail with reference to specific embodiments, so that those skilled in the art can implement it based on the description. It should be noted that, unless otherwise specified, the experimental methods described in the following embodiments are conventional methods, and the reagents and materials described are commercially available unless otherwise specified. It should be understood that terms such as "having," "comprising," and "including" as used herein do not exclude the presence or addition of one or more other elements or combinations thereof.

[0032] (1) such as Figure 1 As shown in this embodiment, a method for classifying and recognizing dragon fruit stem and leaf diseases based on an improved MSF-Net is provided. This method constructs a dual-channel parallel multi-scale feature extraction architecture to extract local texture features and global structural features from dragon fruit stem and leaf images, and then fuses the two types of features for classification output. The improved MSF-Net model can be trained on a computer equipped with a GPU, and the trained model can be deployed on embedded devices or mobile terminals for real-time field inference. The input image is preferably an RGB color image, with a resolution uniformly adjusted to 224×224 pixels. The batch size can be set to 16 or 32 during training and is typically 1 during inference. The method includes four main steps: acquiring the dragon fruit stem and leaf image to be identified; inputting the image into the improved MSF-Net model for dual-channel feature extraction; concatenating the output features of the two channels along the channel dimension to obtain a multi-scale fused feature map; and performing global average pooling on the fused feature map before feeding it into a fully connected classification layer to output the disease category.

[0033] In the specific configuration of the dual-channel architecture, the first feature extraction channel consists of M cascaded multi-scale convolutional modules, where M≥2, preferably M=3. Each multi-scale convolutional module contains a first convolutional kernel branch and a second convolutional kernel branch arranged in parallel. The kernel size of the first convolutional kernel branch is preferably 3×3, i.e., a=3; the kernel size of the second convolutional kernel branch is preferably 5×5, i.e., b=5. The reason for choosing the 3×3 convolutional kernel is that its receptive field covers approximately several tens of pixels in a 224×224 resolution image, which matches the pixel ratio of early sunken lesions with a diameter of about 0.5 to 2 cm on the surface of dragon fruit stems and leaves, and can capture the local gradient information of the lesion edges. The reason for choosing the 5×5 convolutional kernel is that its receptive field can cover a medium-sized lesion area and a section of local structure on the stem edge, which can supplement a slightly larger area of ​​texture patterns. Each of the two convolutional branches is connected to a CReLU activation layer and a batch normalization layer in turn. The CReLU activation layer performs the following operations on the input feature map: First, the input feature map is divided into two parts along the channel dimension. For the first part, all positive values ​​are retained and all negative values ​​are set to zero. For the second part, all positive values ​​are first set to zero, and then the absolute value of all negative values ​​is taken. Finally, the two results are concatenated along the channel dimension and output, with the number of output channels matching the number of input channels. Unlike the standard ReLU activation function, which discards all negative responses, the CReLU activation layer retains the absolute value information of negative responses. These negative responses in dragon fruit stem and leaf images often originate from the slight brightness attenuation in areas such as the reflective transition zone of the waxy layer and the edge of the lesion depression. Retaining this information helps subsequent network layers capture more complete texture gradients. After the outputs of the two convolutional branches are processed by the CReLU activation layer and the batch normalization layer, they are concatenated along the channel dimension. At this point, the number of channels becomes twice the number of input channels for this module. Then, a 1×1 convolutional layer is fed in to compress the channels, bringing the number of channels back to the number of input channels for this module. In M cascaded multi-scale convolutional modules, at least one module has a convolutional stride greater than 1 in its convolutional branch, such that the spatial resolution of the output feature map is halved relative to its input feature map. Preferably, in three cascaded modules, the convolutional stride of the first two modules is set to 1 to maintain the spatial resolution, and the convolutional stride of the third module is set to 2 to halve the spatial resolution of the output feature map. The second feature extraction channel consists of N cascaded dilated multi-scale convolutional modules, where N≥2, preferably N=3. Each dilated multi-scale convolutional module includes a first dilated convolutional kernel branch and a second dilated convolutional kernel branch arranged in parallel. The kernel size of both branches is 3×3, i.e., c=3; the dilation rate of the first dilated convolutional kernel branch is preferably 2, i.e., d1=2, and the dilation rate of the second dilated convolutional kernel branch is preferably 3, i.e., d2=3. The effective receptive field of a 3×3 convolution with a dilatation rate of 2 is approximately 5×5, while the effective receptive field of a 3×3 convolution with a dilatation rate of 3 is approximately 7×7 to 9×9.The reason for choosing these two combinations of dilatation rates is that the edges of the dragon fruit stem surface extend longitudinally, and the areoles are arranged at equal intervals along the edge direction. Their spatial distribution period typically spans tens to hundreds of pixels in a 224×224 image. The receptive field of the convolution branch with a dilatation rate of 3 can cover the spatial range of multiple edge periods, while the receptive field of the convolution branch with a dilatation rate of 2 can cover a single edge and the local morphology on both sides. This division of labor allows for the simultaneous capture of local structural features and global spatial distribution patterns. Each dilatational convolution branch is also sequentially connected to a CReLU activation layer and a batch normalization layer. The outputs of the two branches are concatenated along the channel dimension and then fed into a 1×1 convolutional layer for channel compression. After compression, the number of channels is consistent with the number of input channels of the module. In the N cascaded dilatational multi-scale convolutional modules, at least one module has a convolution stride greater than 1 in its convolution branch, preferably the same as the first feature extraction channel. Before entering the two channels, the input image can first pass through a 3×3 convolutional layer with a stride of 2 to reduce the spatial resolution from 224×224 to 112×112 and initially expand the number of channels to 64. Then, it is fed into the first and second feature extraction channels respectively. In the first feature extraction channel, the input feature map size is 112×112×64. After processing by the first multi-scale convolutional module, the output is 112×112×64; after processing by the second multi-scale convolutional module, the output is 112×112×64; and after processing by the third multi-scale convolutional module, the output is 56×56×128. If further downsampling is needed after the third module to achieve an output resolution of 28×28, a convolutional layer or pooling layer with a stride of 2 can be added at the end of this channel to transform 56×56×128 into 28×28×256. After a similar spatial size change, the output feature map size of the second feature extraction channel is also 28×28, and the preferred number of channels is 256. The output feature maps from the two channels are concatenated along the channel dimension to obtain a multi-scale fused feature map with a size of 28×28×512. After processing by a global average pooling layer, the 28×28 spatial size of each channel is compressed into a single scalar value, outputting a feature vector of length 512. This feature vector is then fed into a fully connected classification layer. The weight matrix of the fully connected classification layer has a size of 512×3, and the bias vector has a length of 3. After softmax normalization, three predicted probability values ​​are output, corresponding to dragon fruit canker, dragon fruit anthracnose, and dragon fruit soft rot, respectively. The category corresponding to the highest probability is taken as the classification result.

[0034] In a specific field application example, an image of a dragon fruit stem taken under natural lighting conditions is input into a pre-trained improved MSF-Net model. The image contains an early-stage sunken lesion approximately 1 cm in diameter, located near a locally reflective area in the waxy layer of the stem. The image is first scaled to 224×224 pixels, processed by an initial convolutional layer, and then output as a 112×112×64 feature map to two feature extraction channels. In the first feature extraction channel, the 3×3 convolution branch of the first multi-scale convolution module generates gradient activation values ​​containing positive responses and negative responses due to the brightness transition of the waxy layer at the edge of the lesion. After passing through a CReLU activation layer, both positive and negative absolute value information are preserved. After batch normalization and 1×1 convolution compression, the data is sent to the next module. The second multi-scale convolution module continues to extract higher-level texture representations based on the features of the previous module. The third multi-scale convolution module reduces the spatial resolution of the feature map from 112×112 to 56×56 with a stride of 2 and outputs it after channel expansion. In parallel, the dilated multi-scale convolution module in the second feature extraction channel uses parallel branches with dilation rates of 2 and 3 to capture the local morphology of the lesion along the stem edge and the spatial distribution relationship between the edges and areoles around the lesion, respectively. The spatial resolution is also halved in the third module. The output feature maps from the two channels are concatenated along their channel dimensions to form a fused feature map of 28×28×512. Global average pooling yields a 512-dimensional feature vector, which is then fed into a fully connected classification layer to output the predicted probabilities for three categories. Through this dual-channel approach to extract local texture and global structure, combined with the preservation of weak texture gradients in the waxy layer by the CReLU activation layer and the coverage of stem morphology features by multi-scale dilated convolution, this method can effectively extract features and classify dragon fruit stem and leaf disease images under natural lighting conditions. This provides a foundation for further expansion to include more disease categories and refinement of disease stage subcategories.

[0035] (2) Based on the above implementation method, this implementation method further addresses the problem that the local lesion texture and global stem morphology in dragon fruit stem and leaf images are mixed and encoded in a single feature stream, making it difficult for the two channels to form a clear division of labor from the input end. A first channel-wise attention weighting module is added before the input end of the first feature extraction channel, and a second channel-wise attention weighting module and an image pyramid downsampling structure are added before the input end of the second feature extraction channel. The parameters of the two channel-wise attention weighting modules are initialized and trained independently, without sharing parameters, thus guiding the two channels to focus on image information of different spatial frequencies from the input end. Before being fed into the two channels, the input image still passes through a 3×3 convolutional layer with a stride of 2, reducing the spatial resolution from 224×224 to 112×112 and initially expanding the number of channels to 64.

[0036] Specifically, the first channel-wise attention weighting module assigns a learnable weight coefficient to each channel of the input feature map. The weight coefficient has a shape of 1×64×1×1 and can be initialized as an all-1 vector, updating independently during training via backpropagation. Since the weight coefficient is only a channel-dimensional vector, it needs to be broadcast to all spatial locations of the input feature map, expanding it from 1×64×1×1 to the same shape as the input feature map. Then, the broadcast weight coefficient is multiplied element-wise with the activation values ​​of the corresponding channels in the input feature map to obtain the first channel input feature map, which is then output, maintaining its size at 112×112×64. After training convergence, the learnable weights of this module will naturally tend towards higher values ​​for high-frequency texture channels and lower values ​​for low-frequency flat region channels, thus guiding the subsequent multi-scale convolutional modules of the first feature extraction channel to prioritize local texture information such as the edges of lesions on the stem and leaf surface and the reflective transition zone of the waxy layer. The input of the second feature extraction channel first passes through an image pyramid downsampling structure. The image pyramid uses the 224×224 dragon fruit stem and leaf image obtained in step S1 as the level 0 image. Each time, the previous level image is downsampled with a stride of 2, generating level 1 and level 2 images sequentially. The level 1 image has a resolution of 112×112, which is one-quarter of the level 0 image resolution; the level 2 image has a resolution of 56×56, which is one-sixteenth of the level 0 image resolution. After feature extraction from each of the level 0, level 1, and level 2 images using a 3×3 convolutional layer, feature maps with sizes of 112×112×64, 112×112×64, and 56×56×64 are obtained, respectively. The feature map of the level 2 image is first upsampled to 112×112 resolution using bilinear interpolation, and then the feature maps from the three levels are concatenated along the channel dimension to obtain a concatenated feature map with a size of 112×112×192. The stitched feature map is fed into the second channel-wise attention weighting module. This module also assigns a learnable weight coefficient to each channel of the stitched feature map. The weight coefficient has a shape of 1×192×1×1 and can be initialized as an all-1 vector, trained and updated independently. After broadcasting the weight coefficient to all spatial locations in the stitched feature map, it is multiplied element-wise with the corresponding channel's activation value to obtain the second channel input feature map, which is then output with a size of 112×112×192. Since the stepwise downsampling operation of the image pyramid inherently suppresses high-frequency details and preserves low-frequency structural information, the low-resolution layer feature map mainly carries global morphological information such as stem edge distribution, regular areole arrangement, and spatial extension of large lesions. During training, the second channel-wise attention weighting module naturally assigns higher weights to these channels carrying structural information, thereby guiding the subsequent dilated multi-scale convolutional module of the second feature extraction channel to prioritize responses to global morphological features.The parameters of the first and second channel-wise attention weighting modules are initialized, trained, and updated independently, without sharing parameters. After the above input processing, the first feature extraction channel receives a first-channel input feature map with a size of 112×112×64 for subsequent multi-scale convolutional feature extraction, and the second feature extraction channel receives a second-channel input feature map with a size of 112×112×192 for subsequent dilated multi-scale convolutional feature extraction.

[0037] In a specific application example, an image of a dragon fruit stem taken under natural sidelighting conditions is input into the model. In this image, one side of the stem shows a bright area due to reflection from the waxy layer, with a slight brightness gradient at the reflective transition zone. The stem surface also exhibits distinct longitudinal edges and evenly spaced areoles. After training convergence, the first channel-wise attention weighting module converges the weight coefficients of the high-frequency texture channels corresponding to the edges of lesions and the reflective transition zone to a value range of approximately 1.2 to 1.5, and the weight coefficients corresponding to the flat, healthy tissue areas to a value range of approximately 0.6 to 0.8. These weight coefficients are then broadcast and multiplied element-wise with the input feature map, selectively enhancing the high-frequency texture information in the first channel input feature map. At the second channel input, the level 0 original resolution image retains all the details of the stem surface, while the level 1 and level 2 downsampled images filter out most of the high-frequency texture, mainly preserving the structural contours of the edge direction and areole arrangement. After passing through the second channel-wise attention weighting module, the feature channels carrying global structural information from the first and second downsampling layers receive higher weights. These weight coefficients are broadcast and multiplied element-wise with the concatenated feature map, guiding the second feature extraction channel to focus on the spatial distribution pattern of stem morphology. Through this input-end differentiated guidance design, the two feature extraction channels form a clear complementary division of labor from the very front of the network. Unlike existing dual-branch networks that passively divide labor only through different level feature maps in the middle layers, this implementation combines front-end attention weighting and pyramid downsampling to achieve active, spatial frequency-based input signal allocation on two similar multi-scale convolutional channels. This allows the subsequent first-channel multi-scale convolutional module to focus on extracting local lesion texture with less interference from global structural signals, and the second-channel dilated multi-scale convolutional module to focus on extracting stem morphological distribution with less decoupling from local textures. This provides a foundation for information complementarity for subsequent deep fusion and classification recognition of dual-channel features.

[0038] (3) Based on the above implementation, in another implementation, in order to solve the problem that the outputs of each convolution branch in the standard Inception module are directly spliced ​​together and then uniformly compressed with 1×1 ordinary convolution, resulting in the entanglement of features at different scales during compression and the interference of weak lesion texture information by large-scale branch signals, this implementation replaces the method of splicing the two outputs along the channel dimension and then sending them into a 1×1 convolution layer for channel compression in the original claim 1 with each branch being independently compressed by depth separable convolution and then spliced ​​together.

[0039] Specifically, within each multi-scale convolutional module, the kernel size of the first convolutional kernel branch is 3×3, i.e., a=3; the kernel size of the second convolutional kernel branch is 5×5, i.e., b=5. Each of the two convolutional branches is sequentially connected to a CReLU activation layer and a batch normalization layer, processed in the same way as in the previous implementation. After processing by the batch normalization layer, the output feature maps of the two branches have the same size and the same number of channels. Assuming the input feature map size of this module is 112×112 and the number of channels is 128, then the outputs of both branches after processing by the CReLU activation layer and the batch normalization layer will both be 112×112×128.

[0040] At this point, instead of directly concatenating the outputs of the two branches, each is independently fed into a depthwise separable convolutional layer for channel compression. Taking the first convolutional kernel branch as an example, its output first enters a channel-wise convolutional layer. The kernel size of this layer is 1×1, and the number of groups is set to 128, which is equal to the number of channels in the feature map output by the batch normalization layer of this branch. This channel-wise 1×1 convolution performs a scalar weighting operation on each channel individually, without introducing any cross-channel information interaction or cross-spatial convolution operations. After the channel-wise 1×1 convolution, the feature map size is still 112×112×128, but the activation value of each channel has been rescaled by its own independent scalar weight. This channel-wise convolutional layer is then connected to a pointwise convolutional layer, which is a regular 1×1 convolution with 128 input channels and 64 output channels, compressing the number of channels to half of the original number of channels in this branch. After pointwise convolution, the output feature map size of the first convolution kernel branch becomes 112×112×64, resulting in the compressed feature map of branch a.

[0041] The second convolutional kernel branch also passes through a depthwise separable convolutional layer consisting of channel-wise 1×1 convolutions and pointwise convolutions. The number of groups in the channel-wise convolutional layer is set to 128, which is equal to the number of channels in the output feature map of the batch normalization layer of this branch. The number of output channels in the pointwise convolutional layer is 64, resulting in a compressed feature map of branch b with a size of 112×112×64. After the two branches have completed independent compression, the compressed feature map of branch a and the compressed feature map of branch b are concatenated along the channel dimension. The total number of channels after concatenation is 64 plus 64 equals 128, which is the same as the number of channels input to the multi-scale convolutional module. The concatenation result is used as the output of the multi-scale convolutional module and sent to the next cascaded multi-scale convolutional module or subsequent processing stage. The depthwise separable convolutional layers corresponding to the two convolutional branches do not share parameters with each other. Within the same first feature extraction channel, the depthwise separable convolutional layers of the corresponding convolutional branches in the first, second, and third multi-scale convolutional modules are also trained and updated independently and do not share parameters with each other.

[0042] The design of setting the number of convolutional layers per channel in depthwise separable convolution to be equal to the number of input channels allows each channel to have its own compression weight. This enables channel-wise differential adjustment of the positive half-axis texture information and the weak absolute gradient information of the negative half-axis preserved by the CReLU activation layer during compression. Unlike the standard Inception module, which concatenates multiple branch outputs and then compresses them uniformly with a 1×1 ordinary convolution, where the 1×1 convolutional layer performs fully connected mixing operations on all input channels, the weak gradient signals of the early ulceration edges captured by the small-scale convolutional branches are diluted in the mixed compression of the stem structure signals of the large-scale convolutional branches. This implementation uses branch-independent compression to prevent the local texture information of lesions extracted by the 3×3 convolutional branches from mixing with the stem edge structure information extracted by the 5×5 convolutional branches during compression. The two types of features at different scales maintain their independence and integrity before entering the concatenation and fusion process. Meanwhile, the per-channel 1×1 convolution only performs single-spatial-position weighting within a channel, without introducing cross-spatial-position convolution operations. This avoids blurring of the gradient at the edge of the lesion during compression by averaging neighboring pixels, allowing the weak texture signal preserved by CReLU to be effectively transmitted to the next network layer. The compression layer parameters of the corresponding branches in the three cascaded modules are also independent, allowing the compression parameters of the shallow modules to focus on adapting to the distribution characteristics of low-level texture features, while the compression parameters of the middle and deep modules can adapt to the distribution characteristics of features at their respective levels, without losing the differences in feature expression between layers due to parameter sharing.

[0043] In a specific application example, an image of early-stage ulceration on the stem of a dragon fruit is input into the model. After processing by the first channel-wise attention weighting module, the image enters the first feature extraction channel. In the first multi-scale convolution module, a 3×3 convolution branch captures gradient changes within a few pixels of the edge of the lesion. In the feature map output by this branch, some channels generate high activation values ​​for sharp gradients at the lesion edge. The 5×5 convolution branch simultaneously captures the reflective texture of the waxy layer on the stem surface surrounding the lesion and the direction of a small section of the edge. Both branches are then processed through CReLU activation layers and batch normalization layers before being fed into their respective depthwise separable convolutional layers. The 3×3 branch's channel-wise 1×1 convolution assigns higher scaling weights to channels carrying lesion edge gradient information and lower scaling weights to channels carrying flat background noise. The 5×5 branch's channel-wise 1×1 convolution independently adjusts the weights of the stem structure channels it focuses on. The two branches are then compressed to 64 channels through pointwise convolution and concatenated to restore a 128-channel output. Because the compression processes of the two branches are completely independent, the gradient information of the lesion edges in the 3×3 branch retains its relative response intensity after compression and is not overwhelmed by the stem structure signal of the 5×5 branch. After the three modules are cascaded, the local texture features of early-stage ulcer lesions and the normal stem structure are distinguished in the output feature map of the first feature extraction channel, providing a clearer feature basis for subsequent fusion with the global structural features of the second feature extraction channel and final classification and recognition.

[0044] (4) Based on the above implementation, in another implementation, in the standard hollow space pyramid pooling structure, parallel convolutional branches with different hollow rates usually share the same set of convolutional kernel weight parameters, and the output gradients of each branch converge to update the same parameter matrix during backpropagation. This sharing mechanism leads to the large hollow rate branch having a larger receptive field coverage and capturing a larger proportion of global structural signals in the feature map, and its gradient signal dominates in parameter updates, thereby inhibiting the small hollow rate branch from learning local lesion texture features. In the dragon fruit stem and leaf disease identification scenario, the small hollow rate branch should be responsible for capturing local texture information such as the depth of lesion edge depression and color transition gradient, while the large hollow rate branch should be responsible for capturing global morphological information such as the periodic distribution of stem edges and the evenly spaced arrangement of areoles. However, the shared weight mechanism causes the former to be suppressed by the latter, and the two types of information cannot be extracted in a balanced manner. To address this issue, this implementation specifies that the kernel weight parameters of the branches with different void ratios within each dilated multi-scale convolution module, as well as the kernel weight parameters of the corresponding branches at different levels within the same channel, are all independent.

[0045] Specifically, the second feature extraction channel consists of N cascaded dilated multi-scale convolutional modules, preferably N=3. Each dilated multi-scale convolutional module includes a first dilated convolutional kernel branch and a second dilated convolutional kernel branch arranged in parallel. The kernel size of both branches is 3×3, i.e., c=3. The dilation rate of the first dilated convolutional kernel branch is 2, i.e., d1=2, and its effective receptive field is approximately 5×5; the dilation rate of the second dilated convolutional kernel branch is 3, i.e., d2=3, and its effective receptive field is approximately 7×7 to 9×9. The two dilated convolutional branches are instantiated as two independent convolutional layers. Taking the first dilated multi-scale convolutional module as an example, the parameters of the first dilated convolutional kernel branch are set as follows: the number of input channels is the same as the number of input channels of the module, the number of output channels is the preset number of intermediate channels of the module, the kernel size is 3, the padding is 2, and the dilation rate is 2. The parameters of the second dilated convolutional kernel branch are set as follows: the number of input channels and the number of output channels are the same, the kernel size is 3, the padding is 3, and the dilation rate is 3. The weight parameters of the two convolutional layers are initialized independently. The initialization method can be Xavier initialization or Kaiming normal distribution initialization. The weight matrices of the two layers are stored independently in memory, and their gradients are calculated independently during backpropagation. They do not share parameters. After one batch of training iterations, the weight parameters of the first dilated convolutional kernel branch are updated only according to the loss gradient corresponding to its own output, and are not affected by the gradient signal of the second dilated convolutional kernel branch; the weight parameters of the second dilated convolutional kernel branch are also driven only by its own gradient.

[0046] The outputs of the two dilated convolution branches are sequentially connected to the CReLU activation layer and the batch normalization layer, and the processing method is the same as the previous implementation method. Then, the outputs of the two branches are concatenated along the channel dimension and fed into a 1×1 convolutional layer for channel compression. After compression, the number of channels is consistent with the number of input channels of the module.

[0047] The same second feature extraction channel contains three cascaded dilated multi-scale convolutional modules: the first, second, and third. In the first module, the kernel weights of the first dilated convolutional kernel branch with a dilation rate of 2 are denoted as W1,2, and the kernel weights of the second dilated convolutional kernel branch with a dilation rate of 3 are denoted as W1,3; these are independent. In the second module, the kernel weights of the first dilated convolutional kernel branch with a dilation rate of 2 are denoted as W2,2, and the kernel weights of the second dilated convolutional kernel branch with a dilation rate of 3 are denoted as W2,3; these are also independent. Furthermore, W1,2 and W2,2 are also independently initialized, trained, and updated, without sharing parameters; W1,3 and W2,3 are also independent. The third module follows the same pattern. The kernel weights of the six dilated convolutional branches across the three modules are completely independent.

[0048] Unlike existing hollow space pyramid pooling structures and similar schemes that share convolutional kernel weights across branches with different porosity rates and rely on attention mechanisms for post-processing weighted compensation at the output, this implementation adopts a design that severs the sharing relationship from the parameter end. In the shared weight scheme, even if the outputs of each branch are reweighted through channel attention, the gradient signal of the branch with a large porosity rate still dominates the parameter update direction during backpropagation, and the parameter optimization of the branch with a small porosity rate is continuously interfered with, systematically suppressing the learning of local texture features. This implementation allows the two hollow convolutional branches to have completely independent parameter spaces and gradient calculation paths from initialization. The smaller receptive field parameters of the first hollow convolutional kernel branch can focus on learning local texture features of lesions such as the gradient direction of the early concave edge of ulcer disease and the local color transition pattern of the purplish-brown infiltrated halo in the early stage of anthrax; the larger receptive field parameters of the second hollow convolutional kernel branch can focus on learning global morphological features such as the longitudinal periodic distribution of stem edges, the equidistant arrangement of areoles along the edge direction, and the spatial pattern of the striped spread of ulcer lesions along the edge direction. The different spatial scale features captured by the two branches remain independent in terms of their source at the parameter level, and each carries complementary discriminative information during subsequent splicing and fusion.

[0049] In a specific application example, an image of mid-stage canker disease on a dragon fruit stem is input into the model. In this image, the lesions have expanded along the stem edges, forming a striped distribution along the edges, while the edges of the lesions still show localized, sunken, and chlorotic textures. After processing by the second-channel input image pyramid and the channel-by-channel attention module, the feature map enters the first dilated multi-scale convolutional module. The kernels of the independently parameterized first dilated convolutional branch, after training, exhibit a strong response to the sunken gradient direction at the lesion edges; the kernels of the second dilated convolutional branch, after training, exhibit a strong response to the alternating bright and dark textures along the stem edges and the periodic structure of the areoles arranged along the edges. The outputs of the two branches, after CReLU activation and batch normalization, retain their respective response patterns, are compressed and concatenated, and then fed into the second dilated multi-scale convolutional module. In the second module, the first dilated convolution branch, independent of the first module, further abstracts higher-level local texture representations based on the features of the previous layer. The second dilated convolution branch further extracts higher-level structural patterns of edge and areole distributions. After the three modules process the features independently at each level, the output feature map of the second feature extraction channel contains both a progressively refined representation of the local texture of the lesion and a progressively abstract representation of the global morphological structure of the stem, providing complete and complementary global structural information for subsequent fusion with the local texture features of the first feature extraction channel. Through the above-mentioned design of completely independent parameters within and between modules, this method fundamentally eliminates gradient competition between different receptive field branches at the parameter level, allowing the large and small receptive field branches to independently and fully learn the features at their corresponding scales. Together with the branch-independent compression design in the first feature extraction channel, this constitutes the feature separation mechanism within each of the two channels.

[0050] (5) Based on the above implementation method, in another implementation method, the negative value part in the standard CReLU activation function is to take the absolute value of all negative values ​​and retain them without difference. However, in the dragon fruit stem and leaf disease identification scenario, there are two types of negative response with completely different physical causes: one is the weak negative gradient signal formed by the attenuation of brightness from high to low in the reflective transition zone of the wax layer, which has a small amplitude but carries discriminative texture information; the other is the negative response of the strong shadow area formed by the edge of the stem under side light, which has a large amplitude but does not carry discriminative information related to lesions, and will instead suppress the weak texture signal in the subsequent feature fusion. The standard CReLU treats these two types of negative signals equally, causing the weak gradient carrying discriminative information to be submerged. To solve this problem, this implementation method introduces a segmented threshold mechanism in the negative value processing branch of the CReLU activation layer to distinguish between low amplitude negative values ​​and high amplitude negative values.

[0051] Specifically, the CReLU activation layers connected after each convolutional kernel branch in the first and second feature extraction channels perform the following segmentation operations on the input feature map. First, the input feature map is divided equally along the channel dimension into a first part and a second part, each occupying half the number of input channels. Second, the first part undergoes the same positive half-axis processing as standard CReLU: retaining all positive values ​​and setting all negative values ​​to zero, resulting in the first part output. Third, the second part undergoes segmented thresholding: first, all positive values ​​are set to zero; for negative values, instead of directly taking all absolute values, a negative value magnitude threshold θ is set. This threshold θ is calculated as follows: the sum of the absolute values ​​of all negative pixels in the feature map of that channel is divided by the total number of negative pixels to obtain the mean absolute value of all negative values ​​in that channel, and then this mean is multiplied by a scaling factor α. The scaling factor α ranges from 0.5 to 2.0, preferably α=1.0. When α=1.0, the threshold θ is exactly equal to the mean absolute value of all negative values ​​in that channel. After calculating the threshold θ, each negative pixel in the channel is judged one by one: negative pixels with an absolute value less than or equal to θ retain their absolute value, while negative pixels with an absolute value greater than θ are set to zero. In the fourth step, the first part of the output is concatenated with the second part of the output after segmentation and thresholding along the channel dimension. The total number of channels after concatenation is consistent with the number of channels in the input feature map, and then it is fed into the subsequent normalization layer.

[0052] In the PyTorch framework, the segmented threshold CReLU mentioned above can be implemented using a custom function. The input feature map x has the shape of batch size × C × H × W. First, x is divided into x1 and x2 along the channel dimension, each with the shape of batch size × (C / 2) × H × W. x1 is processed directly using the ReLU function, i.e., retaining positive values ​​and setting negative values ​​to zero. x2 is processed as follows: first, the pixels less than 0 in x2 are extracted to form a negative value mask. The mean of the absolute values ​​of the pixels at the corresponding positions of the mask is calculated and multiplied by α to obtain θ. Then, an element-wise conditional judgment operation is used to retain the absolute values ​​of negative pixels with absolute values ​​less than or equal to θ, and set the absolute values ​​of negative pixels with absolute values ​​greater than θ to zero, as well as positive values. Finally, the processed x1 and x2 are concatenated along the channel dimension, and the output shape is still batch size × C × H × W. The scaling factor α is set to an initial value of 1.0 before training the improved MSF-Net model and remains unchanged throughout the training process, without participating in backpropagation updates.

[0053] The selection of α=1.0 is based on the fact that the negative gradient amplitude of the reflective transition zone in the waxy layer of dragon fruit stem and leaf images is usually near or below the mean of all negative amplitude distributions in that channel, while the negative amplitude of the shadows on the stem edges is usually much greater than the mean. When α=1.0, the threshold θ is exactly the mean of the absolute values ​​of the negative values. Low-amplitude negative values ​​with absolute values ​​less than the mean are retained, while high-amplitude negative values ​​with absolute values ​​greater than the mean are discarded. This setting can effectively filter out the weak texture signals of the reflective transition zone while filtering out the strong noise signals of the edge shadows. If the lighting conditions in the deployment environment are stronger than those in the training environment, the gradient range of the reflective transition zone may be expanded. In this case, α can be increased to 1.2 to 1.5 to appropriately expand the retention range; conversely, if the lighting conditions are relatively soft and the interference from the edge shadows is weak, α can be decreased to 0.5 to 0.8 to more strictly filter out noise.

[0054] Compared to the standard CReLU approach of indiscriminately retaining the absolute values ​​of all negative values, this implementation introduces an adaptive threshold based on the statistical distribution of negative values ​​within a channel, enabling CReLU to distinguish physical causes based on the magnitude of negative values. In the standard CReLU, the weak gradient signal of the reflective transition zone of the waxy layer and the strong negative signal of the shadow on the stem edge are mixed and retained together before being sent to the subsequent normalization layer. The two types of signals are intertwined in the feature space, with the weak signal being suppressed by the strong signal. In this implementation, high-amplitude negative values ​​are set to zero and no longer enter subsequent feature propagation, while low-amplitude negative values ​​carrying discriminative information are retained independently. Their gradient signals are also propagated back only through the path corresponding to low-amplitude negative values ​​during backpropagation, and are not diluted by the gradient of the high-amplitude negative value region.

[0055] In a specific application example, an image of early-stage canker on a dragon fruit stem is fed into the model. In this image, the lesions are located near the reflective area of ​​the waxy layer. The reflective transition zone produces a weak negative gradient value with an amplitude of approximately 0.2 to 0.5, while the stem edge shadow produces a strong negative value with an amplitude of approximately 1.5 to 3.0. In a certain CReLU activation layer, the average absolute value of all negative pixels in this channel is 0.8, and the threshold θ = 0.8 when α = 1.0. The negative values ​​of the reflective transition zone are preserved because their absolute values ​​are less than 0.8, while the negative values ​​of the edge shadow are set to zero because their absolute values ​​are greater than 0.8. After processing by this CReLU activation layer, the second part of the output only contains the weak texture information of the reflective transition zone, while the edge shadow information is removed. The two parts are then stitched together and fed into a subsequent normalization layer, where the normal tissue texture response of the first part and the pure reflective transition zone texture response of the second part are each preserved. Through the segmented thresholding process described above, this method achieves source differentiation and selective retention of negative signals within the CReLU activation layer, ensuring that the weak texture information of the reflective transition zone of the waxy layer is no longer overwhelmed by the strong signal of the stem edge shadow, thus providing a purer texture feature representation for subsequent multi-scale feature fusion and classification recognition.

[0056] (6) Based on the above implementation method, in another implementation method, in the direct connection sequence of the standard CReLU activation layer followed by the batch normalization layer, the batch normalization layer uses all channels after CReLU splicing as the statistical range and calculates the mean and variance across channels for normalization. However, the first part of the CReLU splicing output comes from positive value retention and the second part comes from negative absolute value retention. Although the activation values ​​of the two parts are both non-negative in the numerical domain, the physical causes of the data sources are completely different, resulting in a systematic shift in the distribution center of the mean and variance of the two parts. The batch normalization layer normalizes the two parts as a whole without difference, forcibly pulling the two activation subsets with different distribution centers to the same mean, so that the texture discrimination ability obtained by CReLU by retaining negative response is partially canceled after normalization. In the scenario of dragon fruit stem and leaf disease identification, this smoothing effect of distribution difference will weaken the discrimination between the weak negative gradient signal of the waxy layer reflective transition zone and the positive half-axis texture signal of normal tissue. To address this issue, this implementation replaces the batch normalization layer connected after each CReLU activation layer with a group normalization layer, using the semantic boundaries of CReLU as the basis for grouping.

[0057] Specifically, in the first and second feature extraction channels, after each convolutional kernel branch within each multi-scale convolutional module and each dilated multi-scale convolutional module, the CReLU activation layer and normalization layer are configured as follows: After performing segmentation thresholding on the input feature map, the CReLU activation layer concatenates the first and second part outputs along the channel dimension. Assuming the number of channels in the CReLU input feature map is C, each part has C / 2 channels, which are then concatenated to restore C channels. After the CReLU activation layer, a grouped normalization layer is connected, with the number of groups set to 2. The group boundaries are strictly aligned with the equal division boundaries when the CReLU activation layer divides the input feature map into two parts along the channel dimension, such that the first group contains all channels of the first part output of the CReLU activation layer, i.e., C / 2 channels from the positive value retention path; the second group contains all channels of the second part output of the CReLU activation layer, i.e., C / 2 channels from the negative absolute value retention path. Since the concatenation order of CReLU is first part first and second part last, the grouping normalization layer automatically divides the first C / 2 channels into the first group and the last C / 2 channels into the second group according to the channel index order, and the grouping boundary is naturally aligned with the semantic boundary of CReLU.

[0058] The grouping normalization layer calculates the mean and variance along the channel dimension for the first group separately. The first group contains C / 2 channels, each with a spatial size of H×W. The mean μ1 and variance σ1 are calculated for all C / 2×H×W activations within this group. 2, with μ1 and σ1 2 All channels within the first group are normalized to adjust the activation value distribution to a standard distribution with a mean of 0 and a variance of 1. After normalization, an affine transformation is performed using the scaling parameter γ1 and the offset parameter β1 of the first group. Both γ1 and β1 are learnable vectors of length C / 2, which are updated independently during training via backpropagation. Similarly, the mean and variance of the second group are calculated separately along its channel dimension to obtain μ2 and σ2. 2 After normalizing all channels within the second group, an affine transformation is performed using the second set of scaling parameters γ2 and offset parameters β2. γ2 and β2 are also learnable vectors of length C / 2. The two sets of scaling and offset parameters are initialized and trained independently; γ1 and γ2 do not share parameters, and β1 and β2 do not share parameters. At the start of training, γ1 and γ2 can be initialized as vectors of all 1s, and β1 and β2 can be initialized as vectors of all 0s. The first and second groups after the affine transformation are concatenated along the channel dimension, resulting in a concatenated number of channels C. This concatenated number of channels is used as the output of the normalization layer for that group and fed into subsequent network layers.

[0059] Compared to the standard batch normalization layer, which performs uniform cross-channel statistical normalization on all C channels after CReLU concatenation, the group normalization layer in this embodiment allows the two signal groups to be normalized independently within their respective groups. The positive half-axis texture signal in the first group is normalized based on its own distribution center, and the relative magnitude of its activation values ​​is not disturbed by the distribution of the negative half-axis absolute value signal in the second group. Similarly, the negative half-axis absolute value signal in the second group is normalized based on its own distribution center, ensuring that the weak texture response of the waxy reflective transition zone is not suppressed by the large activation signal of the normal tissue in the positive half-axis. Two independent scaling parameters γ1, γ2 and offset parameters β1, β2 also enable the network to learn the optimal affine transformation configuration for each of the two signal groups. The gain of the positive half-axis signal and the gain of the negative half-axis absolute value signal are optimized independently, providing more stable transmission conditions for the weak texture information preserved by CReLU.

[0060] In a specific application example, an image of early anthracnose on the stem of a dragon fruit is fed into the model. After the 3×3 convolution branch of the first multi-scale convolutional module, the CReLU activation layer outputs the positive half-axis activation values ​​of the first part and the negative half-axis absolute activation values ​​of the second part, each with 64 channels, concatenated to 128 channels. The grouping normalization layer takes the first 64 channels as the first group, calculates its mean and variance, and then performs normalization and affine transformation; it takes the last 64 channels as the second group, calculates its mean and variance, and then performs normalization and affine transformation. The weak texture channels corresponding to the reflective transition zone of the waxy layer in the second group retain their response intensity after independent normalization, and will not be masked by the strong response channels of normal tissue in the first group during subsequent feature extraction. After subsequent 1×1 convolution compression, the discriminative information carried by each part of the signal is retained in the compressed features. Through the above grouping normalization design, this method performs independent distribution adjustment and parameterization enhancement on the positive half-axis texture information and the negative half-axis absolute value texture information after the CReLU activation layer. This protects the texture discrimination ability obtained by CReLU by retaining the negative response, so that the distribution difference between the two types of signals is retained after normalization rather than being artificially smoothed out.

[0061] (7) Based on the above implementation, in another implementation, in the standard dual-channel feature stitching scheme, the output feature maps of the two channels are directly stitched along the channel dimension and then fed into the subsequent network layer, or the overall features after stitching are uniformly weighted through a shared channel attention mechanism. However, the first feature extraction channel is processed by multi-scale standard convolution, and its output feature map is sensitive to local texture responses such as the edge of the lesion and the reflective transition zone of the wax layer, and the activation values ​​show a sparse and sharp distribution with large inter-channel variance; the second feature extraction channel is processed by dilated multi-scale convolution, and its output feature map is sensitive to global structural responses such as the distribution of stem edges and the arrangement of areoles, and the activation values ​​show a uniform spread distribution with small inter-channel variance. Directly stitching the two types of feature maps with significantly different statistical distributions will cause the few high-activation channels in the first channel carrying discriminative texture information to be submerged by a large number of medium-activation channels in the second channel during subsequent global average pooling. To solve this problem, this implementation performs three steps of processing on the output of the two channels before stitching: distribution equalization, independent channel scaling, and independent spatial attention weighting.

[0062] Specifically, step S3 includes the following sub-steps. In sub-step S31, the output feature map of the first feature extraction channel is subjected to distribution equalization processing. The output feature map of the first feature extraction channel has a shape of 28×28×256. The mean and variance of each channel are calculated along the channel dimension. The mean is calculated by summing the activation values ​​of the 28×28 spatial locations within the channel and dividing by 784. The variance is calculated by subtracting the mean of the channel from the activation value of each spatial location within the channel, summing the squares, and then dividing by 784. The activation values ​​of each channel are normalized using their own mean and variance, that is, each activation value is subtracted from the mean of its channel and divided by the sum of the standard deviation of the channel and a small constant ε, where ε can be 1×10⁻. 5 To prevent division by zero, after normalization, the activation value distribution of each channel in the first channel has zero mean and unit variance, resulting in the normalized feature map of the first channel, which still has a shape of 28×28×256. In sub-step S32, the same distribution equalization process is performed on the output feature map of the second feature extraction channel. The output feature map of the second feature extraction channel is also 28×28×256. The mean and variance of each channel are calculated independently along the channel dimension and then normalized to obtain the normalized feature map of the second channel. The distribution equalization processes of the two channels are performed independently. The normalization statistics of the first channel are calculated only on the 256 channels within the first channel, and the normalization statistics of the second channel are calculated only on the 256 channels within the second channel. The two processes do not interfere with each other.

[0063] In sub-step S33, the first-channel normalized feature map is multiplied channel-by-channel by a learnable first-channel scaling parameter vector γ1. The dimension of γ1 is equal to the number of channels in the first-channel normalized feature map, i.e., a vector of length 256. It can be initialized as an all-1 vector and updated independently during training via backpropagation. The channel-by-channel multiplication operation involves multiplying the k-th element of γ1 by all spatial activation values ​​of the k-th channel of the first-channel normalized feature map, where k = 1, 2, ..., 256. Similarly, the second-channel normalized feature map is multiplied channel-by-channel by a learnable second-channel scaling parameter vector γ2. γ2 also has a dimension of 256, is initialized as an all-1 vector, and is updated independently during training. γ1 and γ2 do not share parameters and are implemented as two independent learnable parameters.

[0064] In sub-step S34, independent spatial attention weighting is applied to the scaled first-channel feature map. First, average pooling and max pooling are performed along the channel dimension. Average pooling is the average of the 256 channel activation values ​​for each spatial location, and max pooling is the maximum of the 256 channel activation values ​​for each spatial location, each yielding a spatial descriptor of size 28×28×1. The two spatial descriptors are concatenated along the channel dimension to obtain a concatenated descriptor of size 28×28×2. This concatenated descriptor is fed into a convolutional layer with a kernel size of 7×7. This convolutional layer has 2 input channels, 1 output channel, and padding of 3 to maintain the spatial size. After activation by the sigmoid function, a first-channel spatial attention weight map of size 28×28×1 is generated. The spatial attention weight map of the first channel is multiplied by the scaled feature map of the first channel at each spatial location. That is, the single value of the weight map at each spatial location of 28×28 is multiplied by the activation value of all 256 channels of the feature map at that spatial location to obtain the weighted feature map of the first channel with a shape of 28×28×256.

[0065] In sub-step S35, independent spatial attention weighting is performed on the scaled second-channel feature map, following the same steps as in sub-step S34. First, average pooling and max pooling are performed along the channel dimension to obtain two 28×28×1 spatial descriptors. These are concatenated to form a 28×28×2 descriptor and fed into another convolutional layer with a 7×7 kernel. After sigmoid activation, a second-channel spatial attention weight map is generated. This weight map is then multiplied spatially with the scaled second-channel feature map to obtain a second-channel weighted feature map with a shape of 28×28×256. The 7×7 convolutional kernel parameters for generating the first-channel spatial attention weight map and the 7×7 convolutional kernel parameters for generating the second-channel spatial attention weight map are not shared; they are instantiated as two independent convolutional layers, each independently initialized, trained, and updated.

[0066] In sub-step S36, the first channel weighted feature map and the second channel weighted feature map are concatenated along the channel dimension to obtain a multi-scale fusion feature map with a size of 28×28×512, which is then fed into the subsequent global average pooling layer and fully connected classification layer.

[0067] Unlike existing dual-branch feature fusion schemes that typically employ direct splicing followed by uniform channel attention weighting, this implementation addresses the statistical distribution differences between the two channels through a two-stage fusion paradigm: equalization followed by differentiation. In the first stage, distribution equalization adjusts the outputs of both channels to a comparable statistical baseline through independent normalization. This ensures that the sparse, sharp texture signal of the first channel and the uniformly spread structural signal of the second channel achieve distribution compatibility before splicing, avoiding mutual suppression due to differences in numerical ranges. In the second stage, independent channel scaling parameters and independent spatial attention weights allow each channel to achieve optimal gain adjustment and spatial focusing on a comparable baseline: the spatial attention of the first channel guides the network to focus on spatially significant local texture locations such as lesion edges and reflective transition zones in the waxy layer; the spatial attention of the second channel guides the network to focus on spatially significant global structural locations such as stem edge directions and areole spacing.

[0068] In a specific application example, an image of the boundary between early-stage canker and anthracnose on the stem of a dragon fruit was fed into the model. In the output feature map of the first feature extraction channel, a few channels corresponding to the concave edges of lesions produced high activation values ​​at the spatial location of the lesion edge, while the channels in most flat healthy tissue areas had low activation values, showing an overall sparse and sharp distribution. In the output feature map of the second feature extraction channel, channels corresponding to the direction of the stem edges and the arrangement of areoles produced moderate and uniform activation values ​​over a larger spatial area, showing an overall evenly spread distribution. After distribution equalization, the mean and variance of each channel in both channels were unified to the same baseline. The scaling parameter γ1 of the first channel assigned a high scaling factor to the channel carrying the gradient information of the lesion edge after training, while the scaling parameter γ2 of the second channel assigned a moderate scaling factor to the channel carrying the edge structure information. The spatial attention weight map of the first channel produced high weight values ​​at the edge of the lesion, while the spatial attention weight map of the second channel produced high weight values ​​along the edge direction and areole position. In the fused feature map after weighted splicing of the two channels, the local texture features of the lesion edges and the global structural features of the stem edges are preserved and enhanced respectively. Through the above design, this method protects the discriminative information extracted by each of the two channels from being mixed and diluted during the feature fusion stage, providing a more complete multi-scale fused feature representation for subsequent classification and recognition.

[0069] (8) Based on the above implementation, in another implementation, in the standard global average pooling operation, the arithmetic mean of the activation values ​​of all spatial locations within each channel is calculated, and each spatial location contributes to the pooling scalar value of that channel with the same weight. However, after the preceding dual-channel feature extraction, distribution equalization, and independent spatial attention weighting, the discriminative information of different channels in the multi-scale fusion feature map is spatially unevenly distributed. The information of some channels is concentrated in a few spatial locations such as the edge of the lesion, and the information of some channels is distributed in a strip-like pattern along the direction of the stem edge. The uniform weighting assumption of standard global average pooling averages the discriminative high activation signals concentrated in a few spatial locations together with a large number of background low activation values, resulting in severe dilution of the high activation signals. To solve this problem, this implementation uses significance-weighted pooling based on activation value deviation to replace standard global average pooling.

[0070] Specifically, when performing pooling processing on the multi-scale fused feature map obtained in step S3, the size of the fused feature map is 28×28×512, that is, 512 channels, and the spatial size of each channel is 28×28, for a total of 784 spatial locations. For each channel of the multi-scale fused feature map, the mean value μ_c of the activation values ​​of all spatial locations within that channel is first calculated. For channel c, μ_c is the sum of the 784 activation values ​​within that channel divided by 784. This mean value reflects the average response level of that channel across the entire spatial range. Then, for each spatial location activation value a_c(i,j) within that channel, the significance weight w_c(i,j) of that spatial location is determined based on the deviation of that activation value from the channel mean μ_c. The specific rules are as follows: When the activation value a_c(i,j) is higher than the mean μ_c, the spatial location is an information-dense region, and an enhancement weight greater than 1 is assigned. The higher the activation value is than the mean, the more prominent the information at that location, and the greater the enhancement weight. The enhancement weight has an upper limit w_max, which is 2.0, to prevent an extremely high activation value at a single spatial location from dominating the pooling process. When the activation value a_c(i,j) is lower than the mean μ_c, the spatial location is an information-sparse region, and a suppression weight less than 1 but always greater than 0 is assigned. The lower the activation value is than the mean, the smaller the suppression weight, so that its contribution to the pooling process is reduced but not completely discarded. When the activation value a_c(i,j) is equal to the mean μ_c, the weight is 1, and the location participates in the pooling process with the original activation value.

[0071] In the specific implementation, the above saliency weights can be calculated as follows: First, the mean value of the fused feature map is calculated along the spatial dimension to obtain a channel mean vector with a shape of 512×1×1. After expanding this mean vector back to a spatial size of 28×28, the difference between the activation value and the corresponding channel mean is calculated for each spatial location. For locations where the difference is greater than 0, the enhancement weight can be increased from 1 by adding 1 to the ratio of the difference divided by the mean, but truncated to no more than w_max=2.0; for locations where the difference is less than 0, the suppression weight can be decreased from 1 by adding 1 to the ratio of the absolute value of the difference divided by the mean, but remains greater than 0. For example, when the activation value is much lower than the mean, the suppression weight tends to a small positive value; for locations where the difference is equal to 0, the weight remains 1.

[0072] After determining the saliency weight for each spatial location, the activation value a_c(i,j) of each spatial location within the channel is multiplied by its saliency weight w_c(i,j), and then summed to obtain the weighted activation value sum. Simultaneously, the saliency weights of all spatial locations within the channel are summed to obtain the weighted sum. Dividing the weighted activation value sum by the weighted sum yields the weighted pooling scalar value s_c for that channel. The weighted pooling scalar values ​​of all channels together form a feature vector with a length of 512, the same as the number of channels in the fused feature map. When the activation values ​​of all spatial locations within a channel are equal, the activation values ​​of all spatial locations are equal to the mean of that channel, the difference between each spatial location and the mean is zero, and the saliency weight of all spatial locations is 1. In this case, the weighted pooling operation for that channel degenerates into standard global average pooling, ensuring numerical stability in extreme cases.

[0073] Unlike standard global average pooling, which indiscriminately averages high-activation signals with low-activation backgrounds, this implementation's saliency-weighted pooling introduces adaptive weights based on the deviation of activation values ​​within a channel. This enhances signals in information-dense regions and moderately suppresses signals in information-sparse regions without adding any trainable parameters. Furthermore, unlike global max pooling, which only retains the maximum value and completely discards the second-highest activation region, this implementation preserves the non-zero contribution of information-sparse regions to the channel scalar values ​​by suppressing the constraint of weights greater than 0. Spatial extension information of global structural signals, such as stem edge direction and areole arrangement intervals, is retained after pooling. The upper limit of the enhancement weights, w_max=2.0, prevents abnormally high activation values, such as reflective saturated pixels in the wax layer, from excessively influencing the pooling results.

[0074] In a specific application example, a multi-scale fusion feature map obtained after processing an image of early-stage canker disease on a dragon fruit stem in the preceding steps is fed into the saliency-weighted pooling layer of this embodiment. One channel in the fusion feature map primarily responds to the gradient information of the lesion's recessed edges. Within this channel, approximately several dozen spatial locations in the lesion edge region generate high activation values, with a mean μ_c of a moderate value. These edge spatial locations, with activation values ​​higher than the mean, are assigned enhancement weights of approximately 1.5 to 2.0; while the activation values ​​of a large number of flat, healthy tissue regions are lower than the mean, and are assigned suppression weights of approximately 0.6 to 0.8. After weighted summation and division by the weights, the pooling scalar value of this channel is mainly contributed by the high activation signal at the lesion edges, and the dilution effect of the background region is significantly reduced. Another channel primarily responds to the structural distribution of the stem edges, with activation values ​​evenly distributed along the edge direction. Within this channel, the activation values ​​of most spatial locations are close to the mean, with a weight close to 1. The pooling scalar value completely preserves the overall spatial characteristics of the edge structure information. The weighted pooling scalar values ​​of each channel form a 512-dimensional feature vector, which is then fed into the fully connected classification layer. Through the aforementioned saliency-weighted pooling design, this method effectively alleviates the dilution problem of spatially concentrated discriminative signals caused by standard global average pooling in the feature compression stage. This ensures that the response intensity of concentrated signals such as lesion edge gradients is maintained after pooling, while the spatial extension information of global structural signals such as stem edges is not completely discarded, providing a more complete feature vector representation for final classification and recognition.

[0075] (9) Based on the above implementation method, in another implementation method, in the existing classification scheme for dragon fruit stem and leaf diseases, the model usually only outputs macroscopic disease categories such as canker and anthracnose, without distinguishing between the early and late stages of the same disease. This results in the inter-class boundaries of similar early lesions of different diseases being submerged by intra-class variance in the feature space, and the classification results cannot provide guidance information on the disease stage level for precise prevention and control. At the same time, soft rot is often not included in the existing deep learning classification system, and no fine-grained differentiation scheme has been proposed between the early infiltrated translucent lesions of soft rot and the early sunken lesions of canker and anthracnose. To solve this problem, this implementation method expands the output nodes of the fully connected classification layer to 7, corresponding to the early stage of dragon fruit canker, the late stage of dragon fruit canker, the early stage of dragon fruit anthracnose, the late stage of dragon fruit anthracnose, the early stage of dragon fruit soft rot, the late stage of dragon fruit soft rot, and healthy. The weight matrix of the fully connected classification layer has a size of 512×7, and the bias vector has a length of 7. After softmax normalization, it outputs predicted probabilities for 7 categories. Each output node has a preset confidence threshold. The preset confidence threshold for output nodes corresponding to early lesions is preferably 0.75, the preset confidence threshold for output nodes corresponding to late lesions is preferably 0.55, and the preset confidence threshold for output nodes corresponding to healthy lesions is the same as that for late lesions, preferably 0.55. The reason for setting the early threshold higher than the late threshold is that the local texture features of early lesions are relatively blurry, and the distribution of early lesions of different diseases in the feature space is more likely to overlap, requiring a more cautious confidence requirement for direct judgment; the macroscopic symptoms of late lesions are more significant, and the model's judgment of them is usually more certain, so the threshold can be appropriately relaxed. In addition, a comprehensive confidence threshold is set, preferably 0.65, to determine whether the basic category can be output when merging probabilities across stages of the same disease.

[0076] In step S4, a feature vector of length 512 is fed into a fully connected classification layer and normalized by softmax to obtain 7 predicted probability values. First, the output node corresponding to the highest predicted probability is taken as the preferred category. Then, it is checked whether the predicted probability value of the preferred category reaches the preset confidence threshold corresponding to the output node. For example, if the preferred category is early stage of dragon fruit canker, its probability value is checked to see if it reaches 0.75; if the preferred category is late stage of dragon fruit canker, its probability value is checked to see if it reaches 0.55. If the predicted probability value of the preferred category reaches its preset confidence threshold, the preferred category is directly used as the final classification result, and the process ends. If it does not reach the threshold, cross-stage probability sum discrimination for the same disease is initiated. When the preferred category is an early subcategory of a certain disease, the predicted probability value of the late subcategory of the same disease is summed with the predicted probability value of the preferred category. If the sum of these probabilities reaches the comprehensive confidence threshold of 0.65, the basic category name of the disease, such as canker, is output, along with a pending confirmation marker for the disease stage, and the process ends. For example, the probability of the preferred category, early stage of ulcer disease, is 0.50, which does not reach the early stage threshold of 0.75. However, the probability of its late stage subcategory is 0.20. The sum of these two probabilities is 0.70, reaching the comprehensive confidence threshold of 0.65. Therefore, ulcer disease is output, and the disease stage is marked as pending confirmation. When the preferred category is a late stage subcategory of a disease, the predicted probability of the early stage subcategory of the same disease is summed with the predicted probability of the preferred category, and the comprehensive threshold is also applied. This design combines the probabilities of the two stages to confirm the disease type when the network cannot make a high-confidence judgment between early and late stages, providing valuable reference information for actual prevention and control. If the sum of the probabilities still does not reach the comprehensive confidence threshold, it indicates that the model lacks sufficient classification certainty for both the specific stage and the disease type. In this case, the preferred category is used as the final classification result, and the process ends.

[0077] Unlike existing classification models that directly use the maximum softmax value as the result in a single-stage decision-making process, this implementation introduces a two-level hierarchical response process. Differential confidence thresholds require early lesions to reach a higher confidence level before being directly identified, reducing misjudgments caused by early texture ambiguity. Furthermore, when the network cannot determine the specific disease stage, the probability complementarity of the two subcategories of the same disease can still effectively pinpoint the disease type, providing a reliable reference for targeted prevention and control.

[0078] In a specific application example, an image of a dragon fruit stem taken under natural sidelight conditions is fed into the model. The image shows an early lesion approximately 1 cm in diameter, with a circular, sunken area and slight fading at the edges, but the overall texture is not yet very clear. After prior dual-channel feature extraction, fusion, and pooling, among the seven predicted probabilities output by the fully connected classification layer, the probability of early-stage dragon fruit canker is 0.52, the probability of late-stage dragon fruit canker is 0.18, the probability of early-stage dragon fruit anthracnose is 0.14, and the probabilities of the other categories are all low. The preferred category is early-stage canker, but its probability of 0.52 does not reach the early stage threshold of 0.75. Therefore, the late-stage subcategory of the same disease, with a probability of 0.18, is selected. The sum of the two is 0.70, reaching the comprehensive confidence threshold of 0.65. Finally, canker is output along with a "stage to be confirmed" label. Although the model lacks certainty in determining the specific disease stage, it has effectively identified the disease as canker, allowing growers to implement targeted control measures. In another example, an image of a healthy stem is fed into the model. The fully connected classification layer outputs a healthy probability of 0.82, reaching the preset confidence threshold of 0.55 for the healthy node, and directly outputs "healthy" as the final classification result. Through the above hierarchical decision-making process, this implementation method can adopt differentiated discrimination strategies based on different levels of model classification certainty, providing more reliable classification outputs for the accurate identification and targeted control of dragon fruit stem and leaf diseases. (10) Based on the above implementation method, such as Figure 2 Furthermore, in another embodiment, under strong direct sunlight, the waxy layer on the surface of the dragon fruit stem produces specular reflection, causing the pixel value in a local area of ​​the RGB image to reach a saturation value of 255. The gradient information and fading transition texture of the lesion edges within the saturated area are erased, forming a flat, textureless region. When this saturated region happens to cover the key edges of early lesions, the gradient response extracted by the small-sized convolutional kernel in the first feature extraction channel in this region is zero. The positive half-axis output of the CReLU activation layer is only a flat high value, and the negative half-axis output also lacks texture gradient information. Its segmented thresholding mechanism cannot function due to the lack of effective negative gradients. To solve this problem, this embodiment performs saturated region detection and guided filtering filling before the image enters the improved MSF-Net model. In the first channel-by-channel attention weighting module, spatial position compensation is performed on the intermediate feature map after weighting by weight coefficients, and the saturation mask information is used to enhance the activation response of the original saturated region.

[0079] Specifically, a saturation preprocessing step is added before step S2. First, each pixel of the dragon fruit stem and leaf image is traversed, and the pixel value of any one of the R, G, and B channels is checked to see if it is equal to 255. If it is, the pixel is marked as a saturated pixel, resulting in a binary saturation mask M_sat with the same spatial size as the input image. In M_sat, the saturated pixel positions are set to 1, and the unsaturated pixel positions are set to 0. Then, guided filtering and filling operations are performed on the R, G, and B channels of the dragon fruit stem and leaf image respectively: the original image of the channel is used as the guide image, and the positions marked as saturated pixels in the channel by M_sat are used as the areas to be filled, and each saturated pixel is processed one by one. For each saturated pixel, a local window of size r×r is taken centered on it, where r is an integer greater than or equal to 3, and r≥a, where a is the kernel size of the first convolutional kernel branch, which is 3, preferably r=5. Within this local window, only the pixel values ​​of those unsaturated pixels with a value of 0 in M_sat are used to calculate the coefficients of the local linear model. Then, this local linear model is used to reconstruct the pixel values ​​of the saturated pixels at the center of the window in the guide map, obtaining the fill value for those saturated pixels. After each of the three channels completes its fill independently, a filled image is obtained. The areas in this image that were saturated and erased have been reasonably filled with surrounding unsaturated texture information, serving as the dragon fruit stem and leaf image fed into the improved MSF-Net model. Next, the binary saturation mask M_sat is downsampled to the same spatial resolution as the input feature map of the first multi-scale convolutional module in the first feature extraction channel, i.e., downsampled from 224×224 to 112×112, resulting in the downsampled saturation mask M'_sat.

[0080] In step S2, the first channel-wise attention weighting module generates learnable weight coefficients as described in claim 2, broadcasts these weight coefficients to all spatial locations of the input feature map, and then multiplies them element-wise with the activation values ​​of the corresponding channels to obtain an intermediate feature map. The size of this intermediate feature map is 112×112×64. Then, the activation values ​​of all channels at spatial locations corresponding to M'_sat values ​​of 1 in this intermediate feature map are multiplied by a learnable compensation factor λ greater than 1. The initial value of λ can be set to 1.5, and it is independently trained and updated through backpropagation during model training. The activation values ​​at spatial locations corresponding to M'_sat values ​​of 0 remain unchanged. The spatially compensated intermediate feature map is then output as the first channel input feature map and fed into the subsequent multi-scale convolution module of the first feature extraction channel for feature extraction.

[0081] Unlike existing technologies that employ histogram equalization or global illumination correction methods like Retinex, which cannot recover texture details that have been saturated and truncated, this implementation uses guided filtering to reconstruct textures by leveraging the local structural correlation between unsaturated and saturated pixels within the same channel. Furthermore, it correlates the filling window size *r* with the minimum convolutional kernel size *a* of the subsequent first feature extraction channel, ensuring that the filled texture area at least covers the receptive field of the minimum convolutional kernel, guaranteeing that small-sized convolutional branches can extract effective gradient responses. Simultaneously, the saturated mask is downsampled and used to compensate for the spatial location of intermediate feature maps, enhancing the network's attention to the originally saturated regions and compensating for any texture weakening that might result from filling repair. This two-stage synergy of filling repair and attention compensation provides a way for the model to recover discriminative information about saturated regions when the standard CReLU segmentation threshold cannot handle positive saturation truncation.

[0082] In a specific application example, an image of a stem taken at noon in a dragon fruit plantation shows direct sunlight exceeding 80,000 lux, projecting onto the stem surface. The thick, hard waxy layer covering the dragon fruit stem epidermis produces strong reflections at locations where the angle of incidence and viewing angle meet specular reflection conditions, forming a saturated area of ​​approximately 60×80 pixels. Within this bright, saturated area, the pixel values ​​of the R, G, and B channels all reach 255, completely erasing the original visual texture. Even more problematic, this saturated area happens to cover approximately two-thirds of the edge of an early-stage canker lesion, about 0.8 cm in diameter. Early-stage canker lesions themselves appear as circular, sunken, chlorotic spots with blurred boundaries from healthy tissue; their discriminative information highly depends on the complete gradient of the orange-yellow to chlorotic transition at the lesion's edge. Saturation truncation resulted in the complete loss of nearly two-thirds of the edge information of the lesion, forming a flat white pixel block within the saturated region. Standard CReLU segmented thresholding at this point offered neither a valid positive gradient nor a valid negative transition signal for thresholding. Saturation detection generated M_sat, and this saturated region was marked as 1. Guided filtering was applied to the R, G, and B channels using a window with r=5. Within a 5×5 neighborhood window of each saturated pixel, only unsaturated pixels within the window were used in the calculation of the local linear model coefficients. Since the saturated region was adjacent to unsaturated healthy stem tissue, the gradual green gradations of these tissues and the orange-yellow transition texture of the unsaturated portion of the lesion edge could be captured by the window. Using the local linear model obtained through least-squares fitting, the gradient texture of the lesion edge within the saturated region was reconstructed. After filling, the pixel values ​​in this region were restored from a flat 255 to a numerical distribution that transitioned naturally with the surrounding healthy tissue and lesion area. The previously erased lesion edge outline was re-presented after filling. M_sat is downsampled to 112×112 resolution. In the subsequent first channel-wise attention weighting module, the weight coefficients are broadcast and multiplied element-wise with the input feature map to obtain the intermediate feature map. The activation value corresponding to the spatial position of the original saturated region is additionally multiplied by the currently updated λ value. In the early stage of training, λ is 1.5, so that the features of the filled and restored region receive a certain degree of weight enhancement when entering the first feature extraction channel to compensate for the slight deviation between the filled texture and the original real texture. After subsequent dual-channel feature extraction, CReLU segmented thresholding to preserve the negative gradient of the reflective transition zone, group normalization to protect the difference in the distribution of the two types of activation signals, dual-channel spatial attention division enhancement, and classification, the early lesion can be correctly identified as the early stage of ulcer disease under the unfavorable condition of local saturation caused by the specular reflection of the wax layer. Through the above saturation preprocessing and attention compensation design, this embodiment provides the network with a means to restore texture and compensate attention under the extreme condition that the texture signal is physically truncated due to strong light at the image acquisition end, reducing the missed detection of early small lesions and misjudgment of similar diseases caused by the reflective saturation of the wax layer.

[0083] Although embodiments of the present invention have been disclosed above, they are not limited to the applications listed in the specification and embodiments. It can be applied to various fields suitable for the present invention. Further modifications can be readily implemented by those skilled in the art.

Claims

1. A method for image classification and recognition of stem and leaf diseases in dragon fruit based on an improved MSF-Net, characterized in that, Includes the following steps: S1. Obtain images of the dragon fruit stems and leaves to be identified; S2. Input the dragon fruit stem and leaf image into the improved MSF-Net model, which contains a parallel first feature extraction channel and a second feature extraction channel; The first feature extraction channel consists of M cascaded multi-scale convolutional modules, where M ≥ 2. Each multi-scale convolutional module contains a first convolutional kernel branch and a second convolutional kernel branch arranged in parallel. The kernel size of the first convolutional kernel branch is a × a, and the kernel size of the second convolutional kernel branch is b × b, where a ≠ b. The first and second convolutional kernel branches are each connected to a CReLU activation layer and a batch normalization layer in sequence. The outputs of the two branches are concatenated along the channel dimension and then fed into a 1 × 1 convolutional layer for channel compression. The CReLU activation layer performs channel compression on the input features. The feature map performs the following operations: the input feature map is divided into a first part and a second part along the channel dimension; positive values ​​in the first part are retained and negative values ​​are set to zero; the absolute values ​​of negative values ​​in the second part are taken and positive values ​​are set to zero; the two parts are concatenated along the channel dimension and then output; at least one of the M cascaded multi-scale convolutional modules has a convolution stride greater than 1 in its convolutional branch, so that the spatial resolution of the feature map output by the module is halved relative to its input feature map, and the spatial resolution of the output feature map of the first feature extraction channel is smaller than its input feature map; The second feature extraction channel consists of N cascaded dilated multi-scale convolutional modules, where N≥2. Each dilated multi-scale convolutional module contains a first dilated convolutional kernel branch and a second dilated convolutional kernel branch arranged in parallel. The kernel size of the first dilated convolutional kernel branch is c×c and the dilation rate is d1. The kernel size of the second dilated convolutional kernel branch is c×c and the dilation rate is d2, where d1≠d2. The first and second dilated convolutional kernel branches are each connected to a CReLU activation layer and a batch normalization layer in sequence. The outputs of the two branches are concatenated along the channel dimension and then fed into a 1×1 convolutional layer for channel compression. At least one of the N cascaded dilated multi-scale convolutional modules has a convolutional stride greater than 1 in its convolutional branch, so that the spatial resolution of the feature map output by the module is halved relative to its input feature map. Furthermore, the spatial resolution of the output feature map of the second feature extraction channel is smaller than that of its input feature map. S3. The output feature maps of the first feature extraction channel and the second feature extraction channel are concatenated along the channel dimension to obtain a multi-scale fused feature map; S4. Perform global average pooling on the multi-scale fused feature map to obtain feature vectors. Feed the feature vectors into a fully connected classification layer and output the disease category to which the dragon fruit stem and leaf image belongs. The output node of the fully connected classification layer corresponds to at least: dragon fruit canker, dragon fruit anthracnose, and dragon fruit soft rot.

2. The method according to claim 1, characterized in that, In step S2, a first channel-wise attention weighting module is set before the input of the first feature extraction channel. This module assigns a learnable weight coefficient to each channel of the input feature map, broadcasts the weight coefficients to all spatial locations of the input feature map, and then multiplies them element-wise with the activation values ​​of the corresponding channels to obtain the first channel input feature map, which is then output. Before the input of the second feature extraction channel, a second channel-wise attention weighting module and an image pyramid downsampling structure are set. The image pyramid uses the dragon fruit stem and leaf image obtained in step S1 as the 0th level image, and each time it downsamples the previous level image... Downsampling with a stride of 2 generates level 1 and level 2 images sequentially. After feature extraction from each of the level 0, level 1, and level 2 images via convolutional layers, the feature maps corresponding to the level 1 and level 2 images are upsampled to the resolution of the level 0 image. The feature maps of the three levels are concatenated along the channel dimension and then fed into the second channel-wise attention weighting module. The second channel-wise attention weighting module assigns a learnable weight coefficient to each channel of the concatenated feature map. The weight coefficient is broadcast to all spatial locations of the concatenated feature map and then multiplied element-wise with the activation value of the corresponding channel to obtain the second channel input feature map and output it. Each multi-scale convolutional module of the first feature extraction channel receives the first channel input feature map, and each dilated multi-scale convolutional module of the second feature extraction channel receives the second channel input feature map; the parameters of the first channel-wise attention weighting module and the second channel-wise attention weighting module are initialized and trained and updated independently, and are not shared with each other; wherein, the resolution of the first-level image is one-quarter of that of the 0th-level image, and the resolution of the second-level image is one-sixteenth of that of the 0th-level image.

3. The method according to claim 1, characterized in that, In the first feature extraction channel, within each multi-scale convolutional module, the output of the a×a convolutional branch is processed by a CReLU activation layer and a batch normalization layer, and then fed into the depthwise separable convolutional layer corresponding to that branch for channel compression. This depthwise separable convolutional layer is composed of sequentially connected channel-wise convolutional layers and pointwise convolutional layers. The kernel size of the channel-wise convolutional layer is 1×1, and its number of groups is equal to the number of channels in the output feature map of the batch normalization layer of that branch. The pointwise convolutional layer compresses the number of channels to half the number of channels in the output feature map of the batch normalization layer of that branch, thus obtaining a segment. The a-branch compressed feature map is processed in the same way to obtain the b-branch compressed feature map; the a-branch compressed feature map and the b-branch compressed feature map are concatenated along the channel dimension, and the number of channels after concatenation is the same as the number of channels of the input feature map of the multi-scale convolution module. The concatenation result is used as the output of the module; the depthwise separable convolutional layers corresponding to the two convolutional branches do not share parameters with each other, and the depthwise separable convolutional layers of the corresponding convolutional branches in different multi-scale convolutional modules within the same first feature extraction channel are also trained and updated independently and do not share parameters with each other.

4. The method according to claim 1, characterized in that, In the second feature extraction channel, within each dilated multi-scale convolutional module, the kernel weight parameters of the first dilated convolutional kernel branch and the second dilated convolutional kernel branch are initialized, trained, and updated independently, without sharing parameters. Within the same second feature extraction channel, in the i-th cascaded dilated multi-scale convolutional module and the (i+1)-th cascaded dilated multi-scale convolutional module, the kernel weight parameters of the corresponding dilation rate branches are also initialized, trained, and updated independently, without sharing parameters, where i=1, 2,…, N-1.

5. The method according to claim 4, characterized in that, The CReLU activation layer connected after each convolutional kernel branch in the first and second feature extraction channels performs the following operations on the input feature map: The input feature map is divided into a first part and a second part along the channel dimension; all positive values ​​are retained in the first part, and all negative values ​​are set to zero; all positive values ​​in the second part are set to zero, and for negative values, the sum of the absolute values ​​of all negative pixels in the feature map of that channel is divided by the total number of negative pixels and then multiplied by a scaling factor α to obtain the negative value magnitude threshold θ, where α ranges from 0.5 to 2.0; negative pixels with absolute values ​​less than or equal to θ retain their absolute values, and negative pixels with absolute values ​​greater than θ are set to zero; the output of the first part and the output of the second part are concatenated along the channel dimension and then fed into the subsequent normalization layer; wherein, the scaling factor α is set to an initial value before model training and remains unchanged during training.

6. The method according to claim 5, characterized in that, In the first and second feature extraction channels, after each multi-scale convolutional module and each dilated multi-scale convolutional module's internal convolutional kernel branch, the batch normalization layer connected after the CReLU activation layer becomes a group normalization layer. This group normalization layer performs group normalization on the output feature map concatenated by the CReLU activation layer. The number of groups is two, and the group boundaries are aligned with the equal division boundaries when the CReLU activation layer divides the input feature map into two equal parts along the channel dimension. This ensures that the first group contains all channels of the first part of the CReLU activation layer's output, and the second group contains... The second part of the CReLU activation layer outputs all channels; the grouped normalization layer calculates the mean and variance of the channel dimension separately for the first group and normalizes them, then performs an affine transformation using the first group scaling parameter γ1 and offset parameter β1. The second group calculates the mean and variance of the channel dimension separately and normalizes them, then performs an affine transformation using the second group scaling parameter γ2 and offset parameter β2. Finally, the two sets of results are concatenated along the channel dimension and output. Among them, γ1 and γ2 are initialized and trained and updated independently, and β1 and β2 are initialized and trained and updated independently. The two sets of parameters are not shared with each other.

7. The method according to claim 1, characterized in that, Step S3 includes: S31. For the output feature map of the first feature extraction channel, calculate the mean and variance of each channel along the channel dimension, and normalize the channel using its own mean and variance to obtain the first channel normalized feature map; S32. Obtain the second channel normalized feature map by the same method for the output feature map of the second feature extraction channel. The distribution equalization processing of the two channels is performed independently, using only the internal statistics of each channel; S33. Multiply the first channel normalized feature map by a learnable first channel scaling parameter vector γ1 channel by channel, and multiply the second channel normalized feature map by a learnable second channel scaling parameter vector γ2 channel by channel. The dimensions of γ1 and γ2 are each equal to the number of channels of the corresponding channel. They are initialized and trained and updated independently, and do not share parameters; S34. S35. For the scaled feature map of the first channel, average pooling and max pooling are performed along the channel dimension to obtain two spatial descriptors. After concatenation, a 7×7 convolutional layer is passed to generate the spatial attention weight map of the first channel. The weighted feature map of the first channel is obtained by multiplying it spatially with the feature map. S36. The spatial attention weight map of the second channel is generated in the same way to obtain the weighted feature map of the second channel. The 7×7 convolutional kernel parameters of the two spatial attention weight maps are not shared. S37. The weighted feature map of the first channel and the weighted feature map of the second channel are concatenated along the channel dimension to obtain a multi-scale fused feature map.

8. The method according to claim 1, characterized in that, In step S4, the global average pooling of the multi-scale fused feature map is performed as follows: For each channel of the multi-scale fused feature map, the mean value μ_c of the activation values ​​at all spatial locations within that channel is calculated; for each spatial location activation value within that channel, a significance weight is determined based on its deviation from μ_c. Spatial locations with activation values ​​higher than μ_c are assigned an enhancement weight greater than 1, with the weight increasing as the value exceeds the mean. The enhancement weight has an upper limit w_max, which is 2.0; spatial locations with activation values ​​lower than μ_c are assigned a suppression weight less than 1 but always greater than 0, with the weight decreasing as the value decreases as the value falls below the mean. When the activation value equals μ_c, the weight is 1. The activation value of each spatial location in the channel is multiplied by the corresponding significance weight, summed, and then divided by the sum of the significance weights of all spatial locations in the channel to obtain the weighted pooling scalar value of the channel. The weighted pooling scalar values ​​of each channel together constitute the feature vector. When the activation values ​​of all spatial locations in a channel are equal, the significance weight of all spatial locations is 1, and the weighted pooling operation of the channel degenerates into standard global average pooling.

9. The method according to claim 2, characterized in that, The fully connected classification layer outputs seven nodes, corresponding to early-stage dragon fruit canker, late-stage dragon fruit canker, early-stage dragon fruit anthracnose, late-stage dragon fruit anthracnose, early-stage dragon fruit soft rot, late-stage dragon fruit soft rot, and healthy. In step S4, after feeding the feature vectors into the predicted probabilities of each node output by the fully connected classification layer, the node with the highest probability is selected as the preferred category. Each output node has a preset confidence threshold; the confidence threshold for nodes corresponding to early-stage lesions is higher than that for nodes corresponding to late-stage lesions, and the confidence threshold for healthy nodes is lower. The confidence threshold is the same as that for late-stage lesion nodes. If the probability value of the preferred category reaches its preset confidence threshold, the preferred category is used as the final classification result. If it does not reach the threshold, when the preferred category is an early subcategory of a disease, the probability value of the late subcategory of the same disease is summed with it. When the preferred category is a late subcategory of a disease, the probability value of the early subcategory of the same disease is summed with it. If the sum of probabilities reaches the comprehensive confidence threshold, the basic category name of the disease is output along with a disease stage pending confirmation marker. If the sum of probabilities still does not reach the overall confidence threshold, then the preferred category is output as the final classification result.

10. The method according to claim 2, characterized in that, Before inputting the dragon fruit stem and leaf image into the improved MSF-Net model in step S2, the process includes: traversing each pixel of the dragon fruit stem and leaf image, marking pixels with a value equal to 255 in any of the R, G, and B channels as saturated pixels, and obtaining a binary saturation mask M_sat, where saturated pixel positions are set to 1 and unsaturated pixel positions are set to 0; performing a filling operation on the R, G, and B channels of the image respectively, using the original image of that channel as the guide image, and the positions marked as saturated pixels by M_sat as the areas to be filled, taking a local window of size r×r centered on each saturated pixel, where r is an integer greater than or equal to 3 and r≥a, and a is the convolution kernel size of the first convolution kernel branch, calculating the coefficients of the local linear model using only unsaturated pixels within the window, and then reconstructing the saturated pixels at the center of the window using this model to obtain the filling value. After each of the three channels is filled, the filled image is obtained and used as the input image to the improved MSF-Net model. M_sat is downsampled to the same spatial resolution as the input feature map of the first multi-scale convolution module in the first feature extraction channel to obtain the downsampled saturation mask M'_sat. In step S2, after the first channel-wise attention weighting module generates learnable weight coefficients, it first multiplies the weight coefficients with the activation values ​​of the corresponding channels element by element to obtain the intermediate feature map. Then, the activation values ​​of all channels corresponding to the spatial position where M'_sat is 1 in the intermediate feature map are multiplied by a learnable compensation factor λ greater than 1. λ is independently trained and updated during model training. The activation values ​​corresponding to the spatial position where M'_sat is 0 are not changed. The intermediate feature map after spatial position compensation is used as the input feature map of the first channel as the output.