Tobacco moisture detection method based on convolutional neural network model

Through the tobacco moisture detection method based on the convolutional neural network model, the tobacco morphology and process stage are identified in real time, and the infrared moisture meter is controlled to select appropriate channels, which solves the problems of tobacco moisture detection error and cumbersome detection process in the existing technology, and achieves efficient and accurate tobacco moisture detection.

CN120064200APending Publication Date: 2025-05-30CHINA JILIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510147324.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-11
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

The existing infrared moisture meter has errors in tobacco moisture detection, which cannot meet the requirements of cigarette production quality, and the inspection process is cumbersome and cannot achieve real-time synchronization.

Method used

The tobacco moisture detection method based on the convolutional neural network model is adopted to identify the tobacco morphology and process stage in real time through image acquisition and classification, and the infrared moisture meter is controlled to select the corresponding channel for detection.

Benefits of technology

It realizes rapid response and high accuracy of tobacco moisture detection, reduces infrared moisture meter detection errors, and improves the reliability and automation level of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120064200A_ABST
    Figure CN120064200A_ABST
Patent Text Reader

Abstract

The invention discloses a tobacco moisture detection method based on a convolutional neural network model. Tobacco images in the industrial production process are collected through interval sampling, classified and marked, then the tobacco images are input into a convolutional neural network constructed through preset design to be trained, a trained model is deployed to edge computing equipment, the images are processed in real time through the autonomous ability of the edge computing equipment, and the image processing efficiency is improved. An exclusive channel is established for each type of tobacco through calibration of the infrared moisture meter, and the infrared moisture meter is controlled to select a detection channel corresponding to the tobacco type according to an output result of the edge equipment. The moisture detection precision can be remarkably improved, errors are reduced, and manual intervention is reduced; compared with a traditional method, the reliability, the automation level and the efficiency of the system are improved, and the method is widely applied to tobacco and other industrial fields needing accurate moisture detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of near-infrared tobacco moisture detection, and particularly relates to a tobacco moisture detection method based on a convolutional neural network model. Background Art

[0002] Near-infrared spectroscopy analysis technology, as a non-destructive, fast and environmentally friendly analysis and detection technology, is widely used in qualitative and quantitative analysis in many fields such as food, agriculture, pharmaceuticals, chemical engineering, biomedicine, and environmental monitoring. The tobacco industry is one of the important economic pillars of our country. The production quality of cigarettes plays a crucial role. During the production process of cigarettes, the moisture content of tobacco is an important index affecting the quality of the final product. Therefore, it is particularly important to detect the moisture content of tobacco in all production links.

[0003] Currently, the TM710e series infrared moisture meters are widely used in the tobacco production process. As a moisture content measuring instrument using near-infrared spectroscopy technology, it has the advantages of high efficiency, accuracy, and portability. The resolution of its moisture detection can reach 0.01%. In the tobacco production process, it is required that the absolute value of the difference between the average moisture content reading during sampling by the moisture meter and the average moisture content of the laboratory sample should not exceed the allowable error (0.3%).

[0004] The working principle of the infrared moisture meter is to use a near-infrared light beam to irradiate the surface of the sample to be measured. The water molecules in the surface sample absorb and reflect the near-infrared light. The reflected near-infrared light beam is received and processed by an advanced infrared optical detection system to obtain the moisture content of the sample to be measured. Therefore, it is easily affected by many factors of the sample. However, in the actual production process, the samples cannot be completely unified, and the differences in various factors will affect the measurement results of the infrared moisture meter, resulting in a certain error between its value and the actual moisture content, which cannot meet the requirements in the verification regulations. At this time, it is necessary to use the moisture detected by the oven method as the standard, and correct the moisture meter according to the error between the detection value of the infrared moisture meter and the standard value. This process not only takes a long time but also has a certain lag, and cannot be compared synchronously with the measurement results of the infrared moisture meter.

[0005] Therefore, to ensure the production quality of cigarettes, reduce the error of the infrared moisture meter in measuring the moisture of tobacco, and achieve stable detection of the equipment is an urgent problem to be solved. Summary of the Invention

[0006] To solve the technical problems existing in the background art, the present invention provides a tobacco moisture detection method based on a convolutional neural network model. The method of the present invention can collect and identify tobacco images in real time during the production process, classify different categories, and control the infrared moisture meter to select the corresponding channel according to the output result of the edge device. The method of the present invention is applicable to the occasion of detecting the moisture of tobacco using an infrared moisture meter.

[0007] The technical solution adopted by the present invention specifically includes the following steps:

[0008] I. A tobacco moisture detection method based on a convolutional neural network model

[0009] The tobacco moisture detection method includes the following steps:

[0010] S1) Collect tobacco images in different forms and process stages and construct them into a data set;

[0011] The specific steps of S1 are as follows:

[0012] S1.1) During the production process, use a camera to collect tobacco images of different forms of tobacco at different process stages; the forms include tobacco leaves, cut stem, and cut tobacco; the process stages include before and after vacuum conditioning, before and after flavoring, before and after adding fragrance, and before and after drying.

[0013] S1.2) Classify the tobacco images according to the form and process stage of the tobacco, and label the tobacco images with the category. Among them, each combination of form and process stage forms a category.

[0014] S1.3) Perform preprocessing on each tobacco image respectively; the preprocessing includes image size adjustment, data augmentation, noise removal, and normalization.

[0015] S1.4) Use each preprocessed tobacco image as the input and the corresponding category label as the output to form a sample pair, and combine all sample pairs to obtain a data set.

[0016] S2) Construct a convolutional neural network model; in the step S2, the convolutional neural network model includes seven processing modules. The seven processing modules are respectively: The first processing module includes a first convolutional layer and a max pooling layer connected in sequence; the input of the convolutional neural network model passes through the first convolutional layer and then is processed by a non-linear activation function and a normalization process in sequence and transmitted to the max pooling layer, and the output end of the max pooling layer serves as the output end of the first processing module; the second processing module includes a basic unit and five downsampling units connected in sequence; the input end of the basic unit of the second processing module is connected to the output end of the first processing module, and the output end of the last downsampling unit of the second processing module serves as the output end of the second processing module; the third processing module includes a basic unit and nine downsampling units connected in sequence; the input end of the basic unit of the third processing module is connected to the output end of the second processing module, and the output end of the last downsampling unit of the third processing module serves as the output end of the third processing module; the fourth processing module includes a basic unit and five downsampling units connected in sequence; the input end of the basic unit of the fourth processing module is connected to the output end of the third processing module, and the output end of the last downsampling unit of the fourth processing module serves as the output end of the fourth processing module; the fifth processing module includes a second convolutional layer; the input end of the second convolutional layer serves as the input end of the fifth processing module and is connected to the output end of the fourth processing module, and the output end of the second convolutional layer serves as the output end of the fifth processing module; the sixth processing module includes a global average pooling layer; the input end of the global average pooling layer serves as the input end of the sixth processing module and is connected to the output end of the fifth processing module, and the output end of the global average pooling layer serves as the output end of the sixth processing module; the seventh processing module includes a fully connected layer and a Softmax layer connected in sequence; the input end of the fully connected layer serves as the input end of the seventh processing module and is connected to the output end of the sixth processing module, and the output end of the Softmax layer serves as the output end of the seventh processing module; an output layer, which is used to obtain the category corresponding to the maximum probability value as the tobacco category according to a set of probability distributions output by the Softmax layer of the seventh processing module; the input end is connected to the output end of the seventh processing module, and the output layer serves as the output end of the convolutional neural network model and outputs the tobacco category.

[0017] The output channel numbers of the first processing module, the second processing module, the third processing module, and the fourth processing module are 32, 128, 256, and 512 respectively.

[0018] In the second processing module, the third processing module, and the fourth processing module, the basic unit and the downsampling unit have the same structure.

[0019] The basic unit includes:

[0020] A channel separation layer for performing channel separation processing on the input of a basic unit to obtain two grouped features; the input end serves as the input end of the basic unit, and the two grouped features are respectively output from the first output end and the second output end;

[0021] A third convolutional layer, with its input end connected to the first output end of the channel separation layer;

[0022] A first depthwise separable convolutional layer, and the output of the third convolutional layer is sequentially passed through a non-linear activation function processing and a normalization processing and then transmitted to the input end of the first depthwise separable convolutional layer;

[0023] A fourth convolutional layer, and the output of the first depthwise separable convolutional layer is transmitted to the input end of the fourth convolutional layer after passing through a normalization processing;

[0024] A first frequency domain attention convolutional layer, and the output of the fourth convolutional layer is sequentially passed through a non-linear activation function processing and a normalization processing and then transmitted to the input end of the first frequency domain attention convolutional layer;

[0025] A first splicing layer, provided with a first input end, a second input end and an output end, for performing channel splicing processing on the input features of the first input end and the second input end, and the result of the channel splicing processing is output from the output end; the first input end of the first splicing layer is connected to the output end of the first frequency domain attention convolutional layer, and the second input end is connected to the second output end of the channel separation layer;

[0026] A first shuffling layer for performing channel shuffling processing on the input features; the input end is connected to the output end of the first splicing layer, and the output end serves as the output end of the basic unit and outputs the features after channel shuffling.

[0027] The downsampling unit includes:

[0028] A first branch, whose input end receives the input of the downsampling unit; it includes a second depthwise separable convolutional layer, a fifth convolutional layer and a second frequency domain attention convolutional layer connected in sequence; the input end of the second depthwise separable convolutional layer serves as the input end of the first branch, the output of the second depthwise separable convolutional layer is transmitted to the input end of the fifth convolutional layer after passing through a normalization processing, the output of the fifth convolutional layer is sequentially passed through a non-linear activation function processing and a normalization processing and then transmitted to the input end of the second frequency domain attention convolutional layer, and the output end of the second frequency domain attention convolutional layer serves as the output end of the first branch;

[0029] The second branch, whose input end receives the input of the downsampling unit; it includes a sixth convolutional layer, a third depthwise separable convolutional layer, a seventh convolutional layer, and a third frequency-domain attention convolutional layer connected in sequence; the input end of the sixth convolutional layer serves as the input end of the second branch, and the output of the sixth convolutional layer is passed to the third depthwise separable convolutional layer after being processed by a non-linear activation function and a normalization process in sequence. The output of the third depthwise separable convolutional layer is passed to the input end of the seventh convolutional layer after being normalized. The output of the seventh convolutional layer is passed to the input end of the third frequency-domain attention convolutional layer after being processed by a non-linear activation function and a normalization process in sequence. The output end of the third frequency-domain attention convolutional layer serves as the output end of the second branch;

[0030] The second splicing layer, which is provided with a first input end, a second input end, and an output end, and is used to perform channel splicing processing on the input features of the first input end and the second input end. The result of the channel splicing processing is output from the output end; the output end of the first branch is connected to the first input end of the second splicing layer, and the output end of the second branch is connected to the second input end of the second splicing layer;

[0031] The second shuffle layer is used to perform channel shuffle processing on the input features; the input end is connected to the output end of the second splicing layer, and the output end serves as the output end of the downsampling unit and outputs the features after channel shuffle.

[0032] Specifically, in each processing module, basic unit, and downsampling unit, the non-linear activation function processing all uses the LeakyReLU activation function.

[0033] S3) Use the data set obtained in step S1 to train the convolutional neural network model obtained in step S2.

[0034] S4) Collect the tobacco images to be detected, use the trained convolutional neural network model obtained in step S3 to classify the tobacco images to be detected, and obtain the category of the tobacco to be detected; select the corresponding detection channel according to the category of the tobacco to be detected, and perform moisture detection on the tobacco to be detected to obtain the moisture detection result.

[0035] The specific steps of step S4 are as follows:

[0036] S4.1) Deploy the trained convolutional neural network model to the edge computing device; pre-establish the detection channels corresponding to each category of tobacco through the calibration of the infrared moisture meter;

[0037] S4.2) Use the camera on the edge computing device to collect the tobacco images to be detected;

[0038] S4.3) On the edge computing device, use the trained convolutional neural network model to classify the tobacco images to be detected, and obtain the category of the tobacco to be detected;

[0039] S4.4) After selecting the corresponding detection channel according to the type of tobacco to be detected, control the infrared moisture meter to detect the moisture of the tobacco to be detected, and obtain the moisture detection result.

[0040] II. An edge computing device applied to the above-mentioned tobacco moisture detection method based on a convolutional neural network model

[0041] The edge computing device includes:

[0042] A camera for collecting tobacco images to be detected;

[0043] A processor for loading and using the trained convolutional neural network model for classification processing;

[0044] A controller for selecting the corresponding detection channel according to the type of tobacco to be detected and controlling the infrared moisture meter to detect the moisture of the tobacco to be detected.

[0045] The beneficial effects of the present invention compared with the prior art are as follows:

[0046] 1. By deploying the improved convolutional neural network model to the edge computing device, the present invention can process the tobacco images collected in industrial production in real time and classify them, achieving fast response.

[0047] 2. The edge device can operate independently without relying on a stable network connection, has good anti-interference ability and environmental adaptability, and significantly improves the reliability of the system.

[0048] 3. The model can accurately distinguish the subtle differences of tobacco under complex production conditions, improve the classification accuracy, provide an accurate basis for the subsequent channel selection of the infrared moisture meter, and reduce the error when detecting moisture.

[0049] 4. The technical route designed by the present invention supports flexible adjustment of the model structure and hyperparameters. By monitoring the loss function value of the model, the training effect can be quickly evaluated, and the network structure and strategy can be optimized and adjusted to ensure the adaptability of the model performance in different environments and tasks.

[0050] 5. Using the edge computing device combined with the camera and the infrared moisture meter realizes a complete closed-loop from image acquisition, classification detection to channel control. This integrated process reduces the manual intervention and complex communication steps in the traditional detection method, and greatly improves the detection efficiency and the automation level of the system.

[0051] Generally speaking, the present invention integrates tobacco image acquisition, classification recognition and infrared moisture meter control through an edge processing method of industrial device data based on a convolutional neural network, constructs an efficient automated processing system, and provides reliable and effective technical support for reducing the error of online moisture detection of tobacco by the infrared moisture meter. Description of the Drawings

[0052] Figure 1 It is a schematic structural diagram of the basic unit of the convolutional neural network in the present invention;

[0053] Figure 2 It is a schematic structural diagram of the downsampling unit of the convolutional neural network in the present invention;

[0054] Figure 3 It is a schematic structural diagram of the Frequency Attention Convolution (FAC) of the convolutional neural network in the present invention;

[0055] Figure 4 It is a graph showing the change of the training accuracy and loss function of the model in the present invention. Detailed Embodiments

[0056] The present invention will be further described in detail below with reference to the drawings and specific embodiments.

[0057] The specific embodiments of the present invention are as follows:

[0058] Embodiment

[0059] In this embodiment, a trained convolutional neural network model is obtained through the following process, and the same tobacco image data is classified and detected by the trained convolutional neural network model, Shufflenetv2, Mobilenetv3, Efficientnetv2, Xception, Squeezenet, Mnasnet, Maxvit, and Ghostnetv2 respectively.

[0060] This embodiment includes the following steps:

[0061] S1) Collect tobacco images in different forms and at different process stages and generate a dataset for training. Specifically:

[0062] S1.1) During the industrial production process, capture image data of tobacco in different forms at different process stages through a camera at regular intervals.

[0063] S1.2) According to the different forms of tobacco (such as tobacco leaves, cut stems, cut tobacco) and process stages (such as before and after vacuum conditioning, before and after flavoring, before and after adding fragrance, before and after drying, etc.), the collected image data is divided into 20 categories and corresponding annotations are made. Among them, each combination of form and process stage forms a category, such as tobacco leaves before vacuum conditioning, cut tobacco after drying, etc.

[0064] S1.3) Preprocess the image data to improve the image quality and enhance the model training effect.

[0065] The preprocessing method specifically includes the following steps:

[0066] a) Image size adjustment: Adjust the image to a unified fixed size for batch processing. It should be noted that excessive distortion or blurring should be avoided during the adjustment process.

[0067] b) Data augmentation: Generate more samples by rotating, scaling, translating, flipping, cropping, etc. on the image to increase data diversity and improve the generalization ability of the model.

[0068] c) Noise removal: Denoise the image (such as Gaussian filtering, median filtering, bilateral filtering, etc.) to eliminate noise generated during processes such as lighting, shooting equipment, and transmission, improve the quality of the image, and enhance the recognition accuracy of the image.

[0069] d) Standardization: Standardize the image, scale the pixel values to a suitable range, accelerate the training process, and improve the convergence of the model.

[0070] S1.4) Use each processed tobacco image as the input and the corresponding classification label as the output to combine a sample pair. Combine all sample pairs to obtain a dataset.

[0071] S2) Construct a convolutional neural network model. The structure of the convolutional neural network model mainly involves two special units, namely the basic unit with a stride of 1 and the downsampling unit with a stride of 2. The convolutional neural network model provided by the present invention, constructed based on the basic unit and the downsampling unit, can process features of different frequencies by selecting frequency components, capture features from multiple scales, assign appropriate weights to different features, retain global structure information, and highlight local details.

[0072] As Figure 1 shown, the basic unit divides the input features into two branches through channel split. The left branch performs an identity mapping without any operation; the right branch sequentially passes through a regular convolution (1×1Conv), a depthwise separable convolution (3×3DWConv), a regular convolution (1×1Conv), and a frequency domain attention convolution (FAC). After each regular convolution, a non-linear activation function processing (LeakyReLU) and a normalization processing (BN) are performed. Only normalization processing (BN) is performed after the depthwise separable convolution. After the left and right branches are merged together through channel concatenation (Concat), channel shuffle (ChannelShuffle) is performed to ensure full fusion of the feature information of the left and right branches.

[0073] As Figure 2As shown, the downsampling unit directly inputs the features into two branches without using channel separation operation. The left branch (the first branch) sequentially passes through depthwise separable convolution (3×3 DWConv), ordinary convolution (1×1 Conv), and frequency-domain attention convolution (FAC); the right branch sequentially passes through ordinary convolution (1×1 Conv), depthwise separable convolution (3×3 DWConv), ordinary convolution (1×1 Conv), and frequency-domain attention convolution (FAC). Similarly, after each ordinary convolution, non-linear activation function processing (LeakyReLU) and normalization processing (BN) are performed, and only normalization processing (BN) is performed after depthwise separable convolution. After the left and right branches are merged together through channel concatenation (Concat), channel shuffle is performed.

[0074] The overall structure of the convolutional neural network model is shown in Table 1, which mainly includes seven processing modules.

[0075] Table 1 Overall network structure of the convolutional neural network model

[0076]

[0077]

[0078] As can be seen from Table 1, the seven processing modules are respectively:

[0079] The first processing module includes a first convolutional layer and a max pooling layer connected in sequence; the input of the convolutional neural network model (i.e., the input of the first processing module) passes through the first convolutional layer and then is sequentially passed to the max pooling layer through non-linear activation function processing and normalization processing, and the max pooling layer is directly connected to the second processing module;

[0080] The second processing module includes a basic unit and five downsampling units connected in sequence; the output features of the max pooling layer of the first processing module (i.e., the input features of the second processing module) are sequentially processed by a basic unit and five downsampling units of the second processing module and then directly connected to the third processing module;

[0081] The third processing module includes a basic unit and nine downsampling units connected in sequence; the output features of the last downsampling unit of the second processing module (i.e., the input features of the third processing module) are sequentially processed by a basic unit and nine downsampling units of the third processing module and then directly connected to the fourth processing module;

[0082] The fourth processing module includes a basic unit and five downsampling units connected in sequence; the output features of the last downsampling unit of the third processing module (i.e., the input features of the fourth processing module) are directly transmitted and connected to the fifth processing module after being processed by a basic unit and five downsampling units of a fourth processing module in sequence.

[0083] The fifth processing module includes a second convolutional layer; the output features of the last downsampling unit of the fourth processing module (the input features of the fifth processing module) are transmitted and connected to the sixth processing module after passing through the second convolutional layer and then through non-linear activation function processing and normalization processing in sequence.

[0084] The sixth processing module includes a global average pooling layer; the output features of the second convolutional layer of the fifth processing module (i.e., the input features of the sixth processing module) are transmitted and connected to the seventh processing module after passing through the global average pooling layer.

[0085] The seventh processing module includes a fully connected layer and a Softmax layer connected in sequence; the output features of the global average pooling layer of the sixth processing module (i.e., the input features of the seventh processing module) are transmitted and connected to the Softmax layer after passing through the fully connected layer, and the Softmax layer converts the output of the fully connected layer into a probability distribution and then transmits and connects it to the output layer.

[0086] The output layer receives the probability distribution output by the Softmax layer of the seventh processing module and obtains the category corresponding to the maximum probability value as the tobacco category; the output layer outputs the tobacco category as the output end of the convolutional neural network model.

[0087] Among them, the number of downsampling units in the second processing module, the third processing module, and the fourth processing module are set to 5, 9, and 5 respectively. Since some types of tobacco have high similarities, at this quantity, the network update can be more delicate, better capturing more subtle shape features and tiny color differences between tobaccos and fully learning more detailed information features of tobaccos. At the same time, there are also requirements for the number of channels when using FAC. When applying FAC in the present invention, the first 16 low-frequency components are used, and the number of channels needs to be divisible by n. Correspondingly, the output channel numbers of the first, second, third, and fourth processing models of the model are set to [32, 128, 256, 512].

[0088] Among them, the frequency-domain attention convolution combines the characteristics of frequency-domain analysis and the convolutional neural network model to improve the feature extraction ability of the model. As Figure 3 shown, by dividing the input feature map X into channels as [X 0 ,X 1 ,X 2 ,...,X n-1different feature blocks, assign a frequency component of the discrete cosine transform (DCT) (pre-selected in advance) to each feature block, and after splicing, obtain weights through a fully connected operation. For each feature block, multiply the calculated weight element-wise with its corresponding channel feature to obtain a re-weighted feature. The re-weighted results of all sub-blocks are integrated by summation, and finally an enhanced channel feature map is obtained.

[0089]

[0090] In the formula, Freq i As the preprocessing of channel attention; n is the number of divided feature blocks; i is the index corresponding to the current feature block; H, W are the width and height of the input feature map X; :, h, w are the position indexes of the current feature point; u, v are the 2D indexes of the frequency components; B represents the basic form of the discrete cosine transform.

[0091] In the present invention, the non-linear activation function adopts the LeakyReLU activation function, etc. The LeakyReLU activation function solves the problem that when the input value is always less than 0, the output and gradient of the ReLU activation function are 0, resulting in the loss of the expression ability of some neurons in the network, while retaining the advantages of the ReLU activation function such as simple calculation, high efficiency, wide applicability, and strong compatibility, by introducing a small slope α (usually 0.01) in the negative part of the ReLU function. The expression of the LeakyReLU activation function is:

[0092] f(x) = x (x ≥ 0), f(x) = αx (x < 0))

[0093] In the formula, x is the input value; α is the slope of the negative activation value, usually 0.01.

[0094] S3) Use the data set obtained in step S1 to train the convolutional neural network model obtained in step S2; during the training process, adjust the network structure, hyperparameters or training strategy by monitoring the changes in the output results and loss function values of the convolutional neural network model. Specifically: during the training process, the network will calculate the prediction results of each sample through forward propagation, compare them with the actual labels, and calculate the value of the loss function. By continuously updating the network parameters, the value of the loss function is gradually reduced, so that the model can better fit the training data.

[0095] In this embodiment, the changes in the accuracy rate and loss function during the training process are as Figure 4 shown. It can be seen that the value of the loss function (Loss) gradually decreases as the number of training rounds increases, and the accuracy rate (ACC) gradually increases as the number of training rounds increases, and finally both tend to be stable, indicating that the model is effectively learning data features and gradually improving its classification ability for data during the training process.

[0096] S4) Collect the tobacco images to be detected, and use the trained convolutional neural network model obtained in step S3 to classify the tobacco images to be detected, so as to obtain the category of the tobacco to be detected; select the corresponding detection channel according to the category of the tobacco to be detected, and perform moisture detection on the tobacco to be detected to obtain the moisture detection result.

[0097] Step S4 is specifically as follows:

[0098] S4.1) Deploy the trained convolutional neural network model to the edge computing device; pre-establish the detection channels corresponding to each category of tobacco through the calibration of the infrared moisture meter.

[0099] In this embodiment, the edge computing device used is the Huashan School - CV1812H development board, but it is not limited to this. Any device that can perform data analysis and decision-making through local computing, storage, and processing and make real-time decisions at the data source end or near the place where data is generated can perform classification detection of tobacco images through this invention.

[0100] The process of deploying the trained convolutional neural network model to the edge computing device is specifically as follows: After training, validating, and saving the model on the workstation through the collected tobacco image data, convert the model into a format adapted to the edge device, and install the necessary runtime environment and dependencies for the edge device. Then, transfer the model file to the device through SSH, USB, or other methods together with the relevant code.

[0101] The detection channel specifically refers to a set of measurement parameters and measurement modes set for a specific category of tobacco in the infrared moisture meter. These parameters and modes can be optimized according to the physical or chemical characteristics of the object to be measured to improve the accuracy and efficiency of measurement.

[0102] S4.2) Use the edge device to combine the model with the camera, and then use the camera on the edge computing device to collect the image of the tobacco to be detected as the tobacco image to be detected.

[0103] S4.3) On the edge computing device, use the trained convolutional neural network model to classify the tobacco image to be detected to obtain the category of the tobacco to be detected;

[0104] S4.4) After selecting the corresponding detection channel according to the category of the tobacco to be detected, control the infrared moisture meter to perform moisture detection on the tobacco to be detected under the corresponding detection channel to reduce the error of the infrared moisture meter when detecting the moisture of the tobacco.

[0105] In this embodiment, in order to demonstrate the accuracy of the moisture detection results, after the training is completed, the tobacco image data of known types is used as test samples to test the classification ability of the convolutional neural network model for tobacco images, and the classification results are counted to calculate the classification accuracy.

[0106] In addition, for comparison, the same tobacco image data is classified and detected using Shufflenetv2, Mobilenetv3, Efficientnetv2, Xception, Squeezenet, Mnasnet, Maxvit, and Ghostnetv2 respectively, and the classification results are shown in Table 2.

[0107] Table 2 Classification test results of different models

[0108]

[0109] As can be seen from Table 2, all data of the model in this embodiment are in the leading position among these models, indicating that it can be well competent in the task of tobacco image classification. It can not only accurately identify positive examples but also maintain balance in multi-class tasks. This verifies the reliability and practicability of the network structure proposed by the present invention.

[0110] In summary, the method of the present invention, through automated image acquisition and processing, combined with the real-time decision-making ability of edge computing devices, can not only improve the accuracy of the infrared moisture meter, reduce its error in detecting tobacco moisture, but also effectively reduce the time consumption, error rate, and operation burden in manual detection, thus realizing a more efficient, accurate, and reliable industrial production detection system.

[0111] The above specific embodiments are used to explain and illustrate the present invention, rather than to limit the present invention. Any modifications and changes made within the spirit and scope of the claims of the present invention fall within the protection scope of the present invention.

[0112] The above are only the preferred embodiments of the present invention. Therefore, all equivalent changes or modifications made according to the structure, features, and principles described in the scope of the present invention patent application are included in the scope of the present invention patent application.

Claims

1. A tobacco moisture detection method based on a convolutional neural network model, characterized in that: The following steps are involved: S1) Collect tobacco images of different forms and process stages and construct them into a dataset; S2) constructing a convolutional neural network model; S3) using the data set obtained in step S1 to train the convolutional neural network model obtained in step S2; S4) collecting a tobacco image to be detected, using the trained convolutional neural network model obtained in step S3 to classify the tobacco image to be detected, and obtaining the category of the tobacco to be detected; selecting a corresponding detection channel according to the category of the tobacco to be detected, performing moisture detection on the tobacco to be detected, and obtaining a moisture detection result.

2. The tobacco moisture detection method based on the convolutional neural network model according to claim 1, characterized in that: The step S1 is specifically as follows: S1.1) During the production process, use a camera to collect tobacco images of different forms and at different process stages; S1.2) classifying tobacco images according to tobacco morphology and process stages, and labeling tobacco images using categories; S1.3) performing preprocessing on each tobacco image respectively; the preprocessing includes image resizing, data enhancement, noise removal and standardization; S1.4) Each preprocessed tobacco image is taken as input and the corresponding category label is taken as output, and a sample pair is obtained by combining them. All sample pairs are combined to obtain a dataset.

3. The tobacco moisture detection method based on the convolutional neural network model according to claim 2, characterized in that: The forms include tobacco leaves, stem shreds and shredded tobacco; the process stages include before and after vacuum conditioning, before and after adding materials, before and after adding flavors, and before and after drying; the combination of each form and process stage forms a category.

4. The tobacco moisture detection method based on the convolutional neural network model according to claim 1, characterized in that: In step S2, the convolutional neural network model includes seven processing modules connected in sequence, and the seven processing modules are: The first processing module includes a first convolution layer and a maximum pooling layer connected in sequence; the input of the convolutional neural network model passes through the first convolution layer and is sequentially processed by a nonlinear activation function and a normalization process and then passed to the maximum pooling layer, and the output end of the maximum pooling layer serves as the output end of the first processing module; The second processing module includes a basic unit and five down-sampling units connected in sequence; The third processing module includes a basic unit and nine down-sampling units connected in sequence; The fourth processing module includes a basic unit and five down-sampling units connected in sequence; The fifth processing module includes a second convolutional layer; The sixth processing module includes a global average pooling layer; The seventh processing module includes a fully connected layer and a Softmax layer connected in sequence; The output layer is used to obtain the category corresponding to the maximum probability value as the tobacco category according to a set of probability distributions output by the Softmax layer of the seventh processing module and output it.

5. The tobacco moisture detection method based on the convolutional neural network model according to claim 4 is characterized in that: The basic unit comprises: The channel separation layer is used to perform channel separation processing on the input of the basic unit to obtain two grouped features; the input end is used as the input end of the basic unit, and the two grouped features are output by the first output end and the second output end respectively; The third convolutional layer, the input end is connected to the first output end of the channel separation layer; The first depth-separable convolutional layer, the output of the third convolutional layer is sequentially processed by a nonlinear activation function and normalized and passed to the input end of the first depth-separable convolutional layer; In the fourth convolutional layer, the output of the first depth-separable convolutional layer is normalized and then passed to the input of the fourth convolutional layer. The outputs of the first frequency domain attention convolution layer and the fourth convolution layer are processed by nonlinear activation functions and normalized in turn and then passed to the input of the first frequency domain attention convolution layer; A first splicing layer is used to perform channel splicing processing on the input features of the first input end and the second input end; the first input end is connected to the output end of the first frequency domain attention convolution layer, and the second input end is connected to the second output end of the channel separation layer; The first shuffling layer has an input end connected to the output end of the first splicing layer, and an output end serving as an output end of the basic unit.

6. The tobacco moisture detection method based on the convolutional neural network model according to claim 4 is characterized in that: The down sampling unit comprises: The first branch, the input end receives the input of the downsampling unit; includes a second depth-separable convolution layer, a fifth convolution layer, and a second frequency-domain attention convolution layer connected in sequence; the input end of the second depth-separable convolution layer is used as the input end of the first branch, the output of the second depth-separable convolution layer is passed to the input end of the fifth convolution layer after normalization, the output of the fifth convolution layer is passed to the input end of the second frequency-domain attention convolution layer through nonlinear activation function processing and normalization processing in sequence, and the output end of the second frequency-domain attention convolution layer is used as the output end of the first branch; The second branch, the input end receives the input of the downsampling unit; includes the sixth convolution layer, the third depth-separable convolution layer, the seventh convolution layer and the third frequency-domain attention convolution layer connected in sequence; the input end of the sixth convolution layer serves as the input end of the second branch, the output of the sixth convolution layer is sequentially passed to the third depth-separable convolution layer through nonlinear activation function processing and normalization processing, the output of the third depth-separable convolution layer is passed to the input end of the seventh convolution layer after normalization processing, the output of the seventh convolution layer is sequentially passed to the input end of the third frequency-domain attention convolution layer through nonlinear activation function processing and normalization processing, and the output end of the third frequency-domain attention convolution layer serves as the output end of the second branch; The second splicing layer is used to perform channel splicing processing on the input features of the first input end and the second input end; the output end of the first branch is connected to the first input end of the second splicing layer, and the output end of the second branch is connected to the second input end of the second splicing layer; The second shuffling layer is used to perform channel shuffling processing on the input features; the input end is connected to the output end of the second concatenation layer, and the output end serves as the output end of the downsampling unit.

7. The tobacco moisture detection method based on a convolutional neural network model according to any one of claims 4 to 6, characterized in that: The nonlinear activation function processing adopts the LeakyReLU activation function.

8. The tobacco moisture detection method based on a convolutional neural network model according to claim 4, characterized in that: The numbers of output channels of the first processing module, the second processing module, the third processing module and the fourth processing module are 32, 128, 256 and 512 respectively.

9. The tobacco moisture detection method based on a convolutional neural network model according to claim 4, characterized in that: The step S4 is specifically as follows: S4.1) deploying the trained convolutional neural network model on the edge computing device; establishing the detection channel corresponding to each category of tobacco in advance by calibrating the infrared moisture meter; S4.2) using a camera on an edge computing device to collect an image of the tobacco to be detected; S4.3) On the edge computing device, using the trained convolutional neural network model to classify the tobacco image to be detected, and obtain the category of the tobacco to be detected; S4.4) After selecting a corresponding detection channel according to the type of the tobacco to be detected, the infrared moisture meter is controlled to perform moisture detection on the tobacco to be detected to obtain a moisture detection result.

10. An edge computing device applied to the tobacco moisture detection method based on a convolutional neural network model as claimed in any one of claims 1 to 9, characterized in that: including a camera for acquiring an image of the tobacco to be inspected; including a processor for carrying and utilizing a trained convolutional neural network model for classification processing; A controller is included, which is used to select a corresponding detection channel according to the category of tobacco to be detected.