An apple disease recognition method based on improved YOLOv5s model

By making lightweight improvements to the YOLOv5s model, including configuring a lightweight Phantom bottleneck layer, adjusting the feature map width, adding a convolutional block attention module and feature pyramid module, the problems of slow recognition speed, large storage occupancy and low recognition accuracy in Apple disease recognition are solved, and efficient and accurate Apple disease recognition is achieved.

CN114819052BActive Publication Date: 2025-03-21SHANDONG AGRICULTURAL UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210199557.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-01
Publication Date
2025-03-21
Estimated Expiration
2042-03-01

AI Technical Summary

Technical Problem

The prior art has problems in Apple disease recognition with slow recognition speed, large storage occupancy and low recognition accuracy, especially in the recognition of mixed images of multiple diseases.

Method used

Lightweight improvements are made based on the YOLOv5s model, including configuring a lightweight Phantom bottleneck layer in the backbone network and the neck network, adjusting the feature map width, adding a convolutional block attention module, and configuring a feature pyramid module and a secondary stacking module in the neck network.

Benefits of technology

It realizes the lightweight model, low storage occupancy, fast recognition speed and high recognition accuracy, especially in Apple's disease recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114819052B_ABST
    Figure CN114819052B_ABST
Patent Text Reader

Abstract

The present application relates to the field of neural network and target recognition technology, and more specifically, to an apple disease recognition method based on an improved YOLOv5s model. The method comprises: obtaining an apple disease dataset and preprocessing the apple disease dataset; performing lightweight improvement on the YOLOv5s model; training the improved YOLOv5s model based on the preprocessed apple disease dataset; and using the trained improved YOLOv5s model to recognize the target apple disease image. The improved model of the present application achieves lightweight model and low storage occupancy, and uses the trained improved YOLOv5s model to recognize the target apple disease image, with fast recognition speed and high recognition accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of neural networks and target recognition. More specifically, the present application relates to an apple disease recognition method based on an improved YOLOv5s model. Background Art

[0002] Apple is an important fruit crop in the world, but the occurrence of diseases seriously affects its yield and quality. Timely and accurate identification of apple diseases can avoid delays in prevention and control and pesticide abuse caused by misidentification of diseases, and is an important step in achieving apple disease prevention and control. Traditional apple disease identification methods rely on personal experience diagnosis, which has poor reliability and timeliness, and are gradually becoming difficult to cope with the current situation of the continuous expansion of apple planting and production scale. With the development of computer vision technology, disease diagnosis through artificial intelligence has become an inevitable trend in agricultural development.

[0003] Convolutional neural networks have become a commonly used image recognition method due to their excellent performance in the field of image recognition. At present, in the field of disease recognition, convolutional neural networks based on image classification are widely used, but their characteristic of predicting a single label from a single image is difficult to apply to images mixed with multiple diseases, and they are lacking in practical applications. In particular, target detection, as a downstream task of image classification, often requires a large amount of anchor box calculations to predict the location information of target instances while performing feature extraction. The storage and computing resources occupied are often higher than those of image classification tasks, but this brings certain difficulties to the later deployment of the model on the mobile terminal. Summary of the invention

[0004] Based on the above technical problems, the present invention aims to build an apple disease detection model with low storage occupancy, fast recognition speed and high recognition accuracy. The model is lightweight and improved based on YOLOv5s as the basic framework.

[0005] A first aspect of the present invention provides an apple disease identification method based on an improved YOLOv5s model, the method comprising:

[0006] Acquire an apple disease dataset, and preprocess the apple disease dataset;

[0007] Lightweight improvements to the YOLOv5s model;

[0008] The improved YOLOv5s model is trained based on the preprocessed apple disease dataset;

[0009] The trained improved YOLOv5s model is used to identify the target apple disease images.

[0010] In some embodiments of the present invention, preprocessing the apple disease dataset includes:

[0011] Rotating the images in the apple disease dataset by a preset angle to simulate images at different shooting angles;

[0012] Randomly enhance the chromaticity, saturation and contrast of the rotated image to simulate images under different lighting conditions;

[0013] The randomly enhanced images are sharpened to simulate images with different sharpness.

[0014] In some embodiments of the present invention, the lightweight improvement of the YOLOv5s model includes:

[0015] Configure lightweight phantom bottleneck layers in the backbone and neck networks of the YOLOv5s model;

[0016] Adjust the width of the feature map of the YOLOv5s model;

[0017] A convolutional block attention module is added to the backbone network of the YOLOv5s model, wherein the convolutional block attention module includes a channel attention module and a spatial attention module.

[0018] In some embodiments of the present invention, the lightweight improvement of the YOLOv5s model further includes:

[0019] Configure the feature pyramid module in the neck network of the YOLOv5s model;

[0020] A secondary stacking module is constructed in the pyramid module.

[0021] In some embodiments of the present invention, constructing a secondary stacking module in the pyramid module includes:

[0022] Get the Transformer encoder with self-attention mechanism;

[0023] Two Transformer encoders based on the self-attention mechanism are stacked to form a secondary stacking module.

[0024] In some embodiments of the present invention, after training the improved YOLOv5s model based on the preprocessed apple disease dataset, the method further includes:

[0025] Evaluate the improved YOLOv5s model;

[0026] The improved YOLOv5s model that was selected and evaluated was determined to be trained.

[0027] In some embodiments of the present invention, the method of identifying target apple diseases using the trained improved YOLOv5s model includes:

[0028] Input the target apple disease image into the trained improved YOLOv5s model;

[0029] The backbone network including the lightweight phantom bottleneck layer performs phantom convolution processing on the target apple disease image, and then performs weighted processing through a channel attention module and a spatial attention module to obtain a first feature map;

[0030] Inputting the first feature map into the improved neck network, and performing feature fusion processing by the feature pyramid module to obtain a second feature map;

[0031] The second feature map is predicted, and the confidence level of the disease to which the target apple disease image belongs is output.

[0032] A second aspect of the present invention provides an apple disease identification device based on an improved YOLOv5s model, the device comprising:

[0033] An acquisition module, used for acquiring an apple disease dataset and preprocessing the apple disease dataset;

[0034] Improvement module, used to make lightweight improvements to the YOLOv5s model;

[0035] The training module is used to train the improved YOLOv5s model based on the preprocessed apple disease dataset;

[0036] The recognition module is used to identify the target apple disease images using the trained improved YOLOv5s model.

[0037] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps:

[0038] Acquire an apple disease dataset, and preprocess the apple disease dataset;

[0039] Lightweight improvements to the YOLOv5s model;

[0040] The improved YOLOv5s model is trained based on the preprocessed apple disease dataset;

[0041] The trained improved YOLOv5s model is used to identify the target apple disease images.

[0042] A fourth aspect of the present invention provides a computer program product, comprising a computer program, which, when executed by a processor, implements the following steps:

[0043] Acquire an apple disease dataset, and preprocess the apple disease dataset;

[0044] Lightweight improvements to the YOLOv5s model;

[0045] The improved YOLOv5s model is trained based on the preprocessed apple disease dataset;

[0046] The trained improved YOLOv5s model is used to identify the target apple disease images.

[0047] The beneficial effects of the present application are as follows: the present application configures a lightweight phantom bottleneck layer in the backbone network and the neck network of the YOLOv5s model, adjusts the width of the feature map of the YOLOv5s model, adds a convolutional block attention module to the backbone network of the YOLOv5s model, and configures a feature pyramid module in the neck network of the YOLOv5s model, and constructs a secondary stacking module in the pyramid module. This series of improvements enables the model to achieve lightweight and low storage occupancy, and uses the trained improved YOLOv5s model to identify the target apple disease image, with fast recognition speed and high recognition accuracy. In particular, the use of a weighted bidirectional feature pyramid network realizes bidirectional cross-scale connection, improves the representation learning ability of the model, and enhances the robustness of the features, while the secondary stacking module, as a detection head, improves the global information acquisition ability of the model.

[0048] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] The accompanying drawings, which constitute a part of the specification, illustrate embodiments of the present application and, together with the description, serve to explain the principles of the present application.

[0050] The present application can be more clearly understood from the following detailed description with reference to the accompanying drawings, in which:

[0051] Figure 1 A schematic diagram of the steps of an apple disease identification method based on an improved YOLOv5s model according to an exemplary embodiment of the present application is shown;

[0052] Figure 2 The overall schematic diagram of the improved YOLOv5s model in an exemplary embodiment of the present application is shown;

[0053] Figure 3A schematic diagram showing the working process of the feature pyramid module in the improved YOLOv5s model in an exemplary embodiment of the present application is shown;

[0054] Figure 4 A schematic diagram showing the working process of the secondary stacking module and the attention mechanism module in the improved YOLOv5s model according to an exemplary embodiment of the present application is shown;

[0055] Figure 5 A schematic diagram showing the effect of apple disease identification according to an exemplary embodiment of the present application is shown;

[0056] Figure 6 A schematic diagram of the structure of an apple disease identification device based on an improved YOLOv5s model according to an exemplary embodiment of the present application is shown;

[0057] Figure 7 A schematic diagram of the structure of a computer device provided by an exemplary embodiment of the present application is shown;

[0058] Figure 8 A schematic diagram of a storage medium provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION

[0059] Hereinafter, embodiments of the present application will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present application. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present application. It is obvious to those skilled in the art that the present application can be implemented without one or more of these details. In other examples, in order to avoid confusion with the present application, some technical features known in the art are not described.

[0060] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should also be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of the features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0061] Now, exemplary embodiments according to the present application will be described in more detail with reference to the accompanying drawings. However, these exemplary embodiments may be implemented in a variety of different forms and should not be construed as being limited to the embodiments described herein. The accompanying drawings are not drawn to scale, and certain details may be magnified and certain details may be omitted for the purpose of clear expression. The shapes of the various regions and layers shown in the figures and the relative sizes and positional relationships therebetween are merely exemplary, and may deviate in practice due to manufacturing tolerances or technical limitations, and those skilled in the art may additionally design regions / layers with different shapes, sizes, and relative positions according to actual needs.

[0062] The following is attached to the instruction manual Figure 1-8 Several embodiments are given to describe exemplary implementations according to the present application. It should be noted that the following application scenarios are only shown to facilitate understanding of the spirit and principles of the present application, and the implementations of the present application are not limited in this regard. On the contrary, the implementations of the present application can be applied to any applicable scenario.

[0063] At present, in the field of disease recognition, convolutional neural networks based on image classification are widely used, but their single image prediction of a single label is difficult to apply to images with multiple diseases, and they are lacking in practical applications. Target detection technology uses disease spots in images as examples for feature learning, and can output multiple disease spot instances (category information + location information) in one disease image, thereby achieving the purpose of identifying multiple disease images.

[0064] As a downstream task of image classification, target detection often requires a large amount of anchor box calculations to predict the location information of target instances while extracting features. The storage and computing resources occupied are often higher than those of image classification tasks, which brings certain difficulties to the later deployment of models on mobile terminals. In addition, in order to meet the needs of mobile terminal deployment, the lightweight processing of the model often brings certain accuracy losses, so seeking a balance between model complexity and accuracy has become one of the difficulties in improving the deep learning spot detection model technology.

[0065] Therefore, in some exemplary embodiments of the present application, a method for identifying apple diseases based on an improved YOLOv5s model is provided, such as Figure 1 As shown, the method includes:

[0066] S1. Obtain an apple disease dataset, and preprocess the apple disease dataset;

[0067] S2. Improve the YOLOv5s model in a lightweight way;

[0068] S3, training the improved YOLOv5s model based on the preprocessed apple disease dataset;

[0069] S4. Use the trained improved YOLOv5s model to identify the target apple disease images.

[0070] In the specific implementation, the apple disease dataset in S1 mainly comes from collected data, and a small part comes from network resources. The types of disease images include bitter pit, anthracnose, fruit rust, ring rot, etc. The LabelImg annotation tool is used to annotate the image spots, divide the training set and the test set, and construct the apple disease dataset in VOC format. The apple disease dataset is preprocessed in S1, including: rotating the images in the apple disease dataset by preset angles such as 90 degrees, 180 degrees, and 270 degrees to simulate images with different shooting angles; randomly enhancing the chromaticity, image saturation, and image contrast of the rotated image to simulate images under different lighting conditions; sharpening the randomly enhanced image to simulate images with different clarity.

[0071] In the specific implementation, refer to Figures 2 to 4 S2 makes lightweight improvements to the YOLOv5s model, including: configuring lightweight phantom bottleneck layers in the backbone network (Backbone) and neck network (Neck) of the YOLOv5s model; adjusting the width of the feature map of the YOLOv5s model, specifically adjusting the overall width of the feature map from 0.5 to 0.25; adding a convolutional block attention module (CBAM) to the backbone network of the YOLOv5s model, wherein the convolutional block attention module includes a channel attention module and a spatial attention module; configuring a feature pyramid module in the neck network of the YOLOv5s model; and constructing a secondary stacking module in the pyramid module. Constructing a secondary stacking module (CBAM) in the pyramid module Figure 2 The TR2 module in the embodiment includes: obtaining a Transformer encoder of a self-attention mechanism; and stacking two Transformer encoders based on the self-attention mechanism to form a secondary stacking module.

[0072] Specifically, Figure 2 As shown in the figure, the ghost bottleneck layer used can replace the redundant features generated by normal convolution with ghost features generated by simple linear operations to reduce the model complexity. Phantom convolution consists of two parts: original convolution and linear transformation. Phantom generates ghost features by processing the original feature map through linear transformation on the basis of conventional convolution operation, and combines the two sets of feature maps to form a new feature map. Figure 3 As shown in Figure 1, the feature pyramid module is connected to the backbone network, which can achieve path aggregation and further integrate the image features output by the backbone network. Figure 3As shown in the figure, the improved YOLOv5s model follows the idea of ​​BIFPN, and performs cross-local bidirectional connections on the B2 features generated by the backbone network at the same level, the F1 features generated by the feature pyramid network (i.e., the feature pyramid module), and the P1 features generated by the path aggregation network, thereby forming a more robust aggregate feature P1 feature. Figure 4 As shown, Transformer encoder module 1 and Transformer encoder module 2 are stacked to form a secondary stacking module, and are configured at the detection head position (between the pre-network and the output), thereby improving the global information acquisition capability of the model.

[0073] CBAM improves the model's attention to local information and spatial information in space and channels by weighting features in both spatial and channel dimensions. It consists of two parts: the channel attention module and the spatial attention module. In the channel attention module, the feature map F is converted into two channel maps through global average pooling and maximum pooling, respectively. These two feature maps are processed by two layers of shared multi-layer perceptrons to obtain two new features. After the new features are added, they are activated by the Sigmoid function to obtain the weight coefficient Mc. Finally, the weight coefficient Mc is multiplied by the feature F to generate a scaled new feature. The calculation formula is as follows:

[0074] Mc(F)=σ(MLP(AvgPool(F)))+σ(MLP(MaxPool(F)))

[0075] Among them, F represents the original feature map, represents the Sigmoid activation function, and MLP represents the multi-layer perceptron. In the spatial attention module, the module concatenates the channel mapping formed by the feature map F after global average pooling and maximum pooling, and obtains the weight coefficient Ms after a 7×7 convolution operation and a Sigmoid activation function. Finally, the weight coefficient Ms is multiplied by the feature F' to obtain a new feature map. The calculation process is as follows:

[0076] Ms(F′)=f 7×7 [(AvgPool(F′);MaxPool(F′))]

[0077] Among them, F' represents the original feature map, f 7×7 Represents a 7×7 convolutional layer.

[0078] In a preferred embodiment, the improved YOLOv5s model is trained based on the preprocessed apple disease dataset in S3, and the data is divided into two parts: 400 bitter pit, 200 anthracnose, 500 fruit rust, and 100 ring rot images collected in Huangtuling Village, Anlinzhan Town, Feicheng City, Tai'an City, Shandong Province from September to October 2021, with a camera model of Sony A6000; 200 anthracnose and ring rot images crawled and screened from the Internet. All images are adjusted to 416×416 pixels, with a total of 1,400 apple fruit disease images. The images are annotated using the LabelImg tool, and the relative coordinates and corresponding categories of the lesions are stored in the xml file. The training set and test set were randomly divided in a ratio of 8:2 to obtain 1120 training sets and 280 test sets. The path information of the images was written into the corresponding train.txt and test.txt files through the program. The apple fruit disease dataset was constructed in VOC format. The annotated name and number of each disease image are shown in Table 1. The number of training sets was expanded from 1120 to 8960.

[0079] Table 1 Number of apple disease images

[0080]

[0081] The model training was carried out under the Ubuntu 18.04 system. The computer CPU used was Intel(R) Core(TM) i7-9750H, 2.60GHz, 16G memory, and the GPU was NVIDIA GeForce RTX 2060, with 6G video memory. In order to improve the training speed of the network, GPU was used for acceleration. The version of cuda was 11.1.0 and the version of cudnn was 8.1.0. During training, Stochastic Gradient Descent (SGD) was used as the optimizer to optimize the neural network. The initial learning rates were set to 0.1, 0.01, and 0.001, respectively, the momentum parameter was set to 0.9, and the weight decay parameter was set to 0.0005. The training adopted the warm up strategy, and the learning rate of 0.0001 was used for training in the first three epochs of training, and then the initial learning rate was restored. The input images were uniformly adjusted to 512×512 pixels, and the batch_size was set to 16.

[0082] In a preferred embodiment, after the improved YOLOv5s model is trained based on the preprocessed apple disease dataset, it also includes: evaluating the improved YOLOv5s model; selecting the improved YOLOv5s model determined to be trained after the evaluation. Specifically, the evaluation indicators used by the model are mAP@0.5, mAP@0.5:0.95, parameter quantity and average detection speed. Average Precision (AP) is the integral of the PR curve drawn by Precision (P) and Recall (R), reflecting the overall detection performance of the model. Mean Average Precision (mAP) is the mean of AP of all classification categories, and its calculation formula is as follows:

[0083]

[0084]

[0085]

[0086]

[0087] Among them, TP represents the number of correctly detected positive samples, FP represents the number of incorrectly detected positive samples, FN represents the number of incorrectly detected negative samples, and N is the number of classification categories. mAP@0.5 is the mAP of the model when the IOU threshold is 0.5, and mAP@0.5:0.95 is the average mAP of the model evaluated at different IOU thresholds (0.5 to 0.95, step size 0.05). The parameter quantity represents the size of the storage space occupied by the model file, in MB. The average detection speed is the average time taken by the model to detect a single test set image under the CPU.

[0088] In the experiment, one evaluation is performed every epoch of training, and a total of 300 epochs are trained. The effectiveness of the improved model is verified by comparing and evaluating the YOLOv5s algorithm using different optimization strategies. The model uses the models trained under three learning rates (0.1, 0.01, 0.001) for integrated reasoning (using multiple models for reasoning at the same time, and aggregating multiple reasoning results to generate the final prediction) to test the final accuracy. Table 2 shows the results of the YOLOv5s model ablation experiment, listing the mAP@0.5:0.95, parameter count, and average detection speed of different models.

[0089] Table 2 Ablation test results of YOLOv5s model

[0090]

[0091] As shown in Table 2, the use of phantom structure in the backbone network and neck network of YOLOv5s and the adjustment of network width effectively reduce the number of model parameters under the condition of sacrificing a certain model accuracy, and obtain a relatively lightweight baseline model YOLOv5s-Ghost (model A). Compared with YOLOv5s, its detection accuracy decreased by 1.7% in mAP@0.5 and 5.2% in mAP@0.5:0.95, but its parameter volume was reduced by more than 10 times, and the average detection speed was increased by 3 times. In order to improve the accuracy of the model, this paper optimizes the model using two improvement strategies, CBAM and BIFPN, based on the baseline model, and uses the TR2 module built on transformer as the prediction head to construct an improved YOLOv5s model (model D) to further improve the generalization ability of the model. The mAP@0.5 of the improved YOLOv5s model reaches 0.909, which is 2.6% higher than the baseline model and exceeds the YOLOv5s model; the mAP@0.5:0.95 reaches 0.671, which is 4% higher than the baseline model. Its mAP@0.5:0.95 reaches 0.671, which is 4% higher than model B and slightly lower than YOLOv5s, but its parameter size is only 2.06MB, and the average detection speed reaches 0.065s / photo, which is better than the YOLOv5s model.

[0092] Table 3 shows the integrated reasoning results of each model for bitter pit, anthracnose, fruit rust and ring rot images at 512×512 pixels. Under the AP@0.5 index, the YOLOv5s model showed high recognition ability on bitter pit and ring rot, reaching 0.960 and 0.942 respectively, but the recognition rate of anthracnose and fruit rust was low, only reaching 0.800 and 0.898. After adding the GhostBottleneck module, the overall accuracy of the model was further reduced. Compared with the baseline model A, the recognition performance of model B on apple ring rot was significantly improved, and model C performed better on apple fruit rust. The final model D, which is the improved YOLOv5s, achieved AP@0.5 of 0.810 and 0.940 on anthracnose and fruit rust, which is a certain improvement over the YOLOv5s model, and the model accuracy distribution is more balanced, indicating the effectiveness of the improvement strategy in this paper.

[0093] Table 3 Recognition accuracy of YOLOv5s model under different disease categories

[0094]

[0095] Figure 5 This is a schematic diagram of the effect of identifying apple diseases (the text in the figure is not limited and is only for illustration). Figure 5As shown, a represents bitter pit, b represents anthracnose, c represents fruit rust, and d represents ring rot. It can be seen that the disease recognition model proposed in this application (the trained improved YOLOv5s model) outputs the lesion category and corresponding position information and corresponding confidence information using the lesion area as an example, thereby ensuring the actual recognition effect of the model.

[0096] In a preferred embodiment, the trained improved YOLOv5s model can be used to identify the target apple disease, specifically including: inputting the target apple disease image into the trained improved YOLOv5s model; performing phantom convolution processing on the target apple disease image through the backbone network including the lightweight phantom bottleneck layer, and then performing weighted processing through the channel attention module and the spatial attention module to obtain a first feature map; inputting the first feature map into the improved neck network, and performing feature fusion processing through the feature pyramid module to obtain a second feature map; predicting the second feature map, outputting the confidence of the disease to which the target apple disease image belongs, and then obtaining the category to which the apple disease belongs.

[0097] This application configures a lightweight phantom bottleneck layer in the backbone network and neck network of the YOLOv5s model, adjusts the width of the feature map of the YOLOv5s model, adds a convolutional block attention module to the backbone network of the YOLOv5s model, and configures a feature pyramid module in the neck network of the YOLOv5s model, and constructs a secondary stacking module in the pyramid module. This series of improvements enables the model to achieve lightweight and low storage occupancy. The trained improved YOLOv5s model is used to identify the target apple disease image with fast recognition speed and high recognition accuracy. In particular, the use of a weighted bidirectional feature pyramid network realizes bidirectional cross-scale connection, improves the model's representation learning ability, and enhances the robustness of the features, while the secondary stacking module, as a detection head, improves the model's global information acquisition ability.

[0098] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application.

[0099] In some exemplary embodiments of the present application, an apple disease identification device based on an improved YOLOv5s model is also provided, such as Figure 6 As shown, the device comprises:

[0100] An acquisition module 601 is used to acquire an apple disease dataset and preprocess the apple disease dataset;

[0101] Improvement module 602, used for lightweight improvement of YOLOv5s model;

[0102] A training module 603 is used to train the improved YOLOv5s model based on the preprocessed apple disease dataset;

[0103] The recognition module 604 is used to recognize the target apple disease image using the trained improved YOLOv5s model.

[0104] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention.

[0105] It should also be emphasized that the system provided in the embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system of simulating, extending and expanding human intelligence, perceiving the environment, acquiring knowledge and using knowledge to obtain the best results using digital computers or machines controlled by digital computers. Basic artificial intelligence technologies generally include technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. Artificial intelligence software technology mainly includes computer vision technology, robotics, biometrics, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0106] Please refer to the following Figure 7 , which shows a schematic diagram of a computer device provided by some embodiments of the present application. Figure 7 As shown, the computer device includes: a processor 200, a memory 201, a bus 202 and a communication interface 203, and the processor 200, the communication interface 203 and the memory 201 are connected via the bus 202; the memory 201 stores a computer program that can be run on the processor 200, and when the processor 200 runs the computer program, it executes the apple disease identification method based on the improved YOLOv5s model provided in any of the aforementioned embodiments of the present application.

[0107] The memory 201 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 203 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.

[0108] The bus 202 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 201 is used to store programs, and the processor 200 executes the programs after receiving the execution instruction. The apple disease identification method based on the improved YOLOv5s model disclosed in any implementation of the aforementioned embodiment of the present application may be applied to the processor 200, or implemented by the processor 200.

[0109] The processor 200 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 200. The above processor 200 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a readily available programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 201, and the processor 200 reads the information in the memory 201 and completes the steps of the above method in combination with its hardware.

[0110] The present application also provides a computer-readable storage medium corresponding to the apple disease identification method based on the improved YOLOv5s model provided in the above embodiment, please refer to Figure 8 , Figure 8 The computer-readable storage medium shown is a CD 30 on which a computer program (i.e., a program product) is stored. When the computer program is executed by a processor, it will execute the apple disease identification method based on the improved YOLOv5s model provided in any of the aforementioned embodiments.

[0111] In addition, examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.

[0112] The computer-readable storage medium provided in the above-mentioned embodiments of the present application and the method for allocating channels for quantum key distribution in a space-division multiplexed optical network provided in the embodiments of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the application programs stored therein.

[0113] The present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, the steps of the apple disease identification method based on the improved YOLOv5s model provided in any of the aforementioned embodiments are implemented, including: obtaining an apple disease dataset and preprocessing the apple disease dataset; performing lightweight improvement on the YOLOv5s model; training the improved YOLOv5s model based on the preprocessed apple disease dataset; and using the trained improved YOLOv5s model to identify the target apple disease image.

[0114] It should be noted that the algorithms and displays provided herein are not inherently related to any particular computer, virtual device or other device. Various general devices can also be used together with the teachings based thereon. According to the above description, it is obvious that the structure required for constructing such devices is constructed. In addition, the present application is not directed to any specific programming language. It should be understood that the content of the present application described herein can be implemented using various programming languages, and the above description of specific languages ​​is to disclose the best implementation mode of the present application. In the specification provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this specification.

[0115] Similarly, it should be understood that in order to streamline the present application and aid in understanding one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, the various features of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the following intention: the claimed application requires more features than the features explicitly recited in each claim. More specifically, as reflected in the claims below, the inventive aspects lie in less than all the features of the single embodiment disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present application.

[0116] Those skilled in the art will appreciate that the modules in the devices in the embodiments can be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments can be combined into one module or unit or component, and in addition they can be divided into multiple submodules or subunits or subassemblies. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification and all processes or units of any method or device disclosed in this manner can be combined in any combination. Unless otherwise clearly stated, each feature disclosed in this specification can be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0117] The various component embodiments of the present application can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all functions of some or all components in the creation device of the virtual machine according to the embodiment of the present application. The present application can also be implemented as a device or device program for executing part or all of the methods described herein. The program implementing the present application can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0118] The above is only a preferred specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. An apple disease identification method based on an improved YOLOv5s model, characterized in that: The method comprises: Acquire an apple disease dataset, and preprocess the apple disease dataset; Lightweight improvements to the YOLOv5s model; The improved YOLOv5s model is trained based on the preprocessed apple disease dataset; Use the trained improved YOLOv5s model to identify the target apple disease images; The lightweight improvement of the YOLOv5s model includes: Configure lightweight phantom bottleneck layers in the backbone and neck networks of the YOLOv5s model; Adjust the width of the feature map of the YOLOv5s model; Add a convolutional block attention module to the backbone network of the YOLOv5s model, wherein the convolutional block attention module includes a channel attention module and a spatial attention module; The lightweight improvement of the YOLOv5s model also includes: Configure the feature pyramid module in the neck network of the YOLOv5s model; constructing a secondary stacking module in the pyramid module; A secondary stacking module is constructed in the pyramid module, comprising: Get the Transformer encoder with self-attention mechanism; Two Transformer encoders based on the self-attention mechanism are stacked to form a secondary stacking module.

2. The apple disease identification method based on the improved YOLOv5s model according to claim 1, characterized in that: The apple disease dataset is preprocessed, including: Rotating the images in the apple disease dataset by a preset angle to simulate images at different shooting angles; Randomly enhance the chromaticity, saturation and contrast of the rotated image to simulate images under different lighting conditions; The randomly enhanced images are sharpened to simulate images with different sharpness.

3. The apple disease identification method based on the improved YOLOv5s model according to claim 1, characterized in that: After training the improved YOLOv5s model based on the preprocessed apple disease dataset, the method further includes: Evaluate the improved YOLOv5s model; The improved YOLOv5s model that was selected and evaluated was determined to be trained.

4. The apple disease identification method based on the improved YOLOv5s model according to claim 1, characterized in that: The method of using the trained improved YOLOv5s model to identify target apple diseases includes: Input the target apple disease image into the trained improved YOLOv5s model; The backbone network including the lightweight phantom bottleneck layer performs phantom convolution processing on the target apple disease image, and then performs weighted processing through a channel attention module and a spatial attention module to obtain a first feature map; Inputting the first feature map into the improved neck network, and performing feature fusion processing by the feature pyramid module to obtain a second feature map; The second feature map is predicted, and the confidence level of the disease to which the target apple disease image belongs is output.

5. An apple disease identification device based on an improved YOLOv5s model, characterized in that: The device comprises: An acquisition module, used for acquiring an apple disease dataset and preprocessing the apple disease dataset; Improvement module, used to make lightweight improvements to the YOLOv5s model; The training module is used to train the improved YOLOv5s model based on the preprocessed apple disease dataset; The recognition module is used to identify the target apple disease images using the trained improved YOLOv5s model; The lightweight improvement of the YOLOv5s model includes: Configure lightweight phantom bottleneck layers in the backbone and neck networks of the YOLOv5s model; Adjust the width of the feature map of the YOLOv5s model; Add a convolutional block attention module to the backbone network of the YOLOv5s model, wherein the convolutional block attention module includes a channel attention module and a spatial attention module; The lightweight improvement of the YOLOv5s model also includes: Configure the feature pyramid module in the neck network of the YOLOv5s model; constructing a secondary stacking module in the pyramid module; A secondary stacking module is constructed in the pyramid module, comprising: Get the Transformer encoder with self-attention mechanism; Two Transformer encoders based on the self-attention mechanism are stacked to form a secondary stacking module.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

7. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Method for calculating the number of people in a closed space

    CN112686180A

  • Landslide detection method and device for small-size model

    CN112883907A