Method, device and equipment for identifying and counting alien invasive pests and storage medium

By performing label analysis and data augmentation processing on the initial pest data set, optimizing the model weight and data set, and training the target pest classification model, the problem of small and medium-sized target detection and category imbalance in foreign invasive pest identification is solved, and efficient and accurate pest identification and statistics are achieved.

CN120298753APending Publication Date: 2025-07-11HUBEI ENG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510291758.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-12
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

The prior art in the identification of foreign invasive pests, especially small target detection and category imbalance, has insufficient recognition accuracy and is difficult to meet the needs of real-time and accuracy.

Method used

By obtaining the initial pest data set for label analysis and normalization, the label pest data set is generated, and the data augmentation process is performed, the initial pest classification model is trained, the model weight is optimized using preset loss functions and random forest strategies, the data set is adjusted, and the target pest classification model is finally obtained to achieve the recognition and quantity statistics of real-time pest images.

Benefits of technology

It improves the accuracy and stability of the identification of foreign invasive pests, can quickly and accurately identify pest species and count the number, solves the problems of small target detection and category imbalance, and enhances the generalization ability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120298753A_ABST
    Figure CN120298753A_ABST
Patent Text Reader

Abstract

The invention discloses an alien invading pest identification and statistical method, device and equipment and a storage medium, relates to the technical field of alien invading pest monitoring, and discloses an alien invading pest identification and statistical method.The alien invading pest identification and statistical method comprises the steps that an initial pest data set is obtained, label analysis and normalization are conducted on the initial pest data, and label pest data are obtained; processing the label pest data to obtain processed data; training an initial pest classification model according to the processing data, and identifying the pest verification image according to the initial pest classification model to obtain a verification pest category identification result; adjusting the initial pest classification model according to the verified pest category identification result, and obtaining a target pest classification model according to the adjusted weight and the processing data set; and identifying the real-time pest image according to the target pest classification model to obtain a target pest category identification result, counting the quantity of the pests, and obtaining a pest statistical result, so that the types and quantity of the pests in the farmland can be accurately identified and counted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of alien invasive pest monitoring, and particularly to methods, devices, equipment, and storage media for identifying and counting alien invasive pests. Background Art

[0002] Alien invasive pests have a high degree of harm and a fast spread rate, posing a serious threat to the native ecological environment and agricultural production, and have become an important agricultural problem globally. Alien invasive pests have strong adaptability and lack natural enemy suppression, and are prone to rapidly reproduce in new environments and cause serious disasters, greatly affecting the growth of crops. Once crops are invaded by pests, their growth status and physiological functions will be severely damaged, resulting in hindered plant growth and the inability to reach the normal production state, thereby causing a decline in crop yields and serious agricultural economic losses.

[0003] Traditional alien invasive pest identification technologies mainly use traditional image processing methods and machine learning algorithms, such as support vector machines, K-nearest neighbors, and convolutional neural networks, to identify pests by combining artificial feature extraction with classification models. However, these methods rely on artificial experience in the feature extraction stage and are difficult to effectively capture the subtle features of pests. Especially for invasive pest targets with fewer samples and smaller sizes in the dataset, the model is prone to bias towards large-sample categories and ignores the feature learning of small-sample categories, resulting in insufficient recognition accuracy in the detection of small targets and minority categories, thus affecting the overall recognition accuracy and making it difficult to meet the real-time and accuracy requirements of large-scale alien invasive pest monitoring.

[0004] The above content is only used to assist in understanding the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main purpose of this application is to provide a method, device, equipment, and storage media for identifying and counting alien invasive pests, aiming to solve the technical problem of insufficient recognition accuracy in the identification of alien invasive pests in small target detection and class imbalance problems.

[0006] To achieve the above purpose, this application proposes a method for identifying and counting alien invasive pests, the method comprising:

[0007] Obtain an initial pest dataset, and perform label analysis and normalization on the initial pest data to obtain a labeled pest dataset;

[0008] Perform data processing on the labeled pest dataset to obtain a processed dataset;

[0009] Train an initial pest classification model according to the processed dataset, and identify a pest verification image according to the initial pest classification model to obtain a verification pest category recognition result;

[0010] Adjust the weights of the initial pest classification model and the processed data set according to the verified pest category recognition result, and train a target pest classification model based on the adjusted weights and the processed data set;

[0011] Identify the real-time pest image according to the target pest classification model to obtain a target pest category recognition result, and count the number of pests in the target pest category recognition result to obtain a pest statistics result.

[0012] In one embodiment, the steps of training the initial pest classification model according to the processed data set and identifying the pest verification image according to the initial pest classification model to obtain a verified pest category recognition result include:

[0013] Obtain a verified pest data set according to the ratio of the processed data set and the verification data set;

[0014] Obtain an initial pest classification model according to a preset loss function, a preset model, and a random forest strategy;

[0015] Verify the initial pest classification model according to the processed data set and the verified pest data set to obtain a verified pest category recognition result.

[0016] In one embodiment, the steps of obtaining an initial pest classification model according to a preset loss function, a preset model, and a random forest strategy include:

[0017] Train a decision tree based on the processed data set to obtain a classification result and a random forest classification model;

[0018] According to the ensemble learning strategy, comprehensively calculate the classification results to determine the target classification result;

[0019] Calculate the classification error according to the preset loss function;

[0020] Obtain an initial pest classification model according to the preset model, the random forest classification model, the target classification result, and the classification error.

[0021] In one embodiment, the steps of verifying the initial pest classification model according to the processed data set and the verified pest data set to obtain a verified pest category recognition result include:

[0022] Train the initial pest classification model according to the processed data set to obtain an initial training result;

[0023] Perform confusion recognition on the initial training result according to a confusion matrix and / or an enhanced regression tree to obtain a confusion recognition result;

[0024] Perform blank identification on the initial training result according to the verified pest dataset to obtain a blank identification result;

[0025] Obtain a verified pest category identification result according to the confusion identification result and the blank identification result.

[0026] In one embodiment, the step of adjusting the weights of the initial pest classification model and the processed dataset according to the verified pest category identification result, and training a target pest classification model based on the adjusted weights and processed dataset includes:

[0027] Obtain the error source and the target modified pest category according to the verified pest category identification result;

[0028] Adjust the hyperparameters and / or loss function weights of the initial pest classification model according to the error source to obtain an adjusted training model;

[0029] Modify the processed dataset according to the target modified pest category to obtain an optimized training dataset;

[0030] Train the adjusted training model according to the optimized training dataset to obtain a target pest classification model.

[0031] In one embodiment, the step of performing data processing on the labeled pest dataset to obtain a processed dataset includes:

[0032] Obtain a training pest dataset according to the labeled pest dataset and the training dataset ratio;

[0033] Perform light-dark conversion on the training pest dataset to obtain a light-dark training dataset;

[0034] Remove the background from the training pest dataset to obtain a background-removed dataset;

[0035] Rotate the training pest dataset to obtain a multi-angle dataset;

[0036] Add noise to the training pest dataset to obtain a noise-added dataset;

[0037] Obtain a processed dataset according to the light-dark training dataset, the background-removed dataset, the multi-angle dataset, and the noise-added dataset.

[0038] In one embodiment, the step of obtaining an initial pest dataset, and performing label analysis and normalization on the initial pest data to obtain a labeled pest dataset includes:

[0039] Obtain an initial pest dataset, and perform label analysis on the initial pest data to obtain an initial label dataset;

[0040] Based on the initial label data set, obtain the image height, image width, abscissa of the center point, and ordinate of the center point;

[0041] Normalize according to the image height, the image width, the abscissa of the center point, and the ordinate of the center point to obtain a labeled pest data set.

[0042] In addition, to achieve the above object, the present application also proposes an apparatus for identifying and counting alien invasive pests, the apparatus for identifying and counting alien invasive pests comprising: an acquisition module, configured to acquire an initial pest data set, and perform label analysis and normalization on the initial pest data to obtain a labeled pest data set;

[0043] A processing module, configured to perform data processing on the labeled pest data set to obtain a processed data set;

[0044] An identification module, configured to train an initial pest classification model according to the processed data set, and identify a pest verification image according to the initial pest classification model to obtain a verification pest category identification result;

[0045] An adjustment module, configured to adjust the weights of the initial pest classification model and the processed data set according to the verification pest category identification result, and train a target pest classification model according to the adjusted weights and processed data set;

[0046] A statistics module, configured to identify a real-time pest image according to the target pest classification model to obtain a target pest category identification result, and count the number of pests in the target pest category identification result to obtain a pest statistics result.

[0047] In addition, to achieve the above object, the present application also proposes an apparatus for identifying and counting alien invasive pests, the apparatus comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the method for identifying and counting alien invasive pests as described above.

[0048] In addition, to achieve the above object, the present application also proposes a storage medium, the storage medium being a computer-readable storage medium, on which a computer program is stored, the computer program, when executed by a processor, implementing the steps of the method for identifying and counting alien invasive pests as described above.

[0049] In addition, to achieve the above object, the present application also provides a computer program product, the computer program product comprising a computer program, the computer program, when executed by a processor, implementing the steps of the method for identifying and counting alien invasive pests as described above.

[0050] One or more technical solutions proposed in this application have at least the following technical effects:

[0051] By obtaining the initial pest dataset and performing label analysis and normalization on it, the dataset is ensured to be unified and standardized, providing high-quality data input for subsequent model training. The labeled pest dataset is further processed to obtain a processed dataset. The initial pest classification model after preliminary training is used to identify the validation images, generating class recognition results. Based on these results, the weights of the classification model are adjusted, and the dataset is further optimized. The adjusted data and weights are used to train the target pest classification model. By using the target pest classification model to identify real-time pest images, not only can the pest species be quickly and accurately identified, but also the number of each pest can be counted, forming a comprehensive pest statistics result. This solves the technical problem of insufficient recognition accuracy in small target detection and class imbalance in the identification of alien invasive pests. In the face of various factors such as a large variety of species, complex backgrounds, and light changes, the model can maintain high accuracy and stability. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] The drawings here are incorporated into the specification and form a part of this specification, showing embodiments consistent with this application and used together with the specification to explain the principles of this application.

[0053] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.

[0054] Figure 1 It is a schematic flowchart provided for Embodiment 1 of the method for identifying and counting alien invasive pests in this application;

[0055] Figure 2 It is a schematic diagram of the light and darkness conversion effect provided for Embodiment 1 of the method for identifying and counting alien invasive pests in this application;

[0056] Figure 3 It is a schematic diagram of the background removal effect provided for Embodiment 1 of the method for identifying and counting alien invasive pests in this application;

[0057] Figure 4 It is a schematic diagram of the rotation effect provided for Embodiment 1 of the method for identifying and counting alien invasive pests in this application;

[0058] Figure 5 It is a schematic diagram of the noise addition effect provided for Embodiment 1 of the method for identifying and counting alien invasive pests in this application;

[0059] Figure 6Schematic diagram of blank recognition provided for Embodiment 1 of the method for identifying and counting alien invasive pests in this application;

[0060] Figure 7 Schematic flowchart provided for Embodiment 2 of the method for identifying and counting alien invasive pests in this application;

[0061] Figure 8 Brief schematic flowchart of the method for identifying and counting alien invasive pests provided for Embodiment 2 of this application;

[0062] Figure 9 Schematic diagram of the module structure of the device for identifying and counting alien invasive pests in the embodiment of this application;

[0063] Figure 10 Schematic diagram of the device structure of the hardware operating environment involved in the method for identifying and counting alien invasive pests in the embodiment of this application.

[0064] The realization of the purpose, functional features and advantages of this application will be further described with reference to the embodiments and the accompanying drawings. Specific embodiments

[0065] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of this application and are not used to limit this application.

[0066] In order to better understand the technical solutions of this application, the following will be described in detail in combination with the accompanying drawings of the specification and specific embodiments.

[0067] The main solution of the embodiment of this application is: obtaining an initial pest data set, performing label analysis and normalization on the initial pest data to obtain a labeled pest data set; performing data processing on the labeled pest data set to obtain a processed data set; training an initial pest classification model according to the processed data set, and identifying a pest verification image according to the initial pest classification model to obtain a verification pest category recognition result; adjusting the weights of the initial pest classification model and the processed data set according to the verification pest category recognition result, and training a target pest classification model according to the adjusted weights and processed data set; identifying a real-time pest image according to the target pest classification model to obtain a target pest category recognition result, and counting the number of pests in the target pest category recognition result to obtain a pest statistics result.

[0068] In this embodiment, for the convenience of description, the following will be described with the device for identifying and counting alien invasive pests as the execution subject.

[0069] Due to the insufficient recognition accuracy of the existing technology for identifying alien invasive pests in small target detection and class imbalance problems, this application provides a solution. By obtaining an initial pest dataset and performing label analysis and normalization on it, the dataset is ensured to be unified and standardized, providing high-quality data input for subsequent model training. The labeled pest dataset is further processed to obtain a processed dataset. The initial pest classification model after preliminary training is used to identify the verification images, generating class recognition results. Based on these results, the weights of the classification model are adjusted, and the dataset is further optimized. The adjusted data and weights are used to train the target pest classification model. By using the target pest classification model to identify real-time pest images, not only can the pest species be quickly and accurately identified, but also the number of each type of pest can be counted, forming a comprehensive pest statistics result. This solves the technical problem of insufficient recognition accuracy of alien invasive pest identification in small target detection and class imbalance problems. When facing various factors such as a wide variety of species, complex backgrounds, and lighting changes, the model can maintain a high degree of accuracy and stability.

[0070] It should be noted that the execution entity of this embodiment can be a computing service device with data processing, network communication, and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device, an alien invasive pest identification and statistics device, etc. that can implement the above functions. Hereinafter, an alien invasive pest identification and statistics device will be taken as an example to illustrate this embodiment and the following embodiments.

[0071] Based on this, the embodiments of this application provide an alien invasive pest identification and statistics method, referring to Figure 1 , Figure 1 which is a schematic flowchart of the first embodiment of the alien invasive pest identification and statistics method of this application.

[0072] In this embodiment, the alien invasive pest identification and statistics method includes steps S10 to S50:

[0073] Step S10, obtain an initial pest dataset, and perform label analysis and normalization on the initial pest data to obtain a labeled pest dataset;

[0074] It should be noted that the initial pest dataset refers to a dataset containing various images of alien invasive pests collected. Usually, these data can be collected from actual farmlands or downloaded from official channels of existing images. The initial pest dataset contains images of different types of pests and is used for subsequent model training.

[0075] Additionally, label analysis involves screening and analyzing the labels in the dataset to ensure the quality of dataset classification and existing categories, and identifying potential problems such as class imbalance, so as to take measures to balance the dataset, improve the performance of the model during training, reduce bias, and enhance the generalization ability of the model.

[0076] Additionally, normalization is a data processing method aimed at converting data into a unified scale to avoid affecting the subsequent training process due to inconsistent data dimensions. In the normalization of image data, a common practice is to adjust pixel values to the range of 0 to 1, or to unify the size of the image to a certain standard size so that the neural network can process it effectively.

[0077] It can be understood that by obtaining the initial pest dataset, the source of the input data for training the model can be ensured. Conducting label analysis, that is, classifying and annotating each image in the dataset to clarify the types of pests existing in the dataset. The normalization process is to standardize the labels and image data of all images so that these data can adapt to the subsequent deep learning model training process. Finally, the standard data obtained is the labeled pest dataset.

[0078] In a feasible implementation manner, step S10 may include steps S11 to S13:

[0079] Step S11, obtaining the initial pest dataset and performing label analysis on the initial pest data to obtain the initial label dataset;

[0080] It should be noted that the initial label dataset refers to the dataset containing pest types and location information obtained after label analysis. It contains the types of each pest in the image for model training.

[0081] Additionally, the YOLO (You Only Look Once) label is a specific format of annotation used for training data in object detection tasks. In the YOLO format, each label contains the digital encoding of the object category and the position information of the object in the image, usually represented by a rectangular box. Specifically, the YOLO label includes the number of the object category, the center coordinates (x, y) of the bounding box, the width and height of the bounding box.

[0082] It can be understood that in order to enable the dataset to be directly used for the training of the YOLO model, the labels need to be converted into the YOLO format so that the model can correctly understand the data and train efficiently. After screening out the labeled data, the labels are normalized to meet the YOLO label format, that is, the category.

[0083] Step S12: Obtain the image height, image width, abscissa of the center point, and ordinate of the center point according to the initial label dataset.

[0084] It should be noted that the image height refers to the size of the image in the vertical direction, usually expressed in pixels. In the object detection task in deep learning, the image height is an important parameter describing the size and resolution of the image content. Additionally, the image width refers to the size of the image in the horizontal direction, also expressed in pixels. Similar to the image height, the image width describes the size of the image content and affects the format of the input image for the model. Additionally, the abscissa of the center point refers to the coordinate of the center point of the labeled pest bounding box in the horizontal direction in the image. This coordinate is usually a relative position of the image width and is used to locate the specific position of the pest in the image. Additionally, the ordinate of the center point refers to the coordinate of the center point of the labeled pest bounding box in the vertical direction in the image. It is used to locate the vertical position of the pest in the image and, together with the abscissa, determines the position of the pest.

[0085] It can be understood that according to the initial label dataset, the image height and image width of each image are extracted, and these two parameters describe the size of the image. The abscissa of the center point of the pest and the ordinate of the center point are extracted from the labels, that is, the center point position of the rectangle where the pest is located. Through these coordinates, the relative position of the pest in the image can be further analyzed.

[0086] Step S13: Normalize according to the image height, the image width, the abscissa of the center point, and the ordinate of the center point to obtain the labeled pest dataset.

[0087] It can be understood that the image height, image width, abscissa of the center point, and ordinate of the center point extracted in Step S12 are used for normalization. The center point coordinates of the pest are divided by the width and height of the image, so as to scale all coordinate values to the range between 0 and 1. For example, if the width of the image is 1000 pixels and the abscissa of the center point of the pest is 500 pixels, then the normalized value of the abscissa is 0.5. In this way, the coordinates of all images become standardized relative positions.

[0088] Step S20: Perform data processing on the labeled pest dataset to obtain the processed dataset.

[0089] It can be understood that data processing refers to operations such as cleaning, transforming, and augmenting the original data to ensure that the data quality meets the requirements of model training. Common data processing methods include removing noise, handling missing data, and increasing data diversity. The goal of data processing is to make the data more in line with the needs of the model and improve the training effect.

[0090] It should be noted that the processed dataset is the final dataset obtained after data processing steps. After being processed such as cleaning and augmentation, this dataset is more suitable for training deep learning models and can improve the adaptability and accuracy of the models to different situations.

[0091] In addition, it can be understood that the processed dataset will be further processed. The processing content can include removing duplicate data, correcting label errors, and data augmentation to make the dataset more in line with the requirements of deep learning. For example, data can be augmented by rotating images, adjusting brightness, changing backgrounds, etc., to ensure that the model can learn effective features from various situations.

[0092] In a feasible implementation manner, step S20 may include steps S21 to S26:

[0093] Step S21, obtaining a training pest dataset according to the ratio of the labeled pest dataset and the training dataset;

[0094] It should be noted that the training dataset ratio refers to the proportion of the entire dataset allocated to the training set, validation set, and test set, where the training set accounts for the proportion. In this embodiment, 60% of the labeled pest dataset is divided into the training set, 20% of the labeled pest dataset is divided into the validation set, and 20% of the labeled pest dataset is divided into the test set.

[0095] It can be understood that the training pest dataset is a dataset screened from the labeled pest dataset according to the set training dataset ratio. It contains all the image data for training the model and their corresponding label information.

[0096] Step S22, performing light-dark conversion on the training pest dataset to obtain a light-dark training dataset;

[0097] It can be understood that light-dark conversion is a technology in image processing, aiming to change the brightness and contrast of images. By adjusting the lighting conditions of images, different lighting environments can be simulated, enabling the model to better adapt to different shooting conditions and enhancing its generalization ability.

[0098] It should be noted that the light-dark training dataset is the dataset after light-dark conversion processing. By changing the brightness and contrast of the images in the training dataset, new image samples are generated for model training.

[0099] In addition, it can be understood that the light-dark conversion is performed on the training pest dataset. By randomly adjusting the brightness and contrast of each image, images under different lighting conditions can be simulated, increasing the diversity of the dataset. For example, some images can be brightened while some can be darkened. This processing method helps the model adapt to different lighting conditions and improves the stability and robustness of the model.

[0100] Refer to Figure 2 , Figure 2 which is a schematic diagram of the light-dark conversion effect provided by the first embodiment of the method for identifying and counting invasive pests in this application.

[0101] As Figure 2 shown, the second part of the image is the original image, the first part has its brightness increased through brightening processing, and the third part is the image after darkening processing with reduced brightness. This process adjusts the brightness and contrast of the image, enabling the model to learn and identify the target object under different lighting conditions, thereby improving the adaptability of the model.

[0102] Step S23: Remove the background from the training pest dataset to obtain a background-removed dataset;

[0103] It can be understood that background removal is an image processing method aimed at removing irrelevant background information in the image and only retaining the pest images in the image. Background removal can extract the pests from the background through image segmentation technology or other methods, reducing the interference of background noise on model training.

[0104] It should be noted that the background-removed dataset is an image dataset after background removal processing. After processing, these images will only contain the target pests and their positions, removing the cluttered background in the original images.

[0105] In addition, it can be understood that the training pest dataset is processed to remove the background. The purpose of this process is to extract the main body of the pests from each image and remove the irrelevant background content, so that the model can focus more on the pests themselves during training without being interfered by the background.

[0106] Refer to Figure 3 , Figure 3 which is a schematic diagram of the background removal effect provided by the first embodiment of the method for identifying and counting invasive pests in this application.

[0107] As Figure 3 shown, the left side is the original image, and the right side is the image after background removal processing. During the background removal process, the pests in the image are retained while the surrounding background is removed, making the pests more prominent. This processing helps reduce the interference of the background on model training, enables the model to focus more on identifying pests, and improves the recognition accuracy.

[0108] Step S24: Rotate the training pest dataset to obtain a multi-angle dataset;

[0109] It can be understood that rotation is a method of image enhancement aimed at changing the angle of an image. By rotating the image, pest images at different angles can be simulated, enabling the model to adapt to the recognition of pests in different poses.

[0110] It should be noted that the multi-angle dataset is a new dataset obtained by rotating the images in the training pest dataset. The rotation angle of each image is random, simulating the situation when pests are observed from different angles.

[0111] In addition, it can be understood that the images in the training pest dataset are rotated. By randomly rotating the images (such as ±90 degrees, ±180 degrees, etc.), pest images observed from different angles are generated. The rotated images will be used as new samples for the model during training.

[0112] Refer to Figure 4 , Figure 4 which is a schematic diagram of the rotation effect provided by Embodiment 1 of the method for identifying and counting alien invasive pests in this application.

[0113] As Figure 4 shown, the original image is on the left, and the rotated image is on the right. Through rotation, the pests in the image present different angles, enabling the model to adapt to pest images in different poses. This data augmentation method helps the model learn how to identify pests observed from different angles, improving the generalization ability and accuracy of the model.

[0114] Step S25: Add noise to the training pest dataset to obtain a noisy dataset;

[0115] It can be understood that adding noise is a type of image enhancement technique that simulates different shooting conditions by adding random noise to an image. Adding noise can help the model adapt to interference factors in the image, thereby improving its robustness.

[0116] It should be noted that the noisy dataset is a dataset processed by adding noise. By randomly adding noise to the image, new samples are generated, enabling the model to be trained in a more complex and noise-interfered environment.

[0117] In addition, it can be understood that the training pest dataset is processed by adding noise. This step adds a certain amount of noise to the image to simulate different shooting environments and image qualities. For example, it simulates images collected under poor lighting, unstable shooting equipment, or other interferences.

[0118] Refer toFigure 5 , Figure 5 A schematic diagram of the noise addition effect provided in Example 1 of the alien invasive pest identification and statistical method of the present application.

[0119] like Figure 5 As shown in the figure, the left side is the original image, and the right side is the image after noise addition. In the process of noise addition, random noise is added to the image, which causes the image quality to deteriorate and shows more interference information. Through this processing, the environmental noise that may be encountered in actual shooting can be simulated, helping the model to improve its robustness under noise interference conditions and enhance its adaptability to undesirable shooting conditions.

[0120] Step S26, obtaining a processed data set according to the light and dark training data set, the background removal data set, the multi-angle data set and the noise addition data set.

[0121] It is understandable that the datasets processed by the light and dark training dataset, the background removal dataset, the multi-angle dataset, and the noise dataset are merged to obtain a processed dataset. This dataset will contain a variety of data-enhanced images for the model to use during training. By merging datasets processed by different enhancement methods, the diversity of the dataset can be increased, allowing the model to be trained in a more complex and changeable environment. This dataset can improve the generalization ability of the model and improve the accuracy and stability of the model in practical applications.

[0122] Step S30, training an initial pest classification model according to the processed data set, and identifying the pest verification image according to the initial pest classification model to obtain a verification pest category identification result;

[0123] It can be understood that training the initial pest classification model means using the processed data set to train the data set through YOLOv5 to build a preliminary classification model. The task of this model is to identify the pest species in the input image.

[0124] It should be noted that pest verification images refer to a part of the data set used to evaluate model performance during model training. These data do not participate in model training, but are only used to check the recognition effect of the model and help judge the accuracy and generalization ability of the model.

[0125] In addition, the verification pest category recognition result refers to the pest types recognized by the model in the verification image and their locations in the image. This result usually includes the category label and bounding box coordinates of each pest.

[0126] In addition, it can be understood that a preliminary pest classification model is trained using a processed dataset. After training is completed, the model is tested using unseen validation images to obtain the recognition results of pest species. The purpose of this process is to evaluate the accuracy of the initial model. The pest species and locations in the validation images are compared with the model recognition results to verify whether the model can effectively identify the pests in the images. For example, if there is a beet armyworm in the validation image, the model should be able to accurately identify and mark its location.

[0127] In a feasible implementation manner, step S30 may include steps S31 to S33:

[0128] Step S31, obtaining a validation pest dataset according to the processed dataset and the validation dataset ratio;

[0129] It should be noted that the validation dataset ratio refers to the proportion of data allocated to the validation set during the dataset division process. In this embodiment, the validation dataset ratio is 20%.

[0130] It can be understood that according to the set validation dataset ratio, a validation pest dataset is selected from the processed dataset. The validation dataset ratio is 20%. The validation pest dataset is used to regularly evaluate the performance of the model during the model training process to ensure the training quality of the model. If the validation set data ratio is set reasonably, it can help discover problems in the training process, such as overfitting or underfitting.

[0131] Step S32, obtaining an initial pest classification model according to a preset loss function, a preset model, and a random forest strategy;

[0132] It should be noted that the loss function is a function used in deep learning models to measure the difference between the model prediction results and the actual labels. The goal of the loss function is to minimize the error, enabling the model to gradually adjust its parameters during training for more accurate prediction. Common loss functions include cross-entropy loss function, mean squared error loss function, etc. In this embodiment, the preset loss function is GIOU Loss.

[0133] In addition, the preset model refers to the architecture or algorithm determined before model training. In the pest classification problem, the preset model may be a deep convolutional neural network (CNN) or other models suitable for image classification, such as object detection models like YOLO. The preset model provides a preliminary framework for training, and its performance is optimized through subsequent training. In this embodiment, the preset model is YOLOv5.

[0134] Additionally, the Random Forest (RF) strategy refers to enhancing the stability and accuracy of a classification model through training multiple decision trees and performing ensemble learning. The Random Forest strategy includes bootstrap sampling (Bagging), random feature selection, and a voting mechanism. Specifically, multiple subsets are randomly sampled from the training data, and multiple decision trees are trained separately to reduce the overfitting risk of a single decision tree. During the splitting process of each decision tree, a partial set of features is randomly selected for decision-making to improve the generalization ability of the model. The final classification result is determined by voting of all decision trees, with the minority obeying the majority, to improve the stability and accuracy of classification.

[0135] Additionally, the initial pest classification model refers to the initial version of the pest classification model obtained through preliminary training based on a preset loss function and a preset model. This model usually has not yet achieved the optimal effect, but it provides a basis for subsequent optimization and adjustment.

[0136] It can be understood that the preset loss function is used to optimize the object detection ability of YOLOv5, enabling it to more accurately identify the pest category and location. Then, using YOLOv5 as the preset model, the processed dataset is trained to extract the visual features of the pests and generate preliminary detection results (including the category and location information of the pests). Subsequently, in combination with the Random Forest strategy, the classification results of YOLOv5 are further input into the Random Forest model, and multiple decision trees are used to optimize and adjust the classification results. Each decision tree uses a different combination of features to ensure the robustness of the model, and finally the final classification result is determined through the voting mechanism. After training is completed, the initial pest classification model is output for subsequent verification and optimization.

[0137] In a feasible implementation manner, step S32 may include steps S321 to S324:

[0138] Step S321, training a decision tree based on the processed dataset to obtain a classification result and a Random Forest classification model;

[0139] It should be noted that a decision tree is a classification algorithm based on a tree structure. By recursively partitioning the data space, a series of decision rules are established to finally achieve the classification task. In the pest classification task, the decision tree will split according to the features of the pests, such as morphological features, color, size, etc., and generate a set of classification rules, enabling the model to predict the category based on the features of the input image.

[0140] Additionally, the classification result refers to the category information output after the decision tree classifies the input pest image, including the category label of each pest and the corresponding confidence level. The quality of the classification result directly affects the subsequent model optimization process, so it needs to be further optimized by combining multiple decision trees.

[0141] Additionally, the random forest classification model is an ensemble learning method consisting of multiple independently trained decision trees. It improves the classification accuracy and generalization ability by combining the prediction results of multiple decision trees. In this step, the random forest learns the classification features of pests by training multiple decision trees and uses a voting mechanism to obtain a more robust classification model.

[0142] It can be understood that the images and label information of pests are extracted from the processed dataset and used to train multiple decision trees. Each decision tree analyzes the data features, learns the pest classification rules, and independently generates classification results. These multiple trained decision trees are integrated into the random forest classification model to reduce the overfitting risk of a single decision tree and improve the robustness and stability of the model. The random forest classification model aggregates the prediction results of multiple decision trees to provide basic data for subsequent classification optimization.

[0143] Step S322: According to the ensemble learning strategy, comprehensively calculate the classification results to determine the target classification result;

[0144] It should be noted that the ensemble learning strategy is a machine learning method that constructs a stronger classification model by combining multiple decision trees. In the random forest classification model, the ensemble learning strategy integrates the classification results of multiple decision trees through voting or weighted averaging to finally obtain a stable classification output.

[0145] Additionally, the target classification result refers to the final pest category determined after comprehensively calculating multiple classification results under the action of the ensemble learning strategy. The determination method of the target classification result usually includes the majority voting method (majorityvoting) or the weighted averaging method to ensure the stability and accuracy of classification.

[0146] It can be understood that the ensemble learning strategy is used to optimize the classification results in step S321. Multiple decision trees in the random forest each classify the input image and output their respective predicted categories. The classification results of all decision trees are statistically analyzed, and the majority voting method or the weighted averaging method is used to determine the target classification result. For example, if 7 out of 10 decision trees predict an image as "Hyphantria cunea" and 3 predict it as "Tuta absoluta", then the final target classification result will be determined as "Hyphantria cunea".

[0147] Step S323: Calculate the classification error according to the preset loss function;

[0148] It should be noted that the classification error refers to the deviation between the pest category predicted by the model and the actual category. The magnitude of the classification error determines the optimization direction of the model. A larger error means that the model needs to be further adjusted to improve the classification accuracy.

[0149] It is understandable that the classification error of the model is calculated using a preset loss function. The target classification result is compared with the true label and input into the loss function for calculation. The error distribution is analyzed to determine which categories have relatively large classification errors, so as to optimize in subsequent steps. For example, if it is calculated that the model has a high error in the recognition of "codling moth", more learning on this category is required in the next training step.

[0150] Step S324: Obtain an initial pest classification model according to the preset model, the random forest classification model, the target classification result, and the classification error.

[0151] It is understandable that by integrating the object detection ability of the preset model (YOLOv5) and the classification optimization ability of the random forest classification model, and by combining the target classification result and the classification error, a more accurate pest classification model is trained. Use YOLOv5 for object detection to extract pest category information; input the output of YOLOv5 into the random forest model for further classification, and adjust the model parameters by combining the previously calculated classification error, and finally output the initial pest classification model.

[0152] Step S33: Verify the initial pest classification model according to the processed data set and the verified pest data set to obtain the verified pest category recognition result.

[0153] It is understandable that the verified pest category recognition result is the prediction result made by the model on the verification data set, including the pest category and its location in each image in the object detection task. The verified pest category recognition result is used to evaluate the accuracy and robustness of the model in practical applications. According to the initial pest classification model, it is applied to the processed data set and the verified pest data set for verification. By running the model on the verification set, the verified pest category recognition result of each sample is obtained. These results will include the category and possible location information of the pests in each image, which are used to evaluate the recognition ability of the model.

[0154] In a feasible implementation manner, step S33 may include steps S331 to S334:

[0155] Step S331: Train the initial pest classification model according to the processed data set to obtain an initial training result;

[0156] It should be noted that the initial pest classification model refers to the first version of the model trained based on the processed data set. It is still in the initial stage of training and usually requires further optimization and adjustment. Additionally, the initial training result refers to the output result after training the initial pest classification model using the processed data set, including indicators such as the prediction accuracy and loss function value of the model.

[0157] It is understandable that the initial pest classification model is trained using a processed dataset. Through training, the model learns the characteristics of pest images, enabling it to make preliminary classification predictions. During the training process, the loss for each prediction is calculated, and the weights of the model are adjusted according to the results of the loss function. Finally, the system obtains the initial training results, which typically include indicators such as the loss value and accuracy of the model, reflecting the performance of the model on the training set.

[0158] Step S332, perform confusion identification on the initial training results according to the confusion matrix and / or the boosted regression tree to obtain a confusion identification result;

[0159] It should be noted that the confusion matrix is a tool for evaluating the performance of a classification model, showing the relationship between the model's prediction results and the actual labels. It usually contains four indicators: true positives (TP), false positives (FP), true negatives (TN), and false negatives (FN). Through the confusion matrix, it is possible to analyze in detail which categories the model performs well in and which categories it makes mistakes in. Confusion identification is to evaluate the identification effect of the model in each category by analyzing the confusion matrix. Confusion identification checks the prediction results for each category to identify cases where the model misclassifies. Additionally, the confusion identification result is the evaluation result of the model's classification performance obtained through confusion matrix analysis, usually including the accuracy of the model in different categories, the cases of misclassification, and the direction for model optimization.

[0160] Additionally, the Boosted Regression Trees (BRT) is a classification method that combines Gradient Boosting (GB) and Regression Trees (RT). Compared with traditional decision trees or random forests, BRT iteratively trains multiple regression trees, paying attention to the classification errors in the previous round during each training, thus continuously optimizing the model to classify pest categories more accurately.

[0161] It can be understood that confusion recognition refers to identifying, based on the confusion matrix and / or the misclassification situation of the boosted regression tree (BRT) analysis model, which pest categories are prone to misclassification and the specific patterns of misclassification. For example, if the codling moth is often misidentified as the fall webworm, confusion recognition will identify the features that lead to this error for subsequent optimization. First, the confusion matrix is used to analyze the classification errors of the initial training results. By calculating the false positives (FP) and false negatives (FN) in the confusion matrix, it is identified which pest categories have a higher misclassification rate. For example, if the confusion matrix shows that the tomato leafminer is often misclassified as the codling moth, then the model may need to further optimize the feature learning for this category. If further detection is required, the boosted regression tree (BRT) can be used to further analyze and optimize the classification error of the model. BRT will focus on the samples misclassified by the model and generate new classification rules to enable the model to more accurately identify these categories in subsequent training. For example, if BRT finds that the model has a large error in the classification of the codling moth, then in the next round of training, the learning for this category will be strengthened to optimize its classification accuracy.

[0162] Step S333, perform blank recognition on the initial training results according to the verified pest dataset to obtain a blank recognition result;

[0163] It should be noted that blank recognition refers to analyzing the blank categories in the model prediction results. Blank categories usually refer to the categories that the model fails to identify or the targets that the model does not predict. In this case, blank recognition mainly focuses on the performance of the model on these unpredicted categories. Additionally, the blank recognition result refers to the feedback obtained during the blank recognition process, mainly the categories or images that the model fails to correctly identify. This result can help us understand which categories or features the model cannot effectively detect and then improve.

[0164] It can be understood that the verified pest dataset is used to perform blank recognition on the initial training results. Through blank recognition, the pest categories or images that the model fails to identify in the verification dataset are found. This helps to evaluate the performance of the model on some more difficult or rarer categories.

[0165] Refer to Figure 6 , Figure 6 FIG. is a schematic diagram of blank recognition provided for Embodiment 1 of the method for identifying and counting alien invasive pests in this application.

[0166] Such as Figure 6As shown, the model successfully identified several pests, which were marked with blue boxes. However, there are also some cases of insufficient identification in the model. For example, two large bugs were not correctly identified, and the identification effect of some categories is not good. Through this blank identification, the categories or images that the model failed to identify can be identified, so as to provide a basis for further optimization and adjustment, and improve the accuracy and comprehensiveness of the model.

[0167] Step S334, obtain the verified pest category identification result according to the confusion identification result and the blank identification result.

[0168] It can be understood that by combining the confusion identification result and the blank identification result, the final verified pest category identification result is obtained. This result comprehensively considers the identification performance of the model on different categories, including its accuracy on the validation set and which categories are misclassified or omitted. Through the comprehensive analysis of these results, the model can be further optimized to improve its accuracy in practical applications.

[0169] Step S40, adjust the weights of the initial pest classification model and the processed data set according to the verified pest category identification result, and train to obtain a target pest classification model according to the adjusted weights and processed data set;

[0170] It can be understood that adjusting the weights of the initial pest classification model means modifying the parameters of the model during the training process to make it more suitable for the identification task. The weight adjustment is completed through the backpropagation algorithm, and the goal is to minimize the loss function of the model, thereby improving the identification accuracy of the model.

[0171] In addition, adjusting the processed data set means further optimizing and correcting the training data set according to the identification results in the verification images. Specifically, based on the performance of the model on the verification images, identify which parts of the training data or labels need to be improved, so as to improve the accuracy and generalization ability of the model. After preliminary training and evaluation using verification images, the model may expose some problems, such as inaccurate identification of certain categories or overfitting to certain samples. Then it is necessary to optimize the training data set according to the verification results.

[0172] It should be noted that the target pest classification model is a model for identifying the types of pests required for actual applications after weight adjustment. After multiple rounds of training and optimization, this model can more accurately identify the target pests.

[0173] It can be understood that the initial classification model is optimized and adjusted according to the recognition results in the verification images. According to the verification results, it can be found that the model has inaccurate recognition or large deviations in some categories. By adjusting the weights of the model and improving the learning ability of the model, an optimized target pest classification model can be obtained. For example, if the initial model cannot well recognize a certain type of small pest, its accuracy can be improved by increasing the training data of this category or modifying the learning strategy of the model.

[0174] Step S50: Identify the real-time pest image according to the target pest classification model to obtain the target pest category recognition result, and count the number of pests in the target pest category recognition result to obtain the pest statistics result.

[0175] It should be noted that the real-time pest image refers to the pest image collected in real time by an image acquisition device in an agricultural environment. The real-time pest image is used for online detection and identification of exotic invasive pest species.

[0176] In addition, the pest category recognition result refers to the type and location of each pest identified after the model classifies the real-time captured pest image.

[0177] In addition, the pest quantity statistics refers to counting the quantity of each type of pest according to the recognition result of the classification model. The statistical result is usually presented as the quantity of each type of pest to help evaluate the severity of the pest damage.

[0178] It can be understood that the target pest classification model will be applied to the real-time pest image for pest identification. The model will detect the pests in each image and output the type and location of each type of pest. Then, by counting these recognition results, the quantity of each type of pest, that is, the pest quantity statistics, can be obtained. For example, the model may identify 10 fall webworms, 5 codling moths, and 3 tomato leafminers in an image, and the statistical result will show the quantities of these pests. Through real-time image recognition and quantity statistics, the types and quantities of pests in the farmland can be quickly and accurately grasped, helping agricultural personnel take timely control measures to reduce the impact of pests on crops.

[0179] In a feasible implementation manner, step S50 may include steps S51 to S53:

[0180] Step S51: Obtain the pest category information according to the target pest category recognition result;

[0181] It should be noted that the pest category information refers to the category data of each pest extracted from the target pest category recognition result. These information usually include the name or category label of the pest and can be used for subsequent statistics and analysis.

[0182] It can be understood that according to the target pest category recognition results, the category information of each recognized pest is extracted. That is, the species of each pest is extracted from the category recognition results of each pest. These information provide data support for subsequent statistical work. For example, if the recognition results include "Hyphantria cunea" and "Cydia pomonella", the category information of these pests will be extracted.

[0183] Step S52: Establish an index based on the pest category information to obtain a category index.

[0184] It should be noted that an index is a data structure used for quickly searching and storing information. The purpose of establishing an index is to establish an efficient search structure through the pest category information, so that relevant category data can be quickly accessed during subsequent statistics or analysis. Additionally, a category index refers to a data structure constructed based on the pest category information, which records the index positions of each pest species. In subsequent steps, the category index can be used to quickly access the data of a certain category or conduct statistics.

[0185] It can be understood that based on the extracted pest category information, a category index is established. By assigning a unique index to each pest species, the information of that category can be quickly searched and obtained from the data. The advantage of doing this is that it can efficiently manage and operate a large amount of pest recognition data. Especially during statistics and analysis, the search time can be reduced.

[0186] Exemplarily, in a certain farmland image, through the recognition of the target pest classification model, three invasive alien pests, namely "Hyphantria cunea", "Cydia pomonella", and "Tuta absoluta", are recognized. In the results returned by the model, the category information of each pest includes their species and locations. According to these pest category information, a unique index can be assigned to each pest. For example, "Hyphantria cunea" is assigned index 1, "Cydia pomonella" is assigned index 2, and "Tuta absoluta" is assigned index 3. In this way, the system can create a category index, recording the category index and its location of each pest. Thus, when subsequent pest quantity statistics or further analysis are required, the corresponding pest category can be quickly located through the category index, improving the efficiency of data processing.

[0187] Step S53: Statistically count the pest quantity based on the category index and the target pest category recognition results to obtain a pest statistical result.

[0188] It should be noted that the pest statistical result refers to the final numerical result obtained by statistically counting the number of pests in each category. The statistical result usually includes the number of each pest species, which is used to evaluate the types and densities of pests.

[0189] It is understandable that, by combining the category index and the recognition result of the target pest category, the pests in the image are counted. Specifically, the system will look up the category of each pest according to the category index, and obtain the pest statistics result by counting the number of occurrences of each category. For example, if the category "Hyphantria cunea" appears 5 times and the category "Cydia pomonella" appears 3 times, the pest statistics result will show the quantity of each category.

[0190] Exemplarily, in a farmland image, the target pest classification model identifies three invasive alien pests, namely "Hyphantria cunea", "Cydia pomonella" and "Tuta absoluta", and marks the category information of each pest. According to the previously established category index, the index of Hyphantria cunea is 1, the index of Cydia pomonella is 2, and the index of Tuta absoluta is 3. After statistics, the model finds that Hyphantria cunea appears 5 times, Cydia pomonella appears 3 times, and Tuta absoluta appears 2 times. Finally, based on the category index and the recognition result of the target pest category, the pest quantity is statistically obtained as: 5 Hyphantria cunea, 3 Cydia pomonella, and 2 Tuta absoluta. This statistical result can provide real-time pest quantity information for agricultural management and help to take effective control measures.

[0191] This embodiment provides a method for identifying and counting invasive alien pests. By obtaining an initial pest data set and performing label analysis and normalization processing, and combining data enhancement technologies such as light-dark conversion, background removal, rotation, and noise addition to generate a high-quality processed data set, and then training an initial pest classification model, and adjusting the model weights and optimizing the data set according to the verification results, finally a target pest classification model is obtained. This model can accurately identify and count real-time pest images, providing an efficient and accurate technical means for monitoring invasive alien pests, achieving the beneficial effects of improving the pest recognition accuracy, enhancing the model generalization ability, and improving the management efficiency of invasive alien pests.

[0192] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar content as that in the above-mentioned first embodiment can be referred to the above introduction and will not be repeated hereinafter. On this basis, please refer to Figure 7 , step S40 of the method for identifying and counting invasive alien pests further includes steps S41 to S44:

[0193] Step S41, obtaining the error source and the target modified pest category according to the verified pest category recognition result;

[0194] It should be noted that the error source refers to the reason for the error in the model during the verification process, which may be caused by factors such as incorrect data labels, overfitting of the model, and insufficient training data. Identifying the error source helps to accurately find the weaknesses of the model and provide a direction for subsequent improvement.

[0195] Additionally, the target modified pest category refers to modifying the pest categories that the model fails to recognize or misidentifies according to the error sources of the model, adjusting the model's recognition ability, and ensuring that the model can correctly recognize all pest species.

[0196] It can be understood that based on the verification of the pest category recognition results, the system analyzes the errors of the model and identifies the error sources. For example, the model may perform poorly on certain small-sample categories or images with complex backgrounds. At the same time, the system will determine the target modified pest categories according to the error sources. For example, if certain pest categories are frequently misidentified, they will be targeted for adjustment.

[0197] Step S42: According to the error source, adjust the hyperparameters and / or loss function weights of the initial pest classification model to obtain an adjusted training model;

[0198] It should be noted that hyperparameters refer to the parameters set before training the model, such as the learning rate, batch size, number of network layers, etc. The selection of hyperparameters has an important impact on the training effect of the model. Additionally, the loss function weights refer to the different weights given to various losses, such as misclassification loss, positive and negative sample imbalance, etc., during the model optimization process. By adjusting the loss function weights, the model can pay more attention to certain specific problems or categories during the optimization process. Additionally, the adjusted training model refers to retraining the model by modifying settings such as hyperparameters and loss functions after discovering model problems. The goal is to improve the model's recognition ability, especially for optimizing the error sources and target modified categories.

[0199] It can be understood that based on the error source, the hyperparameters and / or loss function weights of the initial pest classification model will be adjusted. For example, if the model performs poorly in recognizing certain pest categories, it may be necessary to increase the learning rate, adjust the optimizer, or redesign the loss function to increase the model's attention to this category, thereby obtaining an adjusted training model.

[0200] Exemplarily, during the verification process, the accuracy of the model in recognizing the fall webworm is relatively low, mainly because the number of samples of this category is small, resulting in overfitting or inaccurate recognition of the model. After analyzing the error source, it is found that the loss function did not pay sufficient attention to the minority categories during training, resulting in the model not having enough learning opportunities to recognize the fall webworm. To adjust the model, it is decided to modify the loss function weights to increase the loss weight of the fall webworm category. This will make the model pay more attention to the recognition of the fall webworm during the training process. In addition, hyperparameters may also be adjusted, such as reducing the learning rate, to ensure that the model can adjust the parameters more carefully, thereby avoiding overfitting in this category. In this way, the adjusted model will better recognize the fall webworm and improve its performance on other minority categories.

[0201] Step S43: Modify the processed data set according to the target modified pest category to obtain an optimized training data set.

[0202] It should be noted that the optimized training data set refers to modifying and optimizing the data set according to the requirements of the target modified pest category to improve the effect of model training. For example, it may be necessary to increase the samples of minority categories or re-label the categories with misidentified data, so as to make the training data more representative and diverse.

[0203] It can be understood that the pest category is modified according to the target, and the original processed data set is modified to obtain an optimized training data set. This optimization process may include increasing the samples of specific categories, re-labeling the data or applying other enhancement techniques to ensure that all category features can be fully learned during model training.

[0204] Exemplarily, during the verification process, the model's recognition performance for the category of "codling moth" is poor because there are few samples of this category in the training data set, resulting in the model being unable to fully learn its features. To improve this problem, it is decided to take "codling moth" as the target modified pest category. To optimize the processed data set, the sample size of the "codling moth" category is increased through data enhancement techniques. For example, more diverse "codling moth" images are generated by rotating, adjusting brightness and cropping, etc., and at the same time, images under other different environmental conditions are added to improve the model's recognition ability for this category. In addition, some images of "codling moth" also need to be re-labeled to ensure the accuracy of the labels. Finally, an optimized training data set is obtained, which can help the model better identify "codling moth" and other categories.

[0205] Step S44: Train the adjusted training model according to the optimized training data set to obtain a target pest classification model.

[0206] It can be understood that the adjusted training model is continuously trained using the optimized training data set to obtain a target pest classification model. Through this step, a more accurate classification model is generated based on the improved training data and adjusted model parameters. This model can better identify different types of pests, especially in the specifically modified categories, and shows more excellent performance. The adjusted and optimized training process can improve the classification effect of the final model. Through the meticulous optimization of the data set and model parameters, the target pest classification model can provide higher recognition accuracy and stronger generalization ability in practical applications.

[0207] This embodiment provides a method for identifying and counting alien invasive pests. By analyzing and verifying the pest category recognition results to determine the error sources and target pest categories to be modified, and accordingly adjusting the hyperparameters and loss function weights of the initial pest classification model, and at the same time optimizing the processed data set, the technical problem of inaccurate identification of specific pest categories caused by model overfitting, data imbalance or label errors is solved, and the beneficial effects of improving the model's recognition ability for minority categories and error-prone categories, enhancing the model's generalization performance, and improving the overall pest classification accuracy are achieved.

[0208] Exemplarily, to help understand the implementation process of the alien invasive pest identification and counting method obtained by combining the above-mentioned Embodiment 1, please refer to Figure 8 , Figure 8 A brief flow schematic diagram of the alien invasive pest identification and counting method is provided. Specifically:

[0209] Data collection is carried out by downloading the full-scale data set, and then it is judged whether there are labels in the data set. If the data set has no labels, partial data annotation needs to be carried out manually to add appropriate labels to each picture. If the data set already has labels, the labels will be unified into YOLO format labels next, that is, the labels will be converted into a format that can be used by the YOLO object detection algorithm. Then, valid pictures are extracted, and these pictures are processed as necessary to ensure that the image quality in the data set meets the requirements of model training. Next, through data augmentation and expansion, data augmentation technology is used to increase the diversity of training data, expand the scale of the data set, and improve the robustness of the model. Next, the optimized data set is trained using model training, and the effect of the model is evaluated. If the training result is good, that is, the model can accurately identify pest categories and has good generalization ability, the model can be saved. If the training result is not ideal, problems need to be solved, such as adjusting parameters, increasing data or optimizing the model structure, and then model training is carried out until a model that meets the requirements is obtained, and the final model saving operation is carried out. The goal of the entire process is to obtain an efficient pest identification model by continuously optimizing the model.

[0210] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the alien invasive pest identification and counting method of this application. Based on this technical concept, more forms of simple transformation are within the protection scope of this application.

[0211] This application also provides an alien invasive pest identification and counting device. Please refer to Figure 9 , the alien invasive pest identification and counting device includes:

[0212] An acquisition module 10, configured to acquire an initial pest data set, and perform label analysis and normalization on the initial pest data to obtain a labeled pest data set;

[0213] A processing module 20, configured to process the tagged pest dataset to obtain a processed dataset;

[0214] An identification module 30, configured to train an initial pest classification model according to the processed dataset, and identify a pest verification image according to the initial pest classification model to obtain a verified pest category identification result;

[0215] An adjustment module 40, configured to adjust the weights of the initial pest classification model and the processed dataset according to the verified pest category identification result, and train a target pest classification model according to the adjusted weights and processed dataset;

[0216] A statistics module 50, configured to identify a real-time pest image according to the target pest classification model to obtain a target pest category identification result, and count the number of pests in the target pest category identification result to obtain a pest statistics result.

[0217] The alien invasive pest identification and statistics device provided by this application adopts the alien invasive pest identification and statistics method in the above embodiment, and can solve the technical problem of insufficient identification accuracy of alien invasive pest identification in small target detection and class imbalance problems. Compared with the prior art, the beneficial effects of the alien invasive pest identification and statistics device provided by this application are the same as those of the alien invasive pest identification and statistics method provided by the above embodiment, and other technical features in the alien invasive pest identification and statistics device are the same as the features disclosed in the above embodiment method, and will not be elaborated here.

[0218] In one embodiment, the identification module 30 is further configured to obtain a verified pest dataset according to the ratio of the processed dataset and the verification dataset; obtain an initial pest classification model according to a preset loss function, a preset model, and a random forest strategy; and verify the initial pest classification model according to the processed dataset and the verified pest dataset to obtain a verified pest category identification result.

[0219] In one embodiment, the identification module 30 is further configured to train a decision tree based on the processed dataset to obtain a classification result and a random forest classification model; comprehensively calculate the classification result according to an ensemble learning strategy to determine a target classification result; calculate a classification error according to the preset loss function; and obtain an initial pest classification model according to the preset model, the random forest classification model, the target classification result, and the classification error.

[0220] In one embodiment, the recognition module 30 is further configured to train an initial pest classification model based on the processed data set to obtain an initial training result; perform confusion recognition on the initial training result according to a confusion matrix and / or an enhanced regression tree to obtain a confusion recognition result; perform blank recognition on the initial training result according to the verified pest data set to obtain a blank recognition result; and obtain a verified pest category recognition result according to the confusion recognition result and the blank recognition result.

[0221] In one embodiment, the adjustment module 40 is further configured to obtain an error source and a target modified pest category according to the verified pest category recognition result; adjust hyperparameters and / or loss function weights of the initial pest classification model according to the error source to obtain an adjusted training model; modify the processed data set according to the target modified pest category to obtain an optimized training data set; and train the adjusted training model according to the optimized training data set to obtain a target pest classification model.

[0222] In one embodiment, the processing module 20 is further configured to obtain a training pest data set according to the labeled pest data set and the training data set ratio; perform light-dark conversion on the training pest data set to obtain a light-dark training data set; remove the background from the training pest data set to obtain a background-removed data set; rotate the training pest data set to obtain a multi-angle data set; add noise to the training pest data set to obtain a noise-added data set; and obtain a processed data set according to the light-dark training data set, the background-removed data set, the multi-angle data set, and the noise-added data set.

[0223] In one embodiment, the acquisition module 10 is further configured to acquire an initial pest data set, perform label analysis on the initial pest data to obtain an initial label data set; obtain an image height, an image width, a center point abscissa, and a center point ordinate according to the initial label data set; and perform normalization according to the image height, the image width, the center point abscissa, and the center point ordinate to obtain a labeled pest data set.

[0224] The present application provides an alien invasive pest recognition and statistics device, which includes: 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 alien invasive pest recognition and statistics method in the first embodiment above.

[0225] Next, refer to Figure 10, which shows a schematic structural diagram of an alien invasive pest identification and statistics device suitable for implementing the embodiments of the present application. The alien invasive pest identification and statistics device in the embodiments of the present application may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistant), PADs (Portable Application Description), PMPs (Portable Media Player), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 10 The shown alien invasive pest identification and statistics device is merely an example and should not impose any limitations on the functions and usage scope of the embodiments of the present application.

[0226] As Figure 10 shown, the alien invasive pest identification and statistics device may include a processing device 1001 (such as a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to the programs stored in the ROM (Read Only Memory) 1002 or the programs loaded from the storage device 1003 into the RAM (Random Access Memory) 1004. In the RAM 1004, various programs and data required for the operation of the alien invasive pest identification and statistics device are also stored. The processing device 1001, the ROM 1002, and the RAM 1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems may be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1003 including, for example, magnetic tapes, hard disks, etc.; and a communication device 1009. The communication device 1009 can allow the alien invasive pest identification and statistics device to communicate with other devices wirelessly or wiredly to exchange data. Although the figure shows an alien invasive pest identification and statistics device with various systems, it should be understood that it is not required to implement or have all the shown systems. More or fewer systems may be implemented or had alternatively.

[0227] In particular, according to the embodiments disclosed in the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium. The computer program contains program codes for executing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by a processing device 1001, the above-mentioned functions defined in the methods of the embodiments disclosed in the present application are executed.

[0228] The alien invasive pest identification and statistics device provided by the present application adopts the alien invasive pest identification and statistics method in the above-mentioned embodiment, and can solve the technical problem of insufficient identification accuracy of alien invasive pest identification in small target detection and class imbalance problems. Compared with the prior art, the beneficial effects of the alien invasive pest identification and statistics device provided by the present application are the same as those of the alien invasive pest identification and statistics method provided by the above-mentioned embodiment, and other technical features in the alien invasive pest identification and statistics device are the same as the features disclosed in the method of the previous embodiment, and will not be elaborated here.

[0229] It should be understood that each part disclosed in the present application can be implemented by hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in a suitable manner in any one or more embodiments or examples.

[0230] As described above, the above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present application, and all of them should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

[0231] The present application provides a computer-readable storage medium, which has computer-readable program instructions (i.e., computer programs) stored thereon. The computer-readable program instructions are used to execute the alien invasive pest identification and statistics method in the above-mentioned embodiment.

[0232] The computer-readable storage medium provided by this application can be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or components, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) or flash memory, optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this embodiment, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. The program code contained on the computer-readable storage medium can be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0233] The above computer-readable storage medium can be included in the alien invasive pest identification and counting device; or it can exist independently without being assembled into the alien invasive pest identification and counting device.

[0234] The above computer-readable storage medium carries one or more programs. When the one or more programs are executed by the alien invasive pest identification and counting device, the alien invasive pest identification and counting device is caused to: obtain an initial pest data set, perform label analysis and normalization on the initial pest data to obtain a labeled pest data set; perform data processing on the labeled pest data set to obtain a processed data set; train an initial pest classification model according to the processed data set, and identify a pest verification image according to the initial pest classification model to obtain a verification pest category identification result; adjust the weights of the initial pest classification model and the processed data set according to the verification pest category identification result, and train a target pest classification model according to the adjusted weights and processed data set; identify a real-time pest image according to the target pest classification model to obtain a target pest category identification result, and count the number of pests in the target pest category identification result to obtain a pest count result.

[0235] Computer program code for performing the operations of this application can be written in one or more programming languages or combinations thereof. The above-mentioned programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN: Local Area Network) or a wide area network (WAN: Wide Area Network), or it can be connected to an external computer (for example, by connecting through the Internet using an Internet service provider).

[0236] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0237] The modules described in the embodiments of this application can be implemented in software or in hardware. Among them, the name of the module does not constitute a limitation on the unit itself in some cases.

[0238] The readable storage medium provided by this application is a computer-readable storage medium. The computer-readable storage medium stores computer-readable program instructions (i.e., computer programs) for performing the above-mentioned alien invasive pest identification and statistics method, and can solve the technical problem of insufficient recognition accuracy in small target detection and class imbalance problems of alien invasive pest identification. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by this application are the same as those of the alien invasive pest identification and statistics method provided by the above embodiments, and will not be elaborated here.

[0239] The present application also provides a computer program product, including a computer program which, when executed by a processor, implements the steps of the method for identifying and counting alien invasive pests as described above.

[0240] The computer program product provided by the present application can solve the technical problem of insufficient recognition accuracy in the identification of alien invasive pests in small target detection and class imbalance problems. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as those of the method for identifying and counting alien invasive pests provided in the above embodiments, and will not be elaborated here.

[0241] The above are only some embodiments of the present application, and thus do not limit the patent scope of the present application. Any equivalent structural transformation made under the technical concept of the present application by using the content of the specification and drawings of the present application, or direct / indirect application in other related technical fields, is included in the patent protection scope of the present application.

Claims

1. A method for identifying and counting alien invasive pests, characterized in that The method includes: Obtain an initial pest dataset, and perform label analysis and normalization on the initial pest data to obtain a labeled pest dataset; Perform data processing on the labeled pest dataset to obtain a processed dataset; Train an initial pest classification model according to the processed dataset, and identify a pest verification image according to the initial pest classification model to obtain a verification pest category identification result; Adjust the weights of the initial pest classification model and the processed dataset according to the verification pest category identification result, and train a target pest classification model according to the adjusted weights and processed dataset; Identify a real-time pest image according to the target pest classification model to obtain a target pest category identification result, and count the number of pests in the target pest category identification result to obtain a pest statistics result.

2. The method according to claim 1, characterized in that, The step of training an initial pest classification model according to the processed dataset, and identifying a pest verification image according to the initial pest classification model to obtain a verification pest category identification result includes: Obtain a verification pest dataset according to the ratio of the processed dataset and the verification dataset; Obtain an initial pest classification model according to a preset loss function, a preset model, and a random forest strategy; Verify the initial pest classification model according to the processed dataset and the verification pest dataset to obtain a verification pest category identification result.

3. The method according to claim 2, wherein The step of obtaining an initial pest classification model according to a preset loss function, a preset model, and a random forest strategy includes: Train a decision tree based on the processed dataset to obtain a classification result and a random forest classification model; Perform comprehensive calculation on the classification result according to an ensemble learning strategy to determine a target classification result; Calculate a classification error according to the preset loss function; Obtain an initial pest classification model according to the preset model, the random forest classification model, the target classification result, and the classification error.

4. The method according to claim 2, characterized in that The step of verifying the initial pest classification model according to the processed dataset and the verification pest dataset to obtain a verification pest category identification result includes: Train an initial pest classification model according to the processed dataset to obtain an initial training result; Perform confusion identification on the initial training result according to a confusion matrix and / or an enhanced regression tree to obtain a confusion identification result; Perform blank identification on the initial training result according to the verification pest dataset to obtain a blank identification result; Obtain a verification pest category identification result according to the confusion identification result and the blank identification result.

5. The method according to claim 1, wherein The step of adjusting the weights of the initial pest classification model and the processed dataset according to the verification pest category identification result, and training a target pest classification model according to the adjusted weights and processed dataset includes: Obtain an error source and a target modified pest category according to the verification pest category identification result; Adjust the hyperparameters and / or loss function weights of the initial pest classification model according to the error source to obtain an adjusted training model; Modify the processed dataset according to the target modified pest category to obtain an optimized training dataset; Train the adjusted training model according to the optimized training data set to obtain a target pest classification model.

6. The method according to claim 1, wherein The steps of processing the labeled pest data set to obtain a processed data set include: Obtain a training pest data set according to the labeled pest data set and the training data set ratio; Perform light-dark conversion on the training pest data set to obtain a light-dark training data set; Remove the background from the training pest data set to obtain a background-removed data set; Rotate the training pest data set to obtain a multi-angle data set; Add noise to the training pest data set to obtain a noise-added data set; Obtain a processed data set according to the light-dark training data set, the background-removed data set, the multi-angle data set, and the noise-added data set.

7. The method according to claim 1, characterized in that, The steps of obtaining an initial pest data set, and performing label analysis and normalization on the initial pest data to obtain a labeled pest data set include: Obtain an initial pest data set, and perform label analysis on the initial pest data to obtain an initial labeled data set; Obtain the image height, image width, abscissa of the center point, and ordinate of the center point according to the initial labeled data set; Perform normalization according to the image height, the image width, the abscissa of the center point, and the ordinate of the center point to obtain a labeled pest data set.

8. An apparatus for identifying and counting alien invasive pests, characterized in that, The device includes: An acquisition module, configured to obtain an initial pest data set, and perform label analysis and normalization on the initial pest data to obtain a labeled pest data set; A processing module, configured to process the labeled pest data set to obtain a processed data set; An identification module, configured to train an initial pest classification model according to the processed data set, and identify a pest verification image according to the initial pest classification model to obtain a verification pest category identification result; An adjustment module, configured to adjust the weights of the initial pest classification model and the processed data set according to the verification pest category identification result, and train to obtain a target pest classification model according to the adjusted weights and processed data set; A statistics module, configured to identify a real-time pest image according to the target pest classification model to obtain a target pest category identification result, and count the number of pests in the target pest category identification result to obtain a pest statistics result.

9. An alien invasive pest identification and statistics device, characterized in that The device includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, where the computer program is configured to implement the steps of the alien invasive pest identification and statistics method according to any one of claims 1 to 7.

10. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium, and when the computer program is executed by a processor, it implements the steps of the alien invasive pest identification and statistics method according to any one of claims 1 to 7.