Method and device for detecting insect pests of tea trees
Through downsampling and upsampling technology combined with the recognition unit of the CA attention mechanism, the characteristic parameters of the tea tree pest image are extracted, which solves the problem of low accuracy in pest detection in the prior art, and achieves more accurate pest recognition and real-time detection.
Patent Information
- Application Number
- CN202410959392.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-11-15
AI Technical Summary
The existing tea tree pest detection methods are small and similar to crops, resulting in low detection accuracy, making it difficult to meet the accuracy and real-time requirements of pest detection.
The downsampling unit is used to cut the image to be tested, extract the pest characteristic parameters, restore the image size through the upsampling unit, and identify it in combination with the recognition unit of the CA attention mechanism to obtain pest information and control information.
It improves the accuracy and real-time nature of pest detection, can more accurately identify small targets, and meets the accuracy and real-time requirements of pest detection.
Smart Images

Figure CN118968053A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of agricultural detection, and in particular to a method and device for detecting tea tree pests. Background Art
[0002] Tea tree is a plant with important economic value, and its planting areas are widely distributed all over the world. The healthy growth of tea tree is crucial to the yield and quality of tea. However, tea tree is susceptible to a variety of pests, such as tea green leafhopper, gray tea looper, tea orange gall mite, black spiny whitefly, etc. During the growth and development of tea tree, all parts of tea tree are harmed by pests and diseases, especially bud and leaf pests, which are of many types and serious. These pests not only affect the yield of tea, but also may cause serious damage to the quality of tea. The loss of tea production caused by pests is huge, resulting in a 15% to 20% reduction in tea production. The outbreak of tea loopers in local tea areas can even cause a reduction of more than 60% in tea production. In order to effectively prevent and control tea tree pests, timely intervention should be carried out by understanding the weak links in its life cycle before the pest occurs, and effective measures should be taken to prevent its large-scale reproduction and spread to protect tea trees. At the same time, chemical or biological control methods should be combined with the rational use of cultivation techniques and scientific fertilization according to the characteristics of the pests and local conditions to achieve economical, safe and effective pest management and ensure the health of tea trees, tea yield and quality.
[0003] CN117554369A discloses a tea tree pest and disease detection system and method, including a detection module, an information processing module, a visual module, a control module and a communication module. The steps are as follows: the control module calculates a pest and disease prediction factor according to relevant information transmitted by the detection module, the information processing module and the visual module, obtains alarm information according to the pest and disease prediction factor and transmits it to the communication module, and the communication module transmits the alarm information to the user end.
[0004] CN117808620A discloses a pest monitoring and early warning method and system, including an association analysis module, a screening module and a monitoring and early warning module; the association analysis module is used to determine a monitoring area, and obtain historical pest data in the monitoring area, including pest types and corresponding quantities in a historical time period, and perform association analysis based on the historical pest data to obtain an influencing factor group; the screening module is used to screen the maximum pest influencing factor according to the association analysis result, including constructing a data set according to the factor group and historical pest data, inputting it into a model for training, eliminating unqualified pest influencing factors, and obtaining the maximum pest influencing factor; the monitoring and early warning module is used to perform pest prediction based on the maximum pest influencing factor based on a pre-constructed multi-level prediction model to predict the pest types and corresponding quantities, and perform monitoring and early warning according to the pest prediction result.
[0005] In the existing technology, for common pests, grassroots agricultural technicians can directly identify and deal with them; but for special species, especially pests with different characteristics at different growth stages, relying solely on pictures and text descriptions can easily lead to misjudgment, affecting timely and correct prevention and control. In existing pest detection technologies, multiple environmental parameters, advanced remote sensing technology, and deep learning technology are usually used to detect pest species and predict pest occurrence. However, due to the small size of the pest targets themselves and their similarities to crops, complex environmental factors such as light and background interference, and the limitations of algorithms and models, the existing recognition models are insufficient in processing small target detection capabilities, resulting in low detection accuracy and difficulty in meeting the technical requirements of accuracy and real-time pest detection. Summary of the invention
[0006] After long-term practice, it is found that the existing methods for detecting tea tree pests are usually directly judged by grassroots agricultural technicians or identified through machine learning models; the accuracy of the former is mainly determined by their experience; while the latter usually uses a variety of environmental parameters, advanced remote sensing technology and deep learning technology to detect pest types and predict the occurrence of pests. Due to interference factors such as the small size of the pest targets themselves and their similarities to crops, the detection accuracy is not high and it is difficult to meet the accuracy of pest detection.
[0007] In view of this, the present invention provides a method for detecting tea tree pests, which comprises: obtaining an image to be tested, wherein the image to be tested includes at least a pest image; obtaining a pest recognition model, wherein the pest recognition model includes at least a downsampling unit, an upsampling unit and a recognition unit; inputting the image to be tested into the pest recognition model, wherein the downsampling unit cuts the image to be tested to obtain a cut image, wherein the cut image includes the pest image; the upsampling unit restores the size of the cut image to obtain a sampled image, so that the position of the pest image in the sampled image is the same as that in the image to be tested; and recognizing the sampled image by the recognition unit to obtain pest information corresponding to the pest image and control information corresponding to the pest information.
[0008] In one embodiment, before obtaining the image to be tested, the method further includes: obtaining a photo of tea tree pests; cutting the photo of tea tree pests into a specified size to obtain the image to be tested, wherein the image to be tested includes at least a pest image.
[0009] In one embodiment, the down-sampling unit cuts the image to be tested to obtain the cut image, which includes: the down-sampling unit extracts features from the pest image to obtain feature parameters corresponding to the pest image; and cuts the image to be tested according to the feature parameters to obtain the cut image.
[0010] In one embodiment, obtaining the pest identification model includes: obtaining a training image; dividing the training image according to a specified ratio to obtain a training set, a verification set and a test set; training the model to be trained based on the training set and the verification set to obtain a trained model; testing the trained model based on the test set, and when the detection accuracy of the trained model reaches a preset threshold, determining the trained model as a pest identification model.
[0011] In one embodiment, obtaining training images includes: obtaining a collection of tea tree pest photos; filtering out tea tree pest photos with a clarity lower than a specified clarity from the collection of tea tree pest photos to obtain tea tree pest images; preprocessing the tea tree pest images to obtain processed images; and annotating the processed images to obtain the training images.
[0012] In one embodiment, the preprocessing includes at least one or more of adding random noise, adjusting image brightness, randomly changing values of certain pixels, translating the image, and mirror-flipping the image.
[0013] In one embodiment, annotating the processed image to obtain the training image includes: identifying pixel values of the processed image to determine candidate areas whose pixel values exceed a specified range; based on the candidate areas, determining an outer contour corresponding to the candidate areas; and annotating the processed image based on the outer contour to obtain the training image.
[0014] In one embodiment, the upsampling unit includes at least a CA attention mechanism.
[0015] In one embodiment, the sampled image is identified by the identification unit to obtain a pest image corresponding to the pest image and control information corresponding to the pest image, including: identifying the sampled image by the identification unit to obtain pest information corresponding to the pest image; when the pest information meets a preset warning category, generating alarm information and control information corresponding to the pest information based on the pest information.
[0016] In view of this, the present invention also provides a tea tree pest detection device, the device comprising: an acquisition module, used to acquire an image to be tested, the image to be tested at least includes a pest image; the acquisition module is also used to acquire a pest recognition model, the pest recognition model at least includes a downsampling unit, an upsampling unit and an identification unit; an input module, used to input the image to be tested into the pest recognition model, the downsampling unit cuts the image to be tested to obtain a cut image, the cut image includes the pest image; a restoration module, used for the upsampling unit to restore the size of the cut image to obtain a sampled image, so that the position of the pest image in the sampled image is the same as that in the image to be tested; an identification module, used to identify the sampled image through the identification unit, and obtain pest information corresponding to the pest image and control information corresponding to the pest information.
[0017] In one embodiment, the acquisition module is further used to acquire tea tree pest photos; cut the tea tree pest photos into specified sizes to obtain images to be tested, and the images to be tested at least include pest images.
[0018] In one embodiment, the input module is also used for the downsampling unit to perform feature extraction on the pest image to obtain feature parameters corresponding to the pest image; and to cut the image to be tested according to the feature parameters to obtain a cut image.
[0019] In one embodiment, the acquisition module is also used to acquire training images; divide the training images according to a specified ratio to obtain a training set, a verification set and a test set; train the to-be-trained model based on the training set and the verification set to obtain a trained model; test the trained model based on the test set, and when the detection accuracy of the trained model reaches a preset threshold, determine the trained model as a pest identification model.
[0020] In one embodiment, the acquisition module is also used to acquire a collection of tea tree pest photos; filter out tea tree pest photos with a clarity lower than a specified clarity in the collection of tea tree pest photos to obtain tea tree pest images; pre-process the tea tree pest images to obtain processed images; and annotate the processed images to obtain the training images.
[0021] In one embodiment, the preprocessing includes at least one or more of adding random noise, adjusting image brightness, randomly changing values of certain pixels, translating the image, and mirror-flipping the image.
[0022] In one embodiment, the acquisition module is also used to identify the pixel values of the processed image, determine the candidate areas whose pixel values exceed the specified range; based on the candidate areas, determine the outer contour corresponding to the candidate areas; and annotate the processed image based on the outer contour to obtain the training image.
[0023] In one embodiment, the upsampling unit includes at least a CA attention mechanism.
[0024] In one embodiment, the recognition module is also used to identify the sampled image through the recognition unit to obtain pest information corresponding to the pest image; when the pest information meets a preset warning category, generate alarm information and control information corresponding to the pest information based on the pest information.
[0025] The present invention also provides an electronic device, at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned method.
[0026] The present invention also provides a machine-readable storage medium, on which instructions are stored, and the instructions are used to enable a machine to execute the method of the present application as described above.
[0027] Compared with the prior art, the present invention provides a method for detecting tea tree pests, which comprises obtaining an image to be detected, wherein the image to be detected includes at least a pest image; obtaining a pest recognition model, wherein the pest recognition model includes at least a downsampling unit, an upsampling unit and a recognition unit; cutting the image to be detected by the downsampling unit to obtain a cut image based on the characteristics of the pest; then restoring the size of the cut image by the upsampling unit to obtain a sampled image so that the sampled image corresponds to the original image; finally, recognizing the sampled image by the recognition unit to obtain pest information corresponding to the pest image and control information corresponding to the pest information; the downsampling and upsampling method is more suitable for cutting small targets, so that the pest image can be obtained more accurately, so that the pest image can be recognized and analyzed, and accurate pest information can be obtained, thereby meeting the accuracy and real-time requirements of pest detection.
[0028] Other features and advantages of the present invention will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings:
[0030] Figure 1 A schematic diagram of a method for detecting tea tree pests according to an embodiment of the present invention Figure 1 ;
[0031] Figure 2 A schematic diagram of a method for detecting tea tree pests according to an embodiment of the present invention Figure 2 ;
[0032] Figure 3 A schematic diagram of the structure of a tea tree pest detection device according to an embodiment of the present invention;
[0033] Figure 4 The present invention is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0034] The specific implementation of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the present invention, and is not used to limit the present invention.
[0035] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0036] Figure 1 A schematic diagram of a method for detecting tea tree pests according to an embodiment of the present invention Figure 1 ; Please refer to Figure 1 ;
[0037] After long-term practice, it is found that the existing methods for detecting tea tree pests are usually directly judged by grassroots agricultural technicians or identified through machine learning models; the accuracy of the former is mainly determined by their experience; while the latter usually uses a variety of environmental parameters, advanced remote sensing technology and deep learning technology to detect pest types and predict the occurrence of pests. Due to interference factors such as the small size of the pest targets themselves and their similarities to crops, the detection accuracy is not high and it is difficult to meet the accuracy of pest detection.
[0038] In view of this, the present invention provides a method for detecting tea tree pests, and the method for detecting tea tree pests includes: step 101, obtaining an image to be tested, wherein the image to be tested includes at least a pest image; step 102, obtaining a pest recognition model, wherein the pest recognition model includes at least a downsampling unit, an upsampling unit and a recognition unit; step 103, inputting the image to be tested into the pest recognition model, wherein the downsampling unit cuts the image to be tested to obtain a cut image, wherein the cut image includes the pest image; step 104, wherein the upsampling unit restores the size of the cut image to obtain a sampled image, so that the position of the pest image in the sampled image is the same as that in the image to be tested; and step 105, identifying the sampled image through the recognition unit, and obtaining pest information corresponding to the pest image and control information corresponding to the pest information.
[0039] Compared with the prior art, the present invention provides a method for detecting tea tree pests, which comprises obtaining an image to be tested, the image to be tested at least comprising an image of a pest; obtaining an insect pest recognition model, the insect pest recognition model at least comprising a downsampling unit, an upsampling unit and an identification unit; cutting the image to be tested by the downsampling unit, thereby obtaining a cut image based on the characteristics of the pest; then restoring the size of the cut image by the upsampling unit, thereby obtaining a sampled image, so that the sampled image corresponds to the original image; finally, identifying the sampled image by the identification unit, obtaining insect pest information corresponding to the insect pest image and control information corresponding to the insect pest information; the downsampling and upsampling method can be more suitable for cutting small targets, thereby obtaining an insect pest image more accurately, thereby identifying and analyzing the insect pest image, obtaining accurate insect pest information, and meeting the accuracy and real-time requirements of insect pest detection.
[0040] Step 101, obtaining an image to be tested, where the image to be tested at least includes an insect pest image;
[0041] In step 101 of the embodiment of the present invention, the image to be tested refers to an image to be identified with pests taken by a user. The pest image refers to a specific image corresponding to the pest in the image to be tested. The image to be tested may be shot remotely by a camera, a mobile phone, or a remote sensing device. Specifically, the image to be tested may be preliminarily processed after shooting, and the preliminarily processing may at least include cropping the image to be tested to meet the size requirements of the pest identification model, and may also remove some noise, thereby improving the accuracy of pest identification.
[0042] Step 102, obtaining an insect pest recognition model, the insect pest recognition model at least comprising a downsampling unit, an upsampling unit and a recognition unit;
[0043] In step 102 of the embodiment of the present invention, the pest identification model is a model for identifying pests of tea trees. The downsampling unit, upsampling unit and identification unit are virtual functional units in the pest identification model, which realize the function of identifying pests of tea tree leaf images after model training.
[0044] Step 103, inputting the image to be tested into the pest recognition model, and the downsampling unit cuts the image to be tested to obtain a cut image, wherein the cut image includes the pest image;
[0045] In step 103 of the embodiment of the present invention, the downsampling unit can perform multiple downsampling on the image to be tested. During the downsampling process, the feature parameters of the pest image can be extracted by the downsampling unit to obtain the feature parameters corresponding to the pest image; thus, the image to be tested is cut based on the feature parameters of the pest to obtain a cut image. Thus, the pest image can be saved in the cut image, and a large amount of noise can be removed, thereby improving the accuracy of small target recognition. Among them, the downsampling unit can use continuous small-size convolution kernels and deeper network structures to extract the features of the image; specifically, VGG16 can be used as the backbone network to achieve the above functions. Furthermore, a CA attention mechanism can be added after each output feature layer; the setting of the CA attention mechanism can provide more accurate location information for scenes that need to comprehensively consider the spatial structure of the image when processing tasks such as image segmentation, thereby increasing attention to pest information and improving the accuracy of pest recognition.
[0046] Step 104, the up-sampling unit restores the size of the cut image to obtain a sampled image, so that the position of the pest image in the sampled image is the same as that in the image to be tested;
[0047] In step 104 of the embodiment of the present invention, after the downsampling is completed, the upsampling unit performs upsampling on the cut image for a corresponding number of times, so that the cut image can be restored in size and return to a size consistent with the image to be tested, so as to facilitate the determination of the location of the pests, thereby facilitating the identification of the pests. Each upsampling is equivalent to the same scale fusion as the number of channels corresponding to the feature extraction part, so as to fuse the low-level features with the high-level features to generate a fine segmentation result.
[0048] Step 105: The sampled image is identified by an identification unit to obtain pest information corresponding to the pest image and control information corresponding to the pest information.
[0049] In step 105 of the embodiment of the present invention, pests are identified based on the sampled image to obtain pest information corresponding to the pest image. Specifically, the sampled image is identified by a recognition unit to obtain pest information corresponding to the pest image. When the pest information meets a preset warning category, alarm information and control information corresponding to the pest information are generated based on the pest information.
[0050] The pest information may include the common name, scientific name and Latin name of the pest, and may further include a pest reference image. The preset warning category may refer to the category of pests that may affect tea trees, specifically, tea green leafhopper, gray tea looper, tea orange gall mite, black spiny whitefly, etc. The treatment information refers to the information on the treatment and management of the pests corresponding to the pest information. Specifically, when the preset warning category is met, the following formula is satisfied:
[0051]
[0052] Among them, JG is the first warning message, YC p It is the selection threshold for pest prediction. When JG=1, it means that the predicted pest does not belong to the preset warning category and no warning is needed. When JG=2, it means that the predicted pest belongs to the preset warning category and a warning is needed.
[0053] Specifically, in order to better store and process the collected data and reduce the amount of calculation on the terminal, the pest trunks in the photographed and uploaded tea tree pest images can be segmented and identified, and the identification records and results can be transmitted to the cloud for storage.
[0054] In one embodiment, before obtaining the image to be tested, the method further includes: obtaining a photo of tea tree pests; cutting the photo of tea tree pests into a specified size to obtain the image to be tested, and the image to be tested includes at least a pest image.
[0055] In an embodiment of the present invention, the tea tree pest photo may be a pest photo taken by a user, and the tea tree pest photo includes at least a tea leaf image and a pest image; the background image in the tea tree pest image is cut to obtain a test image including tea leaves and pests. Specifically, the pixel size of the test image is consistent with the size that can be recognized by the pest recognition model. By cutting the test image before recognition, the accuracy of pest recognition can be effectively improved.
[0056] Figure 2 A schematic diagram of a method for detecting tea tree pests according to an embodiment of the present invention Figure 2 ; Please refer to Figure 2 ;
[0057] In one embodiment, step 102, obtaining a pest identification model includes: step 201, obtaining a training image; step 202, dividing the training image according to a specified ratio to obtain a training set, a validation set and a test set; step 203, training the model to be trained based on the training set and the validation set to obtain a trained model; step 204, testing the trained model based on the test set, and when the detection accuracy of the trained model reaches a preset threshold, the trained model is determined as a pest identification model.
[0058] In step 201 of the present invention, the training images are a collection of images used to train the model. Specifically, the training images can be collected by the staff and obtained after screening and pre-processing. Specifically, a collection of tea tree pest photos is obtained; tea tree pest photos with a clarity lower than a specified clarity are screened out to obtain tea tree pest images; wherein clarity refers to the clarity of the tea leaves and pest photos in the tea tree pest photos, and clarity refers to the clarity of the outline and texture; to facilitate model training. Correspondingly, tea tree pest photos with a clarity lower than a specified clarity are screened out, that is, photos with unclear outlines or textures are screened out. Alternatively, clarity may refer to the number of pixels per inch (DPI) in the length of the image, and correspondingly, the specified clarity may be 300dpi.
[0059] Preprocessing the tea tree pest image to obtain a processed image; preprocessing the tea tree refers to the preparation process before training. Specifically, preprocessing the tea tree pest image at least includes adding random noise, adjusting the image brightness, randomly changing the values of certain pixels, translating the image, and mirror flipping the image. Through the above preprocessing, a certain amount of noise can be added to the image, so that the recognition ability of the model can be improved during training, so that pest information can be more accurately identified.
[0060] The processed image is labeled to obtain a training image. Labeling refers to labeling the pests in the tea tree pest image, so as to facilitate the subsequent label production for model training. Specifically, the labeling of the pests can be to manually label the processed image through the Labelme tool to obtain a training image. It can also be automatically labeled by an electronic device. Specifically, the candidate area whose pixel value exceeds the specified range can be determined by identifying the pixel value of the processed image; wherein the confirmation of the pixel value of the processed image can be determined by the pixel value in the green channel in the RGB color mode; or after the pixel value is grayed, the background color and the pixel value of the pest are distinguished to determine the range, thereby distinguishing the pixel value of the background leaves from the pixel value of the foreground pest. Based on the candidate area, the outer contour corresponding to the candidate area is determined, and the outer contour is the outer adjacent pixel points of the outermost circle of pixel points of the candidate area pixel value; the processed image is labeled based on the outer contour to obtain a training image; specifically, the outer contour can be set to a specified color to complete the labeling, and the specified color can be red.
[0061] In steps 202-204 of the present invention, the specified ratio may be a ratio divided by the staff to meet the requirements of model training. Specifically, the ratio of the training set, the validation set, and the test set may be 7:2:1.
[0062] The training model is trained based on the training set and the validation set to obtain a trained model; specifically, the training set and the validation set are input into the pest recognition model, and the pest images in the training set and the validation set are subjected to feature extraction through the pest recognition model to extract feature parameters of the pests, and segmentation features are obtained according to the feature parameters of the pests. The trained model is a pest detection model with higher accuracy and stronger generalization ability; wherein the feature parameters of the pests include one or more of color, line, texture and area.
[0063] The trained model is tested based on the test set. When the detection accuracy of the trained model reaches a preset threshold, the trained model is determined as a pest identification model. Specifically, the trained model is tested using the test set. When the detection accuracy reaches a preset threshold, the pest identification model is output for predicting pest categories based on real-time acquisition of tea tree pest images. This method can maintain prediction accuracy while reducing computing power requirements.
[0064] A specific embodiment is provided, in which tea tree pests are photographed in a tea garden by a mobile phone and screened; the screened pest images are labeled with the pest trunks using an electronic device or a Labelme tool, and the labeled data are divided into a training set, a validation set, and a test set in a ratio of 7:2:1; the classic deep learning UNet segmentation model is improved, and a TTP-UNet (Tea Tree Pests-UNet) model is proposed; wherein the TTP-UNet model replaces the original backbone network of the UNet model with VGG16; a CA attention mechanism is added after each output feature layer; the TTP-UNet model is trained using a training set and a validation set, and the TTP-UNet model is trained for a total of 120 rounds, and after each round of training, the model's mAP of iou=0.5 is tested using a validation set, and the network weight file corresponding to the model with the best mAP effect is used as the final model. Wherein, mAP may refer to the proportion of correctly classified pixels of each class calculated separately.
[0065] Among them, the TTP-UNet model, namely the Tea Tree Pests-UNet model, combines the architecture of the UNet model. The UNet model has some limitations, such as relatively limited acquisition of global information when processing data, and cannot flexibly adapt to the needs of different data sets and tasks, which affects the accuracy of segmentation and cannot be directly applied to tea tree pest segmentation. In order to deal with the existing problems, VGG16 is introduced into the UNet model to replace the original backbone network, and then the CA attention mechanism is integrated into the output feature layer. The core idea of VGG16 is to use continuous small-size convolution kernels and deeper network structures to extract image features, thereby achieving efficient and accurate recognition of images. In processing tasks such as image segmentation, the CA attention mechanism can provide more accurate location information for scenes that need to comprehensively consider the spatial structure of the image. Thereby improving the performance of the model in performing tea tree pest segmentation tasks.
[0066] Figure 3 This is a schematic diagram of the structure of a tea tree pest detection device according to an embodiment of the present invention; please refer to Figure 3 ;
[0067] In view of this, the present invention also provides a tea tree pest detection device, the device comprising: an acquisition module 301, used to acquire a test image, the test image at least includes a pest image; the acquisition module 301 is also used to acquire a pest recognition model, the pest recognition model at least includes a downsampling unit, an upsampling unit and a recognition unit; an input module 302, used to input the test image into the pest recognition model, the downsampling unit cuts the test image to obtain a cut image, the cut image includes the pest image; a restoration module 303, used for the upsampling unit to restore the size of the cut image to obtain a sampled image, so that the position of the pest image in the sampled image is the same as that in the test image; an identification module 304, used to identify the sampled image through the identification unit, and obtain pest information corresponding to the pest image and control information corresponding to the pest information.
[0068] In one embodiment, the acquisition module 301 is further used to acquire tea tree pest photos; cut the tea tree pest photos into specified sizes to obtain images to be tested, and the images to be tested at least include pest images.
[0069] In one embodiment, the input module 302 is also used for the downsampling unit to perform feature extraction on the pest image to obtain feature parameters corresponding to the pest image; and to cut the image to be tested according to the feature parameters to obtain a cut image.
[0070] In one embodiment, the acquisition module 301 is also used to acquire training images; divide the training images according to a specified ratio to obtain a training set, a verification set and a test set; train the to-be-trained model based on the training set and the verification set to obtain a trained model; test the trained model based on the test set, and when the detection accuracy of the trained model reaches a preset threshold, the trained model is determined as a pest identification model.
[0071] In one embodiment, the acquisition module 301 is also used to obtain a collection of tea tree pest photos; filter out tea tree pest photos with a clarity lower than a specified clarity in the tea tree pest photo collection to obtain tea tree pest images; pre-process the tea tree pest images to obtain processed images; and annotate the processed images to obtain training images.
[0072] In one embodiment, the preprocessing includes at least one or more of adding random noise, adjusting image brightness, randomly changing values of certain pixels, translating the image, and mirror-flipping the image.
[0073] In one embodiment, the acquisition module 301 is also used to identify the pixel values of the processed image, determine the candidate areas whose pixel values exceed the specified range; based on the candidate areas, determine the outer contour corresponding to the candidate areas; and annotate the processed image based on the outer contour to obtain a training image.
[0074] In one embodiment, the upsampling unit includes at least a CA attention mechanism.
[0075] In one embodiment, the identification module 304 is also used to identify the sampled image through the identification unit to obtain pest information corresponding to the pest image; when the pest information meets the preset warning category, generate alarm information and control information corresponding to the pest information according to the pest information.
[0076] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.
[0077] Figure 4 A schematic block diagram of an example electronic device 400 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0078] like Figure 4 As shown, the device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the device 400 can also be stored. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0079] A number of components in the device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0080] The computing unit 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 401 performs the various methods and processes described above, such as the detection method of tea tree pests. For example, in some embodiments, the detection method of tea tree pests may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 400 via ROM 402 and / or communication unit 409. When the computer program is loaded into RAM 403 and executed by the computing unit 401, one or more steps of the detection method of tea tree pests described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to execute the method for detecting tea tree pests in any other appropriate manner (eg, by means of firmware).
[0081] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0082] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0083] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0084] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0085] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0086] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0087] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of this disclosure can be achieved, and this document is not limited here.
[0088] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0089] The above is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A method for detecting tea tree pests, characterized in that: The method comprises, Acquire an image to be tested, wherein the image to be tested at least includes an insect pest image; Acquire an insect pest recognition model, wherein the insect pest recognition model at least includes a downsampling unit, an upsampling unit, and a recognition unit; The image to be tested is input into the pest recognition model, and the down-sampling unit cuts the image to be tested to obtain a cut image, wherein the cut image includes the pest image; The up-sampling unit restores the size of the cut image to obtain a sampled image, so that the position of the pest image in the sampled image is the same as that in the image to be tested; The sampled image is identified by the identification unit to obtain pest information corresponding to the pest image and control information corresponding to the pest information.
2. The method for detecting tea tree pests according to claim 1, characterized in that: Before acquiring the image to be tested, the method further includes: Get photos of tea tree pests; The tea tree pest photo is cut into a specified size to obtain an image to be tested, and the image to be tested at least includes an insect pest image.
3. The method for detecting tea tree pests according to claim 1, characterized in that: The down sampling unit cuts the image to be tested, and obtaining the cut image includes: The downsampling unit extracts features from the pest image to obtain feature parameters corresponding to the pest image; The image to be measured is cut according to the characteristic parameters to obtain a cut image.
4. The method for detecting tea tree pests according to claim 1, characterized in that: The obtaining of the pest identification model comprises: Get training images; Dividing the training image into a specified ratio to obtain a training set, a validation set, and a test set; Training the model to be trained based on the training set and the verification set to obtain a trained model; The trained model is tested based on the test set, and when the detection accuracy of the trained model reaches a preset threshold, the trained model is determined as an insect pest recognition model.
5. The method for detecting tea tree pests according to claim 4, characterized in that: Get training images, including: Get a collection of photos of tea tree pests; Screening out tea tree pest photos with a resolution lower than a specified resolution from the tea tree pest photo collection to obtain tea tree pest images; Preprocessing the tea tree pest image to obtain a processed image; The processed image is annotated to obtain the training image.
6. The method for detecting tea tree pests according to claim 5, characterized in that: The preprocessing includes at least one or more of adding random noise, adjusting image brightness, randomly changing values of certain pixels, translating the image, and mirror-flipping the image.
7. The method for detecting tea tree pests according to claim 5, characterized in that: Annotating the processed image to obtain the training image includes: Identifying pixel values of the processed image and determining candidate regions whose pixel values exceed a specified range; Based on the candidate area, determining an outer contour corresponding to the candidate area; The processed image is annotated based on the outer contour to obtain the training image.
8. The method for detecting tea tree pests according to claim 1, characterized in that: The upsampling unit includes at least a CA attention mechanism.
9. The method for detecting tea tree pests according to any one of claims 1 to 8, characterized in that: The sampled image is identified by the identification unit to obtain a pest image corresponding to the pest image and control information corresponding to the pest image, including: The recognition unit recognizes the sampled image to obtain pest information corresponding to the pest image; When the pest information meets the preset warning category, alarm information and control information corresponding to the pest information are generated according to the pest information.
10. A tea tree pest detection device, characterized in that: The device comprises: An acquisition module, used for acquiring an image to be tested, wherein the image to be tested at least includes an insect pest image; The acquisition module is further used to acquire an insect pest recognition model, wherein the insect pest recognition model at least includes a downsampling unit, an upsampling unit and an identification unit; An input module, used for inputting the image to be tested into the pest recognition model, wherein the downsampling unit cuts the image to be tested to obtain a cut image, wherein the cut image includes the pest image; A restoration module, used for the up-sampling unit to restore the size of the cut image to obtain a sampled image, so that the position of the pest image in the sampled image is the same as that in the image to be tested; The recognition module is used to recognize the sampled image through the recognition unit to obtain pest information corresponding to the pest image and control information corresponding to the pest information.
