CN111160428A - Automatic vegetable identification method based on CNN-SVM algorithm - Google Patents

Automatic vegetable identification method based on CNN-SVM algorithm Download PDF

Info

Publication number
CN111160428A
CN111160428A CN201911302291.9A CN201911302291A CN111160428A CN 111160428 A CN111160428 A CN 111160428A CN 201911302291 A CN201911302291 A CN 201911302291A CN 111160428 A CN111160428 A CN 111160428A
Authority
CN
China
Prior art keywords
cnn
svm
model
classification
layer
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
CN201911302291.9A
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.)
Jinling Institute of Technology
Original Assignee
Jinling Institute 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 Jinling Institute of Technology filed Critical Jinling Institute of Technology
Priority to CN201911302291.9A priority Critical patent/CN111160428A/en
Publication of CN111160428A publication Critical patent/CN111160428A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2411Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on the proximity to a decision surface, e.g. support vector machines
    • 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
    • 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; 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
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/60Type of objects
    • G06V20/68Food, e.g. fruit or vegetables

Landscapes

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

Abstract

The invention discloses a vegetable automatic identification method based on a CNN-SVM algorithm, which is characterized in that a CNN-Lenet5 model (namely a network structure is composed of an input layer, a convolution layer, a pooling layer, a full-link layer and an output layer) is constructed to extract high-level features of vegetable images, and then an SVM is used for classifying the high-level features to finish the final identification of vegetables. Since the CNN classification algorithm requires a large amount of data as a support, in the case of a small amount of data, directly using the CNN algorithm may result in overfitting. The SVM algorithm has excellent classification effect only by using small samples, and the defect that a large amount of data is needed by CNN is just made up. Therefore, after the feature extraction is completed, the last softmax classification layer of the CNN network structure is removed and replaced by an SVM algorithm model. The automatic classification and recognition of the vegetable images are realized by combining CNN automatic feature extraction and SVM classification two algorithm models.

Description

Automatic vegetable identification method based on CNN-SVM algorithm
Technical Field
The invention relates to the field of vegetable auxiliary treatment, in particular to a vegetable automatic identification method based on a CNN-SVM algorithm.
Background
With the continuous development of economy and the continuous improvement of living standard, the food safety becomes a topic which is increasingly concerned by people. In order to solve the problem of food safety, related laws in China put forward the requirement for establishing food traceability, and operations such as food information input, transmission and recording of food safety information and transaction information are required. The traditional vegetable information input, transmission and other operations are realized by the technologies of manual memory input, two-dimensional code or bar code scanning, radio frequency identification and the like. Vegetable image recognition is a technical means to accomplish processing and interpretation tasks via computers using imaging systems. Vegetables image recognition can carry out automated inspection and classification to vegetables, can replace operations such as traditional information input, transmission, saves a large amount of manpower and materials.
At present, the vegetable identification method researched by domestic and foreign researchers is to establish a characteristic database for identification by searching the characteristics of the image such as texture, shape, color and the like. In 1996, Bolle et al designed the first Veggie-Vision system for fruit and vegetable recognition based on image color, texture, and shape. In 2012, Shiv Ram Dubey et al proposed an improved texture feature recognition method based on original texture features. However, the extracted texture, shape and color features belong to shallow features, the shallow features need manual extraction, and interference of human factors can be caused in the process of extracting the shallow features, so that the identification of the vegetable image is restricted.
Convolutional Neural Networks (CNN) are a type of feed-forward Neural network that includes convolution calculation and has a deep structure, and structurally mainly include modules such as an input layer, a Convolutional layer, a pooling layer, a nonlinear activation layer, and a full connection layer, and have a hierarchical learning mode, and parameter optimization is performed through a back propagation algorithm in a learning stage to adaptively learn an image shallow layer. The CNN has the characteristic of active feature learning, has strong expression capability and generalization capability, and can extract high-level image features by using the CNN. The CNN gradually extracts image features of each level from an original image through a multilayer convolutional network, and then gradually extracts high-level features from shallow features such as texture, color, shape and the like.
A Support Vector Machine (SVM) belongs to the category of supervised learning. The learning strategy of the support vector machine is to find the "interval maximization", that is, to find the optimal hyperplane capable of maximizing the classification category spacing, and the nature of the model is the maximum linear classifier in the feature space. The SVM has the advantages of excellent generalization capability, capability of processing small samples, strong robustness and the like, and can be applied to vegetable image classification by combining with the high-level features extracted by the CNN to complete an automatic vegetable recognition task.
Disclosure of Invention
To solve the above existing problems. The invention provides a vegetable automatic identification method based on a CNN-SVM algorithm, which utilizes the strong expression capability and generalization capability of the CNN, extracts the high-level image characteristics of vegetable images through the CNN and combines the SVM algorithm to realize the task of automatically identifying the vegetable category in the whole process. To achieve this object:
the invention provides a vegetable automatic identification method based on a CNN-SVM algorithm, which comprises the following steps,
step 1: establishing a vegetable image sample database, establishing a data set by classifying the collected vegetable images, and dividing training samples and testing samples;
and step 3: constructing a CNN-Lenet5 model, wherein the input layer structure is 512 × 3, the two convolution layers are 512 × 24 and 512 × 128, the pooling layer selects the maximum pooling mode, and the two fully-connected layers are 1 × 128 to 240 and 240 to 20;
and 4, step 4: training a CNN model, inputting training sample images and image types into the CNN model to enable a softmax layer to calculate loss errors, adjusting CNN convolutional layer template parameters by continuously reducing the errors, and training to obtain an optimal CNN model;
and 5: extracting 20 high-level features of the training sample, removing a softmax layer in the CNN model, inputting the training sample image into the CNN model, and outputting the 20 high-level features of the training sample through a full-connection layer 240 x 20 by the CNN model;
and 5: training an SVM model, wherein 20 high-level features of a training sample image are used for training the SVM model;
step 6: extracting 20 high-level features of a test sample, inputting a test sample image into a CNN model, and outputting the 20 high-level features of the test sample through a full-connection layer 240 × 20 by the CNN model;
step 6: and outputting a classification result. Inputting the 20 high-level features of the test sample into the SVM model, and outputting the classification result of the test image.
As a further improvement of the present invention, the calculation formula of softmax in the second step is as follows:
Figure BDA0002322142690000021
class S in which n numerical values representk,k∈(0,n]I denotes a certain class in k, giA value, P (S), representing the classificationk) Is the probability of that classification.
As a further improvement of the present invention, the classification core principle of the SVM in the step five is:
let the linearly separable set of samples be (x)i,yi) Where i is 1,2, …,20, xiIs 20 features, y, extracted through the CNN networkiThe category labels of the vegetables are obtained, and the optimal hyperplane obtained by interval maximization learning is as follows:
ω·x+b=0 (2)
where ω is the normal vector and determines the direction of the hyperplane. b is the displacement, determines the distance between the hyperplane and the origin, and the general form of the corresponding linear classification function is:
f(x)=ω·x+b (3)
while the optimal hyperplane makes all sample points satisfy:
|f(x)|≥1 (4)
the support vector of the SVM is a sample point at which equation 3 holds, and the point of the support vector is a solid point in the image.
The invention provides a vegetable automatic identification method based on a CNN-SVM algorithm, which is specifically designed as follows:
1. the invention extracts 20 advanced features of the vegetable image by utilizing the characteristic that the CNN has strong feature expression capability and generalization capability. The method has stronger robustness and generalization capability by utilizing the CNN to extract the advanced features of the vegetable image to realize vegetable identification.
2. The vegetable image classification method adopts the SVM algorithm to replace a softmax layer in the CNN to classify the vegetable image, and avoids the overfitting phenomenon caused by small samples of the CNN.
3. The CNN does not need to do complicated preprocessing work on the image in advance when extracting the image characteristics, and the CNN extracted characteristics can automatically overcome certain noise interference.
4. The invention uses the CNN-SVM algorithm, improves the accuracy of vegetable classification and identification, increases the robustness in the identification process, and has application significance in engineering.
5. The CNN-Kmeans algorithm model provided by the invention can realize real-time identification of vegetables.
Drawings
FIG. 1 is a flow chart of the overall algorithm principle of the present invention;
FIG. 2 is a CNN model structure employed in the present invention;
FIG. 3 is a support vector machine classification optimization hyperplane;
fig. 4 is a flow diagram of the SVM algorithm.
Detailed Description
The invention is described in further detail below with reference to the following detailed description and accompanying drawings:
the invention provides a vegetable automatic identification method based on a CNN-SVM algorithm, which utilizes the strong expression capability and generalization capability of the CNN, extracts the high-level image characteristics of vegetable images through the CNN and combines the SVM algorithm to realize the task of automatically identifying the vegetable category in the whole process.
The overall algorithm principle flow of the invention is shown in fig. 1.
Firstly, marking categories of collected images and establishing a database. And then dividing the original data in the established data set into a training sample image and a testing sample image, wherein the training sample image is used for training a CNN model and an SVM model, and the testing sample image is used for testing the effectiveness of the algorithm model. The training samples need to train a complete CNN model, and because the whole CNN algorithm process needs to be participated by a loss function layer, the characteristics obtained by convolution of the convolution template parameters can be optimal under the effect of loss function reduction, the CNN network needs to be trained by the training samples at first.
After the data set is prepared, a CNN-Lenet5 network model is created, the input layer structure is 512 x 3, the two convolution layers are 512 x 24 and 512 x 128, the pooling layer selects the maximum pooling mode, the two fully-connected layers are 1 x 128 to 240 and 240 to 20, and the network model structure of the CNN-Lenet5 is shown in FIG. 2.
And completing the pre-training of the CNN model by using the constructed CNN-Lenet5 model structure. Training the sample image to enable the softmax layer to calculate loss errors, then continuously reducing the errors so as to continuously adjust template parameters of the CNN convolutional layer, and training the convolutional template with the optimal feature extraction. Because the features extracted by the convolutional layer can be identified by the network better by continuously reducing the error in the softmax layer, the smaller the error is, the more effective and robust the extracted features are, the better the subsequent identification is, wherein the calculation formula of softmax is as follows:
Figure BDA0002322142690000041
class S in which n numerical values representk,k∈(0,n]I denotes a certain class in k, giA value, P (S), representing the classificationk) Is the probability of that classification.
And inputting the training samples into the trained CNN model again, extracting 20 high-level features from the fully-connected layer 240 x 20, and inputting the 20 high-level features into the SVM to train the SVM model.
And removing the last loss function softmax layer in the trained CNN model, and replacing the last layer with the trained SVM model. The classification core principle of the SVM is as follows:
let the linearly separable set of samples be (x)i,yi) Where i is 1,2, …,20, xiIs 20 features, y, extracted through the CNN networkiThe category labels of the vegetables are obtained, and the optimal hyperplane obtained by interval maximization learning is as follows:
ω·x+b=0 (2)
where ω is the normal vector and determines the direction of the hyperplane. b is the displacement, determining the distance between the hyperplane and the origin. The general form of the corresponding linear classification function is:
f(x)=ω·x+b (3)
while the optimal hyperplane makes all sample points satisfy:
|f(x)|≥1 (4)
the support vector of the SVM is a sample point where equation 3 holds, the points of the support vector are the solid points in fig. 3, and the flow of the SVM algorithm is shown in fig. 4.
And finally, the trained CNN-SVM model is used for detecting vegetable images, and the accuracy of the optimized algorithm model in automatic vegetable recognition reaches 97.62%.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the present invention in any way, but any modifications or equivalent variations made according to the technical spirit of the present invention are within the scope of the present invention as claimed.

Claims (3)

1. The vegetable automatic identification method based on the CNN-SVM algorithm comprises the following specific steps,
step 1: establishing a vegetable image sample database, establishing a data set by classifying the collected vegetable images, and dividing training samples and testing samples;
and step 3: constructing a CNN-Lenet5 model, wherein the input layer structure is 512 × 3, the two convolution layers are 512 × 24 and 512 × 128, the pooling layer selects the maximum pooling mode, and the two fully-connected layers are 1 × 128 to 240 and 240 to 20;
and 4, step 4: training a CNN model, inputting training sample images and image types into the CNN model to enable a softmax layer to calculate loss errors, adjusting CNN convolutional layer template parameters by continuously reducing the errors, and training to obtain an optimal CNN model;
and 5: extracting 20 high-level features of the training sample, removing a softmax layer in the CNN model, inputting the training sample image into the CNN model, and outputting the 20 high-level features of the training sample through a full-connection layer 240 x 20 by the CNN model;
and 5: training an SVM model, wherein 20 high-level features of a training sample image are used for training the SVM model;
step 6: extracting 20 high-level features of a test sample, inputting a test sample image into a CNN model, and outputting the 20 high-level features of the test sample through a full-connection layer 240 × 20 by the CNN model;
step 6: and outputting a classification result. Inputting the 20 high-level features of the test sample into the SVM model, and outputting the classification result of the test image.
2. The CNN-SVM algorithm-based vegetable automatic recognition method of claim 1, wherein: the calculation formula of softmax in the second step is as follows:
Figure FDA0002322142680000011
class S in which n numerical values representk,k∈(0,n],iDenotes a certain class in k, giA value, P (S), representing the classificationk) Is the probability of that classification.
3. The CNN-SVM algorithm-based vegetable automatic recognition method of claim 1, wherein: the classification core principle of the SVM in the step five is as follows:
let the linearly separable set of samples be (x)i,yi) Wherein i is 1,2iIs 20 features, y, extracted through the CNN networkiThe category labels of the vegetables are obtained, and the optimal hyperplane obtained by interval maximization learning is as follows:
ω·x+b=0 (2)
where ω is the normal vector and determines the direction of the hyperplane. b is the displacement, determines the distance between the hyperplane and the origin, and the general form of the corresponding linear classification function is:
f(x)=ω·x+b (3)
while the optimal hyperplane makes all sample points satisfy:
|f(x)|≥1 (4)
the support vector of the SVM is a sample point at which equation 3 holds, and the point of the support vector is a solid point in the image.
CN201911302291.9A 2019-12-17 2019-12-17 Automatic vegetable identification method based on CNN-SVM algorithm Pending CN111160428A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911302291.9A CN111160428A (en) 2019-12-17 2019-12-17 Automatic vegetable identification method based on CNN-SVM algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911302291.9A CN111160428A (en) 2019-12-17 2019-12-17 Automatic vegetable identification method based on CNN-SVM algorithm

Publications (1)

Publication Number Publication Date
CN111160428A true CN111160428A (en) 2020-05-15

Family

ID=70557546

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911302291.9A Pending CN111160428A (en) 2019-12-17 2019-12-17 Automatic vegetable identification method based on CNN-SVM algorithm

Country Status (1)

Country Link
CN (1) CN111160428A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112115902A (en) * 2020-09-25 2020-12-22 广州市派客朴食信息科技有限责任公司 Dish identification method based on single-stage target detection algorithm
CN113762325A (en) * 2021-05-26 2021-12-07 江苏师范大学 Vegetable recognition method based on ResNet-SVM algorithm
CN113962231A (en) * 2021-10-13 2022-01-21 杭州胜铭纸业有限公司 Optical identification comparison method and system for information codes of packing cases

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105184309A (en) * 2015-08-12 2015-12-23 西安电子科技大学 Polarization SAR image classification based on CNN and SVM
CN108304885A (en) * 2018-02-28 2018-07-20 宜宾学院 A kind of Gabor wavelet CNN image classification methods
CN108491765A (en) * 2018-03-05 2018-09-04 中国农业大学 A kind of classifying identification method and system of vegetables image
CN110084318A (en) * 2019-05-07 2019-08-02 哈尔滨理工大学 A kind of image-recognizing method of combination convolutional neural networks and gradient boosted tree

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105184309A (en) * 2015-08-12 2015-12-23 西安电子科技大学 Polarization SAR image classification based on CNN and SVM
CN108304885A (en) * 2018-02-28 2018-07-20 宜宾学院 A kind of Gabor wavelet CNN image classification methods
CN108491765A (en) * 2018-03-05 2018-09-04 中国农业大学 A kind of classifying identification method and system of vegetables image
CN110084318A (en) * 2019-05-07 2019-08-02 哈尔滨理工大学 A kind of image-recognizing method of combination convolutional neural networks and gradient boosted tree

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112115902A (en) * 2020-09-25 2020-12-22 广州市派客朴食信息科技有限责任公司 Dish identification method based on single-stage target detection algorithm
CN113762325A (en) * 2021-05-26 2021-12-07 江苏师范大学 Vegetable recognition method based on ResNet-SVM algorithm
CN113962231A (en) * 2021-10-13 2022-01-21 杭州胜铭纸业有限公司 Optical identification comparison method and system for information codes of packing cases
CN113962231B (en) * 2021-10-13 2024-03-26 杭州胜铭纸业有限公司 Packaging box information code optical identification comparison method and system

Similar Documents

Publication Publication Date Title
Wang et al. Integrated model of BP neural network and CNN algorithm for automatic wear debris classification
CN105447473B (en) A kind of any attitude facial expression recognizing method based on PCANet-CNN
CN106971152B (en) Method for detecting bird nest in power transmission line based on aerial images
CN111723738B (en) Coal rock chitin group microscopic image classification method and system based on transfer learning
CN107492098B (en) It is a kind of based on PCA and CNN high-temperature forging surface defect in position detecting method
CN107451565B (en) Semi-supervised small sample deep learning image mode classification and identification method
CN109272500B (en) Fabric classification method based on adaptive convolutional neural network
CN110827260B (en) Cloth defect classification method based on LBP characteristics and convolutional neural network
CN111160428A (en) Automatic vegetable identification method based on CNN-SVM algorithm
Zhang et al. Chromosome classification with convolutional neural network based deep learning
CN104992223A (en) Intensive population estimation method based on deep learning
Ahranjany et al. A very high accuracy handwritten character recognition system for Farsi/Arabic digits using convolutional neural networks
CN111127423B (en) Rice pest and disease identification method based on CNN-BP neural network algorithm
CN110363253A (en) A kind of Surfaces of Hot Rolled Strip defect classification method based on convolutional neural networks
CN110929762B (en) Limb language detection and behavior analysis method and system based on deep learning
CN111178177A (en) Cucumber disease identification method based on convolutional neural network
CN114898472B (en) Signature identification method and system based on twin vision transducer network
CN115953666B (en) Substation site progress identification method based on improved Mask-RCNN
CN112749675A (en) Potato disease identification method based on convolutional neural network
Zhang Application of artificial intelligence recognition technology in digital image processing
Dong et al. Fusing multilevel deep features for fabric defect detection based NTV-RPCA
CN108898157B (en) Classification method for radar chart representation of numerical data based on convolutional neural network
CN111144464B (en) Fruit automatic identification method based on CNN-Kmeans algorithm
CN113158878B (en) Heterogeneous migration fault diagnosis method, system and model based on subspace
Zeng et al. Image recognition method of agricultural pests based on multisensor image fusion technology

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20200515

RJ01 Rejection of invention patent application after publication