# Research on Plant Disease and Pest Diagnosis Model Based on Generalized Stochastic Petri Net
## 5 Case Study
### Verification of the Grape Downy Mildew Pest and Disease Early Warning System  
Based on the GSPN model for the spread and evolution of grape downy mildew, this study evaluated the severity of the disease and implemented corresponding control strategies through simulation analysis of different disease occurrence probability combinations. To validate the effectiveness of this model, data collection was conducted from April to May 2025 at a grape planting base in Kunming, Yunnan Province, with the experimental period lasting two months. During the experiment, the health status of grape leaves was closely monitored, and high-resolution imaging equipment was used for periodic image data collection of these areas. Researchers collected images of selected grape plants at a fixed time each day (from 9:00 am to 10:00 am) to ensure stable environmental lighting and avoid interference with image quality. At least three images were taken of each grape plant to comprehensively document growth changes and disease development. The captured images were annotated by professionals, particularly marking the infected areas for downy mildew lesions. The annotation and segmentation of the leaves and lesions were performed using Labelme, which allows for precise labeling of the leaf and lesion areas and generates corresponding JSON format files. These files were ultimately used to train and validate the segmentation model's performance. The indicators for classifying disease severity are typically set based on the extent of the disease's impact on crops. These indicators help farmers, horticulturists, and plant protection experts assess the severity of the disease and take appropriate control measures accordingly. For downy mildew, the area of the lesions is an intuitive indicator for evaluating disease severity. By measuring the proportion of the lesion area relative to the leaf area, one can roughly determine the stage of development and severity of the disease. The calculation involves determining the ratio of the number of pixels in the lesion area to the number of pixels in the leaf area, which gives the percentage of the leaf area affected by the lesions. The formula for this calculation is shown in Formula (24):  
\[\mathrm{P}=\frac{\mathrm{A_{d}}}{\mathrm{A_{1}}}\times 100\% \tag{24}\]  
In Formula (24), P represents the percentage of the downy mildew lesion area relative to the entire leaf area; \(\mathrm{A_{d}}\) is the area of the lesion region; and \(\mathrm{A_{1}}\) is the area of the leaf region. Since the dataset used in this study consists of single-leaf images, to better assess the severity of the disease, the severity of grape downy mildew was classified by calculating the ratio of the pixel area of the downy mildew lesions on a single leaf to the pixel area of the entire grape leaf. In the disease identification process, a two-step segmentation method is used to process grape leaf images. The first step involves using a leaf segmentation model to extract the grape leaf, separating it from the complex background and obtaining an image of the leaf with a simple background. In the second step, based on the leaf image with a simple background, a lesion segmentation model is used to extract the lesion area of downy mildew. After obtaining the lesion area, the pixel area of the lesion is calculated and compared with the pixel area of the leaf. This ratio is used to calculate the proportion of the lesion area relative to the total leaf area, and the severity of the disease is then determined. According to the Chinese national standard GB/T17980.122-2004 [34], the classification of grape downy mildew is based on the proportion of the lesion area relative to the leaf area. In this study, the classification is specifically divided into mild, moderate, and severe infections.