A tobacco non-smoke substance online detection method, system and storage medium

By combining a feature extraction network and a small-sample prototype matching module, the problems of accuracy and real-time performance of hyperspectral imaging technology in tobacco processing sites were solved, enabling accurate and real-time detection and removal of non-tobacco substances.

CN122493077APending Publication Date: 2026-07-31CHINA TOBACCO HUNAN IND CORP
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA TOBACCO HUNAN IND CORP
Filing Date
2026-05-29
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing hyperspectral imaging technology is greatly affected by environmental factors in tobacco processing sites, resulting in low recognition accuracy and difficulty in meeting the real-time requirements of high-flow-rate production lines.

Method used

By employing a feature extraction network combined with a spectral attention module and a small sample prototype matching module, high-dimensional feature vector extraction and soft boundary discrimination are performed through the fusion of spectral and spatial information. Combined with a delayed rejection control signal, accurate and real-time detection of non-smoke substances is achieved.

Benefits of technology

In high humidity and dusty environments, it achieves accurate identification and real-time removal of non-smoke substances, reduces false alarm rate, and meets the detection requirements of high flow rate production lines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122493077A_ABST
    Figure CN122493077A_ABST
Patent Text Reader

Abstract

This application discloses an online detection method, system, and storage medium for non-tobacco substances, belonging to the field of tobacco processing quality inspection and intelligent sorting. The detection method includes acquiring raw hyperspectral image data during tobacco transportation, preprocessing the hyperspectral image data, and segmenting the hyperspectral image data to obtain segmented hyperspectral image blocks; inputting the segmented hyperspectral image blocks into a pre-trained feature extraction network to extract high-dimensional feature vectors that fuse spectral and spatial information; inputting the high-dimensional feature vectors into a small-sample prototype matching module to calculate the metric distance between the feature vectors and the prototype vectors of pure tobacco leaves and various non-tobacco substances in the non-tobacco substance prototype library; and performing soft boundary discrimination based on the metric distance to determine whether the hyperspectral image blocks contain non-tobacco substances. This application, through the feature extraction network and small-sample prototype matching algorithm, achieves accurate, real-time, and flexible detection of non-tobacco substances under high flow rate conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of tobacco processing quality inspection and intelligent sorting technology, specifically to an online detection method, system and storage medium for non-tobacco substances in tobacco. Background Technology

[0002] On tobacco re-drying or cigarette production lines, non-tobacco substances mixed in with the tobacco (such as plastic sheets, hemp rope, paper scraps, animal feathers, etc.) can seriously affect the sensory quality and smoking safety of cigarette products. Traditional manual sorting or visible light machine vision-based detection methods are difficult to identify non-tobacco substances (such as transparent nylon filaments, light-colored plastic films, etc.) that are similar in color and texture to tobacco leaves.

[0003] Hyperspectral imaging technology integrates spectral and spatial information, enabling accurate identification based on the inherent spectral differences of different materials. However, existing hyperspectral-based methods for detecting non-smoke substances in tobacco face challenges: high humidity, dust, and light source fluctuations at tobacco processing sites cause spectral signal distortion, and general models are susceptible to interference, leading to false alarms; high-flow-rate (1.5m / s-2.0m / s) production lines have extremely high real-time requirements, which is in serious conflict with the limited computing power of edge computing devices.

[0004] Because existing hyperspectral imaging technology is greatly affected by environmental factors, resulting in low recognition accuracy, this is a problem that needs to be solved by those skilled in the art. Summary of the Invention

[0005] The purpose of this application is to provide an online detection method, system, and storage medium for non-tobacco substances to overcome the aforementioned deficiencies in the prior art.

[0006] To achieve the above objectives, this application employs the following technical solution: In a first aspect, this application discloses an online detection method for non-tobacco substances, comprising: The raw hyperspectral image data during tobacco delivery is acquired, and the hyperspectral image data is preprocessed and segmented into image blocks to obtain segmented hyperspectral image blocks. The segmented hyperspectral image patch is input into a pre-trained feature extraction network to extract a high-dimensional feature vector that integrates spectral and spatial information. The feature extraction network includes a spectral attention module to adaptively adjust the feature weights of different spectral bands. The high-dimensional feature vector is input into the small sample prototype matching module to calculate the metric distance between it and the pure tobacco leaf prototype vector and the prototype vectors of various non-tobacco substances in the non-tobacco substance prototype library; wherein, the prototype vectors in the non-tobacco substance prototype library are generated based on non-tobacco substance samples through the feature extraction network. Based on the metric distance, soft boundary discrimination is performed to determine whether a hyperspectral image patch contains non-smoke substances.

[0007] A further aspect of this application includes updating the non-smoke substance prototype library, which is triggered when a new category of non-smoke substance appears in tobacco. The update of the non-smoke substance prototype library includes collecting N samples as a support set, where N≤5; extracting feature vectors from the support set samples through the feature extraction network and calculating the mean, generating the prototype vector of the newly added category and updating it to the non-smoke substance prototype library, thereby achieving gradient-free fast iteration.

[0008] A further aspect of this application involves inputting the dimensionality-reduced hyperspectral image data into a pre-trained feature extraction network to extract a high-dimensional feature vector that fuses spectral and spatial information, including: High-dimensional feature vectors are extracted simultaneously using a three-dimensional convolutional neural network and / or a hybrid spectral-spatial network. These high-dimensional feature vectors include spectral sequence features and two-dimensional spatial texture features of the hyperspectral image.

[0009] A further aspect of this application, wherein the determination of non-smoke substances in a hyperspectral image patch based on the measured distance and performing soft boundary discrimination includes: By introducing a distance softening mechanism, the first distance between the current hyperspectral image patch feature vector and the pure tobacco prototype vector, and the minimum second distance between the feature vector and the prototype vectors of all categories in the non-tobacco material prototype library are calculated. If the first distance is greater than a preset tobacco leaf cohesion threshold and the second distance is less than a preset non-smoke substance discrimination threshold, then the current hyperspectral image block is determined to be a non-smoke substance of the corresponding category. If the first distance is greater than a preset tobacco leaf cohesion threshold and the second distance is greater than a preset non-smoke substance discrimination threshold, then the current hyperspectral image block is determined to be an unknown abnormal object.

[0010] A further aspect of this application, wherein the determination of whether a hyperspectral image patch contains non-smoke substances based on the measured distance and performing soft boundary discrimination, further includes: If a hyperspectral image block is determined to contain non-smoke substances, the system generates a rejection control signal to drive the actuator to reject it.

[0011] In a further embodiment, the system generates the rejection control signal by including: Based on the acquisition time sequence of the original hyperspectral image data and the conveyor belt speed, the spatial position of the non-smoke material and the delay in its arrival at the rejection mechanism are calculated, and a precise delay trigger signal is generated.

[0012] The spatial location of the non-smoke substance and the delay in reaching the rejection mechanism are calculated using the following formula; T delay = L / V − Noffset × T line - T compute - T valve Among them, T delay To eliminate delay, T line V is the single-line scan time of the line scan camera, L is the conveyor belt speed, L is the physical distance from the center of the hyperspectral image block to the pneumatic rejection valve, Noffset is the line offset, and T is the line offset. compute For the time consumed by reasoning, T valve This is the response delay for the solenoid valve.

[0013] Secondly, this application also discloses an online detection system for non-tobacco substances, which includes... The acquisition and processing module is configured to acquire the raw hyperspectral image data during tobacco delivery, and to preprocess and segment the hyperspectral image data to obtain segmented hyperspectral image blocks. The feature extraction module is configured to input the segmented hyperspectral image patches into a pre-trained feature extraction network to extract a high-dimensional feature vector that integrates spectral and spatial information. The data processing and feature matching module is configured to input the high-dimensional feature vector into the small sample prototype matching module and calculate the metric distance between it and the pure tobacco leaf prototype vector and the prototype vectors of various non-tobacco substances in the non-tobacco substance prototype library; wherein, the prototype vectors in the non-tobacco substance prototype library are generated based on a small number of samples through the feature extraction network. The determination module is configured to perform soft boundary discrimination based on the metric distance to determine whether a hyperspectral image block contains non-smoke substances.

[0014] In a further embodiment of this application, the illumination source in the acquisition and processing module is a halogen lamp or a broadband LED array, and the tilt angle of the light source is set to avoid specular reflection on the tobacco surface and the surface of non-smoke substances, thus creating a diffuse reflection layout.

[0015] Thirdly, this application discloses a computer-readable storage medium, characterized in that the computer-readable storage medium stores one or more programs, the one or more programs including instructions that, when executed by a computing device, cause the computing device to perform the above-described method.

[0016] The beneficial effects of this application are as follows: This application acquires raw hyperspectral image data in real time, and accurately extracts high-dimensional feature vectors from hyperspectral image blocks through a lightweight network. The spectral attention module adaptively adjusts the feature weights of different spectral bands, which is anti-interference. The small sample prototype matching module calculates the metric distance between the high-dimensional feature vector and the tobacco prototype vector and the non-smoke substance prototype vector. Combined with soft boundary discrimination, the entire detection method is less affected by environmental factors, enabling accurate, real-time and flexible detection of non-smoke substances in high flow rate environments. Attached Figure Description

[0017] Figure 1 This is a logic diagram of the online detection method for non-tobacco substances in the embodiments of this application; Figure 2 This is a schematic diagram of the feature extraction network structure in an embodiment of this application; Figure 3 This is a logic diagram of the spectral attention module processing in this application; Figure 4 This is a schematic diagram of the timing for precise control of delayed elimination in the embodiments of this application. Detailed Implementation

[0018] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present invention and the specific features in the embodiments are detailed descriptions of the technical solution of the present invention, rather than limitations thereof. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.

[0019] The term "and / or" simply describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Example 1

[0020] As attached Figure 1 As shown in the figure, this embodiment introduces a small sample hyperspectral online detection method for non-smoke substances in tobacco, which includes acquiring the original hyperspectral image data during tobacco transportation, and preprocessing and segmenting the hyperspectral image data to obtain segmented hyperspectral image blocks. The segmented hyperspectral image patches are input into a pre-trained feature extraction network to extract high-dimensional feature vectors that fuse spectral and spatial information. The feature extraction network includes a spectral attention module to adaptively adjust the feature weights of different spectral bands. The high-dimensional feature vector is input into the small sample prototype matching module to calculate the metric distance between it and the pure tobacco leaf prototype vector, as well as the prototype vectors of various non-tobacco substances in the non-tobacco substance prototype library; wherein, the prototype vectors in the non-tobacco substance prototype library are generated based on non-tobacco substance samples through a feature extraction network. Based on the metric distance, soft boundary discrimination is performed to determine whether a hyperspectral image patch contains non-smoke substances.

[0021] As attached Figures 2 to 4 As shown, in some embodiments, the specific methods for small-sample hyperspectral online detection of non-smoke substances in tobacco are as follows; Data preprocessing and dimensionality reduction After acquiring the original hyperspectral images using an online scanning hyperspectral camera (band range 400nm-1000nm, sampling interval approximately 5nm, totaling 128 bands), grayscale correction and denoising were first performed. Subsequently, Principal Component Analysis (PCA) was used to reduce the dimensionality of the 128 spectral bands to 16 principal components, with the cumulative contribution rate of the retained 16 principal components set to ≥99.5%. This reduced the number of input channels for subsequent 3D convolution from 128 to 16, decreasing the computational load by approximately 87%. The size of the cropped spatial image patch was set to 21×21×16 (physically corresponding to a 10mm×10mm area on a conveyor belt).

[0022] Feature extraction network architecture design (as shown in the appendix) Figure 2 ) This application employs an improved lightweight hybrid network, which is deeply optimized to address edge computing power constraints.

[0023] First layer: 3D spectral feature extraction layer. Convolutional kernel size 7×3×3 (spectral dimension 7, spatial dimension 3×3), number 8. The spectral span of 7 is chosen because the half-width at half-maximum (WHM) of the absorption peaks of non-smoke materials (belts, plastics, etc.) typically covers 5-8 consecutive bands. Stride (1,1,1), padding (3,1,1), output 16×21×21×8. After max pooling (2,2,2), the output is 8×10×10×8.

[0024] Second layer: 3D depth feature extraction layer. Convolutional kernel size 5×3×3, number 16. Stride (1,1,1), padding (2,1,1), output 4×5×5×16 after pooling.

[0025] Third layer: Spectral attention masking layer (as shown in the appendix) Figure 3 The network has a built-in attention module that can autonomously learn the weights of each band. For example... Figure 3As shown, to address water vapor interference in the production environment, the system can automatically reduce the weights of water vapor absorption bands such as 970nm, highlighting effective characteristic bands and greatly improving anti-interference capabilities. A global average pooling (GAP) is performed on the spectral dimension of the 4×5×5×16 feature map, followed by two fully connected layers (16 and 4 neurons respectively, activated by Sigmoid) to generate four band channel weights. Industrial mechanism integration: The system pre-sets a water vapor absorption band mapping table (e.g., around 970nm), and during initialization, the weights of interfering bands are forcibly set to a minimum value (0.01), allowing the network to automatically "shield" spectral distortions caused by high humidity environments. The weights are then multiplied back into the original feature map to complete recalibration.

[0026] Fourth layer: 2D spatial morphology extraction layer. The tensor is reshaped into 5×5×64, and then passed through two 2D convolutional layers (3×3, with 32 and 64 channels) to output 5×5×64.

[0027] Fifth layer: Feature mapping layer. Flattened into a 1600-dimensional vector, connected to a 128-dimensional fully connected layer. The 128-dimensional designation, instead of 512-dimensional, ensures that the inference time for a single image on the industrial control computer is strictly controlled within 5 milliseconds.

[0028] Small sample prototype matching and classification logic Prototype Calculation: The prototype vectors in the non-smoke material prototype library are generated based on non-smoke material samples through a feature extraction network. If a new non-smoke material (such as nylon rope) appears on the production line, the operator only selects 5 images, and the system extracts its 128-dimensional vector, calculates the arithmetic mean, generates a "category prototype vector", and stores it in the non-smoke material prototype library, realizing gradient-free fast iteration.

[0029] Soft boundary discrimination: Calculate the first distance between the feature vector of the current hyperspectral image patch and the prototype vector of pure tobacco leaves, and the minimum second distance between it and the prototype vectors of all categories in the non-tobacco material prototype library; The Euclidean distance metric is used, and a temperature coefficient is introduced to convert the distance into a similarity probability. The specific formula is as follows: P=e^(-d / τ).

[0030] Where d is the Euclidean distance, τ > 0 is the temperature coefficient, p is the similarity probability, and e is the natural constant; a larger p indicates a higher probability of similarity between features in the hyperspectral image patch and pure tobacco leaves or non-tobacco substances; the following explanation uses distance constraints. If the first distance is greater than the preset tobacco leaf cohesion threshold and the second distance is less than the preset non-smoke substance discrimination threshold, then the current hyperspectral image block is determined to be a non-smoke substance of the corresponding category; if the first distance is greater than the preset tobacco leaf cohesion threshold and the second distance is greater than the preset non-smoke substance discrimination threshold, then the current hyperspectral image block is determined to be an unknown abnormal object.

[0031] For example, the distance d1 between the real-time feature vector in the hyperspectral image patch and the prototype vector of pure tobacco leaf, and the distance d2 between the prototype vector of nylon rope, are calculated. If d1 is greater than the tobacco leaf cohesion threshold and d2 is less than the non-smoking substance discrimination threshold, it is determined to be a non-smoking substance of this type; if d2 is also greater than the discrimination threshold at the same time, it is determined to be an unknown anomaly, triggering conservative rejection.

[0032] Model training strategy A meta-learning strategy is employed to address the few-shot problem. The optimizer is Adam (initial learning rate 1×10⁻⁶). −3 The cosine annealing strategy was used to reduce the temperature to 1×10⁻⁶. −5 The loss function is cross-entropy loss. In the offline phase, a "5-way 1-shot" episode is artificially constructed for iterative training using a publicly available foreign object dataset, enabling the network to learn how to distinguish unfamiliar objects using only a small number of samples.

[0033] The engineering control algorithm for delayed elimination (as attached) Figure 4 (As shown) Based on the acquisition time sequence of the original hyperspectral image data and the conveyor belt speed, the spatial position of the non-smoke substance and the delay in its arrival at the rejection mechanism are calculated, and a precise delay trigger signal is generated. The spatial location of non-smoke substances and the delay in reaching the rejection mechanism (rejection delay) are calculated using the following formula: T delay = L / V − Noffset × T line - T compute - T valve Among them, T delay To eliminate delay, T line V is the single-line scan time of the line scan camera, L is the conveyor belt speed, L is the physical distance from the center of the hyperspectral image block to the pneumatic rejection valve, Noffset is the line offset, and T is the line offset. compute For inference time (dynamic measurement 3-5ms), T valve The solenoid valve response delay is 8-12ms; the system refreshes V every second according to the encoder to ensure that the rejection accuracy error is controlled within ±2mm. Example 2

[0034] Based on the same inventive concept as Example 1, this example describes an online detection method for non-tobacco substances, including: The acquisition and processing module is configured to acquire the raw hyperspectral image data during tobacco delivery, and to preprocess and segment the hyperspectral image data to obtain segmented hyperspectral image blocks. The feature extraction module is configured to input the segmented hyperspectral image patches into a pre-trained feature extraction network to extract a high-dimensional feature vector that integrates spectral and spatial information. The data processing and feature matching module is configured to input the high-dimensional feature vector into the small sample prototype matching module and calculate the metric distance between it and the pure tobacco leaf prototype vector and the prototype vectors of various non-tobacco substances in the non-tobacco substance prototype library; wherein, the prototype vectors in the non-tobacco substance prototype library are generated based on a small number of samples through a feature extraction network. The determination module is configured to perform soft boundary discrimination based on metric distance to determine whether a hyperspectral image patch contains non-smoke substances.

[0035] The specific functional implementation of each module mentioned above is described in the relevant content of the method in Embodiment 1, and will not be repeated here. It should be noted that: The lighting source in the acquisition and processing module is a halogen lamp or a broadband LED array, and the tilt angle of the light source is set to avoid specular reflection on the tobacco surface and the surface of non-smoke substances, thus creating a diffuse reflection layout. Example 3

[0036] Based on the same inventive concept as other embodiments, this embodiment describes a computer-readable storage medium that stores one or more programs, the one or more programs including instructions that, when executed by a computing device, cause the computing device to perform the method described in Embodiment 1. In summary, this application acquires raw hyperspectral image data in real time, accurately extracts high-dimensional feature vectors from hyperspectral image blocks using a lightweight network, and adaptively adjusts the feature weights of different spectral bands using a spectral attention module, which is anti-interference. The small-sample prototype matching module calculates the metric distance between the high-dimensional feature vector and the tobacco prototype vector and the non-smoke substance prototype vector, and with soft boundary discrimination, the entire detection method is less affected by environmental factors, enabling accurate, real-time, and flexible detection of non-smoke substances under high flow rate environments.

[0037] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0038] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0039] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0040] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0041] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims. All of these forms are within the protection scope of the present invention.

Claims

1. An online detection method for non-tobacco substances, characterized in that, include: The raw hyperspectral image data during tobacco delivery is acquired, and the hyperspectral image data is preprocessed and segmented into image blocks to obtain segmented hyperspectral image blocks. The segmented hyperspectral image patch is input into a pre-trained feature extraction network to extract a high-dimensional feature vector that integrates spectral and spatial information. The feature extraction network includes a spectral attention module to adaptively adjust the feature weights of different spectral bands. The high-dimensional feature vector is input into the small sample prototype matching module to calculate the metric distance between it and the pure tobacco leaf prototype vector and the prototype vectors of various non-tobacco substances in the non-tobacco substance prototype library; wherein, the prototype vectors in the non-tobacco substance prototype library are generated based on non-tobacco substance samples through the feature extraction network. Based on the metric distance, soft boundary discrimination is performed to determine whether a hyperspectral image patch contains non-smoke substances.

2. The online detection method for non-tobacco substances according to claim 1, characterized in that, It also includes updates to the non-smoke substance prototype library, which are triggered when a new category of non-smoke substance appears in tobacco. The update of the non-smoke substance prototype library includes collecting N samples as a support set, where N≤5; extracting feature vectors from the support set samples through the feature extraction network and calculating the mean, generating the prototype vector of the newly added category and updating it to the non-smoke substance prototype library, thereby achieving gradient-free fast iteration.

3. The online detection method for non-tobacco substances according to claim 1, characterized in that, The dimensionality-reduced hyperspectral image data is input into a pre-trained feature extraction network to extract a high-dimensional feature vector that fuses spectral and spatial information, including: High-dimensional feature vectors are extracted simultaneously using a three-dimensional convolutional neural network and / or a hybrid spectral-spatial network. These high-dimensional feature vectors include spectral sequence features and two-dimensional spatial texture features of the hyperspectral image.

4. The online detection method for non-tobacco substances according to claim 1, characterized in that, The process of determining non-smoke substances in hyperspectral image patches based on the measured distance includes: By introducing a distance softening mechanism, the first distance between the current hyperspectral image patch feature vector and the pure tobacco prototype vector, and the minimum second distance between the feature vector and the prototype vectors of all categories in the non-tobacco material prototype library are calculated. If the first distance is greater than a preset tobacco leaf cohesion threshold and the second distance is less than a preset non-smoke substance discrimination threshold, then the current hyperspectral image block is determined to be a non-smoke substance of the corresponding category. If the first distance is greater than a preset tobacco leaf cohesion threshold and the second distance is greater than a preset non-smoke substance discrimination threshold, then the current hyperspectral image block is determined to be an unknown abnormal object.

5. The online detection method for non-tobacco substances according to claim 1, characterized in that, The process of determining whether a hyperspectral image patch contains non-smoke substances based on the measured distance and performing soft boundary discrimination also includes: If a hyperspectral image block is determined to contain non-smoke substances, the system generates a rejection control signal to drive the actuator to reject it.

6. The online detection method for non-tobacco substances according to claim 5, characterized in that, The system generates rejection control signals including: Based on the acquisition time sequence of the original hyperspectral image data and the conveyor belt speed, the spatial position of the non-smoke substance and the delay in its arrival at the rejection mechanism are calculated, and a precise delay trigger signal is generated. The spatial location of the non-smoke substance and the delay in reaching the rejection mechanism are calculated using the following formula; T delay = L / V − Noffset × T line − T compute − T valve where T delay is the rejection delay, T line is the single line scanning time of the line scan camera, V is the speed of the conveyor belt, L is the physical distance between the center of the hyperspectral image block and the pneumatic rejection valve, Noffset is the line offset, T compute is the inference time consumption, and T valve is the solenoid valve response delay.

7. An online detection system for non-tobacco substances, characterized in that, include The acquisition and processing module is configured to acquire the raw hyperspectral image data during tobacco delivery, and to preprocess and segment the hyperspectral image data to obtain segmented hyperspectral image blocks. The feature extraction module is configured to input the segmented hyperspectral image patches into a pre-trained feature extraction network to extract a high-dimensional feature vector that integrates spectral and spatial information. The data processing and feature matching module is configured to input the high-dimensional feature vector into the small sample prototype matching module and calculate the metric distance between it and the pure tobacco leaf prototype vector and the prototype vectors of various non-tobacco substances in the non-tobacco substance prototype library; wherein, the prototype vectors in the non-tobacco substance prototype library are generated based on a small number of samples through the feature extraction network. The determination module is configured to perform soft boundary discrimination based on the metric distance to determine whether a hyperspectral image block contains non-smoke substances.

8. The online detection system for non-tobacco substances according to claim 1, characterized in that, The illumination source in the acquisition and processing module is a halogen lamp or a broadband LED array, and the tilt angle of the light source is set to avoid specular reflection on the tobacco surface and the surface of non-smoke substances, thus creating a diffuse reflection layout.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, the one or more programs including instructions that, when executed by a computing device, cause the computing device to perform the method of any one of claims 1 to 6.