A device and method for detecting surface defects of steel

By using the detection algorithm of the fusion channel attention mechanism and the neural network calculation rod in the detection of steel surface defects, the problems of low accuracy and low efficiency of traditional detection methods are solved, the efficient detection of steel surface defects is achieved, and the detection accuracy and efficiency are improved. efficiency.

CN115508285BActive Publication Date: 2024-10-01DATONG ZHENGDONG MACHINERY EQUIPMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211312517.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-25
Publication Date
2024-10-01
Estimated Expiration
2042-10-25

AI Technical Summary

Technical Problem

Traditional steel surface defect detection methods rely on manual visual inspection, which is easily affected by subjective factors, has low detection accuracy, high cost and low efficiency, and suffers from a large number of false detections and missed detections.

Method used

A steel surface defect detection algorithm is adopted that integrates the channel attention mechanism. The Raspberry Pi and artificial intelligence accelerator are used to combine the YOLOX structure and the Pytorch framework for detection. The neural network computing stick is used for AI reasoning, and the channel attention mechanism is introduced to detect the defect feature information. Perform weighted enhancement and suppression, use α-IoU loss and VariFocalLoss loss function to improve the model and improve the prediction ability of small targets.

Benefits of technology

It improves the accuracy of steel surface defect detection, effectively solves the problems of low detection accuracy of small targets and slow model convergence speed, enhances the prediction ability of small targets, avoids over-fitting, and improves detection efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115508285B_ABST
    Figure CN115508285B_ABST
Patent Text Reader

Abstract

A device and method for detecting surface defects of steel, the device for detecting surface defects of steel comprising a Raspberry Pi, an artificial intelligence accelerator, a hub expansion board, a micro USB connector, an Arduino development board, an LCD expansion board, a display screen, a rocker, a button, a 5MP camera, an SD card, an uninterruptible power supply expansion board and a rechargeable battery; the Raspberry Pi is provided with multiple development frameworks and software, including ROS, OpenCV, Arduino IDE, Python and packages and software libraries required by various hardware; an improved steel surface defect detection model is used for detection, the loss function is modified, and an extremely lightweight channel attention mechanism is introduced to improve the detection accuracy of steel surface defects. The device for detecting surface defects of steel in the present invention integrates multiple different hardware and software, and each component can transmit signals through a wireless network to achieve the effect of information interaction without complicated wiring; it can be used in combination with other devices and equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of steel surface detection technology, and in particular to a device and method for detecting steel surface defects. Background Art

[0002] Strip steel is a very common industrial raw material, and is increasingly widely used in daily life and industrial production. However, in the actual production of hot-rolled steel strips, due to the raw materials, the production process is easily affected by adverse factors in the environment and the operating level of the staff, various types of defects are produced on the surface. Typical surface defects of steel such as cracks, inclusions, scratches, pressed oxide scale, plaques, pitting, etc. will reduce the performance and service life of steel, seriously affect the quality and appearance of the products produced, and even directly cause safety accidents. Therefore, surface defect detection is an indispensable link in steel production. More and more companies also regard it as a key technology to improve product quality, and relevant researchers are also conducting related technical research.

[0003] The traditional steel inspection method is through visual inspection by production workers. This method is easily affected by subjective factors. It is not only costly, but also has low inspection efficiency and high requirements for workers. More importantly, it will result in a large number of false detections and missed detections. Secondly, the long-term inspection of workers under the reflection of light has a great impact on their vision. Secondly, the traditional visual steel surface defect detection method generally uses traditional image processing or target detection algorithms, and the detection accuracy is relatively low. Summary of the invention

[0004] In response to the above-mentioned technical problems, the present technical solution provides a device and method for detecting surface defects of steel. An improved steel surface defect detection algorithm is used to detect surface defects of steel, and the accuracy is improved to a certain extent compared with the original algorithm model; it can effectively solve the above-mentioned problems.

[0005] The present invention is achieved through the following technical solutions:

[0006] A device for detecting surface defects of steel, comprising a Raspberry Pi, an artificial intelligence accelerator, a hub expansion board, a micro USB connector, an Arduino development board, an LCD expansion board, a display, a joystick, a button, a 5MP camera, a memory card, an uninterruptible power supply expansion board, and a rechargeable battery;

[0007] The artificial intelligence accelerator and the Arduino development board are connected to the hub expansion board via a micro USB connector, the display screen, the joystick and the buttons are installed on the LCD expansion board, the LCD expansion board is connected to the hub expansion board via an input / output port, and the hub expansion board is connected to the Raspberry Pi via an input / output port and a micro USB connector;

[0008] The rechargeable battery is installed on an uninterruptible power supply expansion board, and the uninterruptible power supply expansion board is directly connected to the Raspberry Pi through an input / output port;

[0009] The 5MP camera is directly connected to the Raspberry Pi via a CSI-2 interface to collect image data of steel surface defects;

[0010] The Raspberry Pi is equipped with multiple development frameworks and software, including ROS, OpenCV, Arduino IDE, Python, and packages and software libraries required by various hardware.

[0011] Furthermore, the artificial intelligence accelerator adopts a neural network computing stick, which is used to improve the AI ​​reasoning computing capability and low power consumption capability; the neural network computing stick is used to input the acquired steel defect image data into a preset steel surface defect detection model, obtain the steel surface defect detection model output steel surface defect detection results, and send the image detection results to the Raspberry Pi.

[0012] Furthermore, the neural network computing stick includes a model optimizer and an inference engine; the model optimizer is used to convert a preset steel surface defect detection model into an intermediate file recognizable by the inference engine; the inference engine is used to run the intermediate file sent by the model optimizer to perform image recognition on the steel surface defect image sent by the Raspberry Pi, and send the steel surface defect detection result to the Raspberry Pi.

[0013] Furthermore, the memory card is placed in a built-in card slot of the Raspberry Pi, and is used to store the Raspberry Pi system files and the software package and steel surface detection image data required by the steel surface defect detection model.

[0014] Furthermore, the Raspberry Pi uses Zero 2W, which is connected to a remote computer via VNC to remotely display the detection results of the steel surface defect detection model.

[0015] Furthermore, the display uses an LCD display screen, and the LCD display screen is used to display the detection results of the steel surface defect detection model.

[0016] Furthermore, the Arduino development board used is the Arduino Nano 33 BLE Sense development board.

[0017] Furthermore, the LCD expansion board is the same size as the Raspberry Pi.

[0018] Furthermore, the hub expansion board is equipped with an RJ45 Ethernet interface, two USB expansion interfaces, a Raspberry Pi GPIO interface, a USB HUB interface and multiple indicator lights.

[0019] Furthermore, the RJ45 Ethernet interface can be connected to an external network cable; the Raspberry Pi GPIO interface is used to connect the single-board computer Raspberry Pi and the LCD expansion board; the USB HUB interface is connected to the single-board computer Raspberry Pi and the Micro-USB OTG communication interface via a Micro USB connector; the multiple indicator lights are used to conveniently view the working status of the power supply, network port and USB expansion interface.

[0020] Furthermore, the single-board computer Raspberry Pi Zero 2W has an onboard 1GHz quad-core 64-bit ARM Cortex-A53 processor, 2.4GHz IEEE802.11b / g / n wireless LAN and low-power Bluetooth 4.2, as well as a Micro SD card slot, a mini HDMI interface, a Micro-USB power supply interface, a Micro-USB OTG communication interface, and a CSI-2 camera interface.

[0021] Furthermore, the Micro SD card slot is used to store an SD card; the mini HDMI interface is used for an external display; the Micro-USB power supply interface is used to connect a rechargeable battery; and the CSI-2 camera interface is used to connect a 5MP camera.

[0022] Furthermore, the Arduino Nano 33BLE Sense development board has a temperature and humidity sensor, a nine-axis acceleration gravity sensor, a Bluetooth module, a distance, color, and posture sensor, a microphone, and a pressure sensor.

[0023] Furthermore, the temperature and humidity sensor is used to detect the temperature and humidity of the environment; the nine-axis acceleration gravity sensor can sense acceleration, angular velocity, magnetic field, and pressure; the Bluetooth module can realize Bluetooth low-power wireless communication; the distance, color, and posture sensor are used to detect distance, recognize color, gestures, and other machine learning projects for research and development; the microphone is used for voice recognition; and the pressure sensor is used to detect gravity.

[0024] Furthermore, the uninterruptible power supply expansion board UPS HAT (C) has a USB charging interface, a power switch, a spring ejector pin, and a 1000 mAh rechargeable battery.

[0025] Furthermore, the USB charging port is used to charge a 1000 mAh rechargeable battery; the 1000 mAh rechargeable battery is used to power the device; and the spring pin is used to connect to the single-board computer Raspberry Pi.

[0026] Furthermore, the LCD expansion board has 3 buttons, a joystick, a Raspberry Pi 40pin GPIO interface, and a 1.3-inch LCD display.

[0027] Furthermore, the three buttons and one joystick are used to control the mouse of the Raspberry Pi; the Raspberry Pi 40pin GPIO interface is used to connect the Raspberry Pi.

[0028] A steel surface defect detection algorithm integrating a channel attention mechanism can be used in the above-mentioned device for detecting steel surface defects, and is characterized in that it includes the following steps:

[0029] S1: The YOLOX structure is used as the backbone network, and the detection algorithm model is trained using the Pytorch framework to extract features from defect areas;

[0030] S2: Introduce the channel attention mechanism to adaptively weight and strengthen the important feature information of defects and suppress the unimportant feature information of defects;

[0031] S3: Modify the positioning loss function and confidence prediction loss function in the YOLOX model, replace the original IoU loss with α-IoU loss, solve the problem of gradient vanishing in IoU loss for some smaller targets in steel surface defects, resulting in low bounding box regression accuracy and slow model convergence speed, and replace the binary cross entropy loss function with VariFocalLoss loss function, so that small targets obtain relatively large loss values, thereby improving the prediction ability for small targets.

[0032] The α-IoU is a unified exponentiation of the existing loss based on IoU. The calculation formulas of IoU and α-IoU loss functions are as follows:

[0033]

[0034] Loss IoU = 1-IoU;

[0035]

[0036] In the formula, A represents the detection box, B represents the real box, A∩B represents the intersection area of ​​A and B, and A∪B represents the union area of ​​A and B;

[0037] When the predicted box does not intersect with the true box, the IoU result is 0, the loss value is also 0, the next step of training cannot be performed, the network weights cannot be updated, and the model cannot converge to the global optimum;

[0038] α-IoU loss can significantly outperform existing IoU-based losses. By adjusting α, the detector has greater flexibility in achieving different levels of bbox regression accuracy; it is more robust to small datasets and noise;

[0039] When α=2, it speeds up learning for all positive IoU targets at AP50, however, empirical studies show that the α-IoU loss with α=3 is more competitive than the α-IoU loss with α=2 in most cases.

[0040] Furthermore, the VariFocalLoss loss function described in step S3 is defined as follows:

[0041]

[0042] Where p is the predicted IACS score and q is the target IoU score; for positive samples in training, q is set to the IoU between the generated bbox and gt box (gt IoU), while for negative samples in training, the training target q for all categories is 0;

[0043] The VariFocalLoss loss function uses a hyperparameter to control the model's bias towards small targets, allowing small targets to obtain relatively large loss values, so that the model will tend to improve its own prediction ability for small targets.

[0044] Furthermore, the channels described in step S2 correspond directly to the attention weights, and cross-channel interaction is achieved through grouped convolution. Feature information is enhanced or suppressed according to the size of the attention weights, thereby improving the model's utilization of useful information. After the image passes through the backbone feature extraction network, three feature maps of different scales are generated. The introduction of the channel attention mechanism includes the following steps:

[0045] A: First, the input feature map is globally averaged pooled.

[0046] B: Local cross-channel interactive learning is achieved through convolution of 1×1 convolution with kernel size k;

[0047] C: The weight of each channel is obtained through the sigmoid activation function;

[0048] D: Recalibrate the original feature map, multiply the input feature information with the weight of each channel to obtain stronger features in a specific area, and obtain the final output feature map.

[0049] Beneficial Effects

[0050] The device and method for detecting surface defects of steel materials proposed in the present invention have the following beneficial effects compared with the prior art:

[0051] (1) This technical solution can improve the AI ​​reasoning computing ability and low power consumption ability through the neural network computing stick used in the artificial intelligence accelerator, and the YOLOX structure is used as the backbone network in the defect detection algorithm. The detection algorithm model is trained using the Pytorch framework to extract features from the defect area. At the same time, a channel attention mechanism is introduced to adaptively weight and enhance important defect feature information and suppress unimportant defect feature information, so that the steel surface defect data set is smaller. The data enhancement method is used to provide more training data. Sufficient data can effectively avoid overfitting and improve detection accuracy.

[0052] (2) This technical solution replaces the original IoU loss with the α-IoU loss to solve the problem of gradient vanishing in the IoU loss for some smaller targets in the surface defects of steel, resulting in low bounding box regression accuracy and slow model convergence speed. The binary cross entropy loss function is replaced by the VariFocalLoss loss function, so that small targets obtain relatively large loss values, thereby improving the prediction ability of small targets. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 This is a schematic diagram of the structural principle of Example 1 of the present invention.

[0054] Figure 2 This is a detection block diagram of the neural network computing stick in Example 1.

[0055] Figure 3 Schematic diagram of the attention mechanism module in Example 2 of the present invention. DETAILED DESCRIPTION

[0056] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. The described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Under the premise of not departing from the design concept of the present invention, various modifications and improvements made by ordinary persons in the art to the technical solutions of the present invention should all fall within the protection scope of the present invention.

[0057] Embodiment 1:

[0058] A device for detecting surface defects of steel, comprising a Raspberry Pi, an artificial intelligence accelerator, a hub expansion board, a micro USB connector, an Arduino development board, an LCD expansion board, a display, a joystick, a button, a 5MP camera, a memory card, an uninterruptible power supply expansion board, and a rechargeable battery.

[0059] The Raspberry Pi is equipped with multiple development frameworks and software, including ROS, OpenCV, Arduino IDE, Python, and packages and software libraries required by various hardware; the Raspberry Pi uses Zero 2W, which is connected to a remote computer via VNC to remotely display the detection results of the steel surface defect detection model.

[0060] The artificial intelligence accelerator and Arduino development board are connected to the hub expansion board via a micro USB connector.

[0061] The artificial intelligence accelerator uses a neural network computing stick, which is used to improve the AI ​​reasoning computing capability and low power consumption capability; the neural network computing stick is used to input the acquired steel defect image data into a preset steel surface defect detection model, obtain the steel surface defect detection model output steel surface defect detection results, and send the image detection results to the Raspberry Pi.

[0062] The neural network computing stick includes a model optimizer and an inference engine; the model optimizer is used to convert a preset steel surface defect detection model into an intermediate file recognizable by the inference engine; the inference engine is used to run the intermediate file sent by the model optimizer to perform image recognition on the steel surface defect image sent by the Raspberry Pi, and send the steel surface defect detection result to the Raspberry Pi.

[0063] The Arduino development board used is the Arduino Nano 33BLE Sense development board. The Arduino Nano33BLE Sense development board has a temperature and humidity sensor, a nine-axis acceleration gravity sensor, a Bluetooth module, a distance, color, and posture sensor, a microphone, and a pressure sensor.

[0064] The temperature and humidity sensor is used to detect the temperature and humidity of the environment; the nine-axis acceleration gravity sensor can sense acceleration, angular velocity, magnetic field, and pressure; the Bluetooth module can realize Bluetooth low-power wireless communication; the distance, color, and posture sensors are used to detect distance, recognize color, gestures, and other machine learning projects for research and development; the microphone is used for voice recognition; and the pressure sensor is used to detect gravity.

[0065] The display screen, joystick and buttons are mounted on an LCD expansion board, which is connected to a hub expansion board via an input / output port, and the hub expansion board is connected to a Raspberry Pi via an input / output port and a micro USB connector. The LCD expansion board is the same size as the Raspberry Pi.

[0066] The LCD expansion board has 3 buttons, a joystick, a Raspberry Pi 40pin GPIO interface, and a 1.3-inch LCD display. The 3 buttons and the joystick are used to control the mouse of the Raspberry Pi; the Raspberry Pi 40pin GPIO interface is used to connect the Raspberry Pi.

[0067] The display screen adopts an LCD display screen, and the LCD display screen is used to display the detection results of the steel surface defect detection model.

[0068] The rechargeable battery is installed on the uninterruptible power supply expansion board, and the uninterruptible power supply expansion board is directly connected to the Raspberry Pi through the input / output port.

[0069] The uninterruptible power supply expansion board UPS HAT (C) has a USB charging interface, a power switch, a spring pin, and a 1000 mAh rechargeable battery. The USB charging interface is used to charge the 1000 mAh rechargeable battery; the 1000 mAh rechargeable battery is used to power the device; and the spring pin is used to connect the single-board computer Raspberry Pi.

[0070] The 5MP camera is directly connected to the Raspberry Pi via a CSI-2 interface and is used to collect image data of steel surface defects.

[0071] The memory card is placed in the built-in card slot of the Raspberry Pi and is used to store the Raspberry Pi system files and the software package and steel surface detection image data required by the steel surface defect detection model.

[0072] The hub expansion board has an RJ45 Ethernet interface, two USB expansion interfaces, a Raspberry Pi GPIO interface, a USB HUB interface and multiple indicator lights. The RJ45 Ethernet interface can be connected to an external network cable; the Raspberry Pi GPIO interface is used to connect the single-board computer Raspberry Pi and the LCD expansion board; the USBHUB interface is connected to the single-board computer Raspberry Pi and the Micro-USB OTG communication interface through a Micro USB connector; the multiple indicator lights are used to conveniently check the working status of the power supply, network port and USB expansion interface.

[0073] The single-board computer Raspberry Pi Zero 2W has an onboard 1GHz quad-core 64-bit ARMCortex-A53 processor, 2.4GHz IEEE802.11b / g / n wireless LAN and low-power Bluetooth 4.2, as well as a Micro SD card slot, a mini HDMI interface, a Micro-USB power supply interface, a Micro-USB OTG communication interface, and a CSI-2 camera interface.

[0074] The Micro SD card slot is used to store an SD card; the mini HDMI interface is used to connect to an external display; the Micro-USB power supply interface is used to connect a rechargeable battery; and the CSI-2 camera interface is used to connect a 5MP camera.

[0075] See also Figure 2 The 5MP camera is used to collect the detection image and is connected through the CSI-2 interface of the single-board computer Raspberry Pi. The single-board computer Raspberry Pi uses Zero 2W. The system is based on Linux and has an onboard 1GHz quad-core 64-bit ARM Cortex-A53 metaprocessor. The detection results can also be displayed remotely through VNC.

[0076] The pre-trained model used needs to be converted into the IR model of the neural network computing stick toolkit OpenVINO using the weight file trained by the steel defect detection algorithm used in the present invention.

[0077] The pre-trained model is imported into the neural network computing stick, and after accelerated inference by the neural network computing stick, it is applied to the single-board computer Raspberry Pi, and then the OpenCV library is called to achieve real-time detection in the 5MP camera.

[0078] Embodiment 2:

[0079] A steel surface defect detection algorithm integrating a channel attention mechanism can be used in a device for detecting steel surface defects described in Example 1, comprising the following steps:

[0080] S1: The YOLOX structure is used as the backbone network, and the detection algorithm model is trained using the Pytorch framework to extract features from the defect area.

[0081] S2: Introduce the channel attention mechanism to adaptively weight and strengthen the important feature information of defects and suppress the unimportant feature information of defects;

[0082] The channels and attention weights will directly correspond to each other, and cross-channel interaction will be achieved through grouped convolution. The feature information will be enhanced or suppressed according to the size of the attention weight, thereby improving the model's utilization of useful information. After the image passes through the backbone feature extraction network, three feature maps of different scales will be generated; Figure 3 As shown in Figure 2, the introduction of the channel attention mechanism includes the following steps:

[0083] A: First, the input feature map is globally averaged pooled.

[0084] B: Local cross-channel interactive learning is achieved through 1×1 convolution with a kernel size of k, making full use of channel information;

[0085] C: The weight of each channel is obtained through the sigmoid activation function;

[0086] D: Recalibrate the original feature map, multiply the input feature information with the weight of each channel to obtain stronger features in a specific area, and obtain the final output feature map.

[0087] S3: Modify the positioning loss function and confidence prediction loss function in the YOLOX model, replace the original IoU loss with α-IoU loss, solve the problem of gradient vanishing in IoU loss for some smaller targets in steel surface defects, resulting in low bounding box regression accuracy and slow model convergence speed, and replace the binary cross entropy loss function with VariFocalLoss loss function, so that small targets obtain relatively large loss values, thereby improving the prediction ability for small targets.

[0088] The YOLOX structure is used as the backbone network to extract features from defect areas, solve the problem of not being able to effectively extract important feature information about defects, and introduce a channel attention mechanism. The positioning loss function and confidence prediction loss function in the steel surface defect detection model are modified to solve the problem of gradient vanishing for some smaller targets in steel surface defects, resulting in low border regression accuracy and slow model convergence, and improve the prediction ability of small defects.

[0089] In order to complete the corresponding tasks efficiently and quickly, the importance of different feature channels of feature information can be learned more significantly and deeply, and the important feature information of the target can be adaptively weighted and strengthened, while the unimportant feature information can be suppressed or weakened, thereby enhancing the perception of the target features. A channel attention mechanism is introduced into the model.

[0090] The α-IoU loss can significantly outperform existing IoU-based losses. By adjusting α, the detector has greater flexibility in achieving different levels of regression accuracy and is more robust to small data sets and noise. The VariFocalLoss loss function uses a hyperparameter to control the model's bias towards small targets to improve detection accuracy.

[0091] The α-IoU is a unified exponentiation of the existing loss based on IoU. The calculation formulas of IoU and α-IoU loss functions are as follows:

[0092]

[0093] LoSS IoU =i-IoU;

[0094]

[0095] In the formula, A represents the detection box, B represents the real box, A∩B represents the intersection area of ​​A and B, and A∪B represents the union area of ​​A and B.

[0096] When the predicted box does not intersect with the true box, the IoU result is 0, the loss value is also 0, the next step of training cannot be performed, the network weights cannot be updated, and the model cannot converge to the global optimum.

[0097] α-IoU loss can significantly outperform existing IoU-based losses. By adjusting α, the detector has greater flexibility in achieving different levels of bbox regression accuracy; it is more robust to small datasets and noise;

[0098] When α=2, it speeds up learning for all positive IoU targets at AP50, however, empirical studies show that the α-IoU loss with α=3 is more competitive than the α-IoU loss with α=2 in most cases.

[0099] The VariFocalLoss loss function is defined as follows:

[0100]

[0101] Where p is the predicted IACS score and q is the target IoU score; for positive samples in training, q is set to the IoU between the generated bbox and gt box (gt IoU), while for negative samples in training, the training target q for all categories is 0;

[0102] The VariFocalLoss loss function uses a hyperparameter to control the model's bias towards small targets, allowing small targets to obtain relatively large loss values, so that the model will tend to improve its own prediction ability for small targets.

[0103] Specific examples:

[0104] The model was trained on the Ubuntu system using the Pytorch framework. After the training was completed, the weight file generated after the training was converted into the IR model of the neural network computing stick toolkit OpenVINO, and then imported into the neural network computing stick. After the accelerated reasoning of the neural network computing stick, it was applied to the single-board computer Raspberry Pi, and then the OpenCV library was called to achieve real-time detection in the 5MP camera.

[0105] Dataset and evaluation metrics:

[0106] This case uses the NEU-DET steel surface defect detection dataset released by Northeastern University as training data for model training. The specific steps are as follows:

[0107] (1) Dataset expansion: Before training, the dataset is randomly enlarged, cropped, rotated, and subjected to mosaic data augmentation to increase the number of samples, improve the generalization ability of the model, and prevent overfitting.

[0108] (2) Divide the data set: Randomly shuffle the data set, and then divide the data set into training set and test set in a ratio of 8:2.

[0109] (3) Model training: Use the improved YOLOX network model for training.

[0110] In order to evaluate the performance of the steel surface defect detection algorithm proposed in the present invention, the commonly used evaluation indicators precision (Precision): the proportion of positive samples in the samples predicted as positive samples and recall (Recall): the proportion of positive samples successfully predicted as positive samples and mAP (Mean Average Precision) are used to evaluate the model. AP refers to the area under the PR (Precision-Recall) curve, and mAP refers to the mean of AP of each category. The larger the AP and mAP values, the better. Their calculation methods are:

[0111]

[0112]

[0113]

[0114]

[0115] Among them, TP is the true positive, that is, the number of targets with IoU ≥ 0.5 between the predicted box and the real box; FP is the false positive, that is, the number of targets with IoU ≤ 0.5 between the predicted box and the real box; FN is the number of positives that are mistakenly judged as negative; TN is the number of negatives that are judged as negative.

[0116] Results and Analysis:

[0117] In order to evaluate the performance improvement of the method of the present invention, the accuracy of steel defects was detected, and the original YOLOX model algorithm and the improved steel surface defect detection algorithm proposed in the present invention were compared. It was found that the mAP value of the improved algorithm of the present invention was improved by 4.13% compared with the improved algorithm.

Claims

1. A steel surface defect detection algorithm integrating a channel attention mechanism can be used in a device for detecting steel surface defects, characterized in that: The device for detecting surface defects of steel includes: a Raspberry Pi, an artificial intelligence accelerator, a hub expansion board, a micro USB connector, an Arduino development board, an LCD expansion board, a display, a joystick, a button, a 5MP camera, a memory card, an uninterruptible power supply expansion board, and a rechargeable battery; The artificial intelligence accelerator and the Arduino development board are connected to the hub expansion board via a micro USB connector, the display screen, the joystick and the buttons are installed on the LCD expansion board, the LCD expansion board is connected to the hub expansion board via an input / output port, and the hub expansion board is connected to the Raspberry Pi via an input / output port and a micro USB connector; The rechargeable battery is installed on an uninterruptible power supply expansion board, and the uninterruptible power supply expansion board is directly connected to the Raspberry Pi through an input / output port; The 5MP camera is directly connected to the Raspberry Pi via a CSI-2 interface to collect image data of steel surface defects; The Raspberry Pi is equipped with multiple development frameworks and software, including ROS, OpenCV, Arduino IDE, Python, and packages and software libraries required for various hardware; The steel surface defect detection algorithm comprises the following steps: S1: The YOLOX structure is used as the backbone network, and the detection algorithm model is trained using the Pytorch framework to extract features from defect areas; S2: Introduce the channel attention mechanism to adaptively weight and strengthen the important feature information of defects and suppress the unimportant feature information of defects; S3: Modify the positioning loss function and confidence prediction loss function in the YOLOX model, replace the original IoU loss with α-IoU loss, and replace the binary cross entropy loss function with VariFocalLoss loss function, so that small targets obtain relatively large loss values ​​and improve the prediction ability of small targets; The α-IoU is a unified exponentiation of the existing loss based on IoU. The calculation formulas of IoU and α-IoU loss functions are as follows: Loss IoU =1-IoU; In the formula, A represents the detection box, B represents the real box, A∩B represents the intersection area of ​​A and B, and A∪B represents the union area of ​​A and B; When the predicted box does not intersect with the true box, the IoU result is 0, the loss value is also 0, the next step of training cannot be performed, the network weights cannot be updated, and the model cannot converge to the global optimum.

2. According to claim 1, a steel surface defect detection algorithm integrating a channel attention mechanism is characterized in that: The artificial intelligence accelerator uses a neural network computing stick, which is used to input the acquired steel defect image data into a preset steel surface defect detection model, obtain the steel surface defect detection model output steel surface defect detection results, and send the image detection results to the Raspberry Pi.

3. According to claim 2, a steel surface defect detection algorithm integrating a channel attention mechanism is characterized in that: The neural network computing stick includes a model optimizer and an inference engine; the model optimizer is used to convert a preset steel surface defect detection model into an intermediate file recognizable by the inference engine; the inference engine is used to run the intermediate file sent by the model optimizer to perform image recognition on the steel surface defect image sent by the Raspberry Pi, and send the steel surface defect detection results to the Raspberry Pi.

4. According to claim 1, a steel surface defect detection algorithm integrating a channel attention mechanism is characterized in that: The memory card is placed in the built-in card slot of the Raspberry Pi and is used to store the Raspberry Pi system files and the software package and steel surface detection image data required by the steel surface defect detection model.

5. According to claim 1, a steel surface defect detection algorithm integrating a channel attention mechanism is characterized in that: The Raspberry Pi uses Zero 2W, which is connected to a remote computer via VNC to remotely display the detection results of the steel surface defect detection model.

6. According to claim 1, a steel surface defect detection algorithm integrating a channel attention mechanism is characterized in that: The display adopts an LCD display screen, and the LCD display screen is used to display the detection results of the steel surface defect detection model.

7. The steel surface defect detection algorithm integrating channel attention mechanism according to claim 1 is characterized by: The Arduino development board used is the Arduino Nano 33BLE Sense development board.

8. The steel surface defect detection algorithm integrating channel attention mechanism according to claim 1 is characterized by: The VariFocalLoss loss function described in step S3 is defined as follows: Where p is the predicted IACS score and q is the target IoU score; for positive samples in training, q is set to the IoU between the generated bbox and gt box (gt IoU), while for negative samples in training, the training target q for all categories is 0; The VariFocalLoss loss function uses a hyperparameter to control the model's bias towards small targets, allowing small targets to obtain relatively large loss values, so that the model will tend to improve its own prediction ability for small targets.

9. The steel surface defect detection algorithm integrating channel attention mechanism according to claim 1 is characterized by: The channels described in step S2 correspond directly to the attention weights, and cross-channel interaction is achieved through grouped convolution. The feature information is enhanced or suppressed according to the size of the attention weight, thereby improving the model's utilization of useful information. After the image passes through the backbone feature extraction network, three feature maps of different scales are generated. The introduction of the channel attention mechanism includes the following steps: A: First, the input feature map is globally averaged pooled. B: Local cross-channel interactive learning is achieved through convolution of 1×1 convolution with kernel size k; C: The weight of each channel is obtained through the sigmoid activation function; D: Recalibrate the original feature map, multiply the input feature information with the weight of each channel to obtain stronger features in a specific area, and obtain the final output feature map.