Flue-cured tobacco maturity classification method and device

Through the combination of expert sample preparation and hyperspectral imaging technology, the spectral characteristics of flue-cured tobacco maturity are extracted and classified using machine learning models, which solves the problem of difficulty in extracting flue-cured tobacco maturity information in the existing technology and improves the intelligent grading of tobacco leaves Accuracy and reliability.

CN119438096APending Publication Date: 2025-02-14KUNMING UNIV OF SCI & TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411555850.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-04
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

Existing machine vision technology is difficult to effectively extract the maturity information of tobacco leaves, resulting in a lack of control over maturity in intelligent grading of tobacco leaves, affecting the accuracy and reliability of grading results.

Method used

The flue-cured flue-cured maturity sample was obtained through expert samples, and spectral data were collected using a hyperspectral imaging system, and after pre-processing, the spectral characteristic band was extracted using the SWO-ResNet model, and finally the flue-cured maturity was classified using the LDA classification model.

Benefits of technology

It realizes the accurate classification of the maturity of flue-cured tobacco leaves, improves the accuracy and reliability of intelligent grading of tobacco leaves, and meets the needs of intelligent grading of tobacco leaves in industry.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119438096A_ABST
    Figure CN119438096A_ABST
Patent Text Reader

Abstract

The invention discloses a flue-cured tobacco maturity classification method and device, and relates to the technical field of flue-cured tobacco classification. The method comprises the following steps: respectively manufacturing upper, middle and lower flue-cured tobacco maturity samples by a tobacco leaf grading expert, acquiring spectral data of the flue-cured tobacco maturity by an imaging system, and eliminating noise in the spectral data of the flue-cured tobacco maturity by using a moving average filtering method and a multivariate scatter correction method; the method comprises the following steps: integrating a spider bee intelligent optimization algorithm into a 1D-ResNet model to establish an SWO-ResNet model, using SWO to intelligently optimize batchsize and epochs parameters in the 1D-ResNet model, using the SWO-ResNet model to extract a spectral characteristic wave band of flue-cured tobacco maturity, and using an LDA classifier to establish a flue-cured tobacco maturity classification model. The flue-cured tobacco maturity classification method capable of being described is established, and classification of the flue-cured tobacco maturity is completed through spectral characteristics.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a method and a device for classifying maturity of flue-cured tobacco, and relates to the technical field of tobacco leaf grading. Background Art

[0002] The maturity of flue-cured tobacco refers to the degree of maturity reflected by tobacco leaves harvested from the field after being baked. It is an important basis for evaluating the quality of flue-cured tobacco and one of the elements of flue-cured tobacco grading. It is closely related to other appearance characteristics of flue-cured tobacco leaves. At present, countries with advanced flue-cured tobacco production in the world put maturity at the top of all grading factors. Since the maturity process of flue-cured tobacco is very complicated, it involves the growth and development of tobacco plants, physiological and biochemical changes, baking conditions and modulation technology. Therefore, the characteristics of flue-cured tobacco maturity are also very complex, involving internal chemical composition and appearance characteristics. In the field of intelligent grading of flue-cured tobacco based on machine vision, the tobacco leaf images obtained by industrial cameras cannot directly reflect the maturity information of tobacco leaves, so the control of maturity as a quality factor is lacking in the grading process, so that the application of intelligent grading of tobacco leaves is difficult to fully reflect the quality of tobacco leaves, and the accuracy and reliability of the grading results need to be further improved. Although the flexible substances inside tobacco leaves such as cell walls, cell gaps and other tissue structures can be observed under a high-power microscope to represent maturity information, this method is currently difficult to be applied to intelligent grading of tobacco leaves.

[0003] In summary, the maturity index of flue-cured tobacco leaves should be added to the intelligent grading of tobacco leaves, but the maturity information of flue-cured tobacco leaves extracted by machine vision in the existing technology is difficult to apply to intelligent grading. Therefore, it is necessary to design a flue-cured tobacco maturity classification method to solve the above technical problems. Summary of the invention

[0004] The main technical problem to be solved by the present invention is to overcome the above-mentioned defects of the prior art and provide a method and device for classifying the maturity of flue-cured tobacco. The maturity samples of flue-cured tobacco leaves are obtained by expert sample preparation, and the spectral data of the flue-cured tobacco maturity samples are collected by a hyperspectral imaging system. After preprocessing the spectral data, the SWO-ResNet model is used to improve the spectral characteristic bands of the maturity of flue-cured tobacco, and finally the LDA classification model is used to complete the classification of the maturity of flue-cured tobacco.

[0005] The technical solution adopted by the present invention to solve its technical problem is:

[0006] According to one aspect of the present disclosure, a flue-cured tobacco maturity classification method is provided, S1: obtaining a flue-cured tobacco maturity sample through expert annotation;

[0007] S2: collecting spectral data of a flue-cured tobacco maturity sample, and preprocessing the spectral data to obtain processed spectral data;

[0008] S3: extracting features from the processed spectral data through a SWO-ResNet model to obtain spectral characteristic bands of the flue-cured tobacco maturity sample;

[0009] S4: classifying the spectral characteristic bands of the flue-cured tobacco maturity sample by using a flue-cured tobacco maturity classification model, wherein the flue-cured tobacco maturity model is established by using a linear discriminant analysis (LDA) classifier.

[0010] In one embodiment of the present disclosure, the flue-cured tobacco maturity samples are selected by 7 tobacco leaf grading experts, and the flue-cured tobacco in the upper, middle and lower parts are divided into three grades: mature, fairly mature and under-mature. 100 samples are made for each grade, and the state and morphology of the tobacco leaves are basically consistent. The sample tobacco leaves should be stored in frames in the warehouse. The humidity, temperature, insect and mildew conditions of the warehouse should meet the local warehouse storage conditions. The size, moisture content, and degree of shrinkage and curling of the tobacco leaves should be basically consistent.

[0011] In one embodiment of the present disclosure, the step of collecting spectral data of a flue-cured tobacco maturity sample includes:

[0012] A hyperspectral imaging system consisting of a hyperspectral camera mounting bracket, a movable lifting platform, a light source, and a scanning controller is used for data collection. During data collection, a white board calibration is first performed, then a dark current calibration is performed, and finally, the flue-cured tobacco leaves are placed on the lifting platform in turn. The scanning controller controls the hyperspectral camera to capture the hyperspectral information of the entire flue-cured tobacco leaf.

[0013] In one embodiment of the present disclosure, the preprocessing of the spectral data includes:

[0014] The sliding average filtering method and the multivariate scatter correction method are used successively to eliminate the noise in the signal. The principle formula of the sliding average filtering method is shown in (1):

[0015]

[0016] Where y[n] is the output signal after filtering, x[n] is the input signal at the current time n, m is the window size, that is, the number of samples involved in calculating the average, and k is an index from 0 to m-1, representing the M samples before the current time n;

[0017] The calculation steps of the multivariate scatter correction method include:

[0018] ① Calculate the average spectrum: Where N is the number of samples, X i is the spectrum of the i-th sample;

[0019] ② Centralization: Centralize each sample spectrum to obtain the centralized spectrum C i ,

[0021] ③ Calculate the covariance matrix: Calculate the covariance matrix of the centralized data

[0022] ④ Calculate MSC transformation coefficients: Use the covariance matrix to obtain the transformation coefficients T -1 R, where

[0024] ⑤Apply transformation: through formula Among them, Y i is the spectrum after multivariate scattering correction.

[0025] In one embodiment of the present disclosure, the SWO-ResNet model integrates the spider bee intelligent optimization algorithm SWO into the 1D-ResNet model to establish the SWO-ResNet model, and uses SWO to intelligently optimize the batch_size and epochs parameters in the 1D-ResNet model.

[0026] In one embodiment of the present disclosure, the 1D-ResNet model consists of a convolutional layer, a residual block, a pooling layer, and a fully connected layer. Each convolutional layer is connected to a batch normalization layer and an activation function layer. The output of the batch normalization layer is processed using a nonlinear activation function ReLU. Finally, a global average pooling layer and a fully connected layer are set, and a fully connected layer is added after the global average pooling layer.

[0027] In one embodiment of the present disclosure, the use of SWO to intelligently optimize batch_size and epochs parameters in the 1D-ResNet model includes:

[0028] Define the objective function as shown in formula (2) according to the accuracy and loss value, then update the population according to the spider bee update rule as shown in formula (3), and finally find the optimal objective function value through continuous iteration;

[0029] objective_function=-train_accuracy-test_accuracy+train_loss+test_loss (2)

[0030] perturbation=population[j]+random(1,2,2)*(best_position-population[j]) (3)

[0031] In formula (3), random(1,2,2) means randomly generating a two-dimensional array with element values ​​between 1 and 2, and then performing random perturbation according to popolation[j] and best_position according to the above formula, and perturbation is the element after random perturbation.

[0032] In one embodiment of the present disclosure, the specific steps of implementing the LDA classification model are:

[0033] ① Calculate the class mean: For each category K C , calculate its mean vector: Where N k is the number of samples in the kth class, x i is a sample belonging to this class;

[0034] ②Calculate the overall mean: Calculate the overall mean of all data points, Where K is the total number of categories and N is the total number of samples;

[0035] ③ Calculate the intra-class scatter matrix: intra-class scatter matrix S W Indicates the data distribution within each category.

[0036] ④ Calculate the inter-class scatter matrix: The inter-class scatter matrix describes the degree of separation between each category. Where N i is the number of samples in the i-th category, u i is the mean vector of the i-th class, and u is the overall mean vector of all samples.

[0037] According to another aspect of the present disclosure, a flue-cured tobacco maturity classification device is also provided, comprising:

[0038] The sample annotation module is used to obtain flue-cured tobacco maturity samples through expert annotation;

[0039] A data acquisition module, used for collecting spectral data of flue-cured tobacco maturity samples, preprocessing the spectral data, and obtaining processed spectral data;

[0040] A feature extraction module, used to extract features from the processed spectral data through a SWO-ResNet model to obtain spectral characteristic bands of the flue-cured tobacco maturity sample;

[0041] The sample classification module is used to classify the spectral characteristic bands of the flue-cured tobacco maturity sample by using a flue-cured tobacco maturity classification model, wherein the flue-cured tobacco maturity model is established using a linear discriminant analysis (LDA) classifier.

[0042] The beneficial effect of the present invention is that the present invention is based on the spectral feature of the flue-cured tobacco maturity classification method, the flue-cured tobacco leaf maturity sample is obtained by expert sample preparation, and then the spectral data of the flue-cured tobacco maturity sample is collected by a hyperspectral imaging system, and the spectral data is preprocessed by using a sliding average filter method and a multivariate scattering correction method, and then the spectral characteristic band of the flue-cured tobacco maturity is improved by using a SWO-ResNet model, and finally the flue-cured tobacco maturity is classified by using an LDA classification model. The present invention mainly adopts a machine learning method, and through a series of methods such as expert sample preparation, spectral characteristic band selection, and classification model classification, the classification of flue-cured tobacco maturity based on spectral characteristics is realized, and the characteristic description of the quality factor of maturity in the intelligent classification of tobacco leaves is improved, and the accuracy and reliability of the intelligent classification of tobacco leaves are improved. At the same time, the method is used to classify the maturity of flue-cured tobacco, and the classification effect is good and the operation stability is high, which can meet the needs of intelligent classification of tobacco leaves in industry.

[0043] Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0045] Figure 1 This is a flow chart of the method for classifying flue-cured tobacco maturity provided by an embodiment of the present invention.

[0046] Figure 2 This is a schematic diagram of the method for classifying the maturity of flue-cured tobacco provided in an embodiment of the present invention.

[0047] Figure 3 A physical picture of the hyperspectral acquisition and imaging system provided in an embodiment of the present invention.

[0048] Figure 4 This is a SWO-ResNet model framework diagram provided in an embodiment of the present invention.

[0049] Figure 5 The following is a flow chart of SWO optimization provided by an embodiment of the present invention.

[0050] Figure 6 A schematic diagram of the structure of a flue-cured tobacco maturity classification device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0051] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0052] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0053] In order to enable those skilled in the art to better understand the technical solution of the present disclosure, the present disclosure is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present disclosure.

[0054] Figure 1 FIG. 2 is a flow chart of a method for classifying flue-cured tobacco maturity provided by an embodiment of the present invention. Figure 1 As shown, in one embodiment, a flue-cured tobacco maturity classification method provided by the embodiment of the present disclosure comprises the following steps:

[0055] S1: Obtain flue-cured tobacco maturity samples through expert annotation;

[0056] S2: collecting spectral data of flue-cured tobacco maturity samples, preprocessing the spectral data, and obtaining processed spectral data;

[0057] S3: The processed spectral data is subjected to feature extraction through the SWO-ResNet model to obtain the spectral characteristic bands of the flue-cured tobacco maturity samples;

[0058] S4: The spectral characteristic bands of the flue-cured tobacco maturity samples are classified by the flue-cured tobacco maturity classification model. The flue-cured tobacco maturity model is established using the linear discriminant analysis (LDA) classifier.

[0059] like Figure 2As shown, the flue-cured tobacco maturity classification method based on spectral features obtains flue-cured tobacco leaf maturity samples through expert sample preparation, and then collects spectral data of the flue-cured tobacco maturity samples through a hyperspectral imaging system. After preprocessing the spectral data using a sliding average filter method and a multivariate scattering correction method, the SWO-ResNet model is used to improve the spectral characteristic bands of flue-cured tobacco maturity, and finally the LDA classification model is used to complete the classification of flue-cured tobacco maturity. The present invention mainly adopts a machine learning method, and through a series of methods such as expert sample preparation, spectral characteristic band selection, and classification model classification, realizes the classification of flue-cured tobacco maturity based on spectral features, improves the characteristic description of maturity as a quality factor in tobacco leaf intelligent grading, and improves the accuracy and reliability of tobacco leaf intelligent grading. At the same time, the method is used to classify the maturity of flue-cured tobacco, and the classification effect is good and the operation stability is high, which can meet the needs of tobacco leaf intelligent grading in industry.

[0060] In one embodiment, the maturity samples of flue-cured tobacco are selected by 7 tobacco leaf grading experts, and the flue-cured tobacco in the upper, middle and lower parts are divided into three grades: mature, fairly mature and under-mature. 100 samples are made for each grade, and the state and shape of the tobacco leaves are basically consistent. The sample tobacco leaves should be stored in frames in the warehouse. The humidity, temperature, insect and mildew conditions of the warehouse should meet the local warehouse storage conditions. The size, moisture content, and degree of shrinkage and curling of the tobacco leaves should be basically consistent.

[0061] like Figure 3 As shown, in one embodiment, collecting spectral data of a flue-cured tobacco maturity sample includes:

[0062] A hyperspectral imaging system consisting of a hyperspectral camera mounting bracket, a movable lifting platform, a light source, and a scanning controller is used for data collection. During data collection, a white board calibration is first performed, then a dark current calibration is performed, and finally, the flue-cured tobacco leaves are placed on the lifting platform in turn. The scanning controller controls the hyperspectral camera to capture the hyperspectral information of the entire flue-cured tobacco leaf.

[0063] In one embodiment, the spectral data is preprocessed, including:

[0064] The sliding average filtering method and the multivariate scatter correction method are used successively to eliminate the noise in the signal. The principle formula of the sliding average filtering method is shown in (1):

[0065]

[0066] Where y[n] is the output signal after filtering, x[n] is the input signal at the current time n, m is the window size, that is, the number of samples involved in calculating the average, and k is an index from 0 to m-1, representing the M samples before the current time n;

[0067] The calculation steps of the multivariate scatter correction method include:

[0068] ⑥Calculate the average spectrum: Where N is the number of samples, X i is the spectrum of the i-th sample;

[0069] ⑦ Centralization: Centralize each sample spectrum to obtain the centralized spectrum C i ,

[0070] ⑧Calculate the covariance matrix: Calculate the covariance matrix of the centralized data

[0071] ⑨ Calculate MSC transform coefficients: Use the covariance matrix to obtain the transform coefficients T -1 R, where

[0072] ⑩Apply transformation: through formula Among them, Y i is the spectrum after multivariate scattering correction.

[0073] In one embodiment, the SWO-ResNet model integrates the spider bee intelligent optimization algorithm SWO into the 1D-ResNet model to establish the SWO-ResNet model, and uses SWO to intelligently optimize the batch_size and epochs parameters in the 1D-ResNet model.

[0074] like Figure 4 As shown, in one embodiment, the 1D-ResNet model consists of a convolutional layer, a residual block, a pooling layer, and a fully connected layer. Each convolutional layer is connected to a batch normalization layer and an activation function layer. The output of the batch normalization layer is processed using a nonlinear activation function ReLU. Finally, a global average pooling layer and a fully connected layer are set, and a fully connected layer is added after the global average pooling layer.

[0075] Figure 5 The SWO optimization flow chart provided by the embodiment of the present invention. Figure 5 As shown, in one embodiment, SWO is used to intelligently optimize batch_size and epochs parameters in the 1D-ResNet model, including:

[0076] Define the objective function as shown in formula (2) according to the accuracy and loss value, then update the population according to the spider bee update rule as shown in formula (3), and finally find the optimal objective function value through continuous iteration;

[0077] objective_function=-train_accuracy-test_accuracy+train_loss+test_loss (2)

[0078] perturbation=popilation[j]+random(1,2,2)*(best_position-population[j]) (3)

[0079] In formula (3), random(1,2,2) means randomly generating a two-dimensional array with element values ​​between 1 and 2, and then performing random perturbation according to popolation[j] and best_position according to the above formula, and perturbation is the element after random perturbation.

[0080] In one embodiment, the specific steps of implementing the LDA classification model are:

[0081] ① Calculate the class mean: For each category C K , calculate its mean vector: Where N K is the number of samples in the kth class, x i is a sample belonging to this class;

[0082] ②Calculate the overall mean: Calculate the overall mean of all data points, Where K is the total number of categories and N is the total number of samples;

[0083] ③ Calculate the intra-class scatter matrix: intra-class scatter matrix S W Indicates the data distribution within each category.

[0084] ④ Calculate the inter-class scatter matrix: The inter-class scatter matrix describes the degree of separation between each category. Where N i is the number of samples in the i-th category, u i is the mean vector of the i-th class, and u is the overall mean vector of all samples.

[0085] In the disclosed embodiment, the flue-cured tobacco maturity classification method based on spectral features provided by the present invention is used to establish a classification model using the maturity samples of the upper, middle and lower flue-cured tobacco, respectively. The maturity classification accuracy of the three parts is 0.94, 0.9336 and 0.9578, respectively, and the performance of parameters such as AUC, Recall, Precision and F1 is also very good. The experimental results show that the maturity classification method of flue-cured tobacco provided by the present invention can achieve a good maturity classification effect by classifying the maturity of tobacco leaves in various parts, and provides a more objective distinction method for the problem that the maturity of flue-cured tobacco is difficult to distinguish.

[0086] Figure 6 FIG. 2 is a schematic diagram showing the structure of a flue-cured tobacco maturity classification device provided in an embodiment of the present disclosure. Figure 6 As shown, in one embodiment, a flue-cured tobacco maturity classification device according to an embodiment of the present disclosure includes:

[0087] The sample annotation module 610 is used to obtain the flue-cured tobacco maturity samples through expert annotation;

[0088] The data acquisition module 620 is used to collect the spectral data of the flue-cured tobacco maturity sample, pre-process the spectral data, and obtain processed spectral data;

[0089] The feature extraction module 630 is used to extract features from the processed spectral data through the SWO-ResNet model to obtain the spectral characteristic bands of the flue-cured tobacco maturity sample;

[0090] The sample classification module 640 is used to classify the spectral characteristic bands of the flue-cured tobacco maturity samples using a flue-cured tobacco maturity classification model. The flue-cured tobacco maturity model is established using a linear discriminant analysis (LDA) classifier.

[0091] In one embodiment, the sample labeling module 610 is used for selecting the maturity samples of flue-cured tobacco by seven tobacco leaf grading experts, and the flue-cured tobacco in the upper, middle and lower parts are respectively divided into three grades: mature, fairly mature and under-mature. 100 samples are made for each grade, and the state and shape of the tobacco leaves are basically consistent. The sample tobacco leaves should be stored in frames in the warehouse. The humidity, temperature, insect and mildew conditions of the warehouse should meet the local warehouse storage conditions. The size, moisture content, and degree of shrinkage and curling of the tobacco leaves should be basically consistent.

[0092] In one embodiment, the data acquisition module 620 is used to collect data using a hyperspectral imaging system consisting of a hyperspectral camera mounting bracket, a movable lifting platform, a light source, and a scanning controller. During the collection, a white board calibration is first performed, then a dark current calibration is performed, and finally, the flue-cured tobacco leaves are placed on the lifting platform in turn, and the scanning controller controls the hyperspectral camera to capture the hyperspectral information of the entire flue-cured tobacco leaf.

[0093] In one embodiment, the data acquisition module 620 is used to successively use a sliding average filtering method and a multivariate scatter correction method to eliminate noise in the signal. The principle formula of the sliding average filtering method is shown in (1):

[0094]

[0095] Where y[n] is the output signal after filtering, x[n] is the input signal at the current time n, m is the window size, that is, the number of samples involved in calculating the average, and k is an index from 0 to m-1, representing the M samples before the current time n;

[0096] The calculation steps of the multivariate scatter correction method include:

[0097] Compute the average spectrum: Where N is the number of samples, X i is the spectrum of the i-th sample;

[0098] Centralization: Centralize each sample spectrum to obtain the centralized spectrum C i ,

[0100] Calculate the covariance matrix: Calculate the covariance matrix of the centered data

[0101] Calculate MSC transform coefficients: Use the covariance matrix to obtain the transform coefficients T -1 R, where

[0102] Apply transformation: By formula Among them, Y i is the spectrum after multivariate scattering correction.

[0103] In one embodiment, the device also includes a model optimization module not shown in the accompanying drawings, which is used for the SWO-ResNet model to integrate the spider bee intelligent optimization algorithm SWO into the 1D-ResNet model to establish the SWO-ResNet model, and use SWO to intelligently optimize the batch_size and epochs parameters in the 1D-ResNet model.

[0104] In one embodiment, the 1D-ResNet model consists of a convolutional layer, a residual block, a pooling layer, and a fully connected layer. Each convolutional layer is connected to a batch normalization layer and an activation function layer. The output of the batch normalization layer is processed using a nonlinear activation function ReLU. Finally, a global average pooling layer and a fully connected layer are set, and a fully connected layer is added after the global average pooling layer.

[0105] In one embodiment, the model optimization module is used to define the objective function as shown in formula (2) according to the accuracy and the loss value, and then update the population according to the spider bee update rule as shown in formula (3), and finally find the optimal objective function value according to continuous iteration;

[0106] objective_function=-train_accuracy-test_accuracy+train_loss+test_loss (2)

[0107] perturbation=population[j]+random(1,2,2)*(best_position-population[j]) (3)

[0108] In formula (3), random(1,2,2) means randomly generating a two-dimensional array with element values ​​between 1 and 2, and then performing random perturbation according to popolation[j] and best_position according to the above formula, and perturbation is the element after random perturbation.

[0109] In one embodiment, the sample classification module 640 is used to implement the specific steps of implementing the LDA classification model:

[0110] ① Calculate the class mean: For each category C K , calculate its mean vector: Where N k is the number of samples in the kth class, x i is a sample belonging to this class;

[0111] ②Calculate the overall mean: Calculate the overall mean of all data points, Where K is the total number of categories and N is the total number of samples;

[0112] ③ Calculate the intra-class scatter matrix: intra-class scatter matrix S W Indicates the data distribution within each category.

[0113] ④ Calculate the inter-class scatter matrix: The inter-class scatter matrix describes the degree of separation between each category. Where N iis the number of samples in the i-th category, u i is the mean vector of the i-th class, and u is the overall mean vector of all samples.

[0114] In the disclosed embodiment, the classification model is established using the maturity samples of the upper, middle and lower parts of the flue-cured tobacco, and the maturity classification accuracy of the three parts is 0.94, 0.9336 and 0.9578 respectively, and the performance of parameters such as AUC, Recall, Precision and F1 is also very good. The experimental results show that the maturity classification method of flue-cured tobacco provided by the present invention can achieve a good maturity classification effect by classifying the maturity of tobacco leaves in various parts, and provide a more objective distinction method for the problem that the maturity of flue-cured tobacco is difficult to distinguish.

[0115] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any simple modification, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention are still within the scope of the technical solution of the present invention.

Claims

1. A method for classifying flue-cured tobacco maturity, characterized in that: include: S1: Obtaining flue-cured tobacco maturity samples through expert annotation; S2: collecting spectral data of a flue-cured tobacco maturity sample, and preprocessing the spectral data to obtain processed spectral data; S3: extracting features from the processed spectral data through a SWO-ResNet model to obtain spectral characteristic bands of the flue-cured tobacco maturity sample; S4: classifying the spectral characteristic bands of the flue-cured tobacco maturity sample by using a flue-cured tobacco maturity classification model, wherein the flue-cured tobacco maturity model is established by using a linear discriminant analysis (LDA) classifier.

2. The method for classifying flue-cured tobacco maturity according to claim 1, wherein: The flue-cured tobacco maturity samples are selected by 7 tobacco grading experts, and the flue-cured tobacco from the upper, middle and lower parts are divided into three grades: mature, fairly mature and under-mature. 100 samples are made for each grade, and the state and shape of the tobacco leaves are guaranteed to be basically consistent. The sample tobacco leaves should be stored in frames in the warehouse. The humidity, temperature, insect and mildew conditions of the warehouse should conform to the local warehouse storage conditions. The size, moisture content, and degree of shrinkage and curling of the tobacco leaves should be guaranteed to be basically consistent.

3. The method for classifying flue-cured tobacco maturity according to claim 1, characterized in that: The method of collecting spectral data of the flue-cured tobacco maturity sample includes: A hyperspectral imaging system consisting of a hyperspectral camera mounting bracket, a movable lifting platform, a light source, and a scanning controller is used for data collection. During data collection, a white board calibration is first performed, then a dark current calibration is performed, and finally, the flue-cured tobacco leaves are placed on the lifting platform in turn. The scanning controller controls the hyperspectral camera to capture the hyperspectral information of the entire flue-cured tobacco leaf.

4. The method for classifying flue-cured tobacco maturity according to claim 1, characterized in that: The preprocessing of the spectral data comprises: The sliding average filtering method and the multivariate scatter correction method are used successively to eliminate the noise in the signal. The principle formula of the sliding average filtering method is shown in (1): Where y[n] is the output signal after filtering, x[n] is the input signal at the current time n, m is the window size, that is, the number of samples involved in calculating the average, and k is an index from 0 to m-1, representing the M samples before the current time n; The calculation steps of the multivariate scatter correction method include: ① Calculate the average spectrum: Where N is the number of samples, X i is the spectrum of the i-th sample; ② Centralization: Centralize each sample spectrum to obtain the centralized spectrum C i , ③ Calculate the covariance matrix: Calculate the covariance matrix of the centralized data ④ Calculate MSC transformation coefficients: Use the covariance matrix to obtain the transformation coefficient T -1 R, where ⑤Apply transformation: through formula Among them, Y i is the spectrum after multivariate scattering correction.

5. The method for classifying flue-cured tobacco maturity according to claim 1, characterized in that: The SWO-ResNet model integrates the spider bee intelligent optimization algorithm SWO into the 1D-ResNet model to establish the SWO-ResNet model, and uses SWO to intelligently optimize the batch_size and epochs parameters in the 1D-ResNet model.

6. The method for classifying flue-cured tobacco maturity according to claim 5, characterized in that: The 1D-ResNet model consists of a convolutional layer, a residual block, a pooling layer, and a fully connected layer. Each convolutional layer is connected to a batch normalization layer and an activation function layer. The output of the batch normalization layer is processed using a nonlinear activation function ReLU. Finally, a global average pooling layer and a fully connected layer are set, and a fully connected layer is added after the global average pooling layer.

7. The method for classifying flue-cured tobacco maturity according to claim 5, characterized in that: The use of SWO to intelligently optimize the batch_size and epochs parameters in the 1D-ResNet model includes: Define the objective function as shown in formula (2) according to the accuracy and loss value, then update the population according to the spider bee update rule as shown in formula (3), and finally find the optimal objective function value through continuous iteration; objective_function=-train_accuracy-test_accuracy+train_loss+test_loss(2) perturbation=population[j]+random(1,2,2)*(best_position-population[j]) (3) In formula (3), random(1,2,2) means randomly generating a two-dimensional array with element values ​​between 1 and 2, and then performing random perturbation according to popolation[j] and best_position according to the above formula, and perturbation is the element after random perturbation.

8. The method for classifying flue-cured tobacco maturity according to claim 1, characterized in that: The specific steps of implementing the LDA classification model are: ① Calculate the class mean: For each category C K , calculate its mean vector: Where N K is the number of samples in the kth class, x i are samples belonging to this class; ②Calculate the overall mean: Calculate the overall mean of all data points, Where K is the total number of categories and N is the number of all samples; ③ Calculate the intra-class scatter matrix: intra-class scatter matrix S W Indicates the data distribution within each category. ④ Calculate the inter-class scatter matrix: The inter-class scatter matrix describes the degree of separation between each category. Where N i is the number of samples in the i-th category, u i is the mean vector of the i-th class, and u is the overall mean vector of all samples.

9. A flue-cured tobacco maturity classification device, characterized in that: include: The sample annotation module is used to obtain flue-cured tobacco maturity samples through expert annotation; A data acquisition module, used for collecting spectral data of flue-cured tobacco maturity samples, preprocessing the spectral data, and obtaining processed spectral data; A feature extraction module, used to extract features from the processed spectral data through a SWO-ResNet model to obtain spectral characteristic bands of the flue-cured tobacco maturity sample; The sample classification module is used to classify the spectral characteristic bands of the flue-cured tobacco maturity sample by using a flue-cured tobacco maturity classification model, wherein the flue-cured tobacco maturity model is established using a linear discriminant analysis (LDA) classifier.

Citation Information

Cited By

  • Method for rapidly evaluating compost maturity based on hyperspectral imaging and machine learning

    CN121366652A