Magnetic material surface defect detection method, system and equipment combining RevCol and Yolo networks
By combining RevCol and YOLO networks, a lightweight magnetic material surface defect detection model was designed, which solved the problem of imbalance between detection accuracy and complexity, and achieved efficient magnetic material surface defect detection.
Patent Information
- Application Number
- CN202410953332.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-07-16
AI Technical Summary
Existing magnetic material surface defect detection models fail to properly balance the relationship between detection accuracy and model complexity, resulting in low detection accuracy and computational complexity, and they are not optimized for the characteristics of magnetic material surface images.
By combining RevCol and YOLO networks, a lightweight magnetic material surface defect detection model is designed. The feature extraction capability is enhanced by introducing the C2f_SA module, and the number of sub-networks and reg_max value are optimized to simplify the model structure and reduce the number of parameters and computational complexity.
Without sacrificing detection accuracy, it significantly reduces the number of model parameters and computational complexity, improves the model's memory efficiency and robustness, and is suitable for detecting defects on magnetic material surfaces.
Smart Images

Figure CN118967575A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of surface defect detection, and in particular to a magnetic material surface defect detection method, system and device combining 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, replacing some C3 modules in Neck with C3Ghost 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 to speed up the training and detection speed of the model.
[0004] The above detection method has the following defects in practical 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] In order to solve the problems existing in the above-mentioned prior art, the purpose of the present disclosure is to provide a magnetic material surface defect detection method, system and equipment combining RevCol and Yolo networks. The present disclosure performs a lightweight design of the detection model according to the characteristics of the magnetic material surface image, reduces the number of parameters and complexity of the model, simplifies the model structure, and introduces the C2f_SA module to enhance the model's ability to extract features, which can effectively improve the overall detection accuracy of the model and can well balance the relationship between the detection accuracy and computational overhead of the model.
[0007] The present disclosure discloses a method for detecting surface defects of magnetic materials by combining RevCol and Yolo networks, comprising the following steps:
[0008] 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 defect as output. 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, including 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 to extract image features. 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 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 types of each sample image and mark the defect types and locations 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 according to 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 images of the surface of the magnetic material with different types of defects as sample images, wherein the types of defects include missing 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 network, comprising:
[0020] A model building module, which is used to establish a magnetic material surface defect detection model with a magnetic material surface image as input and a magnetic material surface defect type as output, wherein the magnetic material surface defect detection model includes a backbone network, a neck network and a head network that are sequentially cascaded along a data input direction, wherein the backbone network is a RevCol network, including a plurality of parallel sub-networks, wherein the neck network includes a connected Up Sampling layer, a Down Sampling layer and a feature fusion module, wherein the head network includes at least one Detect layer, wherein a C2f_SA module is used in both the backbone network and the neck network to extract image features, wherein 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 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 in the present invention includes 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 magnetic material surface defect detection method as described above is executed.
[0023] The present invention discloses a computer-readable storage medium, which stores at least one instruction or at least one program. When the at least one instruction or the at least one program is loaded by a processor, the method for detecting surface defects of magnetic materials as described above is executed.
[0024] The advantages of the magnetic material surface defect detection method, system and device combined with RevCol and Yolo network described in the present disclosure are:
[0025] 1. This paper combines the RevCol network with the Yolo network, and combines 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 of the model without causing significant accuracy loss, and improve the memory efficiency and robustness of the model;
[0026] 2. In view of the small defect area on the surface of magnetic materials, the present invention removes the 20*20 network structure in the neck network and the 20*20 detection head in the head network to prevent the overly deep network structure from burdening the model's parameter quantity and computational complexity, making the model easier to deploy and apply;
[0027] 3. The present disclosure designs a C2f_SA module to extract image features, which can enhance the model's ability to extract features, thereby improving the overall detection accuracy of the model;
[0028] 4. The present invention 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 calculation complexity, and further balancing the detection accuracy and calculation overhead of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 is a flowchart of the steps of a magnetic material surface defect detection method combining RevCol and Yolo network described in 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 It is a 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, a magnetic material surface defect detection method combining RevCol and Yolo network described in the present disclosure includes the following steps:
[0035] 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 defect as output. 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, including 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 to extract image features. 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 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 shown in detail. 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). Mainly, reversible connections are added between columns, and then the input is repeatedly connected to the column, and finally the low-level texture details and semantic information are gradually separated. In this way, the model can maintain high accuracy in pre-training while ensuring that low-level information is not lost. Ultimately, it can achieve better detection results in downstream tasks such as detection or segmentation. Such a design can improve the performance of the network in computer vision tasks such as image classification, object detection, and semantic segmentation, especially when the number of parameters is large and the data set is large.
[0037] RevCol has the following main features and functions: The first is reversibility: The core of the RevCol architecture lies in the reversibility of its network structure, that is, the forward propagation process of the network can be accurately reversed to the input state, which means that without storing the activation of the intermediate layer, only the original input and the final output can be retained to reconstruct the feature representation of any intermediate layer. This feature significantly reduces the memory consumption required for model training and reasoning, especially for large models and high-resolution input. The second is feature decoupling: RevCol achieves feature decoupling learning by designing a network structure with "reversible column" as the basic unit. Each column contains a set of independent sub-networks that process different parts of the input data in parallel, and the information interaction between them is limited. The purpose of this is to ensure that different feature dimensions are independent of each other, thereby enhancing the model's generalization ability and expression ability for complex inputs. The third is efficient transmission: In RevCol, the transmission of information in the network is lossless, because reversibility ensures that all original input information can be fully retained to 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 the main parameter of RevCol. The selection of the number of subnetworks will affect 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 sub-networks 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 above table, 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 accuracy and computing resources of the detection model.
[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, which are 80*80, 40*40 and 20*20 respectively, 80*80 is suitable for detecting small targets because it has the highest spatial resolution, and 20*20 is suitable for detecting large targets because it has the smallest spatial resolution. In combination with the detection object in this embodiment being magnetic materials, specifically surface defects of magnetic materials, 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, as shown in detail. 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 which 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 use the spatial attention mechanism and the channel attention mechanism at the same time; finally, the SA Unit collects all sub-features by Concat, and then uses the Channel Shuffle operation to fuse the information of features of different groups. Through the above operations, the SA module can achieve an efficient combination of channel and spatial attention mechanisms with low computational complexity, and ultimately enable 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 channels of the feature map of the frame, where for each frame, its number of channels of the feature map is 4×reg_max, so 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 surface defect data of magnetic materials, this embodiment has made exploratory adjustments and optimizations to it. The purpose of such optimization is to balance the detection accuracy and computational overhead of the model, so as to ensure that the model can achieve better detection results in a relatively lightweight case. The specific approach is as follows:
[0049] Six detection models with reg_max values of 4, 6, 8, 10, 12, and 16 are set respectively, 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] It can be concluded from Table 2 above that when the value of reg_max is 8, the model can achieve higher detection accuracy while ensuring lighter weight.
[0053] After the above designs, we can get Figure 2 The magnetic material surface defect detection model is 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 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.
[0055] In order to verify the effectiveness of the magnetic material surface defect detection model of this embodiment, this embodiment also compares the effect of this 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, although the detection model of this embodiment has a slight decrease of 0.2% in overall detection accuracy, 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, which 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] The experimental platform built with industrial cameras is used to capture and collect images of surface defects of industrial magnetic materials, which are used as the original images for this defect detection work; according to the actual collection situation, it can be divided into six types of defects, namely, missing corners, poor electroplating, particles, watermarks, hidden cracks, and strip-shaped protrusions. The collected original images can be images containing a single defect or images containing multiple defects. Finally, a total of 793 original images were collected.
[0062] Step 2: Create a dataset
[0063] 2-1. Annotating 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, namely xml folder, images folder and dataSets folder. The xml folder stores the xml information file exported in step 2-1, the images folder stores the 793 images collected in step 1, and the dataSets folder also needs to create a sub-file named Main to store the corresponding divided data set information later.
[0067] 2-3. Data enhancement
[0068] Due to the limited number of images collected in the experiment, in order to prevent overfitting in the experiment and improve the robustness and generalization ability of the model, we chose to use data augmentation to expand the data set. Specifically, brightness enhancement, color inversion, image rotation, contrast enhancement and other methods were used for augmentation processing. In the end, the data set was reduced from 793 images to 2780 images.
[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 division is saved in the Main subfolder of the dataSets folder in step 2-2, specifically 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 the defects of the magnetic material image. 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: 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 surface of the magnetic material.
[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 was Pycharm2023, the development environment was Python 3.10, CUDA 11.7, and the deep learning framework was PyTorch 1.13.1.
[0077] 4-2. Training related parameter settings
[0078] The optimizer for model training is AdamW, the learning rate is 0.001, and the momentum is 0.9. To prevent overfitting, the weight decay is set to 0.0005. The total number of training times is 120, and the batch size is set to 32.
[0079] 4-3. Training phase
[0080] The model will be trained according to the environment and parameters set previously, 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 the online test is passed, 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, which is used to 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 that are sequentially cascaded along the data input direction, wherein the backbone network is a RevCol network, including several parallel sub-networks, wherein the neck network includes a connected Up Sampling layer, a Down Sampling layer and a feature fusion module, wherein the head network includes at least one Detect layer, wherein the backbone network and the neck network both use a C2f_SA module for image feature extraction, wherein 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 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 by bus signals, wherein the memory 102 stores at least one instruction or at least one program, and the at least one instruction or at least one program is executed when loaded by the processor 101. The memory 102 can be used to store software programs and modules, and the processor 101 executes various functional applications by running the software programs and modules stored in the memory 102. The memory 102 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, application programs required for functions, etc.; the data storage area can store data created according to the use of the device, etc. In addition, the memory 102 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 102 can 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 may be executed in a computer terminal, a server or a similar computing device, that is, the above-mentioned computer device may include a computer terminal, a server or a 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. Among them, the processor, network interface and memory in 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, a mobile communication interface, etc.). The memory 102 (Memory) is a memory device in the computer device for storing programs and data. It can be understood that the memory 102 here can be a high-speed RAM storage device, or a non-volatile storage 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 a storage space, which stores the operating system of the electronic device, which may include but is 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., and the present disclosure does not limit this; and, in the storage space, one or more instructions suitable for being loaded and executed by the processor 101 are also stored, and these instructions can be one or more computer programs (including program codes). 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 embodiment of the present disclosure also provides a computer-readable storage medium, on which at least one instruction or at least one program is stored, and the at least one instruction or at least one program is executed when loaded by the processor 101. The computer-readable storage medium carries one or more programs, and when the one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0091] According to an embodiment of the present disclosure, the 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 may be used by or in combination with an instruction execution system, apparatus, or device.
[0092] For those skilled in the art, various other corresponding changes and deformations can be made according to the technical solutions and concepts described above, and all of these changes and deformations should fall within the protection scope of the claims of the present disclosure.
Claims
1. A magnetic material surface defect detection method combining RevCol and Yolo network, 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 defect as output, wherein the magnetic material surface defect detection model comprises a backbone network, a neck network and a head network which are sequentially cascaded along the data input direction, wherein the backbone network is a RevCol network, comprising a plurality of parallel sub-networks, wherein the neck network comprises an Up Sampling layer, a Down Sampling layer and a feature fusion module which are connected to each other, wherein the head network comprises at least one Detect layer, wherein the C2f_SA module is used in both the backbone network and the neck network to extract image features, wherein the C2f_SA module comprises a first CBS unit, a Split unit, a BottleNeck unit, a Concat layer, a second CBS unit and a SA unit which are sequentially cascaded; 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.
2. The magnetic material surface defect detection method combining RevCol and Yolo network according to claim 1, characterized in that: 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.
3. The magnetic material surface defect detection method combining RevCol and Yolo network according to claim 1, characterized in that: In the backbone network, the number of subnetworks is 3.
4. The magnetic material surface defect detection method combining RevCol and Yolo network according to claim 1, characterized in that: In the head network, the value of reg_max is 8.
5. 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 types of each sample image and mark the defect types and locations 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 according to the prediction results until the maximum number of iterations is reached or the magnetic material surface defect detection model meets the prediction accuracy requirements.
6. The magnetic material surface defect detection method combining RevCol and Yolo network according to claim 5, characterized in that: Step S011 specifically includes: photographing and collecting images of the surface of magnetic materials with different types of defects as sample images, wherein the types of defects include missing corners, poor electroplating, particles, watermarks, hidden cracks and strip-shaped protrusions.
7. The magnetic material surface defect detection method combining RevCol and Yolo network according to claim 5 or 6, characterized in that: In step S012, data enhancement is performed on the acquired sample image to expand the data volume.
8. A magnetic material surface defect detection system combining RevCol and Yolo network, characterized in that: include: A model building module, which is used to 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 that are sequentially cascaded along a data input direction, wherein the backbone network is a RevCol network, including a plurality of parallel sub-networks, wherein the neck network includes a connected Up Sampling layer, a Down Sampling layer and a feature fusion module, wherein the head network includes at least one Detect layer, wherein a C2f_SA module is used in both the backbone network and the neck network to extract image features, wherein 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 sequentially cascaded; 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.
9. 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 7 is executed.
10. A computer-readable storage medium having at least one instruction or at least one program stored thereon, 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-7 is executed.
Citation Information
Patent Citations
Power equipment surface defect detection method and device, equipment and storage medium
CN117173145A
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
Light-weight lithium battery surface defect detection method for enhancing image feature fusion
CN117934375A
Cited By
Unmanned aerial vehicle-oriented small target detection system and method based on YOLOv8s improved model, medium and equipment
CN119888542A
Defect inspection system, defect inspection method, computer
TWI934739B
