Industrial defect detection method, device and equipment and storage medium

By combining the visual language model with electron microscope images and defect detection text, the accuracy and efficiency problems of traditional industrial defect detection methods are solved, and efficient identification and classification of complex shapes and small-sized defects in industrial castings are achieved, providing detailed defect analysis and Improvement measures.

CN118570169APending Publication Date: 2024-08-30INSPUR SUZHOU INTELLIGENT TECH CO LTD

Patent Information

Application Number
CN202410703599.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Traditional industrial defect detection methods are limited by factors such as size, shape, surface condition, etc., require a lot of manual operations and professional knowledge, and have limited accuracy in identifying small defects, high equipment costs, and limited scope of application.

Method used

Using a visual language model, the visual language model is trained through the combination of electron microscope images and defect detection text to generate a model for identifying and classifying defects in industrial castings, using image understanding and natural language processing capabilities to achieve more accurate defect detection.

Benefits of technology

It improves the accuracy and efficiency of industrial casting defect detection, reduces dependence on professional knowledge and equipment costs, is suitable for the detection of complex shapes and small-sized defects, and provides detailed defect analysis and suggestions for improvement measures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570169A
    Figure CN118570169A
Patent Text Reader

Abstract

According to the embodiment of the invention, a first model is obtained by pre-training a visual language model, an electron microscope image of the industrial casting is obtained, defect labeling is carried out on the electron microscope image to obtain a to-be-detected image containing a labeling text, and then a defect detection text for determining defect information of the industrial casting is obtained; the to-be-detected image and the defect detection text are input into the first model for defect detection, and a detection result corresponding to the industrial casting is obtained. According to the embodiment of the invention, the electron microscope image of the industrial casting is used as the input data, the defect is marked manually, and the visual language model is finely adjusted according to the marked data set; the model can understand and analyze the properties and reasons of industrial defects, and effective reference is provided for subsequent improvement measures.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of defect detection technology, and in particular to an industrial defect detection method, device, equipment and storage medium. Background Art

[0002] Industrial defects generally refer to various problems that do not meet quality standards or design requirements that occur during industrial production. These problems may occur in raw materials, production processes, product design, manufacturing processes, assembly, testing or final products. Industrial defects may lead to reduced product performance, reduced reliability, increased safety hazards, and even complete product failure. In order to reduce industrial defects, companies usually take a series of quality control measures, including the establishment of a quality management system, process monitoring, employee training, and the use of advanced testing equipment and technology. Although traditional industrial defect detection methods have been developed for many years, they still have some shortcomings. First, although visual inspection is intuitive, it is affected by human vision and fatigue, and the accuracy of identifying tiny defects is limited. Although X-ray testing can penetrate industrial castings and find internal defects, the equipment is expensive and requires professional operators. Ultrasonic testing can detect defects inside materials, but its resolution may not be high enough for industrial castings with complex shapes. Magnetic particle testing performs well in surface defect detection, but it is only applicable to ferromagnetic materials and not to other materials. Thermal imaging testing relies on changes in heat distribution to detect defects, but it may not be effective for small defects or defects with small surface temperature differences.

[0003] However, in the field of industrial defect detection, traditional methods are often limited by factors such as size, shape, and surface condition, and require a lot of manual operation and professional knowledge. All of these traditional detection methods have their own disadvantages. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a method, device, equipment and storage medium for detecting industrial defects, which utilize the capabilities of the visual language model in natural language processing and image understanding to more accurately identify and classify various defects of industrial castings. The specific technical solutions are as follows:

[0005] In a first aspect of the present invention, a method for detecting industrial defects is provided, wherein the method comprises:

[0006] Acquire an electron microscope image of an industrial casting, and annotate defects on the electron microscope image to obtain an image to be inspected containing annotated text;

[0007] Acquire a preset defect detection text, wherein the defect detection text is used to determine defect information of the industrial casting;

[0008] The image to be detected and the defect detection text are input into the first model for defect detection to obtain the detection result corresponding to the industrial casting.

[0009] Optionally, the defect detection image data set includes an electron microscope image of an industrial casting and a defect detection text, and the defect detection text includes a defect detection question and a defect detection answer truth value;

[0010] The step of training a visual language model by using the defect detection image dataset to obtain a first model includes:

[0011] Get the visual language model;

[0012] Inputting the electron microscope image and the defect detection text into the visual language model for training to obtain a defect detection answer training value corresponding to the electron microscope image;

[0013] The loss value of the defect detection answer training value is calculated in combination with the true value of the defect detection answer, and the loss value is reversely updated to the visual language model to generate the first model.

[0014] Optionally, the visual language model includes an initial image processing module, an initial text processing module and an initial question-answering module, and the method further includes:

[0015] Inputting the electron microscope image into the initial image processing module for feature extraction, vectorization and word embedding to obtain a visual word vector of the electron microscope image;

[0016] Input the defect detection text into the initial text processing module for encoding to obtain a language word vector of the defect detection text, wherein the language word vector includes three groups of question-answer word vectors;

[0017] Inputting the visual word vector and the first question word vector in the language word vector into the initial question-answering module to obtain a first answer training value;

[0018] Combined with the first answer truth word vector corresponding to the first question word vector, the first answer training value is subjected to loss calculation to obtain a first loss value of the first answer training value, and the first loss value is reversely updated to the initial question-answering module;

[0019] Inputting the visual word vector, the first answer truth word vector and the second question word vector in the language word vector into the initial question-answering module to obtain a second answer training value;

[0020] Combine the second answer truth word vector corresponding to the second question word vector and

[0021] The training value is used to perform loss calculation to obtain a second loss value of the second answer training value, and the second loss value is reversely updated to the initial question-answer module;

[0022] Inputting the visual word vector, the second answer truth word vector and the third question word vector in the language word vector into the initial question-answering module to obtain a third answer training value;

[0023] In combination with the third answer truth word vector corresponding to the third question word vector, the loss of the third answer training value is calculated to obtain a third loss value of the third answer training value, and the third loss value is reversely updated to the initial question-answer module to generate the first model.

[0024] Optionally, the method further comprises:

[0025] The original weight of the initial question-answering module is set to a closed state, and a low-rank matrix layer is added to the initial question-answering module, and the visual language model is locally fine-tuned according to the low-rank matrix layer.

[0026] Optionally, the first model includes an image processing module, a text processing module and a question-answering module;

[0027] The step of inputting the image to be detected and the defect detection text into the first model for defect detection includes:

[0028] Inputting the image to be detected into the image processing module for feature extraction to obtain a visual word vector of the image to be detected;

[0029] Inputting the defect detection text into the text processing module for feature extraction to obtain a language word vector of the defect detection text;

[0030] splicing the visual word vector and the language word vector and inputting them into the question-answering module for defect detection to obtain an output word vector, wherein when splicing, the visual word vector is linearly projected to the same dimension as the language word vector;

[0031] The output word vector is decoded and combined with the defect information to obtain a detection result for the industrial casting.

[0032] Optionally, the image processing module includes an image encoder, an intermediate and a fully connected layer;

[0033] The step of inputting the image to be detected into the image processing module for feature extraction to obtain a visual word vector of the image to be detected includes:

[0034] Inputting the image to be detected into the image encoder to extract features, thereby obtaining visual features of the image to be detected;

[0035] Inputting the visual feature into the intermediate layer for vectorization to obtain a visual feature vector corresponding to the visual feature;

[0036] The visual feature vector is input into the fully connected layer for word embedding to obtain a visual word vector corresponding to the visual feature vector.

[0037] Optionally, the text processing module includes a word segmentation editor;

[0038] The step of inputting the defect detection text into the text processing module for feature extraction to obtain a language word vector of the defect detection text includes:

[0039] Determining whether there are other defect detection texts before obtaining the defect detection text;

[0040] If no other defect detection text exists before the defect detection text, the defect detection text is subjected to string formatting processing to obtain a prompt word text corresponding to the defect detection text;

[0041] If there are other defect detection texts before the defect detection text, determining the previous defect detection text of the defect detection text from the other defect detection texts;

[0042] Splicing the defect detection text with the previous defect detection text to obtain a spliced ​​text, and performing string formatting processing on the spliced ​​text to obtain a prompt word text corresponding to the defect detection text;

[0043] The prompt word text is input into the word segmentation editor for encoding to obtain a language word vector corresponding to the prompt word text.

[0044] In a second aspect of the present invention, there is also provided an industrial defect detection device, the device comprising:

[0045] A model training module is used to obtain a defect detection image dataset, and train a visual language model through the defect detection image dataset to obtain a first model;

[0046] An image acquisition module is used to acquire an electron microscope image of an industrial casting and annotate defects on the electron microscope image to obtain an image to be inspected containing annotated text;

[0047] A text acquisition module, used to acquire a preset defect detection text, wherein the defect detection text is used to determine defect information of the industrial casting;

[0048] The defect detection module is used to input the image to be detected and the defect detection text into the first model for defect detection to obtain the detection result corresponding to the industrial casting.

[0049] Optionally, the defect detection image data set includes an electron microscope image of an industrial casting and a defect detection text, and the defect detection text includes a defect detection question and a defect detection answer truth value;

[0050] The model training module is specifically used for:

[0051] Get the visual language model;

[0052] Inputting the electron microscope image and the defect detection text into the visual language model for training to obtain a defect detection answer training value corresponding to the electron microscope image;

[0053] The loss value of the defect detection answer training value is calculated in combination with the true value of the defect detection answer, and the loss value is reversely updated to the visual language model to generate the first model.

[0054] Optionally, the visual language model includes an initial image processing module, an initial text processing module and an initial question-answering module, and the model training module is specifically used to:

[0055] Inputting the electron microscope image into the initial image processing module for feature extraction, vectorization and word embedding to obtain a visual word vector of the electron microscope image;

[0056] Input the defect detection text into the initial text processing module for encoding to obtain a language word vector of the defect detection text, wherein the language word vector includes three groups of question-answer word vectors;

[0057] Inputting the visual word vector and the first question word vector in the language word vector into the initial question-answering module to obtain a first answer training value;

[0058] Combined with the first answer truth word vector corresponding to the first question word vector, the first answer training value is subjected to loss calculation to obtain a first loss value of the first answer training value, and the first loss value is reversely updated to the initial question-answering module;

[0059] Inputting the visual word vector, the first answer truth word vector and the second question word vector in the language word vector into the initial question-answering module to obtain a second answer training value;

[0060] Combined with the second answer truth word vector corresponding to the second question word vector, the second answer training value is subjected to loss calculation to obtain a second loss value of the second answer training value, and the second loss value is reversely updated to the initial question-answering module;

[0061] Inputting the visual word vector, the second answer truth word vector and the third question word vector in the language word vector into the initial question-answering module to obtain a third answer training value;

[0062] In combination with the third answer truth word vector corresponding to the third question word vector, the loss of the third answer training value is calculated to obtain a third loss value of the third answer training value, and the third loss value is reversely updated to the initial question-answer module to generate the first model.

[0063] Optionally, the model training module is specifically used to:

[0064] The original weight of the initial question-answering module is set to a closed state, and a low-rank matrix layer is added to the initial question-answering module, and the visual language model is locally fine-tuned according to the low-rank matrix layer.

[0066] Optionally, the first model includes an image processing module, a text processing module and a question-answering module;

[0067] The defect detection module is specifically used for:

[0068] Inputting the image to be detected into the image processing module for feature extraction to obtain a visual word vector of the image to be detected;

[0069] Inputting the defect detection text into the text processing module for feature extraction to obtain a language word vector of the defect detection text;

[0070] splicing the visual word vector and the language word vector and inputting them into the question-answering module for defect detection to obtain an output word vector, wherein when splicing, the visual word vector is linearly projected to the same dimension as the language word vector;

[0071] The output word vector is decoded and combined with the defect information to obtain a detection result for the industrial casting.

[0072] Optionally, the image processing module includes an image encoder, an intermediate layer and a fully connected layer;

[0073] The defect detection module is specifically used for:

[0074] Inputting the image to be detected into the image encoder to extract features, thereby obtaining visual features of the image to be detected;

[0075] Inputting the visual feature into the intermediate layer for vectorization to obtain a visual feature vector corresponding to the visual feature;

[0076] The visual feature vector is input into the fully connected layer for word embedding to obtain a visual word vector corresponding to the visual feature vector.

[0077] Optionally, the text processing module includes a word segmentation editor;

[0078] The defect detection module is specifically used for:

[0079] Determining whether there are other defect detection texts before obtaining the defect detection text;

[0080] If no other defect detection text exists before the defect detection text, the defect detection text is subjected to string formatting processing to obtain a prompt word text corresponding to the defect detection text;

[0081] If there are other defect detection texts before the defect detection text, determining the previous defect detection text of the defect detection text from the other defect detection texts;

[0082] The defect detection text is concatenated with the previous defect detection text to obtain a concatenated text, and the concatenated text is subjected to string formatting to obtain a prompt word corresponding to the defect detection text.

[0083] text;

[0084] The prompt word text is input into the word segmentation editor for encoding to obtain a language word vector corresponding to the prompt word text.

[0085] In a third aspect of the present invention, there is also provided an electronic device, comprising: a memory, a processor, and a program stored in the memory and executable on the processor;

[0086] The processor is used to read the program in the memory to implement the steps in any of the above-mentioned industrial defect detection methods.

[0087] In a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein a program is stored in the computer-readable storage medium, and when the program is run on a computer, the computer executes the steps in any of the above-mentioned industrial defect detection methods.

[0088] The embodiment of the present invention obtains the first model by pre-training the visual language model, obtains the electron microscope image of the industrial casting, annotates the defects of the electron microscope image, obtains the image to be detected containing the annotated text, and then obtains the defect detection text for determining the defect information of the industrial casting, inputs the image to be detected and the defect detection text into the first model for defect detection, and obtains the corresponding detection result of the industrial casting. The embodiment of the present invention uses the electron microscope image of the industrial casting as input data, manually annotates the defects, and fine-tunes the visual language model according to the annotated data set, so that the model can understand and analyze the nature and causes of industrial defects, and provide an effective reference for subsequent improvement measures. BRIEF DESCRIPTION OF THE DRAWINGS

[0089] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0090] Figure 1 One of the step flow charts of the industrial defect detection method provided by an embodiment of the present invention;

[0091] Figure 2 is a flow chart of training a visual language model provided by an embodiment of the present invention;

[0092] Figure 3 A second flowchart of the step of inputting the image to be detected and the defect detection text into the first model for defect detection in the industrial defect detection method provided by an embodiment of the present invention;

[0093] Figure 4 It is a structural schematic diagram of an industrial defect detection device provided by an embodiment of the present invention;

[0094] Figure 5 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0095] To make the purpose, technical solutions and advantages of the embodiments of the present invention more clear, the following will be combined with the accompanying drawings.

[0096] The various embodiments of the present invention are described in detail. However, it can be understood by those skilled in the art that in the various embodiments of the present invention, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solution claimed in the present application can also be implemented. The division of the following embodiments is for the convenience of description and should not constitute any limitation on the specific implementation of the present invention. The various embodiments can be combined and referenced with each other under the premise of no contradiction.

[0097] Industrial castings are parts or products produced by casting process, which are widely used in various industrial fields, such as automobile, aviation, construction, machinery manufacturing, energy, etc. Casting is a manufacturing process that pours molten metal or alloy into a mold and allows it to cool and solidify into the desired shape. Industrial castings can be simple structural parts or complex mechanical parts with different sizes, shapes and performance requirements.

[0098] Industrial defects usually refer to various problems that do not meet quality standards or design requirements during the industrial production process. These problems may occur in raw materials, production processes, product design, manufacturing processes, assembly, testing or final products. Industrial defects may lead to reduced product performance, reduced reliability, increased safety hazards, and even complete product failure. In order to reduce industrial defects, companies usually take a series of quality control measures, including the establishment of a quality management system, process monitoring, employee training, and the use of advanced testing equipment and technology.

[0099] Reference Figure 1 , shows one of the step flow charts of the industrial defect detection method provided by an embodiment of the present invention. The industrial defect detection method of the present invention pre-trains a vision language model (Vision-Language Model, VLM), and performs defect detection on industrial castings based on the first model obtained by training. The specific steps are as follows:

[0100] Step 101: Obtain a defect detection image dataset, and train a visual language model using the defect detection image dataset to obtain a first model.

[0101] Step 102, obtaining an electron microscope image of the industrial casting, and annotating defects on the electron microscope image to obtain an image to be inspected containing annotated text.

[0102] The present invention firstly performs appropriate processing on the industrial casting, such as cutting, grinding, polishing and conductive processing, so as to obtain a clear image under an electron microscope. Then, according to the characteristics of the industrial casting and the required resolution, the acceleration voltage, probe current and other parameters of the electron microscope are adjusted, and different areas of the industrial casting, especially areas where defects may exist, are photographed by an electron microscope (such as a scanning electron microscope, SEM, etc.).

[0103] Import the images taken by the electron microscope into the computer, use image processing software (such as ImageJ, Photoshop, etc.) to perform necessary image enhancements, such as contrast adjustment, noise removal, etc., and select appropriate image annotation tools (such as LabelImg, VGG Image Annotator (VIA)), etc.) to manually annotate the defect areas on the image, which usually involves drawing bounding boxes, arrows or other marks on the image, and adding text annotations to describe the type, size and location of defects, such as pores, cracks, inclusions, shrinkage holes, cold shuts, sand holes, etc. Ensure that the annotation information is associated with the electron microscope image file and saved, and export the image containing the annotation to a commonly used image format, such as JPEG or PNG, for further analysis or reporting.

[0104] Step 103, obtaining a preset defect detection text, where the defect detection text is used to determine defect information of the industrial casting.

[0105] In one embodiment of the present invention, a pre-set defect detection text includes three groups of questions and answers. The questions in the first group of questions and answers are: What type of defects are in the picture? Since the image processing module cannot know in advance what type of defects the image to be detected belongs to during the actual processing of the defect detection text, in actual operation, the first group of questions and answers only contains questions but no corresponding true answer values. The true answer value refers to the known defect type to which the image to be detected belongs, which is an absolutely correct answer.

[0106] The questions in the second set of questions and answers are: What is the cause of this defect? ​​Since the cause corresponding to each type of defect can be set in advance, the second set of answers corresponding to the second set of questions can be set in advance, that is, the cause of the defect.

[0107] The questions in the third set of questions and answers are: What kind of process improvements can be made to address the causes of such defects. Since the third set of answers corresponding to the third set of questions can also be preset, the third set of answers is set to: improvement measures for the causes of such defects.

[0108] Step 104: input the image to be detected and the defect detection text into the first model for defect detection to obtain the detection result corresponding to the industrial casting.

[0109] The defect detection image data set of the present invention includes an electron microscope image of an industrial casting and a defect detection text, and the defect detection text includes a defect detection question and a defect detection answer truth value.

[0110] Each training sample contains a picture (which can be a microscopic electron microscope picture or a macroscopic high-resolution camera picture) and three sets of question and answer annotations. The three sets of questions and answers are: 1) First question: What is the defect in the picture? First answer: Defect type; 2) Second question: What is the cause of this defect? ​​Second answer: Cause of the defect; 3) First question: What process improvement measures can be taken to address this cause? Third answer: Improvement measures.

[0112] In one embodiment, the present invention obtains the first model by the following method:

[0113] Get the visual language model.

[0114] The electron microscope image and defect detection text are input into the visual language model for training to obtain the defect detection answer training value corresponding to the electron microscope image.

[0115] The loss value of the defect detection answer training value is calculated in combination with the true value of the defect detection answer, and the loss value is reversely updated to the visual language model to generate a first model.

[0116] When calculating the loss value of the defect detection answer training value in combination with the true value of the defect detection answer, it can be calculated by cross entropy, binary cross entropy, mean square error, logarithm, hinge method, and the present invention is not limited to this.

[0117] The visual language model of the present invention includes an initial image processing module, an initial text processing module and an initial question-answering module. Therefore, the specific training process after the electron microscope image and the defect detection text are input into the visual language model is as follows.

[0118] The electron microscope image is input into the initial image processing module for feature extraction, vectorization and word embedding to obtain the visual word vector of the electron microscope image.

[0119] The defect detection text is input into the initial text processing module for encoding to obtain the language word vector of the defect detection text. The language word vector includes three groups of question and answer word vectors.

[0120] Reference Figure 2 , the first question word vector in the visual word vector and the language word vector is input into the initial question-answering module to obtain the first answer training value.

[0121] Combined with the first answer truth word vector corresponding to the first question word vector, the loss of the first answer training value is calculated to obtain a first loss value of the first answer training value, and the first loss value is reversely updated to the initial question-answer module.

[0122] The visual word vector, the first answer truth word vector and the second question word vector in the language word vector are input into the initial question-answering module to obtain the second answer training value.

[0123] Combined with the second answer truth word vector corresponding to the second question word vector, the loss of the second answer training value is calculated to obtain a second loss value of the second answer training value, and the second loss value is reversely updated to the initial question and answer module.

[0124] The visual word vector, the second answer truth word vector and the third question word vector in the language word vector are input into the initial question-answering module to obtain the third answer training value.

[0125] Combined with the third answer truth word vector corresponding to the third question word vector, the loss of the third answer training value is calculated to obtain a third loss value of the third answer training value, and the third loss value is reversely updated to the initial question-answer module to generate a first model.

[0126] When the original weights are set to the off state, it means that in the subsequent training process, the values ​​of these weights will not change. This can maintain the model's language understanding and generation capabilities, while reducing the computing resources required for training and preventing overfitting. Therefore, in an embodiment of the present invention, the original weights of the initial question-answering module are set to the off state, and a low-rank matrix layer is added to the initial question-answering module. That is, during the training process, only the weights of the low-rank matrix layer are trainable, which means that the visual language model can be locally fine-tuned by adjusting the weights of the low-rank matrix layer while keeping most of the weights unchanged.

[0127] The above deployment adopts chain thinking in the entire model architecture, gradually guiding the model to answer questions, and utilizing the capabilities of visual language in natural language processing and image understanding, which can more accurately identify and classify various defects of industrial castings.

[0128] In another embodiment of the present invention, the fourth group of questions and answers can be set to infer the tempering temperature based on the cause of the defects, and the fifth group of questions and answers can be set to infer the annealing temperature based on the cause of the defects. After obtaining the third group of answers, the visual word vector is processed in combination with the third group of answers and the fourth group of questions in the fourth group of questions and answers to obtain the corresponding fourth group of answers, and then the visual word vector is processed in combination with the fourth group of answers and the fifth group of questions in the fifth group of questions and answers to obtain the fifth group of answers. In this way, the first model can not only detect defects in industrial castings, but also infer appropriate process parameters based on the causes of the defects, thereby guiding temperature control in the production process and improving product quality and production efficiency.

[0129] Reference Figure 3 , step 104, inputting the image to be detected and the defect detection text into the first model for defect detection, specifically including the following process:

[0130] Since the pre-trained visual language model includes an initial image processing module, an initial text processing module and an initial question-answering module, the first model obtained based on the visual language model training also includes the corresponding image processing module, text processing module and question-answering module.

[0131] The image to be detected is input into the image processing module for feature extraction to obtain the visual word vector of the image to be detected.

[0132] The image processing module of the present invention comprises an image encoder, an intermediate layer and a fully connected layer. The image encoder is used to extract the features of the image to be detected, the intermediate layer is used to generate a feature vector, and the fully connected layer is used to convert the feature vector into

[0133] The feature vector is converted into a word vector. When extracting features from the detection module, the image to be detected is first input into the image encoder for feature extraction to obtain the visual features of the image to be detected.

[0134] The visual features are then input into the middle layer for vectorization to obtain the visual feature vector corresponding to the visual features.

[0135] Finally, the visual feature vector is input into the fully connected layer for word embedding to obtain the visual word vector corresponding to the visual feature vector.

[0136] In the embodiment of the present invention, before inputting the image to be detected into the image processing module, the image to be detected is first adjusted to the size required by the image processing module input. For example, the image processing module requires the input image size to be 224x224 or 299x299 pixels, which is not limited by the present invention. Then the image is normalized in pixel value, usually by scaling the pixel value from [0, 255] to [0, 1], and adjusting the mean and standard deviation according to the requirements of the image processing module. The processed image is input into the image processing module, and forward propagation calculation is performed to extract features from the middle layer or the last layer of the image processing module. The output of the middle layer can be used as a visual word vector, which captures the high-level features of the image.

[0137] The defect detection text is input into the text processing module for feature extraction to obtain the language word vector of the defect detection text.

[0138] The text processing module of the present invention includes a word segmentation editor, and the specific process of feature extraction of defect detection text is as follows:

[0139] Determine whether there are other defect detection texts before obtaining the defect detection text.

[0140] If no other defect detection text exists before the defect detection text, the defect detection text is string formatted to obtain a prompt word text corresponding to the defect detection text.

[0141] If there are other defect detection texts before the defect detection text, the previous defect detection text of the defect detection text is determined from the other defect detection texts.

[0142] In an embodiment of the present invention, there are three groups of questions and answers in the defect detection text. The questions in the first group of questions and answers are: What are the types of defects in the picture? Since the image processing module cannot know in advance which type of defects the image detected this time belongs to during the actual processing of the defect detection text, in the actual operation process, there are only questions in the first group of questions and answers, but no corresponding answers. That is to say, when the defect detection text obtained this time is the first group of questions, then there is no other defect detection text. When the defect detection text obtained this time is the second group of questions, since the visual word vector has been processed in a question-like manner based on the first group of questions, the first group of answers (i.e., the types of defects in industrial castings) are obtained, therefore, there must be other defect detection texts (i.e., the first group of answers). When the defect detection text obtained this time is the third group of questions, since the visual word vector has been processed in a question-like manner based on the first group of questions and the second group of questions, the first group of answers (i.e., the types of defects in industrial castings) and the second group of answers (i.e., the causes of defects in such industrial castings) are obtained, therefore, there must be other defect detection texts (i.e., the first group of answers and the second group of answers).

[0144] When the defect detection text obtained this time is the second set of questions, the only other defect detection texts that exist are the first set of answers. Therefore, the first set of answers is determined to be the previous defect detection text of the current defect detection text. When the defect detection text obtained this time is the third set of questions, the other defect detection texts that exist are the first set of answers and the second set of answers, among which the second set of answers are the other defect detection texts closest to the current defect detection text. Therefore, the second set of answers is determined to be the previous defect detection text of the current defect detection text.

[0145] The defect detection text and the previous defect detection text are concatenated to obtain a concatenated text, and a string formatting process is performed on the concatenated text to obtain a prompt word text corresponding to the defect detection text.

[0146] String formatting is to format the string. For example, for the first set of questions and answers, the visual language model outputs the defect type of industrial castings as "pores" after processing. When conducting the second set of questions and answers, "pores" needs to be filled in the placeholder <defect type> in the question. The string formatting result of the second set of questions and answers is:

[0147] ###Known defects are pores

[0148] ### What is the cause of this defect?

[0149] ###Please answer

[0150] This operation of replacing placeholders with actual variables in practice is string formatting.

[0151] The string formatting processing in the embodiment of the present invention is divided into two categories, one is the case where there is a previous defect detection text, and the other is the case where there is no previous defect detection text:

[0152] For the first group of each data sample, since it does not have the previous defect detection text, the string formatting result is:

[0153] ### What kind of defects are shown in the picture?

[0154] ###Please answer:

[0155] For the second and third sets of questions and answers of each data sample, there is the previous defect detection text, so the string formatting result is:

[0156] ###Known defects are <defect type>

[0157] ### What is the cause of this defect?

[0158] ###Please answer:

[0159] ###The known cause of this defect is <cause of defect>

[0160] ### What process improvement measures can be taken to address this reason?

[0161] ###Please answer:

[0162] In the string formatting result, <> is a placeholder. Represents the visual word vector of the inserted industrial casting, while other placeholders are based on the answers to the previous set of questions and answers that are inserted.

[0163] Input the prompt word text into the word segmentation editor for encoding to obtain the language word vector corresponding to the prompt word text.

[0164] In an embodiment of the present invention, the defect detection text is segmented into word or sub-word units, and then, as needed, stop words in the text (such as common but less informative words like "of", "is", "in", etc.) are removed, and the words are restored to their basic forms to reduce the vocabulary and improve the quality of word vectors. The processed defect detection text is input into a text processing module for feature extraction to obtain language word vectors, which represent the high-level features of the text. In addition, the language word vectors can be post-processed as needed, such as dimensionality reduction (using methods like PCA, t-SNE, etc.) or normalization.

[0165] The visual word vectors and the language word vectors are concatenated and then input into a question-answering module for defect detection to obtain output word vectors. Among them, when concatenating, the visual word vectors are linearly projected to the same dimension as the language word vectors.

[0166] When concatenating the visual word vectors and the language word vectors, it is necessary to ensure that the dimensions of the visual word vectors and the language word vectors match. If the dimensions do not match, one of the vectors may need to be adjusted through dimensionality reduction or dimensionality increase operations. In an embodiment of the present invention, the visual word vectors are linearly projected to the same dimension as the language word vectors.

[0167] As mentioned above, the defect detection text consists of three sets of questions and answers. Therefore, the concatenated input word vectors contain the feature word vectors of these three sets of questions and answers. Therefore, after the input word vectors are input into the question-answering module, first, the visual word vectors in the input word vectors are processed in combination with the question feature word vectors of the first set of questions and answers to obtain the defect types of industrial castings as the first set of answers. Then, the first set of answers is concatenated with the second set of questions in a string formatting manner. Then, the concatenated first set of answers and the second set of

[0168] questions are reversely input into the text processing module to obtain second language word vectors. The second language word vectors and the visual word vectors are concatenated again and input into the question-answering module to obtain the second set of answers, that is, the reasons for the generation of such industrial casting defects. After that, the second set of answers is concatenated with the third set of questions in a string formatting manner. The concatenated second set of answers and the third set of questions are reversely input into the text processing module to obtain third language word vectors. The third language word vectors and the visual word vectors are concatenated again and input into the question-answering module to obtain the third set of answers, that is, the improvement measures for the reasons for the generation of such industrial castings.

[0169] The output word vectors are decoded, and the detection results for industrial castings are obtained in combination with the defect information.

[0170] After obtaining the output word vector, it is necessary to decode the output word vector. Decoding and encoding are inverse processes. Encoding encodes the text of natural language into word vectors, and decoding decodes the word vectors into natural language text. Therefore, after decoding the output word vector composed of the first group of answers, the second group of answers and the third group of answers, the defect detection results of this industrial casting can be obtained.

[0171] The embodiment of the present invention obtains an electron microscope image of an industrial casting, and annotates defects on the electron microscope image to obtain an image to be detected containing annotated text, inputs the image to be detected into an image processing module for processing to obtain a visual word vector of the image to be detected, inputs the defect detection text into a text processing module for processing to obtain a language word vector of the defect detection text, splices the visual word vector with the language word vector to obtain the spliced ​​word vector to be input, inputs the word vector to be input into a question-and-answer module for processing to obtain an output word vector corresponding to the word vector to be input, decodes the output word vector, and obtains a defect detection result for the industrial casting in combination with the defect information. The embodiment of the present invention uses the electron microscope image of the industrial casting as input data, manually annotates the defects, and fine-tunes the visual language model according to the annotated data set, so that the model can understand and analyze the nature and causes of industrial casting defects, and provide an effective reference for subsequent improvement measures.

[0172] Reference Figure 4 , shows a schematic structural diagram of an industrial defect detection device provided by an embodiment of the present invention, the device may include:

[0173] A model training module 401 is used to obtain a defect detection image dataset, train a visual language model through the defect detection image dataset, and obtain a first model;

[0174] The image acquisition module 402 is used to acquire an electron microscope image of an industrial casting and annotate defects on the electron microscope image to obtain an image to be inspected containing annotated text.

[0175] The text acquisition module 403 is used to acquire a preset defect detection text, and the defect detection text is used to determine the defect information of the industrial casting.

[0176] The defect detection module 404 is used to input the image to be detected and the defect detection text into the first model to perform defect detection and obtain the detection result corresponding to the industrial casting.

[0177] Optionally, the defect detection image data set includes an electron microscope image of an industrial casting and defect detection text, and the defect detection text includes a defect detection question and a defect detection answer truth value;

[0178] The model training module 401 is specifically used for:

[0179] Get the visual language model;

[0180] Input the electron microscope image and defect detection text into the visual language model for training, and obtain the defect detection answer training value corresponding to the electron microscope image;

[0181] The loss value of the defect detection answer training value is calculated in combination with the true value of the defect detection answer, and the loss value is reversely updated to the visual language model to generate the first model.

[0182] Optionally, the visual language model includes an initial image processing module, an initial text processing module and an initial question-answering module;

[0183] The model training module 401 is specifically used for:

[0184] Input the electron microscope image into the initial image processing module for feature extraction, vectorization and word embedding to obtain the visual word vector of the electron microscope image;

[0185] Input the defect detection text into the initial text processing module for encoding to obtain the language word vector of the defect detection text. The language word vector includes three sets of question-answer word vectors.

[0186] Input the first question word vector in the visual word vector and the language word vector into the initial question-answering module to obtain the first answer training value;

[0187] Combined with the first answer truth word vector corresponding to the first question word vector, the first answer training value is subjected to loss calculation to obtain a first loss value of the first answer training value, and the first loss value is reversely updated to the initial question-answering module;

[0188] Input the visual word vector, the first answer truth word vector, and the second question word vector in the language word vector into the initial question-answering module to obtain the second answer training value;

[0189] Combined with the second answer truth word vector corresponding to the second question word vector, the second answer training value is subjected to loss calculation to obtain a second loss value of the second answer training value, and the second loss value is reversely updated to the initial question-answering module;

[0190] Input the visual word vector, the second answer truth word vector, and the third question word vector in the language word vector into the initial question-answering module to obtain a third answer training value;

[0191] Combined with the third answer truth word vector corresponding to the third question word vector, the loss of the third answer training value is calculated to obtain a third loss value of the third answer training value, and the third loss value is reversely updated to the initial question-answer module to generate a first model.

[0192] Optionally, the model training module 401 is specifically used for:

[0193] The original weights of the initial question-answering module are set to the closed state, and a low-rank matrix layer is added to the initial question-answering module, and the visual language model is locally fine-tuned according to the low-rank matrix layer.

[0194] Optionally, the first model includes an image processing module, a text processing module and a question-answering module;

[0195] The defect detection module 404 is specifically used for:

[0196] Input the image to be detected into the image processing module for feature extraction to obtain the visual word vector of the image to be detected;

[0197] Input the defect detection text into the text processing module for feature extraction to obtain the language word vector of the defect detection text;

[0198] The visual word vector is concatenated with the language word vector and then input into the question-answering module for defect detection to obtain an output word vector. When concatenating, the visual word vector is linearly projected to the same dimension as the language word vector.

[0199] The output word vector is decoded and combined with the defect information to obtain the inspection results for industrial castings.

[0200] Optionally, the image processing module includes an image encoder, an intermediate layer, and a fully connected layer;

[0201] The defect detection module 404 is specifically used for:

[0202] Input the image to be detected into the image encoder for feature extraction to obtain the visual features of the image to be detected;

[0203] Input the visual features into the middle layer for vectorization to obtain the visual feature vector corresponding to the visual features;

[0204] The visual feature vector is input into the fully connected layer for word embedding to obtain the visual word vector corresponding to the visual feature vector.

[0205] Optionally, the text processing module includes a word segmentation editor;

[0206] The defect detection module 404 is specifically used for:

[0207] Determine whether there are other defect detection texts before obtaining the defect detection text;

[0208] If there is no other defect detection text before the defect detection text, the defect detection text is string formatted to obtain a prompt word text corresponding to the defect detection text;

[0209] If there are other defect detection texts before the defect detection text, the previous defect detection text of the defect detection text is determined from the other defect detection texts;

[0210] Splicing the defect detection text with the previous defect detection text to obtain a spliced ​​text, and performing string formatting on the spliced ​​text to obtain a prompt word text corresponding to the defect detection text;

[0211] Input the prompt word text into the word segmentation editor for encoding to obtain the language word vector corresponding to the prompt word text.

[0212] The embodiment of the present invention obtains the first model by pre-training the visual language model, obtains the electron microscope image of the industrial casting, annotates the defects of the electron microscope image, obtains the image to be detected containing the annotated text, and then obtains the defect detection text for determining the defect information of the industrial casting, inputs the image to be detected and the defect detection text into the first model for defect detection, and obtains the detection result corresponding to the industrial casting. The embodiment of the present invention uses the electron microscope image of the industrial casting as input data, manually annotates the defects, and fine-tunes the visual language model according to the annotated data set, so that the model can understand and analyze the nature and causes of industrial casting defects, and provide an effective reference for subsequent improvement measures.

[0213] The embodiment of the present invention further provides an electronic device, such as Figure 5 As shown, it includes a processor 501, an interface 502, a memory 503 and a bus 504, wherein:

[0214] Memory 503, used for storing computer programs;

[0215] The processor 501 is used to execute the program stored in the memory 503, and implements the following steps:

[0216] Obtain a defect detection image dataset, and train a visual language model using the defect detection image dataset to obtain a first model;

[0217] Obtain an electron microscope image of an industrial casting, and annotate the defects of the electron microscope image to obtain an image to be inspected containing annotated text;

[0218] Obtaining a preset defect detection text, the defect detection text is used to determine defect information of industrial castings;

[0219] The image to be detected and the defect detection text are input into the first model for defect detection to obtain the corresponding detection result of the industrial casting.

[0220] The bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus.

[0221] line or a type of bus.

[0222] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Alternatively, the memory may also be at least one storage device located away from the aforementioned processor.

[0223] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0224] The present invention also provides a storage medium. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the industrial defect detection method of the aforementioned embodiment.

[0225] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0226] The algorithm and display provided herein are not inherently related to any particular computer, virtual device or other equipment. According to the above description, it is obvious that the structure required for constructing this type of device is. In addition, the present invention is not directed to any specific programming language. It should be understood that various programming languages ​​can be utilized to realize the content of the present invention described herein, and the description of the above specific language is to disclose the best mode of the present invention.

[0227] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0228] Similarly, it should be understood that in order to streamline the present invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this method of disclosure should not be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as reflected in the claims below, inventive aspects lie in less than all of the features of a single embodiment disclosed above. Therefore, the claims that follow the detailed description are hereby expressly incorporated into this detailed description, with each claim hereof being hereby expressly incorporated into the detailed description.

[0229] Each claim itself constitutes a separate embodiment of the present invention.

[0230] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0231] The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in the sorting device according to the present invention. The present invention may also be implemented as a device or apparatus program for executing part or all of the methods described herein. Such a program for implementing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0232] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc., does not indicate any order. These words may be interpreted as names.

[0233] Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the above-described devices, apparatuses and units can refer to the corresponding working processes in the above-mentioned method embodiments.

[0234] The process will not be described in detail here.

[0235] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

[0236] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

[0237] It should be noted that the various data-related processes in the embodiments of the present application are all carried out in compliance with the corresponding data protection laws and policies of the country where the device is located, and with the authorization given by the owner of the corresponding device.

Claims

1. A method for detecting industrial defects, characterized in that: The method comprises: Acquire a defect detection image dataset, and train a visual language model using the defect detection image dataset to obtain a first model; Acquire an electron microscope image of an industrial casting, and annotate defects on the electron microscope image to obtain an image to be inspected containing annotated text; Acquire a preset defect detection text, wherein the defect detection text is used to determine defect information of the industrial casting; The image to be detected and the defect detection text are input into the first model for defect detection to obtain the detection result corresponding to the industrial casting.

2. The method according to claim 1, characterized in that The defect detection image data set includes electron microscope images of industrial castings and defect detection texts, and the defect detection texts include defect detection questions and defect detection answer truth values; The step of training a visual language model by using the defect detection image dataset to obtain a first model includes: Get the visual language model; Inputting the electron microscope image and the defect detection text into the visual language model for training to obtain a defect detection answer training value corresponding to the electron microscope image; The loss value of the defect detection answer training value is calculated in combination with the true value of the defect detection answer, and the loss value is reversely updated to the visual language model to generate the first model.

3. The method according to claim 1, characterized in that The visual language model includes an initial image processing module, an initial text processing module and an initial question-answering module, and the method further includes: Inputting the electron microscope image into the initial image processing module for feature extraction, vectorization and word embedding to obtain a visual word vector of the electron microscope image; Input the defect detection text into the initial text processing module for encoding to obtain a language word vector of the defect detection text, wherein the language word vector includes three groups of question-answer word vectors; Inputting the visual word vector and the first question word vector in the language word vector into the initial question-answering module to obtain a first answer training value; Combined with the first answer truth word vector corresponding to the first question word vector, the first answer training value is subjected to loss calculation to obtain a first loss value of the first answer training value, and the first loss value is reversely updated to the initial question-answering module; Inputting the visual word vector, the first answer truth word vector and the second question word vector in the language word vector into the initial question-answering module to obtain a second answer training value; Combined with the second answer truth word vector corresponding to the second question word vector, the second answer training value is subjected to loss calculation to obtain a second loss value of the second answer training value, and the second loss value is reversely updated to the initial question-answering module; Inputting the visual word vector, the second answer truth word vector and the third question word vector in the language word vector into the initial question-answering module to obtain a third answer training value; In combination with the third answer truth word vector corresponding to the third question word vector, the loss of the third answer training value is calculated to obtain a third loss value of the third answer training value, and the third loss value is reversely updated to the initial question-answer module to generate the first model.

4. The method according to claim 2, characterized in that: The method further comprises: The original weight of the initial question-answering module is set to a closed state, and a low-rank matrix layer is added to the initial question-answering module, and the visual language model is locally fine-tuned according to the low-rank matrix layer.

5. The method according to claim 1, characterized in that The first model includes an image processing module, a text processing module and a question-answering module; The step of inputting the image to be detected and the defect detection text into the first model for defect detection includes: Inputting the image to be detected into the image processing module for feature extraction to obtain a visual word vector of the image to be detected; Inputting the defect detection text into the text processing module for feature extraction to obtain a language word vector of the defect detection text; splicing the visual word vector and the language word vector and inputting them into the question-answering module for defect detection to obtain an output word vector, wherein when splicing, the visual word vector is linearly projected to the same dimension as the language word vector; The output word vector is decoded and combined with the defect information to obtain a detection result for the industrial casting.

6. The method according to claim 5, characterized in that The image processing module includes an image encoder, an intermediate layer and a fully connected layer; The step of inputting the image to be detected into the image processing module for feature extraction to obtain a visual word vector of the image to be detected includes: Inputting the image to be detected into the image encoder to extract features, thereby obtaining visual features of the image to be detected; Inputting the visual feature into the intermediate layer for vectorization to obtain a visual feature vector corresponding to the visual feature; The visual feature vector is input into the fully connected layer for word embedding to obtain a visual word vector corresponding to the visual feature vector.

7. The method according to claim 5, characterized in that The text processing module includes a word segmentation editor; The step of inputting the defect detection text into the text processing module for feature extraction to obtain a language word vector of the defect detection text includes: Determining whether there are other defect detection texts before obtaining the defect detection text; If no other defect detection text exists before the defect detection text, the defect detection text is subjected to string formatting processing to obtain a prompt word text corresponding to the defect detection text; If there are other defect detection texts before the defect detection text, determining the previous defect detection text of the defect detection text from the other defect detection texts; Splicing the defect detection text with the previous defect detection text to obtain a spliced ​​text, and performing string formatting processing on the spliced ​​text to obtain a prompt word text corresponding to the defect detection text; The prompt word text is input into the word segmentation editor for encoding to obtain a language word vector corresponding to the prompt word text.

8. An industrial defect detection device, characterized in that: include: A model training module is used to obtain a defect detection image dataset, and train a visual language model through the defect detection image dataset to obtain a first model; An image acquisition module is used to acquire an electron microscope image of an industrial casting and annotate defects on the electron microscope image to obtain an image to be inspected containing annotated text; A text acquisition module, used to acquire a preset defect detection text, wherein the defect detection text is used to determine defect information of the industrial casting; The defect detection module is used to input the image to be detected and the defect detection text into the first model for defect detection to obtain the detection result corresponding to the industrial casting.

9. An electronic device, characterized in that: include: A memory, a processor, and a program stored in the memory and executable on the processor; The processor is used to read the program in the memory to implement the steps in the industrial defect detection method as claimed in any one of claims 1 to 7.

10. A computer-readable storage medium for storing a program, characterized in that: When the program is executed by a processor, the steps of the industrial defect detection method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Fabric surface defect classification deep network method based on biological visual inspiration

    CN115147341A

  • Industrial defect detection method and device based on pre-training model and storage medium

    CN116468725A

  • Open domain visual language question answering method and device, electronic equipment and storage medium

    CN116561272A

  • Anomaly detection method and device based on large visual language model

    CN117745680A

  • Detection method for visual language large model with fusion module

    CN117809008A

Cited By

  • Steel ladle hoisting safety monitoring and early warning method, system, equipment and medium

    CN121191081A

  • Machine-learning based defect identification in images of computing devices

    US12762686B2

  • Machine-learning based defect identification in images of computing devices

    US20260187775A1