Search

CN-121982418-A - Cut tobacco defect detection method, device, equipment and storage medium

CN121982418ACN 121982418 ACN121982418 ACN 121982418ACN-121982418-A

Abstract

The embodiment of the invention provides a method, a device, equipment and a storage medium for detecting tobacco shred defects, and relates to the technical field of computer vision. The method comprises the steps of carrying out multi-scale feature extraction on a tobacco shred image to be detected by utilizing a multi-branch large-kernel fusion depth convolution module of a main network to obtain initial image features, carrying out feature fusion on the initial image features to obtain target features, carrying out parallel processing on the target features by utilizing a multi-scale cavity attention mechanism of the feature fusion network to obtain fusion features, and classifying and positioning the fusion features by utilizing a lightweight detection head to obtain a defect detection result of the tobacco shred image to be detected. The invention can ensure that the detection model simultaneously meets the requirements of high precision and light weight.

Inventors

  • ZHANG CHONG
  • QIN HAO
  • CAO YONGJUN

Assignees

  • 广东省科学院智能制造研究所

Dates

Publication Date
20260505
Application Date
20260205

Claims (10)

  1. 1. A method for detecting a cut tobacco defect, comprising: acquiring a cut tobacco image to be detected, and inputting the cut tobacco image to be detected into a defect detection model, wherein the defect detection model comprises a main network, a feature fusion network and a lightweight detection head; Performing multi-scale feature extraction on the tobacco shred images to be detected by utilizing a multi-branch large-kernel fusion depth convolution module of the backbone network to obtain initial image features, and performing feature fusion on the initial image features to obtain target features; The target features are processed in parallel by utilizing a multi-scale cavity attention mechanism of the feature fusion network to obtain fusion features; And classifying and positioning the fusion characteristics by using the lightweight detection head to obtain a defect detection result of the cut tobacco image to be detected.
  2. 2. The method for detecting a tobacco shred defect according to claim 1, wherein the initial image features include initial features and context features, the step of extracting the multi-scale features of the tobacco shred image to be detected by using the multi-branch large-kernel fusion depth convolution module of the main network to obtain initial image features, and performing feature fusion on the initial image features to obtain target features includes: Extracting features of the tobacco shred images to be detected through a depth separable convolution layer of the multi-branch large-core fusion depth convolution module to obtain initial features, and capturing context information of the initial features through a large-size convolution check of the multi-branch large-core fusion depth convolution module to obtain context features; and carrying out feature fusion on the initial feature and the context feature to obtain the target feature.
  3. 3. The method for detecting a tobacco shred defect according to claim 2, wherein the step of performing feature fusion on the initial feature and the context feature to obtain the target feature comprises: Optimizing the structures and parameters of the depth separable convolution layer and the large-size convolution kernel through structural re-parameterization to obtain a plurality of identical single convolution layers corresponding to the depth separable convolution layer and the large-size convolution kernel; and obtaining an output result of each single convolution layer, and fusing each output result to obtain the target feature.
  4. 4. The method for detecting the tobacco shred defects according to claim 1, wherein the step of processing the target features in parallel by using a multi-scale hole attention mechanism of the feature fusion network to obtain fusion features comprises the following steps: Inputting the target features into a multi-scale cavity convolution layer and a channel attention mechanism layer respectively; different void ratio convolutions are carried out on the target feature by utilizing the multi-scale void convolution layer so as to obtain a multi-scale feature; processing the target features by using the channel attention mechanism layer to obtain weight coefficients corresponding to channel dimensions, and carrying out weighted calculation on the spatial positions and feature channels corresponding to the target features by using the weight coefficients to obtain attention features; And fusing the multi-scale features and the attention features to obtain the fused features.
  5. 5. The method for detecting a tobacco shred defect according to claim 4, wherein the step of processing the target feature by the channel attention mechanism layer to obtain a weight coefficient corresponding to a channel dimension includes: Carrying out global average pooling treatment on the target features by using the channel attention mechanism to obtain global average pooling information; carrying out global maximum pooling treatment on the target features by using the channel attention mechanism to obtain global maximum pooling information; and carrying out weighted calculation on the global average pooling information and the global maximum pooling information to obtain the weight coefficient.
  6. 6. The method for detecting a cut tobacco defect according to claim 1, wherein the step of classifying and locating the fusion feature by using the lightweight detection head to obtain a defect detection result of the cut tobacco image to be detected comprises: classifying, positioning and calculating target confidence coefficient by utilizing a plurality of detection branches of the lightweight detection head; and marking the classification result, the positioning result and the target confidence corresponding to the fusion characteristic on the cut tobacco image to be detected to obtain a defect detection result of the cut tobacco image to be detected.
  7. 7. The method of claim 6, wherein the step of classifying and locating the fused features using the lightweight detection head further comprises: respectively constructing a classification loss function, a positioning loss function and a target confidence loss function; And constructing a weighted combination loss function by using the classification loss function, the positioning loss function and the target confidence loss function, and monitoring and optimizing the output result of the loss lightweight detection head by using the weighted combination loss function.
  8. 8. A tobacco shred defect detection device, characterized by comprising: The image acquisition module is used for acquiring an image of the cut tobacco to be detected, inputting the image of the cut tobacco to be detected into a defect detection model, wherein the defect detection model comprises a main network, a feature fusion network and a lightweight detection head; The feature extraction module is used for extracting multi-scale features of the tobacco shred images to be detected by utilizing the multi-branch large-kernel fusion depth convolution module of the main network to obtain initial image features, and carrying out feature fusion on the initial image features to obtain target features; The feature fusion module is used for processing the target features in parallel by utilizing a multi-scale cavity attention mechanism of the feature fusion network to obtain fusion features; And the defect detection module is used for classifying and positioning the fusion characteristics by utilizing the lightweight detection head to obtain a defect detection result of the cut tobacco image to be detected.
  9. 9. An electronic device comprising a processor and a memory, the memory storing machine-executable instructions executable by the processor to implement the tobacco shred defect detection method of any one of claims 1-7.
  10. 10. A computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements a tobacco shred defect detection method as claimed in any one of claims 1 to 7.

Description

Cut tobacco defect detection method, device, equipment and storage medium Technical Field The invention relates to the technical field of computer vision, in particular to a tobacco shred defect detection method, a device, equipment and a storage medium. Background In the tobacco industry, tobacco shred quality is a decisive factor in the quality and production efficiency of cigarette products. On a high-speed automatic production line, various defect targets (such as tobacco stems, foreign matters, agglomerations and abnormal colors) mixed in tobacco shreds are detected and removed accurately on line in real time, and the method is a key link for guaranteeing the product quality. The traditional machine vision method generally depends on a preset color or shape threshold value, is difficult to adapt to complex variability of tobacco shred background, tiny change of illumination and diversity of defect targets, and has high false detection rate and omission rate, so that the quality requirements of modern industrial production cannot be met. In recent years, as deep learning technology breaks through in the field of computer vision, a method based on a single-stage object detection network (such as YOLO series) is introduced into industrial detection. The method can realize accurate identification of the target under the complex background on the premise of ensuring higher reasoning speed through end-to-end learning. However, when the general YOLO model is directly applied to the field of tobacco shred defect detection with high throughput and high real-time requirements, the following three technical difficulties are still faced: the problem of confusion of extremely small objects with complex backgrounds is that in tobacco shred defects, such as tiny foreign objects and local clusters, only a very small pixel area is usually occupied in an image acquired by an industrial camera. In the deep feature extraction process of the standard target detection network, the detail features of the small target are easily diluted or ignored, so that the detection precision and recall rate are difficult to improve. The weight and accuracy are difficult to balance, and industrial deployment often requires extremely low computational effort (FLOPs) and parameter quantities (Parameters) of the detection model to achieve real-time reasoning speed in the millisecond range. The standard lightweight network structure inevitably loses part of the feature extraction capability while compressing the model volume, so that the detection accuracy cannot reach the standard of industrial application. The problem of characteristic dislocation of the positioning and classifying task is that in defect detection, accurate bounding box positioning and accurate defect class classification are two tasks which are related to each other and compete with each other. When the standard network shares the feature representation, the features for positioning (boundary) and classifying (semantic) cannot be pertinently enhanced, so that the phenomenon of inaccurate positioning frame or incorrect class prediction is easy to occur at an output end. Disclosure of Invention Accordingly, the present invention aims to provide a method, a device and a storage medium for detecting tobacco shred defects, so as to solve the problem of low detection precision of the existing tobacco shred defect detection method. In order to achieve the above purpose, the technical scheme adopted by the invention is as follows: in a first aspect, the present invention provides a tobacco shred defect detection method, including: acquiring a cut tobacco image to be detected, and inputting the cut tobacco image to be detected into a defect detection model, wherein the defect detection model comprises a main network, a feature fusion network and a lightweight detection head; Performing multi-scale feature extraction on the tobacco shred images to be detected by utilizing a multi-branch large-kernel fusion depth convolution module of the backbone network to obtain initial image features, and performing feature fusion on the initial image features to obtain target features; The target features are processed in parallel by utilizing a multi-scale cavity attention mechanism of the feature fusion network to obtain fusion features; And classifying and positioning the fusion characteristics by using the lightweight detection head to obtain a defect detection result of the cut tobacco image to be detected. In an optional embodiment, the initial image features include an initial feature and a context feature, the step of performing multi-scale feature extraction on the tobacco shred image to be detected by using the multi-branch large-kernel fusion depth convolution module of the backbone network to obtain an initial image feature, and performing feature fusion on the initial image feature to obtain a target feature includes: Extracting features of the tobacco shred images to be detected th