Tomato disease diagnosis method based on naive Bayes classifier and sensor data

By using naive Bayes classifier and sensor data in tomato disease diagnosis, the subjectivity and inefficiency of traditional diagnostic methods are solved, and the automation and efficient diagnosis of tomato disease are achieved, and crop yields are improved.

CN119089898APending Publication Date: 2024-12-06NANJING UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411185638.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-27
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

Traditional tomato disease diagnosis methods have strong subjectivity, slow diagnosis speed and low accuracy. Image processing technology is highly dependent in practical applications and consumes high computing resources, making it difficult to achieve automated and efficient diagnosis.

Method used

Using a method based on naive Bayes classifier and sensor data, the disease characteristics are obtained from planted books, word segmentation preprocessing and TF-IDF vectorization processing are performed, and the naive Bayes classifier training model is combined to treat disease characteristics. Make predictions and optimize diagnostic results with sensor data.

Benefits of technology

It realizes automation and efficient accuracy of tomato disease diagnosis, significantly improves diagnosis speed and accuracy, and ensures the comprehensiveness and reliability of the diagnosis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119089898A_ABST
    Figure CN119089898A_ABST
Patent Text Reader

Abstract

The invention discloses a tomato disease diagnosis method based on a naive Bayes classifier and sensor data, and the method comprises the steps: obtaining a feature description and a solution corresponding to a tomato disease from a planting book, and taking the feature description and the solution as a standard text case; performing word segmentation preprocessing on the standard text case, and segmenting continuous text statements in the standard text case to obtain single vocabularies convenient for IF-IDF processing; using a TF-IDF method to carry out vectorization processing on the standard text case after word segmentation; using a naive Bayes classifier to train the standard text case after the TF-IDF vectorization processing; predicting a plurality of cases describing tomato disease characteristics by using the trained model to obtain a text diagnosis result; a diagnosis result is further optimized through data collected by a sensor, and a corresponding disease solution is provided; the accuracy of tomato disease diagnosis can be improved, so that the crop yield is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of tomato disease diagnosis, and in particular to a tomato disease diagnosis method based on a naive Bayes classifier and sensor data. Background Art

[0002] With the development of agricultural technology, the area and types of crop plantings are increasing, and tomato diseases are becoming increasingly serious. Traditional pest and disease diagnosis methods mainly rely on farmers' experience and manual observation, but this method has problems such as strong subjectivity, slow diagnosis speed and low accuracy. At the same time, with the development of smart agriculture and precision agriculture, relying on sensor technology and big data analysis to realize the automation and monitoring of tomato diseases has gradually become a trend.

[0003] In recent years, pest and disease diagnosis methods based on image processing technology have received extensive attention and research. These methods collect images of crop leaves or fruits, analyze the images using machine learning or deep learning algorithms, and identify the types and severity of pests and diseases. However, image processing technology has some limitations in practical applications, such as its strong dependence on image acquisition equipment and ambient lighting, high complexity in image data processing, and high consumption of computing resources. Summary of the invention

[0004] The purpose of the present invention is to provide a tomato disease diagnosis method based on a naive Bayes classifier and sensor data, taking the description of tomato diseases in books as standard cases, performing word segmentation preprocessing on the collected standard text cases, performing model training through a naive Bayes classifier, and making predictions from multiple cases describing disease characteristics. Finally, the diagnosis results are further optimized through sensor data to improve the accuracy of tomato disease diagnosis and increase crop yields.

[0005] The technical solution to achieve the purpose of the present invention is:

[0006] A method for diagnosing tomato diseases based on a naive Bayes classifier and sensor data, comprising:

[0007] Step 1: Obtain the corresponding characteristic descriptions and solutions of tomato diseases from planting books as standard text cases;

[0008] Step 2: Perform word segmentation preprocessing on the standard text case to segment the continuous text sentences in the standard text case to obtain single words that are convenient for IF-IDF processing;

[0009] Step 3: Use the TF-IDF method to vectorize the standard text cases after word segmentation;

[0010] Step 4: Use the Naive Bayes classifier to train the standard text cases after TF-IDF vectorization.

[0011] Step 5: Use the trained model to predict multiple cases describing tomato disease characteristics and obtain text diagnosis results;

[0012] Step 6: Further optimize the diagnosis results through the data collected by the sensor and provide corresponding disease solutions:

[0013] The cultivation environment parameters corresponding to tomato blight were obtained in the literature as standard sensor data;

[0014] Two sets of culture environment parameters were randomly generated in Python to simulate the culture environment of tomato blight during planting as case sensor data;

[0015] The text diagnosis result or the sensor data diagnosis result is selected according to the comprehensive score of the text diagnosis score and the sensor diagnosis score; the corresponding disease solution method in the standard case is provided for reference according to the final diagnosis result.

[0016] Compared with the prior art, the present invention has the following significant advantages:

[0017] (1) By combining text data and sensor data, the automation of tomato disease diagnosis is effectively realized, avoiding the subjectivity and inefficiency of traditional manual diagnosis methods and significantly improving the accuracy and speed of diagnosis.

[0018] (2) Natural language processing technology was used to pre-process the text data using the Jieba word segmentation library, and vectorized the data using the TF-IDF algorithm, which greatly improved the accuracy of tomato disease feature extraction.

[0019] (3) In the process of disease and insect pest diagnosis, standard text cases are trained based on the naive Bayes classifier to achieve accurate classification of different diseases, and the diagnosis results are further optimized in combination with sensor data to ensure the comprehensiveness and reliability of the diagnosis. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 The flowchart of the tomato disease diagnosis method based on the naive Bayes classifier and sensor data of the present invention;

[0021] Figure 2 Diagnostic results of 19 early blight cases of the present invention are shown in FIG.

[0022] Figure 3 This is a diagram showing the diagnosis results of 15 late blight cases of the present invention;

[0023] Figure 4The flowchart of weight allocation of text data and sensor data of the present invention. DETAILED DESCRIPTION

[0024] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments.

[0025] Combination Figure 1 A method for diagnosing tomato diseases based on a naive Bayes classifier and sensor data of the present invention comprises the following steps:

[0026] Step 1: Obtain the corresponding characteristic descriptions and solutions of tomato diseases from planting books as standard text cases;

[0027] In the book "New Technology for Tomato Cultivation in Greenhouses", we learned how to identify the symptoms of early blight and late blight and how to solve them. Early blight and late blight (recorded in the text) are the two most common diseases of tomatoes. They have similar symptoms, including leaf spots and death. Solutions include choosing disease-resistant varieties, properly managing the planting environment, and using chemical agents. The specific descriptions of the symptoms of early blight and late blight in the book are used as standard text cases.

[0028] Step 2: Perform word segmentation preprocessing on the standard text case to segment the continuous text sentences in the standard text case to obtain single words that are convenient for IF-IDF processing; the specific steps of preprocessing are:

[0029] The jieba word segmentation library of the python programming language was used to perform word segmentation by calling the "tokenize" function. The continuous text of the specific text data describing tomato diseases in the standard text case was segmented into individual words. For example, the sentence "Leaf spots initially appear as dark brown or black-brown spots" was processed to obtain "Leaf spots initially appear as dark brown or black-brown spots".

[0030] Step 3: Use the TF-IDF method to vectorize the standard text cases after word segmentation;

[0031] Create a TfidfVectorizer instance, convert the text data after word segmentation in step 2 into TF-IDF feature vectors, use the fit_transform method to train and transform the text data, and convert the text data into a TF-IDF feature vector matrix to generate a TF-IDF feature vector matrix. By viewing this matrix, you can check the feature vectors after each text conversion and ensure that the generated feature vectors effectively represent the important information in the text.

[0032] Step 4: Use the Naive Bayes classifier to train the standard text cases after TF-IDF vectorization.

[0033] Use the Naive Bayes classifier to train the standard text cases that have been vectorized by TF-IDF. Use the make_pipeline method to combine TfidfVectorizer and MultinomialNB to form a pipeline for processing text data and training models. Use the fit method to pass the text data and corresponding labels into the pipeline to train the Naive Bayes classifier. After training, the model can be used to classify new text data. You can use the predict method to classify new text.

[0034] Step 5: Use the trained model to predict multiple cases describing tomato disease characteristics and obtain text diagnosis results;

[0035] The trained model is used to predict multiple cases describing the characteristics of tomato diseases to obtain text diagnosis results. The specific steps are as follows: Descriptive statements about tomato early blight and late blight are collected in the literature, including 19 text statements describing tomato early blight and 15 text statements describing tomato late blight. These text statements are used as verification cases, and the verification cases are saved in txt format and opened in the python program. The naive Bayes classifier trained in step 4 is used to call the predict method to classify and predict the verification cases and output the probability value of each case. Specifically, the probability value is obtained through the model's predict_proba method, which calculates the probability distribution of each verification case belonging to each category. The predict_proba method returns a two-dimensional array, in which each row represents the category probability distribution of a verification case, and each value represents the probability that the case belongs to a certain category, thereby providing detailed information about classification uncertainty. The probability value reflects the matching degree of the verification case with the standard text case. The higher the probability value, the higher the matching degree of the verification case with the standard case. Among the 19 statements describing tomato early blight, 17 have a higher probability of being diagnosed as early blight than late blight, and 2 have a higher probability of being diagnosed as late blight than early blight, that is, 2 cases are misdiagnosed, and the diagnosis accuracy is 89%. Among the 15 statements describing tomato late blight, 13 have a higher probability of being diagnosed as late blight than early blight, and 2 have a higher probability of being diagnosed as early blight than late blight, that is, 2 cases are misdiagnosed, and the diagnosis accuracy is 87%. The verification results are:

[0036]

[0037] Step 6: Further optimize the diagnosis results through the data collected by the sensor and provide corresponding disease solutions.

[0038] The culture environment parameters such as air temperature (℃), air humidity (%RH), soil temperature (℃), soil humidity (%RH), light intensity (Lux), pH, etc. corresponding to tomato early blight and late blight were obtained in the literature as standard sensor data. According to the sensor parameter range corresponding to early blight and late blight, two sets of culture environment parameters were randomly generated in python to simulate the culture environment of tomato early blight and late blight during the planting process as case sensor data. The case sensor data was compared with the standard sensor data to evaluate the degree of compliance. If one case sensor data meets the standard sensor data, the sensor data diagnostic score is increased by one until it is added from zero to the total number of sensors. Finally, the diagnostic result and diagnostic score based on the sensor data are obtained. The diagnostic score is defined as score sensor , also based on the diagnosis results of text data, the probability value of the text diagnosis result is obtained through the predict_proba method of the model as the text diagnosis score text , define a variable x, when the text diagnosis result is inconsistent with the sensor diagnosis result, as the weight distribution of the text diagnosis result score and the sensor diagnosis score, since the text diagnosis score is distributed around 0.5, the sensor diagnosis score depends on the number of sensor parameter types. Specifically, if there are several items in the case sensor data that meet the standard sensor data, the sensor diagnosis score should be equal to the number of data items that meet the standard, which is 0 to 6 in this embodiment. Therefore, the initial value of x is set to 12, and it is decreased by 0.5 intervals until the highest accuracy is obtained. According to the text diagnosis score combined with the weight parameter x and the sensor diagnosis score, a comprehensive score score is finally obtained. combined , the pest type is determined based on the comprehensive diagnosis score. If the comprehensive score is greater than 0, the text diagnosis result is selected. If the comprehensive score is less than 0, the sensor data diagnosis result is selected. In addition, since the text diagnosis score is the probability value of model matching, four decimal places are retained in this embodiment, and the sensor diagnosis score is an integer, the comprehensive score does not have a case of 0. The method is as follows:

[0039] score combined =score text *x-score sensor (1)

[0040]

[0041] Where score combined is the comprehensive score, score text Score for text diagnosis, score sensor is the sensor diagnosis score, result text is the text diagnosis result, result sensoris the sensor diagnosis result, result combined For the comprehensive diagnosis results.

[0042] The 19 early blight text cases and 15 late blight text cases in step 5 were combined to generate 19 early blight sensor data and 15 late blight sensor data, and the optimal value of x was 11. The results are as follows:

[0043]

[0044] Finally, according to the final diagnosis results, the corresponding disease solution in the standard case is provided for farmers' reference. In this embodiment, if the diagnosis is early blight of tomato, the solution provided is: select disease-resistant varieties; carry out reasonable crop rotation with non-Solanaceae plants, and soak the seeds in 55°C warm water for 30 minutes before sowing to effectively treat the seeds; maintain suitable temperature and humidity in the protected area, avoid high temperature and high humidity environment, and do not keep the greenhouse stuffy for a long time in the early stage after planting; use chemical control. If the diagnosis is late blight, the solution provided is: select disease-resistant varieties; pay attention to ventilation and reduce humidity; separate the seedling greenhouse from the production greenhouse, and strictly ensure that the seedling greenhouse does not get sick; reduce the chance of artificial transmission of pathogens; implement crop rotation with non-Solanaceae crops for more than 2 to 3 years, reasonably close planting, and formula fertilization; use chemical control.

[0045] Combination Figure 2 The present invention obtains the diagnosis result from 19 text data describing tomato early blight, including the following steps:

[0046] Descriptive statements about tomato early blight were collected from the literature, and the diagnosis results and predicted probability values ​​were obtained based on the trained model. In the diagnosis results, the model judged 17 statements as early blight and 2 statements as late blight, that is, 2 cases were misdiagnosed, and the probability difference between the two misdiagnosed cases was within 0.1.

[0047] Combination Figure 3 The present invention obtains the diagnosis result from 15 text data describing tomato late blight, comprising the following steps:

[0048] Descriptive statements about tomato early blight were collected from the literature, and the diagnosis results and predicted probability values ​​were obtained based on the trained model. In the diagnosis results, the model judged 13 statements as late blight and 2 statements as early blight, that is, 2 cases were misdiagnosed, and the probability difference between the two misdiagnosed cases was within 0.05.

[0049] Combination Figure 4 After obtaining the text diagnosis result and the probability value, the present invention combines the sensor data score to perform a comprehensive diagnosis, including the following steps:

[0050] The probability value of the text diagnosis result is used as the text diagnosis score. After multiplying the text diagnosis score by the weight parameter, a comprehensive diagnosis is performed in combination with the sensor diagnosis score. If the text diagnosis result is consistent with the sensor diagnosis result, the comprehensive diagnosis result is directly obtained. If the text diagnosis result is inconsistent with the sensor diagnosis result, the text diagnosis score multiplied by the weight is compared with the sensor diagnosis score, and the result with a higher score is selected as the comprehensive diagnosis result.

[0051] The optimal value of the weight parameter is determined by multiple cases describing tomato early blight and tomato late blight. In this embodiment, 19 cases describing tomato early blight and 15 cases describing tomato late blight are obtained from the literature. When the weight parameter is 11, the comprehensive diagnosis accuracy of the case is 100%, that is, 11 is the optimal value of the weight parameter.

[0052] In addition, it should be understood that although the present specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.

Claims

1. A method for diagnosing tomato diseases based on a naive Bayes classifier and sensor data, characterized in that: include: Step 1: Obtain the corresponding characteristic descriptions and solutions of tomato diseases from planting books as standard text cases; Step 2: Perform word segmentation preprocessing on the standard text case, segment the continuous text sentences in the standard text case, and obtain single words that are convenient for IF-IDF processing; Step 3: Use the TF-IDF method to vectorize the standard text cases after word segmentation; Step 4: Use the Naive Bayes classifier to train the standard text cases after TF-IDF vectorization. Step 5: Use the trained model to predict multiple cases describing tomato disease characteristics and obtain text diagnosis results; Step 6: Further optimize the diagnosis results through the data collected by the sensor and provide corresponding disease solutions: The cultivation environment parameters corresponding to tomato blight were obtained in the literature as standard sensor data; Two sets of culture environment parameters were randomly generated in Python to simulate the culture environment of tomato blight during planting as case sensor data; The text diagnosis result or the sensor data diagnosis result is selected according to the comprehensive score of the text diagnosis score and the sensor diagnosis score; the corresponding disease solution method in the standard case is provided for reference according to the final diagnosis result.

2. The method for diagnosing tomato diseases based on naive Bayesian classifier and sensor data according to claim 1, characterized in that: The specific process of preprocessing is: The jieba word segmentation library of the Python programming language is used to perform word segmentation by calling the "tokenize" function to segment the specific text data describing tomato diseases in the standard text case into single words.

3. The method for diagnosing tomato diseases based on naive Bayesian classifier and sensor data according to claim 1, characterized in that: The specific process of vectorization is as follows: Create a TfidfVectorizer instance, convert the segmented text data into TF-IDF feature vectors, use the fit_transform method to train and transform the text data, and convert the text data into a TF-IDF feature vector matrix to generate a TF-IDF feature vector matrix.

4. The method for diagnosing tomato diseases based on naive Bayesian classifier and sensor data according to claim 1, characterized in that: Use the Naive Bayes classifier to train the standard text case after TF-IDF vectorization. The specific process is as follows: Use the Naive Bayes classifier to train the standard text cases that have been vectorized by TF-IDF. Use the make_pipeline method to combine TfidfVectorizer and MultinomialNB to form a pipeline for processing text data and training models. Use the fit method to pass the text data and corresponding labels into the pipeline to train the Naive Bayes classifier.

5. The method for diagnosing tomato diseases based on naive Bayesian classifier and sensor data according to claim 1, characterized in that: The combined score of the text diagnosis score and the sensor diagnosis score is calculated as follows: score combined =score text *x-score sensor (1) Where score combined For the comprehensive score; score text The score is the text diagnosis score. The probability value of the text diagnosis result is obtained through the predict_proba method of the model as the text diagnosis score; score sensor The sensor diagnosis score is obtained by comparing the case sensor data with the standard sensor data to see if they are consistent; result text is the text diagnosis result, result sensor is the sensor diagnosis result, result combined is the comprehensive diagnosis result, and x is the text diagnosis score combined with the weight parameter.

6. The method for diagnosing tomato diseases based on naive Bayes classifier and sensor data according to claim 5, characterized in that: The text diagnosis score combined with the value of the weight parameter x is: set the initial value to a certain value, and then decrease it by a set interval until the highest accuracy is obtained.