Method and system for detecting non-tobacco substances in flue-cured tobacco
By establishing a database of non-smoking substances and building detection models, identifying the source of impurities and generating control instructions, the problems of insufficient analysis in the existing technology are solved, efficient detection and automated management of non-smoking substances in tobacco cured tobacco are realized, and production efficiency and product quality are improved.
Patent Information
- Application Number
- CN202510520970.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-08-05
AI Technical Summary
The analysis of the dynamic change trends and influencing factors of non-toxin substances in tobacco cured tobacco in the prior art has not formed a systematic research framework, which makes it difficult for the detection results to effectively guide production practice.
Establish a non-smoking substance database, collect physical characteristics and spectral information of tobacco leaves and non-smoking substances, perform denoising, standardizing and feature extraction, build a non-smoking substance detection model, identify the source of impurities through UNet network and discriminators, and generate control instructions for removing impurities to achieve automated and intelligent management.
It improves the accuracy and efficiency of non-smoking substance detection, can understand the source of impurities more intuitively, generate effective removal control instructions, and improve production efficiency and product quality.
Smart Images

Figure CN120431383A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of non-smoking substance detection, and in particular to a method and system for detecting non-smoking substances in flue-cured tobacco. Background Art
[0002] Non-tobacco substances refer to any form of organic or inorganic substances that do not belong to tobacco itself, including organic and inorganic substances. Organic non-tobacco substances include flue-cured tobacco stems, grass, wood poles, corn cobs, tobacco branches, food, tree or plant fruits, animals or insects and their fur, etc.; inorganic non-tobacco substances include paper (such as labels, tissue paper), metal objects, stones, etc. In addition, non-tobacco substances are divided into Class I, Class II and Class III according to the degree of harm they cause to tobacco leaves. Class I is the most harmful biological organisms, such as animal bodies and insect eggs. Traditional detection methods include visual inspection, screening methods, and photoelectric rejection equipment. For example, in the redrying process, non-tobacco substances in the leaves are separated by setting up a non-tobacco substance detection table and photoelectric rejection equipment.
[0003] Prior art one, a Chinese patent (Patent No. 202410285918.9), provides a training method, apparatus, device, and storage medium for a non-tobacco substance detection model. The method includes: collecting photos of tobacco leaves on a conveyor belt as training images; labeling the training images for various non-tobacco substances; and performing data augmentation on the labeled training images to obtain a complete labeled training set; using the labeled training set to train a target detection model. During the training process, the parameters of the target detection model are corrected using an integrated loss value, resulting in a corresponding non-tobacco substance detection model. While using a high-performance and improved target detection model as a training model for non-tobacco substance detection has significant practical value, data statistics and analysis are insufficient, and a systematic research framework for analyzing the dynamic trends and influencing factors of non-tobacco substances has not yet been established, making it difficult for detection results to effectively guide production practice.
[0004] Prior art 2, Chinese patent No. 202410903714.7, discloses an online detection method and system for non-tobacco substances based on area array spectral imaging. This method involves image segmentation technology for industrial detection within industrial artificial intelligence technology. The method includes the following steps: hardware construction for the imaging system, using a 7-channel spectral camera and a 3-channel visible light camera to construct the imaging hardware; camera calibration, geometric calibration of the cameras to achieve image alignment; data acquisition and annotation, collecting and annotating images from a tobacco leaf impurity removal pipeline to construct a dataset; and constructing a fusion feature extraction network model. The encoder-decoder network MSFSNet is designed, using 10-channel image data as input, adding a point-by-point convolutional feature extraction branch and a SIPNet multi-layer perceptron. While this method, based on area array spectral imaging and image semantic segmentation technology, combines spectral and visible light data for analysis and processing, fully utilizing the target spectral characteristics to significantly improve detection accuracy while ensuring real-time performance, it suffers from insufficient data statistics and analysis, and lacks a systematic research framework for analyzing the dynamic trends and influencing factors of non-tobacco substances, making it difficult for the detection results to effectively guide production practices.
[0005] Prior art three, Chinese patent number 202410378514.4, relates to an online classification, identification, and sorting device for debris based on hyperspectral detection. This device belongs to the field of tobacco debris removal technology. The device comprises a hyperspectral camera, an industrial camera, an industrial computer, and a diversion unit. The hyperspectral camera and the industrial camera are positioned relative to each other. Finished tobacco sheets are ejected from a conveyor belt and pass between the hyperspectral camera and the industrial camera. Both the hyperspectral camera and the industrial camera are equipped with a light source on one side. The spectral camera captures multi-band images of the finished tobacco sheets and provides spectral data. The industrial camera captures high-definition images of the finished tobacco sheets. The industrial computer processes and analyzes the multi-band images, spectral data, and high-definition images of the tobacco sheets to detect the presence of non-tobacco substances. The device compares the spectral data of debris with spectra of different substances to determine the type of debris. While this device is effective in detecting and distinguishing non-tobacco substances, reducing the impact on tobacco quality during the detection process, it suffers from insufficient data statistics and analysis. A systematic research framework for analyzing the dynamic trends and influencing factors of non-tobacco substances has not yet been established, making it difficult for the detection results to effectively guide production practices.
[0006] Currently, existing technologies 1, 2, and 3 lack data statistics and analysis, and lack a systematic research framework for analyzing the dynamic trends and influencing factors of non-smoking substances. This makes it difficult for detection results to effectively guide production practices. To address the above issues, the present invention provides a method for detecting non-smoking substances in flue-cured tobacco. Summary of the Invention
[0007] The main purpose of the present invention is to provide a method and system for detecting non-tobacco substances in flue-cured tobacco, so as to solve the problem that data statistics and analysis are insufficient in the existing technology, and a systematic research framework has not been formed for the analysis of the dynamic change trends and influencing factors of non-tobacco substances, resulting in the difficulty of detection results to effectively guide production practice.
[0008] To achieve the above object, the present invention provides the following technical solutions:
[0009] A method for detecting non-tobacco substances in flue-cured tobacco. The method establishes a non-tobacco substance database, collects physical characteristics of tobacco leaves and non-tobacco substances, and spectral information and non-tobacco substance data of the physical characteristics of non-tobacco substances; classifies non-tobacco substances into organic non-tobacco substances and inorganic non-tobacco substances; calculates the weight proportion of inorganic non-tobacco substances, and identifies the source of impurities in the non-tobacco substances.
[0010] As a further improvement of the present invention, after the non-smoking substance database is established, denoising, standardization and feature extraction are performed on the non-smoking substance data.
[0011] As a further improvement of the present invention, the process of denoising, standardizing, and extracting features from non-smoking substance data includes the following steps:
[0012] Establish a non-tobacco substance database, collect various non-tobacco substances and mix them with shredded tobacco leaves, scan the mixed non-tobacco substances, pre-collect black frame and white frame data to form a hyperspectral three-dimensional matrix; calibrate the hyperspectral data to remove random image noise;
[0013] Unify the dimensions of spectral data collected from different batches and devices; extract physical features such as shape, texture, and color of non-smoking substances from images; and analyze the differences in spectral reflectance of different non-smoking substances at specific wavelengths.
[0014] A non-smoking substance dataset is constructed based on the characteristics of non-smoking substances and the differences in spectral reflectance, and is divided into a training set, a validation set, and a test set.
[0015] As a further improvement of the present invention, the process of forming a hyperspectral three-dimensional matrix includes the following steps:
[0016] The collected non-tobacco substances are mixed with shredded tobacco leaves to simulate the dynamic conditions of the production environment; the mixed non-tobacco substances are scanned, black frame and white frame data are collected in advance, and the black frame data and white frame data are stored as a three-dimensional matrix to form hyperspectral data;
[0017] Hyperspectral data is corrected to remove random noise and interference introduced by light sources / equipment. The corrected three-dimensional matrix is integrated according to the spatial dimension and spectral channel dimension, and the data of the spectral channel corresponding to each spatial position is associated to form a hyperspectral data cube.
[0018] The corrected three-dimensional matrix is normalized and converted into a grayscale image; the integrated spatial positions and the corresponding spectral data are rearranged; each spatial point corresponds to an average spectrum, and all coordinate points are combined into a hyperspectral three-dimensional data set.
[0019] As a further improvement of the present invention, the process of combining all coordinate points into a hyperspectral three-dimensional data set includes the following steps:
[0020] The corrected three-dimensional matrix is normalized, the spectral reflectance value is adjusted to a preset range, and converted into a grayscale image; based on the spatial distribution of the tobacco leaves, the target area is identified and a mask is created to remove creases;
[0021] The tobacco leaf image is divided into multiple local areas according to relative positions, and a fixed-size region of interest is defined at the center of each tobacco leaf block; a preset number of valid pixels are randomly selected in each region of interest to extract spectral data;
[0022] The spectra of the pixel points in the same area of interest are averaged to obtain the representative spectral curve of the area; if there are more than a preset number of sub-areas, they are averaged again to form the spectral data of the entire tobacco leaf; the integrated spatial position and the averaged spectral data are rearranged to form a hyperspectral three-dimensional dataset.
[0023] As a further improvement of the present invention, the classification of non-smoking substances is achieved by constructing a non-smoking substance detection model based on a non-smoking substance database.
[0024] As a further improvement of the present invention, the process of the non-smoking substance detection model identifying the source of impurities in non-smoking substances includes the following steps:
[0025] Build a non-tobacco substance detection model based on the non-tobacco substance database; use independent UNet networks to parallel process hyperspectral images of different channels and output probability maps of debris areas;
[0026] A discriminator with fully connected layers and random dropout layers is used to determine whether an image contains debris. A weighted combination of UNet loss and discriminator loss is used to train the non-smoking substance detection model's sensitivity to debris areas and its ability to discriminate.
[0027] The training parameters were set, the number of feature maps in the fully connected layer of the discriminator was set to 1024, 128, and 1, respectively, and the random drop probability was set to 0.5. The detection accuracy of the non-smoking substance detection model for the debris area was evaluated through accuracy, recall rate, and F1 score.
[0028] As a further improvement of the present invention, based on the source of impurities in non-smoking substances, an impurity removal control instruction is generated; if the non-smoking substance detection model detects an abnormality, an early warning is immediately issued, and relevant personnel are notified to reprocess the corresponding batch.
[0029] As a further improvement of the present invention, the process of issuing an early warning includes the following steps:
[0030] Automatically adjust the operating parameters of the impurity removal equipment based on the type of impurities detected; dynamically allocate sorting resources based on impurity distribution data; set warning thresholds based on the degree of impurity damage and weight ratio;
[0031] When a level one warning is reached, the production line is automatically paused and relevant personnel are notified; a level two warning is simultaneously sent to the quality control department, initiating the batch tracking process; if a level three warning is reached, the equipment is immediately blocked and relevant personnel are notified;
[0032] The warning data is fed back to the non-smoking substance detection model to update the weight parameters of the non-smoking substance detection model; for tobacco-like organic matter that is frequently missed, additional training samples are added to improve the recognition accuracy to above the preset threshold.
[0033] To achieve the above object, the present invention also provides the following technical solutions:
[0034] A system for detecting non-smoking substances in flue-cured tobacco, which is applied to the method for detecting non-smoking substances in flue-cured tobacco, comprises:
[0035] The non-tobacco substance collection module is used to establish a non-tobacco substance database, collect the physical characteristics of tobacco leaves and non-tobacco substances, as well as the spectral information of the physical characteristics of non-tobacco substances, and perform denoising, standardization, and feature extraction on the non-tobacco substance data;
[0036] The non-tobacco substance identification module is used to build a non-tobacco substance detection model based on the non-tobacco substance database, classify non-tobacco substances into organic and inorganic non-tobacco substances using the non-tobacco substance detection model, calculate the weight percentage of inorganic non-tobacco substances, and identify the source of impurities in non-tobacco substances;
[0037] The non-smoking substance warning module is used to generate impurity removal control instructions based on the source of impurities in non-smoking substances. If the non-smoking substance detection model detects an abnormality, an early warning will be issued immediately, and relevant personnel will be notified to reprocess the corresponding batch.
[0038] The establishment of this invention's database provides fundamental support for subsequent classification and detection, enabling more efficient classification and analysis. Leveraging the non-smoking substance database, a detection model is constructed, classifying non-smoking substances into organic and inorganic categories. The weight percentage of inorganic non-smoking substances is calculated to identify the source of impurities, improving classification accuracy and efficiency. By calculating the weight percentage of inorganic non-smoking substances, the source of impurities can be more intuitively understood, providing a basis for subsequent impurity removal. Control instructions for impurity removal are generated based on the source of the impurities. If an anomaly is detected, an immediate warning is issued and relevant personnel are notified to reprocess the batch. This achieves automated and intelligent management, improving production efficiency and product quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 This is a schematic flow chart of the steps of one embodiment of a method for detecting non-tobacco substances in flue-cured tobacco according to the present invention;
[0040] Figure 2 This is a flow chart showing the steps of denoising, standardizing and feature extraction of non-tobacco substance data in one embodiment of the method for detecting non-tobacco substances in flue-cured tobacco of the present invention;
[0041] Figure 3 A schematic flow chart of the steps for forming a hyperspectral three-dimensional matrix in one embodiment of a method for detecting non-tobacco substances in flue-cured tobacco according to the present invention;
[0042] Figure 4 This is a schematic flow chart of the steps of combining all coordinate points into a hyperspectral three-dimensional data set in one embodiment of the method for detecting non-tobacco substances in flue-cured tobacco of the present invention;
[0043] Figure 5 This is a flow chart of steps for identifying the sources of impurities in non-smoking substances in one embodiment of a method for detecting non-smoking substances in flue-cured tobacco according to the present invention;
[0044] Figure 6 A flowchart showing the steps for training the sensitivity and discrimination ability of a non-smoking substance detection model to debris areas according to an embodiment of the method for detecting non-smoking substances in flue-cured tobacco of the present invention;
[0045] Figure 7 This is a schematic flow chart of an embodiment of a method for detecting non-tobacco substances in flue-cured tobacco and steps for setting training parameters;
[0046] Figure 8 This is a flow chart of the steps of establishing a correspondence between preset standardized classifications and sources according to one embodiment of a method for detecting non-tobacco substances in flue-cured tobacco according to the present invention;
[0047] Figure 9A schematic flow chart of the steps of immediately issuing an early warning according to an embodiment of the method for detecting non-tobacco substances in flue-cured tobacco of the present invention;
[0048] Figure 10 This is a schematic diagram of the functional modules of an embodiment of a system for detecting non-tobacco substances in flue-cured tobacco according to the present invention;
[0049] Figure 11 This is a schematic structural diagram of an embodiment of an electronic device of the present invention;
[0050] Figure 12 This is a schematic structural diagram of an embodiment of a storage medium of the present invention. DETAILED DESCRIPTION
[0051] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0052] The terms "first", "second" and "third" in the present invention are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first", "second" and "third" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "multiple" is at least two, for example, two, three, etc., unless otherwise clearly and specifically defined. All directional indications in the embodiments of the present invention (such as up, down, left, right, front, back...) are only used to explain the relative position relationship, movement, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.
[0053] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present invention. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute a separate or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0054] like Figure 1 As shown, this embodiment provides an embodiment of a method for detecting non-smoking substances in flue-cured tobacco. In this embodiment, the method for detecting non-smoking substances in flue-cured tobacco specifically includes the following steps:
[0055] Step S1: Establishing a non-tobacco substance database, collecting non-tobacco substance data such as the physical characteristics of tobacco leaves and non-tobacco substances and spectral information of the physical characteristics of non-tobacco substances; performing denoising, standardization, and feature extraction on the non-tobacco substance data;
[0056] Step S2: Constructing a non-tobacco substance detection model based on the non-tobacco substance database, and using the non-tobacco substance detection model to classify non-tobacco substances into organic non-tobacco substances and inorganic non-tobacco substances; calculating the weight percentage of inorganic non-tobacco substances, and identifying the source of impurities in non-tobacco substances;
[0057] Step S3: Based on the sources of impurities in non-smoking substances, an impurity removal control instruction is generated; if the non-smoking substance detection model detects an abnormality, an early warning is immediately issued, and relevant personnel are notified to reprocess the corresponding batch.
[0058] Preferably, this embodiment collects physical characteristics and spectral information of tobacco leaves and non-tobacco substances to construct a non-tobacco substance database. This data undergoes denoising, standardization, and feature extraction for subsequent analysis, improving data accuracy and reliability. The establishment of this database provides foundational support for subsequent classification and detection, enabling more efficient classification and analysis models. Using the non-tobacco substance database, a detection model is constructed, classifying non-tobacco substances into organic and inorganic categories. The weight percentage of inorganic non-tobacco substances is calculated to identify impurity sources, improving classification accuracy and efficiency. By calculating the weight percentage of inorganic non-tobacco substances, the source of impurities can be more intuitively understood, providing a basis for subsequent impurity removal. Control instructions for removing impurities are generated based on their source. If an anomaly is detected, an immediate warning is issued and relevant personnel are notified to reprocess the batch. This achieves automated and intelligent management, improving production efficiency and product quality. After data collection, non-tobacco substance data is subjected to denoising, standardization, and feature extraction to improve data quality and model training results. Denoising and standardization operations enhance the credibility and consistency of the data. Feature extraction extracts meaningful information from the raw data, providing effective input for model training, thereby improving classification and detection accuracy. Hyperspectral image acquisition equipment is used to acquire spectral information of non-tobacco substances, and their chemical composition and physical state are analyzed through processing steps such as normalization, noise reduction, and feature extraction. This improves the sensitivity and accuracy of non-tobacco substance detection. For example, multispectral imaging technology allows for a more comprehensive analysis of the characteristics of non-tobacco substances and supports the identification of impurities in complex backgrounds.
[0059] Furthermore, if Figure 2As shown, the process of denoising, standardizing and feature extraction of non-smoking substance data in step S1 specifically includes the following steps:
[0060] Step S11: Establish a non-tobacco substance database, collect various non-tobacco substances and mix them with shredded tobacco leaves, scan the mixed non-tobacco substances, pre-collect black frame and white frame data to form a hyperspectral three-dimensional matrix; calibrate the hyperspectral data to remove random image noise;
[0061] Step S12: Unifying the spectral data collected from different batches and devices; extracting physical features such as shape, texture, and color of non-smoking substances from the image; and analyzing the differences in spectral reflectance of different non-smoking substances at specific wavelengths.
[0062] Step S13: constructing a non-smoking substance dataset based on the non-smoking substance characteristics and the spectral reflectance differences, and dividing the non-smoking substance dataset into a training set, a validation set, and a test set.
[0063] Preferably, when establishing a non-tobacco substance database in this embodiment, black and white frame data are collected to form a hyperspectral three-dimensional matrix, and the hyperspectral data is corrected to remove random noise. Black and white frame correction can effectively eliminate errors caused by changes in ambient light or sensor characteristics during the imaging process, thereby improving the signal-to-noise ratio and accuracy of the data. Spectral data collected from different batches and devices are uniformly dimensionalized. After standardization, physical features such as shape, texture, and color of non-tobacco substances are extracted from the images. A dataset is constructed based on non-tobacco substance characteristics and spectral reflectance differences, and divided into training, validation, and test sets. Hyperspectral imaging technology, combined with multi-dimensional features such as shape, texture, and color, enables accurate classification of non-tobacco substances and tobacco leaves. Methods such as black and white frame correction and radiation correction are used to significantly improve data quality and reduce noise interference. Through reasonable dataset division and deep learning model design, the training efficiency and classification accuracy of the model are improved.
[0064] Furthermore, if Figure 3 As shown, the process of forming a hyperspectral three-dimensional matrix in step S11 specifically includes the following steps:
[0065] Step S111: Mixing the collected various non-tobacco substances with shredded tobacco leaves to simulate the dynamic conditions of the production environment; scanning the mixed non-tobacco substances, pre-collecting black frame and white frame data, and storing the black frame data and the white frame data as a three-dimensional matrix to form hyperspectral data;
[0066] Step S112: Correct the hyperspectral data to remove random noise and interference introduced by light sources / equipment; integrate the corrected three-dimensional matrix according to the spatial dimension and spectral channel dimension, and associate the data of the spectral channel corresponding to each spatial position to form a hyperspectral data cube;
[0067] Step S113: normalize the corrected three-dimensional matrix and convert it into a grayscale image; rearrange the integrated spatial positions and the corresponding spectral data; each spatial point corresponds to an average spectrum, and all coordinate points are combined into a hyperspectral three-dimensional data set.
[0068] Preferably, in this embodiment, non-tobacco substances are mixed with shredded tobacco leaves to simulate the dynamic conditions of a production environment. A hyperspectral camera collects black and white frame data, forming a three-dimensional matrix that is stored as hyperspectral data. The hyperspectral data is then subjected to black-and-white correction to eliminate interference caused by light source inhomogeneity and dark current. Data preprocessing also includes operations such as radiometric correction, geometric correction, and noise removal to improve data quality and signal-to-noise ratio. The corrected three-dimensional matrix is integrated according to spatial and spectral channel dimensions to form a hyperspectral data cube. The data is then normalized and converted into a grayscale image. The spatial positions and spectral data are realigned to generate a hyperspectral three-dimensional dataset. Black-and-white correction and noise removal significantly improve the brightness and darkness uniformity and signal-to-noise ratio of the hyperspectral data, reducing random noise and interference introduced by the equipment. Data preprocessing also effectively removes irrelevant information, improving data quality and laying the foundation for subsequent analysis. The construction of the hyperspectral data cube ensures that each spatial point corresponds to an average spectrum, facilitating subsequent feature extraction and classification modeling. The normalized grayscale image further simplifies the data representation, facilitating the application of subsequent image segmentation and machine learning algorithms. Hyperspectral imaging technology can capture the unique spectral characteristics of non-tobacco debris and tobacco leaves under the same optical environment, thereby achieving accurate identification and classification.
[0069] Further, if Figure 4 As shown, the process of combining all coordinate points into a hyperspectral three-dimensional data set in step S113 specifically includes the following steps:
[0070] Step S1131: normalize the corrected three-dimensional matrix, adjust the spectral reflectance value to a preset range, and convert it into a grayscale image; identify the target area based on the spatial distribution of the tobacco leaves, and create a mask to remove creases;
[0071] Step S1132: Segment the tobacco leaf image into multiple local regions according to relative positions, and define a region of interest of fixed size in the center of each tobacco leaf block; randomly select a preset number of valid pixels in each region of interest and extract spectral data;
[0072] Step S1133: Average the spectra of the pixel points in the same region of interest to obtain a representative spectral curve for the region; if there are more than a preset number of sub-regions, average them again to form the spectral data of the entire tobacco leaf; rearrange the integrated spatial position and the averaged spectral data to form a hyperspectral three-dimensional dataset.
[0073] Preferably, this implementation normalizes the corrected three-dimensional matrix, adjusts the spectral reflectance value to a preset range, and converts it into a grayscale image; by demarcating the region of interest and randomly extracting valid pixels to extract spectral data, it is possible to focus on the key parts of the tobacco leaf and reduce the interference of irrelevant information; by averaging the spectral data of the pixels in the same region of interest, a representative spectral curve of the region is generated; the integrated spatial position and the averaged spectral data are rearranged to form a hyperspectral three-dimensional data set. This reconstruction method can organically combine spatial information with spectral information, providing comprehensive data support for subsequent analysis. Normalization and region of interest delineation effectively reduce background noise interference and improve image contrast and clarity; by randomly extracting pixels and averaging, the impact of redundant information on the model is reduced, and the representativeness of the data is improved; the reconstruction of the three-dimensional data set enables the organic combination of spatial and spectral information, providing more comprehensive data support for subsequent analysis.
[0074] Further, if Figure 5 As shown, the process of identifying the source of impurities in non-smoking matter in step S2 specifically includes the following steps:
[0075] Step S21: constructing a non-smoking substance detection model based on the non-smoking substance database; using independent UNet networks to process hyperspectral images of different channels in parallel and output a probability map of the debris area;
[0076] Among them, each UNet includes an encoder and a decoder; the encoder includes downsampling to extract features, and the decoder includes upsampling to restore spatial resolution;
[0077] Step S22: Using a discriminator with a fully connected layer and a random dropout layer, determine whether the image contains debris. A weighted combination of UNet loss and discriminator loss is used to train the sensitivity and discrimination ability of the non-smoking substance detection model to debris areas.
[0078] Step S23: The training parameters are set, the number of feature maps of the fully connected layer of the discriminator is set to 1024, 128, and 1 respectively, and the random drop probability is set to 0.5; the detection accuracy of the non-smoking substance detection model for the debris area is evaluated by the accuracy, recall rate, and F1 score.
[0079] Preferably, this embodiment uses independent UNet networks to process hyperspectral images of different channels in parallel and output probability maps of debris areas. It also utilizes the encoder-decoder structure of UNet, in which the encoder extracts features through downsampling and the decoder restores spatial resolution through upsampling, thereby achieving efficient segmentation and feature extraction of hyperspectral images. The training effect of the model is further optimized by combining a weighted combination of UNet loss and discriminator loss. This joint loss function design not only improves the model's sensitivity to debris areas, but also enhances the model's discriminative ability, enabling the model to more accurately identify non-tobacco substances in images. The number of feature maps in the fully connected layer of the discriminator is set to 1024, 128, and 1, respectively, and the random dropout probability is set to 0.5. The performance of the model can be comprehensively measured through a comprehensive evaluation of accuracy, recall, and F1 score.
[0080] Furthermore, if Figure 6 As shown, the process of training the sensitivity and discrimination ability of the non-smoking substance detection model to the debris area in step S22 specifically includes the following steps:
[0081] Step S221: Calculate the discriminator loss function and the UNet loss function; wherein the discriminator loss function is used to determine whether the image contains debris, and the UNet loss function optimizes the UNet's segmentation degree of the debris area;
[0082] Step S222: The discriminator loss function and the UNet loss function are combined according to weights to perform weighted segmentation accuracy and discrimination ability; a parallel training mechanism is set up, and each set of training data contains 3 three-channel images and 1 label image;
[0083] Step S223: During the training process, the three images are fed into three independent UNet networks, each processing data from a different spectral channel combination and sharing a common label for supervision; the features extracted by the UNet encoder are fed into the discriminator;
[0084] The discriminator consists of a fully connected layer and a random dropout layer, and optimizes the discriminability of feature extraction through discriminative loss.
[0085] Among them, step S221 constructs the dual-objective loss function, multispectral UNet segmentation loss, and assumes that the output probability map of the k-th branch is Its loss function includes:
[0086] Spectral Adaptive Cross Entropy:
[0087]
[0088] Where, Represents edge-sensitive weights is the Sobel operator, represents the frequency weight f of category q q is the proportion of class q pixels in the training set; τ = 0.8 represents the temperature coefficient; represents the probability that the k-th branch predicts category q at position (i, j); y ijq One-hot encoding of the true label;
[0089] Multi-scale topological loss:
[0090]
[0091] where Φ r (·) represents a continuous homology feature extractor of scale r; ||·|| F represents the Frobenius norm, which calculates the overall difference of the matrix; P (k) represents the output probability map of the kth branch; Φ r (Y) represents the continuous homology feature of the true label Y at scale r; represents the multi-scale topological loss of the k-th branch;
[0092] Discriminator adversarial loss:
[0093] Assume that the discriminator layer m features are The adversarial loss adopts the form of adaptive gradient penalty:
[0094]
[0095] Where, represents adaptive S-shape activation; represents the dynamic penalty coefficient; represents the generated samples after adding spectral perturbations, represents the real sample; ψ(z) represents the adaptive S-shaped activation, ρ controls the slope to avoid gradient explosion; κ(ζ) represents the dynamic penalty coefficient, which forms a gradient penalty between the real sample (ζ=0) and the generated sample (ζ=ξ); represents the gradient of the discriminator for the mixed sample; L adv represents the adversarial loss of the discriminator; Represents the mathematical expectation operator; Represents the sample Xr sampled from the real data distribution Pdata; represents the random interpolation weight ζ uniformly distributed in the interval [0,ξ];
[0096] Step S222: Weighted joint optimization, dynamic weight adjustment mechanism, the total loss function is:
[0097]
[0098] Where, represents Gaussian decay scheduling; represents the segmentation loss variance; represents the Group Lasso regularization of the convolution kernel; α(t) represents the Gaussian decay schedule, ν controls the decay rate, and gradually reduces the segmentation loss weight as the number of training steps t increases; represents the variance of the segmentation loss of the three branches, which is used to adaptively adjust the weights; ∈ represents a small constant to prevent division by zero; L total represents the total loss function; Represents the variance of the adversarial loss Ladv;
[0099] Step S223 multi-branch feature fusion, cross-modal feature interaction, set the highest level feature of the three-branch encoder to be The fusion process is:
[0100]
[0101] F (k) represents the deep feature map of the k-th branch; W k represents the learnable 3D attention weight; F fus Represents the final fusion feature, and the attention mechanism is realized through softmax;
[0102] Discriminator input construction:
[0103]
[0104] represents the learnable attention weight; Represents a tensor contraction operation: Indicates that the second branch feature is processed by BatchNorm; Indicates that the third branch feature is activated by ReLU; [;] indicates feature concatenation operation; W D represents the projection matrix of the discriminator; F (1) Represents the top-level features of the first branch encoder.
[0105] Preferably, in this embodiment, the discriminator loss function is used to determine whether the image contains debris, while the UNet loss function optimizes the segmentation accuracy of the debris area. This combination improves the model's ability to detect and segment debris areas in the image by jointly optimizing the discriminant ability of the discriminator and the segmentation accuracy of UNet; through the guidance of the discriminator, UNet can more accurately learn the characteristics of the debris area, thereby improving the segmentation accuracy. During the training process, the discriminator loss function and the UNet loss function are combined through weights to balance the segmentation accuracy and discrimination ability. At the same time, a parallel training mechanism is adopted to input three three-channel images into three independent UNet networks, each network processes data from different spectral channels respectively, and shares a label image for supervision; this parallel training method can make full use of multispectral information, improve the model's adaptability to different spectral features, and optimize the balance between segmentation accuracy and discrimination ability through a weighted mechanism. The discriminator consists of fully connected layers and random dropout layers. It optimizes feature extraction capabilities through discriminative loss, thereby improving the model's discriminability. The introduction of random dropout layers helps prevent overfitting, while fully connected layers can further enhance the discriminative ability of features, making the model more accurate in determining whether an image contains debris. Each UNet independently processes image data from different spectral channels, sharing a common label for supervision. This design enables the model to learn the features of different spectral channels separately, thereby improving its ability to detect debris in complex backgrounds. By independently processing multi-channel data, the model can capture information in more dimensions, thereby improving the robustness and accuracy of detection. The features extracted by the UNet encoder are input into the discriminator, and the discriminative loss is used to further optimize the discriminativeness of the feature extraction. This collaborative mechanism enables the discriminator to more effectively utilize the output of the feature extractor, thereby improving its ability to discriminate against debris areas in the image.
[0106] Further, if Figure 7 As shown, the process of setting the training parameters in step S23 specifically includes the following steps:
[0107] Step S231: Classify the non-smoking substances into organic and inorganic categories based on their components; analyze the physical properties and sources of the non-smoking substances and match them with predefined categories in the non-smoking substance database;
[0108] Step S232: If the detected substance is a cigarette stick or corn cob, it is classified as organic; if the detected substance is a stone or metal fragment, it is classified as inorganic. After the classification is completed, the weight ratio of inorganic non-smoking substances is calculated;
[0109] Step S233: Analyze potential sources of impurities based on the source information of non-smoking substances and the classification results; establish a correspondence between the preset standardized classification and the source, and establish a rule base for the non-smoking substance detection model; and, based on the detection scenario, associate control measures with the impurity type of non-smoking substances.
[0110] Preferably, this embodiment achieves accurate classification of non-tobacco substances by classifying them into organic and inorganic categories based on their composition and matching them with physical properties and source information. Non-tobacco substances are classified and matched using predefined categories in the non-tobacco substance database, combined with detected physical properties and source information. After classification, the weight percentage of inorganic non-tobacco substances is calculated, and their sources are analyzed and a rule base is established based on potential impurity source information. By standardizing the correspondence between classification and source, a rule base for the non-tobacco substance detection model is constructed, thereby achieving precise control of impurity types in the detection scenario. The matching of physical properties and source information, coupled with the support of a predefined database, significantly improves the accuracy of non-tobacco substance classification. Based on the classification results and source analysis, control measures can be more accurately formulated to reduce the impact of impurities on tobacco leaf quality. The establishment of a rule base enables rapid identification and processing of impurity types in the detection scenario, improving detection efficiency. Through precise classification and implementation of control measures, the potential harm of non-tobacco substances to tobacco leaf quality is effectively reduced, ensuring the quality of the final product.
[0111] Further, if Figure 8 As shown, the process of establishing a corresponding relationship between the preset standardized classification and the source in step S233 specifically includes the following steps:
[0112] Step S2331: Classify organic and inorganic non-tobacco substances into categories I, II, and III according to their degree of hazard; define the physical properties and sources of the non-tobacco substances in each category; and match the detected non-tobacco substance type and source information with predefined categories in the non-tobacco substance database.
[0113] Step S2332: Based on the non-smoking substance classification results and the relationship between the non-smoking substance sources, a rule base is established; if the proportion of stones is high, screening and classification are performed; if tobacco branches are found, the tobacco plant topping technology is optimized; the rule base is dynamically adjusted in combination with the real-time monitoring scene;
[0114] Step S2333: Regularly analyze non-smoking substance detection data, identify deviations between non-smoking substance types and non-smoking substance sources or newly emerging impurity types, and update the rule base; and in combination with the detection scenario, associate control measures with non-smoking substances by impurity type.
[0115] Preferably, this embodiment classifies organic and inorganic non-tobacco substances into categories I, II, and III based on their degree of hazard, clarifies their physical properties and sources, and matches them against a predefined non-tobacco substance database. A rule base is established based on the classification results and source relationships, and dynamically adjusted in conjunction with real-time monitoring scenarios. Regular analysis of detection data identifies deviations in non-tobacco substance types and sources, or new impurity types, and updates the rule base. At the same time, combined with detection scenarios, control measures are associated with impurity types to further enhance the pertinence and efficiency of non-tobacco substance control. Classification and database matching enable more accurate identification of non-tobacco substance types and sources, reducing the rate of false positives. The establishment and adjustment of a dynamic rule base makes the production process more flexible, enabling rapid response to changes in production, thereby improving product quality. Regular analysis and updating of the rule base, combined with control measures associated with impurity types, can more effectively reduce the impact of non-tobacco substances on tobacco leaf quality.
[0116] Further, if Figure 9 As shown, the process of immediately issuing an early warning in step S3 specifically includes the following steps:
[0117] Step S31: Automatically adjust the operating parameters of the impurity removal equipment according to the detected impurity type; dynamically allocate sorting resources based on impurity distribution data; set warning thresholds according to the degree of impurity damage and weight ratio;
[0118] Step S32: When a level 1 warning is reached, the production line is automatically paused and relevant personnel are notified; a level 2 warning is simultaneously sent to the quality control department, and the batch tracking program is initiated; if a level 3 warning is reached, the equipment is immediately blocked and relevant personnel are notified;
[0119] Step S33: Feedback the warning data to the non-smoking substance detection model to update the weight parameters of the non-smoking substance detection model; for the frequently missed detection of tobacco-like organic matter, increase the training samples to improve the recognition accuracy to above the preset threshold.
[0120] Preferably, in this embodiment, the system can dynamically adjust the operating parameters of the impurity removal equipment based on the type of impurities detected; combined with the impurity distribution data, the system can dynamically allocate sorting resources to ensure efficient resource utilization; and the system sets an early warning threshold based on the degree of harm and weight percentage of the impurities. When a level one early warning is reached, the production line automatically pauses and notifies the relevant personnel; a level two early warning is simultaneously sent to the quality control department and a tracking program is initiated; a level three early warning immediately blocks the equipment and notifies the relevant personnel. This hierarchical early warning mechanism can quickly respond to potential risks and avoid production accidents. The early warning data is fed back to the non-smoking substance detection model, and the weight parameters are updated. For tobacco-like organic matter that is frequently missed, additional training samples are added to improve recognition accuracy.
[0121] like Figure 10As shown, this embodiment further provides an embodiment of a detection system for non-smoking substances in flue-cured tobacco. In this embodiment, the detection system for non-smoking substances in flue-cured tobacco is applied to the detection method for non-smoking substances in flue-cured tobacco in the above embodiment. The detection system for non-smoking substances in flue-cured tobacco includes:
[0122] The non-tobacco substance collection module 1 is used to establish a non-tobacco substance database, collect non-tobacco substance data such as the physical characteristics of tobacco leaves and non-tobacco substances, and spectral information of the physical characteristics of non-tobacco substances; and perform denoising, standardization, and feature extraction on the non-tobacco substance data;
[0123] The non-tobacco substance identification module 2 is used to build a non-tobacco substance detection model based on the non-tobacco substance database, classify non-tobacco substances into organic non-tobacco substances and inorganic non-tobacco substances using the non-tobacco substance detection model, calculate the weight percentage of inorganic non-tobacco substances, and identify the source of impurities in non-tobacco substances;
[0124] The non-smoking substance warning module 3 is used to generate impurity removal control instructions based on the source of impurities in non-smoking substances; if the non-smoking substance detection model detects an abnormality, it will immediately issue a warning and notify relevant personnel to reprocess the corresponding batch.
[0125] Preferably, this embodiment uses physical sensors and spectral analysis technology to obtain the physical characteristics and spectral information of tobacco leaves and non-tobacco substances. This data includes the physical properties of non-tobacco substances, such as shape, size, color, and density, as well as spectral characteristics, and is used to establish a non-tobacco substance database. A detection model is constructed based on the non-tobacco substance database, and deep learning or machine learning algorithms are used to classify non-tobacco substances into organic and inorganic categories. The weight percentage of inorganic non-tobacco substances is calculated, and the source of impurities is identified, which provides a basis for subsequent impurity removal. Control instructions are generated based on the source of impurities to guide impurity removal operations. At the same time, when an anomaly is detected, the module will immediately issue an early warning and notify relevant personnel to reprocess the corresponding batch of tobacco leaves.
[0126] like Figure 11 As shown, this embodiment provides an embodiment of an electronic device. In this embodiment, the electronic device 4 includes a processor 41 and a memory 42 coupled to the processor 41.
[0127] The memory 42 stores program instructions for implementing the layout method of the method for detecting non-tobacco substances in flue-cured tobacco according to any of the above embodiments.
[0128] The processor 41 is used to execute program instructions stored in the memory 42 to implement the layout of the detection method of non-tobacco substances in flue-cured tobacco.
[0129] The processor 41 may also be referred to as a CPU (Central Processing Unit). The processor 41 may be an integrated circuit chip having signal processing capabilities. The processor 41 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. The general-purpose processor may be a microprocessor or any conventional processor.
[0130] Further, Figure 4 This is a schematic diagram of the structure of a storage medium in an embodiment of the present application. The storage medium 5 in the embodiment of the present application stores program instructions 51 that can implement all the above methods, wherein the program instructions 51 can be stored in the above storage medium in the form of a software product, including a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or terminal devices such as a computer, server, mobile phone, and tablet.
[0131] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0132] In addition, the functional units in the various embodiments of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware or in the form of software functional units. The above is only an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
[0133] The above detailed description of the specific embodiments of the invention is intended to be illustrative only, and the present invention is not limited to the specific embodiments described above. For those skilled in the art, any equivalent modifications or substitutions to the invention are also within the scope of the present invention. Therefore, equivalent changes, modifications, and improvements made without departing from the spirit and scope of the present invention are also encompassed within the scope of the present invention.
Claims
1. A method for detecting non-tobacco substances in flue-cured tobacco, characterized in that: The method for detecting non-tobacco substances in flue-cured tobacco establishes a non-tobacco substance database, collects physical characteristics of tobacco leaves and non-tobacco substances, and spectral information and non-tobacco substance data of the physical characteristics of non-tobacco substances; classifies non-tobacco substances into organic non-tobacco substances and inorganic non-tobacco substances; calculates the weight proportion of inorganic non-tobacco substances, and identifies the source of impurities in non-tobacco substances.
2. The method for detecting non-smoking substances in flue-cured tobacco according to claim 1, wherein After establishing the non-tobacco substance database, the non-tobacco substance data is denoised, standardized and feature extracted.
3. The method for detecting non-smoking substances in flue-cured tobacco according to claim 2, wherein: The process of denoising, standardizing, and extracting features from non-smoking substance data includes the following steps: Establish a non-tobacco substance database, collect various non-tobacco substances and mix them with shredded tobacco leaves, scan the mixed non-tobacco substances, pre-collect black frame and white frame data to form a hyperspectral three-dimensional matrix; calibrate the hyperspectral data to remove random image noise; Unify the dimensions of spectral data collected from different batches and devices; extract the shape, texture, and color physical characteristics of non-smoking substances from images; and analyze the differences in spectral reflectance of different non-smoking substances at specific wavelengths. A non-smoking substance dataset is constructed based on the characteristics of non-smoking substances and the differences in spectral reflectance, and is divided into a training set, a validation set, and a test set.
4. The method for detecting non-tobacco substances in flue-cured tobacco according to claim 3, wherein: The process of forming a hyperspectral three-dimensional matrix includes the following steps: The collected non-tobacco substances are mixed with shredded tobacco leaves to simulate the dynamic conditions of the production environment; the mixed non-tobacco substances are scanned, black frame and white frame data are collected in advance, and the black frame data and white frame data are stored as a three-dimensional matrix to form hyperspectral data; Hyperspectral data is corrected to remove random noise and interference introduced by light sources / equipment. The corrected three-dimensional matrix is integrated according to the spatial dimension and spectral channel dimension, and the data of the spectral channel corresponding to each spatial position is associated to form a hyperspectral data cube. The corrected three-dimensional matrix is normalized and converted into a grayscale image; the integrated spatial positions and the corresponding spectral data are rearranged; each spatial point corresponds to an average spectrum, and all coordinate points are combined into a hyperspectral three-dimensional data set.
5. The method for detecting non-tobacco substances in flue-cured tobacco according to claim 4, wherein: The process of combining all coordinate points into a hyperspectral 3D dataset includes the following steps: The corrected three-dimensional matrix is normalized, the spectral reflectance value is adjusted to a preset range, and converted into a grayscale image; based on the spatial distribution of the tobacco leaves, the target area is identified and a mask is created to remove creases; The tobacco leaf image is divided into multiple local areas according to relative positions, and a fixed-size region of interest is defined at the center of each tobacco leaf block; a preset number of valid pixels are randomly selected in each region of interest to extract spectral data; The spectra of the pixel points in the same area of interest are averaged to obtain the representative spectral curve of the area; if there are more than a preset number of sub-areas, they are averaged again to form the spectral data of the entire tobacco leaf; the integrated spatial position and the averaged spectral data are rearranged to form a hyperspectral three-dimensional dataset.
6. The method for detecting non-tobacco substances in flue-cured tobacco according to claim 1, wherein: The classification of non-smoking substances is achieved by constructing a non-smoking substance detection model based on the non-smoking substance database.
7. The method for detecting non-tobacco substances in flue-cured tobacco according to claim 6, characterized in that: The process of the non-tobacco substance detection model to identify the source of impurities in non-tobacco substances includes the following steps: Build a non-tobacco substance detection model based on the non-tobacco substance database; use independent UNet networks to parallel process hyperspectral images of different channels and output probability maps of debris areas; A discriminator with fully connected layers and random dropout layers is used to determine whether an image contains debris. A weighted combination of UNet loss and discriminator loss is used to train the non-smoking substance detection model's sensitivity to debris areas and its ability to discriminate. The training parameters were set, the number of feature maps in the fully connected layer of the discriminator was set to 1024, 128, and 1, respectively, and the random drop probability was set to 0.
5. The detection accuracy of the non-smoking substance detection model for the debris area was evaluated through accuracy, recall rate, and F1 score.
8. The method for detecting non-tobacco substances in flue-cured tobacco according to claim 6, wherein: Based on the sources of impurities in non-smoking substances, control instructions for removing impurities are generated; if the non-smoking substance detection model detects an abnormality, an early warning is immediately issued, and relevant personnel are notified to reprocess the corresponding batch.
9. The method for detecting non-tobacco substances in flue-cured tobacco according to claim 8, characterized in that: The process of issuing an early warning includes the following steps: Automatically adjust the operating parameters of the impurity removal equipment based on the type of impurities detected; dynamically allocate sorting resources based on impurity distribution data; set warning thresholds based on the degree of impurity damage and weight ratio; When a level one warning is reached, the production line is automatically paused and relevant personnel are notified; a level two warning is simultaneously sent to the quality control department, initiating the batch tracking process; if a level three warning is reached, the equipment is immediately blocked and relevant personnel are notified; The warning data is fed back to the non-smoking substance detection model to update the weight parameters of the non-smoking substance detection model; for tobacco-like organic matter that is frequently missed, additional training samples are added to improve the recognition accuracy to above the preset threshold.
10. A system for detecting non-smoking substances in flue-cured tobacco, applied to the method for detecting non-smoking substances in flue-cured tobacco according to any one of claims 1 to 9, characterized in that: The detection system for non-tobacco substances in flue-cured tobacco comprises: The non-tobacco substance collection module is used to establish a non-tobacco substance database, collect the physical characteristics of tobacco leaves and non-tobacco substances, as well as the spectral information of the physical characteristics of non-tobacco substances, and perform denoising, standardization, and feature extraction on the non-tobacco substance data; The non-tobacco substance identification module is used to build a non-tobacco substance detection model based on the non-tobacco substance database, classify non-tobacco substances into organic and inorganic non-tobacco substances using the non-tobacco substance detection model, calculate the weight percentage of inorganic non-tobacco substances, and identify the source of impurities in non-tobacco substances; The non-smoking substance warning module is used to generate impurity removal control instructions based on the source of impurities in non-smoking substances. If the non-smoking substance detection model detects an abnormality, an early warning will be issued immediately, and relevant personnel will be notified to reprocess the corresponding batch.
Citation Information
Patent Citations
Non-smoke substance detection model training method and device, equipment and storage medium
CN118196486A
Sundry online classification identification and sorting device and method based on hyperspectral detection
CN118237299A
Non-smoke substance online detection method and system based on area array type spectral imaging
CN118657749A
Cited By
Method and device for detecting non-tobacco substances in mixed tobacco shreds and storage medium
CN121090520A