Welding radiograph defect detection method, device, computer equipment and medium

Through the combination of the preset visual segmentation model and the visual language model, the problems of low efficiency and insufficient accuracy of defect detection in traditional welding radiographs are solved, and efficient and accurate welding defect detection without manual participation is achieved.

CN118314123BActive Publication Date: 2024-08-27SHANGHAI WISON OFFSHORE & MARINE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410719654.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2024-08-27
Estimated Expiration
2044-06-05

AI Technical Summary

Technical Problem

Traditional welding radiograph defect detection technology relies on manual analysis, which is inefficient and easily affected by experience and ability, making it difficult to achieve efficient and accurate welding defect identification.

Method used

The initial welding radiographs are preprocessed using a preset visual segmentation model to generate mask radiographs and input into the trained visual language model together with the preset welding defect query text to maximize the relationship between real image-text pairs. Consistency optimization trained visual language model for detection.

Benefits of technology

It achieves efficient and accurate welding defect detection without manual participation, significantly improves detection efficiency, and can obtain more accurate results from two dimensions based on images and text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118314123B
    Figure CN118314123B
Patent Text Reader

Abstract

The present application relates to a welding radiograph defect detection method, device, computer equipment and medium, wherein the method comprises: obtaining an initial welding radiograph; preprocessing the initial welding radiograph using a preset visual segmentation model to obtain a mask radiograph, wherein the welding defect mask in the mask radiograph is saved as a preset color overlay superimposed on the initial welding radiograph; inputting the mask radiograph and the preset welding defect query text into a trained visual language model; and obtaining a welding defect detection result according to the output result of the trained visual language model. In the whole process, the initial welding radiograph is preprocessed using a preset visual segmentation model to mark the welding defect mask, and then the defect detection is performed from two dimensions of image and text through the trained visual language model. The whole scheme can realize efficient and accurate welding defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image recognition technology, and in particular to a welding radiograph defect detection method, apparatus, computer equipment, storage medium and computer program product. Background Art

[0002] In the shipbuilding industry, welding accounts for more than 60% of the entire process. Therefore, an automated process is needed to identify and classify welding defects to improve the efficiency and reliability of the quality control system.

[0003] Among traditional technologies, there are various welding inspection techniques such as radiographic testing, ultrasonic testing, and magnetic testing used as non-destructive testing. Radiographic testing is one of the most common non-destructive testing methods and involves capturing images of welded structures using an X-ray or gamma-ray source. These images are usually analyzed by trained professionals or automated systems to identify any potential defects in the weld, such as incomplete fusion, porosity, or lack of penetration.

[0004] However, traditional visual inspection and analysis techniques are easily affected by factors such as technicians' experience and ability, and the identification process is very time-consuming. Summary of the invention

[0005] Based on this, it is necessary to provide an efficient and accurate welding radiograph defect detection method, device, computer equipment, storage medium and computer program product to address the above technical problems.

[0006] In a first aspect, the present application provides a method for detecting defects in welding radiographs. The method comprises:

[0007] Obtain initial weld radiographs;

[0008] Preprocessing the initial welding radiograph using a preset visual segmentation model to obtain a mask radiograph, wherein a welding defect mask in the mask radiograph is saved as a preset color overlay superimposed on the initial welding radiograph;

[0009] Inputting the mask radiograph and a preset welding defect query text into a trained visual language model;

[0010] Obtaining welding defect detection results according to the output results of the trained visual language model;

[0011] The trained visual language model is trained based on maximizing the consistency between real image-text pairs.

[0012] In one embodiment, the preprocessing of the initial welding radiograph using a preset visual segmentation model to obtain a mask radiograph comprises:

[0013] inputting the initial welding radiograph into a preset visual segmentation model;

[0014] Obtaining a welding defect mask in the initial welding radiograph by using the preset visual segmentation model;

[0015] A preset color overlay layer is used to cover the welding defect mask to obtain a mask radiograph.

[0016] In one embodiment, before inputting the mask radiograph and the preset welding defect query text into the trained visual language model, the method further includes:

[0017] Acquire an initial welding visual language model and training data pairs, wherein the training data pairs include image-text pairs of welding defects;

[0018] Convert each input image and text in the training data pair into a d-dimensional vector representation to obtain an image vector and a text vector;

[0019] The initial welding visual language model is trained based on the image vector and the text vector until the loss value of the image-text pair is minimized, thereby obtaining a trained visual language model.

[0020] In one embodiment, converting each input image and text in the training data pair into a d-dimensional vector representation to obtain an image vector and a text vector comprises:

[0021] Obtain each input image and text in the training data pair respectively;

[0022] A sampling transformation function corresponding to the initial welding visual language model is used to draw a random view from each input image; an image encoder corresponding to the initial welding visual language model is used to convert the random view into a fixed-dimensional vector, and the fixed-dimensional vector is converted into a d-dimensional image vector by a preset image projection function;

[0023] The text conversion function corresponding to the initial welding visual language model is adopted to obtain the span text of the text; based on the span text, the text encoder corresponding to the initial welding visual language model and the preset text projection function, a d-dimensional text vector is obtained.

[0024] In one embodiment, the initial welding visual language model is trained based on the image vector and the text vector until the loss value of the image-text pair is minimized, and the trained visual language model is obtained, comprising:

[0025] Inputting the image vector and the text vector into the initial welding visual language model for iterative training;

[0026] Get the first contrast loss from image to text and the second contrast loss from text to image during training;

[0027] Weighted calculation of the first contrast loss and the second contrast loss to obtain a combined loss;

[0028] The model parameters of the welding visual language model are adjusted during the training process until the combination loss is minimized to obtain a trained visual language model.

[0029] In one of the embodiments, the image encoder adopts a ResNet50 architecture, and the text encoder includes a BERT (Bidirectional Encoder Representations from Transformers) encoder, and the embedding and front preset layer transformer layers of the BERT encoder are frozen to adapt to the image-text comparison task.

[0030] In one of the embodiments, the preset image projection function and the preset text projection function perform vector projection through a single hidden layer neural network.

[0031] In a second aspect, the present application also provides a welding radiograph defect detection device. The device comprises:

[0032] An initial data acquisition module, used to acquire initial welding radiographs;

[0033] A preprocessing module, configured to preprocess the initial welding radiograph using a preset visual segmentation model to obtain a mask radiograph, wherein a welding defect mask in the mask radiograph is saved as a preset color overlay superimposed on the initial welding radiograph;

[0034] An input module, used for inputting the mask radiograph and a preset welding defect query text into a trained visual language model;

[0035] A detection module, used to obtain a welding defect detection result according to the output result of the trained visual language model;

[0036] The trained visual language model is trained based on maximizing the consistency between real image-text pairs.

[0037] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0038] Obtain initial weld radiographs;

[0039] Preprocessing the initial welding radiograph using a preset visual segmentation model to obtain a mask radiograph, wherein a welding defect mask in the mask radiograph is saved as a preset color overlay superimposed on the initial welding radiograph;

[0040] Inputting the mask radiograph and a preset welding defect query text into a trained visual language model;

[0041] Obtaining welding defect detection results according to the output results of the trained visual language model;

[0042] The trained visual language model is trained based on maximizing the consistency between real image-text pairs.

[0043] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0044] Obtain initial weld radiographs;

[0045] Preprocessing the initial welding radiograph using a preset visual segmentation model to obtain a mask radiograph, wherein a welding defect mask in the mask radiograph is saved as a preset color overlay superimposed on the initial welding radiograph;

[0046] Inputting the mask radiograph and a preset welding defect query text into a trained visual language model;

[0047] Obtaining welding defect detection results according to the output results of the trained visual language model;

[0048] The trained visual language model is trained based on maximizing the consistency between real image-text pairs.

[0049] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0050] Obtain initial weld radiographs;

[0051] Preprocessing the initial welding radiograph using a preset visual segmentation model to obtain a mask radiograph, wherein a welding defect mask in the mask radiograph is saved as a preset color overlay superimposed on the initial welding radiograph;

[0052] Inputting the mask radiograph and a preset welding defect query text into a trained visual language model;

[0053] Obtaining welding defect detection results according to the output results of the trained visual language model;

[0054] The trained visual language model is trained based on maximizing the consistency between real image-text pairs.

[0055] The above-mentioned welding radiograph defect detection method, device, computer equipment, storage medium and computer program product obtain an initial welding radiograph; use a preset visual segmentation model to preprocess the initial welding radiograph to obtain a mask radiograph, and the welding defect mask in the mask radiograph is saved as a preset color overlay superimposed on the initial welding radiograph; input the mask radiograph and the preset welding defect query text into the trained visual language model; and obtain the welding defect detection result according to the output result of the trained visual language model. In the whole process, the preset visual segmentation model is used to preprocess the initial welding radiograph, mark the welding defect mask, and then the trained visual language model is used to perform defect detection from two dimensions of image and text. Since the trained visual language model is optimized and trained based on maximizing the consistency between real image-text pairs, more accurate results can be obtained based on images and texts, and there is no need to rely on manual defect identification, and the defect detection efficiency can also be significantly improved. The whole scheme can achieve efficient and accurate welding defect detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 A diagram showing an application environment of a welding radiograph defect detection method in one embodiment;

[0057] Figure 2 A schematic diagram of a process of a welding radiograph defect detection method in one embodiment;

[0058] Figure 3 Schematic diagram for pre-processing a weld radiograph by masking weld defects with a red overlay;

[0059] Figure 4 It is a schematic diagram of the WeldCLIP model structure;

[0060] Figure 5 A schematic diagram of a process of a welding radiograph defect detection method in another embodiment;

[0061] Figure 6 is a structural block diagram of a welding radiograph defect detection device in one embodiment;

[0062] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0063] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0064] The welding radiograph defect detection method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The terminal 102 sends a welding defect detection request to the server 104. After receiving the welding defect detection request sent by the terminal 102, the server 104 parses the request to obtain the initial welding radiograph; the initial welding radiograph is preprocessed using a preset visual segmentation model to obtain a mask radiograph, and the welding defect mask in the mask radiograph is saved as a preset color overlay superimposed on the initial welding radiograph; the mask radiograph and the preset welding defect query text are input into the trained visual language model; according to the output result of the trained visual language model, the welding defect detection result is obtained. Further, the server 104 can feed back the final welding defect detection result to the terminal 102. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices, and the Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. The portable wearable device may be a smart watch, a smart bracelet, a head-mounted device, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.

[0065] In one embodiment, Figure 2 As shown, a welding radiograph defect detection method is provided, and the method is applied to Figure 1 Taking the server 104 in the example as an example, the following steps are included:

[0066] S200: Obtain initial welding radiographs.

[0067] Initial welding radiographs refer to radiographs taken during the welding process to check the welding quality. These photos are usually taken by X-ray or gamma ray to see through the internal structure of the weld joint and possible defects. There are many types of welding defects. In practical applications, a diverse and comprehensive weld radiographic testing (WRT) dataset can be collected and summarized. Welding radiographs and corresponding non-destructive testing reports are manually annotated by radiographic testing (RT) experts. Different types of welding defects can be covered in this dataset, such as cold lap, porosity, slag inclusion, lack of penetration, lack of fusion, voids, undercuts, cracks, etc.

[0068] S400: Preprocessing the initial welding radiograph using a preset visual segmentation model to obtain a mask radiograph, wherein the welding defect mask in the mask radiograph is saved as a preset color overlay superimposed on the initial welding radiograph.

[0069] The preset visual segmentation model is a pre-built model that can detect welding defects from the initial welding radiograph, that is, predict the welding defect mask. After predicting the welding defect mask, it is saved as a preset color overlay of the initial welding radiograph to enhance the training and detection of the next visual language model. The preset visual segmentation model can specifically be WeldSAM (Weld Segment Anything Model). The preset color can be set according to the actual needs. It can be set to red, yellow, blue, etc. In order to significantly distinguish other normal areas, it is generally not considered to be set to grayscale. Specifically, Figure 3 As shown, the weld radiograph is pre-processed here by using a red overlay to conceal weld defects.

[0070] Specifically, the above processing includes the following: 1) Select a visual segmentation model: First, you need to select a suitable visual segmentation model. This model should be pre-trained and can identify and segment the welding defect parts in the welding radiograph. 2) Apply the model for preprocessing: Input the initial welding radiograph into the selected visual segmentation model. The model will analyze the photo and identify the welding defect area therein. 3) Generate a mask radiograph: After the model identifies the defect area, it will generate a mask that matches the size of the initial welding radiograph and marks the corresponding area at the defect location. 4) Color overlay: In order to more intuitively display the defect location, the defect area in the mask can be superimposed on the initial welding radiograph. This overlay can use a preset color for easy observation and identification. In this way, in the mask radiograph, the welding defect mask is saved as a preset color overlay superimposed on the initial welding radiograph.

[0071] S600: Inputting the mask radiograph and the preset welding defect query text into the trained visual language model; wherein the trained visual language model is optimized and trained based on maximizing the consistency between real image-text pairs.

[0072] The trained visual language model is a pre-trained visual language model, which is trained by maximizing the consistency between real image-text pairs. Specifically, the consistency between image-text pairs can be represented by the bidirectional loss of image→text and text→image, and maximizing the consistency between real image-text pairs corresponds to the minimum bidirectional loss. The trained visual language model can be a trained CLIP (Contrastive Language-ImagePre-Training) visual language model, that is, the trained CLIP visual language model is used here to detect defects in welding radiographs. CLIP is a visual language pre-training model launched by OpenAI. Its core idea is to achieve better mutual understanding between images and texts by establishing the association between images and texts and measuring the similarity between images and texts. The basic principles of the CLIP model cover reinforcement learning, adversarial learning, and feedback learning. Its implementation is based on combining and matching a large number of images and corresponding text information to build a large-scale data set.

[0073] Furthermore, the visual language model trained here can be a model specially trained for welding defects, which is specifically WeldCLIP that can identify and classify defects in welding radiographs. The specific structure of the entire model is as follows Figure 4 As shown, it relies on maximizing the bidirectional loss and The consistency between the real image-text representation pairs is obtained by training. The specific training process of the trained visual language model will be further explained in the subsequent content.

[0074] S800: Obtain welding defect detection results according to the output results of the trained visual language model.

[0075] After the mask radiograph and the preset welding defect query text are input into the trained visual language model, the trained visual language model will output the corresponding result, that is, the welding defect detection result.

[0076] The above welding radiograph defect detection method obtains an initial welding radiograph; uses a preset visual segmentation model to preprocess the initial welding radiograph to obtain a mask radiograph, and the welding defect mask in the mask radiograph is saved as a preset color overlay superimposed on the initial welding radiograph; inputs the mask radiograph and the preset welding defect query text into the trained visual language model; and obtains the welding defect detection result according to the output result of the trained visual language model. In the whole process, the preset visual segmentation model is used to preprocess the initial welding radiograph, mark the welding defect mask, and then the trained visual language model is used to perform defect detection from two dimensions: image and text. Since the trained visual language model is optimized and trained based on maximizing the consistency between real image-text pairs, more accurate results can be obtained based on images and texts, and there is no need to rely on manual defect identification, and the defect detection efficiency can be significantly improved. The whole solution can achieve efficient and accurate welding defect detection.

[0077] like Figure 5 As shown, in one embodiment, S400 includes:

[0078] S420: Input the initial welding radiograph into a preset visual segmentation model.

[0079] The initial weld radiographs taken or acquired are used as input data and imported into a pre-trained visual segmentation model. This model is usually trained based on deep learning or other machine learning methods and has the ability to identify and segment specific areas in the image (such as weld defects).

[0080] S440: Obtain a welding defect mask in the initial welding radiograph by using a preset visual segmentation model.

[0081] The preset visual segmentation model processes the input welding radiographs. The model distinguishes the welding defect area from the background or other non-defective areas by identifying features in the image (such as color, texture, shape, etc.). After processing, the model outputs a mask, which is a binary image of the same size as the original image, in which the welding defect area is marked as red (or other specific colors) and the non-defective area is marked as a gray background (or other colors relative to white).

[0082] S460: A preset color overlay is used to cover the welding defect mask to obtain a mask radiograph.

[0083] The resulting weld defect mask is superimposed on the original weld radiograph to more intuitively display the location and size of the defect. This is usually achieved by adding a color overlay to the original image, the color, transparency and other properties of which can be set as required. In this color overlay, the weld defect area will be displayed in a color that contrasts sharply with the background or other areas of the original image, making it easier to identify and evaluate.

[0084] In general, the preset visual segmentation model processes the input initial welding radiograph, identifies the welding defect mask in the initial welding radiograph, and then uses the preset color overlay to cover the welding defect mask, and finally forms a mask radiograph. The entire specific implementation process can be found in Figure 3 .

[0085] like Figure 5 As shown, in one embodiment, before S600, the method further includes:

[0086] S520: Acquire an initial welding visual language model and a training data pair, where the training data pair includes an image-text pair of welding defects.

[0087] The training data pairs should include images of welding defects and text descriptions associated with these images (i.e., image-text pairs). The images can be radiographs of the welding process or other types of images, which contain various welding defects. The text descriptions should accurately reflect the type, location, and degree of welding defects in the images. These data pairs need to be carefully annotated and organized for the subsequent training process. Specifically, training data pairs can be organized from actual production applications, such as a diverse and comprehensive weld radiographic testing (WRT) dataset curated from a shipyard. The welding radiographs and corresponding non-destructive testing reports are manually annotated by radiographic testing (RT) experts. The dataset covers different types of welding defects, such as cold lap, porosity, slag inclusion, lack of penetration, lack of fusion, voids, undercuts, cracks, etc.

[0088] S540: Convert each input image and text in the training data pair into a d-dimensional vector representation to obtain an image vector and a text vector.

[0089] Use appropriate feature extractors to convert each input image and text into a d-dimensional vector representation. These vector representations should be able to capture the key information in the image and text and can be compared and matched in the same vector space.

[0090] S560: Train the initial welding visual language model based on the image vector and the text vector until the loss value of the image-text pair is minimized, thereby obtaining a trained visual language model.

[0091] Based on the image vector and text vector, the initial welding visual language model is trained using an appropriate loss function. The goal of the training is to enable the model to accurately match image and text pairs, that is, when given an image, the model can generate the most relevant text description for the image; vice versa. During the training process, the performance of the model can be optimized by adjusting the model parameters, optimizer, learning rate and other hyperparameters.

[0092] In one embodiment, each input image and text in the training data pair is converted into a d-dimensional vector representation, and the image vector and text vector are obtained, including:

[0093] Each input image and text in the training data pair is obtained respectively; a random view from each input image is drawn using a sampling transformation function corresponding to the initial welding visual language model; the random view is converted into a fixed-dimensional vector using an image encoder corresponding to the initial welding visual language model, and the fixed-dimensional vector is converted into a d-dimensional image vector using a preset image projection function; the span text of the text is obtained using a text conversion function corresponding to the initial welding visual language model; a d-dimensional text vector is obtained based on the span text, the text encoder corresponding to the initial welding visual language model, and the preset text projection function.

[0094] To explain the above process in detail, Figure 4 Expand the description. Take the corresponding input image and text in each training data pair as an example. Each input image and text Convert to d-dimensional vector representation and For each input image , using the sampling transformation function Drawing from Random Views ,in represents the family of random image transformation functions described later. Next, the image encoder function Will Convert to a fixed-dimensional vector , followed by non-linear items ,Will Convert to Vector , which is specifically shown in the following formula:

[0095]

[0096] in Similarly, for each text input , from the text conversion function behind it Get span , and then obtain the text representation , which is specifically shown in the following formula:

[0097]

[0098] in is a text encoder, It's a project. . Projection function and The representations of the two modalities are projected from the encoder space to the same d-dimensional space for contrastive learning.

[0099] In one embodiment, the initial welding visual language model is trained based on the image vector and the text vector until the loss value of the image-text pair is minimized, and the trained visual language model is obtained, including:

[0100] Step 1: Input the image vector and text vector into the initial welding visual language model for iterative training;

[0101] Step 2: Obtain the first contrast loss from image to text and the second contrast loss from text to image during training;

[0102] Step 3: Weighted calculation of the first contrast loss and the second contrast loss to obtain the combined loss;

[0103] Step 4: Adjust the model parameters of the welding visual language model during the training process until the combined loss is minimized to obtain the trained visual language model.

[0104] When actually training, sampling Input pairs and calculate their representation pairs . Indicates Yes. The training objective of WeldCLIP involves two loss functions. The first loss function is Image-to-text contrastive loss:

[0105]

[0106] in represents the cosine similarity, that is ; represents the temperature parameter. This loss has the same form as the loss function of the mutual information-based contrastive learning loss function, and minimizing it will lead to the encoder maximally preserving the mutual information between the true pairs under the representation function. Intuitively, it is The logarithmic loss of the road classifier attempts to The prediction is the true pair. Since the contrastive loss of image to text is asymmetric for each input modality, the contrastive loss is defined as:

[0107]

[0108] The final training loss is then calculated as a weighted combination of the two losses averaged over all positive image-text pairs in each mini-batch:

[0109]

[0110] in, is a scalar weight.

[0111] In one embodiment, the image encoder adopts the ResNet50 architecture, and the text encoder includes a BERT encoder, an embedding of the BERT encoder, and a pre-set number of layers of the transformer are frozen to adapt to the image-text comparison task.

[0112] The number of preset layers is set according to actual needs, for example, it can be set to 6. In addition to freezing the embedding and the first 6 converter layers of the BERT encoder, the last 6 converter layers can also be adjusted to adapt to the welding defect comparison task.

[0113] In order to be applicable to the welding defect recognition scenario, the preset image projection function and the preset text projection function are vector projected through a single hidden layer neural network, that is, and is modeled as a single learnable single hidden layer neural network, i.e. ,in is the ReLU nonlinearity, for In addition, for image encoders , using the ResNet50 architecture. For the text encoder , using a BERT encoder followed by a max pooling layer on all output vectors. During training, the encoder can be adapted to the welding defect comparison task by freezing the embedding and first 6 transformer layers of the BERT encoder and fine-tuning the last 6 layers. Family of sampled image transforms , where five random transformations are applied sequentially: cropping, horizontal flipping, affine transformation, color jittering, and Gaussian blur. For the text transformation function , for non-destructive testing reports A simple uniform sampling is performed for the welding defect description in the figure.

[0114] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0115] Based on the same inventive concept, the embodiment of the present application also provides a welding radiograph defect detection device for implementing the welding radiograph defect detection method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more welding radiograph defect detection device embodiments provided below can refer to the limitations of the welding radiograph defect detection method above, and will not be repeated here.

[0116] In one embodiment, Figure 6 As shown, a welding radiograph defect detection device is provided, comprising:

[0117] An initial data acquisition module 200, for acquiring an initial welding radiograph;

[0118] A preprocessing module 400 is used to preprocess the initial welding radiograph using a preset visual segmentation model to obtain a mask radiograph, wherein the welding defect mask in the mask radiograph is saved as a preset color overlay superimposed on the initial welding radiograph;

[0119] An input module 600, for inputting the mask radiograph and the preset welding defect query text into the trained visual language model;

[0120] A detection module 800 is used to obtain welding defect detection results according to the output results of the trained visual language model;

[0121] Among them, the trained visual language model is optimized based on maximizing the consistency between real image-text pairs.

[0122] Each module in the welding radiograph defect detection device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0123] In one embodiment, the preprocessing module 400 is also used to input the initial welding radiograph into a preset visual segmentation model; obtain the welding defect mask in the initial welding radiograph through the preset visual segmentation model; and cover the welding defect mask with a preset color overlay layer to obtain a mask radiograph.

[0124] In one of the embodiments, the welding radiograph defect detection device further includes a model training module for obtaining an initial welding visual language model and a training data pair, wherein the training data pair includes an image-text pair of welding defects; converting each input image and text in the training data pair into a d-dimensional vector representation, respectively, to obtain an image vector and a text vector; and training the initial welding visual language model based on the image vector and the text vector until the loss value of the image-text pair is minimized, thereby obtaining a trained visual language model.

[0125] In one embodiment, the preprocessing module 400 is also used to obtain each input image and text in the training data pair respectively; use the sampling transformation function corresponding to the initial welding visual language model to draw a random view from each input image; use the image encoder corresponding to the initial welding visual language model to convert the random view into a fixed-dimensional vector, and convert the fixed-dimensional vector into a d-dimensional image vector through a preset image projection function; use the text conversion function corresponding to the initial welding visual language model to obtain the span text of the text; based on the span text, the text encoder corresponding to the initial welding visual language model and the preset text projection function, obtain a d-dimensional text vector.

[0126] In one of the embodiments, the model training module is used to input the image vector and the text vector into the initial welding visual language model for iterative training; obtain the first contrast loss from the image to the text and the second contrast loss from the text to the image during the training process; weightedly calculate the first contrast loss and the second contrast loss to obtain the combined loss; adjust the model parameters of the welding visual language model during the training process until the combined loss is minimized to obtain the trained visual language model.

[0127] In one embodiment, the image encoder adopts the ResNet50 architecture, and the text encoder includes a BERT encoder, an embedding of the BERT encoder, and a pre-set number of layers of the previous layer converter layer freezing to adapt to the image-text comparison task.

[0128] In one of the embodiments, the preset image projection function and the preset text projection function perform vector projection through a single hidden layer neural network.

[0129] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store preset data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a welding radiograph defect detection method is implemented.

[0130] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0131] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0132] Obtain initial weld radiographs;

[0133] Preprocessing the initial welding radiograph using a preset visual segmentation model to obtain a mask radiograph, wherein the welding defect mask in the mask radiograph is saved as a preset color overlay superimposed on the initial welding radiograph;

[0134] Input the mask radiograph and the preset welding defect query text into the trained visual language model;

[0135] According to the output results of the trained visual language model, the welding defect detection results are obtained;

[0136] Among them, the trained visual language model is optimized based on maximizing the consistency between real image-text pairs.

[0137] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0138] The initial welding radiograph is input into a preset visual segmentation model; the welding defect mask in the initial welding radiograph is obtained through the preset visual segmentation model; and the welding defect mask is covered with a preset color overlay layer to obtain a mask radiograph.

[0139] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0140] An initial welding visual language model and a training data pair are obtained, wherein the training data pair includes an image-text pair of welding defects; each input image and text in the training data pair is converted into a d-dimensional vector representation to obtain an image vector and a text vector; the initial welding visual language model is trained based on the image vector and the text vector until the loss value of the image-text pair is minimized, thereby obtaining a trained visual language model.

[0141] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0142] Each input image and text in the training data pair is obtained respectively; a random view from each input image is drawn using a sampling transformation function corresponding to the initial welding visual language model; the random view is converted into a fixed-dimensional vector using an image encoder corresponding to the initial welding visual language model, and the fixed-dimensional vector is converted into a d-dimensional image vector using a preset image projection function; the span text of the text is obtained using a text conversion function corresponding to the initial welding visual language model; a d-dimensional text vector is obtained based on the span text, the text encoder corresponding to the initial welding visual language model, and the preset text projection function.

[0143] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0144] The image vector and the text vector are input into the initial welding visual language model for iterative training; the first contrast loss from the image to the text and the second contrast loss from the text to the image are obtained during the training process; the first contrast loss and the second contrast loss are weighted to obtain the combined loss; the model parameters of the welding visual language model are adjusted during the training process until the combined loss is minimized to obtain the trained visual language model.

[0145] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0146] Obtain initial weld radiographs;

[0147] Preprocessing the initial welding radiograph using a preset visual segmentation model to obtain a mask radiograph, wherein the welding defect mask in the mask radiograph is saved as a preset color overlay superimposed on the initial welding radiograph;

[0148] Input the mask radiograph and the preset welding defect query text into the trained visual language model;

[0149] According to the output results of the trained visual language model, the welding defect detection results are obtained;

[0150] Among them, the trained visual language model is optimized based on maximizing the consistency between real image-text pairs.

[0151] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0152] The initial welding radiograph is input into a preset visual segmentation model; the welding defect mask in the initial welding radiograph is obtained through the preset visual segmentation model; and the welding defect mask is covered with a preset color overlay layer to obtain a mask radiograph.

[0153] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0154] An initial welding visual language model and a training data pair are obtained, wherein the training data pair includes an image-text pair of welding defects; each input image and text in the training data pair is converted into a d-dimensional vector representation to obtain an image vector and a text vector; the initial welding visual language model is trained based on the image vector and the text vector until the loss value of the image-text pair is minimized, thereby obtaining a trained visual language model.

[0155] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0156] Each input image and text in the training data pair is obtained respectively; a random view from each input image is drawn using a sampling transformation function corresponding to the initial welding visual language model; the random view is converted into a fixed-dimensional vector using an image encoder corresponding to the initial welding visual language model, and the fixed-dimensional vector is converted into a d-dimensional image vector using a preset image projection function; the span text of the text is obtained using a text conversion function corresponding to the initial welding visual language model; a d-dimensional text vector is obtained based on the span text, the text encoder corresponding to the initial welding visual language model, and the preset text projection function.

[0157] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0158] The image vector and the text vector are input into the initial welding visual language model for iterative training; the first contrast loss from the image to the text and the second contrast loss from the text to the image are obtained during the training process; the first contrast loss and the second contrast loss are weighted to obtain the combined loss; the model parameters of the welding visual language model are adjusted during the training process until the combined loss is minimized to obtain the trained visual language model.

[0159] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0160] Obtain initial weld radiographs;

[0161] Preprocessing the initial welding radiograph using a preset visual segmentation model to obtain a mask radiograph, wherein the welding defect mask in the mask radiograph is saved as a preset color overlay superimposed on the initial welding radiograph;

[0162] Input the mask radiograph and the preset welding defect query text into the trained visual language model;

[0163] According to the output results of the trained visual language model, the welding defect detection results are obtained;

[0164] Among them, the trained visual language model is optimized based on maximizing the consistency between real image-text pairs.

[0165] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0166] The initial welding radiograph is input into a preset visual segmentation model; the welding defect mask in the initial welding radiograph is obtained through the preset visual segmentation model; and the welding defect mask is covered with a preset color overlay layer to obtain a mask radiograph.

[0167] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0168] An initial welding visual language model and a training data pair are obtained, wherein the training data pair includes an image-text pair of welding defects; each input image and text in the training data pair is converted into a d-dimensional vector representation to obtain an image vector and a text vector; the initial welding visual language model is trained based on the image vector and the text vector until the loss value of the image-text pair is minimized, thereby obtaining a trained visual language model.

[0169] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0170] Each input image and text in the training data pair is obtained respectively; a random view from each input image is drawn using a sampling transformation function corresponding to the initial welding visual language model; the random view is converted into a fixed-dimensional vector using an image encoder corresponding to the initial welding visual language model, and the fixed-dimensional vector is converted into a d-dimensional image vector using a preset image projection function; the span text of the text is obtained using a text conversion function corresponding to the initial welding visual language model; a d-dimensional text vector is obtained based on the span text, the text encoder corresponding to the initial welding visual language model, and the preset text projection function.

[0171] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0172] The image vector and the text vector are input into the initial welding visual language model for iterative training; the first contrast loss from the image to the text and the second contrast loss from the text to the image are obtained during the training process; the first contrast loss and the second contrast loss are weighted to obtain the combined loss; the model parameters of the welding visual language model are adjusted during the training process until the combined loss is minimized to obtain the trained visual language model.

[0173] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0174] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0175] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0176] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A welding radiograph defect detection method, characterized in that: The method comprises: Obtain initial weld radiographs; Preprocessing the initial welding radiograph using a preset visual segmentation model to obtain a mask radiograph, wherein a welding defect mask in the mask radiograph is saved as a preset color overlay superimposed on the initial welding radiograph; Inputting the mask radiograph and a preset welding defect query text into a trained visual language model; Obtaining welding defect detection results according to the output results of the trained visual language model; The trained visual language model is trained based on maximizing the consistency between real image-text pairs; Before inputting the mask radiograph and the preset welding defect query text into the trained visual language model, the method further includes: obtaining an initial welding visual language model and a training data pair, wherein the training data pair includes an image-text pair of welding defects; converting each input image and text in the training data pair into d -dimensional vector representation, to obtain an image vector and a text vector; based on the image vector and the text vector, the initial welding visual language model is trained until the loss value of the image-text pair is minimized, thereby obtaining a trained visual language model; The step of converting each input image and text in the training data pair into d -dimensional vector representation, obtaining the image vector and the text vector includes: respectively obtaining each input image and text in the training data pair; using the sampling transformation function corresponding to the initial welding visual language model to draw a random view from each input image; using the image encoder corresponding to the initial welding visual language model to convert the random view into a fixed-dimensional vector, and converting the fixed-dimensional vector into d -dimensional image vector; using the text conversion function corresponding to the initial welding visual language model to obtain the span text of the text; based on the span text, the text encoder corresponding to the initial welding visual language model and the preset text projection function, obtain d -dimensional text vector.

2. The method according to claim 1, characterized in that: The preprocessing of the initial welding radiograph by using a preset visual segmentation model to obtain a mask radiograph comprises: inputting the initial welding radiograph into a preset visual segmentation model; Obtaining a welding defect mask in the initial welding radiograph by using the preset visual segmentation model; A preset color overlay layer is used to cover the welding defect mask to obtain a mask radiograph.

3. The method according to claim 1, characterized in that The initial welding visual language model is trained based on the image vector and the text vector until the loss value of the image-text pair is minimized, and the trained visual language model is obtained, comprising: Inputting the image vector and the text vector into the initial welding visual language model for iterative training; Get the first contrast loss from image to text and the second contrast loss from text to image during training; Weighted calculation of the first contrast loss and the second contrast loss to obtain a combined loss; The model parameters of the welding visual language model are adjusted during the training process until the combination loss is minimized to obtain a trained visual language model.

4. The method according to claim 1, characterized in that: The image encoder adopts the ResNet50 architecture, and the text encoder includes a BERT encoder, and the embedding and front preset layer converter layers of the BERT encoder are frozen to adapt to the image-text comparison task.

5. The method according to claim 1, characterized in that The preset image projection function and the preset text projection function perform vector projection through a single hidden layer neural network.

6. A welding radiograph defect detection device, characterized in that: The device comprises: An initial data acquisition module, used to acquire initial welding radiographs; A preprocessing module, configured to preprocess the initial welding radiograph using a preset visual segmentation model to obtain a mask radiograph, wherein a welding defect mask in the mask radiograph is saved as a preset color overlay superimposed on the initial welding radiograph; An input module, used for inputting the mask radiograph and a preset welding defect query text into a trained visual language model; A detection module, used to obtain a welding defect detection result according to the output result of the trained visual language model; The trained visual language model is trained based on maximizing the consistency between real image-text pairs; The model training module is used to obtain an initial welding visual language model and training data pairs, which include image-text pairs of welding defects; each input image and text in the training data pair is converted into d -dimensional vector representation, to obtain an image vector and a text vector; based on the image vector and the text vector, the initial welding visual language model is trained until the loss value of the image-text pair is minimized, thereby obtaining a trained visual language model; The step of converting each input image and text in the training data pair into d -dimensional vector representation, obtaining the image vector and the text vector includes: respectively obtaining each input image and text in the training data pair; using the sampling transformation function corresponding to the initial welding visual language model to draw a random view from each input image; using the image encoder corresponding to the initial welding visual language model to convert the random view into a fixed-dimensional vector, and converting the fixed-dimensional vector into d -dimensional image vector; using the text conversion function corresponding to the initial welding visual language model to obtain the span text of the text; based on the span text, the text encoder corresponding to the initial welding visual language model and the preset text projection function, obtain d -dimensional text vector.

7. The device according to claim 6, characterized in that The model training module is also used to input the image vector and the text vector into the initial welding visual language model for iterative training; obtain the first contrast loss from the image to the text and the second contrast loss from the text to the image during the training process; weightedly calculate the first contrast loss and the second contrast loss to obtain the combined loss; adjust the model parameters of the welding visual language model during the training process until the combined loss is minimized to obtain a trained visual language model.

8. The device according to claim 6, characterized in that The image encoder adopts the ResNet50 architecture, and the text encoder includes the BERT encoder, the embedding of the BERT encoder, and the previous preset layer converter layer freezing to adapt to the image-text comparison task.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.