Search

CN-122023261-A - Light steel surface micro defect detection method

CN122023261ACN 122023261 ACN122023261 ACN 122023261ACN-122023261-A

Abstract

The invention discloses a method for detecting tiny defects on the surface of lightweight steel, and belongs to the technical field of industrial machine vision. The method is based on an improved YOLOv n architecture and works cooperatively through three core technical means, namely, firstly, a Swin transform module is introduced into a backbone network to model long-distance space dependence and inhibit complex background interference, secondly, a high-resolution P2 detection branch is constructed, shallow detail and up-sampling semantic features are fused, micro defect characterization is enhanced through bidirectional refining circulation, and finally, P2 proprietary self-adaptive threshold focus loss ATFL is adopted, threshold updating is limited to P2 detection branch samples only, and a gradient directional return mechanism is matched, so that accurate optimization of difficult micro defects is realized. According to the scheme, the detection recall rate and the positioning precision of the micro defects are effectively improved while the model parameter quantity is obviously reduced, and high-precision and light-weight industrial deployment is realized.

Inventors

  • YU DONGHUA
  • LIU JIA
  • CHEN WENPING
  • CHAI YANFU
  • XU MINGYUAN

Assignees

  • 嵊州市绍大机电创新研究院
  • 绍兴文理学院

Dates

Publication Date
20260512
Application Date
20251230

Claims (9)

  1. 1. The method for detecting the micro defects on the surface of the lightweight steel is characterized by comprising the following steps of: S1, carrying out feature extraction on an input steel image based on a Swin converter backbone network, and outputting a multi-level feature map; S2, constructing a multi-scale feature fusion network and a P2 detection branch special for detecting micro defects, wherein the multi-scale feature fusion network fuses a shallow feature map of the Swin Transformer backbone network with an up-sampled middle feature map to generate a fused high-resolution feature map, and provides the fused high-resolution feature map for the P2 detection branch to generate defect types and positioning predictions of candidate defect areas; S3, calculating classification loss by adopting self-adaptive threshold focus loss ATFL, wherein the ATFL dynamically maintains a self-adaptive threshold for each defect type to reflect the real-time difficulty level of the current micro defect detection task, and the updating calculation of the self-adaptive threshold is only limited in a sample set which is responsible for prediction by a P2 detection branch; and S4, optimizing the multi-scale feature fusion network according to the ATFL calculated classification loss, and mainly transmitting the gradient of the classification loss back to the feature fusion module and the detection head parameters thereof in the P2 detection branch, so that the capability of the P2 detection branch for distinguishing real micro defects from background artifacts is enhanced.
  2. 2. The method according to claim 1, wherein the Swin Transformer backbone network models long distance spatial dependencies of steel surfaces through its windowed self-attention mechanism.
  3. 3. The method of claim 1, wherein the P2 detection branch has a resolution of 160 x 160 and the shallow feature map is further downsampled to 80 x 80 resolution and secondarily fused with the middle feature map to reverse-inject fine-grained information of micro-defects into higher-level semantic features, forming a bi-directional feature refinement loop.
  4. 4. The method of claim 1, wherein the multi-scale feature fusion network is a customized network based on a PAN-FPN structure, wherein a PAN path of the customized network comprises a feature enhancement module specifically designed for a P2 detection branch, the feature enhancement module receives a shallow feature map and a middle feature map from a backbone network, performs 2-time up-sampling on the middle feature map, performs element-level addition fusion on the shallow feature map, and outputs the fused high-resolution feature map through a feature refinement unit comprising a plurality of convolution layers and an activation function.
  5. 5. The method of claim 1, wherein the updating formula of the adaptive threshold is: , Wherein, the An adaptive threshold for the current training batch, t is the training batch, For the adaptive threshold of the last training batch, As the momentum coefficient of the magnetic field, The true label for the P2 detection branch prediction in the current lot is the positive sample number of class c, The confidence of the prediction for the i-th positive sample.
  6. 6. The method according to claim 1, wherein the gradient of the classification loss mainly returns that the classification loss gradient weight assigned to the P2 detection branch is higher than the classification loss gradient weights assigned to the other scale detection branches P3, P4, P5 in the back propagation process, and the optimization signal is preferentially used to enhance the discrimination capability of the P2 detection branch for the micro defects.
  7. 7. The method of claim 1, wherein the Swin fransformer backbone network is modified based on YOLOv n model architecture by introducing at least two Swin fransformer modules in the architecture to enhance model learning ability for complex modes while maintaining the lightweight nature of the overall network, the Swin fransformer modules employing a 3x3 window self-attention mechanism to improve computational efficiency and model performance.
  8. 8. A lightweight steel surface micro-defect detection device, characterized by comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the lightweight steel surface micro-defect detection method according to any one of claims 1 to 7 when executing the program.
  9. 9. A computer-readable storage medium having stored thereon a computer program, wherein the program when executed by a processor implements the lightweight steel surface micro defect detection method according to any one of claims 1 to 7.

Description

Light steel surface micro defect detection method Technical Field The invention relates to the technical field of industrial machine vision, in particular to a method for detecting tiny defects on the surface of lightweight steel. Background In modern industrial automation production, product quality control is a key link for guaranteeing product safety and reliability. Taking industries such as steel, semiconductors, textiles and the like as an example, although the size of tiny defects (such as inclusions, pits, scratches and the like) on the surface of a product is tiny, the mechanical property, the appearance quality and the safety of the final product can be seriously influenced. The traditional quality inspection method based on manual visual or simple image processing is low in efficiency, high in subjectivity and difficult to meet the real-time requirement of a high-speed production line. In recent years, a target detection technology based on deep learning, particularly a YOLO series algorithm, has become a research hotspot in the field of industrial visual detection due to a good balance between detection accuracy and reasoning speed. However, unlike the general purpose target detection scenario, the industrial imaging environment has its uniqueness, firstly, the inspected surface is often accompanied by strong specular reflection, oxide scale and repetitive rolling textures, resulting in high visual confusion of real defects and background artifacts, secondly, critical defects tend to be extremely small in size (< 0.1% image area), details are extremely easy to lose during downsampling of the depth network, and most troublesome, the actual defect dataset presents extremely long tail distribution, the number of rare but extremely harmful tiny defect samples is rare, and is extremely easy to be submerged by massive simple negative samples in training, resulting in low model recall. These factors together constitute a "triple dilemma" for industrial microdefect detection, and a special solution that can synergistically handle strong interference suppression, minuteness segment retention, and difficult sample learning is needed. The chinese patent application CN202410626863.3 proposes a target detection method based on the road scene of improvement Yolov n, which captures small targets (e.g. pedestrians, vehicles) at a distance by adding a 160×160 detection head at the P2 stage of the backbone network of YOLOv n. However, the design of the scheme is fundamentally different from the technical path and the industrial quality inspection scene, and is difficult to directly apply. Specifically, firstly, the scheme focuses on an open dynamic road environment, the background is relatively simple, the target semantics are clear, and therefore, the positioning accuracy is optimized only by replacing the bounding box regression loss (CIoU-EIoU), the serious feature confusion problem caused by complex textures in an industrial scene is not touched, and secondly, the scheme is the most critical difference in that the scheme lacks a dynamic sensing mechanism for sample difficulty in classification tasks. The added P2 detection head improves the spatial resolution, but the loss function still acts on all the global samples, and cannot effectively interfere the tiny defect learning of massive easily-separated negative samples in the industrial data set. The solution solves the problem of clearer sight, but does not solve the core problem of better learning. Therefore, the recall capability of key minor defects is still insufficient in the face of strong interference, high unbalance, industrial surfaces such as steel. In view of this, a brand new detection framework with customized scene is needed in the art, which not only has high resolution sensing capability, but also needs to be equipped with an intelligent optimization mechanism capable of guiding the learning focus of the model to tiny defects precisely and adapting to the learning difficulty of the model, so as to realize high precision and high reliability required by industrial quality inspection. Disclosure of Invention In view of the above, the invention provides a method for detecting micro defects on the surface of lightweight steel. According to the scheme, the Swin transducer backbone is adopted to enhance global context modeling capability, high-resolution P2 detection branches are constructed to retain micro defect details, P2 dedicated self-adaptive threshold focus loss ATFL is adopted for directional optimization, recall rate and detection precision of the micro defects are remarkably improved, and meanwhile, light weight of a model is achieved. The invention provides a method for detecting tiny defects on the surface of lightweight steel, which comprises the following steps: S1, carrying out feature extraction on an input steel image based on a Swin converter backbone network, and outputting a multi-level feature map; S2, constructing a multi-sc