Magnetic material surface defect detection method, system and equipment combining RevCol and Yolo network
By combining RevCol and Yolo networks, the magnetic material surface defect detection model is optimized, and the C2f_SA module and Shuffle Attention mechanism is used to solve the balance problem between detection accuracy and model complexity, and efficient magnetic material surface defect detection is achieved.
Patent Information
- Application Number
- CN202410953332.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2044-07-16
AI Technical Summary
The existing magnetic material surface defect detection model fails to well balance the relationship between detection accuracy and model complexity, resulting in low detection accuracy and complex calculations, and is not optimized for the surface image characteristics of the magnetic material.
Combined with RevCol and Yolo networks, image feature extraction is extracted by introducing the C2f_SA module, model structure is optimized, unnecessary network layers are deleted, reg_max value is adjusted to balance detection accuracy and calculation overhead, RevCol is used as the backbone network, and feature extraction capabilities are enhanced using the Shuffle Attention mechanism.
While reducing the number of model parameters and complexity, the detection accuracy is improved, the model structure is simplified, and the detection effect is achieved, which is suitable for magnetic material surface defect detection.
Smart Images

Figure CN118967575B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of surface defect detection, and in particular to a method, system, and device for detecting surface defects of magnetic materials in combination with RevCol and Yolo networks. Background Art
[0002] Magnetic materials are widely used in various fields such as energy, home appliances, automobiles, and automatic control. Due to the limitations of production processes and product characteristics, various surface defects are prone to occur in the manufacturing process of magnetic materials. These defects will affect the performance and application of magnetic materials. Therefore, surface defect detection of magnetic materials is particularly important in the production process of magnetic materials.
[0003] The traditional method of detecting surface defects of magnetic materials relies on manual visual judgment, which is inefficient and easily affected by subjective factors. With the development of image processing and classification model technology, a solution for detecting surface defects of magnetic materials using a defect detection algorithm based on a classification model has been applied. For example, the Chinese patent application with application number 202211565001.1 previously proposed by the applicant discloses an improved YOLOv5 magnetic material surface defect detection method. By introducing the attention mechanism SElayer into the backbone feature extraction network and replacing the last two layers C3 and SPP with C3TR and SPPF, the generalization ability of the model is improved and the forward calculation time is reduced, so that small target defects such as particles can be better detected; secondly, C3Ghost is used to replace part of the C3 module in Neck, which can capture more feature maps to eliminate redundant features and reduce the number of parameters of the model; finally, the ordinary convolution is replaced with a depth-separable convolution and the original prediction branch in the Head for detecting large targets is removed, thereby speeding up the training and detection speed of the model.
[0004] The above detection method has the following defects in actual application:
[0005] The model failed to strike a good balance between the detection accuracy and complexity of the model, resulting in poor overall performance of the model. In particular, the model was not optimized for the characteristics of the magnetic material surface image, resulting in defects such as structural redundancy, low detection accuracy, and complex calculations. Summary of the Invention
[0006] To address the aforementioned problems with the prior art, the present disclosure aims to provide a method, system, and device for detecting surface defects in magnetic materials that combine the RevCol and Yolo networks. This disclosure employs a lightweight design for the detection model based on the characteristics of magnetic surface images, reducing the number of model parameters and complexity, simplifying the model structure, and introducing the C2f_SA module to enhance the model's ability to extract features. This effectively improves the model's overall detection accuracy and provides a good balance between the model's detection accuracy and computational overhead.
[0007] The present disclosure discloses a method for detecting surface defects of magnetic materials using a RevCol and Yolo network, comprising the following steps:
[0008] S01. Establish a magnetic material surface defect detection model that takes a magnetic material surface image as input and outputs the type and position of magnetic material surface defects. The magnetic material surface defect detection model includes a backbone network, a neck network, and a head network that are sequentially cascaded along the data input direction. The backbone network is a RevCol network, which includes several parallel sub-networks. The neck network includes an Up Sampling layer, a Down Sampling layer, and a feature fusion module that are connected. The head network includes at least one Detect layer. The C2f_SA module is used in both the backbone network and the neck network for image feature extraction. The C2f_SA module includes a first CBS unit, a Split unit, a BottleNeck unit, a Concat layer, a second CBS unit, and an SA unit that are sequentially cascaded.
[0009] S02. Collecting a surface image of the magnetic material to be tested, inputting the collected surface image into the magnetic material surface defect detection model, and obtaining detection results of the types and positions of the surface defects of the magnetic material to be tested.
[0010] Preferably, the neck network includes an 80*80 feature layer and a 40*40 feature layer, and the head network includes an 80*80Detect layer corresponding to the 80*80 feature layer, and a 40*40Detect layer corresponding to the 40*40 feature layer.
[0011] Preferably, in the backbone network, the number of subnetworks is 3.
[0012] Preferably, in the head network, the value of reg_max is 8.
[0013] Preferably, step S01 specifically includes:
[0014] S011. Obtaining sample images: Obtaining surface images of magnetic materials with different types of defects as sample images;
[0015] S012. Image classification: Classify the sample images according to the defect type of each sample image and mark the defect type and location to obtain a training data set;
[0016] S013. Model training: Use the obtained training data set to train the magnetic material surface defect detection model, and iteratively optimize the magnetic material surface defect detection model based on the prediction results until the maximum number of iterations is reached or the magnetic material surface defect detection model meets the prediction accuracy requirements.
[0017] Preferably, step S011 specifically includes: photographing and collecting surface images of magnetic materials with different types of defects as sample images, wherein the types of defects include chipped corners, poor electroplating, particles, watermarks, hidden cracks and strip-shaped protrusions.
[0018] Preferably, in step S012, data enhancement is performed on the acquired sample image to expand the data volume.
[0019] The present invention discloses a magnetic material surface defect detection system combining RevCol and Yolo networks, comprising:
[0020] A model building module is used to establish a magnetic material surface defect detection model that uses a magnetic material surface image as input and outputs the type of magnetic material surface defect. The magnetic material surface defect detection model includes a backbone network, a neck network, and a head network that are sequentially cascaded along the data input direction. The backbone network is a RevCol network, which includes several parallel sub-networks. The neck network includes a connected Up Sampling layer, a Down Sampling layer, and a feature fusion module. The head network includes at least one Detect layer. The backbone network and the neck network both use a C2f_SA module for image feature extraction. The C2f_SA module includes a first CBS unit, a Split unit, a BottleNeck unit, a Concat layer, a second CBS unit, and an SA unit that are sequentially cascaded.
[0021] The acquisition module is used to acquire the surface image of the magnetic material to be tested, input the acquired surface image into the magnetic material surface defect detection model, and obtain the detection results of the type and position of the surface defects of the magnetic material to be tested.
[0022] A computer device disclosed herein comprises a processor and a memory connected by signals, wherein the memory stores at least one instruction or at least one program, and when the at least one instruction or the at least one program is loaded by the processor, the method for detecting surface defects of magnetic materials as described above is executed.
[0023] The present invention discloses a computer-readable storage medium having stored thereon at least one instruction or at least one program, wherein the at least one instruction or the at least one program, when loaded by a processor, executes the magnetic material surface defect detection method as described above.
[0024] The advantages of the magnetic material surface defect detection method, system and device combining RevCol and Yolo networks described in this disclosure are:
[0025] 1. This paper combines the RevCol network with the Yolo network, taking advantage of the excellent performance of the RevCol network. By setting an appropriate number of sub-networks to achieve the lightweight requirements of the detection model, the model can ultimately reduce the number of parameters and complexity without causing significant accuracy loss, and improve the model's memory efficiency and robustness.
[0026] 2. Taking into account the small surface defect area of magnetic materials, this paper removes the 20*20 network structure in the neck network and the 20*20 detection head in the head network to prevent the excessively deep network structure from burdening the model's parameter volume and computational complexity, making the model easier to deploy and apply.
[0027] 3. This disclosure designs the C2f_SA module for image feature extraction, which can enhance the model's ability to extract features, thereby improving the model's overall detection accuracy;
[0028] 4. This disclosure optimizes the value of reg_max in the model to screen out the value that is most suitable for magnetic material surface defect detection, thereby simplifying the model structure and reducing the computational complexity, further balancing the detection accuracy and computational overhead of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 1 is a flowchart of a method for detecting surface defects of magnetic materials by combining RevCol and Yolo networks according to this embodiment;
[0030] Figure 2 is a structural diagram of the magnetic material surface defect detection model described in this embodiment;
[0031] Figure 3 is a structural diagram of the C2f_SA module described in this embodiment;
[0032] Figure 4 Schematic diagram of the structure of the computer device described in this embodiment.
[0033] Description of reference numerals: 101 - processor, 102 - memory DETAILED DESCRIPTION
[0034] like Figure 1As shown, the present disclosure discloses a method for detecting surface defects of magnetic materials by combining RevCol and Yolo networks, comprising the following steps:
[0035] S01. Establish a magnetic material surface defect detection model that takes a magnetic material surface image as input and outputs the type and position of magnetic material surface defects. The magnetic material surface defect detection model includes a backbone network, a neck network, and a head network that are sequentially cascaded along the data input direction. The backbone network is a RevCol network, which includes several parallel sub-networks. The neck network includes an Up Sampling layer, a Down Sampling layer, and a feature fusion module that are connected. The head network includes at least one Detect layer. The C2f_SA module is used in both the backbone network and the neck network for image feature extraction. The C2f_SA module includes a first CBS unit, a Split unit, a BottleNeck unit, a Concat layer, a second CBS unit, and an SA unit that are sequentially cascaded.
[0036] Specifically, in this embodiment, a magnetic material surface defect detection model is constructed based on the perspective of balancing detection accuracy and computing resources, as detailed in Figure 2 As shown in the figure, the model is based on the Yolov8s network and combined with the RevCol network as the backbone network of the model. The RevCol network improves the performance, efficiency and interpretability of traditional deep learning models by introducing the concepts of reversibility and feature decoupling. RevCol proposes to use "reversible columns" as units to transmit information, which not only ensures feature decoupling but also allows information to flow freely between different branches of the network without loss. Figure 2 As shown in the figure, the entire network structure includes multiple sub-networks (i.e., columns). Primarily, reversible connections are added between columns, and then by repeatedly connecting the input to the column, low-level texture details and semantic information are gradually separated. This approach ensures that the model maintains high accuracy during pre-training while also ensuring that low-level information is not lost. Ultimately, it can achieve better detection results in downstream tasks such as detection or segmentation. This design can improve the network's performance in computer vision tasks such as image classification, object detection, and semantic segmentation, especially when the number of parameters and datasets are large.
[0037] RevCol has the following key features and benefits: First, reversibility: The core of the RevCol architecture lies in the reversibility of its network structure, meaning that the network's forward propagation can be precisely reversed to its input state. This means that the feature representation of any intermediate layer can be reconstructed by retaining only the original input and final output, without storing the intermediate layer activations. This significantly reduces the memory consumption required for model training and inference, and is particularly beneficial for large models and high-resolution inputs. Second, feature decoupling: RevCol achieves decoupled feature learning by designing a network structure based on "reversible columns." Each column consists of a set of independent subnetworks that process different parts of the input data in parallel, with limited information exchange between them. This ensures independence between different feature dimensions, thereby enhancing the model's generalization and ability to represent complex inputs. Third, efficient transfer: In RevCol, information is transferred losslessly throughout the network, as reversibility ensures that all original input information is fully preserved in the final output. This contrasts with the information bottleneck or vanishing gradient problem that may exist in traditional deep networks, and helps improve the performance and robustness of the model.
[0038] Based on the characteristics and functions of the aforementioned RevCol, this embodiment applies the RevCol network to the Yolov8s network and uses RevCol as the backbone network of the model, so that the model has good performance and robustness.
[0039] The number of subnetworks (columns) is a key parameter of RevCol. The selection of the number of subnetworks affects the detection accuracy and computing resources of the model. Therefore, it is particularly necessary to consider these two factors and reasonably design the number of subnetworks. In this embodiment, the optimal number of subnetworks is explored as follows:
[0040] Three detection models with 2, 3, and 4 subnetworks were set respectively, and the indicators of the three detection models were compared. The comparison results are shown in Table 1 below:
[0041] Table 1 Comparison of the effect of the number of sub-networks
[0042]
[0043] As can be seen from the table above, when the number of sub-networks is 3, the model in this embodiment has a high mAP 0.5 , parameter quantity and other indicators perform well, which can better balance the contradictory relationship between the detection model's accuracy and computing resources.
[0044] Furthermore, since the input image (i.e., the magnetic material surface image) will generate three feature maps of different sizes after passing through RevCol as the backbone network, namely 80*80, 40*40, and 20*20, 80*80 is suitable for detecting small targets because it has the highest spatial resolution, while 20*20 is suitable for detecting large targets because it has the smallest spatial resolution. In combination with the fact that the detection object in this embodiment is magnetic material, specifically the surface defects of magnetic material, it is found in the actual detection process that the area of these defects is usually small, so this embodiment performs a lightweight design on the model, that is, the 20*20 feature layer in the neck network is deleted, and the corresponding 20*20Detect layer (detection head) in the head network is deleted. That is, the neck network only includes an 80*80 feature layer and a 40*40 feature layer, and the head network includes an 80*80Detect layer corresponding to the 80*80 feature layer, and a 40*40Detect layer corresponding to the 40*40 feature layer.
[0045] In order to further improve the model's ability to extract features, this embodiment combines C2f with the SA (Shuffle Attention) mechanism on the basis of the C2f extraction module and designs a new C2f_SA module for image feature extraction. Specifically, the C2f_SA module is used in both the backbone network and the neck network for image feature extraction. Figure 3 As shown, the C2f_SA module includes a first CBS unit, a Split unit, a BottleNeck unit, a Concat layer, a second CBS unit and a SA unit that are cascaded in sequence.
[0046] The Shuffle Attention mechanism (hereinafter referred to as SA) is a new type of attention mechanism that can efficiently combine the channel attention mechanism and the spatial attention mechanism. The main operations of this module include the following steps: First, the SA module groups the channel features and then obtains sub-features of multiple groups; then, each sub-feature uses the SA Unit to simultaneously use the spatial attention mechanism and the channel attention mechanism; finally, the SA Unit aggregates all sub-features through the Concat method, and then uses the Channel Shuffle operation to fuse the features of different groups. Through these operations, the SA module can achieve an efficient combination of channel and spatial attention mechanisms with low computational complexity, ultimately enabling the model to more effectively focus on the key information of the target, thereby improving the detection effect of the model.
[0047] In this embodiment, based on the excellent performance of the above-mentioned SA module, it is combined with the C2f module. Specifically, the SA module is embedded after the second CBS module in C2f to construct a new C2f_SA feature extraction module, so that the model can better focus on the feature information of the target.
[0048] Finally, since reg_max is an extremely important special parameter in the Yolov8s head network, reg_max refers to the multiple of the number of feature map channels of the frame, where the number of feature map channels for each frame is 4×reg_max. Therefore, the value of reg_max determines the number of channels of each frame, thereby affecting the representation ability and detection performance of the frame. On the other hand, a larger reg_max value will also significantly increase the computational complexity and storage overhead of the model. Therefore, in order to obtain a suitable minimum value of reg_max in the magnetic material surface defect data, this embodiment has conducted exploratory adjustments and optimizations on it. The purpose of such optimization is to balance the detection accuracy and computational overhead of the model, thereby ensuring that the model can achieve better detection results in a relatively lightweight case. The specific approach is as follows:
[0049] Six detection models are set with reg_max values equal to 4, 6, 8, 10, 12, and 16, and the indicators of the six detection models are compared. The comparison results are shown in Table 2:
[0050] Table 2 Comparison of effects of different reg_max values
[0051]
[0052] From Table 2 above, we can conclude that when the value of reg_max is 8, the model can achieve higher detection accuracy while ensuring a lighter weight.
[0053] After the above designs, we can get Figure 2 The magnetic material surface defect detection model shown.
[0054] S02. Collect the surface image of the magnetic material to be tested, input the collected surface image into the magnetic material surface defect detection model, and obtain the surface defect type detection result of the magnetic material to be tested. The specific working process of the magnetic material surface defect detection model is as follows: the input magnetic material image will generate three feature maps of different sizes after passing through the backbone network. The feature map sizes are 20*20, 40*40 and 80*80 respectively. Then these feature maps are input into the neck network for feature fusion, and finally the fused feature maps are sent to the head network for prediction, so as to accurately obtain the defect type and specific location on the magnetic material surface.
[0055] In order to verify the effectiveness of the magnetic material surface defect detection model of this embodiment, this embodiment also compares the model with other existing defect detection models, as follows:
[0056] Table 3 Comparison of the effects of different models
[0057]
[0058] It can be seen from Table 3 above that Yolov8s, which is closer to the model of this embodiment in terms of detection accuracy, is the baseline model. Compared with the baseline model of Yolov8s, the detection model of this embodiment has a slight decrease of 0.2% in terms of overall detection accuracy, but it has decreased by 51.64%, 30.31% and 50.22% in terms of parameter quantity, computational complexity and model size respectively. Therefore, the model of this embodiment obviously better balances the problems of detection accuracy and computing resources. In addition, compared with other improved models of the same level, this application can achieve a detection accuracy of 89.8% in a lighter weight case. This value is only slightly lower than the baseline model, but much higher than other comparison models. Therefore, the experimental results can more fully demonstrate the effectiveness and superiority of the model of this embodiment.
[0059] The following will combine the above content to fully explain the model building process of this embodiment:
[0060] Step 1: Image Acquisition
[0061] An experimental platform built using industrial cameras was used to capture and capture images of surface defects in industrial magnetic materials. These images served as the raw images for this defect detection task. Based on the actual captured images, six defect types were categorized: chipped corners, poor plating, particles, watermarks, hidden cracks, and strip-like protrusions. The captured raw images could contain either a single defect or multiple defects. A total of 793 raw images were collected.
[0062] Step 2: Create a dataset
[0063] 2-1. Labeling images
[0064] Use the Elf Annotation Assistant software to calibrate the defect type and location of the collected images, and finally export the XML file containing the annotation information in the format of the PascalVOC dataset.
[0065] 2-2. Create the corresponding folder to store the data set
[0066] Create a new file, which should contain three subfolders: xml, images, and dataSets. The xml folder stores the xml information file exported in step 2-1, and the images folder stores the 793 images collected in step 1. In the dataSets folder, you need to create another subfolder named Main to store the corresponding divided data set information later.
[0067] 2-3. Data Augmentation
[0068] Due to the limited number of images collected for the experiment, we chose to use data augmentation to expand the dataset to prevent overfitting and improve the robustness and generalization of the model. Specifically, we used brightness enhancement, color inversion, image rotation, and contrast enhancement to expand the dataset, ultimately reducing the dataset from 793 images to 2780.
[0069] 2-4. Data Division
[0070] The labeled images are divided into 2001 training sets, 223 validation sets, and 556 test sets according to a certain ratio. The detailed information after the division is saved in the Main subfolder of the dataSets folder in step 2-2, specifically as training set train.txt, validation set val.txt, training validation set trainval.txt, and test set test.txt.
[0071] Step 3: Construction of magnetic material surface defect detection model
[0072] The defect detection model mainly consists of three parts: backbone network, neck network and head network. The specific structure is as follows Figure 2 As shown in the figure. First, the RevCol network is used as the backbone network of the new model to extract defect features from magnetic material images. Then, the network structure connected to the 20×20 feature layer in the neck network and the head network is deleted. Then, all feature extraction modules in the RevCol network (i.e., the backbone network) and the neck network are replaced with the newly developed C2f_SA module. Finally, the value of the reg_max parameter of the model is optimized.
[0073] The overall workflow of the network is as follows: first, the input magnetic material image will generate three feature maps of different sizes after passing through the backbone network. The sizes of the feature maps are 20×20, 40×40 and 80×80 respectively. Then these feature maps are input into the neck network for feature fusion. Finally, the fused feature maps are sent to the head network for prediction, so as to accurately obtain the defect type and specific location on the magnetic material surface.
[0074] Step 4: Training the detection model
[0075] 4-1. Training environment configuration
[0076] The experimental environment configuration: R7 6800H CPU and RTX3070 GPU, 32G memory, the magnetic material surface defect detection model was developed on the Windows 11 system, the software version is Pycharm2023, the development environment is Python 3.10, CUDA 11.7, and the deep learning framework is PyTorch 1.13.1.
[0077] 4-2. Training related parameter settings
[0078] The model was trained using the AdamW optimizer, a learning rate of 0.001, and a momentum of 0.9. To prevent overfitting, weight decay was set to 0.0005. The total number of training epochs was 120, and the batch size was set to 32.
[0079] 4-3. Training phase
[0080] The model will be trained according to the previously set environment and parameters, and the learning rate and number of iterations will be dynamically adjusted according to the changes in the training function to update the parameters of the entire defect detection model and continuously update and save the weights of the best prediction model during the training process.
[0081] Step 5: Online testing
[0082] The best model weights saved after training are used to load the model and predict the results. After passing the online test, the model can be deployed in the actual magnetic material surface defect detection scenario.
[0083] This embodiment also provides a magnetic material surface defect detection system combining RevCol and Yolo networks, including:
[0084] A model building module is used to establish a magnetic material surface defect detection model that uses a magnetic material surface image as input and outputs the type and location of magnetic material surface defects. The magnetic material surface defect detection model includes a backbone network, a neck network, and a head network that are sequentially cascaded along the data input direction. The backbone network is a RevCol network, which includes several parallel sub-networks. The neck network includes a connected Up Sampling layer, a Down Sampling layer, and a feature fusion module. The head network includes at least one Detect layer. The backbone network and the neck network both use a C2f_SA module for image feature extraction. The C2f_SA module includes a first CBS unit, a Split unit, a BottleNeck unit, a Concat layer, a second CBS unit, and an SA unit that are sequentially cascaded.
[0085] The acquisition module is used to acquire the surface image of the magnetic material to be tested, input the acquired surface image into the magnetic material surface defect detection model, and obtain the detection results of the type and position of the surface defects of the magnetic material to be tested.
[0086] The system of this embodiment and the method embodiment described above belong to the same inventive concept, which can be understood with reference to the above description and will not be repeated here.
[0087] like Figure 4 As shown, this embodiment also provides a computer device, including a processor 101 and a memory 102 connected via bus signals. The memory 102 stores at least one instruction or at least one program segment, which, when loaded by the processor 101, executes the method described above. The memory 102 can be used to store software programs and modules. The processor 101 executes various functional applications by running the software programs and modules stored in the memory 102. The memory 102 may primarily include a program storage area and a data storage area. The program storage area may store an operating system, application programs required for functions, etc.; the data storage area may store data generated based on the use of the device, etc. In addition, the memory 102 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 102 may also include a memory controller to provide the processor 101 with access to the memory 102.
[0088] The method embodiments provided in the embodiments of the present disclosure can be executed in a computer terminal, server, or similar computing device. That is, the computer device may include a computer terminal, server, or similar computing device. The internal structure of the computer device may include, but is not limited to, a processor, a network interface, and a memory. The processor, network interface, and memory within the computer device may be connected via a bus or other means.
[0089] Among them, the processor 101 (or CPU (Central Processing Unit)) is the computing core and control core of the computer device. The network interface may optionally include a standard wired interface, a wireless interface (such as WI-FI, mobile communication interface, etc.). The memory 102 (Memory) is a memory device in the computer device, used to store programs and data. It is understandable that the memory 102 here can be a high-speed RAM storage device or a non-volatile memory device (non-volatile memory), such as at least one disk storage device; optionally, it can also be at least one storage device located away from the aforementioned processor 101. The memory 102 provides storage space, which stores the operating system of the electronic device, including but not limited to: Windows system (an operating system), Linux (an operating system), Android (Android, a mobile operating system) system, IOS (a mobile operating system) system, etc., which is not limited in this disclosure; and the storage space also stores one or more instructions suitable for being loaded and executed by the processor 101. These instructions can be one or more computer programs (including program code). In the embodiment of this specification, the processor 101 loads and executes one or more instructions stored in the memory 102 to implement the method described in the above method embodiment.
[0090] The present disclosure also provides a computer-readable storage medium having at least one instruction or at least one program stored thereon, which, when loaded by the processor 101, executes the method described above. The computer-readable storage medium carries one or more programs, and when executed, implements the method according to the present disclosure.
[0091] According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include, but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0092] Those skilled in the art can make various other corresponding changes and deformations based on the technical solutions and concepts described above, and all of these changes and deformations should fall within the scope of protection of the claims of this disclosure.
Claims
1. A magnetic material surface defect detection method combining RevCol and Yolo networks, characterized in that: The following steps are involved: S01. Establish a magnetic material surface defect detection model with a magnetic material surface image as input and the type and position of the magnetic material surface defects as output, wherein the magnetic material surface defect detection model includes a backbone network, a neck network, and a head network sequentially cascaded along the data input direction, wherein the backbone network is a RevCol network, comprising several parallel sub-networks, the neck network comprising an Up Sampling layer, a Down Sampling layer, and a feature fusion module connected to each other, the head network comprising at least one Detect layer, and the backbone network and the neck network both use a C2f_SA module for image feature extraction, wherein the C2f_SA module comprises a first CBS unit, a Split unit, a BottleNeck unit, a Concat layer, a second CBS unit, and an SA unit cascaded in sequence; S02, collecting a surface image of the magnetic material to be tested, inputting the collected surface image into the magnetic material surface defect detection model, and obtaining a detection result of the type and position of the surface defects of the magnetic material to be tested; The neck network includes an 80*80 feature layer and a 40*40 feature layer, and the head network includes an 80*80Detect layer corresponding to the 80*80 feature layer and a 40*40Detect layer corresponding to the 40*40 feature layer; In the backbone network, the number of subnetworks is 3; In the head network, the value of reg_max is 8.
2. The magnetic material surface defect detection method combining RevCol and Yolo network according to claim 1, characterized in that: Step S01 specifically includes: S011. Obtaining sample images: Obtaining surface images of magnetic materials with different types of defects as sample images; S012. Image classification: Classify the sample images according to the defect type of each sample image and mark the defect type and location to obtain a training data set; S013. Model training: Use the obtained training data set to train the magnetic material surface defect detection model, and iteratively optimize the magnetic material surface defect detection model based on the prediction results until the maximum number of iterations is reached or the magnetic material surface defect detection model meets the prediction accuracy requirements.
3. The magnetic material surface defect detection method combining RevCol and Yolo network according to claim 2, characterized in that: Step S011 specifically includes: photographing and collecting surface images of magnetic materials with different types of defects as sample images, wherein the types of defects include chipped corners, poor electroplating, particles, watermarks, hidden cracks, and strip-shaped protrusions.
4. The magnetic material surface defect detection method combining RevCol and Yolo network according to claim 2 or 3, characterized in that: In step S012, data enhancement is performed on the acquired sample image to expand the data volume.
5. A magnetic material surface defect detection system combining RevCol and Yolo networks, characterized in that: include: A model building module is used to establish a magnetic material surface defect detection model that uses a magnetic material surface image as input and outputs the type and location of magnetic material surface defects. The magnetic material surface defect detection model includes a backbone network, a neck network, and a head network that are sequentially cascaded along the data input direction. The backbone network is a RevCol network, which includes several parallel sub-networks. The neck network includes a connected Up Sampling layer, a Down Sampling layer, and a feature fusion module. The head network includes at least one Detect layer. The backbone network and the neck network both use a C2f_SA module for image feature extraction. The C2f_SA module includes a first CBS unit, a Split unit, a BottleNeck unit, a Concat layer, a second CBS unit, and an SA unit that are sequentially cascaded. An acquisition module is used to acquire a surface image of the magnetic material to be tested, input the acquired surface image into the magnetic material surface defect detection model, and obtain a detection result of the type and position of the surface defects of the magnetic material to be tested; The neck network includes an 80*80 feature layer and a 40*40 feature layer, and the head network includes an 80*80Detect layer corresponding to the 80*80 feature layer and a 40*40Detect layer corresponding to the 40*40 feature layer; In the backbone network, the number of subnetworks is 3; In the head network, the value of reg_max is 8.
6. A computer device comprising a processor and a memory connected in a signal connection, characterized in that: The memory stores at least one instruction or at least one program, and when the at least one instruction or the at least one program is loaded by the processor, the method for detecting surface defects of magnetic materials as described in any one of claims 1 to 4 is executed.
7. A computer-readable storage medium having stored thereon at least one instruction or at least one program, characterized in that: When the at least one instruction or the at least one program is loaded by the processor, the magnetic material surface defect detection method as described in any one of claims 1 to 4 is executed.
Citation Information
Patent Citations
Improved YOLOv5 magnetic material surface defect detection method
CN116188833A
Steel wire surface anomaly detection method, device and equipment and storage medium
CN117437200A
Transformer oil leakage detection method and system, electronic equipment and storage medium
CN117557493A
License plate detection and recognition system based on super-dimensional calculation
CN117854053A