CN115953352A - Peanut seed selection evaluation and classification method based on network model - Google Patents

Peanut seed selection evaluation and classification method based on network model Download PDF

Info

Publication number
CN115953352A
CN115953352A CN202211369888.7A CN202211369888A CN115953352A CN 115953352 A CN115953352 A CN 115953352A CN 202211369888 A CN202211369888 A CN 202211369888A CN 115953352 A CN115953352 A CN 115953352A
Authority
CN
China
Prior art keywords
peanut
seeds
image
network model
seed
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
CN202211369888.7A
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.)
Qingdao Agricultural University
Original Assignee
Qingdao Agricultural University
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 Qingdao Agricultural University filed Critical Qingdao Agricultural University
Priority to CN202211369888.7A priority Critical patent/CN115953352A/en
Publication of CN115953352A publication Critical patent/CN115953352A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Image Analysis (AREA)

Abstract

The invention discloses a peanut seed selection evaluation and grading method based on a network model. The scheme utilizes the convolutional neural network to be matched with the peanut selection process, so that the recognition rate of peanut seeds is effectively improved; the peanut seed grading method has the advantages that peanut seeds are subjected to image analysis, peanuts are selected and evaluated, peanut seed grading is obtained by combining the length-width ratio and the area ratio of the selected excellent seeds, peanuts with excellent quality are accurately selected, damaged seeds, shrunken seeds and diseased seeds are eliminated, and the reliability analysis of the yield and quality of peanut planting is realized.

Description

Peanut seed selection evaluation and classification method based on network model
Technical Field
The invention relates to the technical field of peanut seed selection and classification, in particular to a peanut seed selection and classification method based on deep learning and image processing.
Background
The peanuts are a crop which is rich in Chinese yield and wide in eating, are used as oil crops and economic crops, are rich in nutrients such as fat, protein, calcium, iron, phosphorus, vitamins and the like, are rich in nutrition, are export-induced foreign exchange agricultural products with strong international competitiveness, and can bring great benefits to the country.
At present, more impurities, small grains, broken grains, bad grains, insect grains and the like still exist after the peanut seeds are harvested, and the quality of the peanut seeds directly influences the yield and the quality of peanut planting. At present, peanut seed selection and classification are mainly realized by depending on a manual or mechanical design mode, but the selection and classification efficiency is low, the precision is poor, and accurate analysis of peanut seeds is difficult to realize.
The invention patent with publication number CN109675799A discloses a grading screening machine for fine processing of peanuts and a screening method thereof, which can realize the function of automatically grading and screening the peanuts through the design of a screening net rack, a rectangular through groove and the like, can accurately grade the peanuts, can separate the peanuts damaged into petals separately, can prevent the peanuts from blocking a screening plate, and has the advantages of good screening effect and the like.
In recent years, with the progress of technology, the deep learning technology is rapidly developed, the target detection algorithm is also switched to the detection technology based on the deep neural network from the traditional algorithm based on manual characteristics, and based on the target detection algorithm, the invention provides a peanut seed selection and classification method based on deep learning.
Disclosure of Invention
The invention provides a peanut seed selection and classification method based on deep learning and image processing, aiming at solving the defects of low efficiency and poor precision of manual classification and screening of peanut seeds in the prior art.
The invention is realized by adopting the following technical scheme: a peanut seed selection evaluation and grading method based on a network model comprises the following steps:
step A, constructing a network model and training the network model;
b, selecting and evaluating peanut seeds based on the trained network model;
b1, carefully selecting and counting various peanut seeds: acquiring an original image of peanut seeds, sequentially carrying out Gaussian filtering, binarization, overlooking expansion and contour detection processing to obtain a minimum circumscribed rectangle and a minimum circumscribed ellipse of the peanut seeds, and realizing the selection of the peanut seeds based on a trained network model;
step B2, peanut seed evaluation: determining the quantity of good peanut seeds, damaged peanut seeds, shriveled peanut seeds and diseased peanut seeds, and calculating the ratio of various types of peanut seeds to the total to realize the evaluation of the peanut seeds;
c, grading the well selected peanut seeds;
step C1, determining the occupied area S of a single peanut seed in an original image;
c2, calculating the length-width ratio n of the minimum circumscribed rectangle, wherein n is less than 1, and calculating the ratio of the area of the minimum circumscribed rectangle to the area of the minimum circumscribed ellipse as omega:
when S is more than or equal to a 1 And nxomega is more than or equal to 0.9 is an excellent seed, and the number of the seeds is recorded as O a
When a is 2 ≤S<a 1 And 0.9 > nxomega ≥ 0.8 is good seed, and the number is recorded as O b
When a is 3 ≤S<a 2 And 0.8 > nxomega ≧ 0.7 is the general seed and the number is recorded as O c
When S is less than a 3 And 0.7 > nxomega is unqualified seed and the number is recorded as O d
Wherein, a 1 、a 2 、a 3 The specific numerical value of the pixel point is different according to different peanut varieties.
Further, the step a is specifically realized by the following steps:
a1, constructing a data set and preprocessing the data set;
collecting images of four types of quality seeds including good peanut seeds, damaged seeds, shrunken seeds and disease seeds in different varieties of peanut seeds, performing noise reduction and white balance adjustment, multiplying each pixel value of the images by 1/255 to enable each numerical value to be between 0 and 1, obtaining a data set, and dividing the data set into a training set, a verification set and a test set; then, preprocessing the data set by adopting rotation, translation, scaling and overturning;
a2, constructing a network model and training the network model;
the network model main body adopts MobileNet V2, the network model structure comprises a convolution layer, a bottleneck layer and an average pooling layer, in order to improve the accuracy of the trained model, a Dropout regularization layer is added at the last of the network model, the Dropout value is preset to be 0.5, and the output layer is a full connection layer; during training, the depth parameter, the width parameter and the resolution parameter of the network model are subjected to fusion adjustment through a grid search method, so that the network model achieves the optimal generalization effect;
step A3, testing a network model;
after the training is finished, testing the mode model, and analyzing a test result by selecting a confusion matrix; and after the model is tested without errors, the model is stored and is subjected to quantification operation.
Further, in the step B, when the peanut image is cropped to a required size, the central coordinates (x, y) of the minimum circumscribed ellipse are obtained through the cv2 function, and in order to avoid cropping peanut seeds in the image, the positions of the central coordinates x, y in the image are determined during cropping, and the original image is cropped according to the central coordinates and the required size.
Further, the step B1 is specifically implemented by the following steps:
(1) Collecting an original image of peanut seeds: extracting a frame of picture from a video stream, wherein an image captured by a camera is an RGB channel;
(2) Gaussian filtering: converting the color space of the image into HSV, separating H, S and V channels, and performing Gaussian filtering on the H channel to remove noise in the image;
(3) Binarization: carrying out binarization processing on the filtered image by adopting an OTSU threshold method, wherein peanut seeds in the processed image are white, and the background is black;
(4) Corrosion expansion: in order to eliminate the interference of the white spots of the binarized image on the detection of the contour of the peanut seed region, the binarized image is respectively subjected to morphological processing of multiple corrosion and expansion;
(5) Contour detection: acquiring an external rectangle and an external rectangle of the peanut seeds through a contour detector, screening the areas of the external rectangle and the external rectangle to acquire a minimum external rectangle and a minimum external ellipse, and then cutting the peanut image into required sizes;
(6) Peanut seed selection: inputting the cut peanut seeds into a trained network model, extracting characteristics through each layer of convolution layer, abstracting the image, and selecting good peanut seeds, damaged peanut seeds, shriveled peanut seeds and diseased peanut seeds.
Further, in the step B1, when the peanut seeds are selected, the judgment is performed according to the following characteristics:
good peanut seeds are characterized by abstraction: the pixel values of the peanut image area are normal and uniform, and the edge detection result is close to an ellipse;
the damaged peanut seeds are characterized by abstraction: the pixel value of the peanut image area presents two numerical values and the numerical value difference is obvious, and the image obtained by edge detection is not an ellipse or an obvious edge detected in the ellipse;
the dry and flat peanut seeds are characterized by abstraction: the fluctuation of the pixel value of the peanut image area is obvious, and besides the elliptic edge, a large number of stripe edges appear in the elliptic part of the image obtained by edge detection;
the disease seed sample is characterized by being abstracted: the difference between the pixel value of the peanut image area and the normal value is large, the state that the pixel value of the area is unbalanced is presented, and the irregular edge is detected in the ellipse except the edge of the ellipse of the image obtained by edge detection.
Further, in the step C1, when determining the area occupied by the single peanut seed in the image, the following method is adopted:
calculating the number of white pixel points in the minimum external ellipse in the binarized image, and recording as S1; then, filtering the original peanut seed image again, and then carrying out simple threshold processing binarization to ensure that the peanut image is black except the damaged peanut seed coat, calculating the pixel point of the white area in the minimum external ellipse and recording the pixel point as S 2 If the seed coat of peanut is not damaged, S 2 =0, single peanut seed occupies S = S in the image 1 +S 2
Compared with the prior art, the invention has the advantages and positive effects that:
the scheme utilizes the convolutional neural network to be matched with the peanut selection process, so that the recognition rate of peanut seeds is effectively improved; by carrying out image analysis on peanut seeds, selecting and evaluating peanuts, and obtaining peanut seed grading by combining the length-width ratio and the area ratio of selected good seeds. The method can accurately select the peanuts with excellent quality, eliminate damaged seeds, shrunken seeds and diseased seeds, and realize the reliability analysis of the yield and quality of the peanut planting.
Drawings
FIG. 1 is a schematic diagram of a method for selecting and grading peanut seeds according to an embodiment of the present invention;
FIG. 2 is a schematic diagram illustrating a schematic flow chart of an embodiment of image processing on video frames;
FIG. 3 is a schematic diagram of a neural network structure and additional network layers according to an embodiment of the present invention;
FIG. 4 is a schematic view of image processing of an acquired peanut seed image according to an embodiment of the present invention;
FIG. 5 is a diagram of a histogram of gray scales obtained by processing an image according to an embodiment of the present invention.
Detailed Description
In order to make the above objects, features and advantages of the present invention more clearly understood, the present invention will be further described with reference to the accompanying drawings and examples. In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced otherwise than as described herein, and thus, the present invention is not limited to the specific embodiments disclosed below.
The embodiment discloses a peanut seed selection and classification method, which comprises the following steps:
step A, constructing a network model and training the network model;
b, selecting and evaluating peanut seeds based on the trained network model, and selecting good peanut seeds, damaged peanut seeds, shrivelled peanut seeds and diseased peanut seeds;
and C, grading the well selected peanut seeds.
The following detailed description of the embodiments of the present invention is provided:
1. constructing a network model and training the network model:
(1) Constructing a data set:
collecting image samples of good peanut seeds, damaged seeds, shrunken seeds and diseased seeds in different peanut seeds as an initial data set, carrying out noise reduction and white balance adjustment on the collected image samples, and multiplying each pixel value of an image by 1/255 to enable each value to be between 0 and 1 so as to obtain a preprocessed image data set; the data set is divided into a training set, a verification set and a test set, the corresponding proportion is 8.
Then preprocessing is carried out on the image, a zooming layer (caching) is added firstly by preprocessing, the image is normalized, and a second preprocessing layer random rotation layer (random rotation), a third preprocessing layer random translation layer (random translation), a fourth preprocessing layer random zoom layer (random zoom) and a sixth preprocessing layer random inversion layer (random flip) are arranged in the image. To prevent I/O blocking, images are loaded from disk using buffered prefetching.
(2) Constructing a network model and training the network model:
when a model is constructed, a lightweight model mobilene _ v2_050 \, wherein a network structure is shown in fig. 3, wherein 1 is a network layer used for migration learning, 2 is a network layer self-constructed for improving the model training effect, a network model backbone adopts mobilenetV2, a network model structure comprises a convolution layer, a bottleneck layer and an average pooling layer, in order to improve the accuracy of the trained model, a Dropout regular layer is added at the last of the network model, the Dropout value is preset to be 0.5, and an output layer is a full connection layer. And acquiring a pre-training model by using a tensoflow _ hub module, and performing fusion adjustment on a depth parameter d, a width parameter w and a resolution parameter r of the network by using a grid search method to enable the model to achieve an optimal generalization effect.
Adding a self-building layer to the pre-training model: dropout regularization layer, the fully connected output layer modifies the output neuron to 4. Dropout regularization is utilized to avoid model training overfitting, the Dropout rate is set to be 0.5, the output categories of the full connection layer are 4 categories, namely good peanut seeds, damaged seeds, shriveled seeds and disease seeds, and finally the probabilities of the four categories of seeds are obtained through processing and output of a softmax function.
And (3) training the network model according to the constructed data set, wherein the input _ shape value of the input layer is (224, 3), namely the RGB image with the size of 224 × 224. The network backbone uses MobileNetV2 to load the weight of the pre-trained mobilenet _ v2_050_224. After the mobilenetV2 backbone network is constructed, dropout regularization processing is adopted in the embodiment to reduce the dependence on weight and achieve the effect of reducing overfitting. The regularization processing is only applied to a model training link, and each neuron is required to be used in a testing link. Finally, an output layer is added, the output of the output layer is related to the picture types needing to be distinguished, and a normalized exponential function softmax activating function is used, the output of a plurality of neurons is mapped into a (0, 1) interval and can be understood as probability, and therefore multi-classification is carried out.
Assuming that there is an array V, and Vi represents the ith element in V, the softmax value of this element is:
Figure BDA0003924500490000051
(3) Testing a network model:
after training is completed, the model needs to be tested, and a confusion matrix is selected for analyzing a test result. After the model is tested, the model is stored and is subjected to quantization operation, 32-bit floating point numbers are converted into 8-bit integers, the size of the model is reduced, and the image classification speed is increased. Because a model trained by the neural network has a large number of parameters, and the embedded Linux equipment cannot be used for smoothly reasoning, a quantization compression parameter is selected, and the quantization principle is as follows:
the formula for floating Point to fixed Point conversion is as follows, where R represents the input floating Point data, Q represents the fixed Point data after quantization, Z represents the value of Zero Point, and S represents the value of Scale:
Figure BDA0003924500490000052
the formula for fixed point to floating point conversion is as follows:
R=(Q-Z)×S
the following equations can be used to solve S and Z:
Figure BDA0003924500490000053
Z=Q max -R max ×S
wherein R is max Representing the maximum value, R, in the input floating-point data min Representing the minimum value, Q, in the input floating-point data max Representing the maximum fixed point value, Q min Representing the minimum fixed point value.
The representable range of fixed point quantization per channel or per tensor weight by int8 is [ -127, 127], and zero-point is the quantization value 0; the representable range of the activation or input values per tensor, which are fixed-point quantized with int8, is [ -128, 127], whose zero-point is formulated within [ -128, 127 ].
After quantification, a TensorFlow Lite model file is obtained by utilizing TensorFlow Lite conversion, and the TensorFlow Lite model file can be deployed into embedded Linux equipment for practical application after being tested without errors.
2. Peanut seed selection and evaluation
1. Carefully selecting and counting the number of samples of various peanut seeds, which specifically comprises the following steps:
1) Obtaining an original image sample; continuously shooting videos by using a high-speed camera, and extracting a frame of picture from a video stream when peanuts pass under a camera, wherein the image captured by the camera is an RGB channel;
2) Gaussian filtering; converting the image color space into HSV (hue, saturation, value) by utilizing OpenCV (open cell vision technology), and then separating H, S and V channels;
in order to reduce image noise and store image information as good as possible, the image needs to be filtered, and the H channel needs to be gaussian filtered to remove noise in the image, where gaussian filtering is to convolve the image with a gaussian kernel, and the gaussian kernel is defined as:
Figure BDA0003924500490000061
where G is a two-dimensional Gaussian kernel with a standard deviation of σ.
3) Binaryzation; in order to better separate the peanut seeds from the background, the picture of the peanut seeds needs to be subjected to binarization treatment;
taking the H-channel picture after gaussian filtering as input, calculating a picture gray level histogram, as shown in fig. 5, knowing that the H-channel picture to be binarized is a double-peak picture through the gray level histogram, because the H-channel picture to be binarized is a double-peak picture, this embodiment performs binarization processing on the image by using an OTSU threshold method, the peanut seeds in the processed picture are white, and the background is black.
4) Corrosion expansion; in order to eliminate the interference of the white spots of the image after binarization processing on the contour detection of the peanut seed region, the image is respectively subjected to morphological processing of multiple corrosion and expansion;
5) Detecting the contour; inputting the processed picture into a contour detector, acquiring the circumscribed ellipse and the circumscribed rectangle of the peanut seed through the contour detector, and acquiring the minimum circumscribed rectangle and the minimum circumscribed ellipse through screening the circumscribed rectangle and the ellipse;
then, cutting the original image into a required size, and firstly obtaining the center coordinate of the minimum circumscribed ellipse, wherein the following operations are performed to avoid damaging peanut seed information after obtaining the cut picture:
obtaining the central coordinates (x, y) of the minimum external ellipse through a cv2 function, further, in order to avoid cutting peanut seeds in an image, the positions of the central coordinates x and y in the image need to be judged during cutting, for example, when 360 × 360 size images need to be cut, wherein the original image of the shot peanut seed sample is set to be 640 × 360 (pixels), the transverse value of the central coordinates of the peanut seeds is x, the longitudinal value is y, the dereferencing range of x is [0,640], the dereferencing range of y is [0,360], when x is smaller than 180, the image is cut to obtain the pixels of the original image in the range of 0 to 360 in the transverse direction, and all range pixels are obtained in the longitudinal direction;
when the transverse coordinate value x of the peanut seeds is larger than 180 and smaller than 460, cutting the picture to obtain pixels in the range from x-180 to x +180 on the x axis of the original image, wherein the y axis obtains the whole range;
when the horizontal coordinate value x of the peanut seeds is larger than 460, cutting the picture to obtain pixels in the range of 280-640 on the x axis of the original image, wherein the y axis obtains the whole range; and then scaled to 224 × 224 size to obtain a picture in a specified format, and then the picture is saved.
6) Peanut seed selection:
the peanut picture total sample after will handling passes into above-mentioned well-trained improved generation MobileNet V2 network, draws the characteristic through each layer convolution layer, abstracts the picture, confirms good peanut seed, damaged peanut seed, shrivelled peanut seed and disease peanut seed, wherein:
good peanut seeds are characterized by abstraction: the pixel values of the peanut image area are normal and uniform without large fluctuation, and the edge detection result is close to an ellipse;
the damaged peanut seeds are characterized by abstraction: the pixel value of the peanut image area presents two values and the difference of the values is obvious, and the image obtained by edge detection is not an ellipse or an obvious edge is detected in the ellipse;
the dry and flat peanut seeds are characterized by abstraction: the fluctuation of the pixel value of the peanut image area is obvious, and besides the elliptic edge, a large number of stripe edges appear in the elliptic part of the image obtained by edge detection;
the disease seed sample is characterized by being abstracted: the difference between the pixel value of the peanut image area and the normal value is large, the state of unbalanced area pixel value can be presented, and irregular edges are detected in the ellipse except the edge of the ellipse of the image obtained by edge detection.
2. Peanut seed evaluation:
recording the quantity of good peanut seeds, damaged peanut seeds, shriveled peanut seeds and disease peanut seeds as U a ,U b ,U c ,U d The total number of samples is U; the above number U a ,U b ,U c ,U d Dividing the total number of samples by U to obtain the proportion of each peanut seed, and taking the corresponding record as P ua The breakage rate is P ub Dry and shrivelledA rate of P uc The disease rate is P ud . And the evaluation on the peanut seeds is realized.
3. Grading peanut seeds;
(1) Calculating the occupied area of a single peanut seed in the original image;
good peanut seeds are reserved after the selection step, the occupied area of a single peanut seed in the image is further calculated and recorded as S according to the image processing result, and the peanut seed in the image is not in a completely regular ellipse shape, so that the data is inaccurate due to the fact that the minimum circumscribed ellipse area is directly adopted. This example was calculated by the following method: firstly, calculating the binary image, namely the binary corresponding image in fig. 4, and recording the number of white pixel points in the minimum ellipse as S 1 (ii) a Further, filtering is carried out on the original peanut seed picture, namely the original picture in the picture 4 again, then binaryzation is carried out through simple threshold processing, so that the parts of the peanut picture except the damaged part of the peanut seed coat, which is white, are black, and the pixel points in the white area in the minimum external ellipse are calculated and recorded as S 2 If the seed coat of peanut is not damaged, S 2 =0, total area S = S 1 +S 2
(2) Calculating a minimum circumscribed rectangle;
calculating the length-width ratio of the minimum circumscribed rectangle as n (the length in width ratio), wherein n is less than 1, and calculating the ratio of the area of the minimum circumscribed rectangle to the area of the minimum circumscribed ellipse as omega;
when S is more than or equal to a 1 And nxomega is more than or equal to 0.9 is an excellent seed, and the number of the seeds is recorded as O a
When a is 2 ≤S<a 1 And 0.9 > nxomega ≥ 0.8 is good seed, and the number is recorded as O b
When a is 3 ≤S<a 2 And 0.8 > nxomega ≥ 0.7 is common seed and the number is recorded as O c
When S is less than a 3 And 0.7 > nxomega is unqualified seed and the number is recorded as O d
A above 1 、a 2 、a 3 Specific numerical values of pixel points, numerical values of different peanut varietiesIn contrast, consider the example of Huayu No. 22 a 1 =40000、a 2 =30000、a 3 =20000, number of samples O after classification a ,O b ,O c ,O d Divided by the total number of samples U, respectively a Obtaining the ratio of each sample as P oa ,P ob ,P oc ,P od And obtaining the fullness grade of the peanut seed sample with good output.
In addition, for a, briefly described 1 、a 2 、a 3 The specific evaluation of the pixel point values adopts the following mode:
(1) Calibrating; after the camera is arranged, vertically shooting a small ball with a known radius R by using the camera, wherein the small ball is in a regular circle shape in the picture, and the area of the circle in the picture is calculated and recorded as S Round (T-shaped) The maximum circle area of the actual pellet is recorded as S Ball (ball) =πR 2 Obtaining the ratio of the maximum circle area of the circle and the ball in the picture
Figure BDA0003924500490000081
(2) A large amount of peanuts of the same variety pass through the right lower part of the camera to obtain the area S of a single peanut seed in the image Flower (A. B. A. B. A And the actual peanut area is S Flower (A. B. A. B. A Xk, recording all areas of the batch of peanuts, drawing a chart according to the quantity-area, and finding that the size distribution of the same variety of peanut seeds is normal distribution according to multiple experiments;
(3) It is assumed that 34.1% of the area on both sides of μ in a normal distribution is medium size peanuts, that outside the right 34.1% and to the right is larger peanut seeds, and that outside the left 34.1% and to the left is smaller peanut seeds.
The above description is only a preferred embodiment of the present invention, and not intended to limit the present invention in other forms, and any person skilled in the art may apply the above modifications or changes to the equivalent embodiments with equivalent changes, without departing from the technical spirit of the present invention, and any simple modification, equivalent change and change made to the above embodiments according to the technical spirit of the present invention still belong to the protection scope of the technical spirit of the present invention.

Claims (6)

1. The peanut seed selection evaluation and classification method based on the network model is characterized by comprising the following steps of:
step A, constructing a network model and training the network model;
b, selecting and evaluating peanut seeds based on the trained network model;
step B1, selecting and counting various peanut seeds: acquiring an original image of peanut seeds, sequentially performing Gaussian filtering, binaryzation, overlooking expansion and contour detection to obtain a minimum circumscribed rectangle and a minimum circumscribed ellipse of the peanut seeds, and realizing the selection of the peanut seeds based on a trained network model;
step B2, peanut seed evaluation: determining the quantity of good peanut seeds, damaged peanut seeds, shriveled peanut seeds and diseased peanut seeds, and calculating the ratio of various types of peanut seeds to the total to realize the evaluation of the peanut seeds;
c, grading the well selected peanut seeds;
step C1, determining the occupied area S of a single peanut seed in an original image;
and C2, calculating the length-width ratio n of the minimum circumscribed rectangle, wherein n is less than 1, and calculating the ratio of the area of the minimum circumscribed rectangle to the area of the minimum circumscribed ellipse as omega:
when S is more than or equal to a 1 And nxomega is more than or equal to 0.9 is an excellent seed, and the number of the seeds is recorded as O a
When a is 2 ≤S<a 1 And 0.9>Good seeds are obtained when nxomega is more than or equal to 0.8, and the number of the seeds is recorded as O b
When a is 3 ≤S<a 2 And 0.8>The general seed is nxomega ≥ 0.7, and the number is recorded as O c ,
When S is less than a 3 And 0.7>n x omega is a non-conforming seed and the number is recorded as O d
Wherein, a 1 、a 2 、a 3 For a particular value of a pixel point, according to the flowerThe breeds vary.
2. The network model-based peanut seed concentration evaluation and grading method according to claim 1, wherein said step a is specifically realized by:
a1, constructing a data set and preprocessing the data set;
collecting images of four types of quality seeds including good peanut seeds, damaged seeds, shrunken seeds and disease seeds in different varieties of peanut seeds, performing noise reduction and white balance adjustment, multiplying each pixel value of the images by 1/255 to enable each numerical value to be between 0 and 1, obtaining a data set, and dividing the data set into a training set, a verification set and a test set; then, preprocessing the data set by adopting rotation, translation, scaling and overturning;
a2, constructing a network model and training the network model;
the network model main body adopts MobileNet V2, the network model structure comprises a convolution layer, a bottleneck layer and an average pooling layer, a Dropout regularization layer is added at the last of the network model, the Dropout value is preset to be 0.5, and the output layer is a full connection layer; during training, the depth parameter, the width parameter and the resolution parameter of the network model are subjected to fusion adjustment through a grid search method, so that the network model achieves the optimal generalization effect;
step A3, testing a network model;
after the training is finished, testing the mode model, and analyzing a test result by selecting a confusion matrix; and after the model is tested to be correct, storing the model and carrying out quantification operation on the model.
3. The method for peanut seed concentration evaluation and grading based on network model of claim 1, wherein in the step B, when the peanut image is cropped to a required size, the central coordinates (x, y) of the minimum circumscribed ellipse are obtained by cv2 function, and the original image is cropped according to the central coordinates and the required size.
4. The network model-based peanut seed concentration evaluation and grading method according to claim 1, wherein said step B1 is specifically realized by:
(1) Collecting an original image of peanut seeds: extracting a frame of picture from a video stream, wherein an image captured by a camera is an RGB channel;
(2) Gaussian filtering: converting the image color space into HSV, then separating H, S and V channels, and carrying out Gaussian filtering on the H channel to remove noise in the image;
(3) Binarization: carrying out binarization processing on the filtered image by adopting an OTSU threshold method, wherein peanut seeds in the processed image are white, and the background is black;
(4) Corrosion expansion: performing morphological processing of multiple corrosion and expansion on the binarized image respectively;
(5) Contour detection: acquiring an external rectangle and an external rectangle of the peanut seeds through a contour detector, screening the areas of the external rectangle and the external rectangle to acquire a minimum external rectangle and a minimum external ellipse, and then cutting the peanut image into required sizes;
(6) Peanut seed selection: inputting the cut peanut seeds into a trained network model, extracting features through each layer of convolution layer, abstracting the image, and selecting good peanut seeds, damaged peanut seeds, shriveled peanut seeds and diseased peanut seeds.
5. The method for evaluating and grading peanut seed selection based on network model of claim 4, wherein in step B1, the peanut seeds are selected according to the following characteristics:
good peanut seeds are characterized by abstraction: the pixel values of the peanut image area are normal and uniform, and the edge detection result is close to an ellipse;
the damaged peanut seeds are characterized by abstraction: the pixel value of the peanut image area presents two numerical values and the numerical value difference is obvious, and the image obtained by edge detection is not an ellipse or an obvious edge detected in the ellipse;
the dry and flat peanut seeds are characterized by abstraction: the fluctuation of the pixel value of the peanut image area is obvious, and besides the elliptic edge, a large number of stripe edges appear in the elliptic part of the image obtained by edge detection;
the disease seed sample is characterized by being abstracted: the difference between the pixel value of the peanut image area and the normal value is large, the state that the pixel value of the area is unbalanced is presented, and the irregular edge is detected in the ellipse except the edge of the ellipse of the image obtained by edge detection.
6. The method for peanut seed concentration evaluation and grading based on network model of claim 1, wherein in step C1, when determining the area of the single peanut seed in the image, the following is adopted:
calculating the number of white pixel points in the minimum external ellipse in the binarized image, and recording as S1; then, filtering the original peanut seed image again, and then carrying out simple threshold processing binarization to ensure that the peanut image is black except the damaged peanut seed coat, calculating the pixel point of the white area in the minimum external ellipse and recording the pixel point as S 2 If the seed coat of peanut is not damaged, S 2 =0, individual peanut seed occupies an area S = S in the image 1 +S 2
CN202211369888.7A 2022-11-03 2022-11-03 Peanut seed selection evaluation and classification method based on network model Pending CN115953352A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211369888.7A CN115953352A (en) 2022-11-03 2022-11-03 Peanut seed selection evaluation and classification method based on network model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211369888.7A CN115953352A (en) 2022-11-03 2022-11-03 Peanut seed selection evaluation and classification method based on network model

Publications (1)

Publication Number Publication Date
CN115953352A true CN115953352A (en) 2023-04-11

Family

ID=87281293

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211369888.7A Pending CN115953352A (en) 2022-11-03 2022-11-03 Peanut seed selection evaluation and classification method based on network model

Country Status (1)

Country Link
CN (1) CN115953352A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116758024A (en) * 2023-06-13 2023-09-15 山东省农业科学院 Peanut seed direction identification method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116758024A (en) * 2023-06-13 2023-09-15 山东省农业科学院 Peanut seed direction identification method
CN116758024B (en) * 2023-06-13 2024-02-23 山东省农业科学院 Peanut seed direction identification method

Similar Documents

Publication Publication Date Title
CN111814867A (en) Defect detection model training method, defect detection method and related device
CN109447945B (en) Quick counting method for basic wheat seedlings based on machine vision and graphic processing
CN110991511A (en) Sunflower crop seed sorting method based on deep convolutional neural network
CN111553240B (en) Corn disease condition grading method and system and computer equipment
CN113222959B (en) Fresh jujube wormhole detection method based on hyperspectral image convolutional neural network
CN115512232B (en) Crop seed germination condition identification model, construction method and application thereof
CN111340019A (en) Grain bin pest detection method based on Faster R-CNN
CN108664839A (en) A kind of image processing method and equipment
CN111797760A (en) Improved crop pest and disease identification method based on Retianet
Lin et al. Determination of the varieties of rice kernels based on machine vision and deep learning technology
CN115953352A (en) Peanut seed selection evaluation and classification method based on network model
CN113420614A (en) Method for identifying mildewed peanuts by using near-infrared hyperspectral images based on deep learning algorithm
CN116682106A (en) Deep learning-based intelligent detection method and device for diaphorina citri
CN108765448B (en) Shrimp larvae counting analysis method based on improved TV-L1 model
CN116246174B (en) Sweet potato variety identification method based on image processing
CN116245855B (en) Crop variety identification method, device, equipment and storage medium
CN112184627A (en) Citrus fresh-keeping quality detection method based on image processing and neural network and application
CN116703932A (en) CBAM-HRNet model wheat spike grain segmentation and counting method based on convolution attention mechanism
CN112132137A (en) FCN-SPP-Focal Net-based method for identifying correct direction of abstract picture image
CN116071592A (en) Corn seed variety identification method and system based on hyperspectral incremental updating
CN114821098A (en) High-speed pavement damage detection algorithm based on gray gradient fusion characteristics and CNN
CN114612415A (en) Surface defect classification method based on depth residual error network and multi-channel image fusion
Rony et al. BottleNet18: Deep Learning-Based Bottle Gourd Leaf Disease Classification
CN113657294A (en) Crop disease and insect pest detection method and system based on computer vision
CN113269251A (en) Fruit flaw classification method and device based on machine vision and deep learning fusion, storage medium and computer equipment

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