Fruit and vegetable video pest detection method based on deep learning and big data technology

Through the combination of deep learning and big data technology, real-time and offline analysis of video data solves the problem of heavy workload and false detection caused by traditional manual detection of fruit and vegetable pests and diseases, and achieves high-precision detection and protection of pests and diseases.

CN118570696APending Publication Date: 2024-08-30GUILIN UNIV OF ELECTRONIC TECH
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202410635672.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-21
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Traditional detection of fruit and vegetable pests and diseases relies on manual observation, which results in a heavy workload and is prone to false detections, missed detections, and false alarms, and it is difficult to achieve efficient and intelligent identification.

Method used

Combined with deep learning algorithms (such as YOLOv7) and big data technology, video is detected in real time through image acquisition equipment, data is analyzed in real time and offline, annotation tools are used to form data sets, model training is performed for detection, and data processing is performed through databases and message queues in real time Issue alerts and visualize results offline.

Benefits of technology

It achieves high-precision fruit and vegetable video pest and disease detection, reduces the workload of manual detection, improves the accuracy and reliability of detection results, and can effectively carry out large-scale pest and disease detection and protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570696A
    Figure CN118570696A
Patent Text Reader

Abstract

The invention discloses a deep learning and big data technology-based fruit and vegetable video pest detection method. The method comprises a camera module, a deep learning model training module, a video detection display module, a detection data collection module, a real-time detection module, an alarm module, an offline detection module and a display module. The camera module is used for shooting a group of fruit and vegetable growth videos in different ranges every 24 hours by using a camera erected in a greenhouse; the deep learning model training module comprises an iteration unit and an identification unit; the video detection display module is an interface generated by software development and displays fruit and vegetable disease and insect pest detection conditions in real time; the real-time detection module carries out real-time processing and analysis on detection data, and the alarm module is triggered when a certain index is reached; the off-line detection module carries out off-line processing and analysis on all-day detection data, and finally the result is displayed in the display module.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of target detection, big data processing and smart agriculture, and specifically to a method for detecting fruit and vegetable pests and diseases based on combining data analysis and processing based on a deep learning algorithm (such as YOLOv7, etc.) and big data technology (such as Spark, etc.). Background Art

[0002] With the development of the times, countries are paying more and more attention to the prevention and control of various crop diseases and pests, which has attracted more and more institutions to conduct research. At present, the detection and protection of fruit and vegetable diseases and pests are mostly done manually, which requires repeated observation of the health or abnormal conditions of fruits and vegetables. Due to the high planting density, wide range, and diverse environment of fruits and vegetables, the workload of manual protection or detection is very large, and it is easy to have problems such as false detection, missed detection, and false alarm. With the development of technologies such as target detection and big data, people have begun to pursue more intelligent methods for identifying or detecting fruit and vegetable diseases and pests, and apply them to large-scale agricultural application scenarios. Summary of the invention

[0003] In view of the defects of the existing technologies such as traditional fruit and vegetable pest and disease detection, identification or protection, the present invention proposes a fruit and vegetable pest and disease detection method based on deep learning and big data technology, which combines real-time detection with offline detection and has high accuracy.

[0004] To achieve the above objectives, the present invention firstly transmits the captured fruit and vegetable videos into the visual detection algorithm model through the image acquisition device for deep learning training, and displays the video detection screen in real time; then transmits the obtained detection data to the big data platform for real-time and offline analysis; if the real-time analysis identifies fruit and vegetable leaves with pests and diseases, an alarm is issued; when the offline analysis is performed, the pests and diseases in all the captured videos are classified and calculated, and then the results are displayed using tools for reference by users or decision makers.

[0005] The fruit and vegetable video pest and disease detection method based on deep learning and big data technology includes the following steps:

[0006] (1) Using a labeling tool to label and classify the collected fruit and vegetable leaves containing pests and diseases to form a data set, and then dividing the data set into a training set, a test set, and a validation set in proportion;

[0007] (2) By training the data set based on deep learning technology (such as YOLOv7, etc.), a weight model for fruit and vegetable disease and insect pest detection is obtained;

[0008] (3) The captured video is transmitted to a trained deep learning model (such as YOLOv7) through the image acquisition device at the agricultural planting site, and the video is detected in real time based on the model, and the video detection screen is displayed in real time;

[0009] (4) The data detected in real time by the deep learning model (such as YOLOv7, etc.) is transmitted to the table of the front-end database through the connection established between Python (or Java, etc.) and the database for pre-storage, and an attribute set is set. The specific area where the fruit and vegetable pests and diseases occur is determined through the attribute set, and then the right medicine is prescribed;

[0010] (5) Importing the data in the front-end database into the message queue as a producer for real-time detection; or extracting the data in the front-end database into the distributed file system using a data extraction tool for offline detection;

[0011] (6) According to step (5), during real-time detection, a big data stream processing tool is used as a consumer to consume the data in the message queue, and an operator (such as groupByKey) is used to group the data according to the attribute set, and operators such as filter are used to filter the data with a confidence greater than 0.5;

[0012] (7) A table corresponding to the front-end database is established in the database, and the data extracted by the data extraction tool into the distributed file system is loaded into the database table according to the date as the partition condition; then the data is counted and aggregated according to the category (class), and finally the analyzed data is loaded into the result table of the database;

[0013] (8) When the detection results of steps (5) and (6) reach certain conditions, an alarm is issued to remind the staff that prevention and control are needed; the results of the offline detection of steps (5) and (7) are visualized through a visualization tool for reference by the staff for prevention and control.

[0014] Further step (1) the data annotation process includes:

[0015] 1) First, filter the images and remove blurry images;

[0016] 2) Secondly, the data is labeled and classified according to bean_pod_borer, leaf_miner, rust, angular_spot, and yellow_mosaic;

[0017] 3) After labeling, use data enhancement to balance the categories, including: flipping, cropping, translation, scaling, adding Gaussian noise, etc.

[0018] The attribute set in step (4) includes greenhouse_id (greenhouse id), camera_id (camera id), current_time (shooting time), class (pest and disease type), and confidence (confidence).

[0019] The table structure of the front-end database in step (4) is as follows:

[0020]

[0021]

[0022] The real-time detection process in step (6) includes:

[0023] 1) First, use the data in the database as the producer data source of the message queue, connect the message queue to the database, and when the data in the database changes, it can be transferred to the message queue in real time. Set the cluster server address, batch size and topic of the message queue;

[0024] 2) Use big data streams (such as Spark Streaming, etc.) as consumers of message queues. As a pseudo-real-time computing engine, big data streams (such as Spark Streaming, etc.) achieve pseudo-real-time effects through micro-batch processing. It is necessary to set the sliding window size and sliding time interval. After reading the data from the message queue, it is abstracted into a data structure called DStream, whose underlying layer is a set of RDD sequences; then use the filter operator to filter data with confidence greater than 0.5, and finally use operators such as groupByKey to group by greenhous_id, camera_id, and class;

[0025] 3) Finally, when the analysis and processing results reach a certain threshold, an alarm device will be triggered to alert the staff.

[0026] The offline detection process in step (7) includes:

[0027] 1) First, use the receipt extraction tool to extract the data in the database into HDFS;

[0028] 2) Create a table corresponding to the database in the data warehouse. In order to facilitate future reading and management of data, the table is partitioned by the date of each day. The data stored in the database on the previous day is analyzed using the T+1 working day analysis method. The computing engine of the data warehouse itself is MapReduce (or other big data processing tools). The underlying HQL still converts SQL into MapReduce's Map tasks and Reduce tasks. The calculation speed is very slow, but very stable. In order to get the processing results quickly, the computing engine of the data warehouse is replaced with big data computing tools (such as Spark, etc.), and query tools (such as Spark SQL, etc.) are used for analysis. The results are then written to a result table created in the database, and finally visualized using visualization tools.

[0029] The fruit and vegetable video pest and disease detection method of the present invention can be used to store and calculate data for large-scale pest and disease detection and protection, effectively accumulate and utilize big data resources, improve the correlation between results, and promote the engineering application of the pest and disease detection method by combining technologies such as artificial intelligence and cloud technology. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 It is a module flow chart of the present invention;

[0031] Figure 2 It is a specific implementation flow chart of the present invention;

[0032] Figure 3 Implementation diagram for real-time detection;

[0033] Figure 4 This is a schematic diagram of Hive partitioning;

[0034] Figure 5 This is a schematic diagram of data preprocessing;

[0035] Figure 6 This is a schematic diagram of the overall data changes;

[0036] Figure 7 Real-time detection and display interface of Doujiao video implemented by PyQt5;

[0037] Figure 8 Real-time citrus video detection and display interface implemented in PyQt5;

[0038] Fig. 9 Real-time sugarcane video detection and display interface implemented in PyQt5;

[0039] Fig.10 It is the visualization interface of FineBI results. DETAILED DESCRIPTION

[0040] In order to further illustrate the technical route of the present invention, the present invention is further described in conjunction with the accompanying drawings.

[0041] The invention discloses a fruit and vegetable video pest and disease detection method based on deep learning and big data technology, comprising a camera module, a deep learning model (such as YOLOv7) training module, a video detection and display module, a detection data collection module, a real-time detection module and an alarm module, an offline detection module and a display module; the camera module uses a camera set up in a greenhouse to shoot a group of fruit and vegetable growth videos with different ranges every 24 hours; the deep learning model (such as YOLOv7) training module includes an iteration unit and a recognition unit; the video detection and display module is an interface generated by software development (such as using PyQt5), and displays the fruit and vegetable pest and disease detection status in real time; the real-time detection module processes and analyzes the detection data in real time, and triggers the alarm module when a certain index is reached; the offline detection module processes and analyzes the detection data throughout the day offline, and finally displays the result in the display module.

[0042] The main steps are as follows:

[0043] (1) Use data labeling tools (such as LabelImg) to label fruit and vegetable leaves with pests and diseases that have been photographed in advance. For example, beans are roughly divided into insects: bean pod borer, leaf miner; diseases: rust, angular leaf spot, yellow mosaic disease; then divide the data set into training set, test set and validation set according to a certain ratio (such as 7:2:1);

[0044] (2) Use a deep learning model (such as YOLOv7) algorithm to train the data set. Try three different training epochs: 200, 300, and 500. Select the training result model of the epoch with the best final effect (precision P, recall R, and mean average precision (mAP) value) as the final model.

[0045] (3) The video captured by the camera installed in the vegetable greenhouse is passed to the trained deep learning model (such as YOLOv7). The model detects the video in real time. During this process, the interface implemented by software development (such as using PyQt5) will display the video detection screen in real time, frame the leaves with pests and diseases, and display their confidence.

[0046] (4) The deep learning model (such as YOLOv7) detects each frame of the video, and transmits the real-time detection data of each frame of the video to the table of the front-end database (such as MySQL) for storage through the connection established between Python (or Java and other programming languages) and the database. The set attributes include greenhouse_id (greenhouse id), camera_id (camera id), current_time (shooting time), class (type of pests and diseases), and confidence (confidence). According to the attribute set (greenhouse_id and camera_id), it can be determined which specific area has pests and diseases. By setting the class, it can be determined what kind of pests and diseases have occurred, so as to prescribe the right remedy.

[0047] (5) This is divided into two parts: one is to import the data in the front-end database (such as MySQL) as a producer into the message queue (such as Kafka) for real-time detection; the other is to use a data extraction tool (such as Datax) to extract the data in the front-end database into HDFS for offline detection;

[0048] (6) According to step (5), during real-time detection, Spark Streaming is used as a consumer to consume data in a message queue (such as Kafka). The window size of Spark Streaming is set to 15 seconds (it can also be set to other values ​​as required), and the interval size of the sliding window is set to 5 seconds (it can also be set to other values ​​as required). Then, the groupByKey operator is used to group the data according to greenhous_id, camera_id, and class. Finally, the filter operator is used to filter the data with a confidence greater than 0.5.

[0049] (7) Create a table in Hive that corresponds to the front-end database, and load the data extracted from HDFS by the data extraction tool (such as Datax) into the table of the data warehouse (such as Hive) according to the partition condition dt (date). In order to speed up the calculation of the data warehouse (such as Hive), replace the computing engine of the data warehouse (such as Hive) from MapReduce to a big data computing component (such as Spark), where the data warehouse (such as Hive) is responsible for storing data and Spark is responsible for SQL parsing optimization. The syntax is Spark SQL, and the bottom layer of Spark uses RDD execution; then perform count aggregation operations on the data according to class, and finally load the analyzed data into the result table of the database (such as MySQL, HBase).

[0050] (8) According to step (6), when the real-time detection results reach certain conditions, an alarm will be issued to remind the staff to take preventive measures; according to step (7), the results obtained by offline detection will be visualized through visualization tools (such as FineBI) for reference by the staff for prevention and control.

[0051] In step (1), in order to achieve better training results, it is necessary to balance the number of each class and perform data augmentation on some data, including flipping, CutMix, translation, adding Gaussian noise, scaling, and other operations.

[0052] This method uses the following method when dividing data. The pseudo code is as follows:

[0053]

[0054] In step (6), in order to maintain the integrity of a large amount of real-time data, the data buffer is composed of a group of message queue (such as Kafka) server clusters. The data storage time can be changed by configuration to improve the overall performance and reliability; the data in the database (such as MySQL) is used as the data source, a message queue (such as Kafka) producer client is created, and producer parameters are set, including kafka.bootstrap.servers (Kafka cluster server address), kafka.batch.size (batch size), kafka.topic (Kafka topic); Spark Streaming is a pseudo real-time computing framework, and its working idea is to process data in micro-batches. The effect of data micro-batching is achieved by setting the size (time) of the sliding window and the sliding interval time of the window. These two times must be integer multiples of the interval (receiver) of receiving stream data. Here, the window size (window) is set to a certain time (such as 15s), and the sliding time (slide) interval is set to 5s, that is, the data within the last 15s is analyzed and calculated every 5s. When the analysis result reaches the set threshold, the alarm device will be triggered to remind the staff to take preventive measures.

[0055]

[0056] Spark Streaming abstracts the read data into a data structure called DStream, whose underlying structure is a set of RDD sequences. First, the filter operator is used to filter the data with confidence greater than 0.5, and then the groupByKey operator is used to group the data with greenhous_id, camera_id, and class as the grouping conditions.

[0057] In step (7), in order to store data for a long time, use a data extraction tool (such as Datax) to extract data from the database (such as MySQL) to HDFS, which will make two backups by default; in order to facilitate future reading of data, use the date of each day as the partition field for partitioning, and use the T+1 working day analysis method to analyze the data of the previous day stored in the database (such as MySQL). The computing engine of the data warehouse (such as Hive) itself is MapReduce, and its unique HQL language bottom layer still converts SQL into MapReduce's Map tasks and Reduce tasks. The computing speed is very slow, but very stable. In order to quickly obtain the processing results, the computing engine of the data warehouse (such as Hive) is replaced by Spark, and Spark SQL is used for analysis. The results are written to a result table in the database (such as MySQL, HBase), and finally a visualization tool (such as FineBI) is used for visualization. The aggregation operation can be as follows:

[0058]

Claims

1. A fruit and vegetable video pest and disease detection method based on deep learning and big data technology, characterized by: The steps include: (1) Using a labeling tool to mark, divide and classify the collected fruit and vegetable leaves containing pests and diseases to form a data set, and then divide the data set into a training set, a test set and a validation set in proportion; (2) The YOLOv7 deep learning technology was used to train the model on the data set to obtain a weight model for fruit and vegetable pest and disease detection; (3) The captured video is transmitted to the trained YOLOv7 deep learning model through the image acquisition device at the agricultural planting site, and the video is detected in real time based on the model, and the video detection screen is displayed in real time; (4) The data detected in real time by the YOLOv7 deep learning model is connected to the database and transferred to the table of the front-end database for pre-storage, and an attribute set is set. The specific area where the fruit and vegetable pests and diseases occur is determined through the attribute set, and then the right medicine is prescribed; (5) Importing the data in the front-end database into the message queue as a producer for real-time detection; or extracting the data in the front-end database into the distributed file system using a data extraction tool for offline detection; (6) According to step (5), during real-time detection, a big data stream processing tool is used as a consumer to consume the data in the message queue, an operator is used to group the data according to the attribute set, and a filter operator is used to filter the data with a confidence greater than 0.5; (7) A table corresponding to the front-end database is established in the database, and the data extracted by the data extraction tool into the distributed file system is loaded into the database table according to the date as the partition condition; then statistical aggregation operations are performed on the data according to the classification, and finally the analyzed data is loaded into the result table of the database; (8) When the detection results of steps (5) and (6) reach certain conditions, an alarm is issued to remind the staff that prevention and control are needed; the results of the offline detection of steps (5) and (7) are visualized through a visualization tool for reference by the staff for prevention and control.

2. The method for detecting pests and diseases of fruits and vegetables by video according to claim 1, characterized in that: The data labeling process in step (1) includes: 1) First, filter the images and remove blurry images; 2) Secondly, the data is labeled and classified according to bean_pod_borer, leaf_miner, rust, angular_spot, and yellow_mosaic; 3) After labeling, use data enhancement to balance the categories, including: flipping, cropping, translation, scaling, and adding Gaussian noise.

3. The method for detecting pests and diseases of fruits and vegetables according to claim 1, characterized in that: The attribute set in step (4) includes greenhouse_id (greenhouse id), camera_id (camera id), current_time (shooting time), class (pest and disease type), and confidence (confidence).

4. The method for detecting pests and diseases of fruits and vegetables by video according to claim 1, characterized in that: The table structure of the front-end database in step (4) is as follows:

5. The method for detecting pests and diseases of fruits and vegetables by video according to claim 1, characterized in that: The real-time detection process in step (6) includes: 1) First, use the data in the database as the producer data source of the message queue, connect the message queue to the database, and when the data in the database changes, it can be transferred to the message queue in real time. Set the cluster server address, batch size and topic of the message queue; 2) The big data stream is used as the consumer of the message queue. It achieves pseudo real-time effect through micro-batch processing. It is necessary to set the sliding window size and sliding time interval. After reading the data from the message queue, it is abstracted into a data structure called DStream, whose underlying layer is a set of RDD sequences; then filter operators such as filter are used to filter the data with confidence greater than 0.5, and finally the groupByKey operator is used to group the data by greenhous_id, camera_id, and class; 3) Finally, when the analysis and processing results reach a certain threshold, an alarm device will be triggered to alert the staff.

6. The method for detecting pests and diseases of fruits and vegetables according to claim 1, characterized in that: The offline detection process in step (7) includes: 1) First, use the receipt extraction tool to extract the data in the database into the distributed file system; 2) Create a table corresponding to the database in the data warehouse. To facilitate future reading and management of data, use the date of each day as the partition field for partitioning. Use the T+1 working day analysis method to analyze the data of the previous day stored in the database. Replace the calculation engine of the data warehouse with a big data calculation tool and use the query tool for analysis. Then write the results to a result table created in the database, and finally use the visualization tool for visualization.

Citation Information

Cited By

  • Fruit and vegetable disease and insect pest spectrum database dynamic evolution updating and diagnosis optimization method based on model confidence feedback driving

    CN120913002A

  • Fruit and vegetable disease and insect pest spectrum database dynamic evolution updating method based on model confidence feedback driving

    CN120913003A

  • Fruit and vegetable disease and insect pest detection method based on spectrum database and model confidence coefficient

    CN120913101A

  • Wheat disease and insect pest identification and identification system based on video stream AI analysis

    CN122116229A