Tobacco disease detection method based on region-morphology perception and bayesian graph inference
Patent Information
- Application Number
- CN202611182440.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-05
- Publication Date
- 2026-10-30
AI Technical Summary
现有技术将叶片视为普通矩形图像进行处理,丢失了这种关键的先验结构信息,导致小目标病害检测精度不足,当病害斑块面积小于图像面积的0.5%时,漏检率超过30%
(1)本发明方法设计了基于植物生理结构的RMP-Net网络,将叶片生理分区与区域化锚框先验深度融合,突破了现有技术将叶片视为普通矩形图像处理的局限,显著提升了小目标病害检测精度;提出了RepLWC结构重参数化模块,通过训练阶段多分支增强与推理阶段单分支融合,从根本上解决了轻量化与高精度的固有矛盾,实现了精度与效率的解耦优化。
Smart Images

Figure CN123015952A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer vision and agricultural inspection technology, and in particular to a method for detecting tobacco diseases based on region-morphology perception and Bayesian graph inference. Background Technology
[0002] Tobacco, an important economic crop in my country, is susceptible to various diseases during its growth, such as red spot, black shank, angular leaf spot, and mosaic virus, leading to decreased quality and yield losses. Traditional manual inspection methods rely on the experience of agricultural experts, resulting in low efficiency, high subjectivity, and difficulty in large-scale screening. With the development of deep learning technology, object detection methods based on convolutional neural networks have shown great potential in the field of agricultural disease identification.
[0003] Currently, target detection technology based on the YOLO (You Only Look Once) algorithm series has been widely used in agricultural disease identification. However, existing technical solutions still have the following fundamental technical shortcomings in tobacco disease detection scenarios: (1) The model architecture lacks awareness of plant physiological structure. Existing YOLO models are mainly designed for general target detection datasets such as COCO, and adopt a globally unified anchor box strategy and feature extraction method, without considering the physiological structural characteristics of tobacco leaves. In fact, the distribution of different diseases on leaves has significant locational patterns: red spot disease occurs mostly in the leaf tip area, black shank disease is concentrated in the leaf base, angular leaf spot is distributed along the leaf margin, and mosaic disease is scattered throughout the leaf. Existing technology treats leaves as ordinary rectangular images and loses this key prior structural information, resulting in insufficient detection accuracy for small target diseases. When the area of disease patches is less than 0.5% of the image area, the false negative rate exceeds 30%.
[0004] (2) Disease area extraction strategies lack morphological constraints. Existing technologies mostly use fixed-parameter boundary expansion or simple cropping methods, which do not fully consider the morphological characteristics of tobacco diseases. Lesions present complex and irregular shapes in image space, and their spatial distribution, aspect ratio, edge gradient, and other morphological features contain rich pathological information. Fixed-parameter cropping cannot adapt to the diversity of lesion morphology, while simple feature weighting strategies lack strict mathematical optimization guarantees, resulting in cropped areas either containing too much background noise or missing key information about lesion edges.
[0005] (3) The confidence level calculation lacks spatial causal reasoning ability. The confidence level of existing detection schemes only depends on the classification probability and target existence probability output by the model, which is a local perception and does not consider the spatial relationship and causal dependence between diseases. In fact, some diseases have significant symbiotic or causal patterns on leaves: mosaic virus infection may damage the leaf epidermal barrier and increase the infection probability of red spot fungus; black shank and root rot have a common soil transmission route. Existing simple co-occurrence statistics or IoU threshold judgment cannot capture this complex causal structure, resulting in a high false detection rate in multi-disease co-occurrence scenarios.
[0006] (4) There is a fundamental contradiction between lightweight design and detection accuracy. Existing models have a large number of parameters and high computational complexity, making them difficult to deploy on edge devices. Although common optimization techniques such as Conv-BN layer fusion and FP16 half-precision inference have been adopted, these optimizations are of a 'post-processing' nature and are not deeply integrated with the model architecture design. While reducing the number of parameters, the ability to represent small target features is simultaneously reduced, forming an inherent contradiction of 'lightweighting means reduced accuracy', and lacking a synergistic mechanism for maintaining accuracy during the training phase and improving efficiency during the inference phase. Summary of the Invention
[0007] The purpose of this invention is to provide a method for detecting tobacco diseases based on region-morphology perception and Bayesian graph inference, which breaks through the limitations of existing technologies that treat leaves as ordinary rectangular images and significantly improves the detection accuracy of small target diseases.
[0008] To achieve the above objectives, the present invention provides the following solution: A method for detecting tobacco diseases based on region-morphology perception and Bayesian graph inference includes the following steps: S1. Acquire tobacco leaf images and perform preprocessing on the tobacco leaf images, including format conversion, size adjustment and normalization. S2. Based on the morphological features of the leaves, the preprocessed tobacco leaf images are divided into leaf tip area, leaf middle area, leaf base area and leaf edge area, and regional anchor frame priors are designed for different areas. S3. An RMP-Net detection model is constructed based on the BiFPN structure and Bayesian graph neural network. The RMP-Net detection model includes a RepLWC module. Preprocessed and physiologically partitioned tobacco leaf images are input into the RMP-Net detection model for forward propagation. Region-aware aspect ratio correction is introduced in bounding box regression to obtain the corrected detection boxes, specifically including: Multi-scale features are fused based on the BiFPN structure, and long-distance dependencies between different physiological regions are established through cross-regional attention functions. Spatial confidence inference is based on Bayesian graph neural network. The detection box is constructed as a graph structure node. Spatial context information is propagated by graph attention network. Spurious correlations are eliminated by Bayesian confidence update and causal intervention. S4. Based on the manifold space dynamic clipping algorithm, the boundary of the corrected detection box is geometrically optimized, the morphological features of the lesion are mapped to the low-dimensional manifold space, and the optimal clipping boundary is found by geodesic distance optimization to obtain the detection result; S5. Perform category-aware nonmaximum suppression and coordinate mapping on the detection results, and output the final result.
[0009] Preferably, in S1, the preprocessing of the tobacco leaf image further includes: Retinex model-based adaptive illumination enhancement:
[0010] in, For the original image, For the enhanced image, L is the estimated illumination component, s is the reflection component, and γ is the enhancement exponent; Texture feature extraction based on Gabor filters:
[0011] Where x' and y' are the rotated coordinates, The main direction of the leaf texture. and denoted as the standard deviation of the Gaussian envelope, and f is the center frequency of the filter.
[0012] Preferably, in S2, the preprocessed tobacco leaf image is divided into the leaf tip region, leaf middle region, leaf base region, and leaf margin region, specifically including: Define a partitioning function based on leaf morphological characteristics:
[0013] Where (x,y) are the image pixel coordinates. and These are the longitudinal coordinates of the leaf base and leaf tip, respectively. The x-coordinate of the blade centerline is... λ is the blade width, and λ is the blade edge curvature compensation coefficient. Based on the partitioning function, the leaf is divided into four physiological zones: leaf tip zone. Yezhong District Leaf base region Leaf edge area ; Design regionalized anchor frame priors for different physiological regions:
[0014]
[0015] in, For the region The anchor frame prior set, and The baseline width and baseline height of region k are obtained by K-means clustering of the disease annotation boxes in that region. Let k be the scale standard deviation of region k. These are sampled values from a standard normal distribution. Let be the height of the i-th anchor frame in the k-th physiological region. Let be the width of the i-th anchor frame in the k-th physiological region.
[0016] Preferably, S3 also includes: the structure reparameterization process of the RepLWC module: The multi-branch output during the training phase is: ; in, This involves a 3×3 convolution operation, used to extract spatial features with a large receptive field. This is a 1×1 convolution operation, used for dimensionality reduction / increment in the channel dimension. For the input feature map, For batch normalization operations; During the inference phase, structural reparameterization is used to merge multiple branches into an equivalent single branch:
[0017] in, For equivalent 3×3 convolution kernel weights, The branch weights are 3×3. The 1×1 branch is expanded to a 3×3 equivalent weight through zero padding. The identity mapping is used as a 3×3 kernel, γ, μ, and σ² are the scaling parameters, running mean, and running variance of the BatchNorm layer, respectively, and ε is a small constant to prevent division by zero. The equivalent bias is:
[0018] in, and These are the biases for the 3×3 and 1×1 branches, respectively, where β is the BatchNorm offset parameter. This is the offset mean, used to compensate for the mean offset introduced by the identity mapping branch during BatchNorm layer fusion.
[0019] Preferably, in S3, multi-scale features are fused based on the BiFPN structure, and long-distance dependencies between different physiological regions are established through a cross-regional attention function, as shown in the following formula:
[0020] in, The characteristics after fusion The feature map of region k, For regional attention weights, β is the cross-regional attention function, and β is the global attention bias.
[0021] Preferably, in S3, spatial confidence inference based on a Bayesian graph neural network specifically includes: Graph structure construction: Each bounding box is treated as a graph node, with node features including the bounding box's position, scale, class confidence, and region attributes; edge weights between nodes are also considered. Determined by both spatial distance and class co-occurrence probability:
[0022] in, The Euclidean distance between the center points of detection boxes i and j is given. For distance attenuation parameters, These are elements of the category co-occurrence probability matrix; Message passing in graph attention networks:
[0023] in, For the features of node i in the l-th layer, and For learnable weight matrix, Attention coefficient This is a nonlinear activation function used to introduce a nonlinear transformation:
[0024] Bayesian confidence update:
[0025] in, Let be the potential function of nodes i and j. Let Z be the observation potential function at node i, and Z be the partition function. Let W be the feature vector of node i after linear transformation by the learnable weight matrix W. Let W be the eigenvector of node j after linear transformation by the learnable weight matrix W. Let W be the eigenvector of node k after linear transformation by the learnable weight matrix W. Let be the attention coefficient of node i to node j; Causal intervention to eliminate spurious correlations:
[0026] Where do(G) represents the intervention of the graph structure to remove spurious related edges; For the detection box j, the disease category is... The marginal probability, In a graph structure G and given that node j has a category of Under the condition that node i is the disease category The conditional probability, After Bayesian graph neural network inference and causal intervention, the detection box i represents the disease category. The post-calibration confidence level.
[0027] Preferably, in S4, the geometric optimization of the corrected detection box boundary is performed based on the manifold space dynamic clipping algorithm, specifically including: Map the morphological feature vectors of the lesion region to a low-dimensional manifold space:
[0028] Where φ(·) is the manifold embedding function, and B is the initial detection box. Spatial distribution characteristics, It is characterized by its aspect ratio. For edge gradient features, For texture features, It is a low-dimensional manifold space, an embedding space composed of lesion morphological feature mappings; Finding the optimal clipping boundary in the manifold space:
[0029] in, This is the optimal clipping frame. This is the geodesic loss function; The geodesic distance is defined as:
[0030] Where γ(t) is the connection between φ(B) and φ(t) on manifold M. The curve, For manifold metric tensors; Marginal gradient regularization:
[0031] in, Here, G(e) is the edge regularization term, G(e) is the magnitude of the edge gradient at boundary e, and φ(e) is the gradient direction. The direction of the boundary normal.
[0032] Preferably, in S5, the detection results are subjected to category-aware nonmaximum suppression and coordinate mapping, specifically including: Category-aware nonmaximum suppression: NMS is performed only on bounding boxes of the same class, sorted by calibrated confidence level. ; Coordinate mapping: Mapping the detection box from the model input size back to the original image size: ,in, Normalized x-coordinates of the model output (0,1), This is the horizontal fill offset during Letterbox preprocessing. The width of the original image. The width of the input image for the model.
[0033] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements a method for detecting tobacco diseases based on region-morphological perception and Bayesian graph inference as described above.
[0034] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects: (1) The method of this invention designs an RMP-Net network based on plant physiological structure, which integrates leaf physiological partitioning with regional anchor box prior depth, breaks through the limitation of the existing technology that treats leaves as ordinary rectangular images, and significantly improves the detection accuracy of small target diseases; it proposes a RepLWC structure reparameterization module, which fundamentally solves the inherent contradiction between lightweight and high precision by integrating multi-branch enhancement in the training stage and single-branch fusion in the inference stage, and achieves decoupling optimization of accuracy and efficiency.
[0035] (2) The method of the present invention constructs a dynamic pruning algorithm based on manifold space, maps the morphological features of lesions to a low-dimensional manifold and optimizes them through geodesic distance, so that the pruning strategy has strict mathematical guarantees, which is different from the empirical fixed parameter pruning of the prior art; constructs a Bayesian graph neural network inference mechanism, propagates spatial context information through graph attention network, and uses causal intervention to eliminate spurious correlations, so that confidence calibration has causal inference ability, which surpasses the simple co-occurrence statistics of the prior art; the method of the present invention integrates a hardware adaptive inference engine and a cross-platform compatibility mechanism, supporting flexible deployment from edge devices to cloud servers. Attached Figure Description
[0036] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0037] Figure 1 A flowchart illustrating the tobacco disease detection method based on region-morphology perception and Bayesian graph inference provided by this invention. Figure 2 This is a schematic diagram of the generation of physiological zones and regional anchor frames for tobacco leaves according to the present invention; Figure 3 This is a schematic diagram of the RepLWC (Restructuring and Lightweighting Module) structure used in this invention; Figure 4 This is a schematic diagram of the dynamic pruning algorithm based on manifold space of the present invention. Figure 5 This is a schematic diagram of the Bayesian graph neural network spatial reasoning mechanism of this invention. Detailed Implementation
[0038] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0039] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0040] like Figure 1 As shown, the present invention provides a method for detecting tobacco diseases based on region-morphology perception and Bayesian graph inference, comprising the following steps: Step 1: System Initialization and Adaptive Hardware Configuration. Load the weight file of the RMP-Net detection model, which is built based on the RepLWC lightweight convolutional module with structure reparameterization. The RepLWC module employs a multi-branch structure (3×3 convolution, 1×1 convolution, identity mapping) to enhance feature representation during training, and merges multiple branches into a single branch during inference through structure reparameterization, achieving decoupling optimization between training accuracy and inference speed. Configure core parameters such as detection confidence threshold, NMS IoU threshold, and maximum number of detections.
[0041] Automatic detection of available computing devices: Prioritizes GPU (CUDA) and enables FP16 / INT8 quantization inference to improve speed; if GPU is unavailable, it intelligently falls back to CPU mode using FP32 full precision. Employs a multi-format model loading strategy, supporting various model formats such as PyTorch, ONNX, and TensorFlow. Creates a results storage directory structure, handling path differences between Windows and Linux systems to ensure cross-platform compatibility.
[0042] Step 2: Input Data Reading and Adaptive Preprocessing. Supports multiple input types, including single image files, image directories, video files, and real-time video streams. Preprocessing is performed on the input data, including format conversion (BGR to RGB), resizing (letterbox method to maintain aspect ratio), normalization, and tensor transformation. For image directory inputs, a batch loading strategy is used, automatically determining the batch size based on GPU memory, combining multiple images into a batch for parallel inference.
[0043] The normalization formula is:
[0044] in, This represents the pixel value of channel c at coordinates (x, y) in the original image. Let σ_c be the pixel mean of image channel c in the training set, and σ_c be the pixel standard deviation of image channel c in the training set. These are the normalized pixel values.
[0045] In addition, adaptive preprocessing also includes adaptive illumination enhancement based on the Retinex model:
[0046] in, For the enhanced image, L is the estimated illumination component, obtained through Gaussian filtering, s is the reflection component, and γ is the enhancement exponent. Texture feature extraction based on Gabor filters is also included.
[0047] Where x' and y' are the rotated coordinates, The main direction of the leaf texture. and denoted as the standard deviation of the Gaussian envelope, and f is the center frequency of the filter.
[0048] Step 3: Physiological Zoning of Tobacco Leaves. Based on leaf morphological characteristics, the input image is divided into the leaf tip region, leaf middle region, leaf base region, and leaf margin region, such as... Figure 2 As shown. Define the partitioning function:
[0049] Where (x,y) are the image pixel coordinates. and x_c represents the longitudinal coordinates of the leaf base and leaf tip, respectively, and x_c represents the abscissa of the leaf centerline. Let λ be the leaf width, and λ be the leaf margin curvature compensation coefficient. The leaf is divided into four physiological zones according to the zoning function: (Leaf apex region, φ∈[0.67,1]) (Leaf mid-region, φ∈[0.33,0.67]) (Leaf base region, φ∈[0,0.33]) and (Leaf margin area, satisfying) ).
[0050] Design regionalized anchor frame priors for different physiological regions:
[0051]
[0052] in, For the region The anchor frame prior set, and The baseline width and height of region k are obtained by K-means clustering of the disease label boxes in that region. Let k be the scale standard deviation of region k. These are sampled values from a standard normal distribution.
[0053] Step 4: Feature Extraction Based on RMP-Net. The preprocessed image tensor is input into the RMP-Net model constructed by RepLWC for forward propagation. The structural reparameterization process of the RepLWC module is as follows: Figure 3 As shown: The multi-branch output during the training phase is: F' = BN(Conv_{3×3}(F) + Conv_{1×1}(F) + F) During the inference phase, structural reparameterization is used to merge multiple branches into an equivalent single branch:
[0054]
[0055] in, For equivalent 3×3 convolution kernel weights, The branch weights are 3×3. The 1×1 branch is expanded to a 3×3 equivalent weight through zero padding. The identity mapping is represented by a 3×3 kernel (1 in the center and 0 in the rest). This is an equivalent bias. The calculation process after fusion is as follows: ,in This represents the convolution operation.
[0056] The detection head outputs the bounding box coordinates of the lesion, the target confidence score, and the class probability. Bounding box regression incorporates region-aware aspect ratio correction.
[0057] in, This is the aspect ratio correction factor for region k. The aspect ratio difference between the prediction frame and the anchor frame.
[0058] The loss function consists of three parts: bounding box regression loss, target existence loss, and class loss. The bounding box regression loss uses CIoU Loss: ,in .
[0059] Step 5: Multi-scale Feature Fusion and Cross-Regional Attention Enhancement. A BiFPN structure is used to fuse multi-scale features, and a cross-regional attention mechanism is introduced:
[0060] in, The characteristics after fusion The feature map of region k, For regional attention weights, β is the cross-regional attention function, and β is the global attention bias. The cross-regional attention mechanism enables the model to establish long-distance dependencies between the leaf tip and leaf base, capturing disease transmission patterns at the whole-leaf scale.
[0061] Step Six: Spatial confidence inference based on Bayesian graphical neural networks, such as... Figure 5 As shown, the detection boxes are constructed as graph nodes, with node features including the detection box's location, scale, class confidence, and region attributes. The edge weights between nodes are determined by both spatial distance and class co-occurrence probability.
[0062] in, The Euclidean distance between the center points of detection boxes i and j is given. For distance attenuation parameters, These are elements of the category co-occurrence probability matrix.
[0063] Message passing in graph attention networks:
[0064] in, For the features of node i in the l-th layer, and For learnable weight matrix, Attention coefficient:
[0065] Where a is the attention vector, and || represents feature concatenation.
[0066] Bayesian confidence update:
[0067] in, Let be the potential function of nodes i and j. Let Z be the observation potential function at node i, and Z be the partition function. The potential function is defined as: The observation potential function is: ,in This is a blade region indicator function.
[0068] Causal intervention to eliminate spurious correlations:
[0069] Here, do(G) represents the intervention on the graph structure to remove spurious correlation edges. Through causal intervention, spurious correlations caused by confounding factors such as changes in lighting and shooting angle are eliminated, ensuring that the confidence calibration only reflects the true spatial relationships of the disease.
[0070] Step 7: Dynamic clipping based on manifold space, such as... Figure 4 As shown, the morphological features of the lesion region are mapped to a low-dimensional manifold space:
[0071] Where φ(·) is the manifold embedding function, and B is the initial detection box. Spatial distribution characteristics, It is characterized by its aspect ratio. For edge gradient features, For texture features, It is a low-dimensional manifold space, an embedding space constructed by mapping the morphological features of lesions (spatial distribution, aspect ratio, edge gradient, texture).
[0072] Finding the optimal clipping boundary in the manifold space:
[0073] in, This is the optimal clipping frame. This is the geodesic loss function. The geodesic distance is defined as:
[0074] Where γ(t) is the connection between φ(B) and φ(t) on manifold M. The curve, The manifold metric tensor is obtained by estimating the covariance matrix of the local neighborhood.
[0075] Marginal gradient regularization:
[0076] in, Here, G(e) is the edge regularization term, G(e) is the magnitude of the edge gradient at boundary e, and φ(e) is the gradient direction. The normal direction is the boundary. This regularization term makes the clipping boundary tend to extend along the normal direction of the lesion edge, avoiding excessive intrusion into the background region.
[0077] Closed-loop feedback optimization: The clipped diseased areas are fed back to the Bayesian graph inference module to iteratively optimize the detection box position and confidence, forming a closed-loop feedback between manifold clipping and graph inference.
[0078] Step 8: Post-processing, visualization, and data export of detection results. A category-aware non-maximum suppression (NMS) algorithm is used to remove duplicate detection boxes. NMS is performed only on detection boxes of the same category to avoid false suppression between different disease types. The NMS ranking is based on the calibrated confidence level. The IoU threshold is set to 0.45~0.65. The detection box coordinates are mapped from the model input size back to the original image size, taking into account the effect of letterbox padding. The detection results are plotted on the original image, and the detection statistics are output in real time. The annotated image and YOLO format label file are saved.
[0079] Example 1: System Initialization and RMP-Net Model Construction This embodiment provides a lightweight detection system for tobacco diseases based on region-morphology joint sensing and Bayesian graph inference, including the following functional modules: (1) Adaptive Hardware Configuration Module: Automatically detects available computing devices and dynamically switches inference precision. Let the device set be D = {GPU, CPU}, and the device selection strategy be: When an NVIDIA GPU is detected, CUDA acceleration is enabled and the system automatically switches to FP16 half-precision mode, resulting in inference speeds that are 5 to 10 times faster than the CPU FP32 mode.
[0080] (2) Physiological partitioning module: Based on leaf morphological features, the input image is divided into leaf tip region ( ), Leafy area ( ), leaf base region ( ) and leaf margin area ( In a dataset containing 5,000 labeled tobacco leaf images, the probability of red spot disease being distributed in the leaf tip area was 78.3%, black shank disease in the leaf base area was 65.7%, and angular leaf spot disease along the leaf margin was 82.1%.
[0081] (3) RepLWC Feature Extraction Module: The RepLWC module is introduced into each stage of the standard RMP-Net backbone network. The training stage adopts a three-branch structure of 3×3 convolution, 1×1 convolution and identity mapping, and the inference stage is fused into a single branch through structural reparameterization. Experiments show that when the number of parameters is reduced from 6.8M to 5.8M (a reduction of 14.7%), the detection accuracy mAP@0.5 of small target diseases in tobacco leaves is improved from 84.1% to 88.5%.
[0082] (4) Multi-scale feature fusion module: The BiFPN structure is used to fuse multi-scale features and a cross-regional attention mechanism is introduced. Cross-regional attention enables long-distance dependence between leaf tip and leaf base features, capturing the disease transmission pattern at the whole leaf scale.
[0083] (5) Bayesian Graph Inference Module: A graph neural network was constructed for four types of diseases (Red Spot Disease (BS), Black Shank Disease (BSR), Angular Leaf Spot Disease (AB), and Mosaic Disease (TMV)). Statistical analysis showed that the co-occurrence probability of BS and TMV in the leaf tip region was 0.35, the co-occurrence probability of BSR and TMV in the leaf base region was 0.45, and AB tended to be independently distributed. By intervening in the causal relationship do(G), spurious correlations caused by changes in light intensity were removed, reducing the false detection rate by 3.8%.
[0084] (6) Manifold Space Clipping Module: The morphological features of lesions are mapped to a 4D manifold space (spatial distribution, aspect ratio, edge gradient, texture), and the optimal clipping boundary is found through geodesic distance optimization. The completeness of disease area extraction by adaptive clipping reaches 96.1%, which is 14.2% higher than that of fixed parameter clipping.
[0085] (7) Post-processing and visualization module: Performs category-aware NMS, result mapping, visualization and data export.
[0086] (8) Exception handling and model rollback module: Automatic rollback when model loading fails to ensure system robustness.
[0087] Example 2: Physiological zoning and regionalized anchor frame verification To verify the effectiveness of physiological zoning and regional anchor frames, a comparative experiment was conducted on a tobacco disease test set (1000 images).
[0088] Experimental setup: The comparison methods included: (a) globally unified anchor frame (YOLOv11 standard); (b) simple longitudinal partitioning (only upper, middle and lower); (c) physiological partitioning of this invention (leaf tip / leaf middle / leaf base / leaf margin + curvature compensation).
[0089] The experimental results are shown in Table 1: Table 1
[0090] The results show that the physiological zoning and regionalized anchor frame design of the present invention significantly improves the detection accuracy of small target diseases.
[0091] Example 3: Verification of RepLWC Structure Reparameterization To verify the effectiveness of the RepLWC module, an ablation experiment was conducted.
[0092] Experimental setup: Comparison with (a) standard YOLOv11; (b) YOLOv11 + depthwise separable convolution; (c) YOLOv11 + RepLWC (this invention).
[0093] The experimental results are shown in Table 2: Table 2
[0094] The results show that RepLWC reduces the number of parameters by 14.7% while improving accuracy by 4.4% and speed by 69%, achieving a synergistic optimization of accuracy and efficiency.
[0095] Example 4: Bayesian Graph Inference and Manifold Clipping Verification Experimental setup: The base model is RMP-Net, and the performance before and after adding Bayesian graph inference and manifold pruning is compared.
[0096] The experimental results are shown in Table 3: Table 3
[0097] The results show that adding Bayesian graph inference improved mAP@0.5 by 2.7 percentage points and reduced the false positive rate by 2.1%; further adding manifold pruning improved mAP@0.5 by 1.8% and pruning integrity by 13.8%.
[0098] Example 5: Overall System Performance Evaluation Deploy the system of this invention on an NVIDIA Jetson Nano edge device.
[0099] Experimental conditions: Input image resolution 1920×1080, model input size 640×640, batch size B_size=4.
[0100] The performance indicators are shown in Table 4: Table 4
[0101] Compared with existing technologies (Gao Rui et al., YOLOv8s tobacco disease detection, mAP@0.5=82.3%, number of parameters 11.2M), the present invention improves the detection accuracy by 10.9%, reduces the number of parameters by 48.2%, and increases the inference speed to 105FPS.
[0102] Example 6: Cross-platform deployment verification The deployment was successfully completed on both Windows 10 and Ubuntu 20.04 systems with a 100% success rate.
[0103] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements a method for detecting tobacco diseases based on region-morphological perception and Bayesian graph inference as described above.
[0104] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0105] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for detecting tobacco diseases based on region-morphology perception and Bayesian graph inference, characterized in that, Includes the following steps: S1. Acquire tobacco leaf images and preprocess the tobacco leaf images, including format conversion, size adjustment and normalization. S2. Based on the morphological features of the leaves, the preprocessed tobacco leaf images are divided into leaf tip area, leaf middle area, leaf base area and leaf edge area, and regional anchor frame priors are designed for different areas. S3. Construct an RMP-Net detection model based on BiFPN structure and Bayesian graph neural network. The RMP-Net detection model includes the RepLWC module. The preprocessed and physiologically partitioned tobacco leaf images are input into the RMP-Net detection model for forward propagation. Region-aware aspect ratio correction is introduced into the bounding box regression to obtain the corrected detection boxes, specifically including: Multi-scale features are fused based on the BiFPN structure, and long-distance dependencies between different physiological regions are established through cross-regional attention functions. Spatial confidence inference is based on Bayesian graph neural network. The detection box is constructed as a graph structure node. Spatial context information is propagated by graph attention network. Spurious correlations are eliminated by Bayesian confidence update and causal intervention. S4. Based on the manifold space dynamic clipping algorithm, the boundary of the corrected detection box is geometrically optimized, the morphological features of the lesion are mapped to the low-dimensional manifold space, and the optimal clipping boundary is found by geodesic distance optimization to obtain the detection result; S5. Perform category-aware nonmaximum suppression and coordinate mapping on the detection results, and output the final result.
2. The method for detecting tobacco diseases based on region-morphological perception and Bayesian graph inference according to claim 1, characterized in that, In step S1, the preprocessing of the tobacco leaf image further includes: Retinex model-based adaptive illumination enhancement: in, For the original image, For the enhanced image, L is the estimated illumination component, s is the reflection component, and γ is the enhancement exponent; Texture feature extraction based on Gabor filters: Where x' and y' are the rotated coordinates, The main direction of the leaf texture. and denoted as the standard deviation of the Gaussian envelope, and f is the center frequency of the filter.
3. The method for detecting tobacco diseases based on region-morphology perception and Bayesian graph inference according to claim 1, characterized in that, In step S2, the preprocessed tobacco leaf image is divided into the leaf tip region, leaf middle region, leaf base region, and leaf edge region, specifically including: Define a partitioning function based on leaf morphological characteristics: Where (x,y) are the image pixel coordinates. and These are the longitudinal coordinates of the leaf base and leaf tip, respectively. The x-coordinate of the blade centerline is... λ is the blade width, and λ is the blade edge curvature compensation coefficient. Based on the partitioning function, the leaf is divided into four physiological regions: leaf tip region. Yezhong District Leaf base region Leaf edge area ; Design regionalized anchor frame priors for different physiological regions: in, For the region The anchor frame prior set, and The baseline width and baseline height of region k are obtained by K-means clustering of the disease annotation boxes in that region. Let k be the scale standard deviation of region k. These are sampled values from a standard normal distribution. Let be the width of the i-th anchor frame in the k-th physiological region. Let be the height of the i-th anchor frame in the k-th physiological region.
4. The method for detecting tobacco diseases based on region-morphological perception and Bayesian graph inference according to claim 1, characterized in that, S3 also includes: the structure reparameterization process of the RepLWC module: The multi-branch output during the training phase is: ; in, This involves a 3×3 convolution operation, used to extract spatial features with a large receptive field. This is a 1×1 convolution operation, used for dimensionality reduction / increment in the channel dimension. For the input feature map, For batch normalization operations; During the inference phase, multiple branches are merged into an equivalent single branch through structural reparameterization: in, For equivalent 3×3 convolution kernel weights, The branch weights are 3×3. The 1×1 branch is expanded to a 3×3 equivalent weight through zero padding. The identity mapping is used as a 3×3 kernel, γ, μ, and σ² are the scaling parameters, running mean, and running variance of the BatchNorm layer, respectively, and ε is a small constant to prevent division by zero. The equivalent bias is: in, and These are the biases for the 3×3 and 1×1 branches, respectively, where β is the BatchNorm offset parameter. This is the offset mean, used to compensate for the mean offset introduced by the identity mapping branch during BatchNorm layer fusion.
5. The method for detecting tobacco diseases based on region-morphology perception and Bayesian graph inference according to claim 1, characterized in that, In S3, multi-scale features are fused based on the BiFPN structure, and long-distance dependencies between different physiological regions are established through a cross-regional attention function, as shown in the following formula: in, The characteristics after fusion The feature map of region k, For regional attention weights, β is the cross-regional attention function, and β is the global attention bias.
6. The method for detecting tobacco diseases based on region-morphological perception and Bayesian graph inference according to claim 1, characterized in that, In S3, spatial confidence inference based on a Bayesian graph neural network specifically includes: Graph structure construction: Each bounding box is treated as a graph node, with node features including the bounding box's position, scale, class confidence, and region attributes; edge weights between nodes are also considered. Determined by both spatial distance and class co-occurrence probability: in, The Euclidean distance between the center points of detection boxes i and j is given. For distance attenuation parameters, These are elements of the category co-occurrence probability matrix; Message passing in graph attention networks: in, For the features of node i in the l-th layer, and For learnable weight matrix, Attention coefficient This is a nonlinear activation function used to introduce a nonlinear transformation: Bayesian confidence update: in, Let be the potential function of nodes i and j. Let Z be the observation potential function at node i, and Z be the partition function. Let W be the feature vector of node i after linear transformation by the learnable weight matrix W. Let W be the eigenvector of node j after linear transformation by the learnable weight matrix W. Let W be the eigenvector of node k after linear transformation by the learnable weight matrix W. Let be the attention coefficient of node i to node j; Causal intervention to eliminate spurious correlations: Where do(G) represents the intervention of the graph structure to remove spurious related edges; For the detection box j, the disease category is... The marginal probability, In a graph structure G and given that node j has a category of Under the condition that node i is the disease category The conditional probability, After Bayesian graph neural network inference and causal intervention, the detection box i represents the disease category. The post-calibration confidence level.
7. The method for detecting tobacco diseases based on region-morphological perception and Bayesian graph inference according to claim 1, characterized in that, In step S4, the geometric optimization of the corrected detection box boundary is performed based on the manifold space dynamic clipping algorithm, specifically including: Map the morphological feature vectors of the lesion region to a low-dimensional manifold space: Where φ(·) is the manifold embedding function, and B is the initial detection box. Spatial distribution characteristics, It is characterized by its aspect ratio. For edge gradient features, For texture features, It is a low-dimensional manifold space, an embedding space composed of lesion morphological feature mappings; Finding the optimal clipping boundary in the manifold space: in, This is the optimal clipping frame. This is the geodesic loss function; The geodesic distance is defined as: Where γ(t) is the connection between φ(B) and φ(t) on manifold M. The curve, For manifold metric tensors; Marginal gradient regularization: in, Here, G(e) is the edge regularization term, G(e) is the magnitude of the edge gradient at boundary e, and φ(e) is the gradient direction. The direction of the boundary normal.
8. The method for detecting tobacco diseases based on region-morphological perception and Bayesian graph inference according to claim 1, characterized in that, In step S5, the detection results are subjected to category-aware nonmaximum suppression and coordinate mapping, specifically including: Category-aware nonmaximum suppression: NMS is performed only on bounding boxes of the same class, sorted by calibrated confidence level. ; Coordinate mapping: Mapping the detection box from the model input size back to the original image size: ,in, The normalized x-coordinate of the model output. This is the horizontal fill offset during Letterbox preprocessing. The width of the original image. The width of the input image for the model.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements a method for detecting tobacco diseases based on region-morphological perception and Bayesian graph inference as described in any one of claims 1-8.
