Insect condition monitoring method and device based on damaged image, equipment and readable medium
By training an adversarial network model on images of damaged insects, the problem of inaccurate insect category identification caused by damage to the visual data collection equipment for insect infestation was solved, and accurate identification and classification of damaged images were achieved.
Patent Information
- Application Number
- CN202311605875.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-28
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-11-28
AI Technical Summary
Insect visual data collection equipment is easily damaged in the field, resulting in contaminated insect image data and affecting the accuracy of insect category identification models.
An adversarial network model is used to train damaged images. By damaging and annotating sample insect images, a training set of insect images is generated. The adversarial network model is then used to train a classification model to identify insect categories and damage types.
It improves the recognition performance of damaged or incomplete insect images, enabling accurate and reliable monitoring and classification of insect categories.
Smart Images

Figure CN117409371B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a method, apparatus, device, and readable medium for insect infestation monitoring based on damaged images. Background Technology
[0002] Insect pest monitoring refers to the use of visual data collection equipment to automatically complete systematic operations such as insect attraction, killing, insect dispersion, photography, transportation, collection, and drainage without supervision. In real time, the types and counts of insect pests are uploaded to the agricultural insect pest forecasting platform. Combined with practical experience and historical data, the system predicts the future trend of pests and diseases, improves labor efficiency and the accuracy of monitoring results, and provides accurate and timely forecasting services for researchers and growers.
[0003] However, due to the difficulty in controlling the field environment, such as weather conditions and damage from wild organisms, insect visual data collection equipment is often easily damaged, resulting in the collection of insect image data being contaminated, ultimately leading to poor performance of models trained based on damaged data.
[0004] Therefore, how to provide a technical solution that can accurately identify the types of insects in damaged images is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] One objective of this application is to provide a method, apparatus, device, and readable medium for insect infestation monitoring based on damaged images, at least to solve problems such as category identification of damaged or incomplete insect image data. The purpose of this application is to provide a novel method for insect infestation monitoring based on damaged images. This method employs a domain generalization algorithm, which can effectively address the problem of decreased performance of insect category classification models due to the deterioration of training image quality caused by damage to insect visual data collection equipment. This improves the insect category classification model's performance in identifying insect categories from damaged or incomplete insect images, providing an accurate and reliable means for real-time monitoring and classification of insect categories.
[0006] To achieve the above objectives, some embodiments of this application provide the following aspects:
[0007] In a first aspect, some embodiments of this application also provide a method for insect infestation monitoring based on damaged images, the method comprising:
[0008] Each sample insect image is subjected to at least one type of damage processing, and the insect category and damage type corresponding to each sample insect image are labeled to obtain a training insect image set;
[0009] The training set of insect images is input into an adversarial network model for training to obtain a classification model;
[0010] The insect image to be processed is input into the classification model to determine the insect category and damage type corresponding to the insect image.
[0011] Secondly, some embodiments of this application also provide an insect infestation monitoring device based on damaged images, the device comprising:
[0012] The damaged image acquisition module is used to perform at least one type of damage processing on each sample insect image, and to label the insect category and damage type corresponding to each sample insect image to obtain a training insect image set;
[0013] The damaged image training module is used to input the training insect image set into the adversarial network model for training to obtain a classification model;
[0014] The damaged image processing module is used to input the insect image to be processed into the classification model to determine the insect category and damage type corresponding to the insect image to be processed.
[0015] Thirdly, some embodiments of this application also provide a computer device, the device comprising:
[0016] One or more processors; and
[0017] A memory storing computer program instructions, which, when executed, cause the processor to perform the insect infestation monitoring method based on damaged images as described above.
[0018] Fourthly, some embodiments of this application also provide a computer-readable medium having computer program instructions stored thereon, which can be executed by a processor to implement the insect infestation monitoring method based on damaged images as described above.
[0019] Compared to existing technologies, the solution provided in this application involves performing at least one type of damage processing on each sample insect image, and labeling the insect category and damage type corresponding to each sample insect image to obtain a training insect image set. This training insect image set is then input into an adversarial network model for training, resulting in a classification model. Finally, the insect image to be processed is input into the classification model to determine the insect category and damage type corresponding to the image. This technical solution trains the insect category classification model based on damaged images to improve the generalization and recognition performance of the classification model for damaged or incomplete insect images, providing an accurate and reliable means for real-time monitoring and classification of insect categories. Attached Figure Description
[0020] Figure 1 This is a flowchart illustrating the insect infestation monitoring method based on damaged images provided in Embodiment 1 of this application;
[0021] Figure 2 This is a schematic diagram of the structure of an adversarial network model provided in Embodiment 2 of this application;
[0022] Figure 3 This is a schematic diagram of the insect monitoring device based on damaged images provided in Embodiment 3 of this application;
[0023] Figure 4 This is a schematic diagram of the structure of the computer device provided in Embodiment 4 of this application. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0025] The technical solutions provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0026] Example 1
[0027] Figure 1 This is a flowchart illustrating the insect infestation monitoring method based on damaged images provided in Embodiment 1 of this application. Figure 1 As shown, the specific steps include: This process includes:
[0028] Step S101: Perform at least one type of damage processing on each sample insect image, and label the insect category and damage type corresponding to each sample insect image to obtain a training insect image set;
[0029] The sample insect images can be obtained by taking pictures of the insects captured by an insect infestation visual collection device. Specifically, the insects can first be attracted and collected using an intelligent insect infestation detection lamp, and then images of the collected insects can be acquired using a high-resolution CCD camera to obtain sample insect images.
[0030] It should be noted that the sample insect images are those collected under undamaged conditions.
[0031] Because insect visual collection equipment is located in the wild, it is easily affected by weather conditions or damage from wild organisms. For example, rain or snow can cause the lens to be blocked by rain or snow, or the camera may not focus accurately during the focusing process. Or, the insect visual collection equipment may shake and cause the image to become blurry when damaged by wild organisms during image acquisition. Or, strong light may cause the acquired image to be overexposed.
[0032] In view of the above problems, this application pre-treats the insect images to train a classification model under image damage conditions.
[0033] The damage type can be determined based on any damage behavior that can be encountered in the wild, such as light intensity, depth of field, occlusion, and shaking.
[0034] In this application, multiple types of damage processing can be applied to the same sample insect image, or different degrees of damage processing of the same type can be applied to the same sample insect image.
[0035] For example, if a sample insect image has a resolution of 100 PPI, its resolution can be reduced to 80 PPI and 50 PPI without changing the size of the sample insect image.
[0036] For another example, a region of a preset size in a sample insect image is randomly occluded to generate multiple occluded training insect images.
[0037] Optionally, the damage type includes at least one of image illumination change, image partial loss, or image color reset.
[0038] Among these, changing the image lighting can involve adjusting the contrast, brightness, or saturation of the sample insect image; partial image loss can involve occluding a portion of the sample insect image; and resetting the image color can involve adjusting the pixel values of each pixel in the sample insect image according to certain rules.
[0039] In this application, the training insect image set can be represented as:
[0040] C={(x1,y1,d1),(x1,y1,d1),…,(x n ,y n ,d n )};
[0041] In the formula, C represents the training insect image set, x represents the training insect image, y represents the insect category, d represents the damage type, and n represents the number of training insect images.
[0042] Step S102: Input the training set of insect images into the adversarial network model for training to obtain a classification model;
[0043] Among them, the adversarial network model can be a model that is trained adversarially on the insect categories and damage types of the training insect images, so that the trained model can classify insect images with different damage types.
[0044] Specifically, the training set of insect images is input into the adversarial network model to predict the insect category and damage type, and the prediction results are compared with the actual labels to incentivize the adversarial network model to learn the indistinguishable features of damage types in the training set of insect images, thereby achieving domain generalization of the model and obtaining a classification model.
[0045] Step S103: Input the insect image to be processed into the classification model to determine the insect category and damage type corresponding to the insect image to be processed.
[0046] The insect images to be processed can be newly acquired insect images from insect infestation visual data collection devices. Specifically, the insect images to be processed can be input into a trained classification model, which outputs the insect category and damage type corresponding to the image.
[0047] For example, when an image of an insect is input into a trained classification model, the output is: the insect category is aphid, and the damage type is local image loss.
[0048] This application provides a method for insect infestation monitoring based on damaged images. The method involves processing each sample insect image with at least one type of damage, and labeling each sample image with its corresponding insect category and damage type to obtain a training insect image set. This training image set is then input into an adversarial network model for training, resulting in a classification model. Finally, the insect image to be processed is input into the classification model to determine the insect category and damage type corresponding to that image. This technical solution trains the insect category classification model based on damaged images to improve the model's generalization and recognition performance for damaged or incomplete insect images, providing an accurate and reliable means for real-time monitoring and classification of insect categories.
[0049] The advantage of this setup is that it allows for continuous online learning of insect species, enabling the automatic discovery of new species while retaining accurate identification of older species.
[0050] Example 2
[0051] Figure 2 This is a schematic diagram of the structure of an adversarial network model provided in Embodiment 2 of this application. Figure 2 As shown, the adversarial network model includes a feature extractor, a category classifier, a domain classifier, and; among them,
[0052] The feature extractor is used to extract features from the training insect image set to obtain a feature image set;
[0053] The category classifier is used to identify the insect category of each training insect image in the feature image set and determine the insect category corresponding to each training insect image.
[0054] The domain classifier is used to identify the damage type of each training insect image in the feature image set and determine the damage type corresponding to each training insect image.
[0055] The gradient inversion layer is used to negate the gradient during the backpropagation process.
[0056] The feature extractor can be a convolutional neural network (CNN). For example, the CNN may include convolutional layers, pooling layers, and fully connected layers. Training images of insects are input into the CNN. The convolutional layers extract local features from the insect images while preserving the spatial location information of the features, resulting in a convolutional feature map. The pooling layers reduce the spatial size of the convolutional feature map, decreasing the number of model parameters and preventing overfitting. The fully connected layers unfold the features obtained from the convolution and pooling operations into a one-dimensional vector, resulting in a feature image.
[0057] The category classifier can be used to classify and identify the insect categories in the training insect images. For example, classification algorithms such as logistic regression, Naive Bayes, decision trees, support vector machines, random forests, and gradient boosting trees can be used for classification and identification.
[0058] Among them, the domain classifier can be used to identify which corrupted algorithm the training insect image came from.
[0059] Since the purpose of the feature extractor is to prevent the domain classifier from correctly identifying which corrupted algorithm the information comes from, the feature extractor and the domain classifier form an adversarial relationship. This adversarial relationship is achieved through adversarial training based on gradient inversion layers.
[0060] Accordingly, the domain classifier is specifically used to identify the damage type of each training insect image in the feature image extracted from the image by the feature extractor, and to determine the damage type corresponding to each training insect image.
[0061] In the backpropagation parameter update process, backpropagation refers to passing the loss value layer by layer backward. Each layer of the network calculates the gradient based on the returned loss value and then updates the parameters of that layer. The task of the feature extractor is to maximize the insect category classification accuracy but minimize the domain classification accuracy; therefore, it needs to maximize the objective function of the domain classifier.
[0062] Therefore, as Figure 2As shown, there is a gradient reversal layer (GR) between the domain classifier and the feature extractor, which makes the training objectives of the network before and after the gradient reversal layer opposite, so as to achieve an adversarial effect, improve the accuracy of the classification model in different damage types, and increase the reliability and robustness of the model in practical applications.
[0063] In some embodiments of this application, the process of constructing the loss function of the adversarial network model includes: determining the loss function of the adversarial network model based on category classification loss, domain classification loss, and gradient inversion loss.
[0064] The loss function is used as a learning criterion to optimize the adversarial network model during training, thereby improving its generalization ability and robustness.
[0065] Specifically, the loss function of the adversarial network model can be obtained by weighting the category classification loss, domain classification loss, and gradient inversion loss.
[0066] Optionally, the loss function of the adversarial network model is determined based on the category classification loss, domain classification loss, and gradient inversion loss, including:
[0067] The loss function of the adversarial network model is determined using the following formula:
[0068] L = L class +αL domain ;
[0069] In the formula, L represents the total loss of the adversarial network model, L class L represents the category classification loss. domain Let denot be the domain classification loss, GR be the gradient reversal loss, and α be a hyperparameter.
[0070] This application provides an adversarial network model, which includes a feature extractor, a category classifier, and a domain classifier. The feature extractor extracts features from a set of training insect images to obtain a feature image set. The category classifier identifies the insect category of each training insect image in the feature image set, determining the corresponding insect category. The domain classifier identifies the damage type of each training insect image in the feature image set, determining the corresponding damage type. This technical solution, through adversarial learning on the feature extractor and domain classifier, enables the classification model to accurately identify insect categories across multiple damage types, increasing the reliability and robustness of the classification model in practical applications and providing a precise and reliable means for real-time monitoring and classification of insect species.
[0071] Example 3
[0072] Figure 3 This is a schematic diagram of the insect infestation monitoring device based on damaged images provided in Embodiment 3 of this application. Figure 3 As shown, it specifically includes the following:
[0073] The damaged image acquisition module 310 is used to perform at least one type of damage processing on each sample insect image, and to label the insect category and damage type corresponding to each sample insect image to obtain a training insect image set.
[0074] The damaged image training module 320 is used to input the training insect image set into the adversarial network model for training to obtain a classification model;
[0075] The damaged image processing module 330 is used to input the insect image to be processed into the classification model to determine the insect category and damage type corresponding to the insect image to be processed.
[0076] The insect infestation monitoring device based on damaged images in this application embodiment can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network-attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not impose specific limitations.
[0077] The insect monitoring device based on damaged images in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit it.
[0078] The insect monitoring device based on damaged images provided in this application embodiment can realize all the processes implemented in the above method embodiments, and will not be described again here to avoid repetition.
[0079] Example 4
[0080] In addition, embodiments of this application also provide a computer device. Figure 4This is a schematic diagram of the structure of the computer device provided in Embodiment 4 of this application. The structure of the device is as follows: Figure 4 As shown, the device includes a memory 41 for storing computer-readable instructions and a processor 42 for executing the computer-readable instructions, wherein when the computer-readable instructions are executed by the processor, the processor is triggered to execute the method described thereon.
[0081] The methods and / or embodiments in this application can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowchart. When the computer program is executed by a processing unit, it performs the functions defined in the methods of this application.
[0082] It should be noted that the computer-readable medium described in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0083] In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, capable of transmitting, propagating, or transmitting a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wireline, optical fiber, RF, etc., or any suitable combination thereof.
[0084] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and 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, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0085] The flowcharts or block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of devices, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-specific system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0086] In another aspect, embodiments of this application also provide a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The aforementioned computer-readable medium carries one or more computer-readable instructions, which may be executed by a processor to implement the steps of the methods and / or technical solutions of the various embodiments of this application.
[0087] In a typical configuration of this application, the terminal and the service network devices each include one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0088] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0089] Computer-readable media include both permanent and non-permanent, removable and non-removable media, which can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other classes of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, read-only optical disc (CD-ROM), digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0090] Furthermore, this application also provides a computer program stored in a computer device, which enables the computer device to execute the method for executing the control code.
[0091] It should be noted that this application can be implemented in software and / or a combination of software and hardware, for example, using an application-specific integrated circuit (ASIC), a general-purpose computer, or any other similar hardware device. In some embodiments, the software program of this application can be executed by a processor to implement the steps or functions described above. Similarly, the software program of this application (including related data structures) can be stored in a computer-readable recording medium, such as RAM memory, magnetic or optical drives, floppy disks, and similar devices. Furthermore, some steps or functions of this application can be implemented in hardware, for example, as circuitry that cooperates with a processor to perform the various steps or functions.
[0092] It will be apparent to those skilled in the art that this application is not limited to the details of the exemplary embodiments described above, and that this application can be implemented in other specific forms without departing from the spirit or essential characteristics of this application. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of this application is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within this application. No reference numerals in the claims should be construed as limiting the scope of the claims. Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in the apparatus claims may also be implemented by a single unit or device in software or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any particular order.
Claims
1. A method for monitoring insect infestations based on damaged images, characterized in that, The method includes: Each sample insect image is subjected to at least one type of damage processing, and the insect category and damage type corresponding to each sample insect image are labeled to obtain a training insect image set; The training set of insect images is input into an adversarial network model for training to obtain a classification model; The insect image to be processed is input into the classification model to determine the insect category and damage type corresponding to the insect image; The adversarial network model includes a feature extractor, a category classifier, and a domain classifier; wherein... The feature extractor is used to extract features from the training insect image set to obtain a feature image set; The category classifier is used to identify the insect category of each training insect image in the feature image set and determine the insect category corresponding to each training insect image. The domain classifier is used to identify the damage type of each training insect image in the feature image set and determine the damage type corresponding to each training insect image. The adversarial network model also includes a gradient inversion layer; wherein... The gradient inversion layer is used to invert the gradient of each training insect image in the feature image set to obtain a gradient-inverted feature image set. The domain classifier is specifically used to identify the damage type of each training insect image in the gradient inversion feature image set, and to determine the damage type corresponding to each training insect image.
2. The method according to claim 1, characterized in that, The damage type includes at least one of image illumination change, partial image loss, or image color reset.
3. The method according to claim 1, characterized in that, The process of constructing the loss function of the adversarial network model includes: The loss function of the adversarial network model is determined based on the category classification loss, domain classification loss, and gradient inversion loss.
4. The method according to claim 1, characterized in that, The loss function of the adversarial network model is determined based on the category classification loss, domain classification loss, and gradient inversion loss, including: The loss function of the adversarial network model is determined using the following formula: ; In the formula, This represents the total loss of the adversarial network model. Represents the category classification loss. Representation domain classification loss, This represents the gradient reversal loss. and This is a hyperparameter.
5. A pest monitoring device based on damaged images, characterized in that, The device includes: The damaged image acquisition module is used to perform at least one type of damage processing on each sample insect image, and to label the insect category and damage type corresponding to each sample insect image to obtain a training insect image set; The damaged image training module is used to input the training insect image set into the adversarial network model for training to obtain a classification model; The damaged image processing module is used to input the insect image to be processed into the classification model to determine the insect category and damage type corresponding to the insect image to be processed; The adversarial network model includes a feature extractor, a category classifier, and a domain classifier; wherein... The feature extractor is used to extract features from the training insect image set to obtain a feature image set; The category classifier is used to identify the insect category of each training insect image in the feature image set and determine the insect category corresponding to each training insect image. The domain classifier is used to identify the damage type of each training insect image in the feature image set and determine the damage type corresponding to each training insect image. The adversarial network model also includes a gradient inversion layer; wherein... The gradient inversion layer is used to invert the gradient of each training insect image in the feature image set to obtain a gradient-inverted feature image set. The domain classifier is specifically used to identify the damage type of each training insect image in the gradient inversion feature image set, and to determine the damage type corresponding to each training insect image.
6. A computer device, characterized in that, The device includes: One or more processors; and A memory storing computer program instructions, which, when executed, cause the processor to perform the insect monitoring method based on damaged images as described in any one of claims 1-4.
7. A computer-readable medium, characterized in that, It stores computer program instructions that can be executed by a processor to implement the insect monitoring method based on damaged images as described in any one of claims 1-4.
Citation Information
Patent Citations
Domain adaptive image classification method and device, storage medium and program product
CN114463575A
