Graphite coil defect detection method, device, electronic equipment and storage medium
By obtaining the intensity map and polarization map of the graphite coil, combining the training of text encoder and visual encoder, using the polarization scoring module and dynamic pixel attention, the problem of low accuracy in graphite coil detection is solved, and higher detection accuracy and clarity are achieved.
Patent Information
- Application Number
- CN202510712754.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2045-05-30
AI Technical Summary
In the prior art, the accuracy of graphite coil defect detection is low, making it difficult to extract accurate and rich feature points and feature areas, and the detection equipment is disturbed by reflective highlights, affecting defect identification and judgment.
Using the intensity map and polarization map of the image to be detected, the defect detection model and polarization scoring module are used to train through text samples, text encoder, intensity map samples and visual encoder, combined with global and local loss functions, the local visual space is refined using diagonal highlighting attention, and the object-independent text prompt template and polarization scoring module are designed to improve detection accuracy.
It improves the accuracy of graphite coil defect detection, reduces dependence on labeled data, enhances the understanding and detection ability of local visual details, suppresses interference with reflective highlights, and improves the clarity of detection.
Smart Images

Figure CN120235866B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a graphite coil defect detection method, device, electronic equipment and storage medium. Background Art
[0002] Graphite coils, as flexible sealing materials that are resistant to high temperatures and corrosion, are indispensable in the energy, chemical, and other fields. By detecting defects, problems such as holes and scratches on the surface of graphite coils can be discovered in a timely manner, preventing these defects from causing more serious quality problems during subsequent processing or use, thereby ensuring that products meet quality standards and improving their overall quality and stability. However, due to the single color and texture of graphite coils, the grayscale values of pixels in intensity images are extremely low and highly concentrated. Existing computer imaging-based detection methods have difficulty extracting accurate and rich feature points and feature areas, resulting in inaccurate detection or missed detection. Furthermore, the surface of graphite coils is smooth and highly reflective, which can cause reflective bright spots or spots to appear in the images captured by the detection equipment, interfering with the observation of the actual surface condition of the coils. This also increases the difficulty of feature extraction and affects the identification and judgment of defects.
[0003] Currently, convolutional neural networks are used for defect detection on the coil surface of winding systems. However, due to the need to extract accurate and rich features from graphite coils, convolutional neural network models are prone to missed detections and false positives. Semi-supervised learning using generative adversarial networks has also been used for defect detection on the coil surface of winding systems. While this method can theoretically utilize unlabeled data, in practice, if the labeled data is of poor quality or too little, the generator may not be able to learn the accurate distribution of real data, and the discriminator may struggle to accurately distinguish between normal and abnormal data, resulting in low defect detection accuracy. Summary of the Invention
[0004] The object of the present invention is to provide a method, device, electronic device and storage medium for detecting defects in graphite coils, so as to solve the technical problem of low accuracy in detecting defects in graphite coils in the prior art.
[0005] The technical solution of the present invention is as follows: providing a method for detecting defects in a graphite coil, comprising:
[0006] Obtaining an intensity map and a polarization map of the image to be detected;
[0007] The intensity map is input into a defect detection model to obtain image defect features, and the polarization degree map of the image to be detected is input into a polarization scoring module to obtain the score of the matching block. The defect detection result is obtained based on the image defect features and the score of the matching block. The defect detection model is obtained by training text samples, text encoders, intensity map samples and visual encoders. The polarization scoring module is used to determine the score based on the normal polarization degree map and the polarization degree map of the image to be detected.
[0008] Furthermore, the training step of the defect detection model includes:
[0009] The text sample is input into the text encoder, and the intensity map sample is input into the visual encoder. The text encoder and the visual encoder are trained using a total loss function; wherein the total loss function is obtained based on a global loss function and a local loss function.
[0010] Furthermore, the total loss function includes
[0011]
[0012] in, is the total loss function, is the global loss function, is a hyperparameter, The middle layer set of the text encoder The local loss function, is the total number of intermediate layer sets.
[0013] Furthermore, after the text sample is input into the text encoder, the method further includes:
[0014] The randomly initialized learnable embeddings are appended to the frozen layers of the text encoder, the randomly initialized learnable embeddings are concatenated with the original learnable embeddings along the channel dimension, and the concatenated learnable embeddings are forward passed to the frozen layers of the text encoder to refine the original text space.
[0015] Furthermore, the graphite coil defect detection method also includes replacing the original QK attention in the visual encoder with diagonal protrusion attention, and the training step of the defect detection model also includes using the diagonal protrusion attention to refine the local visual space and keeping the visual encoder in a frozen state during the training process.
[0016] Furthermore, the polarization degree map of the image to be detected is input into the polarization scoring module to obtain the score of the matching block, including:
[0017] The polarization degree diagram of the image to be detected is input into a polarization scoring module, and the polarization scoring module scores the polarization degree diagram using a scoring formula, wherein the scoring formula includes
[0018]
[0019] in, is the first r The polarization degree diagram corresponds to s Size Score of sliding matching blocks, The normal polarization degree diagram s The size is Sliding matching blocks, is the polarization degree diagram of the image to be detected s The size is Sliding matching blocks.
[0020] Furthermore, obtaining a polarization degree map of the image to be detected includes:
[0021] Separate the 0° polarization direction light intensity, 45° polarization direction light intensity, 90° polarization direction light intensity and 135° polarization direction light intensity from the image to be detected, and Image formula to determine the polarization diagram of the image to be detected image, The image formula includes
[0022]
[0023] in, , is the light intensity in the 0° polarization direction, is the light intensity in the 45° polarization direction, is the light intensity in the 90° polarization direction, is the light intensity in the 135° polarization direction.
[0024] Another technical solution of the present invention is as follows: a graphite coil defect detection device is provided, comprising an image acquisition module and a detection module;
[0025] The image acquisition module is used to acquire the intensity map and polarization degree map of the image to be detected;
[0026] The detection module is used to input the intensity map into the defect detection model to obtain image defect features, input the polarization degree map of the image to be detected into the polarization scoring module to obtain the score of the matching block, and obtain the defect detection result based on the image defect features and the score of the matching block; the defect detection model is obtained by training text samples, text encoders, intensity map samples and visual encoders, and the polarization scoring module is used to determine the score based on the normal polarization degree map and the polarization degree map of the image to be detected.
[0027] Another technical solution of the present invention is as follows: an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program executable by the processor, and when the processor executes the computer program, the graphite coil defect detection method as described in any of the above technical solutions is implemented.
[0028] Another technical solution of the present invention is as follows: a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the graphite coil defect detection method as described in any of the above technical solutions is implemented.
[0029] The beneficial effects of the present invention are: obtaining an intensity map and a polarization map of an image to be detected; inputting the intensity map into a defect detection model to obtain image defect features, inputting the polarization map of the image to be detected into a polarization scoring module to obtain the score of the matching block, and obtaining a defect detection result based on the image defect features and the score of the matching block; the defect detection model is obtained by training text samples, text encoders, intensity map samples and visual encoders, and the polarization scoring module is used to determine the score based on a normal polarization map and the polarization map of the image to be detected; the detection of graphite coil defects can be realized, and the accuracy of graphite coil defect detection can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 A schematic flow chart of a graphite coil defect detection method provided in an embodiment of the present invention.
[0031] Figure 2 A schematic diagram of the model network structure provided by an embodiment of the present invention.
[0032] Figure 3 A schematic diagram of dynamic pixel attention provided by an embodiment of the present invention.
[0033] Figure 4 This is a schematic diagram of the scoring determination of the polarization scoring module provided in an embodiment of the present invention.
[0034] Figure 5 A grayscale image including scratches is provided in an embodiment of the present invention.
[0035] Figure 6 A grayscale image including holes is provided in an embodiment of the present invention.
[0036] Figure 7 A heat map including scratches is provided for an embodiment of the present invention.
[0037] Figure 8 A heat map including holes is provided for an embodiment of the present invention.
[0038] Figure 9 A schematic structural diagram of a graphite coil defect detection device provided in an embodiment of the present invention.
[0039] Figure 10 A schematic structural diagram of an electronic device provided by an embodiment of the present invention.
[0040] Figure 11 A schematic diagram of the structure of a computer-readable storage medium provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0041] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0042] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present invention. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute a separate or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0043] Figure 1 It is a flow chart of the graphite coil defect detection method according to an embodiment of the present invention. It should be noted that the graphite coil defect detection method according to the present invention is not limited to the above methods if the results are substantially the same. Figure 1 The process sequence shown is limited. Figure 1 As shown, the graphite coil defect detection method mainly includes the following steps:
[0044] S101, obtaining an intensity map and a polarization map of an image to be detected;
[0045] In some embodiments, obtaining a polarization degree map of an image to be detected includes:
[0046] Separate the 0° polarization direction light intensity, 45° polarization direction light intensity, 90° polarization direction light intensity and 135° polarization direction light intensity from the image to be detected, and Image formula to determine the polarization diagram of the image to be detected image, The image formula includes
[0047]
[0048] in, , is the light intensity in the 0° polarization direction, is the light intensity in the 45° polarization direction, is the light intensity in the 90° polarization direction, is the light intensity in the 135° polarization direction.
[0049] In a specific embodiment, a split-focal plane polarization camera can be used to capture images of graphite coils, thereby obtaining an image to be detected or an image sample. In the process of reflecting incident light, the surface of an object will produce polarization characteristics determined by its own properties. By analyzing the polarization state of the reflected light, the physical and chemical characteristics such as the target's material and surface roughness, as well as geometric characteristics such as the surface shape and edge information, can be reflected. This is independent of factors such as background illumination and contrast, and can greatly improve target detection and recognition performance. According to the arrangement of the polarization filter on the focal plane of the visible light polarization camera, the polarization filter is separated from the collected original image (the image to be detected or the image sample). 、 、 、 , Indicates the light intensity in the 0° polarization direction, Indicates the light intensity in the 45° polarization direction, Indicates the light intensity in the 90° polarization direction, Indicates the light intensity in the 135° polarization direction.
[0050] The intensity and polarization state of light can be characterized by four parameters represented by light intensity. The four parameters are the time averages of the light intensity and form a four-dimensional mathematical vector. S0, S1, and S2 can be used to describe the intensity and polarization characteristics of light. The light intensity can be expressed as
[0051]
[0052] Thus, the polarization diagram of the coil is obtained. image
[0053]
[0054] in, The image is a polarization format image, that is, a linear polarization degree image.
[0055] S102: Input the intensity map into a defect detection model to obtain image defect features, input the polarization map of the image to be detected into a polarization scoring module to obtain the score of the matching block, and obtain the defect detection result based on the image defect features and the score of the matching block; the defect detection model is obtained by training text samples, text encoders, intensity map samples and visual encoders, and the polarization scoring module is used to determine the score based on the normal polarization map and the polarization map of the image to be detected.
[0056] In some embodiments, the step of training the defect detection model includes:
[0057] The text sample is input into the text encoder, and the intensity map sample is input into the visual encoder. The text encoder and the visual encoder are trained using a total loss function; wherein the total loss function is obtained based on a global loss function and a local loss function.
[0058] In a specific embodiment, the defect detection model may be a trained CLIP (Contrastive Language-Image Pretraining) model, and the model network structure diagram is as follows: Figure 2 As shown, the model includes a text encoder and a visual encoder, which can be used 、 Indicates. Text prompt template The class name can be , can be achieved through Get its corresponding text embedding The commonly used text prompt template in CLIP is similar to a Photos of which Indicates the target class name. Then, For images Encoding is performed to derive a visual representation where class tokens is considered as its visual embedding (global visual embedding), the block token It is called local visual embedding. CLIP performs zero-shot recognition by measuring the similarity between text and visual embeddings. Specifically, given a set of target classes and images , CLIP prediction belong The probability is as follows
[0059]
[0060] in, is the temperature hyperparameter, the operator Represents the calculation of cosine similarity. Similar to other methods involving multiple classes of objects and using object names as class names Different from the visual task of , we can assume that the zero-shot anomaly detection task using CLIP is object-independent, design two types of text prompts (i.e., normal and abnormal), and calculate the likelihood of these two types according to the above formula. Expressed as anomaly score, the computation is extended from global visual embedding to local visual embedding to derive the corresponding segmentation map (normal image) and (Abnormal graph), H represents the graph height, and W represents the graph width.
[0061] In a specific embodiment, object-independent prompt learning is introduced, and the text prompt template will and Design as an object Rather than categories , shielding the category semantics of the object.
[0062]
[0063] in, and Text prompts indicating normal and abnormal conditions, and ( ) represent the learnable text embeddings in normal and abnormal text prompt templates, respectively, [damaged] represents abnormality, Represents an object rather than its class.
[0064] In some embodiments, the total loss function includes
[0065]
[0066] in, is the total loss function, is the global loss function, is a hyperparameter, The middle layer set of the text encoder The local loss function, is the total number of intermediate layer sets.
[0067] In a specific embodiment, For the set of intermediate layers used, the textual prompts can be learned by minimizing the following total loss function,
[0068]
[0069] in, is a hyperparameter that balances global loss and local loss, is a cross entropy loss that matches the cosine similarity between object-independent textual embeddings and visual embeddings of normal / abnormal images from auxiliary data. Let is the ground truth segmentation mask, if the pixel is an anomaly, then ,otherwise .So,
[0070]
[0071] in, and Respectively focal Loss and Dice loss. Indicates the first Middle layer set i Intensity map j Rank k The local visual embedding of the block token corresponding to the column pixel, operator and represents the concatenation of upsampling and channels, I Represents a matrix with all elements set to 1. Since abnormal regions are usually smaller than normal regions, focal loss is used to address the imbalance problem. In addition, to ensure that the model establishes accurate decision boundaries, Dice loss is used to measure the predicted segmentation. Overlap with the ground truth mask.
[0072] In some embodiments, after inputting the text sample into the text encoder, the method further includes:
[0073] The randomly initialized learnable embeddings are appended to the frozen layers of the text encoder, the randomly initialized learnable embeddings are concatenated with the original learnable embeddings along the channel dimension, and the concatenated learnable embeddings are forward passed to the frozen layers of the text encoder to refine the original text space.
[0074] In a specific embodiment, the original text space of CLIP is refined by adding additional learnable token embeddings to the text encoder of CLIP. Specifically, the randomly initialized learnable tokens can be Embed attached to middle, is the mth layer of the frozen CLIP text encoder. Then, along the channel dimension, and the original token Connect them and pass them forward To obtain the next layer of learnable tokens , and initialize new learnable token embeddings Due to the self-attention mechanism, the updated gradients can be back-propagated to optimize the learnable tokens Repeat this process until you reach the specified layer. M ′.
[0075] In some embodiments, the graphite coil defect detection method further includes replacing the original QK attention in the visual encoder with diagonal protrusion attention, and the training step of the defect detection model further includes using the diagonal protrusion attention to refine the local visual space and keeping the visual encoder in a frozen state during the training process.
[0076] In a specific embodiment, the mechanism of diagonal protrusion attention map can be used to refine the local visual space and keep the visual encoder frozen during training. To this end, the original QK attention in the visual encoder is replaced with diagonal protrusion attention. The dynamic pixel attention diagram is as follows: Figure 3 As shown, Figure 3 The red box in the QK attention map in b) is the scratch mark box. QQ, KK and VV self-attention schemes, such as Figure 3 c) Figure 3 d) and Figure 3 As shown in e), the attention map of the improved dynamic pixel attention module is more prominent on the diagonal.
[0077] In some embodiments, the polarization degree map of the image to be detected is input into a polarization scoring module to obtain a score of the matching block, including:
[0078] The polarization degree diagram of the image to be detected is input into a polarization scoring module, and the polarization scoring module scores the polarization degree diagram using a scoring formula, wherein the scoring formula includes
[0079]
[0080] in, is the first r The polarization degree diagram corresponds to s Size Score of sliding matching blocks, The normal polarization degree diagram s The size is Sliding matching blocks, is the polarization degree diagram of the image to be detected s The size is Sliding matching blocks.
[0081] In a specific embodiment, the defective parts of the graphite coil, such as scratches and holes, have different polarization characteristics from the normal area due to different stress. The holes appear as the background when the image is collected. Different materials have different polarization characteristics. Figure 4 As shown in the figure, since the grayscale values of the pixels in the graphite coil strength image are extremely low and highly concentrated, it is difficult to extract features, but the polarization discrimination is very high. If a normal image is used to score the test image using a sliding module, which is essentially a comparison, then the defective area will have a higher contrast than the normal area. Therefore, when there are defects in the test image, the corresponding matching block will have a high score; if there is no abnormality, the score will be low. And the more defects contained in the matching block, the higher the score. A graphite coil defect detection dataset was constructed, in which defects include scratches and holes, and then the model was used for testing. After obtaining the score of the matching block, a grayscale image can be formed based on the score. Including a grayscale image of scratches, such as Figure 5 As shown; including the grayscale image of the hole, such as Figure 6 As shown; According to the image defect characteristics and the grayscale image, a thermal map is obtained, including a thermal map of scratches, such as Figure 7 As shown; including the heat map of holes, such as Figure 8 As shown; the heat map can be used as the defect detection result.
[0082] The graphite coil defect detection method provided by an embodiment of the present invention obtains an intensity map and a polarization map of an image to be detected; inputs the intensity map into a defect detection model to obtain image defect features, inputs the polarization map of the image to be detected into a polarization scoring module to obtain a score of a matching block, and obtains a defect detection result based on the image defect features and the score of the matching block; the defect detection model is obtained by training text samples, a text encoder, an intensity map sample, and a visual encoder, and the polarization scoring module is used to determine a score based on a normal polarization map and the polarization map of the image to be detected; the detection of graphite coil defects can be realized, and the accuracy of graphite coil defect detection can be improved.
[0083] The graphite coil defect detection method provided by an embodiment of the present invention introduces an object-independent text prompt template to capture common normality and abnormality, and uses text prompt tuning technology and a dynamic pixel attention module to strongly support CLIP's learning in text and local visual space dimensions, thereby improving the model's understanding and processing capabilities of relevant information. To further enrich local visual details, a strategy of integrating multiple intermediate layers is adopted. Through this strategy, more detailed local visual information can be provided to the model, thereby enhancing the model's performance in defect detection tasks. Utilizing the dissimilar polarization characteristics between normal and abnormal areas, a polarization scoring module is proposed to further improve detection accuracy.
[0084] The graphite coil defect detection method provided by the embodiment of the present invention introduces an object-independent prompt learning mechanism, utilizes object-independent prompt templates and a global anomaly loss function (total loss function), and uses auxiliary data to learn general anomaly and normal prompts, thereby simplifying the prompt design and effectively reducing the dependence on labeled data. Because under ordinary imaging methods, the color and texture of graphite coils are single, and the pixel grayscale values are concentrated, resulting in low image contrast and unclear features. Polarization imaging can utilize the polarization characteristics of light and obtain more information about the surface of an object by analyzing the intensity changes of light in different polarization directions. The polarization scoring module of the embodiment of the present invention makes good use of the polarization characteristics of graphite coils, overcoming the above-mentioned shortcomings of ordinary intensity images. In addition, the surface of the graphite coil is smooth, and its high reflective properties will produce reflective bright spots or spots, which are mainly mirror reflected light. Polarization imaging can effectively suppress such glare.
[0085] The graphite coil defect detection method provided by an embodiment of the present invention embeds prompts by fine-tuning CLIP, using auxiliary data, and combining image-level and pixel-level loss functions to learn common normal and abnormal features in the image. This allows the model to focus on abnormal image areas rather than object semantics, thereby achieving zero-sample graphite coil defect detection and reducing dependence on labeled data. Polarized images are used as input, and polarized light produces different polarization state changes during reflection. Polarized images can convert the difference between normal and abnormal into a difference in polarization degree, making areas that were originally difficult to distinguish easier to identify, thereby facilitating the extraction of accurate and rich feature points and feature areas. Polarization can effectively suppress specular reflection light and reduce the intensity of reflective bright spots and light spots, making the actual situation of the coil surface in the image clearer and facilitating defect detection.
[0086] Based on the above graphite coil defect detection method, an embodiment of the present invention provides a graphite coil defect detection device, the structural diagram of which is as follows: Figure 9 As shown, the graphite coil defect detection device 90 includes an image acquisition module 91 and a detection module 92;
[0087] The image acquisition module 91 is used to acquire the intensity map and polarization map of the image to be detected;
[0088] The detection module 92 is used to input the intensity map into the defect detection model to obtain image defect features, input the polarization map of the image to be detected into the polarization scoring module to obtain the score of the matching block, and obtain the defect detection result based on the image defect features and the score of the matching block; the defect detection model is obtained by training text samples, text encoders, intensity map samples and visual encoders, and the polarization scoring module is used to determine the score based on the normal polarization map and the polarization map of the image to be detected.
[0089] For other details about how the modules in the graphite coil defect detection device 90 implement the above technical solution, please refer to the description of the graphite coil defect detection method provided in the above invention embodiment, which will not be repeated here.
[0090] Based on the above graphite coil defect detection method, an embodiment of the present invention further provides an electronic device, the structural diagram of which is as follows: Figure 10 As shown, the electronic device 100 includes a processor 101 and a memory 102 coupled to the processor 101. The memory 102 stores a computer program, which, when executed by the processor 101, causes the processor 101 to perform the steps of the graphite coil defect detection method in the above embodiment.
[0091] For other details about how the processor 101 in the electronic device implements the above technical solution, please refer to the description of the graphite coil defect detection method provided in the above invention embodiment, which will not be repeated here.
[0092] Among them, the processor 101 can also be called a CPU (Central Processing Unit), and the processor 101 may be an integrated circuit chip with signal processing capabilities; the processor 101 can also be a general-purpose processor, DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), FPGA (Field Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, among which the general-purpose processor can be a microprocessor or the processor 101 can also be any conventional processor, etc.
[0093] The embodiment of the present invention further provides a computer-readable storage medium, the structural diagram of which is as follows: Figure 11As shown, the storage medium 110 stores a readable computer program 111; wherein, the computer program 111 can be stored in the above-mentioned storage medium 110 in the form of a software product, including a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in various embodiments of the present invention. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk, ROM (Read-Only Memory), RAM (Random Access Memory), and other media that can store program code, or terminal devices such as computers, servers, mobile phones, and tablets.
[0094] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is merely a logical function division. In actual implementation, there may be other division methods, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0095] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules may be selected to achieve the purpose of the present embodiment according to actual needs.
[0096] In addition, the functional modules in the various embodiments of the present application may be integrated into a single processing module, or each module may exist physically separately, or two or more modules may be integrated into a single module. The aforementioned integrated modules may be implemented in the form of hardware or in the form of software functional modules. If the integrated modules are implemented in the form of software functional modules and sold or used as independent products, they may be stored in a computer-readable storage medium.
[0097] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0098] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in accordance with the embodiments of the present application are fully or partially generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that can be stored by a computer, or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, hard disk, or tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0099] The above is a detailed introduction to the technical solution provided by the present application. Specific examples are used in the present application to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
[0100] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0101] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0102] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0103] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0104] Obviously, those skilled in the art may make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.
Claims
1. A method for detecting defects in a graphite coil, characterized in that: include: Obtaining an intensity map and a polarization map of the image to be detected; The intensity map is input into the defect detection model to obtain image defect features, and the polarization degree map of the image to be detected is input into the polarization scoring module, so that the polarization scoring module scores the polarization degree map using a scoring formula to obtain a score for the matching block. The scoring formula includes in, is the first r The polarization degree diagram corresponds to s Size Score of sliding matching blocks, The normal polarization degree diagram s The size is Sliding matching blocks, is the polarization degree diagram of the image to be detected s The size is a sliding matching block; obtaining a defect detection result according to the image defect feature and the score of the matching block; the training step of the defect detection model includes inputting a text sample into a text encoder, inputting an intensity map sample into a visual encoder, replacing the original QK attention in the visual encoder with a diagonally prominent attention, using a total loss function to train the text encoder and the visual encoder, using the diagonally prominent attention to refine the local visual space, and keeping the visual encoder frozen during the training process; wherein the total loss function is obtained based on a global loss function and a local loss function.
2. The method for detecting defects in a graphite coil according to claim 1, wherein: The total loss function includes in, is the total loss function, is the global loss function, is a hyperparameter, The middle layer set of the text encoder The local loss function, is the total number of intermediate layer sets.
3. The method for detecting defects in a graphite coil according to claim 1, wherein: After inputting the text sample into the text encoder, the method further includes: The randomly initialized learnable embeddings are appended to the frozen layers of the text encoder, the randomly initialized learnable embeddings are concatenated with the original learnable embeddings along the channel dimension, and the concatenated learnable embeddings are forward passed to the frozen layers of the text encoder to refine the original text space.
4. The method for detecting defects in a graphite coil according to claim 1, wherein: Obtain the polarization degree map of the image to be detected, including: Separate the 0° polarization direction light intensity, 45° polarization direction light intensity, 90° polarization direction light intensity and 135° polarization direction light intensity from the image to be detected, and Image formula to determine the polarization diagram of the image to be detected image, The image formula includes in, , is the light intensity in the 0° polarization direction, is the light intensity in the 45° polarization direction, is the light intensity in the 90° polarization direction, is the light intensity in the 135° polarization direction.
5. A graphite coil defect detection device, characterized in that: It includes an image acquisition module and a detection module; The image acquisition module is used to acquire the intensity map and polarization degree map of the image to be detected; The detection module is used to input the intensity map into the defect detection model to obtain image defect features, input the polarization degree map of the image to be detected into the polarization scoring module, and enable the polarization scoring module to score the polarization degree map using a scoring formula to obtain a score for the matching block. The scoring formula includes in, is the first r The polarization degree diagram corresponds to s Size Score of sliding matching blocks, The normal polarization degree diagram s The size is Sliding matching blocks, is the polarization degree diagram of the image to be detected s The size is a sliding matching block; obtaining a defect detection result according to the image defect feature and the score of the matching block; the training step of the defect detection model includes inputting a text sample into a text encoder, inputting an intensity map sample into a visual encoder, replacing the original QK attention in the visual encoder with a diagonally prominent attention, using a total loss function to train the text encoder and the visual encoder, using the diagonally prominent attention to refine the local visual space, and keeping the visual encoder frozen during the training process; wherein the total loss function is obtained based on a global loss function and a local loss function.
6. An electronic device comprising a memory and a processor, wherein the memory stores a computer program executable by the processor, wherein: When the processor executes the computer program, the graphite coil defect detection method according to any one of claims 1 to 4 is implemented.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the graphite coil defect detection method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Circuit board surface defect detection method based on polarization prior
CN114549391A
Transformer defect detection method based on pixel-text matching of CLIP model
CN118918095A