CN113469129A - Wheat impurity image detection method based on convolutional neural network - Google Patents

Wheat impurity image detection method based on convolutional neural network Download PDF

Info

Publication number
CN113469129A
CN113469129A CN202110837433.2A CN202110837433A CN113469129A CN 113469129 A CN113469129 A CN 113469129A CN 202110837433 A CN202110837433 A CN 202110837433A CN 113469129 A CN113469129 A CN 113469129A
Authority
CN
China
Prior art keywords
wheat
image
layer
network model
residual
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
CN202110837433.2A
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 CN202110837433.2A priority Critical patent/CN113469129A/en
Publication of CN113469129A publication Critical patent/CN113469129A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/213Feature extraction, e.g. by transforming the feature space; Summarisation; Mappings, e.g. subspace methods
    • 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
    • G06T5/90
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30181Earth observation
    • G06T2207/30188Vegetation; Agriculture

Abstract

The invention discloses a wheat impurity image detection method based on a convolutional neural network, which relates to the field of computer vision and image processing.

Description

Wheat impurity image detection method based on convolutional neural network
Technical Field
The invention relates to the technical field of machine vision, in particular to a wheat impurity image detection method based on a convolutional neural network.
Background
Wheat is a second grain crop of the total yield in the world, is second to corn, has more than 1 ten thousand years of cultivation history, has caryopsis of human staple food, is a key factor for the quality of flour, and has no impurity removed before being milled, so that the quality of the flour is influenced to a certain extent, and the service life of milling equipment is also influenced, therefore, the doping rate is one of important indexes for evaluating the quality grade and the price of the wheat.
At present, the wheat impurity identification method is mainly divided into a sensory detection method and an image detection method. The sensory detection method is characterized in that detection personnel classify the wheat impurities according to experience and subjective judgment of naked eyes, subjective factors are easily doped, and great uncertainty is brought to wheat quality classification; in the aspect of an image detection method, researchers research the identification of wheat and impurities through technologies such as a linear discriminant analysis model and an artificial neural network, and although the identification accuracy rate is over 90%, the calculation process of the method is relatively complicated, the algorithm performance depends on the extracted input data characteristics, and the real-time detection requirement of an actual wheat image cannot be met.
In the agricultural field, many researchers apply the convolutional neural network to wheat research, and compared with technologies such as a linear discriminant analysis model and an artificial neural network, the convolutional neural network can directly identify an original image, so that the complicated processes of artificial feature design, selection, optimization and the like are avoided, and other algorithms are not needed for feature extraction.
Therefore, in order to meet the requirement of real-time detection of wheat images, an urgent need exists in the art for a method for detecting wheat impurity images based on a convolutional neural network.
Disclosure of Invention
In view of the above, the invention provides a wheat impurity image detection method based on a convolutional neural network, which has the advantages of high identification precision, short identification time and smaller model, and meets the real-time requirement of wheat impurity identification.
In order to achieve the above purpose, the invention provides the following technical scheme:
a wheat impurity image detection method based on a convolutional neural network comprises the following steps:
s100: collecting a wheat grain image containing impurities;
s200: preprocessing the collected wheat grain image containing impurities to construct a wheat grain and impurity image database;
s300: dividing data in the wheat grain and impurity image database into a training set and a test set;
s400: constructing a ResNet network model, and optimizing the ResNet network model to obtain an optimized ResNet network model;
s500: and testing the test set according to the optimized ResNet network model to obtain a test result.
Preferably, the step S200 includes:
s210: converting the collected wheat grain image containing impurities into a gray scale image;
s220: converting the gray level image into a binary image after threshold segmentation;
s230: if the binary image has a plurality of seed images, segmenting the plurality of seed images into single seed images;
s240: expanding the single grain image;
s250: and constructing a wheat grain and impurity image database after expansion.
Preferably, the ResNet network model constructed in step S400 includes: the video coding device comprises a first convolution layer, a first residual layer, a second residual layer, a third residual layer, a first pooling layer, a second pooling layer, a global average pooling layer, a full-link layer and an output layer. By simplifying the size of the ResNet network model, the loading time of the network model is reduced.
Preferably, the first residual layer, the second residual layer, and the third residual layer each include a plurality of residual blocks, wherein,
the number of residual blocks of the first residual layer is 2;
the number of residual blocks of the second residual layer is 3;
the number of residual blocks of the third residual layer is 2.
The beneficial effects of adopting the above technical scheme are: by introducing a residual block structure, the system performance is improved by using residual learning.
Preferably, the pooling areas of the first and second pooling layers are 2 x 2 in size and 2 in steps.
The beneficial effects of adopting the above technical scheme are: the dimensionality of the feature vector of the convolutional layer is reduced through pooling, the calculation speed is accelerated, and overfitting is prevented.
Preferably, the number of the neurons of the output layer is 2, and the output layer corresponds to two categories of wheat grains and impurities.
Preferably, the step S400 of optimizing the ResNet network model includes: and selecting an adaptive gradient descent method as an optimization algorithm of the ResNet network model to optimize the ResNet network model.
Preferably, the step S400 further includes: and training the training set according to the optimized ResNet network model, and updating the optimized ResNet network model in the training process.
According to the technical scheme, compared with the prior art, the wheat impurity image detection method based on the convolutional neural network is characterized in that a ResNet model for identifying wheat and impurities is established through a self-established wheat grain and impurity image database, the ResNet model is optimized, and the optimized ResNet model is high in identification precision and strong in real-time performance and is more suitable for being used as an actual application model for identifying the wheat impurities.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a flow chart of an image detection method for wheat impurity identification provided by the invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example 1
Referring to the attached drawing 1, the embodiment 1 of the invention discloses a wheat impurity image detection method based on a convolutional neural network, which comprises the following steps:
s100: collecting a wheat grain image containing impurities;
s200: preprocessing the collected wheat grain image containing impurities to construct a wheat grain and impurity image database;
s300: dividing data in a wheat grain and impurity image database into a training set and a test set;
s400: constructing a ResNet network model, and optimizing the ResNet network model to obtain an optimized ResNet network model;
s500: and testing the test set according to the optimized ResNet network model to obtain a test result.
Specifically, the process of collecting the wheat grain image containing the impurities in step S100 includes:
s110: setting and collecting background materials;
s120: collecting a wheat grain image containing impurities under a collection background;
in one embodiment, step S200 includes:
s210: converting the collected wheat grain image containing impurities into a gray scale image;
s220: converting the gray level image into a binary image after threshold segmentation;
s230: if the binary image has the multi-seed image, the multi-seed image is segmented into single-seed images;
s240: expanding the single grain image;
s250: and constructing a wheat grain and impurity image database after expansion.
Specifically, step S240 includes: and rotating the single grain image to construct a wheat grain and impurity image database.
Specifically, the rotation angles of the single-seed image can be randomly set.
In a specific embodiment, the ResNet network model constructed in step S400 includes sequentially connected: the video coding device comprises a first convolution layer, a first residual layer, a second residual layer, a third residual layer, a first pooling layer, a second pooling layer, a global average pooling layer, a full-link layer and an output layer.
In one embodiment, the first, second, and third residual layers each comprise a plurality of residual blocks, wherein,
the number of residual blocks of the first residual layer is 2;
the number of residual blocks of the second residual layer is 3;
the number of residual blocks of the third residual layer is 2.
More specifically, with the residual block structure, system performance is improved with residual learning.
In a specific embodiment, the pooling regions of the first, second, and third pooling layers are 2 x 2 in size, with a step size of 2.
More specifically, the dimensionality of the feature vectors of the convolutional layers is reduced through pooling, the calculation speed is increased, and overfitting is prevented.
In one embodiment, the number of neurons in the output layer is 2, corresponding to two categories of wheat grain and impurities.
In a specific embodiment, step S400 optimizes the ResNet network model, including: and selecting an adaptive gradient descent method as an optimization algorithm of the ResNet network model to optimize the ResNet network model.
Specifically, in the embodiment, the adaptive gradient descent method is selected as the optimization algorithm of the ResNet network model provided by the invention, the optimized network learning rate is 0.001, and the training precision and the training time index can be simultaneously met.
In a specific embodiment, step S400 further includes: and training the training set according to the optimized ResNet network model, and updating the optimized ResNet network model in the training process.
According to the technical scheme, compared with the prior art, the wheat impurity image detection method based on the convolutional neural network is characterized in that a ResNet model for identifying wheat and impurities is established through a self-established wheat grain and impurity image database, the ResNet model is optimized, and the optimized ResNet model is high in identification precision and strong in real-time performance and is more suitable for being used as an actual application model for identifying the wheat impurities.
Example 2
An example of a specific application of the detection method of embodiment 1 of the present invention is as follows:
(1) and (5) image acquisition.
In the embodiment, the detection of wheat grains and impurities is mainly targeted, and materials required by the test are from grain reserves of Xinglong national food reserves of Zhengzhou, Henan. Because the impurity identification difficulty is the greatest when the size and the shape of the impurity are similar to those of wheat grains, wheat husks similar to the size and the shape of the wheat grains are manually selected as test materials.
The image acquisition background is black light absorption flocking background cloth, and the acquisition equipment is a SONY camera (ILCE-7RM2 model, 4240 ten thousand effective pixels). The wheat grains and the impurities are randomly placed according to the distribution of 10 x 10, wherein 6000 grains are collected in the doped wheat grains.
(2) And (5) image preprocessing.
The image preprocessing comprises three parts, namely multi-grain segmentation, size unification and data expansion. Converting the acquired image into a gray-scale image, searching an optimal threshold value through a graythresh function, converting the gray-scale image into a binary image, and segmenting the multi-seed image into single-seed images by adopting a minimum external rectangle method; the single grain images obtained by the minimum external rectangle method are different in size, and the sizes of the single grain images are unified to be 32 multiplied by 32; because the collected image data are less, the images with unified sizes are rotated by 90 degrees in the left direction and 180 degrees in the left direction respectively. 18000 image sample sets are finally obtained, wherein each of the wheat grain images and the impurity images is 9000.
(3) And building a ResNet network model.
The ResNet network structure comprises 1 convolutional layer, 3 residual layers, 2 average pooling layers, 1 global average pooling layer and a full-connection layer. The convolution layer Conv0 has a convolution kernel size of 32 × 32. Since the dataset picture is small, the convolutional layer step size before input to the residual structure is set to 1 and the max pooling layer is not passed. The residual block numbers of the residual layers Conv0_ x, Conv1_ x, and Conv2_ x are 2, 3, and 2, respectively.
(4) And optimizing the ResNet network model.
And (3) optimizing and setting the learning rate of the ResNet network model: the ResNet network model learning rate is obtained by minimizing an objective function through a self-adaptive gradient descent algorithm. In general, training is attempted from a large learning rate, and the learning rate is selected to be 0.01, and the learning becomes unstable due to a large loss value of the objective function at this time, and the learning rate needs to be reduced. The learning rate is reduced to 0.0001, and the network training time is prolonged. Considering the real-time performance of wheat impurity detection, the network convergence is faster while minimizing the objective function by setting the learning rate to 0.001.
Training a ResNet network model: adopting the established wheat grain and impurity image database, selecting 7200 (80%) wheat grain images and impurity images as a training set, and 1800 (20%) images as a testing set. 14400 images in the training set are trained by using the optimized ResNet network model.
When the ResNet model optimized by the method is used for training the wheat grain and impurity image data set, the accuracy of the optimized ResNet network model tends to 1 when the iteration times reach about 35 times, and the loss approaches to 0.
(5) And testing the optimized ResNet network model.
A Tensorflow frame is used in the test, Python 3.6 is used as a programming language, and a wheat grain and impurity identification model is built on a Pycharm platform. The batch size for network training is set to 144 and the number of iterations (epoch) is set to 100. Model parameters were optimized using an adaptive gradient descent method, with the learning rate set to 0.001 and the momentum factor set to 0.9.
By adopting the wheat grain and impurity image database established by the invention, 7200 images (80%) of the wheat grain images and the impurity images are selected as a training set, 1800 images (20%) are selected as a test set, and the ResNet network model, the classic CNN network model and the VGGNet network model optimized by the invention are used for training.
As shown in table 1, for the performance comparison of different network models on the test set, the average recognition rates of the optimized ResNet network model, and the classical CNN network and VGGNet network models on the test set are 96.94%, 93.33% and 95.72%, respectively, and the recognition times are 5.60ms, 1.04ms and 5.30ms, respectively.
TABLE 1 comparison of Performance of three network models on test set
Figure BDA0003177721370000071
Compared with the classical CNN and VGGNet network models, the ResNet network model has the highest accuracy in wheat impurity image recognition. Meanwhile, the ResNet network model is increased in time consumption of wheat impurity recognition compared with the classical CNN network model, but only 4.56ms is increased, and the practical application of wheat impurity recognition image detection can still be met. Therefore, the overall performance of the ResNet network model constructed by the experiment is superior to that of the classical CNN and VGGNet network models.
Simulation analysis shows that the recognition performance of the ResNet network model is the best compared with the classical CNN and VGGNet network models, the recognition accuracy of a test set is 96.94%, and the recognition time is 5.60 ms. Therefore, the ResNet network model is more suitable for being used as a practical application model for wheat impurity identification.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (8)

1. A wheat impurity image detection method based on a convolutional neural network is characterized by comprising the following steps:
s100: collecting a wheat grain image containing impurities;
s200: preprocessing the collected wheat grain image containing impurities to construct a wheat grain and impurity image database;
s300: dividing data in the wheat grain and impurity image database into a training set and a test set;
s400: constructing a ResNet network model, and optimizing the ResNet network model to obtain an optimized ResNet network model;
s500: and testing the test set according to the optimized ResNet network model to obtain a test result.
2. The wheat impurity image detection method based on the convolutional neural network as claimed in claim 1, wherein said S200 comprises:
s210: converting the collected wheat grain image containing impurities into a gray scale image;
s220: converting the gray level image into a binary image after threshold segmentation;
s230: if the binary image has a plurality of seed images, segmenting the plurality of seed images into single seed images;
s240: expanding the single grain image;
s250: and constructing a wheat grain and impurity image database after expansion.
3. The method for detecting the wheat impurity image based on the convolutional neural network as claimed in claim 1, wherein the ResNet network model constructed in S400 comprises the following components connected in sequence: the video coding device comprises a first convolution layer, a first residual layer, a second residual layer, a third residual layer, a first pooling layer, a second pooling layer, a global average pooling layer, a full-link layer and an output layer.
4. The method of claim 3, wherein the first residual layer, the second residual layer and the third residual layer each comprise a plurality of residual blocks, wherein,
the number of residual blocks of the first residual layer is 2;
the number of residual blocks of the second residual layer is 3;
the number of residual blocks of the third residual layer is 2.
5. The wheat impurity image detection method based on the convolutional neural network as claimed in claim 3, wherein the pooling areas of the first pooling layer and the second pooling layer are 2 x 2 in size, and the step size is 2.
6. The method as claimed in claim 3, wherein the number of neurons in the output layer is 2, and the method corresponds to two categories of wheat grains and impurities.
7. The method for detecting wheat impurities image based on convolutional neural network of claim 1, wherein the S400 optimizes the ResNet network model, including: and selecting an adaptive gradient descent method as an optimization algorithm of the ResNet network model to optimize the ResNet network model.
8. The wheat impurity image detection method based on the convolutional neural network as claimed in claim 7, wherein said S400 further comprises: and training the training set according to the optimized ResNet network model, and updating the optimized ResNet network model in the training process.
CN202110837433.2A 2021-07-23 2021-07-23 Wheat impurity image detection method based on convolutional neural network Pending CN113469129A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110837433.2A CN113469129A (en) 2021-07-23 2021-07-23 Wheat impurity image detection method based on convolutional neural network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110837433.2A CN113469129A (en) 2021-07-23 2021-07-23 Wheat impurity image detection method based on convolutional neural network

Publications (1)

Publication Number Publication Date
CN113469129A true CN113469129A (en) 2021-10-01

Family

ID=77882127

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110837433.2A Pending CN113469129A (en) 2021-07-23 2021-07-23 Wheat impurity image detection method based on convolutional neural network

Country Status (1)

Country Link
CN (1) CN113469129A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114724005A (en) * 2022-03-25 2022-07-08 清华大学 Solid brewing granular raw material doping identification method based on deep neural network

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110991511A (en) * 2019-11-26 2020-04-10 中原工学院 Sunflower crop seed sorting method based on deep convolutional neural network

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110991511A (en) * 2019-11-26 2020-04-10 中原工学院 Sunflower crop seed sorting method based on deep convolutional neural network

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张博: ""基于深度学习的小麦外观品质机器视觉检测研究"", 《中国优秀博硕士学位论文全文数据库(硕士)·农业科技辑》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114724005A (en) * 2022-03-25 2022-07-08 清华大学 Solid brewing granular raw material doping identification method based on deep neural network

Similar Documents

Publication Publication Date Title
CN106228185B (en) A kind of general image classifying and identifying system neural network based and method
CN110021425B (en) Comparison detector, construction method thereof and cervical cancer cell detection method
WO2018052586A1 (en) Method and system for multi-scale cell image segmentation using multiple parallel convolutional neural networks
Sakib et al. Implementation of fruits recognition classifier using convolutional neural network algorithm for observation of accuracies for various hidden layers
CN111553240B (en) Corn disease condition grading method and system and computer equipment
CN111696101A (en) Light-weight solanaceae disease identification method based on SE-Inception
CN109033978B (en) Error correction strategy-based CNN-SVM hybrid model gesture recognition method
CN112633257A (en) Potato disease identification method based on improved convolutional neural network
CN112749675A (en) Potato disease identification method based on convolutional neural network
Luan et al. Sunflower seed sorting based on convolutional neural network
CN113469129A (en) Wheat impurity image detection method based on convolutional neural network
Balasubramaniyan et al. Color contour texture based peanut classification using deep spread spectral features classification model for assortment identification
CN111860601B (en) Method and device for predicting type of large fungi
CN115330759B (en) Method and device for calculating distance loss based on Hausdorff distance
CN111259913A (en) Cell spectral image classification method based on bag-of-word model and textural features
CN116258899A (en) Corn ear classification method based on custom light convolutional neural network
CN115909011A (en) Astronomical image automatic classification method based on improved SE-inclusion-v 3 network model
CN115393631A (en) Hyperspectral image classification method based on Bayesian layer graph convolution neural network
CN111178174B (en) Urine formed component image identification method based on deep convolutional neural network
CN114550164A (en) Tomato leaf disease identification research method based on deep learning
CN113780334A (en) High-dimensional data classification method based on two-stage mixed feature selection
CN113011506A (en) Texture image classification method based on depth re-fractal spectrum network
CN108304546B (en) Medical image retrieval method based on content similarity and Softmax classifier
Girdher et al. Detecting and Estimating Severity of Leaf Spot Disease in Golden Pothos using Hybrid Deep Learning Approach
CN116992944B (en) Image processing method and device based on leavable importance judging standard pruning

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

Application publication date: 20211001