CN112147083A - Seed purity detection method, detection device and computer readable storage medium - Google Patents

Seed purity detection method, detection device and computer readable storage medium Download PDF

Info

Publication number
CN112147083A
CN112147083A CN202011100168.1A CN202011100168A CN112147083A CN 112147083 A CN112147083 A CN 112147083A CN 202011100168 A CN202011100168 A CN 202011100168A CN 112147083 A CN112147083 A CN 112147083A
Authority
CN
China
Prior art keywords
seed
lasso
logistic
model
spectral data
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.)
Granted
Application number
CN202011100168.1A
Other languages
Chinese (zh)
Other versions
CN112147083B (en
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.)
Wuhan Polytechnic University
Original Assignee
Wuhan Polytechnic 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 Wuhan Polytechnic University filed Critical Wuhan Polytechnic University
Priority to CN202011100168.1A priority Critical patent/CN112147083B/en
Publication of CN112147083A publication Critical patent/CN112147083A/en
Application granted granted Critical
Publication of CN112147083B publication Critical patent/CN112147083B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/17Systems in which incident light is modified in accordance with the properties of the material investigated
    • G01N21/25Colour; Spectral properties, i.e. comparison of effect of material on the light at two or more different wavelengths or wavelength bands
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • 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
    • Y02ATECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
    • Y02A40/00Adaptation technologies in agriculture, forestry, livestock or agroalimentary production
    • Y02A40/10Adaptation technologies in agriculture, forestry, livestock or agroalimentary production in agriculture

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Artificial Intelligence (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Analytical Chemistry (AREA)
  • Pathology (AREA)
  • Immunology (AREA)
  • General Health & Medical Sciences (AREA)
  • Biochemistry (AREA)
  • Chemical & Material Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Spectroscopy & Molecular Physics (AREA)
  • Image Analysis (AREA)

Abstract

The invention provides a seed purity detection method, a detection device and a computer readable storage medium, wherein the method comprises the following steps: acquiring spectral data of a seed image to be detected; inputting the spectral data into a trained lasso-logistic model, and operating the lasso-logistic model to obtain a spectral data classification result; and obtaining the seed purity according to the spectral data classification result. By adopting lasso to select the variables of the logistic model, the variables can be compressed, so that stable representative characteristic variables can be selected to reduce the calculated amount, and meanwhile, the variable selection of lasso is a continuous process, which can simultaneously realize continuous variable contraction and automatic variable selection, thereby overcoming the problem of unstable model selection caused by discontinuous regularization of parameter estimation.

Description

Seed purity detection method, detection device and computer readable storage medium
Technical Field
The invention relates to the field of seed detection, in particular to a seed purity detection method, a detection device and a computer readable storage medium.
Background
The hyperspectral image technology is a new seed purity detection method appearing in recent years, and the hyperspectral image not only contains image characteristics, but also contains spectral information, so that the external characteristics and chemical components of the seeds can be identified more accurately. However, the hyperspectral image data contains a large amount of redundant information, and how to accurately extract effective spectral information from the redundant information and identify seeds is a very important problem.
In the hyperspectral image technology in the prior art, an optimal subset selection method and a stepwise regression method are mostly adopted for variable selection, the optimal subset method considers all possible regression models, and finally selects an optimal subset according to a specified standard. Another stepwise regression method, which starts with the selection of the variable that contributes the most into the regression equation and determines in advance two thresholds for deciding the variable selection or rejection, is discontinuous for regularization of parameter estimation, which discontinuity leads to instability of model selection.
Disclosure of Invention
The invention mainly aims to provide a seed purity detection method, a detection device and a computer readable storage medium, and aims to solve the problems that the purity detection method in the prior art is large in calculation amount or unstable in model selection.
In order to achieve the above object, the present invention provides a method for detecting seed purity, comprising the steps of:
acquiring spectral data of a seed image to be detected;
inputting the spectral data into a trained lasso-logistic model, and operating the lasso-logistic model to obtain a spectral data classification result;
and obtaining the seed purity according to the spectral data classification result.
Optionally, the lasso-logistic model comprises a lasso model and a logistic model;
the step of inputting the spectral data into a trained lasso-logistic model and running the lasso-logistic model to obtain a spectral data classification result comprises:
inputting the spectral data into a lasso model to perform feature extraction on the spectral data to obtain spectral data of a feature waveband;
inputting the spectral data of the characteristic waveband into a logistic model, and operating the logistic model to obtain a spectral data classification result.
Optionally, the step of obtaining the spectral data of the image of the seed to be detected includes:
acquiring training spectrum data and preset label data corresponding to the training spectrum data;
using the training spectral data as an input to a lasso-logistic initial model to output a predictive classification result after the lasso-logistic initial model is run;
and training the lasso-logistic initial model according to the prediction classification result and the preset label data, so that the trained lasso-logistic initial model is used as the lasso-logistic model.
Optionally, the step of training the lasso-logistic initial model according to the predicted classification result and the preset label data includes:
comparing the preset label data with the prediction classification result to obtain a loss function;
adjusting parameters of the lasso-logistic initial model according to the loss function to update the lasso-logistic initial model;
judging whether the updated lasso-logistic initial model reaches the training stopping condition or not;
when a stop training condition is reached, taking the last updated lasso-logistic initial model as the lasso-logistic model;
and when the training stopping condition is not met, the training spectrum data and the corresponding preset label data are obtained again.
Optionally, the step of acquiring the training spectrum data and the label data corresponding to each training spectrum data includes:
performing K-fold cross validation on the training spectral data to use validation results as harmonic parameters of the lasso-logistic model.
Optionally, the step of acquiring the spectral data of the image of the seed to be detected includes:
acquiring a seed image to be detected;
identifying the seed image to be detected to obtain pixel points corresponding to various seeds in the seed image to be detected;
acquiring the spectrum information of all pixel points corresponding to each seed, and performing average value calculation on the spectrum information of all pixel points to obtain average spectra corresponding to various seeds;
and taking the average spectrum corresponding to each seed as the spectrum data corresponding to the seed image to be detected.
Optionally, the step of using the average spectrum corresponding to each seed as the spectrum data corresponding to the image of the seed to be measured includes:
carrying out standard normal transformation and derivation processing on the average spectrum corresponding to each seed;
and taking the average spectrum corresponding to each processed seed as the spectrum data corresponding to the seed image to be detected.
Optionally, the step of obtaining seed purity according to the spectral data classification result includes:
acquiring the total quantity of seeds to be detected, and acquiring the quantity of target seeds from the spectral data classification result;
and dividing the target seed quantity by the total quantity of the seeds to be detected to obtain the seed purity.
To achieve the above object, the present invention further provides a detection apparatus, which includes a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the seed purity detection method as described above.
To achieve the above object, the present invention further provides a computer-readable storage medium, having a computer program stored thereon, where the computer program, when executed by a processor, implements the steps of the seed purity detection method as described above.
The invention provides a seed purity detection method, a detection device and a computer readable storage medium, which are used for acquiring spectral data of a seed image to be detected; inputting the spectral data into a trained lasso-logistic model, and operating the lasso-logistic model to obtain a spectral data classification result; and obtaining the seed purity according to the spectral data classification result. By adopting lasso to select the variables of the logistic model, the variables can be compressed, so that stable representative characteristic variables can be selected to reduce the calculated amount, and meanwhile, the variable selection of lasso is a continuous process, which can simultaneously realize continuous variable contraction and automatic variable selection, thereby overcoming the problem of unstable model selection caused by discontinuous regularization of parameter estimation.
Drawings
FIG. 1 is a schematic flow chart of a seed purity detection method according to a first embodiment of the present invention;
FIG. 2 is a detailed flowchart of step S20 in the second embodiment of the method for detecting seed purity according to the present invention;
FIG. 3 is a schematic block diagram of the detecting device of the present invention.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The invention provides a seed purity detection method, and referring to fig. 1, fig. 1 is a schematic flow chart of a first embodiment of the seed purity detection method of the invention, and the method comprises the following steps:
step S10, acquiring the spectral data of the seed image to be detected;
in this embodiment, shoot the seed sample through high spectrum camera earlier, it should be noted that can adjust the ambient light source to indoor halogen lamp when shooing to set up the blank in the setting picture, for the later stage carries out the image calibration. The hyperspectral camera can automatically record dark references during shooting, preset operations such as image scanning, whiteboard selection and reflectance spectrum conversion are executed, and the hyperspectral camera derives a hyperspectral image after the operations are executed. And obtaining spectrum data corresponding to the seeds to be detected through the hyperspectral images, wherein the spectrum data comprise average spectra corresponding to the seeds to be detected in the hyperspectral images. It should be noted that the image of the seed to be measured may include images of a plurality of seeds to be measured, and the spectral data is a set of spectral data corresponding to each seed to be measured.
Step S20, inputting the spectral data into a trained lasso-logistic model, and operating the lasso-logistic model to obtain a spectral data classification result;
the lasso-logistic model is used for adding a penalty term to a parameter when solving the parameter estimation value of the logistic model so as to realize the selection of the variable and the parameter estimation. That is, in the present embodiment, the results of the spectral data after the variable selection and the parameter estimation are input to the logistic model for solution. The lasso-logistic model outputs only two classes, namely "target seed" and "non-target seed".
And step S30, obtaining the seed purity according to the spectral data classification result.
The step S30 includes the steps of:
step S31, acquiring the total quantity of seeds to be detected, and acquiring the quantity of target seeds from the spectrum data classification result;
and step S32, dividing the target seed quantity by the total quantity of the seeds to be detected to obtain the seed purity.
The seed purity refers to the degree of typical consistency of seed varieties in characteristic characteristics, and is expressed by percentage of target seed number in seed number to be detected. And obtaining a spectral data classification result, namely the number of the target seeds in the seeds to be detected, through a lasso-logistic model, and further calculating according to the spectral data classification result to obtain the seed purity.
The embodiment adopts lasso to select the variables of the logistic model, so that the variables can be compressed, stable representative characteristic variables are selected, the calculated amount is reduced, and meanwhile, the variable selection of lasso is a continuous process, which can simultaneously realize continuous variable contraction and automatic variable selection, thereby overcoming the problem of unstable model selection caused by the discontinuous regularization of parameter estimation.
Further, referring to fig. 2, in the second embodiment of the method for detecting purity of seed according to the present invention based on the first embodiment of the present invention, the lasso-logistic model includes a lasso model and a logistic model, and the step S20 includes the steps of:
step S21, inputting the spectral data into a lasso model to perform feature extraction on the spectral data to obtain spectral data of a feature waveband;
and step S22, inputting the spectral data of the characteristic wave band into a logistic model, and operating the logistic model to obtain a spectral data classification result.
The lasso model is a compression estimation method with the idea of reducing a variable set. By constructing a penalty function, the coefficients of the variables can be compressed and some regression coefficients can be changed into 0, so that the purpose of variable selection is achieved.
There are often some unavoidable problems when building models using linear regression. When the sample characteristics exceed the number of samples, the built model is easy to generate an overfitting phenomenon. There are two methods commonly used to alleviate the overfitting problem, namely reducing the number of features and regularization.
The goal of regularization is to minimize structural risk, which is adding a regularization term to the empirical risk. The regularization functions to make the empirical risk and model complexity of the model smaller at the same time. The regularization is generally a norm of a model parameter vector, commonly used is a L1 norm and a L2 norm, lasso regression adopts L1 norm regularization, and the L1 norm is expressed as follows:
Figure BDA0002724173370000051
the cost function of the lasso regression is:
Figure BDA0002724173370000052
where λ is called harmonic parameter, and when λ is 0, m is the number of data points, i.e. the number of spectral data in this embodiment, xiIs the view of input xMeasured value, yiThe observed value of y is output, the model coefficient is not compressed, namely, the model coefficient is a common least square solution, the smaller the lambda is, the smaller the punishment of the model is, and the more the variables are kept; when the lambda is larger, the punishment degree of the model is larger, and the retained variables are fewer.
The most common method for solving the lasso model comprises a minimum angle regression method and a coordinate descent method, wherein the minimum angle regression method integrates the advantages of a classical stepwise regression forward selection method and a stepwise forward method, the calculation problem of the lasso model is rapidly and effectively solved, and the lasso model is widely applied to various models. And the coordinate descent method has more advantages than the minimum angle regression algorithm, is suitable for application in a generalized linear model, and can solve a large-scale data set.
In this embodiment, the steps of solving the lasso model by using the coordinate descent method are as follows:
1, assume that there are estimates of β and β with l ≠ j0To beta, pairjPartial optimization, which creates an outer loop for calculating the second order approximation l for each lambda valueQCurrent parameter (β) of0,β)。
And 2, solving a penalty weighted least square problem by coordinate descent.
3, corresponding to a nested loop sequence: the outer loop is used to reduce the parameter lambda and the middle loop is used to update the second order approximation lQCurrent parameter (beta) used0Beta), the inner loop solves the punitive weighted least squares problem by coordinate descent.
The logistic model is a model used to model the probability of a certain category or event occurring. The logistic model in this embodiment is a binary logistic model.
The lasso method is mainly applied to linear models, and its essence is to add a penalty function on the sum of squared residuals, with coefficients being compressed when estimating parameters, and some coefficients even being compressed to 0 to enable model selection. Considering the binary problem, it is assumed that there are independent and identically distributed observations (X)i,yi) 1,2, n, wherein X isi=(xi1,xi2,...xip) In order to input the variables of the device,yiis a response variable, and yiIf it is a binary discrete data variable, i.e., if the output is 1 or 0 (whether this is the case or not), then the conditional probability of the Logistic linear regression model is:
Figure BDA0002724173370000061
wherein the content of the first and second substances,
Figure BDA0002724173370000062
p is the number of variables, and the coefficient estimates in the lasso-Logistic regression model are given by the minima of the convex function of:
Figure BDA0002724173370000063
where l (β) is a log-likelihood function, l (β) in the above equation can be written as:
Figure BDA0002724173370000064
where n is the number of samples, the coefficient estimates in the lasso-logistic regression model can be written as:
Figure BDA0002724173370000071
the spectral data of the characteristic wave band is obtained after variable selection is carried out on the spectral data through a lasso model, which represents that the difference between different types of seeds in the wave band is large, so that the spectral data in the wave band can be only input into a logistic model for classification, namely, the required classification accuracy is achieved, and the calculated amount is reduced.
In the embodiment, the spectral data of the characteristic wave band is selected through the lasso model, and then the spectral data of the characteristic wave band is input into the logistic model for classification, so that the calculation amount is reduced, and the classification accuracy is ensured.
Further, in the third embodiment of the seed purity detecting method according to the present invention proposed based on the first embodiment of the present invention, the method includes, before the step S10, the steps of:
step S40, acquiring training spectrum data and preset label data corresponding to the training spectrum data;
step S50, using the training spectrum data as the input of the lasso-logistic initial model, so as to output the prediction classification result after the lasso-logistic initial model is operated;
step S60, training the lasso-logistic initial model according to the prediction classification result and the preset label data, so as to use the trained lasso-logistic initial model as the lasso-logistic model.
The training spectral data includes spectral data of each training sample seed, and the preset tag data is a tag corresponding to the training sample seed, for example, if the lasso-logistic model of this embodiment is used to classify whether the training sample seed is a first seed, the tag data corresponding to the spectral data of the first seed in the training sample seeds is a "target seed", and the tag data corresponding to the spectral data of the non-first seed in the training sample seeds is a "non-target seed". Inputting the spectral data corresponding to a training sample seed into a lasso-logistic model to obtain a prediction classification result, and comparing the prediction classification result with the label data corresponding to the spectral data to optimize the lasso-logistic model.
Further, the step S60 includes the steps of:
step S61, comparing the preset label data with the prediction classification result to obtain a loss function;
step S62, adjusting parameters of the lasso-logistic initial model according to the loss function to update the lasso-logistic initial model;
step S63, judging whether the updated lasso-logistic initial model reaches the training stopping condition;
step S64, when the training stopping condition is reached, using the latest updated lasso-logistic initial model as the lasso-logistic model;
and step S65, when the training stopping condition is not reached, acquiring the training spectrum data and the corresponding preset label data again.
The training condition may be set according to an actual training condition, for example, if the training condition is set to a preset training frequency, the counter is incremented by one every training, and when the counter reaches the preset training frequency, the training stopping condition is reached; or setting the training condition as the preset accuracy, calculating the accuracy of the current classification once or for a preset number of times of training, judging whether the preset accuracy is reached, and when the preset accuracy is reached, stopping the training.
This embodiment enables a trained lasso-logistic model to be obtained by training the lasso-logistic initial model.
Further, in a fourth embodiment of the seed purity detection method according to the present invention based on the third embodiment of the present invention, the method includes, after the step S40, the steps of:
step S70, performing K-fold cross validation on the training spectrum data to use the validation result as the reconciliation parameter of the lasso-logistic model.
The choice of variables for the lasso-logistic model is critical to the choice of the harmonic parameters λ. Common methods include Boot-strap, cross-validation and generalized cross-validation. The method adopted by the embodiment is K-fold cross validation, and the flow is as follows:
the samples T are divided equally into K subsets. X ═ T1, T2, …, Tk, }
Respectively taking K as 1,2, 3, … and K, removing the kth subset in the sample T, and fitting the rest K-1 subsets to obtain a model
Figure BDA0002724173370000081
And fitting is performed on the k (k is 1,2, 3, …, k) th parts respectively, and the error is obtained as follows:
Figure BDA0002724173370000082
the total error of the K-fold cross validation is:
Figure BDA0002724173370000083
the adjustment parameters obtained by the K-fold cross verification method are as follows:
Figure BDA0002724173370000084
further, in a sixth embodiment of the seed purity detecting method according to the present invention based on the first embodiment of the present invention, the step S10 includes the steps of:
step S11, acquiring a seed image to be detected;
step S12, identifying the seed image to be detected to obtain pixel points corresponding to various seeds in the seed image to be detected;
step S13, acquiring the spectrum information of all pixel points corresponding to each seed, and performing average value calculation on the spectrum information of all pixel points to obtain the average spectrum corresponding to each seed;
step S14, the average spectrum corresponding to each seed is used as the spectrum data corresponding to the seed image to be measured.
After the seed image to be detected is obtained, a detector may select an ROI (region of interest) in the seed image to be detected, and then identify the ROI by using an image segmentation technique, so as to obtain pixel points corresponding to various seeds in the seed image to be detected. It can be understood that a plurality of pixel points corresponding to one seed are provided, and the average value of the spectrum information of all the pixel points corresponding to one seed is calculated to obtain the average spectrum corresponding to the seed.
In this embodiment, the to-be-detected seed image is identified to obtain the pixel points corresponding to the seeds, and further obtain the average spectra corresponding to the seeds, so that the spectral data corresponding to the seed image can be accurately obtained.
Further, in a fifth embodiment of the seed purity detecting method according to the present invention based on the fourth embodiment of the present invention, the step S14 includes the steps of:
step S141, standard normal transformation and derivation processing are carried out on the average spectrum corresponding to each seed;
and step S142, taking the average spectrum corresponding to each processed seed as the spectrum data corresponding to the seed image to be detected.
Under the influence of factors such as shooting environment and illumination, the extracted average spectrum often contains a large amount of noise, cannot be directly used for analysis, and needs to be subjected to SNV (standard normal transform) and derivation processing.
The SNV is a process of standardizing original normal data or normal variables, and is converted into standard normal distribution according to the characteristic of linear consistency of the normal distribution.
The derivation processing comprises a first derivation and a second derivation, other background interference can be eliminated, the spectral resolution is improved, and the derivative spectrum is obtained by adopting a Savitzky-Golay convolution smoothing method.
In the embodiment, the noise in the average spectrum is removed through standard normal transformation and derivation processing, so that the final classification result is more accurate.
Referring to fig. 3, the detection apparatus may include components such as a communication module 10, a memory 20, and a processor 30 in a hardware structure. In the detection apparatus, the processor 30 is connected to the memory 20 and the communication module 10, respectively, the memory 20 stores thereon a computer program, which is executed by the processor 30 at the same time, and when executed, implements the steps of the above-mentioned method embodiment.
The communication module 10 may be connected to an external communication device through a network. The communication module 10 may receive a request from an external communication device, and may also send a request, an instruction, and information to the external communication device, where the external communication device may be another detection apparatus, a server, or an internet of things device, such as a television.
The memory 20 may be used to store software programs as well as various data. The memory 20 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (for example, performing a standard normal transformation and a derivation process on the average spectrum corresponding to the various sub-regions), and the like; the storage data area may include a database, and the storage data area may store data or information created according to use of the system, or the like. Further, the memory 20 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The processor 30, which is a control center of the inspection apparatus, connects various parts of the entire inspection apparatus using various interfaces and lines, and performs various functions of the inspection apparatus and processes data by operating or executing software programs and/or modules stored in the memory 20 and calling data stored in the memory 20, thereby monitoring the entire inspection apparatus. Processor 30 may include one or more processing units; alternatively, the processor 30 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 30.
Although not shown in fig. 3, the detection device may further include a circuit control module, which is used for connecting with a power supply to ensure the normal operation of other components. Those skilled in the art will appreciate that the detection device configuration shown in FIG. 3 does not constitute a limitation of the detection device, and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
The invention also proposes a computer-readable storage medium on which a computer program is stored. The computer-readable storage medium may be the Memory 20 in the detection apparatus of fig. 3, and may also be at least one of a ROM (Read-Only Memory)/RAM (Random Access Memory), a magnetic disk, and an optical disk, where the computer-readable storage medium includes instructions for enabling a terminal device (which may be a television, an automobile, a mobile phone, a computer, a server, a terminal, or a network device) having a processor to execute the method according to the embodiments of the present invention.
In the present invention, the terms "first", "second", "third", "fourth" and "fifth" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance, and those skilled in the art can understand the specific meanings of the above terms in the present invention according to specific situations.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Although the embodiment of the present invention has been shown and described, the scope of the present invention is not limited thereto, it should be understood that the above embodiment is illustrative and not to be construed as limiting the present invention, and that those skilled in the art can make changes, modifications and substitutions to the above embodiment within the scope of the present invention, and that these changes, modifications and substitutions should be covered by the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A method for detecting seed purity, comprising:
acquiring spectral data of a seed image to be detected;
inputting the spectral data into a trained lasso-logistic model, and operating the lasso-logistic model to obtain a spectral data classification result;
and obtaining the seed purity according to the spectral data classification result.
2. The method of seed purity testing of claim 1, wherein said lasso-logistic model comprises a lasso model and a logistic model;
the step of inputting the spectral data into a trained lasso-logistic model and running the lasso-logistic model to obtain a spectral data classification result comprises:
inputting the spectral data into a lasso model to perform feature extraction on the spectral data to obtain spectral data of a feature waveband;
inputting the spectral data of the characteristic waveband into a logistic model, and operating the logistic model to obtain a spectral data classification result.
3. The method for detecting seed purity according to claim 2, wherein the step of obtaining the spectral data of the image of the seed to be detected comprises:
acquiring training spectrum data and preset label data corresponding to the training spectrum data;
using the training spectral data as an input to a lasso-logistic initial model to output a predictive classification result after the lasso-logistic initial model is run;
and training the lasso-logistic initial model according to the prediction classification result and the preset label data, so that the trained lasso-logistic initial model is used as the lasso-logistic model.
4. The method of claim 3, wherein the step of training the lasso-logistic initial model according to the predictive classification result and the pre-set label data comprises:
comparing the preset label data with the prediction classification result to obtain a loss function;
adjusting parameters of the lasso-logistic initial model according to the loss function to update the lasso-logistic initial model;
judging whether the updated lasso-logistic initial model reaches the training stopping condition or not;
when a stop training condition is reached, taking the last updated lasso-logistic initial model as the lasso-logistic model;
and when the training stopping condition is not met, the training spectrum data and the corresponding preset label data are obtained again.
5. The method of detecting seed purity according to claim 4, wherein the step of obtaining the training spectra data and the label data corresponding to each training spectra data is followed by:
performing K-fold cross validation on the training spectral data to use validation results as harmonic parameters of the lasso-logistic model.
6. The method for detecting seed purity according to any one of claims 1 to 5, wherein the step of obtaining the spectral data of the image of the seed to be detected comprises:
acquiring a seed image to be detected;
identifying the seed image to be detected to obtain pixel points corresponding to various seeds in the seed image to be detected;
acquiring the spectrum information of all pixel points corresponding to each seed, and performing average value calculation on the spectrum information of all pixel points to obtain average spectra corresponding to various seeds;
and taking the average spectrum corresponding to each seed as the spectrum data corresponding to the seed image to be detected.
7. The method for detecting seed purity according to claim 6, wherein the step of using the average spectrum corresponding to each seed as the spectrum data corresponding to the image of the seed to be detected comprises:
carrying out standard normal transformation and derivation processing on the average spectrum corresponding to each seed;
and taking the average spectrum corresponding to each processed seed as the spectrum data corresponding to the seed image to be detected.
8. The method for detecting seed purity according to any one of claims 1 to 5, wherein the step of obtaining seed purity according to the spectral data classification result comprises:
acquiring the total quantity of seeds to be detected, and acquiring the quantity of target seeds from the spectral data classification result;
and dividing the target seed quantity by the total quantity of the seeds to be detected to obtain the seed purity.
9. A testing apparatus comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program when executed by the processor implementing the steps of the seed purity testing method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that a computer program is stored thereon, which computer program, when being executed by a processor, carries out the steps of the seed purity detection method according to any one of claims 1 to 8.
CN202011100168.1A 2020-10-14 2020-10-14 Seed purity detection method, detection device and computer readable storage medium Active CN112147083B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011100168.1A CN112147083B (en) 2020-10-14 2020-10-14 Seed purity detection method, detection device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011100168.1A CN112147083B (en) 2020-10-14 2020-10-14 Seed purity detection method, detection device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN112147083A true CN112147083A (en) 2020-12-29
CN112147083B CN112147083B (en) 2023-07-11

Family

ID=73951911

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011100168.1A Active CN112147083B (en) 2020-10-14 2020-10-14 Seed purity detection method, detection device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN112147083B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102621077A (en) * 2012-03-30 2012-08-01 江南大学 Hyper-spectral reflection image collecting system and corn seed purity nondestructive detection method based on same
US20130046721A1 (en) * 2011-08-19 2013-02-21 International Business Machines Corporation Change point detection in causal modeling
CN105224960A (en) * 2015-11-04 2016-01-06 江南大学 Based on the corn seed classification hyperspectral imagery model of cognition update method of clustering algorithm
CN108734205A (en) * 2018-04-28 2018-11-02 东北电力大学 A kind of simple grain for different cultivars wheat seed pinpoints identification technology
CN110363662A (en) * 2019-08-19 2019-10-22 上海理工大学 A kind of personal credit points-scoring system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130046721A1 (en) * 2011-08-19 2013-02-21 International Business Machines Corporation Change point detection in causal modeling
CN102621077A (en) * 2012-03-30 2012-08-01 江南大学 Hyper-spectral reflection image collecting system and corn seed purity nondestructive detection method based on same
CN105224960A (en) * 2015-11-04 2016-01-06 江南大学 Based on the corn seed classification hyperspectral imagery model of cognition update method of clustering algorithm
CN108734205A (en) * 2018-04-28 2018-11-02 东北电力大学 A kind of simple grain for different cultivars wheat seed pinpoints identification technology
CN110363662A (en) * 2019-08-19 2019-10-22 上海理工大学 A kind of personal credit points-scoring system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
方匡南等: ""基于Lasso-logistic模型的个人信用风险预警方法"", 《数量经济技术经济研究》, pages 125 - 136 *
朱新峰;田叶;徐琴;: "光谱学中的稀疏化方法", 计算机与应用化学, no. 08, pages 15 - 23 *

Also Published As

Publication number Publication date
CN112147083B (en) 2023-07-11

Similar Documents

Publication Publication Date Title
CN108229667B (en) Trimming based on artificial neural network classification
CN109003260B (en) CT image pulmonary nodule detection method, device and equipment and readable storage medium
CN108269254B (en) Image quality evaluation method and device
CN113780466B (en) Model iterative optimization method, device, electronic equipment and readable storage medium
AU2020218573A1 (en) Shadow and cloud masking for remote sensing images in agriculture applications using multilayer perceptron
CN111062876B (en) Method and device for correcting model training and image correction and electronic equipment
CN108182421A (en) Methods of video segmentation and device
WO2015186341A1 (en) Image processing system, image processing method, and program storage medium
CN111199523B (en) Power equipment identification method, device, computer equipment and storage medium
WO2020160643A1 (en) Shadow and cloud masking for agriculture applications using convolutional neural networks
CN110428412B (en) Image quality evaluation and model generation method, device, equipment and storage medium
CN113158909B (en) Behavior recognition light-weight method, system and equipment based on multi-target tracking
WO2013006404A1 (en) System and method for auto-commissioning an intelligent video system
US11288101B2 (en) Method and system for auto-setting of image acquisition and processing modules and of sharing resources in large scale video systems
WO2022082848A1 (en) Hyperspectral image classification method and related device
CN112989910A (en) Power target detection method and device, computer equipment and storage medium
US20240143651A1 (en) Logging Image Definition Recognition Method and Device, Medium, and Electronic Equipment
López-Rubio et al. The effect of noise on foreground detection algorithms
CN113239975B (en) Target detection method and device based on neural network
US20180018525A1 (en) System and method for auto-commissioning an intelligent video system with feedback
CN112147083A (en) Seed purity detection method, detection device and computer readable storage medium
CN114880363A (en) Data center flow prediction system, training method and prediction method
US20150208042A1 (en) System and method for auto-commissioning an intelligent video system
Gao et al. Image quality assessment using image description in information theory
Xu et al. Recursive error-compensated dynamic eigenbackground learning and adaptive background subtraction in video

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
GR01 Patent grant
GR01 Patent grant