CN114565525A - A method for identifying tree species based on leaf pictures - Google Patents

A method for identifying tree species based on leaf pictures Download PDF

Info

Publication number
CN114565525A
CN114565525A CN202210158900.3A CN202210158900A CN114565525A CN 114565525 A CN114565525 A CN 114565525A CN 202210158900 A CN202210158900 A CN 202210158900A CN 114565525 A CN114565525 A CN 114565525A
Authority
CN
China
Prior art keywords
tree species
formula
leaf
feature vector
follows
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
CN202210158900.3A
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.)
Individual
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN202210158900.3A priority Critical patent/CN114565525A/en
Publication of CN114565525A publication Critical patent/CN114565525A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration using local operators
    • G06T5/30Erosion or dilatation, e.g. thinning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume

Landscapes

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

Abstract

The invention relates to the field of pattern recognition, in particular to a method for distinguishing tree species based on leaf pictures. The method solves the problems of complex algorithm, large calculation amount and low identification accuracy. The method comprises the following steps: collecting a leaf picture, and dividing a training set and a testing set; preprocessing a picture; extracting the characteristics of the leaves of the training set; integrating the extracted shape features to be used as feature vectors, normalizing the feature vectors, and inputting the normalized feature vectors into a BP neural network for training to obtain a tree species identification model; and extracting the characteristics of the leaves of the test set, inputting the characteristics into the tree species identification model, and outputting an identification result. According to the invention, the picture is preprocessed, so that the subsequent extraction and identification of leaf characteristics are facilitated; the extracted feature vectors are normalized, the statistical distribution of unified samples is summarized, and the convergence rate of the model is improved; the BP neural network is used for training to obtain the tree species distinguishing model, the robustness of the algorithm is enhanced, and the method can be applied to more scenes.

Description

一种基于树叶图片辨别树种的方法A method for identifying tree species based on leaf pictures

技术领域technical field

本发明涉及模式识别领域,尤其涉及一种基于树叶图片辨别树种的方法。The invention relates to the field of pattern recognition, in particular to a method for identifying tree species based on leaf pictures.

背景技术Background technique

模式识别诞生于20实际20年代,随着40年代计算机的出现,50年代人工智能的兴起,模式识别在60年代初迅速发展成为一门学科。模式识别是根据输入的原始数据对齐进行各种分析判断,从而得到其类别属性,特征判断的过程。模式识别的作用和目的就在于把某一个具体的事物正确的归入某一个类别。Pattern recognition was born in the 1920s. With the advent of computers in the 1940s and the rise of artificial intelligence in the 1950s, pattern recognition rapidly developed into a discipline in the early 1960s. Pattern recognition is a process of performing various analysis and judgments according to the alignment of the input original data, so as to obtain its category attributes and feature judgments. The function and purpose of pattern recognition is to correctly classify a specific thing into a certain category.

随着科学技术的不断发展与进步,模式识别运用地也越来越广泛,模式识别能够更加准确、快速地对事物进行分类,节省了人们大量的时间以及人力物力。With the continuous development and progress of science and technology, pattern recognition has become more and more widely used. Pattern recognition can classify things more accurately and quickly, saving people a lot of time and manpower and material resources.

傅弘学者提出了神经网络的叶脉提取方法,通过训练的神经网络,准确地提取了叶脉图像,实现了叶脉的提取;朱宁学者利用局部二进制模式方法,提出了将该方法应用于植物叶片图像纹理特征的提取,实现了用于提取叶片样本特征的各种算子,实现了基于局部二进制模式的树叶识别。Scholar Fu Hong proposed a neural network extraction method for leaf veins. Through the trained neural network, the image of leaf veins was accurately extracted, and the extraction of leaf veins was realized. Scholar Zhu Ning used the local binary pattern method to propose that this method should be applied to plant leaf images. The extraction of texture features implements various operators for extracting leaf sample features, and realizes leaf recognition based on local binary patterns.

然而基于树叶图片进行识别与分类存下以下几点问题:However, the identification and classification based on leaf images have the following problems:

1、算法较为复杂,计算量大,实现起来有难度;1. The algorithm is more complex, the amount of calculation is large, and it is difficult to implement;

2、识别结果受环境、背景等因素的干扰,识别的准确率不高。2. The recognition results are interfered by factors such as environment and background, and the recognition accuracy is not high.

发明内容SUMMARY OF THE INVENTION

本发明的目的在于提供一种基于树叶图片辨别树种的方法,用以解决算法复杂、计算量大、识别的准确率不高的问题,提高算法的鲁棒性。The purpose of the present invention is to provide a method for identifying tree species based on leaf pictures, which is used to solve the problems of complex algorithm, large amount of calculation, and low recognition accuracy, and to improve the robustness of the algorithm.

为了实现上述目的,本发明采用如下技术方案:In order to achieve the above object, the present invention adopts the following technical solutions:

一种基于树叶图片辨别树种的方法,其特征在于,包括以下步骤:A method for identifying tree species based on leaf picture, is characterized in that, comprises the following steps:

步骤1、采集树叶图片,划分训练集与测试集;Step 1. Collect leaf pictures and divide training set and test set;

步骤2、图片预处理;Step 2, image preprocessing;

步骤3、提取训练集的树叶的特征;Step 3, extract the characteristics of the leaves of the training set;

步骤4、对提取形状特征进行整合作为特征矢量,对特征矢量先进行归一化,再将归一化的特征矢量输入到BP神经网络进行训练,得到树种辨别模型;Step 4. Integrate the extracted shape features as a feature vector, first normalize the feature vector, and then input the normalized feature vector into the BP neural network for training to obtain a tree species identification model;

步骤5、提取测试集的树叶的特征,输入树种辨别模型,输出识别结果。Step 5: Extract the features of the leaves of the test set, input the tree species identification model, and output the identification result.

优选地,所述步骤1中,采集不同树种的图片,树种包括:银杏、枫树、柳树、石榴、白桦,每种树叶数量不少于100,图片大小为300*300像素,将采集的图片作为数据集,把数据集划分为训练集与测试集,训练集与测试集的比例为8:2。Preferably, in the step 1, pictures of different tree species are collected, and the tree species include: ginkgo, maple, willow, pomegranate, and birch. As a data set, the data set is divided into training set and test set, and the ratio of training set and test set is 8:2.

优选地,所述步骤2中,图片预处理包括:去噪、灰度化、二值化、边缘检测、腐蚀、膨胀以及填充;Preferably, in the step 2, the image preprocessing includes: denoising, grayscale, binarization, edge detection, erosion, expansion and filling;

其中去噪的方式选择巴特沃斯低通滤波器去噪、FIR低通滤波器去噪、移动平均滤波去噪、中值滤波去噪、维纳滤波去噪、自适应滤波去噪、小波去噪中的其中一种;Among them, the denoising method chooses Butterworth low-pass filter denoising, FIR low-pass filter denoising, moving average filter denoising, median filter denoising, Wiener filter denoising, adaptive filter denoising, wavelet denoising one of the noises;

其中灰度化采用最大值法对图片进行灰度化,公式如下:The grayscale uses the maximum value method to grayscale the image, and the formula is as follows:

Gray(x,y)=max{R(x,y),G(x,y),B(x,y)} (1)Gray(x, y) = max{R(x, y), G(x, y), B(x, y)} (1)

公式(1)中,R(x,y)、G(x,y)、B(x,y)分别表示RGB三个分量;In formula (1), R(x,y), G(x,y), and B(x,y) respectively represent the three components of RGB;

其中二值化处理,其公式如下:Among them, the binarization process, the formula is as follows:

公式(2)中,T为二值化阈值,二值化中阈值确定选择双峰法、P参数法、最大类方差法、最大熵阈值法、最佳阈值法中的其中一种;In formula (2), T is the binarization threshold, and the threshold in the binarization is determined by selecting one of the bimodal method, the P parameter method, the maximum class variance method, the maximum entropy threshold method, and the optimal threshold method;

其中边缘检测采用Prewitt算子,该算子既能检测边缘,还能抑制噪声的影响;Among them, the edge detection adopts the Prewitt operator, which can not only detect the edge, but also suppress the influence of noise;

优选地,所述步骤3中,提取的特征包括:圆形度、矩形度、最小外接矩形的长宽比、不变矩、傅里叶描述子;Preferably, in the step 3, the extracted features include: circularity, rectangularity, aspect ratio of the smallest circumscribed rectangle, invariant moment, and Fourier descriptor;

其中圆形度表示物体边缘与圆的相似程度,计算公式如下:The circularity represents the similarity between the edge of the object and the circle, and the calculation formula is as follows:

Figure BDA0003513536790000031
Figure BDA0003513536790000031

公式(3)中,S表示物体的面积,L表示物体的周长,e表示圆形度;In formula (3), S represents the area of the object, L represents the perimeter of the object, and e represents the circularity;

其中矩形度表示物体与矩形的相似程度,计算公式如下:The degree of rectangle represents the similarity between the object and the rectangle, and the calculation formula is as follows:

Figure BDA0003513536790000032
Figure BDA0003513536790000032

公式(4)中,S表示物体的面积,SR表示物体的最小外接矩形的面积,R表示矩形度;In formula (4), S represents the area of the object, S R represents the area of the smallest circumscribed rectangle of the object, and R represents the degree of rectangularity;

其中最小外接矩形的长宽比是最小外接矩形长轴与短轴的比值,计算公式如下:The aspect ratio of the smallest circumscribed rectangle is the ratio of the long axis to the short axis of the smallest circumscribed rectangle. The calculation formula is as follows:

Figure BDA0003513536790000033
Figure BDA0003513536790000033

公式(5)中,a表示最小外接矩形长轴,b表示最小外接矩形短轴,ε表示最小外接矩形的长宽比;In formula (5), a represents the long axis of the smallest circumscribed rectangle, b represents the short axis of the smallest circumscribed rectangle, and ε represents the aspect ratio of the smallest circumscribed rectangle;

其中不变矩主要表征了图像区域的几何特征,采用Hu.M.K提出的7个不随水平、旋转、等比缩放变化的矩组,定义如下:Among them, the invariant moment mainly characterizes the geometric features of the image area. The 7 moment groups proposed by Hu.M.K that do not change with horizontal, rotation, and proportional scaling are used, which are defined as follows:

M1=μ2002 (6)M 12002 (6)

M2=(μ2002)2+4μ11 2 (7)M 2 =(μ 2002 ) 2 +4μ 11 2 (7)

M3=(μ30-3μ12)2+(3μ2103)2 (8)M 3 =(μ 30 -3μ 12 ) 2 +(3μ 2103 ) 2 (8)

M4=(μ3012)2+(μ2103)2 (9)M 4 =(μ 3012 ) 2 +(μ 2103 ) 2 (9)

M5=(μ30-3μ12)(μ3012)[(μ3012)2-3(μ2103)2]+(3μ2103)(μ2103)[3(μ3012)2-(μ2103)2] (10)M 5 =(μ 30 -3μ 12 )(μ 3012 )[(μ 3012 ) 2 -3(μ 2103 ) 2 ]+(3μ 2103 )(μ 2103 )[3(μ 3012 ) 2 -(μ 2103 ) 2 ] (10)

M6=(μ2002)[(μ3012)2-(μ2103)2]+4μ113012)(μ2103) (11)M 6 =(μ 2002 )[(μ 3012 ) 2 -(μ 2103 ) 2 ]+4μ 113012 )(μ 2103 ) (11)

M7=(3μ2103)(μ3012)[(μ3012)2-3(μ2103)2]-(μ30-3μ12)(μ2103)[3(μ3012)2-(μ2103)2] (12)M 7 =(3μ 2103 )(μ 3012 )[(μ 3012 ) 2 -3(μ 2103 ) 2 ]-(μ 30 -3μ 12 )(μ 2103 )[3(μ 3012 ) 2 -(μ 2103 ) 2 ] (12)

公式(6)-(12)中,μpq表示归一化(p+q)阶中心矩,p,q=0,1,2,3;In formulas (6)-(12), μ pq represents the normalized (p+q) order central moment, p, q=0, 1, 2, 3;

傅里叶描述子是描述物体形状边界的傅里叶变换系数,计算公式如下:The Fourier descriptor is the Fourier transform coefficient that describes the shape boundary of the object. The calculation formula is as follows:

假设一个由N点组成的封闭边界,从任一点P开始绕边界一周得到:Assuming a closed boundary consisting of N points, starting from any point P, we get:

s(k)=x(k)+jy(k),k=0,1,...,N-1 (13)s(k)=x(k)+jy(k), k=0, 1, ..., N-1 (13)

公式(13)中,x(k)和y(k)是动点P的坐标,j为系数;In formula (13), x(k) and y(k) are the coordinates of the moving point P, and j is the coefficient;

s(k)的离散傅里叶变换(DFT)为:The discrete Fourier transform (DFT) of s(k) is:

Figure BDA0003513536790000041
Figure BDA0003513536790000041

公式(14)中,u=0,1,...,N-1,a(u)是边界的傅里叶描述子In formula (14), u=0,1,...,N-1, a(u) is the Fourier descriptor of the boundary

归一化傅里叶描述子d′(k)为:The normalized Fourier descriptor d'(k) is:

Figure BDA0003513536790000042
Figure BDA0003513536790000042

本发明中,取前10个系数作为傅立叶描述子特征。In the present invention, the first 10 coefficients are taken as the Fourier descriptor feature.

优选地,所述步骤4中,对提取形状特征进行整合作为特征矢量,提取了20个特征参数,包括圆形度、矩形度、最小外接矩形的长宽比、7个不变矩、10个傅里叶描述子,整合得到一个20维的特征矢量,对特征矢量先进行归一化,再将归一化的特征矢量输入到BP神经网络进行训练,得到平面几何形状识别模型;Preferably, in the step 4, the extracted shape features are integrated as a feature vector, and 20 feature parameters are extracted, including circularity, rectangularity, aspect ratio of the smallest circumscribed rectangle, 7 invariant moments, 10 The Fourier descriptor is integrated to obtain a 20-dimensional feature vector. The feature vector is first normalized, and then the normalized feature vector is input into the BP neural network for training to obtain a plane geometric shape recognition model;

其中归一化采用线性归一化,公式如下:The normalization adopts linear normalization, and the formula is as follows:

Figure BDA0003513536790000043
Figure BDA0003513536790000043

公式(16)中,x为原始数据,xmin表示原始数据集的最小值,xmax表示原始数据集的最大值;In formula (16), x is the original data, x min represents the minimum value of the original data set, and x max represents the maximum value of the original data set;

其中BP神经网络输入层有20个神经元,隐含层有64个神经元,输出层有5个神经元,分别对应5种树,输出层的取值范围为[-1,1],输出层的激活函数是softmax函数,隐含层的激活函数是Sigmoid函数。The BP neural network has 20 neurons in the input layer, 64 neurons in the hidden layer, and 5 neurons in the output layer, corresponding to 5 kinds of trees. The value range of the output layer is [-1, 1]. The activation function of the layer is the softmax function, and the activation function of the hidden layer is the Sigmoid function.

优选地,所述步骤5中,提取测试集的树叶的特征,整合得到20维特征矢量,对特征矢量归一化后输入树种辨别模型输出识别结果,验证得到树种辨别模型的准确率为96.8%。Preferably, in the step 5, the features of the leaves of the test set are extracted, integrated to obtain a 20-dimensional feature vector, and the feature vector is normalized and input to the tree species identification model to output the identification result, and the accuracy rate of the obtained tree species identification model is 96.8%. .

本发明的有益效果:Beneficial effects of the present invention:

1、本发明通过采集大量的树叶图片,对图片进行去噪、灰度化、二值化等预处理,有利于后续对树叶特征的提取以及识别。1. The present invention collects a large number of leaf pictures and performs preprocessing such as denoising, grayscale, and binarization on the pictures, which is beneficial to the subsequent extraction and identification of leaf features.

2、通过对提取的特征矢量进行归一化处理,归纳统一样本的统计分布性,提升模型的收敛速度。2. By normalizing the extracted feature vector, the statistical distribution of the unified sample is summarized, and the convergence speed of the model is improved.

3、利用BP神经网络进行训练,得到树种辨别模型,增强了算法的鲁棒性,提高了识别的准确率,可运用于更多场景。3. Using the BP neural network for training, the tree species identification model is obtained, which enhances the robustness of the algorithm, improves the accuracy of identification, and can be used in more scenarios.

附图说明Description of drawings

图1为本发明的均值滤波示意图。FIG. 1 is a schematic diagram of the mean filtering of the present invention.

图2为本发明的原图与灰度图对比图。FIG. 2 is a comparison diagram of the original image and the grayscale image of the present invention.

图3为本发明的二值化示意图。FIG. 3 is a schematic diagram of binarization of the present invention.

图4为本发明的双峰法示意图。Figure 4 is a schematic diagram of the bimodal method of the present invention.

图5为本发明的边缘检测示意图。FIG. 5 is a schematic diagram of edge detection according to the present invention.

图6为本发明的膨胀、腐蚀以及填充示意图。FIG. 6 is a schematic diagram of expansion, corrosion and filling of the present invention.

图7为本发明的预处理后部分数据集示意图。FIG. 7 is a schematic diagram of a partial data set after preprocessing according to the present invention.

图8为本发明的最小外接矩形示意图。FIG. 8 is a schematic diagram of the minimum circumscribed rectangle of the present invention.

图9为本发明的取前10个傅里叶描述子示意图。FIG. 9 is a schematic diagram of taking the first 10 Fourier descriptors according to the present invention.

图10为本发明的BP神经网络训练流程图。FIG. 10 is a flow chart of the BP neural network training of the present invention.

图11为本发明的一种基于树叶图片辨别树种的方法的流程图。FIG. 11 is a flowchart of a method for identifying tree species based on leaf pictures according to the present invention.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purposes, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments These are some embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

实施例1Example 1

如图11所示,一种基于树叶图片辨别树种的方法,包括如下步骤:As shown in Figure 11, a method for identifying tree species based on leaf pictures includes the following steps:

步骤1、采集树叶图片,划分训练集与测试集;Step 1. Collect leaf pictures and divide training set and test set;

采集不同树种的图片,树种包括:银杏、枫树、柳树、石榴、白桦,每种树叶数量为100,总计500,图片大小为300*300像素,将采集的图片作为数据集,把数据集划分为训练集与测试集,训练集与测试集的比例为8:2。Collect pictures of different tree species, tree species include: ginkgo, maple, willow, pomegranate, birch, the number of each leaf is 100, a total of 500, the picture size is 300*300 pixels, the collected pictures are used as a data set, and the data set is divided For training set and test set, the ratio of training set and test set is 8:2.

步骤2、图片预处理;Step 2, image preprocessing;

对采集到的图片进行预处理,预处理包括:去噪、灰度化、二值化、边缘检测、腐蚀、膨胀、填充;Preprocess the collected images, including: denoising, grayscale, binarization, edge detection, erosion, expansion, filling;

其中去噪的方式有巴特沃斯低通滤波器去噪、FIR低通滤波器去噪、移动平均滤波去噪、中值滤波去噪、维纳滤波去噪、自适应滤波去噪、小波去噪等,本发明采用中值滤波去噪,其过程如图1所示。Among them, the denoising methods include Butterworth low-pass filter denoising, FIR low-pass filter denoising, moving average filter denoising, median filter denoising, Wiener filter denoising, adaptive filter denoising, wavelet denoising Noise, etc., the present invention uses median filtering to remove noise, and the process is shown in Figure 1.

其中灰度化的方式有分量法、最大值法、平均值法、加权平均法,本发明采用最大值法对图片进行灰度化,如图2所示,公式如下:The grayscale methods include component method, maximum value method, average value method, and weighted average method. The present invention adopts the maximum value method to grayscale the picture, as shown in FIG. 2 , and the formula is as follows:

Gray(x,y)=max{R(x,y),G(x,y),B(x,y)} (1)Gray(x, y) = max{R(x, y), G(x, y), B(x, y)} (1)

公式(1)中,R(x,y)、G(x,y)、B(x,y)分别表示RGB三个分量;In formula (1), R(x,y), G(x,y), and B(x,y) respectively represent the three components of RGB;

其中二值化处理,如图3所示,其公式如下:The binarization process is shown in Figure 3, and the formula is as follows:

Figure BDA0003513536790000071
Figure BDA0003513536790000071

公式(2)中,T为二值化阈值;In formula (2), T is the binarization threshold;

二值化中阈值选取的常用方法有:双峰法、P参数法、最大类方差法、最大熵阈值法、最佳阈值法等,本发明采用双峰法,如图4所示,T取值为200;Common methods for threshold selection in binarization include: bimodal method, P parameter method, maximum class variance method, maximum entropy threshold method, optimal threshold method, etc. The present invention adopts bimodal method, as shown in FIG. 4 , T takes The value is 200;

边缘检测的算法有:Reberts算子、Prewitt算子、Sobel算子、Laplacian算子、Canny算子等等。Edge detection algorithms include: Reberts operator, Prewitt operator, Sobel operator, Laplacian operator, Canny operator, etc.

本发明采用Sobel算子对二值图像进行边缘检测,得到轮廓图,如图5所示,然后对图像进行膨胀与腐蚀运算、图像填充,如图6所示。The present invention uses the Sobel operator to perform edge detection on the binary image to obtain a contour map, as shown in FIG. 5 , and then performs expansion and erosion operations on the image, as shown in FIG.

对采集的图片进行预处理,最终得到的图片如图7所示。The collected images are preprocessed, and the final image is shown in Figure 7.

步骤3、提取训练集的树叶的特征;Step 3, extract the characteristics of the leaves of the training set;

提取的特征包括:圆形度、矩形度、最小外接矩形的长宽比、不变矩、傅里叶描述子,具体参数如下表所示:The extracted features include: circularity, rectangularity, aspect ratio of the smallest circumscribed rectangle, invariant moment, and Fourier descriptor. The specific parameters are shown in the following table:

特征编号Feature number 特征名称Feature name 描述describe 11 圆形度circularity 表示物体边缘与圆的相似程度Indicates how similar the edge of an object is to a circle 22 矩形度Rectangularity 表示物体与矩形的相似程度Indicates how similar an object is to a rectangle 33 最小外接矩形的长宽比The aspect ratio of the smallest bounding rectangle 最小外接矩形的长宽比The aspect ratio of the smallest bounding rectangle 4-104-10 不变矩Invariant moment 表征了图像区域的形状特征Shape features that characterize image regions 11-2011-20 傅里叶描述子Fourier Descriptor 描述物体的轮廓describe the outline of an object

表1Table 1

其中圆形度表示物体边缘与圆的相似程度,计算公式如下:The circularity represents the similarity between the edge of the object and the circle, and the calculation formula is as follows:

Figure BDA0003513536790000081
Figure BDA0003513536790000081

公式(3)中,S表示物体的面积,L表示物体的周长,e表示圆形度,e为1时,图形即为圆形;e越小,图形越不规律,与圆形的差距越大;In formula (3), S represents the area of the object, L represents the perimeter of the object, e represents the circularity, and when e is 1, the figure is a circle; bigger;

其中矩形度表示物体与矩形的相似程度,计算公式如下:The degree of rectangle represents the similarity between the object and the rectangle, and the calculation formula is as follows:

Figure BDA0003513536790000082
Figure BDA0003513536790000082

公式(4)中,S表示物体的面积,SR表示物体的最小外接矩形的面积,R表示矩形度,矩形度反映了物体在最小外接矩形中的填充程度;In formula (4), S represents the area of the object, S R represents the area of the smallest circumscribed rectangle of the object, R represents the degree of rectangle, and the degree of rectangle reflects the filling degree of the object in the smallest circumscribed rectangle;

其中最小外接矩形的长宽比是最小外接矩形长轴与短轴的比值,最小外接矩形如图8所示,计算公式如下:The aspect ratio of the smallest circumscribed rectangle is the ratio of the long axis to the short axis of the smallest circumscribed rectangle. The smallest circumscribed rectangle is shown in Figure 8, and the calculation formula is as follows:

Figure BDA0003513536790000083
Figure BDA0003513536790000083

公式(5)中,a表示最小外接矩形长轴,b表示最小外接矩形短轴,ε表示最小外接矩形的长宽比;In formula (5), a represents the long axis of the smallest circumscribed rectangle, b represents the short axis of the smallest circumscribed rectangle, and ε represents the aspect ratio of the smallest circumscribed rectangle;

不矩特征主要表征了图像区域的几何特征,又称为几何矩,由于其具有旋转、平移、尺度等特性的不变特征,所以又称其为不变矩,变矩的主要思想是使用对变换不敏感的基于区域的几个矩作为形状特征。The invariant moment feature mainly characterizes the geometric features of the image area, also known as geometric moment. Because it has invariant features such as rotation, translation, scale, etc., it is also called invariant moment. Transform-insensitive region-based moments are used as shape features.

对于二维的(N*M)数字化图像f(x,y),(p+q)阶矩可以定义为:For a two-dimensional (N*M) digitized image f(x,y), the (p+q) moment can be defined as:

Figure BDA0003513536790000084
Figure BDA0003513536790000084

其对应的(p+q)阶中心矩可以定义为:Its corresponding (p+q) order central moment can be defined as:

Figure BDA0003513536790000085
Figure BDA0003513536790000085

公式(7)中,

Figure BDA0003513536790000086
是质心坐标;In formula (7),
Figure BDA0003513536790000086
is the centroid coordinate;

f(x,y)的归一化(p+q)阶中心矩可以定义为:The normalized (p+q) order central moment of f(x,y) can be defined as:

Figure BDA0003513536790000087
Figure BDA0003513536790000087

Hu.M.K提出的7个不随水平、旋转、等比缩放变化的矩组,可以定义为:The 7 moment groups proposed by Hu.M.K that do not change with the level, rotation, and proportional scaling can be defined as:

M1=μ2002 (9)M 12002 (9)

M2=(μ2002)2+4μ11 2 (10)M 2 =(μ 2002 ) 2 +4μ 11 2 (10)

M3=(μ30-3μ12)2+(3μ2103)2 (11)M 3 =(μ 30 -3μ 12 ) 2 +(3μ 2103 ) 2 (11)

M4=(μ3012)2+(μ2103)2 (12)M 4 =(μ 3012 ) 2 +(μ 2103 ) 2 (12)

M5=(μ30-3μ12)(μ3012)[(μ3012)2-3(μ2103)2]+(3μ2103)(μ2103)[3(μ3012)2-(μ2103)2] (13)M 5 =(μ 30 -3μ 12 )(μ 3012 )[(μ 3012 ) 2 -3(μ 2103 ) 2 ]+(3μ 2103 )(μ 2103 )[3(μ 3012 ) 2 -(μ 2103 ) 2 ] (13)

M6=(μ2002)[(μ3012)2-(μ2103)2]+4μ113012)(μ2103) (14)M 6 =(μ 2002 )[(μ 3012 ) 2 -(μ 2103 ) 2 ]+4μ 113012 )(μ 2103 ) (14)

M7=(3μ2103)(μ3012)[(μ3012)2-3(μ2103)2]-(μ30-3μ12)(μ2103)[3(μ3012)2-(μ2103)2] (15)M 7 =(3μ 2103 )(μ 3012 )[(μ 3012 ) 2 -3(μ 2103 ) 2 ]-(μ 30 -3μ 12 )(μ 2103 )[3(μ 3012 ) 2 -(μ 2103 ) 2 ] (15)

傅里叶描述子是描述物体形状边界的傅里叶变换系数,它是物体边界曲线信号的频域分析结果。The Fourier descriptor is the Fourier transform coefficient that describes the shape boundary of the object, and it is the result of the frequency domain analysis of the object boundary curve signal.

假设一个由N点组成的封闭边界,从任一点P开始绕边界一周得到:Assuming a closed boundary consisting of N points, starting from any point P, we get:

s(k)=x(k)+jy(k),k=0,1,...,N-1 (16)s(k)=x(k)+jy(k), k=0, 1, ..., N-1 (16)

公式(16)中,x(k)和y(k)是动点P的坐标,j为系数;In formula (16), x(k) and y(k) are the coordinates of the moving point P, and j is the coefficient;

s(k)的离散傅里叶变换(DFT)为:The discrete Fourier transform (DFT) of s(k) is:

Figure BDA0003513536790000091
Figure BDA0003513536790000091

公式(17)中,u=0,1,...,N-1,a(u)是边界的傅里叶描述子In formula (17), u=0,1,...,N-1, a(u) is the Fourier descriptor of the boundary

归一化傅里叶描述子d′(k)为:The normalized Fourier descriptor d'(k) is:

Figure BDA0003513536790000092
Figure BDA0003513536790000092

本发明中,取前10个系数作为傅立叶描述子特征,如图9所示,可知同一树叶不论方向如何变幻,其傅立叶描述子都不变。In the present invention, the first 10 coefficients are taken as the Fourier descriptor feature, as shown in FIG. 9 , it can be seen that the Fourier descriptor of the same leaf remains unchanged no matter how the direction changes.

步骤4、训练树种辨别模型;Step 4. Train the tree species identification model;

对提取形状特征进行整合作为特征矢量,提取了20个特征参数,包括圆形度、矩形度、最小外接矩形的长宽比、7个不变矩、10个傅里叶描述子,整合得到一个20维的特征矢量,对特征矢量先进行归一化,再将归一化的特征矢量输入到BP神经网络进行训练,得到平面几何形状识别模型。The extracted shape features are integrated as a feature vector, and 20 feature parameters are extracted, including circularity, rectangularity, aspect ratio of the smallest circumscribed rectangle, 7 invariant moments, and 10 Fourier descriptors. 20-dimensional feature vector, the feature vector is normalized first, and then the normalized feature vector is input into the BP neural network for training, and the plane geometric shape recognition model is obtained.

其中归一化采用线性归一化,公式如下:The normalization adopts linear normalization, and the formula is as follows:

Figure BDA0003513536790000101
Figure BDA0003513536790000101

公式(19)中,x为原始数据,xmin表示原始数据集的最小值,xmax表示原始数据集的最大值。In formula (19), x is the original data, x min represents the minimum value of the original data set, and x max represents the maximum value of the original data set.

如图10所示,其中BP神经网络训练的具体流程如下:As shown in Figure 10, the specific process of BP neural network training is as follows:

BP神经网络输入层有n个神经元,隐含层有p个神经元,输出层有q个神经元。The BP neural network has n neurons in the input layer, p neurons in the hidden layer, and q neurons in the output layer.

步骤S1、变量定义:Step S1, variable definition:

输出层单元到隐含层单元有n*p条连线,连接权值为WihThere are n*p connections from the output layer unit to the hidden layer unit, and the connection weight is W ih ;

隐含层单元到输出层的单元有p*q条连线,连接权值WhoThere are p*q connections from the hidden layer unit to the output layer unit, connecting the weights Who ;

输入向量为x=(x1,……,xn);The input vector is x=(x 1 , ..., x n );

隐含层输入变量为hi=(hi1,……,hip);The input variable of the hidden layer is hi=(hi 1 , ..., hi p );

隐含层输出变量为ho=(ho1,……,hop);The output variable of the hidden layer is ho=(ho 1 ,..., ho p );

输出层输入变量为yi=(yi1,……,yiq);The input variable of the output layer is yi=(yi 1 , ..., yi q );

输出层输入变量为yo=(yo1,……,yoq);The input variable of the output layer is yo=(yo 1 , ..., yo q );

期望输出向量为do=(d1,……,dq);The expected output vector is do = (d 1 , ..., d q ) ;

隐含层各神经元的阈值为bhThe threshold of each neuron in the hidden layer is b h ;

输出层各神经元的阈值为boThe threshold value of each neuron in the output layer is b o ;

样本数据个数为k=1,2,……,m;The number of sample data is k = 1, 2, ..., m;

激活函数为f(·);The activation function is f( );

误差函数为

Figure BDA0003513536790000111
The error function is
Figure BDA0003513536790000111

作为本发明优选的实施例,输入层有20个神经元,隐含层有64个神经元,输出层有5个神经元,分别对应5种树,输出层的取值范围为[-1,1],输出层的激活函数是softmax函数,隐含层的激活函数是Sigmoid函数,公式如下:As a preferred embodiment of the present invention, the input layer has 20 neurons, the hidden layer has 64 neurons, and the output layer has 5 neurons, corresponding to 5 kinds of trees respectively, and the value range of the output layer is [-1, 1], the activation function of the output layer is the softmax function, and the activation function of the hidden layer is the Sigmoid function. The formula is as follows:

Figure BDA0003513536790000112
Figure BDA0003513536790000112

步骤S2、网络初始化:给各连接权值分别赋一个区间(-1,1)内的随机数,设定误差函数e,给定计算精度ε和最大学习次数M;Step S2, network initialization: assign a random number in the interval (-1, 1) to each connection weight, set the error function e, and give the calculation accuracy ε and the maximum number of learning times M;

作为本发明优选的实施例,计算精度ε为0.0001,最大学习次数M为500。As a preferred embodiment of the present invention, the calculation accuracy ε is 0.0001, and the maximum number of learning times M is 500.

步骤S3、随机选取:随机选取第k个输入样本以及对应的期望输出;Step S3, random selection: randomly select the kth input sample and the corresponding expected output;

第k个输入样本为x(k)=(x1(k),……,xn(k));The kth input sample is x (k) = (x1(k),...,xn(k));

对应的期望输出为do(k)=(d1(k),……,dq(k));The corresponding expected output is do ( k )=(d 1 (k),...,d q (k));

步骤S4、计算隐含层各神经元的输入和输出;Step S4, calculating the input and output of each neuron in the hidden layer;

Figure BDA0003513536790000113
Figure BDA0003513536790000113

hih(k)=f(hih(k)) (h=1,2,......,p) (22)hi h (k)=f(hi h (k)) (h=1, 2, ..., p) (22)

Figure BDA0003513536790000114
Figure BDA0003513536790000114

yoo(k)=f(yio(k)) (o=1,2,......,q) (24)yo o (k) = f(yi o (k)) (o = 1, 2, ..., q) (24)

步骤S5、计算全局误差E,公式如下:Step S5, calculate the global error E, the formula is as follows:

Figure BDA0003513536790000115
Figure BDA0003513536790000115

步骤S6、求偏导数:利用网络期望输出和实际输出,计算误差函数对输出层的各神经元的偏导数δo(k);Step S6, seek partial derivative: use the expected output and actual output of the network to calculate the partial derivative δ o (k) of the error function to each neuron in the output layer;

步骤S7、修正权值:利用输出层各神经元的δo(k)和隐含层各神经元的输出来修正连接权值Who(k);利用隐含层各神经元的δh(k)和输入层各神经元的输出来修正连接权值Wih(k);Step S7, modify the weights: use the δ o (k) of each neuron in the output layer and the output of each neuron in the hidden layer to correct the connection weight W ho (k); use the δ h ( k) and the output of each neuron in the input layer to modify the connection weight Wih (k);

步骤S8、训练是否终止:判断全局误差E和隐含层、输出层误差e是否满足要求,当误差达到预设精度或者学习次数大于设计的最大次数,则结束算法;否则,选取下一个学习样本以及对应的输出期望,返回步骤S4,进入下一轮学习。Step S8, whether the training is terminated: judge whether the global error E and the error e of the hidden layer and output layer meet the requirements, when the error reaches the preset accuracy or the number of learning times is greater than the maximum number of times designed, the algorithm ends; otherwise, select the next learning sample and the corresponding output expectation, return to step S4, and enter the next round of learning.

步骤5、提取测试集的树叶的特征,输入树种辨别模型,输出识别结果。Step 5: Extract the features of the leaves of the test set, input the tree species identification model, and output the identification result.

提取测试集的树叶的特征,整合得到20维特征矢量对特征矢量归一化后输入树种辨别模型输出识别结果。Extract the features of the leaves of the test set, and integrate to obtain a 20-dimensional feature vector. After normalizing the feature vector, input the tree species identification model and output the identification result.

本发明依据上述方法建立树种辨别模型,其结果如表所示,树种识别的准确率为96.8%,具有非常不错的识别效果。The present invention establishes a tree species identification model according to the above method, and the results are shown in the table. The accuracy rate of tree species identification is 96.8%, which has a very good identification effect.

Figure BDA0003513536790000121
Figure BDA0003513536790000121

表2Table 2

至此完成了整个方法的流程。So far, the whole process of the method is completed.

结合具体实施,可以得到本发明的优点是,本发明通过对图片进行预处理,有利于后续对树叶特征的提取以及识别;通过对提取的特征矢量进行归一化处理,归纳统一样本的统计分布性,提升模型的收敛速度;利用BP神经网络进行训练,得到树种辨别模型,增强了算法的鲁棒性,可运用于更多场景。Combined with the specific implementation, the advantages of the present invention can be obtained: the present invention preprocesses pictures, which is conducive to the subsequent extraction and identification of leaf features; by normalizing the extracted feature vectors, the statistical distribution of the unified samples is summarized. improve the convergence speed of the model; use the BP neural network for training to obtain a tree species identification model, which enhances the robustness of the algorithm and can be used in more scenarios.

本发明未详述之处,均为本领域技术人员的公知技术。The parts that are not described in detail in the present invention are known techniques of those skilled in the art.

以上详细描述了本发明的较佳具体实施例。应当理解,本领域的普通技术人员无需创造性劳动就可以根据本发明的构思作出诸多修改和变化。因此,凡本技术领域中技术人员依本发明的构思在现有技术的基础上通过逻辑分析、推理或者有限的实验可以得到的技术方案,皆应在由权利要求书所确定的保护范围内。The preferred embodiments of the present invention have been described in detail above. It should be understood that those skilled in the art can make many modifications and changes according to the concept of the present invention without creative efforts. Therefore, any technical solutions that can be obtained by those skilled in the art through logical analysis, reasoning or limited experiments on the basis of the prior art according to the concept of the present invention shall fall within the protection scope determined by the claims.

Claims (6)

1.一种基于树叶图片辨别树种的方法,其特征在于,包括以下步骤:1. a method for identifying tree species based on leaf picture, is characterized in that, comprises the following steps: 步骤1、采集树叶图片,划分训练集与测试集;Step 1. Collect leaf pictures and divide training set and test set; 步骤2、图片预处理;Step 2, image preprocessing; 步骤3、提取训练集的树叶的特征;Step 3, extract the characteristics of the leaves of the training set; 步骤4、对提取形状特征进行整合作为特征矢量,对特征矢量先进行归一化,再将归一化的特征矢量输入到BP神经网络进行训练,得到树种辨别模型;Step 4. Integrate the extracted shape features as a feature vector, first normalize the feature vector, and then input the normalized feature vector into the BP neural network for training to obtain a tree species identification model; 步骤5、提取测试集的树叶的特征,输入树种辨别模型,输出识别结果。Step 5: Extract the features of the leaves of the test set, input the tree species identification model, and output the identification result. 2.如权利要求1所述的一种基于树叶图片辨别树种的方法,其特征在于,所述步骤1中,采集不同树种的图片,树种包括:银杏、枫树、柳树、石榴、白桦,每种树叶数量不少于100,图片大小为300*300像素,将采集的图片作为数据集,把数据集划分为训练集与测试集,训练集与测试集的比例为8∶2。2. a kind of method for identifying tree species based on leaf pictures as claimed in claim 1, is characterized in that, in described step 1, collect the pictures of different tree species, tree species comprises: ginkgo, maple, willow, pomegranate, birch, each The number of planted leaves is not less than 100, and the image size is 300*300 pixels. The collected images are used as the data set, and the data set is divided into training set and test set, and the ratio of training set and test set is 8:2. 3.如权利要求2所述的一种基于树叶图片辨别树种的方法,其特征在于,所述步骤2中,图片预处理包括:去噪、灰度化、二值化、边缘检测、腐蚀、膨胀以及填充;3. The method for identifying tree species based on leaf pictures as claimed in claim 2, wherein in the step 2, the picture preprocessing comprises: denoising, grayscale, binarization, edge detection, corrosion, expansion and filling; 其中去噪的方式选择巴特沃斯低通滤波器去噪、FIR低通滤波器去噪、移动平均滤波去噪、中值滤波去噪、维纳滤波去噪、自适应滤波去噪、小波去噪中的其中一种;Among them, the denoising method chooses Butterworth low-pass filter denoising, FIR low-pass filter denoising, moving average filter denoising, median filter denoising, Wiener filter denoising, adaptive filter denoising, wavelet denoising one of the noises; 其中灰度化采用最大值法对图片进行灰度化,公式如下:The grayscale uses the maximum value method to grayscale the image, and the formula is as follows: Gray(x,y)=max{R(x,y),G(x,y),B(x,y)} (1)Gray(x, y) = max{R(x, y), G(x, y), B(x, y)} (1) 公式(1)中,R(x,y)、G(x,y)、B(x,y)分别表示RGB三个分量;In formula (1), R(x, y), G(x, y), and B(x, y) respectively represent the three components of RGB; 其中二值化处理,其公式如下:Among them, the binarization process, the formula is as follows: 公式(2)中,T为二值化阈值,二值化中阈值确定选择双峰法、P参数法、最大类方差法、最大熵阈值法、最佳阈值法中的其中一种。In formula (2), T is the binarization threshold, and the threshold in the binarization is determined by selecting one of the bimodal method, the P parameter method, the maximum class variance method, the maximum entropy threshold method, and the optimal threshold method. 其中边缘检测采用Prewitt算子,该算子既能检测边缘,还能抑制噪声的影响;Among them, the edge detection adopts the Prewitt operator, which can not only detect the edge, but also suppress the influence of noise; 4.如权利要求3所述的一种基于树叶图片辨别树种的方法,其特征在于,所述步骤3中,提取的特征包括:圆形度、矩形度、最小外接矩形的长宽比、不变矩、傅里叶描述子;4. a kind of method for identifying tree species based on leaf pictures as claimed in claim 3, it is characterized in that, in described step 3, the feature of extraction comprises: circularity, rectangularity, length-width ratio of minimum circumscribed rectangle, no. Variable moment, Fourier descriptor; 其中圆形度表示物体边缘与圆的相似程度,计算公式如下:The circularity represents the similarity between the edge of the object and the circle, and the calculation formula is as follows:
Figure FDA0003513536780000021
Figure FDA0003513536780000021
公式(3)中,S表示物体的面积,L表示物体的周长,e表示圆形度;In formula (3), S represents the area of the object, L represents the perimeter of the object, and e represents the circularity; 其中矩形度表示物体与矩形的相似程度,计算公式如下:The degree of rectangle represents the similarity between the object and the rectangle, and the calculation formula is as follows:
Figure FDA0003513536780000022
Figure FDA0003513536780000022
公式(4)中,S表示物体的面积,SR表示物体的最小外接矩形的面积,R表示矩形度;In formula (4), S represents the area of the object, S R represents the area of the smallest circumscribed rectangle of the object, and R represents the degree of rectangularity; 其中最小外接矩形的长宽比是最小外接矩形长轴与短轴的比值,计算公式如下:The aspect ratio of the smallest circumscribed rectangle is the ratio of the long axis to the short axis of the smallest circumscribed rectangle. The calculation formula is as follows:
Figure FDA0003513536780000023
Figure FDA0003513536780000023
公式(5)中,a表示最小外接矩形长轴,b表示最小外接矩形短轴,ε表示最小外接矩形的长宽比;In formula (5), a represents the long axis of the smallest circumscribed rectangle, b represents the short axis of the smallest circumscribed rectangle, and ε represents the aspect ratio of the smallest circumscribed rectangle; 其中不变矩主要表征了图像区域的几何特征,采用Hu.M.K提出的7个不随水平、旋转、等比缩放变化的矩组,定义如下:The invariant moment mainly characterizes the geometric features of the image area. The seven moment groups proposed by Hu.M.K that do not change with horizontal, rotation, and proportional scaling are used, which are defined as follows: M1=μ2002 (6)M 12002 (6) M2=(μ2002)2+4μ11 2 (7)M 2 =(μ 2002 ) 2 +4μ 11 2 (7) M3=(μ30-3μ12)2+(3μ2103)2 (8)M 3 =(μ 30 -3μ 12 ) 2 +(3μ 2103 ) 2 (8) M4=(μ3012)2+(μ2103)2 (9)M 4 =(μ 3012 ) 2 +(μ 2103 ) 2 (9) M5=(μ30-3μ12)(μ3012)[(μ3012)2-3(μ2103)2]+(3μ2103)(μ2103)[3(μ3012)2-(μ2103)2] (10)M 5 =(μ 30 -3μ 12 )(μ 3012 )[(μ 3012 ) 2 -3(μ 2103 ) 2 ]+(3μ 2103 )(μ 2103 )[3(μ 3012 ) 2 -(μ 2103 ) 2 ] (10) M6=(μ2002)[(μ3012)2-(μ2103)2]+4μ113012)(μ2103) (11)M 6 =(μ 2002 )[(μ 3012 ) 2 -(μ 2103 ) 2 ]+4μ 113012 )(μ 2103 ) (11) M7=(3μ2103)(μ3012)[(μ3012)2-3(μ2103)2]-(μ30-3μ12)(μ2103)[3(μ3012)2-(μ2103)2] (12)M 7 =(3μ 2103 )(μ 3012 )[(μ 3012 ) 2 -3(μ 2103 ) 2 ]-(μ 30 -3μ 12 )(μ 2103 )[3(μ 3012 ) 2 -(μ 2103 ) 2 ] (12) 公式(6)-(12)中,μpq表示归一化(p+q)阶中心矩,p,q=0,1,2,3;In formulas (6)-(12), μ pq represents the normalized (p+q) order central moment, p, q=0, 1, 2, 3; 傅里叶描述子是描述物体形状边界的傅里叶变换系数,计算公式如下:The Fourier descriptor is the Fourier transform coefficient that describes the shape boundary of the object. The calculation formula is as follows: 假设一个由N点组成的封闭边界,从任一点P开始绕边界一周得到:Assuming a closed boundary consisting of N points, starting from any point P, we get: s(k)=x(k)+jy(k),k=0,1,...,N-1 (13)s(k)=x(k)+jy(k), k=0, 1, ..., N-1 (13) 公式(13)中,x(k)和y(k)是动点P的坐标,j为系数;In formula (13), x(k) and y(k) are the coordinates of the moving point P, and j is the coefficient; s(k)的离散傅里叶变换(DFT)为:The discrete Fourier transform (DFT) of s(k) is:
Figure FDA0003513536780000031
Figure FDA0003513536780000031
公式(14)中,u=0,1,...,N-1,a(u)是边界的傅里叶描述子In formula (14), u=0,1,...,N-1, a(u) is the Fourier descriptor of the boundary 归一化傅里叶描述子d′(k)为:The normalized Fourier descriptor d'(k) is:
Figure FDA0003513536780000032
Figure FDA0003513536780000032
本发明中,取前10个系数作为傅立叶描述子特征。In the present invention, the first 10 coefficients are taken as the Fourier descriptor feature.
5.如权利要求4所述的一种基于树叶图片辨别树种的方法,其特征在于,所述步骤4中,对提取形状特征进行整合作为特征矢量,提取了20个特征参数,包括圆形度、矩形度、最小外接矩形的长宽比、7个不变矩、10个傅里叶描述子,整合得到一个20维的特征矢量,对特征矢量先进行归一化,再将归一化的特征矢量输入到BP神经网络进行训练,得到平面几何形状识别模型;其中归一化采用线性归一化,公式如下:5. a kind of method for distinguishing tree species based on leaf picture as claimed in claim 4, it is characterized in that, in described step 4, to extract shape feature is integrated as feature vector, extracted 20 feature parameters, including circularity , rectangle degree, aspect ratio of the smallest circumscribed rectangle, 7 invariant moments, 10 Fourier descriptors, integrated to obtain a 20-dimensional feature vector, normalize the feature vector first, and then normalize the normalized The feature vector is input into the BP neural network for training, and the plane geometric shape recognition model is obtained; the normalization adopts linear normalization, and the formula is as follows:
Figure FDA0003513536780000041
Figure FDA0003513536780000041
公式(16)中,x为原始数据,xmin表示原始数据集的最小值,xmax表示原始数据集的最大值;In formula (16), x is the original data, x min represents the minimum value of the original data set, and x max represents the maximum value of the original data set; 其中BP神经网络输入层有20个神经元,隐含层有64个神经元,输出层有5个神经元,分别对应5种树,输出层的取值范围为[-1,1],输出层的激活函数是softmax函数,隐含层的激活函数是Sigmoid函数。The BP neural network has 20 neurons in the input layer, 64 neurons in the hidden layer, and 5 neurons in the output layer, corresponding to 5 kinds of trees. The value range of the output layer is [-1, 1]. The activation function of the layer is the softmax function, and the activation function of the hidden layer is the Sigmoid function.
6.如权利要求5所述的一种基于树叶图片辨别树种的方法,其特征在于,所述步骤5中,提取测试集的树叶的特征,整合得到20维特征矢量,对特征矢量归一化后输入树种辨别模型输出识别结果,验证得到树种辨别模型的准确率为96.8%。6. a kind of method for identifying tree species based on leaf picture as claimed in claim 5, is characterized in that, in described step 5, extract the feature of the leaves of test set, integrate and obtain 20-dimensional feature vector, to feature vector normalization After inputting the tree species identification model and outputting the identification results, the accuracy of the obtained tree species identification model was 96.8%.
CN202210158900.3A 2022-02-21 2022-02-21 A method for identifying tree species based on leaf pictures Pending CN114565525A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210158900.3A CN114565525A (en) 2022-02-21 2022-02-21 A method for identifying tree species based on leaf pictures

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210158900.3A CN114565525A (en) 2022-02-21 2022-02-21 A method for identifying tree species based on leaf pictures

Publications (1)

Publication Number Publication Date
CN114565525A true CN114565525A (en) 2022-05-31

Family

ID=81713631

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210158900.3A Pending CN114565525A (en) 2022-02-21 2022-02-21 A method for identifying tree species based on leaf pictures

Country Status (1)

Country Link
CN (1) CN114565525A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114972276A (en) * 2022-06-05 2022-08-30 长沙烽铭智能科技有限公司 Automatic driving distance judgment algorithm for vehicle

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109522924A (en) * 2018-09-28 2019-03-26 浙江农林大学 A kind of broad-leaf forest wood recognition method based on single photo
CN111860567A (en) * 2020-05-09 2020-10-30 武汉理工大学 The Construction Method of Leaf Image Recognition Model

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109522924A (en) * 2018-09-28 2019-03-26 浙江农林大学 A kind of broad-leaf forest wood recognition method based on single photo
CN111860567A (en) * 2020-05-09 2020-10-30 武汉理工大学 The Construction Method of Leaf Image Recognition Model

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
刘念 等: "基于多特征融合和深度信念网络的植物叶片识别", 《北京林业大学学报》, vol. 38, 31 March 2016 (2016-03-31), pages 110 - 119 *
岑耀东 等著: "《冷轧带钢热镀锌技术》", 30 November 2021, 北京:冶金工业出版社, pages: 38 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114972276A (en) * 2022-06-05 2022-08-30 长沙烽铭智能科技有限公司 Automatic driving distance judgment algorithm for vehicle
CN114972276B (en) * 2022-06-05 2025-01-21 长沙烽铭智能科技有限公司 An algorithm for determining distance of vehicle autonomous driving

Similar Documents

Publication Publication Date Title
CN109003279B (en) Fundus retina blood vessel segmentation method and system based on K-Means clustering labeling and naive Bayes model
CN108520225B (en) A Fingerprint Detection and Classification Method Based on Spatial Transform Convolutional Neural Network
CN110837768B (en) An online detection and identification method for rare animal protection
CN106897673B (en) A Pedestrian Re-identification Method Based on Retinex Algorithm and Convolutional Neural Network
CN109102004A (en) Cotton-plant pest-insects method for identifying and classifying and device
CN107679509B (en) A kind of cyanobacteria identification method and device
CN107194937A (en) Tongue image partition method under a kind of open environment
CN105844285A (en) Cucumber disease identification method and apparatus based on image information
CN110555382A (en) Finger vein identification method based on deep learning and Wasserstein distance measurement
CN109461163B (en) Edge detection method for magnetic resonance standard water model
CN111027570B (en) Image multi-scale feature extraction method based on cellular neural network
CN108537751B (en) Thyroid ultrasound image automatic segmentation method based on radial basis function neural network
CN107944399A (en) A kind of pedestrian's recognition methods again based on convolutional neural networks target's center model
CN111127387B (en) Quality evaluation method for reference-free image
CN111815640B (en) Memristor-based RBF neural network medical image segmentation algorithm
CN110766016B (en) Code-spraying character recognition method based on probabilistic neural network
CN104794440B (en) A kind of false fingerprint detection method based on the multiple dimensioned LBP of more piecemeals
CN101334834A (en) A Bottom-Up Attention Information Extraction Method
CN117593540A (en) Pressure injury staged identification method based on intelligent image identification technology
CN113283371A (en) Local discharge feature extraction and classification method based on BRISK features
CN109191436A (en) The low-dose CT Lung neoplasm detection algorithm of view-based access control model conspicuousness spectrum residual error method
CN116524269A (en) Visual recognition detection system
CN114863189B (en) Intelligent image identification method based on big data
CN114565525A (en) A method for identifying tree species based on leaf pictures
CN114998274A (en) Object positioning method, apparatus, electronic device and readable storage medium

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