Cigarette end detection method and system based on convolutional neural network

Through the cigarette end detection method based on convolutional neural network, the problems of low efficiency and poor accuracy of traditional detection are solved, real-time online detection is achieved, the loss of shredded tobacco is reduced, the quality of tobacco products is improved, and the production cost is reduced.

CN118691803BActive Publication Date: 2024-10-25WUHAN TEXTILE UNIV
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411196640.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2024-10-25
Estimated Expiration
2044-08-29

AI Technical Summary

Technical Problem

Traditional cigarette powder detection methods have low efficiency and poor accuracy, and cannot achieve real-time online detection. Moreover, the cutting process causes the loss of shredded tobacco, affecting quality and utilization.

Method used

A cigarette end detection method based on convolutional neural network is adopted. By collecting longitudinal CT grayscale images, data enhancement and feature fusion are performed, and a backbone network and detection head are constructed to realize position information and prediction frame detection of cigarette ends. Combining CIoU and The DFL loss function is trained and deployed to the server device for detection.

Benefits of technology

It improves the efficiency and accuracy of cigarette end detection, realizes real-time online monitoring, reduces tobacco loss, provides the tobacco industry with reliable quality control means, and reduces production costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118691803B_ABST
    Figure CN118691803B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for detecting cigarette butts based on a convolutional neural network. Specifically, a CT scanner is used to scan a cigarette to be tested, and a longitudinal CT grayscale image of the cigarette to be tested is collected; data enhancement processing is performed on the collected CT grayscale image and a training data set is prepared, a cigarette butt recognition network is constructed and trained for detecting cigarette butts, and the trained cigarette butt recognition network is deployed on a server device to perform cigarette butt detection on the longitudinal CT image of the cigarette. The present invention improves the detection efficiency of cigarette butts, can realize real-time online monitoring, and reduces the loss of tobacco in the traditional detection process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the application of computer vision in tobacco industry quality inspection, and to a cigarette dust detection method and system based on convolutional neural network. Background Art

[0002] In the tobacco production process, the quality inspection of cigarettes is an important link to ensure product quality. The tobacco dust content, that is, the proportion of tobacco fragments (commonly known as "cigarette dust") in cigarettes, is a key indicator affecting the quality of cigarettes. Traditional cigarette dust content detection mainly relies on manual sampling inspection or the use of mechanical screening devices to peel the tobacco from the cigarettes and weigh them, then screen out the tobacco below 0.8mm and weigh them, and calculate the proportion of tobacco dust below 0.8mm in the tobacco. These methods often have problems such as low efficiency, poor accuracy, and inability to achieve real-time online detection. At the same time, the cutting process will cause the loss of tobacco, thereby reducing the utilization rate of tobacco. The Chinese invention patent with publication number CN115236105A mainly uses traditional image processing methods, such as edge detection, circle detection, and ROI region growing method. These methods rely on finding the location where the pixel value changes significantly to identify the boundary of the object, but the processing effect is not good for some complex scenes or fuzzy boundaries.

[0003] To overcome these limitations, it is urgent to develop a new non-destructive detection method for cigarette dust that can improve detection efficiency, accuracy and real-time online detection capabilities. This method should combine the latest computer vision technology and deep learning algorithms to achieve automated monitoring and accurate evaluation of cigarette quality. Summary of the invention

[0004] In order to overcome the problems existing in the background technology, the present invention provides a cigarette end detection method based on a convolutional neural network, which specifically comprises the following steps:

[0005] Step 1, acquiring a longitudinal CT grayscale image of the cigarette to be tested;

[0006] Step 2, performing data enhancement processing on the collected CT grayscale images and creating a training data set;

[0007] Step 3, constructing and training a smoke dust recognition model, wherein the smoke dust recognition model includes a backbone network, a feature fusion network, and a detection head. The backbone network includes a convolutional layer and multiple inverse residual modules, which are used to extract features of different scales of the input image. The feature fusion network realizes the fusion of features of different scales in a bidirectional path aggregation manner. The fused features are input to the detection head to detect the smoke dust and obtain the position information and prediction box of the smoke dust.

[0008] Step 4: deploy the trained cigarette end recognition model to the server device to realize cigarette end detection of the cigarette to be tested.

[0009] Furthermore, the specific implementation of step 2 is as follows;

[0010] (1) Rotate the collected CT grayscale image set by 0-15 degrees clockwise and 0-15 degrees counterclockwise, and save the image once for each integer degree to form a rotation data set;

[0011] (2) Add Gaussian noise to the image set. On the basis of the original image, the noise is randomly superimposed to form a noise data set.

[0012] (3) Perform mosaic data enhancement on the image set. The original images are first scaled to different scales, and the scaled images are randomly spliced ​​so that the spliced ​​images meet the size of the original images to form a mosaic data set.

[0013] (4) Fusing the original image set and the data set formed by steps (1), (2), and (3) to obtain training data set images;

[0014] (5) Use the Labelme tool to label the cigarette dust in the data set image of (4), mark the pixel outline of the cigarette dust, randomly shuffle the image, and divide the data set into training set, validation set, and test set according to the proportion.

[0015] Further, in the backbone network, the input image passes through the first convolution layer, the first inverted residual, the second inverted residual, the third inverted residual, the fourth inverted residual, the fifth inverted residual, the sixth inverted residual, the seventh inverted residual, and the eighth inverted residual in sequence, wherein the feature of the second inverted residual output is P2, the feature map of the third inverted residual output is P3, the feature map of the sixth inverted residual output is P4, and the feature map of the eighth inverted residual output is P5;

[0016] The four features of the second, third, sixth, and eighth inverted residual outputs are input into the feature fusion network for fusion.

[0017] Furthermore, the height and width of the input image will be reduced to half of the original when passing through the first convolutional layer, and the number of channels of the output image will be equal to the number of channels of the convolutional layer. A convolution kernel with a size of 3×3 and a step size of 2 is used for feature extraction, and the h-swish activation function layer is used to increase nonlinear characteristics, and the BN layer is used to accelerate the training process and improve model performance; the h-swish activation function layer formula is as follows:

[0018]

[0019] In the above formula, x represents the input, and ReLU6 is a linear rectifier unit with an upper limit, which limits the input x to the range of [0, 6].

[0020] Furthermore, the structures of the first inverted residual to the eighth inverted residual are the same. The configuration of the convolution layer is adjusted by judging whether the number of channels of the input and hidden layers are equal. If the number of channels of the input and hidden layers is the same, the depthwise separable convolution is directly applied, followed by the h-swish activation function layer and the SE attention mechanism, and finally the feature processing is performed through 1x1 convolution;

[0021] On the contrary, if the number of channels of the input and hidden layers are inconsistent, the number of channels is first transformed using 1x1 convolution to match the number of channels of the hidden layer, and then depth-wise separable convolution, h-swish activation, SE attention processing are performed, and finally adjusted through 1x1 convolution.

[0022] Furthermore, when the feature passes through SE attention, the feature response in the channel dimension is recalibrated through two operations: squeezing and excitation;

[0023] In the squeezing stage, the feature of each channel is compressed into a real number through the global average pooling operation, which represents the global information of the channel. The output of this operation is a vector containing the global information of each channel.

[0024] In the excitation stage, this global information vector is transmitted to two fully connected layers. The first fully connected layer reduces the number of channels to the original 1 / r, where r is the reduction ratio, and then applies the ReLU activation function. The second fully connected layer restores the number of channels and obtains the weight coefficient of each channel through the Sigmoid activation function. These weights reflect the importance of different channels and are applied to the original feature map through the Scale operation to achieve feature re-weighting.

[0025] Furthermore, the specific processing process of the feature fusion network is as follows;

[0026] In the bottom-up path, feature map P5 is enhanced in feature representation ability after an improved CA attention, and then increases in size after an upsampling layer, with height and width doubled, and then is fused with feature map P4 after an improved CA attention. The fused feature is C4, and feature C4 is increased in dimension after an upsampling operation, and then fused with feature map P3 after an improved CA attention to obtain fused feature C3, and then feature C3 is fused with feature map P2 after an improved CA attention after an upsampling operation to obtain fused feature C2;

[0027] In the top-down fusion path, the fused feature C2 passes through the first convolution layer once, and the image size is halved in height and width before being fused with the fused feature C3 to obtain the fused feature R1. The fused feature R1 passes through the first convolution layer once, and its dimension is halved before being fused with the fused feature C4 to obtain the fused feature R2. R2 passes through the first convolution layer once, and is fused with the feature P5 after the improved CA attention for the last time to obtain the fused feature R3.

[0028] Finally, the fused features C2, R1, R2, and R3 are input into the detection head.

[0029] Furthermore, the processing of the improved CA attention module is as follows;

[0030] After the image feature map is input, global average pooling is performed in the horizontal and vertical directions respectively to obtain feature maps in the horizontal and vertical directions. The feature values ​​pooled in the horizontal and vertical directions are aggregated and normalized, and then convolution is performed. Then, the sigmoid function is used for smoothing. The original feature map is smoothed with the sigmoid function, and then re-weighted with the feature maps processed in the horizontal and vertical directions to output a new feature map.

[0031] Furthermore, a joint loss function integrating the CIoU loss function and the DFL loss function is used in the training process. The calculation formula is as follows:

[0032]

[0033] The above formula is the joint loss function, where λ and β are the weights of CIoU and DFL respectively;

[0034] The CIoU Loss formula is as follows:

[0035]

[0036]

[0037]

[0038] In the above formula, IoU is the intersection over union ratio, b1 and b2 represent the center points of the predicted box and the real box, ρ represents the Euclidean distance between the two rectangular boxes of the predicted box and the real box, c is the diagonal length of the smallest bounding box covering the two bounding boxes, v is a consistency parameter used to measure the relative proportion of the predicted box and the real box, α is a balance parameter, w1, h1, w2 and h2 are the width and height of the real box and the predicted box respectively;

[0039] The DFL Loss formula is as follows:

[0040]

[0041] ,

[0042] In the above formula, S i represents the predicted probability of the category, y represents the true value, and y i With y i+1 It is the two predicted values ​​on the left and right of the true value y, that is, y i <y<y i+1 , i is the index of the bounding box.

[0043] The present invention also provides a cigarette end detection system based on a convolutional neural network, comprising the following modules:

[0044] A data acquisition module, used to acquire a longitudinal CT grayscale image of the cigarette to be tested;

[0045] A data enhancement module is used to perform data enhancement processing on the collected CT grayscale images and create a training data set;

[0046] A model building and training module is used to build and train a smoke dust recognition model. The smoke dust recognition model includes a backbone network, a feature fusion network, and a detection head. The backbone network includes a convolution layer and multiple inverse residual modules, which are used to extract features of different scales of the input image. The feature fusion network realizes the fusion of features of different scales in a bidirectional path aggregation manner. The fused features are input to the detection head to detect the smoke dust and obtain the position information and prediction box of the smoke dust.

[0047] The cigarette end recognition module deploys the trained cigarette end recognition model to the server device to realize the cigarette end detection of the cigarette to be tested.

[0048] Compared with the existing technology, the beneficial technical effect of the present invention is that the present invention improves the detection efficiency of cigarette butts, can realize real-time online monitoring, and reduces the loss of tobacco in the traditional detection process. It can also be applied to different types of tobacco products, providing a reliable quality control method for the tobacco industry, effectively improving product quality and reducing production costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 A flow chart of the method provided by the present invention;

[0050] Figure 2 The improved CA attention structure diagram of the embodiment of the present invention;

[0051] Figure 3 This is an inverted residual structure diagram of an embodiment of the present invention;

[0052] Figure 4 This is a feature fusion flow chart in step 3.2 of an embodiment of the present invention. DETAILED DESCRIPTION

[0053] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0054] like Figure 1 As shown, the cigarette end detection method based on convolutional neural network provided by the embodiment of the present invention includes the following steps:

[0055] Step 1: Scan the cigarette to be tested using a CT scanner to acquire a longitudinal CT grayscale image of the cigarette to be tested;

[0056] Specifically, the cigarette sample to be measured can be placed in a CT scanner, and the CT scanner can be started. The X-ray source and detector will rotate around the cigarette, and X-ray data passing through the cigarette can be collected from multiple different angles. Through three-dimensional reconstruction technology, a two-dimensional longitudinal CT grayscale image of the cigarette sample can be obtained, and the image can be stored in an image processor to form a picture set.

[0057] Step 2: Perform data enhancement processing on the collected CT grayscale images and create a training data set;

[0058] (1) Rotate the image set by 0-15 degrees clockwise and 0-15 degrees counterclockwise, and save the image once for each integer degree to form a rotation data set;

[0059] (2) Add Gaussian noise to the image set. On the basis of the original image, the noise is randomly superimposed to form a noise data set.

[0060] (3) Perform mosaic data enhancement on the image set. The original images are first scaled to different scales, and the scaled images are randomly spliced ​​so that the spliced ​​images meet the size of the original images to form a mosaic data set.

[0061] (4) The original image set and the data set formed by steps (1), (2), and (3) are fused to obtain training data set images.

[0062] (5) Use the Labelme tool to label the cigarette dust in the data set image of (4), mark the pixel outline of the cigarette dust, randomly shuffle the image, and divide the data set into training set, validation set and test set according to the ratio of 8:1:1.

[0063] Step 3: Build and train a smoke dust recognition network;

[0064] Step 3-1, in the backbone network, the input image passes through the first convolution layer, the first inverted residual, the second inverted residual, the third inverted residual, the fourth inverted residual, the fifth inverted residual, the sixth inverted residual, the seventh inverted residual, and the eighth inverted residual in sequence, where the feature output of the second inverted residual is P2, the feature map output of the third inverted residual is P3, the feature map output of the sixth inverted residual is P4, and the feature map output of the eighth inverted residual is P5; the features captured by the inverted residual layers of different depths have different degrees of abstraction, and the other inverted residual outputs are also feature maps. This embodiment selects the four features of the second, third, sixth, and eighth inverted residual outputs for fusion, and the included features are from shallow to deep.

[0065] Step 3-1-1, the height and width of the input image will be reduced to half of the original when passing through the first convolutional layer, and the number of channels of the output image will be equal to the number of channels of the convolutional layer. Specifically for the configuration of this layer, we use a convolution kernel of size 3×3 and a step size of 2 for feature extraction, add nonlinear characteristics through the h-swish activation function layer, and cooperate with the BN layer to accelerate the training process and improve model performance; the formula of the h-swish activation function layer is as follows:

[0066]

[0067] In the above formula, x represents the input of a layer in the neural network or the element of the feature map. ReLU6 is a linear rectifier unit with an upper limit, which limits the input x to the range of [0, 6].

[0068] Step 3-1-2, the 8 inverted residual structures are similar, except that the number of input channels is different from the number of hidden channels. When constructing these inverted residual structures, the configuration of the convolution layer is adjusted according to whether the number of channels of the input and hidden layers is equal. If the number of channels of the two is the same, we directly apply the depthwise separable convolution, followed by the h-swish activation function layer and the SE attention mechanism, and finally perform feature processing through 1x1 convolution. This configuration can effectively capture the complex relationship between channels while maintaining the diversity of features. In this embodiment, the number of hidden channels set for the 8 inverted residuals is 32, 64, 96, 96, 128, 160, 160, and 192 respectively.

[0069] On the contrary, if the number of channels of the input and hidden layers are inconsistent, we first use 1x1 convolution to transform the number of channels to match the number of channels of the hidden layer, and then perform depthwise separable convolution, h-swish activation, SE attention processing, and finally adjust through 1x1 convolution. This processing flow not only ensures the adaptability and flexibility of the features, but also effectively optimizes the learning ability of the network, so that the model can better adapt to feature changes of different scales.

[0070] In step 3-1-3, when the feature passes through SE attention, the feature response in the channel dimension is recalibrated through two operations: squeezing and excitation. The purpose of this mechanism is to enable the network to adaptively learn the importance of features, thereby enhancing useful features and suppressing features that are not very useful for the current task. In the squeezing stage, the features of each channel are compressed into a real number through a global average pooling operation. This real number represents the global information of the channel, so that the network layer close to the input layer can also obtain the global receptive field. The output of this operation is a vector containing the global information of each channel.

[0071] In the excitation phase, this global information vector is fed into two fully connected layers. The first fully connected layer reduces the number of channels to 1 / r (r is the reduction ratio) and then applies the ReLU activation function; the second fully connected layer restores the number of channels and obtains the weight coefficient of each channel through the Sigmoid activation function. These weights reflect the importance of different channels and are applied to the original feature map through the Scale operation to achieve feature re-weighting.

[0072] Step 3-2, in the feature fusion network, a bidirectional path aggregation network is used to realize feature fusion, and the output features are detected;

[0073] In the bottom-up path, feature map P5 is enhanced in feature representation ability after an improved CA attention, and then increases in size after an upsampling layer, with height and width doubled. This step improves the resolution of feature map P5 through interpolation method, and then is fused with feature map P4 after an improved CA attention. The fused feature is C4. Feature C4 is upsampled once to increase the dimension of fused feature map C4, and then fused with feature map P3 after an improved CA attention to obtain fused feature C3. Feature C3 is then upsampled once and fused with feature map P2 after an improved CA attention to obtain fused feature C2.

[0074] In the top-down fusion path, the fused feature C2 passes through the first convolution layer once, and the image size is halved in height and width before being fused with the fused feature C3 to obtain the fused feature R1. The fused feature R1 passes through the first convolution layer once, and its dimension is halved before being fused with the fused feature C4 to obtain the fused feature R2. R2 passes through the first convolution layer once, and is fused with the feature P5 after the improved CA attention for the last time to obtain the fused feature R3.

[0075] The fused features C2, R1, R2, and R3 are input to the detection head Detect to detect the smoke ends and obtain the location information and prediction box of the smoke ends;

[0076] Step 3-2-1, use an improved CA (Coordinate Attention) attention module. Channel attention is deconstructed into two independent dimensions in the improved CA module: one-dimensional horizontal coordinate features and one-dimensional vertical coordinate features, and then the features are aggregated from the horizontal and vertical spatial directions. In the improved CA attention module, after the image feature map is input, global average pooling is performed in the horizontal and vertical directions respectively, so as to obtain feature maps in the horizontal and vertical directions. The feature values ​​pooled in the horizontal and vertical directions are then aggregated and normalized, and then convolved, and then smoothed using the sigmoid function. The original feature map is smoothed using the sigmoid function, and then re-weighted with the feature map processed in the horizontal and vertical directions, and a new feature map is output to form the improved CA attention module proposed in the present invention.

[0077] Step 3-3, during the model training process, the model learns the data relationship in the training set, adjusts its internal parameters to minimize the prediction error, uses the validation set to evaluate the performance of the model, adjusts the model's hyperparameters, and determines when to stop training to avoid overfitting. After the model training is completed, the test set is used to test the model. In order to achieve efficient parameter updates and centralized objectives, we adopted an innovative comprehensive loss function strategy that integrates the CIoU loss function and the DFL loss function, and merges them into a unified joint loss function by assigning appropriate weights to the two. This multi-dimensional loss function design simplifies the training process and makes the training process more efficient.

[0078]

[0079] The above formula is the total loss function, where λ and β are the weights of CIoU and DFL respectively;

[0080] The CIoU Loss formula is as follows:

[0081]

[0082]

[0083]

[0084] In the above formula, IoU is the intersection over union ratio, b1 and b2 represent the center points of the predicted box and the real box, ρ represents the Euclidean distance between the two rectangular boxes of the predicted box and the real box, c is the diagonal length of the minimum bounding box covering the two bounding boxes, v is a consistency parameter used to measure the relative proportion of the predicted box and the real box, α is a balance parameter, w1, h1, w2 and h2 are the width and height of the real box and the predicted box respectively.

[0085] The DFL Loss formula is as follows:

[0086]

[0087] ,

[0088] In the above formula, S i represents the predicted probability of the category, y represents the true value, and y i With y i+1 It is the two predicted values ​​on the left and right of the true value y, that is, y i <y<y i+1 , i is the index of the predicted box.

[0089] Step 4: Deploy the trained cigarette end recognition network to the server device to perform cigarette end detection on the longitudinal CT image of the cigarette. The server device system includes an operating system Ubuntu 20.04, 4 NVIDIA Tesla P40 graphics cards, 512GB RAM, and a model training framework of PyTorch.

[0090] On the other hand, the embodiment of the present invention also provides a cigarette end detection system based on a convolutional neural network, comprising the following modules:

[0091] A data acquisition module, used to acquire a longitudinal CT grayscale image of the cigarette to be tested;

[0092] A data enhancement module is used to perform data enhancement processing on the collected CT grayscale images and create a training data set;

[0093] A model building and training module is used to build and train a smoke dust recognition model. The smoke dust recognition model includes a backbone network, a feature fusion network, and a detection head. The backbone network includes a convolution layer and multiple inverse residual modules, which are used to extract features of different scales of the input image. The feature fusion network realizes the fusion of features of different scales in a bidirectional path aggregation manner. The fused features are input to the detection head to detect the smoke dust and obtain the position information and prediction box of the smoke dust.

[0094] The cigarette end recognition module deploys the trained cigarette end recognition model to the server device to realize the cigarette end detection of the cigarette to be tested.

[0095] The specific implementation method of each module is the same as each step and will not be described in detail in the present invention.

[0096] The specific embodiments described herein are merely examples of the spirit of the present invention. Those skilled in the art may make various modifications or additions to the specific embodiments described or replace them in similar ways, but they will not deviate from the spirit of the present invention or exceed the scope defined by the appended claims.

Claims

1. A cigarette end detection method based on a convolutional neural network, characterized in that: The steps include: Step 1, acquiring a longitudinal CT grayscale image of the cigarette to be tested; Step 2, performing data enhancement processing on the collected CT grayscale images and creating a training data set; Step 3, constructing and training a smoke dust recognition model, wherein the smoke dust recognition model includes a backbone network, a feature fusion network, and a detection head. The backbone network includes a convolutional layer and multiple inverse residual modules, which are used to extract features of different scales of the input image. The feature fusion network realizes the fusion of features of different scales in a bidirectional path aggregation manner. The fused features are input to the detection head to detect the smoke dust and obtain the position information and prediction box of the smoke dust. In the backbone network, the input image passes through the first convolution layer, the first inverted residual, the second inverted residual, the third inverted residual, the fourth inverted residual, the fifth inverted residual, the sixth inverted residual, the seventh inverted residual, and the eighth inverted residual in sequence, where the feature output of the second inverted residual is P2, the feature map output of the third inverted residual is P3, the feature map output of the sixth inverted residual is P4, and the feature map output of the eighth inverted residual is P5; The four features of the second, third, sixth and eighth inverted residual outputs are input into the feature fusion network for fusion; The specific processing process of the feature fusion network is as follows; In the bottom-up path, feature map P5 is enhanced in feature representation ability after an improved CA attention, and then increases in size after an upsampling layer, with height and width doubled, and then is fused with feature map P4 after an improved CA attention. The fused feature is C4, and feature C4 is increased in dimension after an upsampling operation, and then fused with feature map P3 after an improved CA attention to obtain fused feature C3, and then feature C3 is fused with feature map P2 after an improved CA attention after an upsampling operation to obtain fused feature C2; In the top-down fusion path, the fused feature C2 passes through the first convolution layer once, and the image size is halved in height and width before being fused with the fused feature C3 to obtain the fused feature R1. The fused feature R1 passes through the first convolution layer once, and its dimension is halved before being fused with the fused feature C4 to obtain the fused feature R2. R2 passes through the first convolution layer once, and is fused with the feature P5 after the improved CA attention for the last time to obtain the fused feature R3. Finally, the fused features C2, R1, R2, and R3 are input into the detection head; The processing of the improved CA attention module is as follows; After the image feature map is input, global average pooling is performed in the horizontal and vertical directions respectively to obtain feature maps in the horizontal and vertical directions. The feature values ​​pooled in the horizontal and vertical directions are aggregated and normalized, and then convolution is performed. Then, the sigmoid function is used for smoothing. The original feature map is smoothed with the sigmoid function, and then re-weighted with the feature maps processed in the horizontal and vertical directions to output a new feature map. Step 4: deploy the trained cigarette end recognition model to the server device to realize cigarette end detection of the cigarette to be tested.

2. The method for detecting cigarette end products based on a convolutional neural network according to claim 1, characterized in that: The specific implementation of step 2 is as follows; (1) Rotate the collected CT grayscale image set by 0-15 degrees clockwise and 0-15 degrees counterclockwise, and save the image once for each integer degree to form a rotation data set; (2) Add Gaussian noise to the image set. On the basis of the original image, the noise is randomly superimposed to form a noise data set. (3) Perform mosaic data enhancement on the image set. The original images are first scaled to different scales, and the scaled images are randomly spliced ​​so that the spliced ​​images meet the size of the original images to form a mosaic data set. (4) Fusing the original image set and the data set formed by steps (1), (2), and (3) to obtain training data set images; (5) Use the Labelme tool to label the cigarette dust in the data set image of (4), mark the pixel outline of the cigarette dust, randomly shuffle the image, and divide the data set into training set, validation set, and test set according to the proportion.

3. The method for detecting cigarette end products based on a convolutional neural network according to claim 1, characterized in that: When the input image passes through the first convolutional layer, its height and width will be reduced to half of the original, and the number of channels of the output image will be equal to the number of channels of the convolutional layer. A convolution kernel with a size of 3×3 and a step size of 2 is used for feature extraction. The h-swish activation function layer is used to increase nonlinear characteristics, and the BN layer is used to accelerate the training process and improve model performance. The formula of the h-swish activation function layer is as follows: ; In the above formula, x represents the input, and ReLU6 is a linear rectifier unit with an upper limit, which limits the input x to the range of [0, 6].

4. The method for detecting cigarette dust based on a convolutional neural network according to claim 1, characterized in that: The structures of the first inverted residual to the eighth inverted residual are the same. The configuration of the convolution layer is adjusted by judging whether the number of channels of the input and hidden layers are equal. If the number of channels of the input and hidden layers is the same, the depthwise separable convolution is directly applied, followed by the h-swish activation function layer and the SE attention mechanism, and finally the feature processing is performed through 1x1 convolution; On the contrary, if the number of channels of the input and hidden layers are inconsistent, the number of channels is first transformed using 1x1 convolution to match the number of channels of the hidden layer, and then depth-wise separable convolution, h-swish activation, SE attention processing are performed, and finally adjusted through 1x1 convolution.

5. The method for detecting cigarette dust based on a convolutional neural network according to claim 4, characterized in that: When the feature passes through SE attention, the feature response in the channel dimension is recalibrated through two operations: squeezing and excitation; In the squeezing stage, the feature of each channel is compressed into a real number through the global average pooling operation, which represents the global information of the channel. The output of this operation is a vector containing the global information of each channel. In the excitation stage, this global information vector is transmitted to two fully connected layers. The first fully connected layer reduces the number of channels to the original 1 / r, where r is the reduction ratio, and then applies the ReLU activation function. The second fully connected layer restores the number of channels and obtains the weight coefficient of each channel through the Sigmoid activation function. These weights reflect the importance of different channels and are applied to the original feature map through the Scale operation to achieve feature re-weighting.

6. The method for detecting cigarette dust based on a convolutional neural network according to claim 1, characterized in that: During the training process, a joint loss function integrating the CIoU loss function and the DFL loss function is used. The calculation formula is as follows: ; The above formula is the joint loss function, where λ and β are the weights of CIoU and DFL respectively; The CIoU Loss formula is as follows: ; ; ; In the above formula, IoU is the intersection over union ratio, b1 and b2 represent the center points of the predicted box and the real box, ρ represents the Euclidean distance between the two rectangular boxes of the predicted box and the real box, c is the diagonal length of the smallest bounding box covering the two bounding boxes, v is a consistency parameter used to measure the relative proportion of the predicted box and the real box, α is a balance parameter, w1, h1, w2 and h2 are the width and height of the real box and the predicted box respectively; The DFL Loss formula is as follows: ; , ; In the above formula, S i represents the predicted probability of the category, y represents the true value, and y i With y i+1 It is the two predicted values ​​on the left and right of the true value y, that is, y i <y<y i+1 , i is the index of the bounding box.

7. A cigarette end detection system based on a convolutional neural network, characterized in that: Includes the following modules: A data acquisition module, used to acquire a longitudinal CT grayscale image of the cigarette to be tested; A data enhancement module is used to perform data enhancement processing on the collected CT grayscale images and create a training data set; A model building and training module is used to build and train a smoke dust recognition model. The smoke dust recognition model includes a backbone network, a feature fusion network, and a detection head. The backbone network includes a convolution layer and multiple inverse residual modules, which are used to extract features of different scales of the input image. The feature fusion network realizes the fusion of features of different scales in a bidirectional path aggregation manner. The fused features are input to the detection head to detect the smoke dust and obtain the position information and prediction box of the smoke dust. In the backbone network, the input image passes through the first convolution layer, the first inverted residual, the second inverted residual, the third inverted residual, the fourth inverted residual, the fifth inverted residual, the sixth inverted residual, the seventh inverted residual, and the eighth inverted residual in sequence, where the feature output of the second inverted residual is P2, the feature map output of the third inverted residual is P3, the feature map output of the sixth inverted residual is P4, and the feature map output of the eighth inverted residual is P5; The four features of the second, third, sixth and eighth inverted residual outputs are input into the feature fusion network for fusion; The specific processing process of the feature fusion network is as follows; In the bottom-up path, feature map P5 is enhanced in feature representation ability after an improved CA attention, and then increases in size after an upsampling layer, with height and width doubled, and then is fused with feature map P4 after an improved CA attention. The fused feature is C4, and feature C4 is increased in dimension after an upsampling operation, and then fused with feature map P3 after an improved CA attention to obtain fused feature C3, and then feature C3 is fused with feature map P2 after an improved CA attention after an upsampling operation to obtain fused feature C2; In the top-down fusion path, the fused feature C2 passes through the first convolution layer once, and the image size is halved in height and width before being fused with the fused feature C3 to obtain the fused feature R1. The fused feature R1 passes through the first convolution layer once, and its dimension is halved before being fused with the fused feature C4 to obtain the fused feature R2. R2 passes through the first convolution layer once, and is fused with the feature P5 after the improved CA attention for the last time to obtain the fused feature R3. Finally, the fused features C2, R1, R2, and R3 are input into the detection head; The processing of the improved CA attention module is as follows; After the image feature map is input, global average pooling is performed in the horizontal and vertical directions respectively to obtain feature maps in the horizontal and vertical directions. The feature values ​​pooled in the horizontal and vertical directions are aggregated and normalized, and then convolution is performed. Then, the sigmoid function is used for smoothing. The original feature map is smoothed with the sigmoid function, and then re-weighted with the feature maps processed in the horizontal and vertical directions to output a new feature map. The cigarette end recognition module deploys the trained cigarette end recognition model to the server device to realize the cigarette end detection of the cigarette to be tested.

Citation Information

Patent Citations

  • Nondestructive detection method for dust content of cigarette

    CN115236105A

  • Tobacco worm detection model construction method integrating collaborative attention and depth separable convolution

    CN116385853A

  • Tobacco shred impurity detection method based on machine vision

    CN116630958A

  • Farmland forest smoke fire prevention detection method and equipment based on image recognition

    CN117671602A

  • Cut tobacco uniformity detection method and system based on convolutional neural network

    CN118015244A