Cigar tobacco leaf producing area discrimination method based on near infrared spectrum data
By using a one-dimensional convolutional neural network in the identification of cigar leaf origin, combining attention mechanism and deep feature extraction module, the problems of low efficiency of cigar leaf origin discrimination and limited feature extraction capability in the prior art are solved, and efficient and accurate discrimination of cigar leaf origin is achieved.
Patent Information
- Application Number
- CN202510103271.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2045-01-22
AI Technical Summary
The prior art has problems such as high subjectivity, time-consuming and inefficient, and limited feature extraction capabilities when processing near-infrared spectral data in the discrimination of cigar leaf origin.
Using a one-dimensional convolutional neural network method, combined with shallow feature extraction module, attention mechanism module, deep feature extraction module and classification module, pre-processing and feature extraction through near-infrared spectral data, cross-entropy loss is constructed and trained using Adam optimizer to achieve efficient and accurate judgment of the origin of cigar tobacco leaves.
It improves the accuracy and efficiency of cigar tobacco leaves's origin discrimination, reduces labor and time costs, provides reliable decision-making support, and provides stable discrimination performance for cigar tobacco leaves information management.
Smart Images

Figure CN119863710A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of tobacco leaf processing and detection, in particular to a method for distinguishing the origin of cigar tobacco leaves based on near-infrared spectral data. Background Art
[0002] In the tobacco industry, the origin of cigar tobacco has a crucial impact on its quality, flavor and market value. Factors such as soil texture, climate conditions, and light duration in different origins give cigar tobacco unique chemical composition and physical properties, which in turn determine the final quality of the cigar. Accurately identifying the origin of cigar tobacco is of great significance to ensuring the stability of cigar product quality.
[0003] Traditionally, the origin of cigars has been determined by sensory testing, such as smell, taste, and the quality of smoke produced when cigar tobacco leaves are burned. However, this method is highly subjective, time-consuming, labor-intensive, and inefficient, and it is difficult to meet the needs of large-scale production and rapid testing.
[0004] With the advancement of technology, near-infrared spectroscopy technology has been combined with a variety of soft computing methods to be applied in the identification of tobacco leaf origin, such as discriminant analysis and cluster analysis, but there are still some shortcomings. On the one hand, some algorithms have limited feature extraction capabilities when processing near-infrared spectral data. Near-infrared spectral data is high-dimensional and complex. Some algorithms are easily disturbed when extracting features and cannot effectively mine key information in the data, which in turn affects the accuracy of the discriminant model. On the other hand, some algorithms have complex network structures, numerous parameters, a long training process, and strict requirements on hardware equipment, which greatly limits their wide application in actual scenarios. Summary of the invention
[0005] The present invention aims to solve the deficiencies of the above-mentioned prior art and proposes a method for distinguishing the origin of cigar tobacco leaves based on near-infrared spectral data, so as to quickly and efficiently extract the spectral characteristics of cigar tobacco leaves, thereby accurately judging the origin of cigar tobacco leaves and reducing labor costs and time costs.
[0006] In order to achieve the above-mentioned purpose, the present invention adopts the following technical scheme:
[0007] The method for identifying the origin of cigar tobacco leaves based on near infrared spectroscopy data of the present invention is characterized in that it is carried out according to the following steps:
[0008] Step 1: Use a near-infrared spectrometer to collect spectra of cigar leaves, obtain near-infrared spectral data of N cigar leaves, and pre-process them to obtain a pre-processed near-infrared spectral data set of cigar leaves, which is recorded as ,in, Indicates The preprocessed spectral data samples of cigar tobacco leaves; The corresponding real origin identification label set is ,in, express The real origin identification label;
[0009] Step 2: Establish a one-dimensional convolutional network, including: shallow feature extraction module, attention mechanism module, deep feature extraction module and classification module;
[0010] Step 2.1, the shallow feature extraction module includes a one-dimensional convolution layer, a batch normalization layer, and a maximum pooling layer in sequence, and After processing, the shallow spectral feature dataset of cigar tobacco leaves is obtained. ,in, Indicates Shallow spectral characteristics of cigar tobacco leaves;
[0011] Step 2.2, the attention mechanism module is composed of a channel attention block and a post-processing feature block in sequence, and Processing is performed to obtain the weighted spectral feature data set of cigar tobacco leaves ;
[0012] Step 2.3: The depth feature extraction module includes A basic feature extraction block, a maximum pooling layer and an adaptive average pooling layer, and Processing to obtain the deep spectral feature dataset of cigar tobacco leaves ;
[0013] Step 2.4: Input into the classification module for processing to obtain the predicted result set of cigar tobacco leaves ,in, express The prediction results;
[0014] Step 3: Based on and A cross entropy loss is constructed, and the one-dimensional convolutional network is trained using the Adam optimizer. The cross entropy loss is calculated to update the network parameters until the training is completed when the number of iterations reaches the maximum number of iterations or the cross entropy loss value reaches the minimum, thereby obtaining the optimal cigar tobacco leaf origin prediction model after training and deploying it on the ZYNQ device for distinguishing the cigar tobacco leaf origin.
[0015] The method for identifying the origin of cigar tobacco leaves based on near infrared spectroscopy data of the present invention is also characterized in that step 2.2 is performed as follows:
[0016] Step 2.2.1, the channel attention block consists of an adaptive average pooling layer, two fully connected layers, a ReLU activation layer and a Sigmoid function, and After processing, we get the attention-weighted shallow spectral feature dataset of cigar tobacco leaves ;
[0017] Step 2.2.2, the post-processing feature block consists of a one-dimensional convolution layer, a ReLU activation layer, and a maximum pooling layer. Processing is performed to obtain the weighted spectral feature data set of cigar tobacco leaves .
[0018] Further, step 2.2.1 is performed as follows:
[0019] Step 2.2.1.1. The input channel is processed in the attention block and processed by the adaptive average pooling layer to obtain the pooled shallow spectral feature dataset of cigar tobacco leaves. ,in, Indicates Pooled shallow spectral feature data of cigar leaves;
[0020] Step 2.2.1.2: After being processed by the first fully connected layer, the first ReLU activation layer, and the second fully connected layer in the channel attention block, the pre-weighted shallow spectral feature dataset of cigar tobacco leaves is obtained. ,in, Indicates Pre-weighted shallow spectral feature data of cigar tobacco leaves;
[0021] Step 2.2.1.3, use the Sigmoid function Mapping is performed to obtain the channel attention weight dataset of cigar tobacco leaves ,in, express The channel attention weight of
[0022] Step 2.2.1.4: Expand to The size of is consistent, and the final channel attention weight of the cigar leaf is obtained ,in, express The final channel attention weight of
[0023] Step 2.2.1.5: and Multiply them together to get the attention-weighted shallow spectral feature dataset of cigar tobacco leaves ,in, Indicates Attention-weighted shallow spectral feature data of cigar tobacco leaves.
[0024] Further, step 2.2.2 is performed as follows:
[0025] Step 2.2.2.1. The data is input into the post-processing feature block for processing. After being processed by the one-dimensional convolution layer and the ReLU activation layer, the post-processing spectral feature dataset of the cigar tobacco leaves is obtained. ,in, Indicates Post-processed spectral characteristic data of cigar tobacco leaves;
[0026] Step 2.2.2.2. The data is input into the maximum pooling layer in the post-processing feature block to obtain the weighted spectral feature dataset of the cigar tobacco leaves. ,in, Indicates Weighted spectral characteristic data of cigar tobacco leaves.
[0027] Furthermore, step 2.3 is performed as follows:
[0028] Step 2.3.1, any The basic feature extraction block includes: a one-dimensional convolution layer, a batch normalization layer, and a ReLU activation layer;
[0029] when hour, Enter the The first level basic feature extraction block is used to process the cigar leaf Deep progressive convolutional spectral feature dataset ,in, Indicates Cigar leaves Deep progressive convolution of spectral feature data;
[0030] when When Deep progressive convolutional spectral feature dataset Enter the The first-level basic feature extraction block is processed and the , thus by The output of the first basic feature extraction block A dataset of deep progressive convolutional spectral features of cigar tobacco leaves ,in, Indicates Deep progressive convolution spectral feature data of cigar tobacco leaves;
[0031] Step 2.3.2, order The deep spectral feature dataset of cigar tobacco leaves is obtained by sequentially processing the maximum pooling layer and the adaptive average pooling layer in the deep feature extraction module. ,in, Indicates Deep spectral feature data of cigar tobacco leaves.
[0032] The electronic device of the present invention includes a memory and a processor, wherein the memory is used to store a program that supports the processor to execute the method for identifying the origin of cigar tobacco leaves, and the processor is configured to execute the program stored in the memory.
[0033] The present invention provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and the computer program executes the steps of the method for distinguishing the origin of cigar tobacco leaves when the computer program is run by a processor.
[0034] Compared with the prior art, the present invention has the following beneficial effects:
[0035] 1. The present invention performs spectral feature learning based on a one-dimensional convolutional neural network, which can capture the characteristics of near-infrared spectral data; through model fine-tuning and prediction, the cigar tobacco leaf spectral data can be efficiently and accurately discriminated; this discrimination method can improve the accuracy and efficiency of discrimination, and provide reliable decision support for cigar tobacco leaf information management.
[0036] 2. The present invention uses the channel attention mechanism to capture the information between spectral data, which improves the model's ability to perceive and capture the differences in spectral data of cigar tobacco leaves from different origins. At the same time, the deep feature extraction module mines deep spectral feature information, so that the model can still maintain stable discrimination performance when facing slight fluctuations or noise interference in the data, and has good adaptability and robustness, providing reliable protection for complex scenarios in practical applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a schematic diagram of the process of the present invention;
[0038] Figure 2 This is a structural diagram of the shallow feature extraction module of the present invention;
[0039] Figure 3 This is a structural diagram of the attention mechanism module of the present invention;
[0040] Figure 4 This is a structural diagram of the deep feature extraction module of the present invention;
[0041] Figure 5 This is a structural diagram of the classification module of the present invention. DETAILED DESCRIPTION
[0042] In this embodiment, a method for identifying the origin of cigar tobacco leaves based on near-infrared spectral data is described as follows: Figure 1 As shown, the following steps are included:
[0043] Step 1: Use a near-infrared spectrometer to collect spectra of cigar leaves, obtain N near-infrared spectrum data samples of cigar leaves, and pre-process them to obtain a pre-processed near-infrared spectrum data set of cigar leaves, which is recorded as ,in, Indicates The preprocessed spectral data of a cigar leaf; The corresponding real origin identification label set is ,in, express The real origin identification label is obtained; in this embodiment, a self-built cigar tobacco leaf near-infrared spectrum data set is used, which contains the near-infrared spectrum data of cigar tobacco leaves from 9 origins. The samples are divided by random method, 80% as the training set and 20% as the test set; after the division, the training set and the test set are preprocessed by standard normal variable transformation to obtain the preprocessed near-infrared spectrum training set and test set of cigar tobacco leaves.
[0044] Step 2: Establish a one-dimensional convolutional network, including: shallow feature extraction module, attention mechanism module, deep feature extraction module and classification module;
[0045] Step 2.1: Figure 2 As shown, the shallow feature extraction module includes a one-dimensional convolution layer, a batch normalization layer, and a maximum pooling layer in sequence;
[0046] Will Input into the shallow feature extraction module for processing to obtain the shallow spectral feature dataset of cigar tobacco leaves ,in, Indicates Shallow spectral features of cigar tobacco leaves; in this example, the convolution kernel of the one-dimensional convolution layer is 1×7, the convolution step is 2, the padding is 3, and the number of output channels is 64; the pooling kernel size of the maximum pooling layer is 1×3, and the pooling step is 2.
[0047] Step 2.2: Figure 3As shown in Figure 1, the attention mechanism module is composed of a channel attention block and a post-processing feature block in sequence; the channel attention block is composed of an adaptive average pooling layer, two fully connected layers, a ReLU activation layer, and a Sigmoid function; the post-processing feature block is composed of a one-dimensional convolutional layer, a ReLU activation layer, and a maximum pooling layer;
[0048] Step 2.2.1. The input channel attention block is processed to obtain the attention-weighted shallow spectral feature dataset of cigar tobacco leaves. .
[0049] Step 2.2.1.1. The input channel is processed in the attention block and processed by the adaptive average pooling layer to obtain the pooled shallow spectral feature dataset of cigar tobacco leaves. ,in, Indicates Pooled shallow spectral feature data of cigar leaves;
[0050] Step 2.2.1.2: After being processed by the first fully connected layer, the first ReLU activation layer, and the second fully connected layer in the channel attention block, the pre-weighted shallow spectral feature dataset of cigar tobacco leaves is obtained. ,in, Indicates Pre-weighted shallow spectral feature data of cigar tobacco leaves;
[0051] Step 2.2.1.3, use the Sigmoid function Mapping is performed to obtain the channel attention weight dataset of cigar tobacco leaves ,in, express The channel attention weights of .
[0052] Step 2.2.1.4: Expand to The size of is consistent, and the final channel attention weight of the cigar leaf is obtained ,in, express The final channel attention weight; in this example, the correlation of each channel is calculated through the channel attention mechanism, and the resulting matrix Able to adaptively update the weights of each channel.
[0053] Step 2.2.1.5: and Multiply them together to get the attention-weighted shallow spectral feature dataset of cigar tobacco leaves ,in, Indicates Attention-weighted shallow spectral feature data of cigar tobacco leaves.
[0054] Step 2.2.2: Input into the post-processing feature block for processing to obtain the weighted spectral feature dataset of cigar tobacco leaves ;
[0055] Step 2.2.2.1. The data is input into the post-processing feature block for processing, and after being processed by the one-dimensional convolution layer and the ReLU activation layer, the post-processing spectral feature dataset of the cigar tobacco leaves is obtained. ,in, Indicates The post-processed spectral feature data of cigar tobacco leaves; in this example, the convolution kernel of the one-dimensional convolution layer is 1×3, the convolution step is 1, the padding is 1, and the number of output channels is 64.
[0056] Step 2.2.2.2. The data is input into the maximum pooling layer in the post-processing feature block to obtain the weighted spectral feature dataset of the cigar tobacco leaves. ,in, Indicates The weighted spectral feature data of cigar tobacco leaves; in this example, the pooling kernel size of the maximum pooling layer is 1×3, and the pooling step size is 2.
[0057] Step 2.3: Figure 4 As shown, the deep feature extraction module includes basic feature extraction blocks, a maximum pooling layer, and an adaptive average pooling layer, where any The basic feature extraction block includes a one-dimensional convolution layer, a batch normalization layer, and a ReLU activation layer; in this embodiment Take 4 to make the model achieve the best discrimination accuracy.
[0058] Step 2.3.1: hour, Enter the The first level basic feature extraction block is used to process the cigar leaf Deep progressive convolutional spectral feature dataset ,in, Indicates Cigar leaves Deep progressive convolution spectral feature data; in this example, the convolution kernel of the first-level one-dimensional convolution layer is 1×3, the convolution step is 1, and the padding is 1. After output The number of channels is 128.
[0059] when When Deep progressive convolutional spectral feature dataset Enter the The first-level basic feature extraction block is processed and the , thus by The output of the first basic feature extraction block A dataset of deep progressive convolutional spectral features of cigar tobacco leaves ,in, Indicates The deep progressive convolution spectral feature data of cigar tobacco leaves; in this example, the convolution kernel of each level of one-dimensional convolution layer is 1×3, the convolution step is 1, the padding is 1, and the output of the second level one-dimensional convolution layer is The number of channels is 256, and the output of the third-level one-dimensional convolutional layer is The number of channels is 256, and the output of the 4th level one-dimensional convolutional layer is The number of channels is 256.
[0060] Step 2.3.2, order The deep spectral feature dataset of cigar tobacco leaves is obtained by sequentially processing the maximum pooling layer and the adaptive average pooling layer in the deep feature extraction module. ,in, Indicates The deep spectral feature data of cigar tobacco leaves; in this example, the pooling kernel size of the maximum pooling layer is 1×3, and the pooling step size is 2.
[0061] Step 2.4: The structure of the classification module is as follows Figure 5 As shown, Input into the classification module for processing to obtain the predicted result set of cigar tobacco leaves ,in, express prediction results.
[0062] Step 3: Based on and Construct a cross entropy loss, and use the Adam optimizer to train the one-dimensional convolutional network, calculate the cross entropy loss to update the network parameters, and complete the training until the number of iterations reaches the maximum number of iterations or the cross entropy loss value reaches the minimum, so as to obtain the optimal cigar tobacco origin prediction model after training and deploy it on the ZYNQ device for distinguishing the origin of cigar tobacco leaves. In this embodiment, the initial value of the learning rate, the decay index, the change of the model loss value and the accuracy rate are adjusted according to the training results, so as to obtain the optimal cigar tobacco origin prediction model after training. After obtaining the optimal cigar tobacco origin prediction model, the test set data is input into the model to obtain the cigar tobacco origin discrimination result of the test set. In addition, the optimal cigar tobacco origin prediction model is deployed on the ZYNQ device, and the collected spectral data is transmitted to the device in the ZYNQ through the single-chip microcomputer for cigar origin discrimination, and the classification results are printed on the screen to achieve real-time discrimination of the cigar origin.
[0063] In this embodiment, an electronic device includes a memory and a processor, wherein the memory is used to store a program that supports the processor to execute the above method, and the processor is configured to execute the program stored in the memory.
[0064] In this embodiment, a computer-readable storage medium stores a computer program on the computer-readable storage medium, and the computer program executes the steps of the above method when executed by a processor.
Claims
1. A method for identifying the origin of cigar tobacco leaves based on near infrared spectroscopy data, characterized in that: The steps are as follows: Step 1: Use a near-infrared spectrometer to collect spectra of cigar leaves, obtain near-infrared spectral data of N cigar leaves, and pre-process them to obtain a pre-processed near-infrared spectral data set of cigar leaves, which is recorded as ,in, Indicates The preprocessed spectral data samples of cigar tobacco leaves; The corresponding real origin identification label set is ,in, express The real origin identification label; Step 2: Establish a one-dimensional convolutional network, including: shallow feature extraction module, attention mechanism module, deep feature extraction module and classification module; Step 2.1, the shallow feature extraction module includes a one-dimensional convolution layer, a batch normalization layer, and a maximum pooling layer in sequence, and After processing, the shallow spectral feature dataset of cigar tobacco leaves is obtained. ,in, Indicates Shallow spectral characteristics of cigar tobacco leaves; Step 2.2, the attention mechanism module is composed of a channel attention block and a post-processing feature block in sequence, and Processing is performed to obtain the weighted spectral feature data set of cigar tobacco leaves ; Step 2.3: The depth feature extraction module includes A basic feature extraction block, a maximum pooling layer and an adaptive average pooling layer, and Processing to obtain the deep spectral feature dataset of cigar tobacco leaves ; Step 2.4: Input into the classification module for processing to obtain the predicted result set of cigar tobacco leaves ,in, express The prediction results; Step 3: Based on and A cross entropy loss is constructed, and the one-dimensional convolutional network is trained using the Adam optimizer. The cross entropy loss is calculated to update the network parameters until the training is completed when the number of iterations reaches the maximum number of iterations or the cross entropy loss value reaches the minimum, thereby obtaining the optimal cigar tobacco leaf origin prediction model after training and deploying it on the ZYNQ device for distinguishing the cigar tobacco leaf origin.
2. The method for identifying the origin of cigar tobacco leaves based on near infrared spectroscopy data according to claim 1, characterized in that: Step 2.2 is performed as follows: Step 2.2.1, the channel attention block consists of an adaptive average pooling layer, two fully connected layers, a ReLU activation layer and a Sigmoid function, and After processing, we get the attention-weighted shallow spectral feature dataset of cigar tobacco leaves ; Step 2.2.2, the post-processing feature block consists of a one-dimensional convolution layer, a ReLU activation layer, and a maximum pooling layer. Processing is performed to obtain the weighted spectral feature data set of cigar tobacco leaves .
3. The method for identifying the origin of cigar tobacco leaves based on near infrared spectroscopy data according to claim 2, characterized in that: Step 2.2.1 is performed as follows: Step 2.2.1.
1. The input channel is processed in the attention block and processed by the adaptive average pooling layer to obtain the pooled shallow spectral feature dataset of cigar tobacco leaves. ,in, Indicates Pooled shallow spectral feature data of cigar leaves; Step 2.2.1.2: After being processed by the first fully connected layer, the first ReLU activation layer, and the second fully connected layer in the channel attention block, the pre-weighted shallow spectral feature dataset of cigar tobacco leaves is obtained. ,in, Indicates Pre-weighted shallow spectral feature data of cigar tobacco leaves; Step 2.2.1.3, use the Sigmoid function Mapping is performed to obtain the channel attention weight dataset of cigar tobacco leaves ,in, express The channel attention weight of Step 2.2.1.4: Expand to The size of is consistent, and the final channel attention weight of the cigar leaf is obtained ,in, express The final channel attention weight of Step 2.2.1.5: and Multiply them together to get the attention-weighted shallow spectral feature dataset of cigar tobacco leaves ,in, Indicates Attention-weighted shallow spectral feature data of cigar tobacco leaves.
4. The method for identifying the origin of cigar tobacco leaves based on near infrared spectroscopy data according to claim 2, characterized in that: Step 2.2.2 is performed as follows: Step 2.2.2.
1. The data is input into the post-processing feature block for processing. After being processed by the one-dimensional convolution layer and the ReLU activation layer, the post-processing spectral feature dataset of the cigar tobacco leaves is obtained. ,in, Indicates Post-processed spectral characteristic data of cigar tobacco leaves; Step 2.2.2.
2. The data is input into the maximum pooling layer in the post-processing feature block to obtain the weighted spectral feature dataset of the cigar tobacco leaves. ,in, Indicates Weighted spectral characteristic data of cigar tobacco leaves.
5. The method for identifying the origin of cigar tobacco leaves based on near infrared spectroscopy data according to claim 1, characterized in that: Step 2.3 is performed as follows: Step 2.3.1, any The basic feature extraction block includes: a one-dimensional convolution layer, a batch normalization layer, and a ReLU activation layer; when hour, Enter the The first level basic feature extraction block is used to process the cigar leaf Deep progressive convolutional spectral feature dataset ,in, Indicates Cigar leaves Deep progressive convolution of spectral feature data; when When Deep progressive convolutional spectral feature dataset Enter the The first-level basic feature extraction block is processed and the , thus by The output of the first basic feature extraction block A dataset of deep progressive convolutional spectral features of cigar tobacco leaves ,in, Indicates Deep progressive convolution spectral feature data of cigar tobacco leaves; Step 2.3.2, order The deep spectral feature dataset of cigar tobacco leaves is obtained by sequentially processing the maximum pooling layer and the adaptive average pooling layer in the deep feature extraction module. ,in, Indicates Deep spectral feature data of cigar tobacco leaves.
6. An electronic device, comprising a memory and a processor, characterized in that: The memory is used to store a program that supports the processor to execute the method for identifying the origin of cigar tobacco leaves as described in any one of claims 1 to 5, and the processor is configured to execute the program stored in the memory.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for identifying the origin of cigar tobacco leaves according to any one of claims 1 to 5 are executed.
Citation Information
Patent Citations
Cigar tobacco grading method based on deep learning
CN115294020A
Tobacco leaf producing area identification method and system based on near infrared spectrum data and medium
CN116202990A
Method and system for synchronously identifying grades of multiple tobacco leaves based on improved YOLOv7
CN117456525A
Method and system of detecting foreign materials within an agricultural product stream
US20180100810A1
Hyperspectral imaging analytical method for determining tobacco components and levels thereof
WO2024218360A1
Cited By
Industrial online detection method and system based on near infrared spectrum and medium
CN120807489A