[go: up one dir, main page]

CN116645599A - A lightweight multi-scale CNN model for wheat disease detection - Google Patents

A lightweight multi-scale CNN model for wheat disease detection Download PDF

Info

Publication number
CN116645599A
CN116645599A CN202310469071.5A CN202310469071A CN116645599A CN 116645599 A CN116645599 A CN 116645599A CN 202310469071 A CN202310469071 A CN 202310469071A CN 116645599 A CN116645599 A CN 116645599A
Authority
CN
China
Prior art keywords
wheat
disease
images
wheat disease
training
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310469071.5A
Other languages
Chinese (zh)
Inventor
方鑫
甄彤
李智慧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Henan University of Technology
Original Assignee
Henan University of Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Henan University of Technology filed Critical Henan University of Technology
Priority to CN202310469071.5A priority Critical patent/CN116645599A/en
Publication of CN116645599A publication Critical patent/CN116645599A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/10Terrestrial scenes
    • G06V20/188Vegetation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/0464Convolutional networks [CNN, ConvNet]
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/0495Quantised networks; Sparse networks; Compressed networks
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/70Labelling scene content, e.g. deriving syntactic or semantic representations

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Multimedia (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Data Mining & Analysis (AREA)
  • Molecular Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Databases & Information Systems (AREA)
  • Medical Informatics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Analysis (AREA)

Abstract

本发明涉及小麦病害检测技术领域,尤其涉及一种轻量级多尺度CNN模型的小麦病害检测方法;包括以下步骤:S1、利用拍摄设备采集小麦病害图像,将小麦病害图像尺码大小统一,并对每类病害进行分类标注;S2、通过旋转、对称翻转、提高对比度对小麦病害数据扩充,将原始数据集扩充到8495张;按照训练集:验证集:测试集=6:2:2的比例划分数据集;S3、设计小麦病害图像检测的网络模型;S4、将S2中得到的小麦病害训练样本在S3所设计的网络模型中进行训练并在测试集上测试;本发明结构简单,计算量小,适用性广泛。

The present invention relates to the technical field of wheat disease detection, in particular to a wheat disease detection method of a lightweight multi-scale CNN model; comprising the following steps: S1, using a shooting device to collect wheat disease images, unifying the size of the wheat disease images, and Classify and label each type of disease; S2, expand the wheat disease data by rotating, symmetrically flipping, and improving the contrast, and expand the original data set to 8495 pieces; divide according to the ratio of training set: verification set: test set = 6:2:2 Data set; S3, design the network model of wheat disease image detection; S4, train the wheat disease training samples obtained in S2 in the network model designed by S3 and test on the test set; the present invention has simple structure and small amount of calculation , with wide applicability.

Description

一种轻量级多尺度CNN模型的小麦病害检测方法A lightweight multi-scale CNN model for wheat disease detection

技术领域technical field

本发明涉及小麦病害检测技术领域,尤其涉及一种轻量级多尺度CNN模型的小麦病害检测方法。The invention relates to the technical field of wheat disease detection, in particular to a wheat disease detection method of a lightweight multi-scale CNN model.

背景技术Background technique

小麦的产量和质量受多种因素的影响,小麦病害不仅是非常重要的因素之一,而且还是制约优质小麦高效生产的主要因素。小麦病害的种类众多,在全世界范围能够查阅到200多种小麦病害,在中国存在约20种发生较重的小麦病害,小麦白粉病、小麦锈病、小麦叶枯病等是很典型且较为严重的小麦病害。在中国,因病害影响,小麦的产量将近减少三分之一,这对粮食生产有巨大的危害。The yield and quality of wheat are affected by many factors. Wheat disease is not only one of the very important factors, but also the main factor restricting the efficient production of high-quality wheat. There are many kinds of wheat diseases, more than 200 kinds of wheat diseases can be found all over the world, and there are about 20 kinds of serious wheat diseases in China, wheat powdery mildew, wheat rust, wheat leaf blight, etc. are very typical and more serious diseases of wheat. In China, due to the impact of diseases, the yield of wheat has been reduced by nearly one-third, which has great harm to grain production.

基于机器学习的小麦病害识别方法依赖于图像的显式特征提取,这些图像特征的提取策略是人们基于先验知识制定的,一方面步骤繁杂,效率较低,特征提取依赖研究人员的知识和经验;另一方面,这些人工提取的特征往往存在于图像浅层,适用面窄。The wheat disease recognition method based on machine learning relies on the explicit feature extraction of images. The extraction strategies of these image features are formulated by people based on prior knowledge. On the one hand, the steps are complicated and the efficiency is low, and the feature extraction depends on the knowledge and experience of researchers. ; On the other hand, these artificially extracted features often exist in the shallow layer of the image and have narrow application.

基于深度学习的小麦病害识别方法对资源和时间的需求大,部署成本高,难以应用于移动设备和嵌入式设备等资源受限的场景,而且精度难以保证。The wheat disease identification method based on deep learning requires a lot of resources and time, and the deployment cost is high. It is difficult to apply to resource-constrained scenarios such as mobile devices and embedded devices, and the accuracy is difficult to guarantee.

在农村,农民很难请到病害专家或者使用昂贵的设备鉴别病害,都是通过经验来判断作物是否患病。因此,研究一种结构简单、计算量小、适用性广泛、可以配备到移动端上的小麦病害识别方法,对帮助农民识别小麦病害、提高小麦产量和质量具有重要意义。In rural areas, it is difficult for farmers to hire disease experts or use expensive equipment to identify diseases. They all use experience to judge whether crops are diseased. Therefore, it is of great significance to study a wheat disease identification method with simple structure, small amount of calculation, wide applicability, and can be equipped on the mobile terminal to help farmers identify wheat diseases and improve wheat yield and quality.

发明内容Contents of the invention

本发明的目的在于克服了现有的人工检测步骤繁琐、机器学习方法对病害识别的精度不高和经典深度学习方法部署和使用成本较高,难以应用于资源受限的移动设备和嵌入式设备等场景的问题,而提供了一种轻量级多尺度CNN模型的小麦病害检测方法,本发明结构简单,计算量小,适用性广泛。The purpose of the present invention is to overcome the cumbersome manual detection steps, the low accuracy of machine learning methods for disease identification, and the high deployment and use costs of classic deep learning methods, which are difficult to apply to mobile devices and embedded devices with limited resources. In order to solve the problems of such scenarios, a wheat disease detection method based on a lightweight multi-scale CNN model is provided. The invention has simple structure, small amount of calculation, and wide applicability.

本发明的目的是通过如下措施来实现的:一种轻量级多尺度CNN模型的小麦病害检测方法,包括以下步骤:The object of the present invention is achieved by following measures: a kind of wheat disease detection method of lightweight multi-scale CNN model comprises the following steps:

S1、利用拍摄设备采集小麦病害图像,将小麦病害图像尺码大小统一,并对每类病害进行分类标注;S1. Use the shooting equipment to collect wheat disease images, unify the size of the wheat disease images, and classify and mark each type of disease;

S2、通过旋转、对称翻转、提高对比度对小麦病害数据扩充,将原始数据集扩充到8495张;按照训练集:验证集:测试集=6:2:2的比例划分数据集;S2, by rotation, symmetric overturning, improving contrast to wheat disease data expansion, original data set is expanded to 8495 pieces; According to training set: verification set: test set=6:2:2 ratio divides data set;

S3、设计小麦病害图像检测的网络模型;S3, designing a network model for wheat disease image detection;

S4、将S2中得到的小麦病害训练样本在S3所设计的网络模型中进行训练并在测试集上测试;S4, the wheat disease training samples obtained in S2 are trained in the network model designed by S3 and tested on the test set;

S5、将已训练好的模型在验证集上进行验证,快速精准识别各种小麦病害。S5. Verify the trained model on the verification set to quickly and accurately identify various wheat diseases.

优选的,所述步骤S1具体为:将采集小麦病害图像保存同一图片格式,并且统一图片尺码大小;对采集到的图像进行分类标注。Preferably, the step S1 is specifically: saving the collected wheat disease images in the same image format, and unifying the size of the images; classifying and labeling the collected images.

优选的,所述步骤S2中,所收集的小麦病害样本来实际麦田拍摄,数据集共3003张,通过旋转、对称翻转、提高对比度等操作对小麦病害数据扩充,将原始数据集扩充到8495张;按照训练集:验证集:测试集=6:2:2的比例划分数据得到训练集5097张,验证集1699张,测试集1699张。Preferably, in the step S2, the collected wheat disease samples are taken from the actual wheat field, and the data set has a total of 3003 pieces. The wheat disease data is expanded by operations such as rotation, symmetrical flipping, and contrast enhancement, and the original data set is expanded to 8495 pieces. ;According to training set: verification set: the ratio division data of test set=6:2:2 obtains 5097 training sets, 1699 verification sets, and 1699 test sets.

优选的,所述步骤S2中,在每一层残差模块中加入CBAM和NAM注意力模块;CBAM整体的注意过程可以概括为:Preferably, in the step S2, CBAM and NAM attention modules are added to each layer of residual modules; the overall attention process of CBAM can be summarized as:

其中,Y∈C×W×H是输入的特征图,C代表特征图的通道数,W代表特征图的宽度,H代表特征图的高度;Mc表示通道注意力机制;表示逐元素乘法;Ms表示空间注意力机制;Y'和Y”为输出特征图;Among them, Y∈C×W×H is the input feature map, C represents the number of channels of the feature map, W represents the width of the feature map, and H represents the height of the feature map; Mc represents the channel attention mechanism; Represents element-wise multiplication; Ms represents the spatial attention mechanism; Y' and Y" are the output feature maps;

NAM整体的注意过程可以概括为:The overall attention process of NAM can be summarized as:

通道注意力模块:Channel attention module:

xc=GlobalAvgPool9x)∈RC x c =GlobalAvgPool9x)∈R C

xs=GlobalStdPool(x)∈RC x s =GlobalStdPool(x)∈R C

s=ScaleFactor(x)∈Rs=ScaleFactor(x)∈R

wc=s·(xc+xs)∈RC w c =s·(x c +x s )∈R C

wc=Threshold(wc)∈RC w c =Threshold(w c )∈R C

x′=x⊙wc x'=x⊙w c

其中,x是输入特征图,C是通道数,GlobalAvgPool和GlobalStdPool分别是全局平均池化和全局标准差池化,ScaleFactor是缩放因子,wc是通道权重向量,Threshold是阈值函数,⊙是逐元素相乘,x′是输出特征图;Among them, x is the input feature map, C is the number of channels, GlobalAvgPool and GlobalStdPool are the global average pooling and global standard deviation pooling respectively, ScaleFactor is the scaling factor, w c is the channel weight vector, Threshold is the threshold function, ⊙ is the element-wise phase Multiply, x′ is the output feature map;

空间注意力模块:Spatial attention module:

xf=Conv1(x)∈RH×W x f =Conv 1 (x)∈R H×W

xf=Conv2(xf)∈RH×W x f =Conv 2 (x f )∈R H×W

s=ScaleFactor(xf)∈Rs=ScaleFactor(x f )∈R

ws=s·xf∈RH×W w s =s x f ∈R H×W

ws=Threshold(ws)∈RH×W w s =Threshold(w s )∈R H×W

x′=x⊙ws x'=x⊙w s

其中,x是输入特征图,H和W分别是高度和宽度,Conv1和Conv2分别是两个卷积层,ScaleFactor是缩放因子,ws是空间权重矩阵,Threshold是阈值函数,⊙是逐元素相乘,x′是输出特征图。Among them, x is the input feature map, H and W are the height and width, respectively, Conv 1 and Conv 2 are two convolutional layers, ScaleFactor is the scaling factor, w s is the spatial weight matrix, Threshold is the threshold function, ⊙ is the step-by-step Element-wise multiplication, x' is the output feature map.

优选的,所述步骤S3中,采用的网络模型为Inception-Resnet-CN,具体过程如下:Preferably, in the step S3, the network model adopted is Inception-Resnet-CN, and the specific process is as follows:

模型的输入为224×224×3的RGB图像,模型架构包括三个不同的Inception结构、两个最大池化层、六个Residual-CN结构、平均池化层以及全连接层;Inception模块可降低复杂的矩阵维度和聚合不同尺寸上的视觉信息,Residual-CN模块加强对疾病特征的表征能力,降低图像中复杂背景对模型识别性能的影响。The input of the model is a 224×224×3 RGB image. The model architecture includes three different Inception structures, two maximum pooling layers, six Residual-CN structures, an average pooling layer, and a fully connected layer; the Inception module can reduce With complex matrix dimensions and visual information aggregated in different sizes, the Residual-CN module strengthens the ability to represent disease features and reduces the impact of complex backgrounds in images on model recognition performance.

优选的,所述步骤S4中网络模型的训练方法具体是:训练时将图像缩放为224×224,学习速率调整方式具体采用:Adam优化梯度下降,设置每轮迭代批处理的图片个数为64,设置迭代次数为70,学习率为0.001。Preferably, the training method of the network model in the step S4 is specifically: during training, the image is scaled to 224×224, and the learning rate adjustment method is specifically adopted: Adam optimizes the gradient descent, and the number of pictures for each round of iteration batch processing is set to 64 , set the number of iterations to 70, and the learning rate to 0.001.

优选的,所述步骤S4中,采用交叉熵计算分类损失,加入L2正则化来惩罚权重参数其数学公式为:J(θ)=-∑p(x)log2q(x)+λ||θ||2式中:p(x)为目标概率分布;q(x)为预测分布;θ为权重参数;λ为正则化系数;||θ||2是正则化项。Preferably, in the step S4, cross-entropy is used to calculate the classification loss, and L2 regularization is added to punish weight parameters. The mathematical formula is: J(θ)=-∑p(x)log 2 q(x)+λ|| θ|| 2 where: p(x) is the target probability distribution; q(x) is the forecast distribution; θ is the weight parameter; λ is the regularization coefficient; ||θ|| 2 is the regularization term.

优选的,所述步骤S1中采集小麦病害图像其具体为:通过采集设备批量拍摄农田小麦图像,然后进行图像预处理。Preferably, the collecting of wheat disease images in the step S1 specifically includes: taking images of farmland wheat in batches by a collection device, and then performing image preprocessing.

本发明的有益效果:相比于传统机器学习小麦病害检测方法,本发明方法速度快,准确率高,鲁棒性好;相比于现有深度学习小麦病害检测方法,本发明方法能够在复杂背景下高效快速地识别小麦病害,且对资源需求低,更加节省成本,能够部署到移动设备上;相比于基于光谱图像的小麦病害检测,本发明降低了实验设备成本;本发明设计合理,实现了真实环境中小麦病害检测,更实现了病害类别的准确识别,并且具有速度快的优点。Beneficial effects of the present invention: Compared with the traditional machine learning wheat disease detection method, the inventive method has high speed, high accuracy and good robustness; compared with the existing deep learning wheat disease detection method, the inventive method can be used in complex It can efficiently and quickly identify wheat diseases in the background, has low resource requirements, saves costs, and can be deployed on mobile devices; compared with the detection of wheat diseases based on spectral images, the present invention reduces the cost of experimental equipment; the present invention has a reasonable design, The detection of wheat diseases in the real environment is realized, and the accurate identification of disease categories is realized, and it has the advantage of fast speed.

附图说明Description of drawings

图1为小麦病害检测流程图;Fig. 1 is the flow chart of wheat disease detection;

图2为小麦病害类别图;Fig. 2 is a wheat disease category diagram;

图3为Inception-Resnet-CN模型结构图;Figure 3 is a structural diagram of the Inception-Resnet-CN model;

图4为七模型在数据集上训练结果。Figure 4 shows the training results of the seven models on the dataset.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

实施例1:如图1-图4所示,一种轻量级多尺度CNN模型的小麦病害检测方法,包括以下步骤:Embodiment 1: as shown in Fig. 1-Fig. 4, a kind of wheat disease detection method of lightweight multi-scale CNN model comprises the following steps:

S1、利用拍摄设备采集小麦病害图像,将小麦病害图像尺码大小统一,并对每类病害进行分类标注;S1. Use the shooting equipment to collect wheat disease images, unify the size of the wheat disease images, and classify and mark each type of disease;

S2、通过旋转、对称翻转、提高对比度对小麦病害数据扩充,将原始数据集扩充到8495张;按照训练集:验证集:测试集=6:2:2的比例划分数据集;S2. Expand the wheat disease data by rotating, symmetrically flipping, and improving the contrast, and expand the original data set to 8495 pieces; divide the data set according to the ratio of training set: verification set: test set = 6:2:2;

S3、设计小麦病害图像检测的网络模型;S3, designing a network model for wheat disease image detection;

S4、将S2中得到的小麦病害训练样本在S3所设计的网络模型中进行训练并在测试集上测试;S4, the wheat disease training samples obtained in S2 are trained in the network model designed by S3 and tested on the test set;

S5、将已训练好的模型在验证集上进行验证,快速精准识别各种小麦病害。S5. Verify the trained model on the verification set to quickly and accurately identify various wheat diseases.

步骤S1具体为:将采集小麦病害图像保存同一图片格式,并且统一图片尺码大小;对采集到的图像进行分类标注;步骤S1中采集小麦病害图像其具体为:通过采集设备批量拍摄农田小麦图像,然后进行图像预处理。Step S1 is specifically as follows: save the collected wheat disease images in the same image format, and unify the size of the images; classify and label the collected images; collect wheat disease images in step S1 specifically: take batches of farmland wheat images through the collection equipment, Then image preprocessing is performed.

如图2所示,步骤S2中,所收集的小麦病害样本来实际麦田拍摄,数据集共3003张,通过旋转、对称翻转、提高对比度等操作对小麦病害数据扩充,将原始数据集扩充到8495张,(叶锈病1156张,白粉1380张,小麦黑穗病1342张,烂根病1096张,赤霉病1161张,焦油斑点病1272张,健康1086张);按照训练集∶验证集∶测试集=6∶2∶2的比例划分数据得到训练集5097张,验证集1699张,测试集1699张,此处为每个类别按照6∶2∶2分配所得。As shown in Figure 2, in step S2, the collected wheat disease samples were photographed in the actual wheat field. The data set has a total of 3003 pieces. The wheat disease data was expanded by operations such as rotation, symmetrical flip, and contrast enhancement, and the original data set was expanded to 8495 Zhang, (leaf rust 1156, powdery mildew 1380, wheat smut 1342, root rot 1096, scab 1161, tar spot 1272, healthy 1086); according to training set: validation set: test Set = 6:2:2 The ratio of data is divided to obtain 5097 training sets, 1699 verification sets, and 1699 test sets. Here, each category is allocated according to 6:2:2.

所述步骤S2中,在每一层残差模块中加入CBAM和NAM注意力模块;CBAM整体的注意过程可以概括为:In the step S2, CBAM and NAM attention modules are added to each layer of residual modules; the overall attention process of CBAM can be summarized as:

其中,Y∈C×W×H是输入的特征图C代表特征图的通道数,W代表特征图的宽度,H代表特征图的高度;Mc表示通道注意力机制;表示逐元素乘法;Ms表示空间注意力机制;Y'和Y”为输出特征图;Among them, Y∈C×W×H is the input feature map C represents the number of channels of the feature map, W represents the width of the feature map, and H represents the height of the feature map; Mc represents the channel attention mechanism; Represents element-wise multiplication; Ms represents the spatial attention mechanism; Y' and Y" are the output feature maps;

NAM整体的注意过程可以概括为:The overall attention process of NAM can be summarized as:

通道注意力模块:Channel attention module:

xc=GlobalAvgPool(x)∈RC x c =GlobalAvgPool(x)∈R C

xs=GlobalStdPool(x)∈RC x s =GlobalStdPool(x)∈R C

s=ScaleFactor(x)∈Rs=ScaleFactor(x)∈R

wc=s×(xc+xs)∈RC w c =s×(x c +x s )∈R C

wc=Threshold(wc)∈RC w c =Threshold(w c )∈R C

x′=x⊙wc x'=x⊙w c

其中,x是输入特征图,C是通道数,GlobalAvgPool和GlobalStdPool分别是全局平均池化和全局标准差池化,ScaleFactor是缩放因子,wc是通道权重向量,Threshold是阈值函数,⊙是逐元素相乘,x′是输出特征图。Among them, x is the input feature map, C is the number of channels, GlobalAvgPool and GlobalStdPool are the global average pooling and global standard deviation pooling respectively, ScaleFactor is the scaling factor, w c is the channel weight vector, Threshold is the threshold function, ⊙ is the element-wise phase Multiply, x′ is the output feature map.

空间注意力模块:Spatial attention module:

xf=Conv1(x)∈RH×W x f =Conv 1 (x)∈R H×W

xf=Conv2(xf)∈RH×W x f =Conv 2 (x f )∈R H×W

s=ScaleFactor(xf)∈Rs=ScaleFactor(x f )∈R

ws=s×xf∈RH×W w s =s×x f ∈R H×W

ws=Threshold(ws)∈RH×W w s =Threshold(w s )∈R H×W

x′=x⊙ws x'=x⊙w s

其中,x是输入特征图,H和W分别是高度和宽度,Conv1和Conv2分别是两个卷积层,ScaleFactor是缩放因子,ws是空间权重矩阵,Threshold是阈值函数,⊙是逐元素相乘,x′是输出特征图。Among them, x is the input feature map, H and W are the height and width, respectively, Conv 1 and Conv 2 are two convolutional layers, ScaleFactor is the scaling factor, w s is the spatial weight matrix, Threshold is the threshold function, ⊙ is the step-by-step Element-wise multiplication, x' is the output feature map.

如图3所示,步骤S3中,采用的网络模型为Inception-Resnet-CN,具体过程如下:As shown in Figure 3, in step S3, the network model adopted is Inception-Resnet-CN, and the specific process is as follows:

模型的输入为224×224×3的RGB图像,模型架构包括三个不同的Inception结构、两个最大池化层、六个Residual-CN结构、平均池化层以及全连接层;Inception模块可降低复杂的矩阵维度和聚合不同尺寸上的视觉信息。Residual-CN模块加强对疾病特征的表征能力,降低图像中复杂背景对模型识别性能的影响。其中Inception-A结构使用1×1卷积、3×3卷积,通过两个3×3卷积代替的5×5卷积并行组合,branch1~branch4卷积核个数分别为8,12,24,8,12,24,24。Residual-CN-A结构包括两个卷积核为3×3的卷积层、CBAM模块、NAM模块以及一个恒等映射,Residual-CN-A1~A4的卷积核个数分别为64,128,128,256。Residual-CN-B结构在Residual-CN-A结构的基础上通过恒等映射处的1×1卷积实现两个通路通道数量的匹配,Residual-CN-B1~B2的卷积核个数为128和256。Inception-B结构使用1×1卷积、不对称1×7卷积、7×1卷积串联的方式进行组合。branch1~branch4卷积核个数分别为32,32,64,64,32,64,64,64,64,32。Inception-C结构使用1×1卷积、不对称1×3卷积、3×1卷积的串并联方式进行组合。branch1~branch4卷积核个数分别为64,64,128,96,96,256,256,256,96,96。The input of the model is a 224×224×3 RGB image. The model architecture includes three different Inception structures, two maximum pooling layers, six Residual-CN structures, an average pooling layer, and a fully connected layer; the Inception module can reduce Complex matrix dimensions and aggregating visual information at different dimensions. The Residual-CN module strengthens the ability to represent disease features and reduces the impact of complex backgrounds in images on model recognition performance. Among them, the Inception-A structure uses 1×1 convolution and 3×3 convolution, and the 5×5 convolution replaced by two 3×3 convolutions is combined in parallel. The number of branch1~branch4 convolution kernels is 8, 12, respectively. 24, 8, 12, 24, 24. The Residual-CN-A structure includes two convolutional layers with a convolution kernel of 3×3, a CBAM module, a NAM module, and an identity map. The number of convolution kernels of Residual-CN-A1 to A4 is 64, 128, 128, and 256, respectively. On the basis of the Residual-CN-A structure, the Residual-CN-B structure realizes the matching of the number of channels of the two channels through the 1×1 convolution at the identity map. The number of convolution kernels of Residual-CN-B1~B2 is 128 and 256. The Inception-B structure is combined using 1×1 convolution, asymmetric 1×7 convolution, and 7×1 convolution in series. The number of convolution kernels in branch1~branch4 is 32, 32, 64, 64, 32, 64, 64, 64, 64, and 32, respectively. The Inception-C structure uses a series-parallel combination of 1×1 convolution, asymmetric 1×3 convolution, and 3×1 convolution. The number of convolution kernels of branch1~branch4 are 64, 64, 128, 96, 96, 256, 256, 256, 96, 96 respectively.

步骤S4中网络模型的训练方法具体是:训练时将图像缩放为224×224,学习速率调整方式具体采用:Adam优化梯度下降,设置每轮迭代批处理的图片个数为64,设置迭代次数为70,学习率为0.001。The training method of the network model in step S4 is as follows: during training, the image is scaled to 224×224, and the learning rate adjustment method is specifically adopted: Adam optimizes the gradient descent, sets the number of pictures for each round of iteration batch processing to 64, and sets the number of iterations to 70 with a learning rate of 0.001.

步骤S4中,采用交叉熵计算分类损失,加入L2正则化来惩罚权重参数其数学公式为:J(θ)=-∑p(x)log2 q(x)+λ‖θ‖2式中:p(x)为目标概率分布;q(x)为预测分布;θ为权重参数;λ为正则化系数;‖θ‖2是正则化项。In step S4, cross-entropy is used to calculate the classification loss, and L2 regularization is added to punish the weight parameters. The mathematical formula is: J(θ)=-∑p(x)log 2 q(x)+λ‖θ‖ 2 where: p(x) is the target probability distribution; q(x) is the predictive distribution; θ is the weight parameter; λ is the regularization coefficient; ‖θ‖ 2 is the regularization term.

模型性能评估指标Model Performance Evaluation Metrics

Precision指预测为正类的样本中预测正确的比例,Accuracy准确率,Recall指预测正确的结果在实际正例样本中所占比例,F1值是精确率和召回率的加权平均。其中TP是真实情况是true,预测结果是positives样本的数量,TN是真实情况是true,预测结果是negatives样本的数量,同样,FP是真实情况是false,预测结果是positives样本的数量,FN是真实情况是false,预测结果是negatives样本的数量。Precision refers to the proportion of correct predictions in the samples predicted to be positive, Accuracy accuracy rate, Recall refers to the proportion of correct prediction results in the actual positive samples, F1 value is the weighted average of precision rate and recall rate. Among them, TP is the real situation is true, the prediction result is the number of positives samples, TN is the real situation is true, the prediction result is the number of negatives samples, similarly, FP is the real situation is false, the prediction result is the number of positives samples, FN is The true situation is false, and the predicted result is the number of negatives samples.

参照图4,将到得的数据在多种模型中训练,对比各种算法性能。Referring to Figure 4, the obtained data is trained in various models, and the performance of various algorithms is compared.

InceptionResnet-CN模型精度最高,达到98.76%,模型性能良好,评估完成后的模型对小麦病害图像进行检测,输出病害类别,达到较高的检测率,能够为粮食安全和农业发展做出了重要贡献。The InceptionResnet-CN model has the highest accuracy, reaching 98.76%, and the model performance is good. After the evaluation, the model detects wheat disease images, outputs disease categories, and achieves a high detection rate, which can make important contributions to food security and agricultural development. .

最后应说明的是:以上所述仅为本发明的优选实施例而已,并不用于限制本发明,尽管参照前述实施例对本发明进行了详细的说明,对于本领域的技术人员来说,其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。Finally, it should be noted that: the above is only a preferred embodiment of the present invention, and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, for those skilled in the art, it still It is possible to modify the technical solutions recorded in the foregoing embodiments, or to perform equivalent replacements on some of the technical features. Any modifications, equivalent replacements, improvements, etc. within the spirit and principles of the present invention shall be included in the within the protection scope of the present invention.

Claims (8)

1. A wheat disease detection method of a lightweight multi-scale CNN model is characterized by comprising the following steps of: the method comprises the following steps:
s1, acquiring wheat disease images by using shooting equipment, unifying the sizes of the wheat disease images, and classifying and labeling each type of disease;
s2, expanding the wheat disease data by rotation, symmetrical overturning and contrast improvement, and expanding an original data set to 8495 pieces; dividing the data set according to the proportion of training set to verification set to test set=6:2:2;
s3, designing a network model for detecting wheat disease images;
s4, training the wheat disease training sample obtained in the S2 in a network model designed in the S3 and testing the wheat disease training sample on a test set;
and S5, verifying the trained model on a verification set, and rapidly and accurately identifying various wheat diseases.
2. The method for detecting wheat diseases by using a lightweight multi-scale CNN model according to claim 1, which is characterized in that: the step S1 is to store the collected wheat disease images in the same picture format and unify the sizes of the pictures; and classifying and labeling the acquired images.
3. The method for detecting wheat diseases by using a lightweight multi-scale CNN model according to claim 1, which is characterized in that: in the step S2, the collected wheat disease samples are photographed in real wheat fields, the total data sets are 3003, the wheat disease data are expanded through operations such as rotation, symmetrical overturning, contrast improvement and the like, and the original data sets are expanded to 8495; the data were divided according to the training set: validation set: test set = 6:2:2 ratio to obtain 5097 training sets, 1699 validation sets, 1699 test sets.
4. A method for detecting wheat diseases by using a lightweight multi-scale CNN model according to claim 3, wherein: in the step S2, adding a CBAM and NAM attention module into each layer of residual error module; the overall attention process of CBAM can be summarized as:
wherein Y epsilon C X W X H is an input feature map, C represents the channel number of the feature map, W represents the width of the feature map, and H represents the height of the feature map; mc represents a channel attention mechanism;representing element-by-element multiplication; ms represents spatial attention mechanisms; y 'and Y' are output feature graphs;
the overall attention process of NAM can be summarized as:
channel attention module:
x c =GlobalAvgPoolx∈R C
x s =GlobalStdPoolx∈R C
s=ScaleFactorx∈R
w c =s·(x c +x s )∈R C
w c =Threshold(w c )∈R C
x′=x⊙w c
wherein x is the input feature map, C is the channel number, globalAvgPool and GlobalStdPool are global average pooling and global standard deviation pooling, respectively, scaleFactor is the scaling factor, w c Is the channel weight vector, threshold is the Threshold function, as is element-wise multiplication, x' is the output feature map;
spatial attention module:
x f =Conv 1 (x)∈R H×W
x f =Conv 2 (x f )∈R H×W
s=ScaleFactor(x f )∈R
w s =s·x f ∈R H×W
w s =Threshold(w s )∈R H×W
x′=x⊙w s
wherein x is an input feature map, H and W are height and width, respectively, conv 1 And Conv 2 Two convolution layers, scaleFactor is the scaling factor, w s Is a spatial weight matrix, threshold is a Threshold function, +..
5. The method for detecting wheat diseases by using a lightweight multi-scale CNN model according to claim 1, which is characterized in that: in the step S3, the adopted network model is an admission-Resnet-CN, and the specific process is as follows:
the input of the model is a 224×224×3 RGB image, and the model architecture comprises three different acceptance structures, two maximum pooling layers, six Residual-CN structures, an average pooling layer and a full connection layer; the acceptance module can reduce the dimension of a complex matrix and aggregate visual information on different sizes, and the Residual-CN module enhances the characterization capability of disease features and reduces the influence of a complex background in an image on the recognition performance of the model.
6. The method for detecting wheat diseases by using a lightweight multi-scale CNN model according to claim 1, which is characterized in that: the training method of the network model in the step S4 specifically comprises the following steps: during training, the images are scaled to 224 multiplied by 224, and the learning rate adjustment mode specifically adopts: adam optimizes gradient descent, sets the number of pictures in each iteration batch to be 64, sets the iteration number to be 70 and sets the learning rate to be 0.001.
7. The method for detecting wheat diseases by using a lightweight multi-scale CNN model according to claim 1, which is characterized in that: in the step S4, the cross entropy is adopted to calculate the classification loss, and the L2 regularization is added to punish the weight parameter, and the mathematical formula is as follows: j (θ) = - Σp (x) log 2 q(x)+λ‖θ‖ 2 Wherein: p (x) is a target probability distribution; q (x) is the prediction distribution;θ is a weight parameter; lambda is the regularization coefficient; II theta II 2 Is a regularization term.
8. The method for detecting wheat diseases by using a lightweight multi-scale CNN model according to claim 1, which is characterized in that: the step S1 is to collect wheat disease images, specifically, the farmland wheat images are shot in batches through collecting equipment, and then image preprocessing is carried out.
CN202310469071.5A 2023-04-27 2023-04-27 A lightweight multi-scale CNN model for wheat disease detection Pending CN116645599A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310469071.5A CN116645599A (en) 2023-04-27 2023-04-27 A lightweight multi-scale CNN model for wheat disease detection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310469071.5A CN116645599A (en) 2023-04-27 2023-04-27 A lightweight multi-scale CNN model for wheat disease detection

Publications (1)

Publication Number Publication Date
CN116645599A true CN116645599A (en) 2023-08-25

Family

ID=87617875

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310469071.5A Pending CN116645599A (en) 2023-04-27 2023-04-27 A lightweight multi-scale CNN model for wheat disease detection

Country Status (1)

Country Link
CN (1) CN116645599A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118397446A (en) * 2024-04-09 2024-07-26 华中农业大学 Lightweight rice disease recognition method and system based on sensitivity under complex background

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220230305A1 (en) * 2019-05-16 2022-07-21 Basf Se System and method for plant disease detection support
CN114972208A (en) * 2022-05-05 2022-08-30 扬州大学 YOLOv 4-based lightweight wheat scab detection method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220230305A1 (en) * 2019-05-16 2022-07-21 Basf Se System and method for plant disease detection support
CN114972208A (en) * 2022-05-05 2022-08-30 扬州大学 YOLOv 4-based lightweight wheat scab detection method

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
XIN FANG ET AL.: ""Lightweight multiscale CNN model for wheat disease detection"", 《APPLIED SCIENCES》, 8 May 2023 (2023-05-08), pages 1 - 22 *
张航等: ""一种基于卷积神经网络的小麦病害识别方法"", 《山东农业科学》, vol. 50, no. 3, 30 March 2018 (2018-03-30), pages 137 - 141 *
方鑫: ""基于轻量模型的小麦病害识别及严重程度评估研究"", 《中国优秀博硕士学位论文全文数据库(硕士)农业科技辑》, no. 2025, 15 April 2025 (2025-04-15), pages 046 - 65 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118397446A (en) * 2024-04-09 2024-07-26 华中农业大学 Lightweight rice disease recognition method and system based on sensitivity under complex background

Similar Documents

Publication Publication Date Title
CN110837870B (en) Sonar image target recognition method based on active learning
CN110110642B (en) A pedestrian re-identification method based on multi-channel attention features
CN113095409B (en) Hyperspectral Image Classification Method Based on Attention Mechanism and Weight Sharing
US11816149B2 (en) Electronic device and control method thereof
CN108846835B (en) Image change detection method based on depthwise separable convolutional network
CN111160176B (en) Fusion feature-based ground radar target classification method for one-dimensional convolutional neural network
CN110660052A (en) Hot-rolled strip steel surface defect detection method based on deep learning
CN110569901A (en) A weakly supervised object detection method based on channel selection for adversarial elimination
CN111090764B (en) Image classification method and device based on multi-task learning and graph convolutional neural network
CN108447057B (en) SAR image change detection method based on significance and depth convolution network
CN114783604B (en) A method, system and storage medium for predicting sentinel lymph node metastasis of breast cancer
CN110263819A (en) A kind of object detection method and device for shellfish image
CN111914696A (en) A classification method of hyperspectral remote sensing images based on transfer learning
CN111222545B (en) Image classification method based on linear programming incremental learning
CN113378979B (en) A method and device for hyperspectral band selection based on band attention reconstruction network
CN113723482B (en) Hyperspectral target detection method based on multi-example twin network
CN120068004B (en) Mass spectrogram ion fragment peak area identification method and device based on deep learning
CN116310466B (en) Small sample image classification method based on local irrelevant area screening graph neural network
CN115272688A (en) A meta-feature-based image classification method based on few-shot learning
CN117078614A (en) Bamboo strip surface defect detection method based on improved YOLOX
CN114492755A (en) Object Detection Model Compression Method Based on Knowledge Distillation
CN116645599A (en) A lightweight multi-scale CNN model for wheat disease detection
CN116452904B (en) Image aesthetic quality determination method
CN116883741A (en) Small sample insect pest detection method based on pyramid attention mechanism
CN114782983A (en) Road scene pedestrian detection method based on improved feature pyramid and boundary loss

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination