Steel rolling surface defect detection method, electronic equipment and computer readable storage medium
By using the combination of Bi-LSTM network structure and attention mechanism in the detection of surface defects of rolled steel, the problems of low detection efficiency and low accuracy in the prior art are solved, and defect detection with higher accuracy and higher efficiency are achieved.
Patent Information
- Application Number
- CN202411953735.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-25
AI Technical Summary
The prior art has problems of low efficiency and low accuracy in the detection of steel surface defects, especially when dealing with irregular shapes or fuzzy defects, the recognition effect is poor and sensitive to external factors.
The surface defect detection method of rolled steel surface defect detection based on Bi-LSTM is adopted, and the detection model is trained and tested using the training set and verification set to output the surface defect detection results of rolled steel surface defects.
It improves the accuracy of surface defect detection of rolled steel, can dynamically adjust the characteristic areas of interest, identify subtle changes and complex patterns of surface defects, reduces the impact of noise, reduces the risks of missed and missed detection, and improves detection efficiency and accuracy.
Smart Images

Figure CN119887687A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of target detection, and in particular relates to a method for detecting surface defects of rolled steel, an electronic device and a computer-readable storage medium. Background Art
[0002] As the main development material of modern industrial technology, steel is widely used in the fields of construction, marine engineering, aerospace engineering, etc., and the requirements for steel quality have become more stringent. However, due to the technical limitations of steel production, various surface defects such as scratches, cracks, concave surfaces, etc. are inevitable in the production process. These surface defects of steel not only affect the appearance of the product, but also reduce the wear resistance, toughness and other properties of the steel, and shorten the service life of the steel.
[0003] At present, the existing technologies for steel surface defect detection include:
[0004] (1) Traditional manual visual inspection, which mainly relies on manual visual inspection, is a low-cost and simple-to-operate inspection method, but it has the disadvantages of low efficiency and low accuracy.
[0005] (2) Defect detection based on image processing, which identifies defects on the steel surface by filtering, edge detection, feature extraction and other operations on the image. The detection method based on image processing is relatively mature and suitable for detecting regular defects, but it has poor recognition effect on irregular or blurred defects, and is more sensitive to external factors such as lighting and angle. Summary of the invention
[0006] In view of the above-mentioned defects or deficiencies in the prior art, the present application aims to provide a method for detecting surface defects of rolled steel, an electronic device and a computer-readable storage medium.
[0007] In a first aspect, according to an embodiment of the present invention, a method for detecting surface defects of rolled steel is provided, comprising the following steps:
[0008] Based on the steel rolling surface defect image data, a data set is constructed, and the data set includes a training set and a validation set;
[0009] The training set and the validation set are used in sequence to train and test a steel rolling surface defect detection model, wherein the steel rolling surface defect detection model is based on Bi-LSTM and is equipped with an attention module through an attention mechanism;
[0010] The steel rolling surface defect image to be detected is input into the trained steel rolling surface defect detection model, and the steel rolling surface defect detection result is output.
[0011] In combination with the first aspect, in certain embodiments of the present invention, the rolled steel surface defect image data includes image data of various types of defects on the rolled steel surface.
[0012] In combination with the first aspect, in some embodiments of the present invention, the attention mechanism adopts the CBAM attention mechanism.
[0013] In combination with the first aspect, in certain embodiments of the present invention, the loss function of the steel rolling surface defect detection model is specifically as follows:
[0014]
[0015] Where N is the length of the input sequence, is the predicted value of the model, y i is the true value.
[0016] In certain embodiments, an Adam optimizer is applied to the steel rolling surface defect detection model.
[0017] In some embodiments, the Bi-LSTM uses RNN and its improved LSTM to process data information, and has a bidirectional structure. The basic architecture of LSTM consists of five parts: input x t 、output h t , Update gate i t 、Forget gate t , output gate o t ,in:
[0018] Forget Gate t The expression of is as follows:
[0019] f t =σ(W f *[h t-1 ,x t ]+b f )
[0020] Update Gate t The expression of is as follows:
[0021] i t =σ(W i *[h t-1 ,x t ]+b i )
[0022] c′ t =tanh(W c *[h t-1 ,x t ]+b c )
[0023] c t =ft *c t-1 +i t *c′ t
[0024] Output gate o t The expression of is as follows:
[0025] o t =σ(W o *[h t-1 ,x t ]+b o )
[0026] h t =o t *tanh(c t )
[0027] Among them, W f , W i , W c , W o represents the weight matrix; b f , b i , b c , b o represents the bias term; σ represents the sigmoid function, which maps the value to the interval [0,1]; tanh(.) represents the hyperbolic tangent function, which is used to standardize the data range to [-1,1]; c′ t Represents the candidate cell state, calculates the new information content at the current moment, and updates gate i t Combine to update the cell state.
[0028] In a second aspect, according to an embodiment of the present invention, there is provided an electronic device, comprising:
[0029] one or more processors;
[0030] a memory configured to store one or more computer programs;
[0031] a communication interface configured to enable the processor and the memory to communicate with an external device;
[0032] When the computer program is executed by the one or more processors, the electronic device executes the method for detecting surface defects of rolled steel as described in the first aspect.
[0033] In a third aspect, according to an embodiment of the present invention, there is provided a computer-readable storage medium, comprising a computer program, which, when executed on an electronic device, enables the electronic device to execute the method for detecting surface defects of rolled steel as described in the first aspect.
[0034] Compared with the prior art, the present invention has the following beneficial effects:
[0035] (1) The network structure based on Bi-LSTM combined with the attention mechanism can capture the long-term temporal dependency and global context information of image data. Through the processing of the bidirectional LSTM network, the model can obtain more comprehensive feature information, thereby improving the accuracy of steel rolling surface defect detection;
[0036] (2) By adding an attention mechanism, the model can dynamically adjust the feature area of interest, which helps to identify subtle changes and complex patterns of surface defects. The attention mechanism can automatically distinguish key local features, reduce the impact of noise, and improve the model's ability to identify complex surface defects;
[0037] (3) The bidirectional processing of Bi-LSTM and the introduction of the attention mechanism in the present invention help the model distinguish between background and noise. By comprehensively processing the context information of the detection area, the model can effectively avoid false positives and redundant detections.
[0038] (4) The present invention constructs a complete data set (including a training set and a validation set) and performs multiple rounds of training and validation on the model, which helps to enhance the generalization ability of the model and enable it to achieve better detection performance in different data sets and application scenarios;
[0039] (5) The present invention adopts the parallel computing characteristics of Bi-LSTM combined with the optimization of the attention mechanism, so that the model can efficiently handle surface defect detection tasks; this structure can reduce the computational complexity and training time while maintaining high detection accuracy;
[0040] (6) The present invention inputs the surface defect image of the steel rolling to be detected into the trained model, and the system can automatically output the defect detection results. This automated detection method greatly improves the detection efficiency and reduces the need for manual intervention, and is particularly suitable for large-scale or high-frequency detection tasks;
[0041] (7) In practical applications, the present invention can improve the efficiency and accuracy of detecting surface defects of rolled steel, reduce the risks of missed detection and false detection, and ensure product quality; timely detection of defects helps to regulate quality problems in subsequent production, thereby improving production efficiency and quality control capabilities. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the scheme in the embodiment of the present invention, the following is a brief introduction to the drawings required for describing the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 is a flow chart of a method for detecting surface defects of rolled steel according to an embodiment of the present invention;
[0044] Figure 2 is a structural block diagram of an LSTM unit according to an embodiment of the present invention;
[0045] Figure 3 is a structural block diagram of a CBAM module according to an embodiment of the present invention;
[0046] Figure 4 FIG. 4 is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0047] The present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the invention are shown in the accompanying drawings.
[0048] At present, the existing technologies for steel surface defect detection include: (1) traditional manual visual inspection, which mainly relies on manual visual inspection. This detection method is low-cost and simple to operate, but has the disadvantages of low efficiency and low accuracy; (2) defect detection based on image processing, which identifies defects on the steel surface by filtering, edge detection, feature extraction and other operations on the image. The detection method based on image processing is relatively mature and suitable for detecting regular defects, but the recognition effect of irregular or blurred defects is poor, and it is more sensitive to external factors such as lighting and angle.
[0049] In order to overcome the shortcomings of the above-mentioned steel surface defect detection technology, the present invention provides a defect detection method, which can detect surface defects of rolled steel, especially surface defects of rolled steel (for example, cracks, folds, scratches, pits, holes, ripples, peeling, etc.).
[0050] Figure 1 FIG. 2 is a flow chart of a method for detecting surface defects of rolled steel according to an embodiment of the present invention. Figure 1 As shown, the steel rolling surface defect detection method can be applied to a computing device, and the steel rolling surface defect detection method includes:
[0051] Step S1, constructing a data set based on rolled steel surface defect image data, wherein the data set includes a training set and a verification set;
[0052] In some embodiments, the rolled steel surface defect image data may be image data of various types of rolled steel surface defects; in some embodiments, the rolled steel surface defect image data may be derived from an existing, open source rolled steel surface defect database;
[0053] Of course, in other embodiments, the image data of rolled steel surface defects can also be obtained through on-site collection. Considering that rolled steel production can be automated, when rolled steel is stationary or moving, multiple high-resolution images of rolled steel can be captured. For example, an imaging system with a camera or other imaging equipment is configured in the production workshop. The imaging system can continuously capture images of rolled steel. The camera in the imaging system can be a high-speed camera. The high-speed camera can capture dynamic images at a very high frequency and capture multiple images of rolled steel on the production line, covering various positions of rolled steel. Screening out rolled steel surface defect images from the captured rolled steel images helps to obtain more accurate rolled steel detection results.
[0054] The data set can be defined by labeled image blocks extracted from images of rolled steel that is actually damaged (e.g., the rolled steel is damaged when it is operating according to one or more normal, standard or recognized operating processes), artificially damaged (e.g., deliberately damaged by humans when not in operation), synthetically damaged (e.g., the appearance of the rolled steel is synthetically changed in the image to show or emphasize the damage), or physically defined defects (cracks, folds, scratches, pits, holes, ripples, peeling, etc.) The images and labels of the data set can be subdivided into a training set and a validation set, the images and labels of the training set are used to train a rolled steel surface defect detection model (see below) to identify damage (defects) in one or more images, and the images and labels of the validation set are used to test or confirm the effectiveness of the trained rolled steel surface defect detection model.
[0055] Step S2, using the training set and the validation set in step S1 in turn to train and test the steel rolling surface defect detection model, where the steel rolling surface defect detection model is based on a Bi-LSTM (bidirectional long short-term memory network) and is equipped with an attention module through an attention mechanism;
[0056] By adjusting the parameters and functions, an effective network training process can be achieved, that is, according to the pre-set number of training times, the parameters of the steel rolling surface defect detection model are continuously adjusted until a certain threshold is reached. In this way, even if the expected number of training times is not reached, the steel rolling surface defect detection model can stop running when the threshold is met. After 3 epochs, if the loss function has not been significantly improved, the steel rolling surface defect detection model will be terminated.
[0057] As an artificial neural network, the steel rolling surface defect detection model is a parallel distributed computing processor system composed of individual units that can jointly learn and store experimental knowledge and make this knowledge available for one or more applications. Such a network can acquire knowledge from the environment through one or more flexible learning processes, determine the advantages of the respective connections between these neurons, and use these advantages when storing the acquired knowledge, thereby simulating the nonlinear psychological performance of many neurons in the human brain in multiple layers. Like the human brain, the steel rolling surface defect detection model can use a target number of neurons, each of which is connected to multiple other neurons to form a network. A single neuron may only be used to solve simple problems, but if the neurons are layered, more complex problems can be solved, including an input layer, an output layer, and one or more intermediate hidden layers.
[0058] The existing unidirectional LSTM unit can only process information before the current moment, while the Bi-LSTM (bidirectional long short-term memory network) in the present steel rolling surface defect detection model is an improved LSTM network, which has a bidirectional structure, that is, it has forward and backward feature extraction paths, and can process forward information and backward information at the same time, providing a more comprehensive data understanding and analysis, so that each moment can determine the final output based on the forward information and backward information. Since it can process information at two moments at the same time, through this bidirectional feature extraction method, the steel rolling surface defect detection model can more comprehensively understand the characteristics of the input data, thereby improving the recognition accuracy of defect features in the steel rolling surface defect image. The steel rolling surface defect detection method adopted by the present invention is based on Bi-LSTM (Bidirectional LSTM). Because it has the ability to capture information from the previous and next moments mentioned above, it overcomes the defects of the traditional neural network method.
[0059] like Figure 3 As shown, in some embodiments, the attention mechanism adopts the CBAM attention mechanism. The CBAM module (Convolutional Block Attention Module) is a lightweight attention mechanism that adds attention weights to the feature maps of each layer through channel attention and spatial attention, thereby improving the model's attention to important features. Its main principles are as follows:
[0060] 1. Channel attention: The weight of each channel of the feature map is calculated through global average pooling and maximum pooling operations, allowing the model to focus on more recognizable channel features.
[0061] 2. Spatial attention: Perform weighted aggregation on each channel feature, focusing on the weights of key areas of the feature map in the spatial dimension.
[0062] The above-mentioned channel attention (CAM) and spatial attention (SAM) are independent components of the CBAM module, and together constitute the core function of the CBAM module. CAM considers both draw and maximum pooling to reduce the information loss caused by pooling. SAM first performs global maximum pooling and global average pooling, then performs convolution operations to reduce the channel to 1, and finally uses sigmoid to generate a spatial attention feature map, which is finally multiplied with the channel attention feature map.
[0063] The CBAM module combines channel attention and spatial attention to construct a hybrid attention, which maximizes the weight of task-related features by selectively focusing on different dimensional information of the input feature map. The CBAM particularly emphasizes how to effectively integrate these two attention mechanisms to optimize the performance of the model. CBAM has played a huge role in improving the attention mechanism of traditional convolutional neural networks. It takes both spatial attention and channel attention into consideration, so that the entire steel rolling surface defect detection model can process information in an effective way. The dual attention of space and channels helps to improve the performance of the neural network. The former focuses on the key pixel areas that affect the classification results, while the latter focuses on giving different weights to different channels, which helps to optimize the performance of the steel rolling surface defect detection model.
[0064] In this steel rolling surface defect detection model, the fusion of Bi-LSTM and CBAM modules has the following advantages:
[0065] 1. Effective time series information modeling: Bi-LSTM can capture the sequence information of images in steel rolling surface defect detection, especially when the defect distribution is continuous or has a certain sequence relationship, it can more accurately extract the defect features in the image. Compared with unidirectional LSTM, bidirectional LSTM can learn the information flow in the image from both the forward and backward directions, so that the model has more comprehensive feature information when analyzing defects.
[0066] 2. Enhanced feature expression capability: CBAM weights the features of the steel rolling surface defect image through two attention modules, channel and space, to improve the expression of key area features and reduce the interference of irrelevant background. The channel attention mechanism can capture important features on different channels, while the spatial attention mechanism focuses on the key positions of the defect image, allowing the model to more effectively focus on the detail areas of the defect.
[0067] 3. Improve the robustness of detection: The combination of Bi-LSTM and CBAM can improve the robustness and accuracy of the model, especially in the case of more noise or complex lighting conditions. CBAM can dynamically adjust the feature weights to adapt to environmental changes, while the bidirectional information propagation of Bi-LSTM further enhances the recognition stability of the model in complex backgrounds.
[0068] 4. More accurate defect location and classification: CBAM applies the attention mechanism to the feature map, which enables the model to accurately locate and identify defect areas when detecting surface defects in rolled steel. Combined with the time series feature analysis of Bi-LSTM, it can better distinguish different types of defect features and improve the accuracy of defect location and classification.
[0069] 5. Reduce computing resource consumption: Compared with more complex convolutional neural networks or multi-layer convolution attention mechanisms, the combined structure of Bi-LSTM and CBAM is relatively simple but effective. It can reduce the computational complexity of the model while ensuring the accuracy of steel rolling surface defect image detection and improve detection efficiency.
[0070] In some embodiments, the attention mechanism adopts the SE (Squeeze-and-Excitation) attention mechanism. The implementation steps of the SE attention mechanism are as follows:
[0071] 1) Squeeze: It is a method used to compress two-dimensional features in order to obtain global features.
[0072] 2) Excitation: The process of generating different weight values aims to build correlation between channels, which is mainly achieved through the fully connected layer. The number of output weights in this process is equal to the number of input channels.
[0073] 3) Scale: Assign the previously calculated weights to each channel so that its features can be effectively evaluated.
[0074] In some embodiments, the loss function of the steel rolling surface defect detection model is optimized. The loss function is an important learning criterion, which can be used to measure the performance of a network and is often related to the optimization amount. The mean square error loss function is used to calculate the mean square error between them. The calculation formula is shown in the following formula:
[0075]
[0076] Where N is the length of the input sequence, is the predicted value of the model, y i is the true value;
[0077] By optimizing the loss function of the steel rolling surface defect detection model, measuring and minimizing the model's prediction error, amplifying the error to promote the model to correct the error, making the model's training process have a continuous and differentiable property for easy optimization, accelerating the model's convergence to improve the accuracy in regression tasks, and assisting the model to avoid overfitting to improve generalization ability.
[0078] In some embodiments, in step S2, applying the Adam optimizer to the steel rolling surface defect detection model can effectively optimize the weight parameters and bias parameters in the steel rolling surface defect detection model.
[0079] Specifically, the Adam optimizer combines the advantages of the Momentum and RMSprop optimizers, and optimizes parameters mainly through the following steps:
[0080] 1. First-order moment estimation (i.e. momentum): Adam maintains an exponentially decaying average of the gradient of each parameter. This helps speed up the gradient descent process, especially in optimization spaces with many flat areas.
[0081] 2. Second-order moment estimate (i.e., the exponentially decaying average of the square of the gradient): This helps adjust the learning rate of each parameter so that the update amplitude is smaller in the direction of larger gradient and larger in the direction of smaller gradient, thereby improving the optimization efficiency.
[0082] 3. Adaptive learning rate: Adam calculates an independent adaptive learning rate for each parameter, which can be dynamically adjusted according to the historical information of the gradient, making the update process more stable.
[0083] 4. Bias correction: In the early stages of training, since the average value of the gradient and the average value of the squared gradient are close to zero, Adam introduces bias correction to solve this problem so that the model update is not affected by the bias.
[0084] Advantages of Adam optimizer in steel rolling surface defect detection:
[0085] 1. Adaptive learning rate: Adam calculates the adaptive learning rate of each parameter, so that during the training process, whether it is a weight parameter or a bias parameter, the learning rate can be dynamically adjusted according to the historical information of its gradient. This avoids the instability of the training process that may be caused by using a fixed learning rate, which is especially important when dealing with highly complex tasks such as steel rolling surface defect detection;
[0086] 2. Efficient convergence: Since Adam uses momentum and the square average of gradients, it can converge quickly in the early stages of training, especially when encountering sparse gradients or unstable gradient changes. Adam's performance is better than traditional gradient descent methods;
[0087] 3. Bias correction: Adam will perform bias correction in the early stages of training so that the update is not affected by the initial weight and bias settings, which helps converge to the global optimal solution faster;
[0088] 4. Applicable to large-scale data sets: Steel rolling surface defect detection usually involves a large amount of image data. The Adam optimizer can effectively process these large-scale data sets, reduce training time, and avoid overfitting;
[0089] 5. Due to its combination of momentum and adaptive adjustment mechanism, Adam can maintain high stability in variable gradients and complex loss spaces, making it more stable and reliable in the training process of the steel rolling surface defect detection model.
[0090] like Figure 2 As shown, in some embodiments, Bi-LSTM uses RNN and its improved LSTM to process data information, which has a bidirectional structure. The basic architecture of LSTM consists of five parts: input x t 、output h t , Update gate i t 、Forget gate t , output gate o t ,in:
[0091] Forget Gate t The expression of is as follows:
[0092] f t =σ(W f *[h t-1 ,x t ]+b f )
[0093] Update Gate t The expression of is as follows:
[0094] i t =σ(W i *[h t-1 ,x t ]+b i )
[0095] c′ t =tanh(W c *[h t-1 ,x t ]+b c )
[0096] c t =f t *c t-1 +i t *c′ t
[0097] Output gate o t The expression of is as follows:
[0098] o t =σ(W o *[h t-1 ,x t ]+b o )
[0099] h t =o t *tanh(c t )
[0100] Among them, W f , W i , W c , W o represents the weight matrix; b f 、b i 、b c 、b o represents the bias term; σ represents the sigmoid function, which maps the value to the interval [0,1]; tanh(.) represents the hyperbolic tangent function, which is used to standardize the data range to [-1,1]; c′ t Represents the candidate cell state, calculates the new information content at the current moment, and updates gate i t Combine to update the cell state.
[0101] Finally, the output value of the unit is determined, and the output gate calculates h t The sigmoid layer determines which part of the cell state is output, and the tanh layer processes it to obtain a value between -1 and 1, and finally determines the output.
[0102] The Bi-LSTM passes through the update gate i in the LSTM t 、Forget gate t , output gate o t The combined control of the forget gate f t It can automatically adjust the information flow of the previous moment and filter out irrelevant or redundant information, thereby improving the model's attention to defect features and avoiding noise interference.
[0103] Candidate cell state c′ t The introduction of t Dynamically update the current cell state c t , realizing the fusion of new information and historical information. In this way, the model can not only retain long-term feature information, but also adapt to real-time changes in input, improving adaptability and accuracy to different defect types.
[0104] The bidirectional structure of Bi-LSTM allows the model to analyze defect image data from both the front and back directions simultaneously. This bidirectional processing enables the model to take into account the context information during the detection process, thereby performing better on hard-to-capture defect features such as edges and details, making defect detection more comprehensive and accurate. The structural design of LSTM effectively alleviates the gradient problem of traditional RNN when processing long sequence data, allowing the model to better handle longer and more complex defect image sequences. Therefore, this solution has stronger adaptability and robustness when detecting continuous and complex defect features on the surface of rolled steel.
[0105] Through the σ activation function sigmoid and the hyperbolic tangent function tanh, the model can finely control the output range of each layer gate (i.e. [0, 1] and [-1, 1]) to ensure the standardization of input and output data. This fine control reduces the risk of gradient disappearance or explosion, ensuring the stability of the model and the training effect.
[0106] Step S3, inputting the steel-rolled surface defect image to be detected into the steel-rolled surface defect detection model trained in step S2, and outputting the steel-rolled surface defect detection result.
[0107] According to an embodiment of the present invention, the rolled steel can be evaluated at any time during the life cycle or operation cycle of the respective rolled steel. In some embodiments, one or more systems and methods disclosed herein can be used to perform quality assurance tests on one or more rolled steels, for example, a large number of such rolled steels are subjected to quality assurance tests on representative samples after their manufacture or assembly to determine the surface defects of such rolled steels. For example, in the case of mass production of rolled steels according to a general process, a predetermined number of rolled steels can be randomly selected and photographed to confirm the surface defects of the rolled steels manufactured according to the process. Alternatively, the object can be inspected regularly or at intervals, or after one or more events. For example, when the rolled steel is in use, one or more aspects of the rolled steel can be photographed, and the image can be processed to determine whether the rolled steel is in a satisfactory state, or whether maintenance, repair or further inspection is required. In addition, if necessary, the object can be repeatedly inspected one or more times, for example, after each use of such an object, between any two uses of such an object, or according to a predetermined schedule.
[0108] Figure 4 FIG. 2 shows a structural diagram of an electronic device according to another embodiment of the present invention. Figure 4 As shown, the electronic device includes:
[0109] one or more processors 10;
[0110] a memory 20 configured to store one or more computer programs;
[0111] a communication interface 30 configured to enable the processor 10 and the memory 20 to communicate with an external device;
[0112] When the computer program is executed by the one or more processors 10, the electronic device executes the method for detecting surface defects of rolled steel.
[0113] In one embodiment, the electronic device may be a laptop computer, a tablet computer, a mobile device, a smart phone, a smart watch, or other electronic devices.
[0114] According to another embodiment of the present invention, there is provided a computer-readable storage medium, comprising a computer program, which, when executed on an electronic device, enables the electronic device to execute the method for detecting surface defects of rolled steel.
[0115] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In addition, the specific features, structures, materials or characteristics described may be combined in an appropriate manner in any one or more embodiments or examples. In addition, those skilled in the art may connect and combine the various embodiments or examples described in the specification, as well as the features of the various embodiments or examples, without contradiction.
[0116] In addition, the terms "first", "second", etc. are used for description only and should not be interpreted as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one feature. In the description of the present invention, unless otherwise clearly and specifically defined, the meaning of "multiple" is two or more.
[0117] Any process or method description in the flowchart or other descriptions herein can be understood as a module, segment or code portion representing executable instructions, including one or more steps for implementing a specific logical function or process. And the scope of the preferred embodiment of the present invention includes additional implementations, wherein, depending on the functions involved, these functions can be performed in a substantially simultaneous manner or in a reverse order relative to the order shown or discussed, which should be understood by those skilled in the art to which the embodiments of the present invention relate.
[0118] The logic and / or steps represented in the flowchart or other content described herein. For example, it can be considered as an ordered list of executable instructions for implementing logical functions, which can be contained in any computer-readable medium for use by an instruction execution system, device or apparatus (a computer-based system, a system including a processor, or other system that can obtain instructions from an instruction execution system and execute the instructions), device or apparatus), or in conjunction with these instructions to execute the system, device or apparatus. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transport the program for use in an instruction execution system, device or apparatus, or in conjunction with such an instruction execution system, device or apparatus. More specific examples of computer-readable media (non-exhaustive list) include: electrical connections with one or more wires (electronic devices), portable computer disk cartridges (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic devices, and portable read-only memory (CDROM). Furthermore, the computer-readable medium may even be a paper or other suitable medium on which the program may be printed, since the program may be obtained electronically, for example by optically scanning the paper or other medium, and then edited, interpreted or processed in another suitable manner if necessary, and then stored in a computer memory.
[0119] It should be understood that parts of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following known in the art may be used to implement: a discrete logic circuit having logic gates for implementing logic functions on data signals, an application-specific integrated circuit having appropriate combination logic gates, a programmable gate array (PGA), a field programmable gate array (FPGA), and the like.
[0120] Those skilled in the art will appreciate that all or part of the steps carried by the method for implementing the above-mentioned embodiment can be completed by program instructions related to hardware, and the program can be stored in a computer-readable storage medium. When executed, it includes one or a combination of the steps of the method embodiment.
[0121] In addition, the functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist physically independently, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may be stored in a computer-readable storage medium. The storage medium may be a read-only memory, a disk, or an optical disk, etc.
[0122] The above is only a specific implementation of the present invention and does not limit the protection scope of the present invention. Any person skilled in the art can easily think of fabrications and changes within the technical scope of the present invention, all of which should be included in the protection scope of the present invention. Therefore, the protection scope of the claims should be taken as the protection scope of the present invention.
Claims
1. A method for detecting surface defects of rolled steel, characterized in that: The steps include: Based on the rolled steel surface defect image data, a data set is constructed, wherein the data set includes a training set and a validation set; The training set and the validation set are used in sequence to train and test a steel rolling surface defect detection model, wherein the steel rolling surface defect detection model is based on Bi-LSTM and is equipped with an attention module through an attention mechanism; The steel rolling surface defect image to be detected is input into the trained steel rolling surface defect detection model, and the steel rolling surface defect detection result is output.
2. The method for detecting surface defects of rolled steel according to claim 1, characterized in that: The rolled steel surface defect image data includes image data of various types of rolled steel surface defects.
3. The method for detecting surface defects of rolled steel according to claim 1, characterized in that: The attention mechanism adopts the CBAM attention mechanism.
4. The method for detecting surface defects of rolled steel according to claim 1, characterized in that: The loss function of the steel rolling surface defect detection model is as follows: Where N is the length of the input sequence, is the predicted value of the model, and yi is the true value.
5. The method for detecting surface defects of rolled steel according to claim 1, characterized in that: The Adam optimizer is applied to the steel rolling surface defect detection model.
6. The method for detecting surface defects of rolled steel according to claim 1, characterized in that: The Bi-LSTM uses RNN and its improved LSTM to process data information and has a bidirectional structure. The basic architecture of LSTM consists of five parts: input x t 、output h t , Update gate i t 、Forget gate t , output gate o t ,in: Forget Gate t The expression of is as follows: f t =σ(W f *[h t-1 ,x t ]+b f ) Update Gate t The expression of is as follows: i t =σ(W i *[h t-1 ,x t ]+b i ) c' t =tanh(W c *[h t-1 ,x t ]+b c ) c t =f t *c t-1 +i t *c′ t Output gate o t The expression of is as follows: the t =σ(W o *[h t-1 ,x t ]+b o ) h t =o t *tanh(c t ) Among them, W f , W i , W c , W o represents the weight matrix; b f , b i , b c , b o represents the bias term; σ represents the sigmoid function, which maps the value to the interval [0, 1]; tanh(.) represents the hyperbolic tangent function, which is used to standardize the data range to [-1, 1]; c′ t Represents the candidate cell state, calculates the new information content at the current moment, and updates gate i t Combine to update the cell state.
7. An electronic device, characterized in that include: one or more processors; a memory configured to store one or more computer programs; a communication interface configured to enable the processor and the memory to communicate with an external device; When the computer program is executed by the one or more processors, the electronic device executes the method for detecting surface defects of rolled steel as described in any one of claims 1-6.
8. A computer-readable storage medium comprising a computer program, characterized in that When the computer program is run on an electronic device, the electronic device executes the method for detecting surface defects of rolled steel as described in any one of claims 1-6.