A method and device for detecting surface defects of magnetic block devices based on improved SimOTA
By improving SimOTA's surface defect detection method of magnetic block device, using the target feature analysis model and improved anchor box allocation strategy, the problems of slow detection speed and low accuracy in the prior art are solved, and more efficient surface defects of magnetic block device are achieved Test.
Patent Information
- Application Number
- CN202210586259.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-27
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2042-05-27
AI Technical Summary
The existing surface defect detection methods of magnetic block devices have problems such as slow detection speed and low detection accuracy. Especially the CNN-bound Regional Recommended Network (RPN) model with multi-layer features is not strong in real time and efficiency, and the YOLOv4 network model is improved. It is necessary to artificially analyze defect characteristics and adjust the anchor frame prior values, which are not efficient and not very general.
Using the surface defect detection method of magnetic block device based on improved SimOTA, the target feature analysis model is obtained, including image segmentation module and feature extraction module, and the surface pictures of magnetic block device are segmented and extracted, combined with the improved SimOTA anchor box allocation strategy, to make the feature pictures The surface defects of the magnetic block device are allocated to the anchor frame, and the area proportion of the anchor frame is adaptively adjusted to improve detection accuracy.
It improves the accuracy and speed of surface defect detection of magnetic block devices, reduces the leakage detection rate of micro defects, and enhances the real-time and efficiency of detection.
Smart Images

Figure CN114862822B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of magnetic block device surface defect detection, and in particular to a magnetic block device surface defect detection method and device based on improved SimOTA. Background Art
[0002] Magnetic devices are widely used in industry. Various defects on the surface of the device may cause it to be unable to be put into use normally, such as affecting component installation, reducing equipment accuracy, and interfering with the normal operation of the system, thereby reducing economic benefits or causing safety problems. Therefore, in order to ensure the quality of magnetic devices, the research on defect detection on the surface of magnetic blocks is of great practical significance.
[0003] In the prior art, methods for detecting surface defects of magnetic block devices include a method of combining a CNN with a region proposal network (RPN) model that integrates multi-layer features and a method for detecting surface defects of magnetic block devices using an improved YOLOv4 network model.
[0004] The method of combining CNN with a region proposal network (RPN) model that integrates multi-layer features has achieved a high defect detection rate on the NEU-DET dataset it constructed, but its real-time performance is not strong, and its detection speed is slow and its detection efficiency is low; the surface defect detection method of magnetic block devices based on the improved YOLOv4 network model has a high accuracy while ensuring the reasoning speed, but it requires manual analysis of defect features and adjustment of the prior value of the anchor box generated by the network, which is inefficient and not very versatile. Summary of the invention
[0005] In view of this, it is necessary to provide a magnetic block device surface defect detection method and device based on improved SimOTA to solve the problems of slow speed and low detection accuracy of magnetic block device surface defect detection in the prior art.
[0006] In order to achieve the above technical objectives, the present invention adopts the following technical solutions:
[0007] In a first aspect, the present invention provides a method for detecting surface defects of a magnetic block device based on an improved SimOTA, comprising:
[0008] Acquire a target feature analysis model, the target feature analysis model includes an image segmentation module and a feature extraction module;
[0009] Obtaining a surface image of the magnetic device to be tested;
[0010] The surface image of the magnetic block device to be detected is divided into a plurality of image segments according to the image segmentation module, and a feature image is extracted from the image segments based on the feature extraction module;
[0011] Anchor frames are assigned to surface defects of magnetic devices in feature images through the improved SimOTA anchor frame assignment strategy.
[0012] Preferably, it also includes:
[0013] A sample set of images of the surface of the magnetic block device is obtained, and the initial parameters of the target feature analysis model are trained based on the parameter determination model to obtain the target parameters.
[0014] Preferably, the surface image of the magnetic block device to be detected is divided into several image segments according to the image segmentation module, including:
[0015] Setting the surface image of the magnetic block device to be tested to a preset pixel size;
[0016] The surface image of the magnetic block device to be inspected with a preset pixel size is input into the image segmentation module to obtain multiple image segments with pixel sizes.
[0017] Preferably, based on the feature extraction module, extracting a feature picture from the image fragment includes:
[0018] According to the target parameters, multiple pixel-sized image segments are input into the feature extraction module to obtain feature images of the surface images of several magnetic block devices to be detected with different sizes.
[0019] Preferably, the feature extraction module further includes an attention module and a recognition module;
[0020] The attention module is used to highlight the image features of the defective area in the image segment; the recognition module is used to recognize and extract the image features.
[0021] Preferably, an anchor frame is assigned to the surface defect of the magnetic block device in the feature image through an improved SimOTA anchor frame assignment strategy, including:
[0022] Perform forward propagation calculation on the feature image to generate candidate anchor boxes;
[0023] Calculate the IOU loss of all candidate anchor boxes;
[0024] Sum the IOU losses of the candidate anchor boxes and assign the initial anchor box based on the sum of the IOU losses;
[0025] According to the actual defect frame on the surface of the magnetic block device, the initial defect anchor frame is adjusted to obtain the target defect anchor frame.
[0026] Preferably, adjusting the initial defect anchor frame according to the actual defect frame on the surface of the magnetic block device to obtain the target defect anchor frame includes:
[0027] Calculate the aspect ratio and area ratio of the actual defect frame on the surface of the magnetic block device;
[0028] According to the aspect ratio and area ratio, adjust the range of the initial defect anchor frame, and calculate the intersection and union ratio of the adjusted initial defect anchor frame and the actual defect frame;
[0029] According to the intersection-over-union ratio, the target defect anchor box is assigned to the actual defect box.
[0030] In a second aspect, the present invention further provides a magnetic block device surface defect detection device based on improved SimOTA, comprising:
[0031] An analysis model building module is used to obtain a target feature analysis model, wherein the target feature analysis model includes an image segmentation module and a feature extraction module;
[0032] An image acquisition module is used to acquire a surface image of a magnetic block device to be detected;
[0033] A feature extraction module is used to segment the surface image of the magnetic block device to be detected into a plurality of image segments according to the image segmentation module, and extract a feature image from the image segments based on the feature extraction module;
[0034] The anchor frame assignment module is used to assign anchor frames to surface defects of magnetic block devices in feature images through an improved SimOTA anchor frame assignment strategy.
[0035] In a third aspect, the present invention further provides an electronic device, including a memory and a processor, wherein:
[0036] Memory, used to store programs;
[0037] The processor is coupled to the memory and is used to execute the program stored in the memory to implement the steps in the surface defect detection method of the magnetic block device based on the improved SimOTA in any of the above implementations.
[0038] In a fourth aspect, the present invention further provides a computer-readable storage medium for storing computer-readable programs or instructions. When the program or instructions are executed by a processor, the steps of the surface defect detection method of a magnetic block device based on the improved SimOTA in any of the above-mentioned implementation methods can be implemented.
[0039] The beneficial effect of adopting the above-mentioned embodiment is as follows: the present invention provides a method and device for detecting surface defects of magnetic block devices based on improved SimOTA, establishes a target feature analysis model, and divides the surface image of the magnetic block device into several images of different pixel sizes through the image segmentation module in the target feature analysis model, which is beneficial to improving the detection accuracy, and then uses the feature extraction module in the target feature analysis model to extract features from several images of different pixel sizes, thereby improving the accuracy and speed of surface defect detection of magnetic block devices, and by improving the original anchor frame allocation strategy, an anchor frame is allocated to the surface defect of the magnetic block device, and the size of the central neighborhood of the candidate anchor frame is adaptively adjusted according to the area ratio of the candidate anchor frame, and more positive samples are allocated to the real frame corresponding to the tiny defect, thereby reducing the missed detection rate of the tiny defect, thereby further improving the accuracy of surface defect detection of magnetic block devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A schematic flow chart of an embodiment of a magnetic block device surface defect detection method based on improved SimOTA provided by the present invention;
[0041] Figure 2 A schematic diagram of a process of adjusting an initial defect anchor frame according to an embodiment of the present invention;
[0042] Figure 3 A structural schematic diagram of an embodiment of adjusting the initial defect anchor frame provided by the present invention;
[0043] Figure 4 A schematic structural diagram of an embodiment of a magnetic block device surface defect detection device provided by the present invention;
[0044] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0045] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.
[0046] In the description of the present application, “plurality” means two or more than two, unless otherwise clearly and specifically defined.
[0047] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0048] The present invention provides a method and device for detecting surface defects of a magnetic block device based on improved SimOTA, which are described below respectively.
[0049] See also Figure 1 , Figure 1 A flow chart of an embodiment of a method for detecting surface defects of a magnetic block device based on an improved SimOTA provided by the present invention is provided. A specific embodiment of the present invention discloses a method for detecting surface defects of a magnetic block device based on an improved SimOTA, comprising:
[0050] S101, obtaining a target feature analysis model, where the target feature analysis model includes an image segmentation module and a feature extraction module;
[0051] S102, obtaining a surface image of a magnetic block device to be detected;
[0052] S103, dividing the surface image of the magnetic block device to be detected into a plurality of image segments according to the image segmentation module, and extracting feature images from the image segments based on the feature extraction module;
[0053] S104. Assign anchor frames to surface defects of magnetic block devices in the feature image through an improved SimOTA anchor frame assignment strategy.
[0054] In a specific embodiment of the present invention, step S101 obtains a target feature analysis model, which is a trained feature analysis model that can directly detect surface defects of magnetic block devices to achieve the accuracy requirements of detection. It is understandable that the target feature analysis model also needs to undergo a certain training process, that is, obtain a data set of images of the surface of the magnetic block device, and train the initial feature analysis model according to the data set to finally obtain the target feature analysis model.
[0055] The image segmentation module includes a basic convolution block and a CSP convolution block. The basic convolution block consists of a two-dimensional convolution layer, a batch normalization layer, and a SiLU activation function. The CSP convolution block contains a residual block. The image segmentation module also has a pyramid pooling structure (SPP) and a Focus structure. The SPP structure can effectively utilize the significant context features separated by different maximum pooling layers to expand the receptive field. The Focus structure can speed up feature extraction by replacing some convolution layers close to the input image in the feature extraction network. The feature extraction module adds a bottom-up path to fuse multi-scale features based on the feature pyramid network (FPN), which can improve the accuracy of feature extraction.
[0056] It should be noted that the number of images of the surface of magnetic devices is limited, and the style is relatively simple with many similarities. If the images of the surface of magnetic devices are directly used as sample sets for model training, the detection accuracy of the trained model may be low due to insufficient number, and the simple style of the images will cause the model to be sensitive only to images of a certain style, while the detection accuracy of images of other styles will be insufficient.
[0057] In the above embodiment, the specific embodiment of the present invention pre-processes the surface image of the magnetic block device, including rotation, translation, cropping, brightness change, noise addition and random scaling data enhancement to expand the training set and the verification set to form the final magnetic block device surface image sample set. It should be noted that the pre-processing method may also include other forms, and the present invention will not go into details here.
[0058] In a specific embodiment of the present invention, step S102 directly obtains a surface image of a magnetic block device to be inspected, and according to a target feature analysis model, features in the surface image of the magnetic block device to be inspected can be extracted, thereby analyzing defects in the surface image of the magnetic block device.
[0059] In a specific embodiment of the present invention, the surface image of the magnetic block device in step S103 must contain many elements, and it is impossible to contain only the magnetic block device, and some image information other than the magnetic block device is useless. The surface image of the magnetic block device is first segmented by an image segmentation module to obtain multiple segmented image fragments of the surface image of the magnetic block device, and then the key information in the surface image of the magnetic block device is extracted from the multiple segmented image fragments according to the feature extraction module, which reduces the burden of defect detection and is conducive to improving detection efficiency and detection accuracy.
[0060] In a specific embodiment of the present invention, after step S104 extracts the feature image of the magnetic block device surface image, it is also necessary to mark the defects therein, that is, to assign anchor frames to the surface defects of the magnetic block device in the feature image, so as to facilitate the observation of the surface defects of the magnetic block device. The assignment of anchor frames to the surface defects is also to prevent errors in detection.
[0061] Compared with the prior art, the present embodiment provides a magnetic block device surface defect detection method based on improved SimOTA, establishes a target feature analysis model, and divides the surface image of the magnetic block device into several images of different pixel sizes through the image segmentation module in the target feature analysis model, which is beneficial to improving the detection accuracy, and then uses the feature extraction module in the target feature analysis model to extract features from several images of different pixel sizes, thereby improving the accuracy and speed of magnetic block device surface defect detection, and through the anchor frame allocation strategy, allocates anchor frames to the surface defects of the magnetic block device, thereby further improving the accuracy of magnetic block device surface defect detection.
[0062] In an embodiment of the present invention, it also includes:
[0063] A sample set of images of the surface of the magnetic block device is obtained, and the initial parameters of the target feature analysis model are trained based on the parameter determination model to obtain the target parameters.
[0064] In the above embodiment, the parameter determination model is trained for 30 epochs to obtain the parameters of the classification module. Some images are selected from the sample set of magnetic block device surface images and input into the parameter determination model. The images are passed through the parameter determination model to determine the optimal parameters required for maximum recognition accuracy, that is, the target parameters. The input image is resized to 224×224 by filling gray pixels, and the network parameters are evaluated using BCE loss, and the learning rate is 10 -2 , momentum factor is 0.9 and weight decay factor is 4×10 -4 The stochastic gradient descent (SGD) optimizer was used with a batch-size of 16 and the parameters were frozen after training to determine the model parameters.
[0065] The present invention selects some pictures from the defect detection data set to form a defect classification data set, trains a parameter determination model, and the parameter determination model uses the lightweight network EfficientNet-B1 with good classification effect in general application scenarios.
[0066] After training the parameter determination model, the feature analysis model needs to be trained. The initial feature analysis model is trained through 90 epochs. The pixel size of the input image is adjusted to 640×640 in the same way. The parameters of the image segmentation module are frozen in the first 25 epochs, and the feature map obtained by the parameter determination module is fused to train the parameters of the feature extraction module. The batch-size is set to 16 and the learning rate is 10. -3 , the learning rate adjustment strategy is lowered to the original 0.95 every 5 epochs. After 65 epochs, the parameters of the image segmentation module are unfrozen and the parameters of the joint feature extraction module are trained together. The batch-size is set to 8 and the learning rate is 10 -4 , and the learning rate adjustment strategy is still adjusted down to the original 0.95 every 5 epochs. After the training is completed, the target feature analysis model is finally obtained.
[0067] In an embodiment of the present invention, the surface image of the magnetic block device to be detected is divided into several image segments according to the image segmentation module, including:
[0068] Setting the surface image of the magnetic block device to be tested to a preset pixel size;
[0069] The surface image of the magnetic block device to be inspected with a preset pixel size is input into the image segmentation module to obtain multiple image segments with pixel sizes.
[0070] In the above embodiment, the preset pixel size is 640×640, and the image segmentation module has a multi-layer structure. According to actual needs, the input surface image of the magnetic block device to be inspected can be segmented into image segments of different pixel sizes. The pixel sizes of the image segments are different, and the accuracy and efficiency of feature extraction will also be different. Separating the surface image of the magnetic block device to be inspected is conducive to improving the detection efficiency and accuracy of defects.
[0071] In an embodiment of the present invention, extracting a feature picture from an image segment based on a feature extraction module includes:
[0072] According to the target parameters, multiple pixel-sized image segments are input into the feature extraction module to obtain feature images of the surface images of several magnetic block devices to be detected with different sizes.
[0073] In the above embodiment, as a preferred embodiment, the image segmentation module divides the input surface image of the magnetic block device to be detected into three image segments of pixel size. In the present invention, the surface image of the magnetic block device to be detected is divided into 1 / 4, 1 / 8 and 1 / 16 of the original image. Avoiding the recognition of the entire surface image of the magnetic block device to be detected can improve the detection speed.
[0074] The feature extraction module processes the surface image fragments of the magnetic block device to be detected with different pixel sizes in different ways. Feature extraction is performed on the surface image fragments of the magnetic block device to be detected with different pixel sizes, thereby improving the detection accuracy of the model.
[0075] In an embodiment of the present invention, the feature extraction module further includes an attention module and a recognition module;
[0076] The attention module is used to highlight the image features of the defective area in the image segment; the recognition module is used to recognize and extract the image features.
[0077] In the above embodiment, the attention module has an attention mechanism, specifically:
[0078] A c (F)=σ(MLP(AvgPool(F))+MLP(MaxPool(F)));
[0079] A s (F)=σ(Conv(AvgPool(F);MaxPool(F)));
[0080] Among them, MLP() represents a multi-layer perceptron with shared weights, Conv() represents a 1*1 convolutional layer, AvgPool() represents average pooling, and MaxPool() represents maximum pooling, which is used to adjust the number of channels of the feature map. c and A s Represent the weights of channel attention and spatial attention respectively.
[0081] The attention module improves the network's sensitivity to the features of tiny defect areas in the image by introducing a spatial attention mechanism, and introduces a channel attention mechanism to suppress image features irrelevant to the defects and enhance the image features of the defective areas, thus obtaining fused deep features with strong semantic information.
[0082] In an embodiment of the present invention, an anchor frame is allocated to a surface defect of a magnetic block device in a feature image by using an improved SimOTA anchor frame allocation strategy, including:
[0083] Perform forward propagation calculation on the feature image to generate candidate anchor boxes;
[0084] Calculate the IOU loss of all candidate anchor boxes;
[0085] Sum the IOU losses of the candidate anchor boxes and assign the initial anchor box based on the sum of the IOU losses;
[0086] According to the actual defect frame on the surface of the magnetic block device, the initial defect anchor frame is adjusted to obtain the target defect anchor frame.
[0087] The traditional SimOTA anchor frame allocation strategy only allocates initial defect anchor frames according to feature points after determining the feature points. However, for most actual defects, the initial defect anchor frames cannot accurately describe the actual defects. In response to this problem, the present invention modifies the traditional SimOTA anchor frame allocation strategy and adds an adaptive adjustment function to the traditional allocation strategy, that is, according to the actual defect frame on the surface of the magnetic block device, the aspect ratio and area ratio of all anchor frames are calculated, the initial defect anchor frame is adjusted, and the IOU values of all candidate anchor frames are weighted. The minimum number of anchor frames is allocated according to the weighted IOU values of the candidate anchor frames, and the confidence loss of the unallocated candidate anchor frames is calculated as negative samples to obtain the final target defect anchor frame. By weighted calculation of the IOU values of the candidate frames, the screening difficulty is reduced, the convergence of the network can be accelerated, and the speed of defect detection is improved.
[0088] In the above embodiment, the feature point is a fragment of the image of the surface of the magnetic block device with defects after model recognition. The preset anchor frame allocation strategy determines the actual defect frame of the surface of the magnetic block device by setting feature points for the defect. It should be noted that the actual defect frame is not a complete and regular actual defect frame, and can only contain part of the actual defect.
[0089] According to the feature points, the preset anchor frame allocation strategy will generate an initial defect anchor frame, which is centered on the feature points and includes most of the surface defects of the magnetic block device, but still cannot include the complete surface defects of the magnetic block device.
[0090] According to the actual defect frame on the surface of the magnetic block device, the initial defect anchor frame is adjusted so that the adjusted defect anchor frame can completely contain the entire surface defect of the magnetic block device, that is, the target defect anchor frame.
[0091] See also Figure 2 , Figure 2 For a flow chart of an embodiment of adjusting the initial defect anchor frame provided by the present invention, please refer to Figure 3 , Figure 3 A schematic diagram of a structure of an embodiment of adjusting the initial defect anchor frame provided by the present invention. In the embodiment of the present invention, the initial defect anchor frame is adjusted according to the actual defect frame on the surface of the magnetic block device to obtain the target defect anchor frame, including:
[0092] S201, calculating the aspect ratio and area proportion of the actual defect frame on the surface of the magnetic block device;
[0093] S202, adjusting the range of the initial defect anchor frame according to the aspect ratio and the area ratio, and calculating the intersection-over-intersection ratio of the adjusted initial defect anchor frame and the actual defect frame;
[0094] S203: assign a target defect anchor frame to the actual defect frame according to the intersection-over-union ratio.
[0095] In a specific embodiment of the present invention, step S201 calculates the aspect ratio and area ratio of the actual defect frame on the surface of the magnetic block device. The aspect ratio and area ratio of the actual defect frame on the surface of the magnetic block device reflect the specific conditions such as the position and range of the actual defect in the entire image, which is conducive to determining the marking anchor frame.
[0096] In a specific embodiment of the present invention, step S202 calculates the intersection-over-union (IOU) of the adjusted candidate defect anchor frame and the actual defect frame. The intersection-over-union (IOU) can be used to indicate the overlap ratio of different images. That is to say, the greater the overlap, the better, indicating that the anchor frame can better reflect the identified defect situation.
[0097] In a specific embodiment of the present invention, step S203 adjusts the initial defect anchor frame with reference to the intersection-over-union ratio, and allocates a target defect anchor frame that can completely include the surface defects of the magnetic block device to the feature image.
[0098] It should be noted that Figure 3 The gt box is the actual defect box, the original neighborhood is the initial defect anchor box, and the corrected neighborhood is the target defect anchor box.
[0099] The present invention uses the accuracy rate P and the speed V of detecting pictures per unit time to make further detection judgments on the detection results, specifically:
[0100]
[0101] Among them, G represents the number of correctly detected pictures, N represents the total number of tested pictures, and T represents the total detection time. To meet the needs of actual application scenarios, "correct detection" means that defects in the picture should not be missed, and defects should not be detected in non-defective areas.
[0102] In order to better implement the magnetic block device surface defect detection method based on the improved SimOTA in the embodiment of the present invention, on the basis of the magnetic block device surface defect detection method based on the improved SimOTA, correspondingly, please refer to Figure 4 , Figure 4 This is a schematic structural diagram of an embodiment of a magnetic block device surface defect detection device provided by the present invention. The embodiment of the present invention provides a magnetic block device surface defect detection device 400, comprising:
[0103] An analysis model building module 401 is used to obtain a target feature analysis model, which includes an image segmentation module and a feature extraction module;
[0104] The image acquisition module 402 is used to acquire the surface image of the magnetic block device to be detected;
[0105] The feature extraction module 403 is used to segment the surface image of the magnetic block device to be detected into a plurality of image segments according to the image segmentation module, and extract feature images from the image segments based on the feature extraction module;
[0106] The anchor frame allocation module 404 is used to allocate anchor frames to the surface defects of the magnetic block device in the feature image through the improved SimOTA anchor frame allocation strategy.
[0107] It should be noted here that: the device 400 provided in the above embodiment can implement the technical solutions described in the above method embodiments. The specific implementation principles of the above modules or units can refer to the corresponding contents in the above method embodiments, which will not be repeated here.
[0108] See also Figure 5 , Figure 5A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Based on the above-mentioned magnetic block device surface defect detection method based on improved SimOTA, the present invention also provides a magnetic block device surface defect detection device based on improved SimOTA. The magnetic block device surface defect detection device based on improved SimOTA can be a computing device such as a mobile terminal, a desktop computer, a notebook, a PDA, and a server. The magnetic block device surface defect detection device based on improved SimOTA includes a processor 510, a memory 520, and a display 530. Figure 5 Only some components of the electronic device are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0109] In some embodiments, the memory 520 may be an internal storage unit of the magnetic block device surface defect detection device based on the improved SimOTA, such as a hard disk or memory based on the magnetic block device surface defect detection device based on the improved SimOTA. In other embodiments, the memory 520 may also be an external storage device based on the magnetic block device surface defect detection device based on the improved SimOTA, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the magnetic block device surface defect detection device based on the improved SimOTA. Further, the memory 520 may also include both an internal storage unit and an external storage device based on the magnetic block device surface defect detection device based on the improved SimOTA. The memory 520 is used to store application software and various types of data installed on the magnetic block device surface defect detection device based on the improved SimOTA, such as the program code for installing the magnetic block device surface defect detection device based on the improved SimOTA. The memory 520 can also be used to temporarily store data that has been output or is to be output. In one embodiment, a magnetic block device surface defect detection program 540 is stored in the memory 520, and the magnetic block device surface defect detection program 540 can be executed by the processor 510, so as to implement the magnetic block device surface defect detection method based on improved SimOTA in each embodiment of the present application.
[0110] In some embodiments, the processor 510 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run program codes or process data stored in the memory 520, such as executing a magnetic block device surface defect detection method based on an improved SimOTA.
[0111] In some embodiments, the display 530 can be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 530 is used to display information on the magnetic block device surface defect detection device based on the improved SimOTA and to display a visual user interface. The components 510-530 of the magnetic block device surface defect detection device based on the improved SimOTA communicate with each other through the system bus.
[0112] In one embodiment, when the processor 510 executes the magnetic block device surface defect detection program 540 in the memory 520 , the steps in the magnetic block device surface defect detection method based on the improved SimOTA are implemented.
[0113] This embodiment further provides a computer-readable storage medium, on which a magnetic block device surface defect detection program based on improved SimOTA is stored. When the magnetic block device surface defect detection program based on improved SimOTA is executed by a processor, the following steps are implemented:
[0114] Acquire a target feature analysis model, the target feature analysis model includes an image segmentation module and a feature extraction module;
[0115] Obtaining a surface image of the magnetic device to be tested;
[0116] The surface image of the magnetic block device to be detected is divided into a plurality of image segments according to the image segmentation module, and a feature image is extracted from the image segments based on the feature extraction module;
[0117] Anchor frames are assigned to surface defects of magnetic devices in feature images through the improved SimOTA anchor frame assignment strategy.
[0118] In summary, the present embodiment provides a method and device for detecting surface defects of magnetic block devices based on improved SimOTA, establishes a target feature analysis model, and divides the surface image of the magnetic block device into several images of different pixel sizes through the image segmentation module in the target feature analysis model, which is beneficial to improving the detection accuracy, and then uses the feature extraction module in the target feature analysis model to extract features from several images of different pixel sizes, thereby improving the accuracy and speed of surface defect detection of magnetic block devices, and through the anchor frame allocation strategy, allocates anchor frames to surface defects of magnetic block devices, thereby further improving the accuracy of surface defect detection of magnetic block devices.
[0119] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. A magnetic block device surface defect detection method based on improved SimOTA, It is characterized in that include: Acquire a target feature analysis model, wherein the target feature analysis model includes an image segmentation module and a feature extraction module; Obtaining a surface image of the magnetic device to be tested; According to the image segmentation module, the surface image of the magnetic block device to be detected is segmented into a plurality of image segments, and based on the feature extraction module, a feature image is extracted from the image segments; Perform forward propagation calculation on the feature image to generate a candidate anchor box; Calculate the IOU loss of all the candidate anchor boxes; Sum the IOU losses of the candidate anchor boxes, and assign an initial anchor box according to the summed result of the IOU losses; Calculating the aspect ratio and area ratio of the actual defect frame on the surface of the magnetic block device; According to the aspect ratio and the area ratio, adjusting the range of the initial defect anchor frame, and calculating the intersection-and-union ratio of the adjusted initial defect anchor frame and the actual defect frame; According to the intersection-over-union ratio, a target defect anchor frame is assigned to the actual defect frame.
2. The method for detecting surface defects of magnetic block devices based on improved SimOTA according to claim 1, It is characterized in that Also includes: A sample set of images of the surface of the magnetic block device is obtained, and the initial parameters of the target feature analysis model are trained based on the parameter determination model to obtain the target parameters.
3. The magnetic block device surface defect detection method based on improved SimOTA according to claim 2, It is characterized in that The step of dividing the surface image of the magnetic block device to be detected into a plurality of image segments according to the image segmentation module includes: Setting the surface image of the magnetic block device to be detected to a preset pixel size; The surface image of the magnetic block device to be inspected with the preset pixel size is input into the image segmentation module to obtain multiple image segments with the pixel size.
4. The magnetic block device surface defect detection method based on improved SimOTA according to claim 3, It is characterized in that The extracting a feature picture from the image segment based on the feature extraction module includes: According to the target parameters, the image segments of the plurality of pixel sizes are input into the feature extraction module to obtain feature images of the surface of the magnetic block device to be detected of several different sizes.
5. The magnetic block device surface defect detection method based on improved SimOTA according to claim 4, It is characterized in that The feature extraction module also includes an attention module and a recognition module; The attention module is used to highlight the image features of the defective area in the image segment; the recognition module is used to recognize the image features and extract the image features.
6. A magnetic block device surface defect detection device based on improved SimOTA, It is characterized in that include: An analysis model building module is used to obtain a target feature analysis model, wherein the target feature analysis model includes an image segmentation module and a feature extraction module; An image acquisition module is used to acquire a surface image of a magnetic block device to be detected; A feature extraction module, used to segment the surface image of the magnetic block device to be detected into a plurality of image segments according to the image segmentation module, and extract a feature image from the image segments based on the feature extraction module; An anchor frame assignment module, used to perform forward propagation calculation on the feature image to generate candidate anchor frames; calculate the IOU loss of all the candidate anchor frames; sum the IOU losses of the candidate anchor frames, and assign an initial anchor frame according to the summed result of the IOU losses; Calculate the aspect ratio and area ratio of the actual defect frame on the surface of the magnetic block device; adjust the range of the initial defect anchor frame according to the aspect ratio and the area ratio, and calculate the intersection-and-union ratio of the adjusted initial defect anchor frame and the actual defect frame; and assign a target defect anchor frame to the actual defect frame according to the intersection-and-union ratio.
7. An electronic device, It is characterized in that comprising a memory and a processor, wherein: The memory is used to store programs; The processor is coupled to the memory and is used to execute the program stored in the memory to implement the steps in the magnetic block device surface defect detection method based on improved SimOTA as described in any one of claims 1 to 5 above.
8. A computer-readable storage medium, It is characterized in that Used to store computer-readable programs or instructions, which, when executed by a processor, can implement the steps in the magnetic block device surface defect detection method based on improved SimOTA as described in any one of claims 1 to 5 above.
Citation Information
Patent Citations
Synthetic aperture radar image target detection method
CN114119582A
Weld defect detection method based on improved YOLOX
CN114240821A
