Method for detecting empty-shell walnuts

文档序号:1844494 发布日期:2021-11-16 浏览:41次 中文

阅读说明:本技术 一种检测空壳核桃的方法 (Method for detecting empty-shell walnuts ) 是由 彭丹 毕艳兰 刘亚丽 陈竞男 杨嘉盛 于 2021-08-12 设计创作,主要内容包括:本发明涉及一种检测空壳核桃的方法,包括如下步骤:1)采集被检测核桃的近红外光谱;2)将采集的近红外光谱输入空壳核桃检测模型,得到核桃空壳与否的检测结果;空壳核桃检测模型利用训练集训练得到,训练集包括若干组空壳核桃及其对应的近红外光谱,和若干组实仁核桃及其对应的近红外光谱。本发明采用近红外光谱技术对核桃空壳率进行检测研究,提高了空壳核桃检测的准确度和检测速度,为无损检测空壳核桃提供了技术支持。(The invention relates to a method for detecting empty walnuts, which comprises the following steps: 1) collecting the near infrared spectrum of the detected walnut; 2) inputting the collected near infrared spectrum into a detection model of the empty walnut to obtain a detection result of whether the walnut is empty or not; the empty shell walnut detection model is obtained by training by utilizing a training set, wherein the training set comprises a plurality of groups of empty shell walnuts and corresponding near infrared spectrums thereof, and a plurality of groups of real kernel walnuts and corresponding near infrared spectrums thereof. The invention adopts the near infrared spectrum technology to carry out detection research on the empty shell rate of the walnut, improves the detection accuracy and the detection speed of the empty shell walnut and provides technical support for nondestructive detection of the empty shell walnut.)

1. A method for detecting empty walnuts is characterized by comprising the following steps:

1) collecting the near infrared spectrum of the detected walnut;

2) inputting the collected near infrared spectrum into a detection model of the empty walnut to obtain a detection result of whether the walnut is empty or not;

the empty-shell walnut detection model is obtained by training with a training set, wherein the training set comprises a plurality of groups of empty-shell walnuts and corresponding near infrared spectrums thereof, and a plurality of groups of real-kernel walnuts and corresponding near infrared spectrums thereof.

2. A method of detecting empty walnuts according to claim 1, wherein said empty walnut detection model is a SVM model or a LDA model.

3. A method for detecting empty-shelled walnuts according to claim 2, characterized in that said empty-shelled walnut detection model is an SVM model, and RBFs are used as kernel functions in the SVM modeling process.

4. The method for detecting empty-shelled walnuts according to claim 3, wherein RBF parameters are determined by a grid search method, and the combination of kernel function and penalty coefficient in the SVM model is obtained as follows: kernel function of 1.93X 10-2Penalty factor of 2.68 × 105

5. The method for detecting empty walnuts according to claim 2, wherein said empty walnut detection model is an LDA model, and Linear is adopted as a discriminant function.

6. The method for detecting empty-shelled walnuts according to claim 5, wherein the near infrared spectrum is obtained by irradiating the walnut belly with near infrared light.

7. The method for detecting empty-shelled walnuts according to claim 6, further comprising a pre-treatment of the acquired near infrared spectrum, said pre-treatment method comprising at least one of the following treatments: normalization algorithm processing, first-order derivation processing, multivariate scattering correction processing, normal variable transformation processing, polynomial convolution smoothing processing and detrending processing.

8. The method for detecting empty walnuts according to claim 7, wherein said near infrared spectrum has a wavelength band of 780nm-1100 nm.

9. The method for detecting empty-shelled walnuts according to claim 8, wherein the collected near infrared spectrum is preprocessed by normal variable transformation.

10. A method of detecting empty walnuts, according to claim 9, further comprising the step of calculating an empty shell rate:

determining the detection result of whether all detected walnuts are empty according to the methods of the steps 1) to 2) so as to determine the number of empty-shell fruits of the empty-shell walnuts; and calculating the ratio of the number of empty-shell fruits to the number of the co-measured fruits to obtain the empty-shell rate.

Technical Field

The invention relates to a method for detecting empty-shell walnuts, and belongs to the field of agricultural planting.

Background

The planting area and the yield of walnuts in China are in the forefront of the world, and the kernel state in the walnuts can directly influence the selling price of the walnuts, so that the empty shell rate of the walnuts becomes a necessary inspection index in the walnut purchasing process and is also an important basis for assessing the grade of the walnuts.

At present, the walnut shell ratio detection method is mainly a gravimetric analysis method, as shown in the weight comparison of the real walnut and the empty walnut in table 1, the weight ranges of the real walnut and the empty walnut are 5.23-11.60 g and 2.61-7.50 g, the average weight of the real walnut is about 1.5 times of that of the empty walnut, and the two types of walnuts overlap each other within the weight range of 5.23-7.50 g.

TABLE 1 comparison of the weight of real and empty walnuts

Type (B) Amount of sample Range/g Average value/g Standard deviation/g
Fruit kernel 100 5.23~11.60 7.26 1.34
Hollow shell 100 2.61~7.50 4.84 1.16

If the upper limit value of the weight of the empty-shell walnut is 7.50g, although the discrimination accuracy of the empty-shell walnut is 100%, 68% of the full-kernel walnut is judged as the empty-shell walnut; when the lower limit value of the weight of the real kernel walnut is 5.23g, the discrimination accuracy of the empty shell walnut is only 66%, and as shown in the weight difference diagram of different varieties of walnuts in figure 1, the weight ranges of the real kernel walnuts of different varieties have certain difference. In addition, the storage time also has an influence on the weight of the full-kernel walnuts, which may be related to the change of the moisture content in the walnuts. As shown in the weight difference chart before and after storage of different types of walnuts in fig. 2, the storage time is reduced to reduce the weight of the real walnut, and the discrimination accuracy of the empty walnut is further reduced based on the lower limit value of the weight range. Therefore, the gravimetric method cannot accurately distinguish the empty shell condition in the walnut. Besides the detection method, there are also manual detection, classification equipment method, X-ray method, etc., and there are problems of high misjudgment rate, long detection time, etc.

Disclosure of Invention

The invention aims to provide a method for detecting empty walnuts, which is used for solving the problems of high misjudgment rate and long detection time.

The invention relates to a method for detecting empty-shell walnuts, which comprises the following steps:

1) collecting the near infrared spectrum of the detected walnut;

2) inputting the collected near infrared spectrum into a detection model of the empty walnut to obtain a detection result of whether the walnut is empty or not;

the empty shell walnut detection model is obtained by training by utilizing a training set, wherein the training set comprises a plurality of groups of empty shell walnuts and corresponding near infrared spectrums thereof, and a plurality of groups of real kernel walnuts and corresponding near infrared spectrums thereof.

The beneficial effects of doing so are: the invention adopts the near infrared spectrum technology to carry out detection research on the empty shell rate of the walnut, improves the accuracy and speed of detection of the empty shell walnut and provides technical support for nondestructive detection of the empty shell walnut.

Further, the empty-shell walnut detection model is an SVM model or an LDA model.

Furthermore, the empty-shell walnut detection model is an SVM model, and RBF is used as a kernel function in the SVM modeling process.

Further, determining RBF parameters by adopting a grid search method, and obtaining the combination of kernel functions and penalty coefficients in the SVM model as follows: kernel function of 1.93X 10-2Penalty factor of 2.68 × 105

Furthermore, the empty walnut detection model is an LDA model, and Linear is used as a discrimination function.

Further, the near infrared spectrum is obtained by irradiating the walnut belly with near infrared light.

The beneficial effects of doing so are: the walnut tripe is selected as the optimal near infrared spectrum detection position, so that the root mean square error of data is reduced, the repeatability and the stability of the near infrared spectrum are improved, and the signal to noise ratio of the near infrared spectrum is also improved.

Further, the method comprises the following steps of preprocessing the collected near infrared spectrum: normalization algorithm processing, first-order derivation processing, multivariate scattering correction processing, normal variable transformation processing, polynomial convolution smoothing processing and detrending processing.

The beneficial effects of doing so are: the original spectrum is preprocessed before modeling, so that other irrelevant interference information such as baseline drift, background, noise and the like is eliminated, and the modeling accuracy is improved.

Further, the wavelength band of the near infrared spectrum is 780nm-1100 nm.

The beneficial effects of doing so are: the wave band is selected to further avoid the interference of irrelevant information before modeling, reduce modeling variables and improve the modeling speed and accuracy.

Further, preprocessing the collected near infrared spectrum by adopting normal variable transformation.

Further, the method for detecting the empty-shell walnuts further comprises the following steps of:

determining the detection result of whether all detected walnuts are empty according to the methods of the steps 1) to 2) so as to determine the number of empty-shell fruits of the empty-shell walnuts; and calculating the ratio of the number of empty-shell fruits to the number of the co-measured fruits to obtain the empty-shell rate.

Drawings

FIG. 1 is a graph showing the difference in weight between different varieties of walnuts in the background art of the present invention;

FIG. 2 is a graph showing the difference in weight between walnuts of different types before and after storage in the background art of the present invention;

FIG. 3 is a diagram of different measuring positions of walnuts;

FIG. 4 is the signal-to-noise ratio of the near infrared spectra of walnuts at different scanning positions;

FIG. 5 is a state diagram of different samples of walnut;

FIG. 6 is a near infrared spectrum of different walnut shell states;

FIG. 7 is a near infrared spectrum of walnut samples of different species;

FIG. 8 is a near infrared original spectrum of an unprocessed walnut;

FIG. 9 is a graph of a walnut near infrared spectrum after normal variable transformation (SNV) pretreatment;

FIG. 10 is a chart of the near infrared spectra of walnuts after pretreatment by normalization algorithm (normalization);

FIG. 11 is a first derivative (1)st) A preprocessed walnut near-infrared spectrogram;

FIG. 12 is a chart of the walnut near infrared spectrum after being pretreated by Multivariate Scattering Correction (MSC);

FIG. 13 is a graph of the walnut near infrared spectrum after pretreatment by polynomial convolution smoothing (S-G smoothing);

FIG. 14 is a near infrared spectrum of a walnut after a detrending (De-trending) pretreatment;

FIG. 15 is a diagram of a kernel function G and penalty factor C network optimization process in a support vector machine model.

Detailed Description

The present invention will be described in further detail with reference to the accompanying drawings.

Example (b):

the invention respectively measures the near infrared spectrums of the empty-shell walnuts and the full-kernel walnuts, because the fat, the protein and the moisture of the walnuts mainly exist in the kernels, the near infrared absorbance of the empty-shell walnuts is obviously lower than that of the full-kernel walnuts, and the near infrared spectrums of the two types of walnuts have obvious difference. Therefore, the method has feasibility for detecting the empty shell condition of the walnut by adopting the near infrared spectrum technology.

The detection method of the walnut shell rate comprises the following steps:

1) selecting the optimal near infrared spectrum detection position of the walnut;

the structure of different parts of the walnut shell has great difference, as shown in figure 3, the walnut belly (horizontally placed) has less and smooth shell grains, and the shell thickness is thinner; the walnut edge II (along the suture line) is wider, the pile height is sharp, and the shell has thick and generous grains; the walnut bottom (vertically placed) has more and deep shell grains and thicker shell skin. The surface position of the walnut shell, on which near-infrared light is incident, has an important influence on the path of light entering the shell, so that the measuring position is a key factor for near-infrared detection of the empty walnut shell.

As shown in FIG. 4, the SNR of the near infrared spectra of walnuts at different scanning positions is shown, according to the equation relating the SNR to the predicted Root Mean Square Error (RMSEP), under the condition that other conditions are not changed, the SNR is improved by 10.0%, and the Root Mean Square Error (RMSEP) is reduced by 9.1%.

Wherein, B is a regression coefficient, and is related to a specific modeling method and modeling parameters.

Therefore, the walnut belly (horizontally placed) is selected as the optimal detection position of the walnut.

2) Preprocessing the acquired walnut near infrared spectrum;

as shown in fig. 5, different sample state diagrams of walnuts are shown, the walnut shell states are commonly two types: one is a smooth shell that is thin and stretched, and the other is a wrinkled shell that is thick and angular. As shown in fig. 6, the near infrared spectra of different walnut shell states have a large influence on the repeatability and stability of the near infrared spectra, because when the near infrared light irradiates the outer surface of the walnut, the wrinkled shell can generate a strong scattering effect on incident light compared with a smooth shell, thereby interfering with the acquisition of near infrared spectrum information. Therefore, the acquired walnut near infrared spectrum needs to be preprocessed.

Meanwhile, the types of the conventional walnuts are many, more than twenty kinds of walnuts exist in China, and the conventional varieties include three types of Xinjiang thin-shell walnuts, Yunnan soaked walnuts and Henan cotton kernel walnuts. The appearance of different varieties of walnuts has certain difference (such as structure, size, color and the like), which is possible to increase irrelevant information of the near infrared detection of the empty-shell walnuts. Therefore, three different varieties of walnuts are taken as research objects, 10 samples are randomly taken from each variety, the influence of the walnut varieties on the near infrared spectrum is examined, and the result is shown in the near infrared spectrogram of different varieties of walnut samples in figure 7. The difference of the near infrared spectra of different types of walnuts is not large, the average variation coefficient of the whole spectrum is not more than 0.06 and is far less than 0.18 of the average variation coefficient of the spectrum between empty-shell walnuts and full-kernel walnuts, which shows that the influence of the types of walnut samples on the near infrared spectra of walnuts is small. Therefore, the research combines the near infrared spectrums of three different varieties of walnuts together to perform modeling research.

As shown in fig. 8, the unprocessed near-infrared original spectrogram of the walnut does not only contain internal structural information of the walnut itself, but also may contain other irrelevant interference information such as baseline drift, background, noise and the like, and the existence of the interference information directly affects the robustness and accuracy of the established model. Therefore, the invention adopts a normal variable transformation (SNV) method to preprocess the walnut near infrared spectrum. As shown in fig. 9, the walnut near-infrared spectrogram after normal variable transform (SNV) pretreatment, the whole shape of the processed spectrum is basically the same as the original spectrum, and the dispersion degree of the sample spectrum is reduced.

In addition to the method of preprocessing the walnut near-external spectrum in this embodiment using normal-to-variable transformation (SNV), a normalization algorithm (normalization) (as shown in fig. 10) and a first derivative (1) may also be appliedst) (as shown in FIG. 11), Multivariate Scatter Correction (MSC) (as shown in FIG. 12), polynomial convolution smoothing (S-G smoothing) (as shown in FIG. 13), and detrending (De-trending) (as shown in FIG. 14), as shown in Table 2, the linear judgment of the empty shell rate of walnut under different pretreatment methodsAs shown in the results of the individual models, the empty-shell recognition rate of the normal variable transform (SNV) used in the present example was the highest among the various pretreatment methods described above, as analyzed and found in table 2.

TABLE 2 Linear discrimination model results of empty shell rate of walnuts under different pretreatment methods

3) Selecting the waveband of the preprocessed near infrared spectrum;

on one hand, the wave band selection avoids the interference of irrelevant information, and extracts the related spectral information of the walnut to be tested; on the other hand, modeling variables are reduced, modeling speed is improved, the difference of modeling results of the walnut shell rate of different detection wave bands is large, as shown in a linear discrimination model result of the walnut shell rate of different wave bands in a table 3, discrimination effect of the shell rate of 780-1100 nm in the wavelength range of the whole near infrared spectrum of the walnut is the best, and therefore the 780-1100 nm range is selected as the optimal modeling wave band of the walnut shell rate.

TABLE 3 Linear discrimination model results of walnut empty shell rate under different wave bands

As other embodiments, the invention can also select the wave band first, after obtaining the near infrared spectrum, select the 780-1100 nm range with good discrimination effect, and then perform the preprocessing process of the step 2) on the selected wavelength range, thus reducing the data processing amount of preprocessing and increasing the processing efficiency. The sequence of the band selection and the preprocessing process is not limited in the present invention.

4) Carrying out modeling analysis on the near infrared spectrum of the optimal waveband;

the invention selects Linear as a discriminant function to establish an LDA discrimination model. Linear Discriminant Analysis (LDA) is a supervised identification method, and its classification idea is to project high-dimensional sample data to the best classified vector space to achieve the effect of extracting classification information and compressing feature space dimensions. Depending on the discriminant function, the method can be classified into Linear discriminant analysis (Linear), Quadratic discriminant analysis (Quadratic), Mahalanobis distance discriminant analysis (Mahalanobis), and the like. As shown in a table 4 of results of a Linear discrimination model of the empty-shell walnut, in walnut near infrared spectrum modeling, the modeling effect of the Linear discrimination function is good, the recognition rate of the whole model reaches 100.0%, and 100% discrimination of the empty-shell walnut can be realized on the premise of fidelity.

TABLE 4 Linear discriminant model results for empty walnuts

Besides this embodiment, the modeling analysis of the near infrared spectrum of the optimal band can also be modeled by using a Support Vector Machine (SVM) method, in which a low-dimensional space linear inseparable mode is nonlinearly mapped to a high-dimensional feature space by introducing a kernel function, so as to achieve the purpose of linear divisibility. In the SVM modeling process, two key parameters need to be determined: the selection of the values of the kernel function and the kernel function parameters directly influences the classification effect and the prediction precision of the model. At present, the common kernel functions include Linear kernel function (Linear), Polynomial kernel function (Polynomial), radial basis kernel function (RBF), Sigmoid kernel function (Sigmoid), and the like. The invention refers to the existing research experience and selects RBF as kernel function through comparison. The RBF parameters are determined by a grid search method, and the selection range of the kernel function G is 1.0 multiplied by 10-3~1.0×100The selection range of the predetermined penalty factor C is 1.0 × 102~1.0×10610000 iterations, by intersectionThe identification accuracy of the mutual authentication is determined by selecting G and C values, and the result is shown in fig. 15.

From the analysis of FIG. 15, the optimal combination of (G, C) obtained by the web search method is a range, the global search is performed by using the web search method in combination with the particle swarm optimization, the optimal parameters are found, and the optimal combination of (G, C) is calculated as (1.93 × 10)-2,2.68×105) At this time, the number of corresponding support vectors is 31. The built support vector machine model is adopted to predict 50 walnut samples which are randomly distributed, and the results are shown in table 5.

TABLE 5 support vector machine discrimination results for empty walnut

For the verification of the two models, 50 unknown walnut samples are adopted for detection, and the results are shown in table 6. The LAD method adopted by the invention has better prediction effect.

TABLE 6 model verification results for empty walnut

After detecting the empty walnuts, the walnuts are laid on a clean plane by adopting a counting method, the number of the empty walnuts is picked out and recorded, the empty rate is calculated by using the ratio of the number of the empty walnuts to the total number of the walnut samples, and the calculation formula is as follows:

the invention adopts the near infrared technology and the chemometrics method to establish the identification model of the walnut shell rate, and the model can accurately identify the walnut shell condition. In the prior art, a method for detecting whether the walnut is empty by weight is easily influenced by factors such as walnut varieties and storage time, so that the problem of low empty walnut distinguishing accuracy is caused. Aiming at the problems in the prior art, the detection method disclosed by the invention is used for detecting the empty shell rate of the walnut by adopting a near-infrared irradiation method based on the characteristic that the absorption degree of substances such as water, protein and fat in the empty shell walnut to near-infrared light is obviously lower than that of a real kernel walnut. Specifically, the walnut belly (flatly placed) is detected by using near infrared light, data (near infrared spectrum) obtained by detection is preprocessed by a normal variable transform (SNV) method, after preprocessing, a 780-1100 nm range is selected as a detection wave band and a modeling wave band of the walnut shell rate, and finally, a Linear discriminant function is selected to establish an LDA identification model for shell rate detection, so that the shell rate identification rate of the walnut shell reaches 100.0%.

16页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种光稳定剂-123中120号溶剂油的检测方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!