Disease area determination method and device, storage medium and electronic device
By adjusting image parameters and using a trained neural network model to identify diseased areas, the problem of low detection efficiency in diseased areas was solved, achieving more efficient detection of diseased areas, especially in the identification of pine nematode disease, which improved detection accuracy and efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG DAHUA TECH CO LTD
- Filing Date
- 2022-10-14
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies have low detection efficiency for diseased areas, especially in the detection of pine nematode disease, where the low resolution of satellite-acquired images leads to low detection efficiency.
By acquiring images collected by the target device, adjusting image parameters using a preset algorithm, and inputting them into the target neural network model for disease area identification, the trained target neural network model is used to select the disease area, and the model is trained by combining sample images and detection boxes. Attention mechanism and residual edge calculation module are used to optimize the detection effect.
It improves the efficiency and effectiveness of disease detection, especially in the identification of pine nematode disease, enabling more accurate detection of diseased areas and overcoming the limitations of manual searching.
Smart Images

Figure CN115512238B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and more specifically, to a method, apparatus, storage medium, and electronic device for determining a diseased area. Background Technology
[0002] Currently, the main method for identifying diseased areas in related technologies is to use satellite equipment to collect images and then manually add detection frames to determine the diseased areas in the images.
[0003] For example, pine trees are one of the most abundant tree species, playing a vital role in afforestation of barren mountains and air purification. However, pine nematode disease is fatal to pine trees and is often referred to as the "cancer" of pine trees. Once pine nematode disease occurs, the growth of pine trees will be severely damaged. Current treatment methods are limited to cutting down affected pine trees to prevent them from endangering surrounding tree species. Because pine nematodes spread rapidly and cause widespread damage, the earlier pine nematode disease is detected and the more targeted the treatment of damaged branches, the less likely it is to endanger the pine tree itself.
[0004] In related technologies, satellite detection is mainly used to identify the diseased areas corresponding to pine nematodes. However, the low resolution of satellite images leads to the technical problem of low detection efficiency for diseased areas.
[0005] There is currently no effective solution to the problem of low detection efficiency of diseased areas in related technologies. Summary of the Invention
[0006] This invention provides a method, apparatus, storage medium, and electronic device for determining diseased areas, in order to at least solve the problem of low detection efficiency of diseased areas in related technologies.
[0007] According to an embodiment of the present invention, a method for determining a diseased area is provided, comprising: acquiring a first image collected by a target device, wherein the target device is a device for acquiring images based on remote sensing technology, and the first image is an image including a diseased area to be detected; adjusting the image parameters of the first image using a preset algorithm to obtain a second image; inputting the second image into a target neural network model to obtain a target recognition result, wherein the target neural network model is a model obtained by training an initial neural network model to be trained, and the target recognition result includes the diseased area selected by using a target detection box in the second image.
[0008] In an exemplary embodiment, the method further includes: acquiring sample images and sample detection boxes corresponding one-to-one with the sample images, wherein the sample detection boxes are used to select diseased areas in the sample images, and the sample images are images pre-acquired by the acquisition device; adjusting the image parameters of the sample images in a graphics processor using the preset algorithm to obtain a third image; and training the initial neural network model to be trained in the graphics processor using the sample images and the third image as a training sample set to obtain the target neural network model.
[0009] In an exemplary embodiment, training the initial neural network model to be trained in the graphics processor using the sample image and the third image as training sample sets to obtain the target neural network model includes: training the initial neural network model to be trained in the graphics processor using the sample image and the third image as training sample sets, wherein each sample image and its corresponding sample detection box are used as training sample pairs input in each round of the training sample set, or each third image and its corresponding sample detection box are used as training sample pairs input in each round of the training sample set; determining the loss function of the initial neural network model based on the input training sample pairs, and determining whether the loss function satisfies a preset target convergence condition; adjusting the parameters of the initial neural network model if the loss function does not satisfy the target convergence condition; and generating the target neural network model if the loss function satisfies the target convergence condition.
[0010] In an exemplary embodiment, training the initial neural network model to be trained in the graphics processor using the sample image and the third image as training sample sets includes: performing multiple rounds of training on the initial neural network model through the following steps until the loss function satisfies the target convergence condition, wherein the image input to the initial neural network model in each round of training is considered the current image; extracting sample feature maps from the current image through an attention-based target extraction module; generating a first detection box based on the sample feature maps; determining the classification result of the first detection box based on the positional relationship between the sample detection box and the sample detection box corresponding to the current image, wherein the classification result is used to indicate whether the region selected by the first detection box is a disease region; and determining the initial neural network model based on the input training sample pairs. The loss function is used to determine whether it satisfies a preset target convergence condition. This includes: determining that the loss function satisfies the target convergence condition when the probability that the classification result indicated by the loss function is the same as the result indicated by the sample detection box satisfies a preset threshold or the number of training epochs satisfies a preset epoch threshold, wherein the classification result is the classification result corresponding to the first detection box, the fact that the classification result is the same as the result indicated by the sample detection box indicates that the region selected by the first detection box is the disease region, and the result indicated by the sample detection box is that the region selected by the sample detection box is the disease region; and determining that the loss function does not satisfy the target convergence condition when the probability that the classification result indicated by the loss function is the same as the result indicated by the sample detection box does not satisfy the preset threshold or the number of training epochs does not satisfy the preset epoch threshold.
[0011] In an exemplary embodiment, the step of extracting sample feature maps from the current image using an attention-based target extraction module includes: obtaining a first feature map from the current image and inputting the first feature map into a target calculation module to obtain a target feature map, wherein the target calculation module includes preset residual edges used to linearly transform the input and output of the target calculation module; inputting the target feature map into the first calculation module and the target calculation module respectively to obtain a second feature map and a third feature map, wherein the second feature map and the third feature map extracted by the first calculation module and the target calculation module have different receptive fields; and performing a dot product operation on the second feature map and the third feature map to obtain the sample feature map.
[0012] In an exemplary embodiment, adjusting the image parameters of the first image using a preset algorithm to obtain the second image includes: preprocessing the first image, wherein the preprocessing includes cropping, Gaussian filtering, and an adaptive enhancement algorithm.
[0013] In one exemplary embodiment, the target device includes a smart drone.
[0014] According to another embodiment of the present invention, a device for determining a diseased area is provided, comprising: a first acquisition module, configured to acquire a first image collected by a target device, wherein the target device is a device for acquiring images based on remote sensing technology, and the first image is an image including a diseased area to be detected; an adjustment module, configured to adjust the image parameters of the first image using a preset algorithm to obtain a second image; and a first processing module, configured to input the second image into a target neural network model to obtain a target recognition result, wherein the target neural network model is a model obtained by training an initial neural network model to be trained, and the target recognition result includes the diseased area selected by using a target detection box in the second image.
[0015] According to yet another embodiment of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.
[0016] According to yet another embodiment of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0017] This invention allows for the acquisition of a first image from a target device, followed by adjustment of its image parameters using a preset algorithm to obtain a second image. This second image is then input into a target neural network model to obtain the target recognition result. By adjusting the image parameters of the first image using a preset algorithm to obtain the adjusted second image, and then using a target neural network model to detect and identify diseased areas in the second image, this invention solves the problem of low detection efficiency for diseased areas in related technologies, thereby improving both the detection efficiency and effectiveness of diseased areas. Attached Figure Description
[0018] Figure 1 This is a hardware structure block diagram of a mobile terminal for a method of determining a diseased area according to an embodiment of the present invention.
[0019] Figure 2 This is a flowchart of a method for determining a diseased area according to an embodiment of the present invention;
[0020] Figure 3 This is a schematic diagram of a neural network structure for a method of determining a diseased area according to an embodiment of the present invention;
[0021] Figure 4 This is a flowchart of a method for determining a diseased area according to an embodiment of the present invention;
[0022] Figure 5 This is a structural block diagram of a device for determining a diseased area according to an embodiment of the present invention. Detailed Implementation
[0023] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings and examples.
[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0025] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for a method of determining a diseased area according to an embodiment of the present invention. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0026] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the method for determining the diseased area in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to a mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0027] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0028] This embodiment provides a method for determining diseased areas. Figure 2 This is a flowchart of a method for determining the diseased area according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:
[0029] S202, acquire the first image collected by the target device, wherein the target device is a device for collecting images based on remote sensing technology, and the first image is an image including the area of disease to be detected;
[0030] Optionally, in this embodiment, remote sensing technology refers to non-contact, long-distance detection technology. Therefore, any device with non-contact, long-distance detection capabilities can be used to acquire the first image, such as a smart drone.
[0031] S204, The image parameters of the first image are adjusted using a preset algorithm to obtain the second image;
[0032] Optionally, in this embodiment, the preset algorithm can be a pre-set algorithm for adjusting the image parameters of the first image, and other algorithms with similar algorithmic functions to the preset algorithm can also adjust the image parameters of the first image, such as the Retinex algorithm, etc. The image parameters include, but are not limited to, the resolution of the image, the size of the image, the color of the image, the pixels of the image, etc.
[0033] S206, the second image is input into the target neural network model to obtain the target recognition result, wherein the target neural network model is a model obtained by training the initial neural network model to be trained, and the target recognition result includes the disease area selected by using the target detection box in the second image.
[0034] Optionally, in this embodiment, the neural network model is an algorithmic mathematical model that mimics the behavioral characteristics of animal neural networks and performs distributed parallel information processing. Therefore, the training process of the initial neural network model is the process of learning to detect and identify diseased areas. In addition, other models with similar functions to the neural network model can be used to identify the second image to obtain target recognition results, such as the Faster R-CNN model. The detection box is a label used to select the diseased areas in the second image. Other labeling methods can also be used to identify the diseased areas in the second image.
[0035] The device performing the above operations can be a controller, processor, server, or other processing devices or units with similar processing capabilities. The target device can be a smart device, such as a smart drone that supports image capture.
[0036] Optionally, in this embodiment, there can be multiple target devices for acquiring the first image, thereby improving the acquisition efficiency of the first image. In addition, if one of the target devices suddenly malfunctions, the acquisition work does not need to be interrupted, and other intelligent devices with image capturing functions can be controlled to acquire images. Furthermore, since the first image includes multiple images, the image parameters of the multiple first images can be adjusted to obtain multiple second images, and then the multiple second images are input into the target neural network model to obtain multiple target recognition results, thereby enabling centralized detection and recognition of a large area of disease, further improving the detection efficiency of disease areas.
[0037] This invention allows for the acquisition of a first image from a target device, followed by adjustment of its image parameters using a preset algorithm to obtain a second image. This second image is then input into a target neural network model to obtain the target recognition result. By adjusting the image parameters of the first image using a preset algorithm to obtain the adjusted second image, and then using a target neural network model to detect and identify diseased areas in the second image, this invention solves the problem of low detection efficiency for diseased areas in related technologies, thereby improving both the detection efficiency and effectiveness of diseased areas.
[0038] In an exemplary embodiment, the method further includes: acquiring sample images and sample detection boxes corresponding one-to-one with the sample images, wherein the sample detection boxes are used to select diseased areas in the sample images, and the sample images are images pre-acquired by the acquisition device; adjusting the image parameters of the sample images in a graphics processor using the preset algorithm to obtain a third image; and training the initial neural network model to be trained in the graphics processor using the sample images and the third image as a training sample set to obtain the target neural network model.
[0039] Optionally, in this embodiment, the sample detection box corresponding one-to-one with the sample image can be a label manually marked on the sample image, or a label marked on the sample image by the model algorithm. By marking the sample detection box in the disease area on the sample image, it is possible to more intuitively see which areas are disease areas, thereby improving the accuracy of disease area detection. In addition, the preset algorithm can be pre-set, manually set according to the actual application scenario, or it can be an algorithm built into the image processor. The preset algorithm can also be adjusted according to the actual application situation, but the image parameters adjusted by the preset algorithm must meet the requirements.
[0040] In one of the above embodiments, in addition to training the initial neural network model in a graphics processor, the initial neural network model can also be trained in other processors or processing devices with similar functions to the graphics processor. Furthermore, by using the sample image, the third image, and the sample detection box as training sample sets to train the initial neural network model to be trained, the target neural network model obtained can detect and identify the disease area in the second image, which can further improve the detection effect of the disease area.
[0041] In an exemplary embodiment, training the initial neural network model to be trained in the graphics processor using the sample image and the third image as training sample sets to obtain the target neural network model includes: training the initial neural network model to be trained in the graphics processor using the sample image and the third image as training sample sets, wherein each sample image and its corresponding sample detection box are used as training sample pairs input in each round of the training sample set, or each third image and its corresponding sample detection box are used as training sample pairs input in each round of the training sample set; determining the loss function of the initial neural network model based on the input training sample pairs, and determining whether the loss function satisfies a preset target convergence condition; adjusting the parameters of the initial neural network model if the loss function does not satisfy the target convergence condition; and generating the target neural network model if the loss function satisfies the target convergence condition.
[0042] Optionally, in this embodiment, the target convergence condition can be a convergence condition pre-set according to the requirements, or a convergence condition pre-set according to previous training experience. The target convergence condition can also be adjusted according to the actual application situation. In addition, if the loss function does not meet the target convergence condition, the parameters of the initial neural network model can be manually adjusted, or the model can automatically adjust the parameters.
[0043] In an exemplary embodiment, training the initial neural network model to be trained in the graphics processor using the sample image and the third image as training sample sets includes: performing multiple rounds of training on the initial neural network model through the following steps until the loss function satisfies the target convergence condition, wherein the image input to the initial neural network model in each round of training is considered the current image; extracting sample feature maps from the current image through an attention-based target extraction module; generating a first detection box based on the sample feature maps; determining the classification result of the first detection box based on the positional relationship between the sample detection box and the sample detection box corresponding to the current image, wherein the classification result is used to indicate whether the region selected by the first detection box is a disease region; and determining the initial neural network model based on the input training sample pairs. The loss function is used to determine whether it satisfies a preset target convergence condition. This includes: determining that the loss function satisfies the target convergence condition when the probability that the classification result indicated by the loss function is the same as the result indicated by the sample detection box satisfies a preset threshold or the number of training epochs satisfies a preset epoch threshold, wherein the classification result is the classification result corresponding to the first detection box, the fact that the classification result is the same as the result indicated by the sample detection box indicates that the region selected by the first detection box is the disease region, and the result indicated by the sample detection box is that the region selected by the sample detection box is the disease region; and determining that the loss function does not satisfy the target convergence condition when the probability that the classification result indicated by the loss function is the same as the result indicated by the sample detection box does not satisfy the preset threshold or the number of training epochs does not satisfy the preset epoch threshold.
[0044] Optionally, in this embodiment, an attention-based target extraction module (which can selectively extract sample feature maps of smaller lesion areas in the current image, thereby improving the detection effect of smaller lesion areas) can be used to extract sample feature maps from the current image and generate a first detection box based on the sample feature maps. Then, the classification result of the first detection box is determined by calculating the distance between the sample detection box and the sample detection box corresponding to the current image. That is, if the distance between the sample detection box and the sample detection box corresponding to the current image is less than or equal to a preset distance threshold, the classification result is determined to be the same as the result indicated by the sample detection box (i.e., the position indicated by the detection box in the classification result is the same as the position indicated by the sample detection box). If the distance between the sample detection box and the sample detection box corresponding to the current image is greater than the distance threshold, the classification result is determined to be different from the result indicated by the sample detection box (i.e., the position indicated by the detection box in the classification result is different from the position indicated by the sample detection box). The distance threshold can be a preset value or a value set according to the actual application scenario. The distance threshold can also be adjusted according to the actual application situation.
[0045] In the above embodiments, both the preset threshold and the preset round threshold are preset values. The preset threshold can be set to 85%, 90%, 95%, etc., and the preset round threshold can be set to 100, 150, 200, etc. For example, when the preset threshold and the preset round threshold are 95% and 100, respectively, if the probability that the classification result represented by the loss function is the same as the result indicated by the sample detection box satisfies 95% or the training rounds are 100, it is determined that the loss function satisfies the target convergence condition. It should be noted that the above examples of the preset threshold and the preset round threshold are only exemplary embodiments. The preset threshold and the preset round threshold are not limited to the above examples, and the preset threshold and the preset round threshold can also be adjusted according to the actual application.
[0046] In an exemplary embodiment, the step of extracting sample feature maps from the current image using an attention-based target extraction module includes: obtaining a first feature map from the current image and inputting the first feature map into a target calculation module to obtain a target feature map, wherein the target calculation module includes preset residual edges used to linearly transform the input and output of the target calculation module; inputting the target feature map into the first calculation module and the target calculation module respectively to obtain a second feature map and a third feature map, wherein the second feature map and the third feature map extracted by the first calculation module and the target calculation module have different receptive fields; and performing a dot product operation on the second feature map and the third feature map to obtain the sample feature map.
[0047] Optionally, in this embodiment, the target calculation module can be a residual module based on an attention mechanism. The linear transformation includes the multiplication or addition of feature maps. The different receptive fields of the second and third feature maps indicate that the regions of the input image mapped by the second and third feature maps are different. That is, by obtaining feature maps with different receptive fields and performing dot multiplication, the detection range of the disease area is made larger. In addition, the residual edge can be preset or adjusted according to the actual application.
[0048] In an exemplary embodiment, adjusting the image parameters of the first image using a preset algorithm to obtain the second image includes: preprocessing the first image, wherein the preprocessing includes cropping, Gaussian filtering, and an adaptive enhancement algorithm.
[0049] Optionally, in this embodiment, the first image is cropped to obtain images of the same resolution, and these images are used to create a training set. This can avoid the problem of poor model training effect due to different resolutions. Gaussian filtering can remove noise interference such as salt and pepper, and adaptive enhancement of the images can improve the image detection and recognition effect.
[0050] In one exemplary embodiment, the target device includes a smart drone. In this embodiment, the target device may include other smart devices with similar functions to a smart drone, in addition to a smart drone.
[0051] Obviously, the embodiments described above are only some embodiments of the present invention, and not all embodiments.
[0052] The present invention will be described in detail below with reference to specific embodiments:
[0053] First, the image processing of this invention will be described in detail:
[0054] Images acquired by the drone (corresponding to the target device mentioned above) are cropped and used to create a training set at a resolution of 1920*1080. Some images are first subjected to Gaussian filtering to remove noise interference such as salt-and-pepper particles, and then adaptive enhancement is performed. The Retinex algorithm (corresponding to the preset algorithm mentioned above) is used to enhance the consistency of image color range, edges, and color perception. The original and enhanced images are placed together to create the training dataset. A Faster-R-CNN model with an attention mechanism (corresponding to the target neural network model mentioned above) is trained. In principle, this involves adding an attention module similar to ResNet residual blocks (corresponding to the target computation module mentioned above) to the feature map extraction of Faster-R-CNN. Figure 3 This is a schematic diagram of the ResNet residual block attention mechanism according to an embodiment of the present invention, as shown below. Figure 3 As shown, Figure 3 The main residual block in the diagram corresponds to the target calculation module mentioned above, used to obtain the target feature map and the second feature map. The processing flow corresponding to the left and right branches below the main residual block in the diagram both belong to the first calculation module mentioned above, used to obtain the third feature map. The scaling operation corresponds to the dot product operation mentioned above. The left and right branches below the main residual block in the diagram are different processing flows based on attention. The visualization layer is used to normalize the data and accelerate the training and fitting speed. The activation functions include, but are not limited to, ReLU and sigmoid. Introducing an attention-based residual block (ResNet, corresponding to the target calculation module mentioned above) into the model has a better recognition effect on small targets.
[0055] Figure 4 This is a flowchart illustrating the detection process of pine trees infested with pine nematode disease in UAV remote sensing images based on an attention mechanism, according to an embodiment of the present invention. Figure 4 As shown, the process includes the following steps:
[0056] S402, the drone captures and acquires an image of the target (corresponding to the first image mentioned above);
[0057] S404: Use dedicated software to stitch the acquired images, cut the large image, and directly execute step S410.
[0058] S406, Perform Gaussian filtering on the image (corresponding to the first image above) to remove noise signals, etc.;
[0059] S408 uses the Retinex algorithm for adaptive image enhancement;
[0060] S410, Modify the residual block in the feature extraction network module (corresponding to the target extraction module above) of the Faster-rcnn model to introduce an attention mechanism, construct an attention mechanism residual block (corresponding to the target calculation module above), set the initialization parameters of the improved Faster-rcnn model, and use the improved Faster-rcnn model to train the adaptively enhanced image (corresponding to the second image above) and the cropped image in step S404 above.
[0061] S412, stop training when the model training loss (corresponding to the above loss function) reaches the expected convergence (corresponding to the above target convergence condition), and obtain the trained model (corresponding to the above target neural network model);
[0062] S414, acquire the image to be tested (corresponding to the sample image above) collected by the drone;
[0063] S416, crop the image to be tested to a resolution of 1920*1080;
[0064] S418 performs Gaussian filtering on the cropped image;
[0065] S420, The Retinex algorithm is used to adaptively enhance the image, and the processed image (corresponding to the above training sample set) is input into the model trained in step S412 for prediction;
[0066] S422, Obtain the target region (corresponding to the target recognition result above).
[0067] As can be seen from the foregoing embodiments, after acquiring ground object images through UAV remote sensing aerial photography, the acquired images are cropped to obtain images with a resolution of 1920*1080. The original images are preprocessed, and the unprocessed and preprocessed images are selected to create a training set. By setting the pine nematode disease area of the target image as the region of interest, the model is trained and features are learned using the attention mechanism. Then, the prediction image is preprocessed in the same way and input into the model for result prediction. This effectively overcomes the limitations of manual searching for diseased pine trees. The high-performance computing characteristics of GPU devices can be used to accelerate the detection of pine nematode disease areas. At the same time, the attention mechanism's friendly characteristics for small target detection optimize the detection effect of specific disease locations with small disease areas.
[0068] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0069] This embodiment also provides a device for determining the diseased area, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0070] Figure 5This is a structural block diagram of a device for determining the diseased area according to an embodiment of the present invention, such as... Figure 5 As shown, the device includes:
[0071] The first acquisition module 52 is used to acquire a first image collected by the target device, wherein the target device is a device for acquiring images based on remote sensing technology, and the first image is an image including the disease area to be detected;
[0072] Adjustment module 54 is used to adjust the image parameters of the first image using a preset algorithm to obtain the second image;
[0073] The first processing module 56 is used to input the second image into the target neural network model to obtain the target recognition result. The target neural network model is a model obtained by training the initial neural network model to be trained. The target recognition result includes the disease area selected by using a target detection box in the second image.
[0074] In an exemplary embodiment, the above apparatus further includes: a second acquisition module, configured to acquire sample images and sample detection boxes corresponding one-to-one with the sample images, wherein the sample detection boxes are used to select diseased areas in the sample images, and the sample images are images pre-acquired by the acquisition device; an adjustment module, configured to adjust the image parameters of the sample images in a graphics processor using the preset algorithm to obtain a third image; and a second processing module, configured to use the sample images and the third images as training sample sets in the graphics processor to train the initial neural network model to be trained, thereby obtaining the target neural network model.
[0075] In an exemplary embodiment, the second processing module includes: a training submodule, configured to train the initial neural network model to be trained in the graphics processor using the sample image and the third image as training sample sets, wherein each sample image and its corresponding sample detection box serve as a training sample pair input in each round of the training sample set, or each third image and its corresponding sample detection box serve as a training sample pair input in each round of the training sample set; a determination submodule, configured to determine the loss function of the initial neural network model based on the input training sample pairs, and determine whether the loss function satisfies a preset target convergence condition; an adjustment submodule, configured to adjust the parameters of the initial neural network model if the loss function does not satisfy the target convergence condition; and a generation submodule, configured to generate the target neural network model if the loss function satisfies the target convergence condition.
[0076] In an exemplary embodiment, the training submodule includes: a processing unit, configured to train the initial neural network model multiple times through the following steps until the loss function satisfies the target convergence condition, wherein the image input to the initial neural network model during each training round is considered the current image; extracting sample feature maps from the current image through an attention-based target extraction module; generating a first detection box based on the sample feature maps; determining the classification result of the first detection box based on the positional relationship between the sample detection box and the sample detection box corresponding to the current image, wherein the classification result is used to indicate whether the region selected by the first detection box is a disease region; and a determining unit, configured to determine the loss function of the initial neural network model based on the input training sample pairs, and determine the loss function. Whether the preset target convergence condition is met includes: if the probability that the classification result represented by the loss function is the same as the result indicated by the sample detection box meets a preset threshold or the number of training epochs meets a preset epoch threshold, then the loss function is determined to meet the target convergence condition. Here, the classification result is the classification result corresponding to the first detection box, and the fact that the classification result is the same as the result indicated by the sample detection box indicates that the region selected by the first detection box is the disease region, and the result indicated by the sample detection box is that the region selected by the sample detection box is the disease region; if the probability that the classification result represented by the loss function is the same as the result indicated by the sample detection box does not meet the preset threshold or the number of training epochs does not meet the preset epoch threshold, then the loss function is determined not to meet the target convergence condition.
[0077] In an exemplary embodiment, the processing unit includes: a first processing subunit, configured to acquire a first feature map from the current image and input the first feature map into a target calculation module to obtain a target feature map, wherein the target calculation module includes preset residual edges, the residual edges being used to perform a linear transformation on the input and output of the target calculation module; a second processing subunit, configured to input the target feature map into the first calculation module and the target calculation module respectively to obtain a second feature map and a third feature map, wherein the second feature map and the third feature map extracted by the first calculation module and the target calculation module have different receptive fields; and a third processing subunit, configured to perform a dot product operation on the second feature map and the third feature map to obtain the sample feature map.
[0078] In an exemplary embodiment, the adjustment module 54 includes a third processing module for preprocessing the first image, wherein the preprocessing includes at least one of the following: cropping, Gaussian filtering, and adaptive enhancement algorithm.
[0079] In one exemplary embodiment, the above-described apparatus further includes: the target device includes a smart drone.
[0080] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0081] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.
[0082] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0083] Embodiments of the present invention also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.
[0084] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0085] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0086] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0087] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for determining a diseased area, characterized in that, include: Acquiring a first image captured by a target device, and adjusting the image parameters of the first image using a preset algorithm to obtain a second image, includes: preprocessing the first image, wherein the preprocessing includes cropping, Gaussian filtering, and adaptive enhancement algorithms, the target device is a device that acquires images based on remote sensing technology, and the first image is an image including the disease area to be detected; The second image is input into the target neural network model to obtain the target recognition result. The target neural network model is a model obtained by training the initial neural network model to be trained. The target recognition result includes the disease area selected by using a target detection box in the second image. The method further includes: obtaining a first feature map from the current image, inputting the first feature map into a target calculation module to obtain a target feature map, inputting the target feature map into the first calculation module and the target calculation module respectively to obtain a second feature map and a third feature map, performing a dot product operation on the second feature map and the third feature map to obtain a sample feature map, wherein the target calculation module includes a preset residual edge, the residual edge is used to perform a linear transformation on the input and output of the target calculation module, the second feature map and the third feature map extracted by the first calculation module and the target calculation module have different receptive fields, and the image input to the initial neural network model in each round of training is regarded as the current image; The method further includes: acquiring sample images and sample detection boxes corresponding to each sample image; adjusting the image parameters of the sample images in a graphics processor using the preset algorithm to obtain a third image; and training the initial neural network model in the graphics processor using the sample images and the third image as a training sample set to obtain the target neural network model. The sample detection boxes are used to select diseased areas in the sample images. The sample images are images pre-acquired by the acquisition device. Each sample image and its corresponding sample detection box serve as a training sample pair input in each round of the training sample set, or each third image and its corresponding sample detection box serve as a training sample pair input in each round of the training sample set.
2. The method according to claim 1, characterized in that, The step of training the initial neural network model in the graphics processor using the sample image and the third image as training sample sets to obtain the target neural network model includes: The initial neural network model is trained in the graphics processor using the sample image and the third image as training sample sets. The loss function of the initial neural network model is determined based on the input training sample pairs, and it is determined whether the loss function satisfies the preset target convergence condition. If the loss function does not meet the target convergence condition, the parameters of the initial neural network model are adjusted. The target neural network model is generated when the loss function satisfies the target convergence condition.
3. The method according to claim 2, characterized in that, The step of training the initial neural network model in the graphics processor using the sample image and the third image as training sample sets includes: The initial neural network model is trained in multiple rounds through the following steps until the loss function satisfies the target convergence condition, wherein the image input to the initial neural network model during each training round is considered the current image: a sample feature map is extracted from the current image through an attention-based target extraction module; a first detection box is generated based on the sample feature map; the classification result of the first detection box is determined based on the positional relationship between the sample detection box and the sample detection box corresponding to the current image, wherein the classification result is used to indicate whether the region selected by the first detection box is a diseased area; The step of determining the loss function of the initial neural network model based on the input training sample pairs and determining whether the loss function satisfies the preset target convergence condition includes: determining that the loss function satisfies the target convergence condition when the probability that the classification result is the same as the result indicated by the sample detection box satisfies a preset threshold or the training epochs satisfy a preset epoch threshold, wherein the classification result is the classification result corresponding to the first detection box, the same classification result as the result indicated by the sample detection box indicates that the region selected by the first detection box is the disease region, and the result indicated by the sample detection box is that the region selected by the sample detection box is the disease region; determining that the loss function does not satisfy the target convergence condition when the probability that the classification result is the same as the result indicated by the sample detection box does not satisfy the preset threshold or the training epochs satisfy the preset epoch threshold.
4. The method according to any one of claims 1 to 3, characterized in that, The target equipment includes intelligent drones.
5. A device for determining a diseased area, characterized in that, include: The first acquisition module is used to acquire a first image collected by a target device, wherein the target device is a device for acquiring images based on remote sensing technology, and the first image is an image including the diseased area to be detected. An adjustment module is used to adjust the image parameters of the first image using a preset algorithm to obtain a second image; The first processing module is used to input the second image into a target neural network model to obtain a target recognition result, wherein the target neural network model is a model obtained by training an initial neural network model to be trained, and the target recognition result includes the disease area selected by using a target detection box in the second image; The device is further configured to: obtain a first feature map from the current image, input the first feature map into the target calculation module to obtain a target feature map, input the target feature map into the first calculation module and the target calculation module respectively to obtain a second feature map and a third feature map, perform a dot product operation on the second feature map and the third feature map to obtain a sample feature map, wherein the target calculation module includes a preset residual edge, the residual edge is used to perform a linear transformation on the input and output of the target calculation module, the second feature map and the third feature map extracted by the first calculation module and the target calculation module have different receptive fields, and the image input into the initial neural network model in each round of training is regarded as the current image; The device is further configured to: preprocess the first image, wherein the preprocessing includes cropping, Gaussian filtering, and an adaptive enhancement algorithm; The device is further configured to: acquire sample images and sample detection boxes corresponding to the sample images one-to-one; adjust the image parameters of the sample images in a graphics processor using the preset algorithm to obtain a third image; and train the initial neural network model in the graphics processor using the sample images and the third image as a training sample set to obtain the target neural network model. The sample detection boxes are used to select diseased areas in the sample images. The sample images are images pre-acquired by the acquisition device. Each sample image and its corresponding sample detection box serve as a training sample pair input in each round of the training sample set, or each third image and its corresponding sample detection box serve as a training sample pair input in each round of the training sample set.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of claims 1 to 4.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 4.
Citation Information
Patent Citations
Crop disease recognition method and device, electronic equipment and storage medium
CN113902735A