A tobacco insect detection model construction method integrating collaborative attention and depthwise separable convolution

By building a tobacco insect detection model that combines collaborative attention and depthwise separable convolution, the problems of low accuracy, slow speed, and high cost of tobacco insect detection in cigarette factory warehouses are solved, and efficient tobacco insect detection is achieved on a lightweight network that is suitable for mobile devices.

CN116385853BActive Publication Date: 2025-09-16CHINA TOBACCO HENAN IND CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310402222.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-13
Publication Date
2025-09-16
Estimated Expiration
2043-04-13

AI Technical Summary

Technical Problem

Existing technologies for tobacco insect detection in cigarette factory warehouses suffer from low detection accuracy, slow speed, high cost, and difficult deployment. In particular, the application of traditional target detection algorithms on mobile devices suffers from large computational complexity and low efficiency.

Method used

A tobacco insect detection model that integrates collaborative attention and depthwise separable convolution is constructed. By compressing the original target detection model, introducing depthwise separable convolution modules such as DA-DW-GhostBottleneck, and integrating the collaborative dual attention mechanism, network parameters and computational complexity are reduced, and the efficiency of feature map utilization is improved.

Benefits of technology

It achieves efficient and accurate tobacco insect detection on mobile devices, significantly improves detection accuracy, reduces computing pressure, and adapts to lightweight network deployment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116385853B_ABST
    Figure CN116385853B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for constructing a tobacco insect detection model that integrates collaborative attention and deep separable convolution. The main design concept of the present invention is to compress the original target detection model, construct a lightweight deep separable convolution module, and obtain a lightweight network; the aforementioned customized deep separable convolution module can reduce the parameters in the network, so that the network focuses on the channels related to the object in the feature map; then the two attention modules are fused to more efficiently utilize the information between the upper and lower layers of the feature map, improve the representation ability of the model, and then generate an accurate tobacco insect feature map. The customized deep separable convolution module of the present invention reduces the parameters and computational complexity of the network while ensuring the feature extraction capability of the backbone network. At the same time, the coordinated dual attention mechanism can realize feature fusion at all stages, enhance the expression of channel and spatial features, and ultimately achieve accurate positioning and classification of target tobacco insects while greatly reducing the computing pressure of mobile devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cigarette manufacturing, and in particular to a method for constructing a tobacco insect detection model integrating collaborative attention and depthwise separable convolution. Background Art

[0002] Object detection is a key research topic in computer vision. Its primary task is to classify and locate objects in images. With the development of neural networks, object detection has also achieved breakthroughs. Currently, neural network-based object detection is widely used in various fields, such as video surveillance, autonomous driving, face recognition, and defect detection.

[0003] In view of the specific scenarios in the tobacco industry, the storage workshops of cigarette factories need to perform visual identification and detection of tobacco beetles to understand the number of tobacco beetles. However, the use of traditional target detection algorithms in conjunction with mobile devices for beetle target detection has low detection accuracy and slow speed. In particular, the problem of high-complexity algorithms being difficult to deploy is highlighted.

[0004] To meet the needs of mobile devices, the industry has explored and developed lightweight object detection algorithms. For example, replacing standard convolution with depthwise separable convolutions or attempting to improve information flow through convolutional layers through channel shift operations to enhance the performance of lightweight network models. However, in terms of technical implementation details, these existing technologies fail to fully exploit the correlation and redundancy between feature maps. This led to the design of the Ghost module, which uses low-cost, high-efficiency linear operations to obtain redundant features, ensuring the network's comprehensive understanding of the input data.

[0005] However, although the Ghost module is very effective for lightweight networks by using cheap operations with less computational effort, its process of using ordinary convolution to generate valuable feature maps will greatly increase the application cost for the specific scenario of tobacco insect detection using mobile devices. Summary of the Invention

[0006] In view of the above, the present invention aims to provide a method for constructing a tobacco insect detection model that integrates collaborative attention and depthwise separable convolution to solve the technical problems mentioned above.

[0007] The technical solution adopted in the present invention is as follows:

[0008] The present invention provides a method for constructing a tobacco insect detection model integrating collaborative attention and depthwise separable convolution, which includes:

[0009] Preprocess the tobacco insect dataset and divide it into training set, validation set and test set;

[0010] The backbone network of the original object detection model is compressed and a customized depth-wise separable convolutional module is constructed to obtain a lightweight convolutional network.

[0011] A collaborative dual attention mechanism is constructed and integrated with the lightweight convolutional network to obtain a lightweight tobacco insect target detection model;

[0012] Using the training set and the validation set to train the lightweight tobacco insect target detection model to obtain trained weights;

[0013] The test set is used as the input image of the lightweight tobacco insect target detection model based on the optimal weight, and after being processed by the model, the target tobacco insects are output and the number of tobacco insects is determined.

[0014] In at least one possible implementation, the depthwise separable convolution module is a DA-DW-GhostBottleneck module.

[0015] In at least one possible implementation, the DA-DW-GhostBottleneck module includes: a stacked DW-Ghost module and a shortcut branch of an integrated DANet, wherein the DW-Ghost module is used to generate a feature map through DW convolution.

[0016] In at least one possible implementation, the process of obtaining a lightweight convolutional network includes: dividing the depthwise separable convolution module into depthwise convolution and pointwise convolution, and using pointwise convolution of preset specifications to connect the prior feature maps in the depthwise convolution direction.

[0017] In at least one possible implementation, the collaborative dual attention mechanism consists of coordinate channel attention and coordinate space attention.

[0018] In at least one possible implementation, the coordinate channel attention mechanism includes:

[0019] The fused feature map is compressed by the strip pooling layer, and the feature map is transformed using the reconstruction operation;

[0020] Obtain cross-channel interactions of feature maps and use preset activation methods to obtain channel weights combined with horizontal and vertical features respectively;

[0021] The input feature map is combined with the channel weights and the first target feature map is obtained through a cascade operation.

[0022] In at least one possible implementation, the coordinate space attention mechanism includes:

[0023] Average pooling, maximum pooling, and convolution operations are used to aggregate features on the channel dimension of the input feature map;

[0024] Use the preset convolution layer to extract the feature maps in the horizontal and vertical directions and obtain the spatial weights of the feature maps;

[0025] The input feature maps weighted according to the spatial weights are cascaded to obtain a second target feature map.

[0026] Compared with the existing technology, the main design concept of the present invention is to compress and improve the original target detection model to solve the problems of low accuracy, slow speed, high cost and difficult deployment of tobacco insect detection in the storage workshop of the cigarette factory, and construct a lightweight deep separable convolution module, such as the DA-DW-GhostBottleneck module, so as to achieve the lightweight of CSPDarkNet53 and obtain a lightweight network; the aforementioned customized deep separable convolution module can reduce the parameters in the network, so that the network focuses on the channels related to the object in the feature map, and then fuses the two attention modules to more efficiently utilize the information between the upper and lower layers of the feature map, improve the representation ability of the model, and thus generate an accurate tobacco insect feature map. The customized deep separable convolution module of the present invention reduces the parameters and computational complexity of the network while ensuring the feature extraction capability of the backbone network. At the same time, the coordinated dual attention mechanism can realize feature fusion at all stages, enhance the expression of channel and spatial features, and ultimately greatly reduce the computing pressure of the mobile device while also achieving accurate positioning and classification of the target tobacco insects. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be further described below with reference to the accompanying drawings, in which:

[0028] Figure 1 A flowchart of a method for constructing a tobacco insect detection model integrating collaborative attention and depthwise separable convolution provided by an embodiment of the present invention;

[0029] Figure 2 A schematic diagram of the structure of the DA-DW-GhostBottleneck provided in an embodiment of the present invention;

[0030] Figure 3 A schematic diagram of the structure of the DW-Ghost module provided in an embodiment of the present invention;

[0031] Figure 4 An overall structural diagram of the collaborative dual attention provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0032] The following describes embodiments of the present invention in detail. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended only to explain the present invention and are not to be construed as limiting the present invention.

[0033] The present invention proposes an embodiment of a method for constructing a tobacco insect detection model that integrates collaborative attention and depthwise separable convolution. Specifically, Figure 1 shown, including:

[0034] Step S1: preprocess the tobacco insect dataset and divide it into a training set, a validation set, and a test set;

[0035] Step S2: compress the backbone network of the original object detection model (such as YOLOv5s) and construct a customized depth-wise separable convolutional network module to obtain a lightweight convolutional network;

[0036] Combine Figure 2 and Figure 3 As shown, the specific construction of the DA-DW-GhostBottleneck module includes:

[0037] Composed of stacked DW-Ghost modules and a shortcut branch integrated with DANet, the DW-Ghost module generates valuable feature maps using computationally inexpensive DW convolutions and generates redundant feature maps based on these feature maps using low-cost operations. Leveraging the lightweight nature of the DW-Ghost module, the DA-DW-Ghost Bottleneck is introduced into the backbone network of the object detection model, significantly reducing the number of parameters while allowing the network to focus on target-related channels in the feature map.

[0038] The specific construction method of the lightweight convolutional network mentioned above is:

[0039] First, the depth-wise separable convolution GhostBottleneck is divided into depth-wise convolution and point-wise convolution. Depth-wise convolution acts on a two-dimensional plane, and the number of convolution kernels corresponds to the depth. Each channel of the input layer is convolved independently, and the feature information of different channels cannot be effectively utilized in the same spatial position. Therefore, a point-by-point convolution with a kernel size of 1×1×M (where M represents the depth of the upper output) is used to connect the previous feature map in the depth direction. Subsequently, the advantages of depth-wise separable convolution over ordinary convolution are examined from the perspective of computational complexity. For ordinary two-dimensional convolution (where stride=1, padding=0), the input size is h×w×c, and the computational amount of convolution is T conv and the computational cost of depthwise separable convolution T DWconvThey are expressed by the following two formulas:

[0040] T conv =n·h′·w′·c·s·s

[0041] T DWconv =h′·w′·c·s·s+n·h′·w′·c

[0042] k represents the size of the convolution filter kernel, h′ and w′ are the height and width of the output feature, the number of filters is n, and c represents the number of channels.

[0043] To further obtain the desired residual feature map, the present invention proposes, in some embodiments, applying a series of low-cost linear operations on each valuable feature map to generate the desired residual redundant feature map. The linear operation method is shown in the following formula:

[0044]

[0045] y′ i Refers to the first valuable feature map, Φ i,j Is to generate the first redundant feature map y i,j The first linear operation, y′ i There can be one or more redundant feature maps The valuable feature maps and redundant feature maps are combined together as the output features of DW-Ghost.

[0046] Continuing from the previous article, step S3, a collaborative dual attention mechanism is constructed and integrated with the lightweight convolutional network to obtain a lightweight tobacco insect target detection model, thereby realizing feature fusion at all stages and enhancing the expression of channel and spatial features.

[0047] Combine Figure 4 As shown, the specific construction method of the collaborative dual attention mechanism is:

[0048] It consists of coordinate channel attention and coordinate space attention. First, for coordinate channel attention, the fusion feature map F∈R C×H×W It is compressed by strip pooling layers of shape (H, 1) and (1, W), and the feature map is transformed into F using a reconstruction operation. H ∈R H×C and F W ∈R W×C , one-dimensional convolution is used to obtain cross-channel interaction of feature maps, and the Sigmoid activation method is used to obtain channel weights combined with horizontal and vertical features respectively. The input feature map is combined with the channel weights, and the feature map F is obtained through cascade operation. C ∈R 2C×H×WSecond, for the coordinate space attention, in the input feature map F I ∈R 1×H×W The average pooling, maximum pooling and convolution methods are used to aggregate features on the channel dimension of , and then the convolution with kernel size of (H, 1) and (1, W) is used to extract the features in the horizontal and vertical directions. The Sigmoid activation function is used to obtain the spatial weight of the feature map. The input feature map weighted by the spatial weight is cascaded to obtain the feature map F P ∈R 2C×H×W .

[0049] Step S4: training the lightweight tobacco insect target detection model using the training set and the validation set to obtain a trained weight;

[0050] Step S5: Using the test set as the input image of the lightweight tobacco insect target detection model based on the optimal weight, outputting the target tobacco insects after being processed by the model and determining the number of tobacco insects.

[0051] After actual implementation and comparison, the tobacco insect detection model provided by the present invention is not only suitable for mobile devices, but also has a detection accuracy significantly higher than the detection results of the original YOLOv5s algorithm.

[0052] In summary, the main design concept of the present invention is to compress and improve the original target detection model in order to solve the problems of low accuracy, slow speed, high cost and difficult deployment in the storage workshop of cigarette factories, and construct a lightweight deep separable convolution module, such as the DA-DW-GhostBottleneck module, to achieve the lightweight of CSPDarkNet53 and obtain a lightweight network; the aforementioned customized deep separable convolution module can reduce the parameters in the network, so that the network focuses on the channels related to the object in the feature map, and then fuses the two attention modules to more efficiently utilize the information between the upper and lower layers of the feature map, improve the representation ability of the model, and then generate an accurate tobacco insect feature map. The customized deep separable convolution module of the present invention reduces the parameters and computational complexity of the network while ensuring the feature extraction capability of the backbone network. At the same time, the coordinated dual attention mechanism can realize feature fusion at all stages, enhance the expression of channel and spatial features, and ultimately greatly reduce the computing pressure of mobile devices while also achieving accurate positioning and classification of target tobacco insects.

[0053] In the embodiment of the present invention, "at least one" refers to one or more, and "more" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can be represented by: a, b, c, a and b, a and c, b and c, or a, b and c, where a, b, c can be single or multiple.

[0054] The above describes in detail the structure, features and effects of the present invention based on the embodiments shown in the drawings, but the above is only a preferred embodiment of the present invention. It should be noted that the technical features involved in the above embodiments and their preferred modes can be reasonably combined and matched into a variety of equivalent schemes by those skilled in the art without departing from or changing the design ideas and technical effects of the present invention; therefore, the scope of implementation of the present invention is not limited to what is shown in the drawings. Any changes made in accordance with the concept of the present invention, or modifications to equivalent embodiments with equivalent changes, which still do not exceed the spirit covered by the description and drawings, should be within the scope of protection of the present invention.

Claims

1. A method for constructing a tobacco insect detection model integrating collaborative attention and depthwise separable convolution, characterized by: include: Preprocess the tobacco insect dataset and divide it into training set, validation set and test set; The backbone network of the original object detection model is compressed and a customized depthwise separable convolutional module is constructed to obtain a lightweight convolutional network. The depthwise separable convolutional module is a DA-DW-Ghost Bottleneck module, which specifically includes: a stacked DW-Ghost module and a shortcut branch of an integrated DANet, wherein the DW-Ghost module is used to generate feature maps through DW convolution. A collaborative dual attention mechanism is constructed and integrated with the lightweight convolutional network to obtain a lightweight tobacco insect target detection model; Using the training set and the validation set to train the lightweight tobacco insect target detection model to obtain trained weights; The test set is used as the input image of the lightweight tobacco insect target detection model based on the optimal weight, and after being processed by the model, the target tobacco insects are output and the number of tobacco insects is determined.

2. The method for constructing a tobacco insect detection model integrating collaborative attention and depthwise separable convolution according to claim 1 is characterized in that: The process of obtaining a lightweight convolutional network includes: dividing the depthwise separable convolution module into depthwise convolution and pointwise convolution, and using preset pointwise convolution to connect the previous feature maps in the depthwise convolution direction.

3. The method for constructing a tobacco insect detection model integrating collaborative attention and depthwise separable convolution according to any one of claims 1 to 2, characterized in that: The collaborative dual attention mechanism consists of coordinate channel attention and coordinate spatial attention.

4. The method for constructing a tobacco insect detection model integrating collaborative attention and depthwise separable convolution according to claim 3 is characterized in that: The coordinate channel attention mechanism includes: The fused feature map is compressed by the strip pooling layer, and the feature map is transformed using the reconstruction operation; Obtain cross-channel interactions of feature maps and use preset activation methods to obtain channel weights combined with horizontal and vertical features respectively; The input feature map is combined with the channel weights and the first target feature map is obtained through a cascade operation.

5. The method for constructing a tobacco insect detection model integrating collaborative attention and depthwise separable convolution according to claim 3 is characterized in that: The coordinate space attention mechanism includes: Average pooling, maximum pooling, and convolution operations are used to aggregate features on the channel dimension of the input feature map; Use the preset convolution layer to extract the feature maps in the horizontal and vertical directions and obtain the spatial weights of the feature maps; The input feature maps weighted according to the spatial weights are cascaded to obtain a second target feature map.

Citation Information

Patent Citations

  • Real-time target detection method based on depth feature fusion and attention mechanism

    CN112232214A

  • Disease and pest identification method based on multi-scale lightweight network

    CN115116054A