Tobacco purity prediction model training method, prediction method and related device

By using hyperspectral imaging and convolutional neural network technology, a tobacco purity prediction model was trained, which solved the accuracy and efficiency problems of existing detection methods, achieved fast and accurate tobacco purity detection, and improved the quality control level of the tobacco industry.

CN120673221APending Publication Date: 2025-09-19HEBEI BAISHA TOBACCO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510574785.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-06
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

Existing tobacco purity detection methods rely on manual screening or simple mechanical separation based on physical properties. They have problems such as inconsistent results, poor accuracy, slow processing speed and insufficient scalability, and cannot meet the high-efficiency needs of modern tobacco production.

Method used

Hyperspectral imaging technology is used to obtain tobacco image samples. Through principal component analysis, wavelet transform and convolutional neural network, spectral and spatial features are extracted, and a tobacco purity prediction model is trained to achieve fast and accurate tobacco purity detection.

Benefits of technology

The accuracy and efficiency of tobacco purity detection have been improved, with a detection accuracy rate of 95%, a recall rate of 93%, and an average response time of only 5 seconds, which is significantly better than traditional methods and ensures the reliability of tobacco product quality and production efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120673221A_ABST
    Figure CN120673221A_ABST
Patent Text Reader

Abstract

The invention discloses a training method of a tobacco purity prediction model, a prediction method and a related device. The method comprises the steps that a tobacco image sample set is acquired and preprocessed, and based on a principal component analysis method and / or an independent component analysis method and / or a wavelet transform method, most representative spectral features are extracted from preprocessed tobacco hyperspectral image samples; inputting the preprocessed tobacco hyperspectral image sample into a convolutional layer and a pooling layer of a convolutional neural network to generate a spatial feature map; carrying out dimension expansion on the spectral features, and then carrying out channel splicing on the spectral features and the spatial feature map to obtain fusion features; and training a convolutional neural network based on the fusion features to obtain a tobacco purity prediction model. Therefore, a prediction model capable of rapidly and accurately detecting the purity of the tobacco can be obtained through training, and the quality control level of the tobacco industry is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of tobacco quality detection, specifically to technical fields such as hyperspectral imaging and machine learning, and particularly to a training method, prediction method and related devices for a tobacco purity prediction model. Background Art

[0002] In the global tobacco market, slim cigarettes are increasingly popular with consumers due to their unique style and healthy image. With continued growth in market demand, improving production efficiency and ensuring product quality have become key challenges for major tobacco companies. As a key indicator affecting tobacco product quality and consumer experience, tobacco purity testing is crucial.

[0003] Currently, tobacco purity testing relies primarily on manual screening or simple mechanical separation methods based on physical properties. However, manual screening is subject to significant human influence, making it difficult to ensure consistent and accurate results. Separation methods based on physical properties (such as density and size) are prone to misidentifying impurities with similar characteristics and suffer from significant limitations in processing speed, accuracy, and scalability, making them unable to meet the demands of modern, efficient production. Summary of the Invention

[0004] The present application provides a training method, a prediction method, and related devices for a tobacco purity prediction model to quickly and accurately detect tobacco purity and improve the quality control level of the tobacco industry.

[0005] The technical solution is as follows:

[0006] In a first aspect, a method for training a tobacco purity prediction model is provided, comprising:

[0007] Acquire and preprocess a tobacco image sample set, wherein the tobacco image sample set includes a plurality of tobacco hyperspectral image samples, each of which carries a purity label;

[0008] Extracting the most representative spectral features from the preprocessed tobacco hyperspectral image samples based on principal component analysis and / or independent component analysis and / or wavelet transform;

[0009] The preprocessed tobacco hyperspectral image samples are input into the convolutional layer and pooling layer of the convolutional neural network to generate a spatial feature map;

[0010] After the spectral feature is dimensionally expanded, channel splicing is performed with the spatial feature map to obtain a fusion feature;

[0011] The convolutional neural network is trained based on the fusion features to obtain a tobacco purity prediction model.

[0012] In one possible implementation, the preprocessed tobacco hyperspectral image samples are input into the convolutional layer and pooling layer of a convolutional neural network to generate a spatial feature map, specifically including:

[0013] The preprocessed tobacco hyperspectral image samples are sequentially input into each convolutional layer to obtain multiple feature maps of different scales;

[0014] Perform maximum pooling and / or average pooling operations on the multiple feature maps of different scales, and fuse the multiple feature maps of different scales after the pooling operation into a spatial feature map.

[0015] In one possible implementation, the convolution kernel of the convolutional layer of the convolutional neural network is variable; then the method further includes:

[0016] According to the different feature scale requirements of tobacco images, the convolution kernel size is dynamically adjusted to extract local and / or global features.

[0017] In a possible implementation, the spectral feature is dimensionally expanded and then channel-joined with the spatial feature map to obtain a fusion feature, specifically including:

[0018] After dimension expansion of the spectral feature, channel splicing is performed with a spatial feature map comprising multiple feature maps of different scales to obtain a fusion feature; and / or;

[0019] After the spectral features are dimensionally expanded, channel splicing is performed with a spatial feature map containing local features and / or global features to obtain a fusion feature.

[0020] In a second aspect, a tobacco purity prediction method is provided, comprising:

[0021] Acquire tobacco hyperspectral images and perform preprocessing;

[0022] Extracting the most representative spectral features from the preprocessed tobacco hyperspectral image based on principal component analysis and / or independent component analysis and / or wavelet transform;

[0023] The preprocessed tobacco hyperspectral image is input into the convolutional layer and pooling layer of the convolutional neural network to generate a spatial feature map;

[0024] After the spectral feature is dimensionally expanded, channel splicing is performed with the spatial feature map to obtain a fusion feature;

[0025] The fusion feature is input into a tobacco purity prediction model to output a tobacco purity prediction result; the tobacco purity prediction model is determined based on the training method of the tobacco purity prediction model described in the first aspect.

[0026] In a third aspect, a training device for a tobacco purity prediction model is provided, comprising:

[0027] an acquisition module, configured to acquire and preprocess a tobacco image sample set, wherein the tobacco image sample set includes a plurality of tobacco hyperspectral image samples, each of which carries a purity label;

[0028] An extraction module, for extracting the most representative spectral features from the preprocessed tobacco hyperspectral image sample based on principal component analysis and / or independent component analysis and / or wavelet transform;

[0029] A generation module is used to input the preprocessed tobacco hyperspectral image samples into the convolution layer and pooling layer of the convolutional neural network to generate a spatial feature map;

[0030] A fusion module is used to perform channel splicing on the spectral feature after dimension expansion and the spatial feature map to obtain a fusion feature;

[0031] A training module is used to train a convolutional neural network based on the fusion features to obtain a tobacco purity prediction model.

[0032] In a fourth aspect, a tobacco purity prediction device is provided, characterized in that it includes:

[0033] Acquisition module, used to acquire tobacco hyperspectral images and perform preprocessing;

[0034] An extraction module, for extracting the most representative spectral features from the preprocessed tobacco hyperspectral image based on principal component analysis and / or independent component analysis and / or wavelet transform;

[0035] A generation module is used to input the preprocessed tobacco hyperspectral image into the convolution layer and pooling layer of the convolutional neural network to generate a spatial feature map;

[0036] A fusion module is used to perform channel splicing on the spectral feature after dimension expansion and the spatial feature map to obtain a fusion feature;

[0037] The prediction module is used to input the fusion feature into a tobacco purity prediction model and output a tobacco purity prediction result; the tobacco purity prediction model is determined based on the training method of the tobacco purity prediction model described in the first aspect.

[0038] According to a fifth aspect, an electronic device is provided, including:

[0039] at least one processor; and

[0040] a memory communicatively connected to the at least one processor; wherein,

[0041] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any possible implementation manner and the aspects described above.

[0042] In a sixth aspect, a computer-readable storage medium is provided, wherein the storage medium stores at least one instruction, and the at least one instruction is loaded and executed by a processor to implement the method of the above-mentioned aspect and any possible implementation method.

[0043] In a seventh aspect, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the above-mentioned aspects and any possible implementation method.

[0044] The beneficial effects of the technical solution provided by this application include at least:

[0045] As can be seen from the above technical solution, the embodiment of the present application obtains and preprocesses a tobacco image sample set, and then extracts the most representative spectral features from the preprocessed tobacco hyperspectral image samples based on principal component analysis and / or independent component analysis and / or wavelet transform. The preprocessed tobacco hyperspectral image samples are input into the convolution layer and pooling layer of a convolutional neural network to generate a spatial feature map. The spectral features are dimensionally expanded and then channel-joined with the spatial feature map to obtain fused features. The convolutional neural network is trained based on the fused features to obtain a tobacco purity prediction model. Thus, a prediction model that can quickly and accurately detect tobacco purity can be trained, improving the quality control level of the tobacco industry.

[0046] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0048] Figure 1 This is a schematic diagram of the steps of a method for training a tobacco purity prediction model provided in an embodiment of the present application.

[0049] Figure 2 This is a schematic diagram of the steps of a tobacco purity prediction method provided in an embodiment of the present application.

[0050] Figures 3a-3d This is a schematic diagram of the comparison results of different algorithms provided in the embodiments of the present application in terms of accuracy, recall rate, F1 value and average response time.

[0051] Figure 4 This is a structural block diagram of a tobacco purity prediction model training device provided in yet another embodiment of the present application.

[0052] Figure 5 This is a structural block diagram of a tobacco purity prediction device provided in yet another embodiment of the present application.

[0053] Figure 6 This is a block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0054] The following description of exemplary embodiments of the present application is provided in conjunction with the accompanying drawings, which include various details of the embodiments of the present application to facilitate understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0055] Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0056] It should be noted that the terminal devices involved in the embodiments of the present application may include but are not limited to mobile phones, personal digital assistants (PDAs), wireless handheld devices, tablet computers and other smart devices; display devices may include but are not limited to personal computers, televisions and other devices with display functions.

[0057] In this document, the term "and / or" simply describes a relationship between related objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " in this document generally indicates that the related objects are in an "or" relationship.

[0058] Given the shortcomings of existing tobacco purity detection methods, which mainly rely on manual screening or simple mechanical separation methods based on physical properties, this application proposes a training scheme for a tobacco purity prediction model. The main inventive concept is to obtain a tobacco image sample set and preprocess it. Based on principal component analysis and / or independent component analysis and / or wavelet transform, the most representative spectral features are extracted from the preprocessed tobacco hyperspectral image samples; the preprocessed tobacco hyperspectral image samples are input into the convolution layer and pooling layer of a convolutional neural network to generate a spatial feature map; the spectral features are dimensionally expanded and then channel-joined with the spatial feature map to obtain fused features; the convolutional neural network is trained based on the fused features to obtain a tobacco purity prediction model. Thus, a prediction model that can quickly and accurately detect tobacco purity can be trained, improving the quality control level of the tobacco industry.

[0059] Reference Figure 1 FIG. 1 is a schematic diagram of the steps of a method for training a tobacco purity prediction model provided in an embodiment of the present application. The method mainly includes:

[0060] Step 102: Obtain a tobacco image sample set and perform preprocessing. The tobacco image sample set includes a plurality of tobacco hyperspectral image samples, and each tobacco hyperspectral image sample carries a purity label.

[0061] The tobacco hyperspectral image samples in the tobacco image sample set can be tobacco samples collected from different batches and processing stages on the tobacco production line, covering a wide range of purities. Samples of common impurities in tobacco (such as stems and leaf fragments) are also collected to construct a sample dataset against a complex background.

[0062] It should be understood that the above-mentioned tobacco hyperspectral image samples are all obtained by scanning using a hyperspectral imager. The imager parameters, such as spectral range (400-1000nm), spectral resolution (5nm), spatial resolution (adjusted according to actual needs), light source intensity and exposure time, are set to ensure that high-quality hyperspectral image data is collected. At the same time, the collected tobacco samples are purity tested and labeled, and the tobacco purity is divided into different levels (such as excellent, good, medium, and poor) according to industry standards or internal enterprise standards. The actual purity level information of each sample is recorded and a labeled data set is established. In this way, each tobacco hyperspectral image sample carries a purity label.

[0063] Furthermore, the tobacco hyperspectral image samples can be subjected to radiation correction, geometric correction and denoising to optimize the samples.

[0064] Step 104: extracting the most representative spectral features from the preprocessed tobacco hyperspectral image sample based on principal component analysis and / or independent component analysis and / or wavelet transform.

[0065] Step 106: Input the preprocessed tobacco hyperspectral image sample into the convolution layer and pooling layer of the convolutional neural network to generate a spatial feature map.

[0066] Optionally, when the preprocessed tobacco hyperspectral image samples are input into the convolution layer and pooling layer of the convolutional neural network to generate a spatial feature map, the preprocessed tobacco hyperspectral image samples can be input into each convolution layer in turn to obtain multiple feature maps of different scales; maximum pooling and / or average pooling operations are performed on the multiple feature maps of different scales, and the multiple feature maps of different scales after the pooling operation are fused into a spatial feature map.

[0067] It should be noted that the convolution kernel of the convolutional layer of the convolutional neural network described in this application is variable; the convolution kernel size can also be dynamically adjusted according to the different feature scale requirements of the tobacco image to extract local features and / or global features. For example: in the convolution layer of the convolutional neural network prediction module, a structure with a variable convolution kernel size is adopted. The convolution kernel size is dynamically adjusted according to the different feature scale requirements of the tobacco image. For example, for the subtle texture features of tobacco, a smaller convolution kernel (such as 3×3) is used for local feature extraction; for larger scale features such as the overall shape of tobacco, a larger convolution kernel (such as 5×5 or 7×7) is used for global feature capture to improve the comprehensiveness and pertinence of feature extraction.

[0068] Step 108: After dimension expansion of the spectral feature, channel splicing is performed with the spatial feature map to obtain a fusion feature.

[0069] Optionally, after the spectral feature is dimensionally expanded, channel splicing is performed with the spatial feature map to obtain a fused feature. Specifically, the spectral feature can be dimensionally expanded and then channel splicing is performed with a spatial feature map containing multiple feature maps of different scales to obtain a fused feature; and / or; after the spectral feature is dimensionally expanded, channel splicing is performed with a spatial feature map containing local features and / or global features to obtain a fused feature.

[0070] In other words, in addition to spectral-spatial feature fusion, multi-scale spatial feature fusion is also introduced during the feature fusion process. By fusing the spatial feature maps output by different layers of the 2D-CNN, such as fusing shallow low-level spatial features (containing rich texture details) with deep high-level spatial features (with strong semantic information), the model can simultaneously utilize spatial information at different scales, enhancing its ability to express the complex structure of tobacco and improving prediction accuracy.

[0071] Step 110: Training a convolutional neural network based on the fusion features to obtain a tobacco purity prediction model.

[0072] In this application, the convolutional neural network prediction module can also be initialized using the parameters of a convolutional neural network model pre-trained on a large-scale image dataset (such as ImageNet). Since the pre-trained model has already learned a wealth of common image features, transfer learning can accelerate the model's convergence on the tobacco purity prediction task, reducing training time and data requirements while improving the model's generalization ability.

[0073] Reference Figure 2 FIG. 1 is a schematic diagram of the steps of a tobacco purity prediction method provided in an embodiment of the present application. The method comprises:

[0074] Step 202: Acquire tobacco hyperspectral images and perform preprocessing.

[0075] Step 204: extracting the most representative spectral features from the preprocessed tobacco hyperspectral image based on principal component analysis and / or independent component analysis and / or wavelet transform.

[0076] Step 206: Input the preprocessed tobacco hyperspectral image into the convolution layer and pooling layer of the convolutional neural network to generate a spatial feature map.

[0077] Step 208: After dimension expansion of the spectral feature, channel splicing is performed with the spatial feature map to obtain a fusion feature.

[0078] Step 210: inputting the fusion feature into a tobacco purity prediction model and outputting a tobacco purity prediction result; the tobacco purity prediction model is determined based on the training method of the tobacco purity prediction model.

[0079] It should be understood that the implementation details of the prediction scheme steps are similar to those of the training scheme steps and will not be repeated here.

[0080] Figure 3a Comparative results of different algorithms in terms of accuracy are presented. A tobacco purity prediction model based on a convolutional neural network significantly outperforms traditional support vector machine and decision tree algorithms in terms of accuracy. The model achieved an accuracy of 95%, compared to 87% for the support vector machine and 83% for the decision tree. Using convolutional neural networks, richer feature information can be automatically extracted from hyperspectral data, effectively improving classification accuracy. Convolutional neural networks are capable of automatically learning multi-level feature representations, particularly useful for purity testing of thin tobacco against complex backgrounds.

[0081] Figure 3bThe recall performance of each algorithm was demonstrated, with the proposed algorithm achieving a recall rate of 93%, significantly higher than that of the support vector machine (85%) and decision tree (80%). During the inspection process, the convolutional neural network-based model more effectively identified all stems and capillary stem impurities, reducing the likelihood of missed detections. This is crucial for ensuring the quality of the final product. Any undetected impurities could negatively impact the consumer experience.

[0082] Figure 3c The F1 test results for each algorithm are presented. The proposed algorithm achieved an F1 score of 93.1%, a significant improvement over the support vector machine (86%) and decision tree (81.5%). This balance is crucial for industrial production, as it ensures efficient rejection of substandard products while avoiding wasteful resource allocation due to excessive misclassifications.

[0083] Figure 3d The average system response time for each algorithm is presented. The results show that the average response time for the convolutional neural network-based model is only 5 seconds, significantly lower than that of the support vector machine (12 seconds) and decision tree (15 seconds). This demonstrates that despite the complex computational requirements of the convolutional neural network model, it remains highly efficient in practice thanks to optimized training strategies and hardware acceleration technology. The rapid response speed enables the system to monitor tobacco purity in real time without affecting production flow.

[0084] It can be seen from this that the technical solution of this application can achieve the following technical effects:

[0085] High detection accuracy: Hyperspectral imaging technology can obtain rich spectral information of tobacco samples, and convolutional neural networks can automatically learn multi-level feature representations, effectively improving classification accuracy. The model accuracy reaches 95%, which is significantly better than traditional support vector machine (87%) and decision tree (83%) algorithms.

[0086] Fast detection speed: The system's average response time is only 5 seconds, much lower than the support vector machine (12 seconds) and decision tree (15 seconds). It can monitor tobacco purity in real time without affecting production rhythm. It can detect 720 tobacco samples per hour, greatly improving detection efficiency.

[0087] Strong detection reliability: The model's recall rate reaches 93% and the F1 value reaches 93.1%, both significantly higher than traditional algorithms. It can more effectively identify impurities and reduce the possibility of missed detection. The detection failure rate is as low as 0.5%, ensuring the reliability of the test results.

[0088] Providing a basis for quality control: Through in-depth analysis of the collected data, some previously unnoticed quality control points can be discovered, such as the changing trends of spectral characteristics at certain wavelengths, providing an important basis for quality control and process improvement in tobacco production.

[0089] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0090] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0091] Figure 4 FIG. 1 shows a structural block diagram of a training device for a tobacco purity prediction model provided by an embodiment of the present application. Figure 4 As shown. The training device 400 of the tobacco purity prediction model of this embodiment may include an acquisition module 401, an extraction module 402, a generation module 403, a fusion module 404 and a training module 405. Among them, the acquisition module 401 is used to acquire and preprocess a tobacco image sample set, wherein the tobacco image sample set contains multiple tobacco hyperspectral image samples, and each tobacco hyperspectral image sample carries a purity label; the extraction module 402 is used to extract the most representative spectral features from the preprocessed tobacco hyperspectral image samples based on principal component analysis and / or independent component analysis and / or wavelet transform; the generation module 403 is used to input the preprocessed tobacco hyperspectral image samples into the convolution layer and pooling layer of the convolutional neural network to generate a spatial feature map; the fusion module 404 is used to expand the dimension of the spectral features and perform channel splicing with the spatial feature map to obtain a fusion feature; the training module 405 is used to train the convolutional neural network based on the fusion feature to obtain a tobacco purity prediction model.

[0092] It should be noted that part or all of the training device of the tobacco purity prediction model of this embodiment can be an application located in the local terminal, or it can also be a functional unit such as a plug-in or software development kit (SDK) set in the application located in the local terminal, or it can also be a processing engine located in the network side server, or it can also be a distributed system located on the network side.

[0093] It is understandable that the application may be a native program (nativeApp) installed on the local terminal, or may be a webpage program (webApp) of a browser on the local terminal, which is not limited in this embodiment.

[0094] Optionally, in a possible implementation of this embodiment, the generation module 403 inputs the preprocessed tobacco hyperspectral image sample into the convolution layer and pooling layer of the convolutional neural network to generate a spatial feature map, specifically inputting the preprocessed tobacco hyperspectral image sample into each convolution layer in sequence to obtain multiple feature maps of different scales; performing maximum pooling and / or average pooling operations on the multiple feature maps of different scales, and fusing the multiple feature maps of different scales after the pooling operation into a spatial feature map.

[0095] Optionally, in a possible implementation of this embodiment, the fusion module 404, after dimensionally expanding the spectral feature, performs channel splicing with the spatial feature map to obtain a fused feature, is specifically used to dimensionally expand the spectral feature, then perform channel splicing with a spatial feature map containing multiple feature maps of different scales to obtain a fused feature; and / or; after dimensionally expanding the spectral feature, perform channel splicing with a spatial feature map containing local features and / or global features to obtain a fused feature.

[0096] Figure 5 FIG. 1 shows a structural block diagram of a tobacco purity prediction device provided by an embodiment of the present application. Figure 5 As shown. The tobacco purity prediction device 500 of this embodiment may include an acquisition module 501, an extraction module 502, a generation module 503, a fusion module 504 and a prediction module 505. Among them, the acquisition module 501 is used to acquire and preprocess the tobacco hyperspectral image; the extraction module 502 is used to extract the most representative spectral features from the preprocessed tobacco hyperspectral image based on principal component analysis and / or independent component analysis and / or wavelet transform; the generation module 503 is used to input the preprocessed tobacco hyperspectral image into the convolution layer and pooling layer of the convolutional neural network to generate a spatial feature map; the fusion module 504 is used to expand the dimension of the spectral feature and perform channel splicing with the spatial feature map to obtain a fused feature; the prediction module 505 is used to input the fused feature into the tobacco purity prediction model and output the tobacco purity prediction result; the tobacco purity prediction model is determined based on the training method of the tobacco purity prediction model described in the first aspect.

[0097] In this embodiment, a tobacco image sample set can be obtained and preprocessed. The most representative spectral features are extracted from the preprocessed tobacco hyperspectral image samples based on principal component analysis, independent component analysis, and / or wavelet transform. The preprocessed tobacco hyperspectral image samples are input into the convolutional and pooling layers of a convolutional neural network to generate a spatial feature map. The spectral features are dimensionally expanded and then channel-joined with the spatial feature map to generate fused features. The convolutional neural network is trained based on the fused features to generate a tobacco purity prediction model. This allows for a trained prediction model that can quickly and accurately detect tobacco purity, improving quality control in the tobacco industry.

[0098] One embodiment of the present application provides a computer-readable storage medium, wherein the storage medium stores at least one instruction, and the at least one instruction is loaded and executed by a processor to implement the tobacco purity prediction model training method or tobacco purity prediction method as described above.

[0099] An embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores at least one instruction, and the instruction is loaded and executed by the processor to implement the tobacco purity prediction model training method or tobacco purity prediction method as described above.

[0100] In the technical solution of this application, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0101] Figure 6 A schematic block diagram of an example electronic device 600 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or claimed herein.

[0102] like Figure 6As shown, the electronic device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. Various programs and data required for the operation of the electronic device 600 can also be stored in the RAM 603. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0103] Multiple components in the electronic device 600 are connected to the I / O interface 605, including an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a magnetic disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the electronic device 600 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0104] The computing unit 601 can be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as the training method of the tobacco purity prediction model or the tobacco purity prediction method. For example, in some embodiments, the training method of the tobacco purity prediction model or the tobacco purity prediction method can be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the training method of the tobacco purity prediction model or the tobacco purity prediction method described above can be performed. Alternatively, in other embodiments, the computing unit 601 may be configured in any other appropriate manner (eg, by means of firmware) to execute the tobacco purity prediction model training method or the tobacco purity prediction method.

[0105] Various embodiments of the systems and techniques described above can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, at least one input device, and at least one output device.

[0106] The program code for implementing the methods of the present application can be written in any combination of one or more programming languages. Such program code can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the program code is executed by the processor or controller, the functions / operations specified in the flow charts and / or block diagrams are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0107] In the context of the present application, a machine-readable medium can be a tangible medium that can contain or store a program for use by an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0108] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0109] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0110] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact through a communication network. The client-server relationship arises through computer programs running on the respective computers and having a client-server relationship with each other. The server may be a cloud server, a server in a distributed system, or a server integrated with a blockchain.

[0111] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this application can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this application can be achieved. This is not a limitation herein.

[0112] The above specific embodiments do not constitute a limitation on the scope of protection of this application. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application shall be included within the scope of protection of this application.

Claims

1. A method for training a tobacco purity prediction model, characterized in that: include: Acquire and preprocess a tobacco image sample set, wherein the tobacco image sample set includes a plurality of tobacco hyperspectral image samples, each of which carries a purity label; Extracting the most representative spectral features from the preprocessed tobacco hyperspectral image samples based on principal component analysis and / or independent component analysis and / or wavelet transform; The preprocessed tobacco hyperspectral image samples are input into the convolutional layer and pooling layer of the convolutional neural network to generate a spatial feature map; After the spectral feature is dimensionally expanded, channel splicing is performed with the spatial feature map to obtain a fusion feature; The convolutional neural network is trained based on the fusion features to obtain a tobacco purity prediction model.

2. The method according to claim 1, wherein The preprocessed tobacco hyperspectral image samples are input into the convolutional layer and pooling layer of the convolutional neural network to generate a spatial feature map, which includes: The preprocessed tobacco hyperspectral image samples are sequentially input into each convolutional layer to obtain multiple feature maps of different scales; Perform maximum pooling and / or average pooling operations on the multiple feature maps of different scales, and fuse the multiple feature maps of different scales after the pooling operation into a spatial feature map.

3. The method according to claim 1, wherein The convolution kernel of the convolutional layer of the convolutional neural network is variable; the method further includes: According to the different feature scale requirements of tobacco images, the convolution kernel size is dynamically adjusted to extract local and / or global features.

4. The method according to claim 2 or 3, wherein: After the spectral feature is dimensionally expanded, channel splicing is performed with the spatial feature map to obtain a fusion feature, specifically including: After dimension expansion of the spectral feature, channel splicing is performed with a spatial feature map comprising multiple feature maps of different scales to obtain a fusion feature; and / or; After the spectral features are dimensionally expanded, channel splicing is performed with a spatial feature map containing local features and / or global features to obtain a fusion feature.

5. A tobacco purity prediction method, characterized in that: include: Acquire tobacco hyperspectral images and perform preprocessing; Extracting the most representative spectral features from the preprocessed tobacco hyperspectral image based on principal component analysis and / or independent component analysis and / or wavelet transform; The preprocessed tobacco hyperspectral image is input into the convolutional layer and pooling layer of the convolutional neural network to generate a spatial feature map; After the spectral feature is dimensionally expanded, channel splicing is performed with the spatial feature map to obtain a fusion feature; The fusion feature is input into a tobacco purity prediction model to output a tobacco purity prediction result; the tobacco purity prediction model is determined based on the training method of the tobacco purity prediction model according to any one of claims 1 to 4.

6. A training device for a tobacco purity prediction model, characterized in that: include: an acquisition module, configured to acquire and preprocess a tobacco image sample set, wherein the tobacco image sample set includes a plurality of tobacco hyperspectral image samples, each of which carries a purity label; An extraction module, for extracting the most representative spectral features from the preprocessed tobacco hyperspectral image sample based on principal component analysis and / or independent component analysis and / or wavelet transform; A generation module is used to input the preprocessed tobacco hyperspectral image samples into the convolution layer and pooling layer of the convolutional neural network to generate a spatial feature map; A fusion module is used to perform channel splicing on the spectral feature after dimension expansion and the spatial feature map to obtain a fusion feature; A training module is used to train a convolutional neural network based on the fusion features to obtain a tobacco purity prediction model.

7. A tobacco purity prediction device, characterized in that: include: Acquisition module, used to acquire tobacco hyperspectral images and perform preprocessing; An extraction module, for extracting the most representative spectral features from the preprocessed tobacco hyperspectral image based on principal component analysis and / or independent component analysis and / or wavelet transform; A generation module is used to input the preprocessed tobacco hyperspectral image into the convolution layer and pooling layer of the convolutional neural network to generate a spatial feature map; A fusion module is used to perform channel splicing on the spectral feature after dimension expansion and the spatial feature map to obtain a fusion feature; A prediction module is used to input the fusion feature into a tobacco purity prediction model and output a tobacco purity prediction result; the tobacco purity prediction model is determined based on the training method of the tobacco purity prediction model according to any one of claims 1 to 4.

8. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 5.

9. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 5.

10. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 5.