Weld defect recognition method, weld defect recognition model training method and device
Through the weld defect identification model based on convolutional neural network, the pipeline weld defects are automatically identified, which solves the problem of degradation of identification accuracy caused by professional experience dependence, and improves the efficiency and accuracy of weld defect identification.
Patent Information
- Application Number
- CN202110155569.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-04
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2041-02-04
AI Technical Summary
In the prior art, the identification of pipeline weld defects depends on the experience of professionals and is susceptible to subjective and objective factors, resulting in a decrease in accuracy.
The weld defect recognition model based on convolutional neural network is adopted. By acquiring and marking pipeline weld images, the defect location and type are identified, and the model parameters are optimized by iterative training methods to achieve automated recognition.
The objective and accurate identification of pipeline weld defects is achieved, which avoids the influence of visual fatigue and environmental factors of professionals, and improves the identification efficiency and accuracy.
Smart Images

Figure CN114862745B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of pipeline technology, and in particular to a weld defect recognition method, a weld defect recognition model training method and a device. Background Art
[0002] As one of the main transportation carriers for crude oil, refined oil and natural gas, long-distance oil and gas pipelines play an important role in national infrastructure. Long-distance oil and gas pipelines are composed of multiple welded steel pipes. The welds between steel pipes may have defects, which are pipeline weld defects.
[0003] Pipeline weld defects are one of the important factors affecting the safe operation of pipelines. With the development of pipeline construction towards large diameters, high pressures, and high steel grades, a large amount of pipeline weld inspection data is needed to identify and evaluate pipeline weld defects. For a long time, the identification of pipeline weld defects has always relied on the experience of professionals. Therefore, the experience accumulation of professionals largely determines the accuracy of pipeline weld defect identification.
[0004] Even experienced professionals are easily affected by various subjective and objective factors. For example, professionals may experience visual fatigue, mood changes, weak ambient light, and low image clarity when viewing similar images for a long time, which may lead to a decrease in the accuracy of identifying pipeline weld defects. Summary of the invention
[0005] The embodiment of the present application provides a weld defect recognition method, a weld defect recognition model training method and a device, which can objectively and accurately recognize the weld defects of the pipeline. The technical solution is as follows:
[0006] According to one aspect of the present application, a weld defect recognition method is provided, which is applied to a computer device, wherein a weld defect recognition model based on a convolutional neural network is provided in the computer device, and the method comprises:
[0007] Acquire an image to be identified, where the image to be identified is a collected weld image of a long-distance pipeline;
[0008] Call the weld defect recognition model to perform defect recognition on the image to be recognized, and obtain the defect position and defect type of the pipeline weld defect;
[0009] The pipeline weld defects are marked in the image to be identified based on the defect position and defect type, so as to obtain an image marked with the pipeline weld defects.
[0010] According to another aspect of the present application, a method for training a weld defect recognition model is provided, the method comprising:
[0011] m weld defect image samples are obtained from a database, where the weld defect image samples are marked with sample defect positions and sample defect types of sample pipeline weld defects;
[0012] The model to be trained is called to perform defect recognition on the weld defect image sample to obtain the identified defect position and identified defect type of the sample pipeline weld defect;
[0013] Calculating the recognition loss between the sample defect position and the recognized defect position, and between the sample defect type and the recognized defect type;
[0014] The model parameters of the model to be trained are adjusted based on the recognition loss, and the model to be trained is iteratively trained based on m weld defect image samples to finally obtain a weld defect recognition model, where m is a positive integer greater than 1.
[0015] According to another aspect of the present application, a weld defect recognition device is provided, in which a weld defect recognition model based on a convolutional neural network is provided, and the device includes:
[0016] The first acquisition module is used to acquire an image to be identified, where the image to be identified is a weld image of a long-distance pipeline;
[0017] The first recognition module is used to call the weld defect recognition model to perform defect recognition on the image to be recognized, and obtain the defect position and defect type of the pipeline weld defect;
[0018] The marking module is used to mark the pipeline weld defects in the image to be identified based on the defect position and defect type, and obtain an image marked with the pipeline weld defects.
[0019] According to another aspect of the present application, a training device for a weld defect recognition model is provided, the device comprising:
[0020] The second acquisition module is used to acquire m weld defect image samples from the database, where the weld defect image samples are marked with sample defect positions and sample defect types of sample pipeline weld defects;
[0021] The second recognition module is used to call the model to be trained to perform defect recognition on the weld defect image sample to obtain the identified defect position and identified defect type of the sample pipeline weld defect;
[0022] A calculation module, used for calculating the recognition loss between the sample defect position and the recognition defect position, and the sample defect type and the recognition defect type;
[0023] The training module is used to adjust the model parameters of the model to be trained based on the recognition loss, iteratively train the model to be trained based on m weld defect image samples, and finally obtain the weld defect recognition model, where m is a positive integer greater than 1.
[0024] According to another aspect of the present application, a computer device is provided, comprising: a processor and a memory, wherein the memory stores a computer program, and the computer program is loaded and executed by the processor to implement the weld defect recognition method as described above, or the weld defect recognition model training method as described above.
[0025] According to another aspect of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the weld defect recognition method as described above, or the weld defect recognition model training method as described above.
[0026] According to another aspect of the present application, a computer program product is provided, the computer program product includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the weld defect recognition method as described above, or the training method of the weld defect recognition model as described above.
[0027] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:
[0028] The computer device is provided with a weld defect recognition model based on a convolutional neural network. When it is necessary to recognize the weld defects of the pipeline, the computer device calls the weld defect recognition model to perform calculations and recognition on the weld image of the pipeline, and directly outputs an image marked with the location and type of the weld defects of the pipeline, thereby objectively and accurately identifying the weld defects of the pipeline, thereby avoiding the problem of reduced accuracy in identifying weld defects of the pipeline caused by various subjective and objective factors such as video fatigue, emotional changes, weak ambient light, and low image clarity caused by professionals watching similar images for a long time; or, the weld defects of the pipeline identified by the above machine can be used as powerful reference data, and professionals can quickly and finally determine the location and type of the weld defects of the pipeline based on the weld defects identified by the machine. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0030] Figure 1A schematic diagram showing the structure of a computer system provided by an exemplary embodiment of the present application is shown;
[0031] Figure 2 A flow chart of a weld defect identification method provided by an exemplary embodiment of the present application is shown;
[0032] Figure 3 A schematic diagram of the structure of a weld defect recognition model provided by an exemplary embodiment of the present application is shown;
[0033] Figure 4 A schematic diagram showing a weld defect recognition result provided by an exemplary embodiment of the present application is shown;
[0034] Figure 5 A flow chart showing a method for training a weld defect recognition model provided by an exemplary embodiment of the present application is shown;
[0035] Figure 6 A schematic structural diagram of a weld defect identification device provided by an exemplary embodiment of the present application is shown;
[0036] Figure 7 A schematic structural diagram of a training device for a weld defect recognition model provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0037] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0038] First, several nouns involved in this application are introduced:
[0039] Long distance pipeline refers to the pipeline used to transport commodity media between production sites, storage depots, and user units. Oil and gas long distance pipelines are pipelines used to transport crude oil, refined oil, and natural gas between production sites, storage depots, and user units.
[0040] Circumferential welds are welds formed by welding various circular and annular welds, and the welds formed by welding are closed circular rings.
[0041] Figure 1 A schematic diagram of the structure of a computer system 100 provided by an exemplary embodiment of the present application is shown. The computer system 100 includes a radiographic flaw detection device 120, a database 140, a server cluster 160 and a terminal 180.
[0042] The radiographic flaw detection device 120 is an instrument that uses the structural differences in the local area of the object when the radiation passes through the object to change the attenuation of the object to the radiation, and then detects the intensity of the projected radiation to determine the defects and material distribution inside the object. Exemplarily, the radiographic flaw detection includes at least one of X-ray flaw detection, gamma-ray flaw detection, and high-energy ray flaw detection. The video flaw detection device 120 uses radiation to irradiate the weld and develop it through film exposure. Since the density of weld defects is smaller than that of metal, the sensitivity of the film is large at the weld defect. After development, black stripes or spots will appear on the film. The position, size and type of the defect can be determined based on the position, shape and size of the black spots on the film. Exemplarily, in the embodiment provided in the present application, the radiographic flaw detection device 120 irradiates the pipeline weld to obtain a film image, which is the image to be identified.
[0043] The radiographic flaw detection device 120 is connected to the database 140 via a wired or wireless network. After acquiring the film image, the radiographic flaw detection device 120 transmits the film image to the database 140 for storage. The database 140 is connected to the server cluster 160 via a wired or wireless network. The server cluster 160 obtains the image to be identified from the database 140, calls the weld defect recognition model to perform defect recognition on the image to be identified, thereby obtaining the defect position and defect type of the pipeline weld defect, and marking the pipeline weld defect in the image to be identified based on the defect position and defect type, to obtain an image marked with the pipeline weld defect. Exemplarily, the server cluster 160 also sends the image marked with the pipeline weld defect to the database 140 for storage.
[0044] The X-ray flaw detection equipment 120 can also be connected to the server cluster 160 through a wired or wireless network. After acquiring the image to be identified, the X-ray flaw detection equipment 120 directly transmits the image to be identified to the server cluster 160. The server cluster 160 identifies pipeline weld defects based on the image to be identified and outputs an image marked with pipeline weld defects.
[0045] The server cluster 160 is provided with a display device, and the server cluster 160 can display the image marked with the pipeline weld defect through the above display device. Alternatively, the server cluster 160 also communicates with the terminal 180 through a wired or wireless connection, and the image marked with the pipeline weld defect can be displayed on the display device of the terminal 180.
[0046] Exemplarily, the identification and display of the above-mentioned pipeline weld defects can be real-time, that is, the X-ray flaw detection equipment 120 collects the image to be identified in real time, transmits the above-mentioned image to be identified to the server cluster 160 for pipeline weld defect identification, and finally displays the identification result on the display device, and the identification result includes an image marked with pipeline weld defects and an image not marked with pipeline weld defects.
[0047] For example, the radiographic flaw detection device 120 may integrate a pipeline weld defect recognition function and an image display function. Accordingly, after the radiographic flaw detection device 120 acquires the image to be recognized, it directly calls the pipeline weld recognition model to perform recognition processing on the image to be recognized, determines whether there is a pipeline weld defect in the image to be recognized, and displays the image after recognition processing.
[0048] It should be noted that a client is installed and running on the X-ray flaw detection equipment 120 or the server cluster 160 or the terminal 180, and the client can trigger the data processing function of the image to be identified, such as triggering the identification of weld defects and displaying the image after identification processing.
[0049] The server cluster 160 may include at least one of a server, a plurality of servers, a cloud computing platform, and a virtualization center. Exemplarily, the terminal 180 may include at least one of a smart phone, a tablet computer, a laptop computer, a desktop computer, and a notebook computer. Those skilled in the art may know that the number of the terminals 180 may be more or less. For example, the terminal 180 may be only one, or the terminal 180 may be dozens or hundreds, or more. The embodiment of the present application does not limit the number and device type of the terminal 180.
[0050] Figure 2 A flowchart of a weld defect recognition method provided by an exemplary embodiment of the present application is shown. The method is applied to a computer device, in which a weld defect recognition model based on a convolutional neural network is provided. The computer device may include a server and a terminal. The method is applied to Figure 1 Taking the server shown in FIG. 1 as an example, the method includes:
[0051] Step 201: Obtain an image to be recognized.
[0052] The image to be identified is a collected weld image of a long-distance pipeline; illustratively, the identified image is a collected weld image of a circumferential weld of a long-distance pipeline.
[0053] Optionally, the above-mentioned image to be identified is stored in a database, and the server obtains the image to be identified from the database; or, the above-mentioned image to be identified is transmitted to the server by the X-ray flaw detection equipment, and the server receives the image to be identified sent by the X-ray flaw detection equipment.
[0054] Exemplarily, after obtaining the image to be identified, if the format of the image to be identified is not in the specified format, the server performs format conversion on the image to be identified, converts the format of the image to be identified into the specified format, and obtains the image to be identified in the specified format. For example, the original film image (i.e., the image to be identified) obtained by radiographic inspection of the circumferential weld of the pipeline is converted into a grayscale image in a 16-bit Portable Network Graphics (PNG) format. Exemplarily, the image to be identified stored in the database is a weld image in the specified format obtained after preprocessing.
[0055] Step 202: Calling a weld defect recognition model to perform defect recognition on the image to be recognized, and obtaining the defect position and defect type of the pipeline weld defect.
[0056] The server inputs the image to be identified into the weld defect recognition model, and the weld defect recognition model performs defect recognition on the image to be identified to obtain the defect position and defect type of the pipeline weld defect. Optionally, the defect type includes at least one of a lack of fusion defect, a circular defect, a strip defect, a lack of penetration defect, a crack defect, an undercut defect, and a concave defect.
[0057] Among them, circular defects refer to defects with an aspect ratio less than or equal to 3 that are not cracks, incomplete penetration and incomplete fusion, including pores, massive slag inclusions, tungsten inclusions, etc. Strip defects refer to defects with an aspect ratio greater than 3 that are not cracks, incomplete penetration and incomplete fusion. They include strip slag and strip holes, etc. Incomplete penetration defects refer to defects caused by the lack of melting between the parent metals and the failure of the weld metal to enter the root of the joint, including root incomplete fusion, groove incomplete fusion and interlayer incomplete fusion, etc. Cracks refer to defects formed by local fractures between materials, including hot cracks and cold cracks. Undercut defects refer to depressions left at the edge of the weld. Concave defects refer to local depressions formed on the surface of the weld or the back of the weld after welding that are lower than the surface of the parent material. Incomplete fusion defects refer to defects caused by incomplete melting and bonding of the weld metal and the parent metal, or incomplete melting and bonding between the weld metals.
[0058] For example, Figure 3, shows a schematic diagram of the structure of an optional weld defect recognition model, the input end is composed of two convolutional layers (Convolutional layer) 310 connected in series, the first convolutional layer is provided with a 3×3 convolution kernel, the number of channels is 32, and the image output size is 256×256; the second convolutional layer is provided with a 3×3 convolution kernel, the number of channels is 64, the step size is 2, and the image output size is 128×128. The second convolutional layer is connected to a block (block) 301, which includes two convolutional layers connected in series and a residual network (Residual Networks, ResNets) layer, the first convolutional layer 1 is provided with a 1×1 convolution kernel, the number of channels is 64; the second convolutional layer 1 is provided with a 3×3 convolution kernel, the number of channels is 64; the image output size of the residual network layer 1 is 128×128. The convolution layer connecting blocks is called an intermediate convolution layer 306. The above block 301 is connected to two series-connected blocks 302 through the first intermediate convolution layer, block 302 is connected to eight series-connected blocks 303 through the second intermediate convolution layer, block 303 is connected to eight series-connected blocks 304 through the third intermediate convolution layer, and block 304 is connected to four series-connected blocks 305 through the fourth intermediate convolution layer. The structure of each block is the same, but the number of channels and image output size are different. The convolution kernel size of each intermediate convolution layer is 3×3, the step size is 2, and the number of channels and image output size are also different. The last block 305 is connected to a global average pooling layer 307, which is connected to a fully connected layer 308, which is connected to a normalization (softmax) layer 309. The image to be recognized is input from the first convolutional layer, and after convolution, residual, pooling, full connection, and normalization calculations, the softmax layer outputs the final recognition result. For example, the softmax layer outputs the defect location and defect type of the pipeline weld defect.
[0059] Step 203: Mark the pipeline weld defect in the image to be identified based on the defect position and defect type, and obtain an image marked with the pipeline weld defect.
[0060] When a pipeline weld defect is identified from the image to be identified, the server marks the pipeline weld defect in the image to be identified based on the defect location and defect type. For example, Figure 4 As shown in the left figure in FIG. 3 , the identified defect position is marked with a box 311 , and the defect type can also be marked around the box 311 , such as Figure 4In the right figure, the pipeline weld defect is marked as a strip defect 312 on the right side of the box 311.
[0061] In summary, the weld defect recognition method provided in this embodiment, when it is necessary to recognize the weld defects of the pipeline, the server calls the weld defect recognition model to perform calculation and recognition on the weld image of the pipeline, and directly outputs an image marked with the position and type of the weld defect of the pipeline, so as to objectively and accurately identify the weld defect of the pipeline, thereby avoiding the problem of reduced accuracy of pipeline weld defect recognition caused by various subjective and objective factors such as video fatigue, emotional changes, weak ambient light, and low image clarity caused by professionals watching similar pictures for a long time, so that the output result is more stable; or, the pipeline weld defects recognized by the above machine can be used as powerful reference data, and professionals can quickly and finally determine the position and type of the pipeline weld defects based on the pipeline weld defects recognized by the machine; the recognition efficiency of weld defects is improved, and the subjective error of weld defect recognition is reduced.
[0062] Figure 5 A flowchart of a method for training a weld defect recognition model provided by an exemplary embodiment of the present application is shown. The method is applied to a computer device, which may include a server and a terminal. Figure 1 Taking the server shown in FIG. 1 as an example, the method includes:
[0063] Step 401, obtaining m weld defect image samples from a database, where the weld defect image samples are marked with sample defect positions and sample defect types of sample pipeline weld defects.
[0064] The server stores m weld defect image samples, each of which is marked with the sample defect position and sample defect type of the sample pipeline weld defect, and m is a positive integer greater than 1. The m weld defect image samples are processed images in a specified format, and the m weld defect image samples contain various types of pipeline weld defects. Exemplarily, each weld defect image sample is marked with i rectangular boxes, and there is only one type of pipeline weld defect in each rectangular box, and i is a positive integer. Exemplarily, the ratio of the area occupied by the pipeline weld defect in each rectangular box to the area of the rectangular box is greater than the ratio threshold, that is, the area occupied by the pipeline weld defect in the rectangular box needs to be as large as possible.
[0065] For example, the format of the annotation rectangle is (p,x min ,y min ,x max ,y max ,type), p represents whether there is a defect in the marked area, x min and minRespectively represent the horizontal and vertical coordinates of the upper left corner of the labeled rectangle, x max and max They represent the horizontal and vertical coordinates of the lower right corner of the marked rectangular box respectively, and type represents the category of the pipeline weld defect.
[0066] For example, there are n weld defect images, and the server performs image expansion processing on the n weld defect images by noise superposition, flipping, cropping, etc., to obtain m weld defect image samples, where n is a positive integer less than m. In the process of image expansion processing, the number of each type of weld defect images is kept relatively balanced.
[0067] Step 402, calling the model to be trained to perform defect recognition on the weld defect image sample, and obtaining the recognized defect position and recognized defect type of the sample pipeline weld defect.
[0068] The server is provided with a model to be trained based on a convolutional neural network. The server calls the model to be trained to perform defect recognition on the weld defect image sample to obtain the identified defect position and identified defect type of the sample pipeline weld defect. For example, the server calls the model to be trained to perform convolution operations on the image grid by grid from left to right and from top to bottom starting from the upper left corner of the weld defect image sample with a step length of 10 to 15 pixels st1. The obtained recognition result is expressed as (p', x min ',y min ',x max ',y max ',type'), where p' represents whether there is a defect in the identified area, x min ' and y min 'represents the horizontal and vertical coordinates of the upper left corner of the recognition rectangle, x max ' and y max 'represent the horizontal and vertical coordinates of the lower right corner of the identification rectangle, and type' represents the type of the identified pipeline weld defect. For example, the area of the identification rectangle includes 5 2 , 10 2 , 20 2 At least one of the ratios of the recognition rectangular frame is at least one of 1:1, 1:2, and 1:4.
[0069] In some embodiments, the server calls the model to be trained to perform defect identification on the weld defect image sample to obtain at least two groups of intermediate identification results of the sample pipeline weld defects, each group of intermediate identification results includes an intermediate identification defect position and an intermediate identification defect type; for each group of the at least two groups of intermediate identification results, the identification loss between the sample defect position and the intermediate identification defect position, and between the sample defect type and the intermediate identification defect type is calculated, and finally at least two intermediate identification losses corresponding to the at least two groups of intermediate identification results are obtained; the minimum intermediate identification loss is determined from the at least two intermediate identification losses, and a regional image is extracted from the weld defect image sample based on the intermediate identification defect position corresponding to the minimum intermediate identification loss in the at least two intermediate identification losses; the model to be trained is called to perform defect identification on the regional image to obtain the identification defect position and identification defect type of the sample pipeline weld defect.
[0070] In some embodiments, the server calls the model to be trained to perform defect identification on the weld defect image sample to obtain the intermediate identified defect position and the intermediate identified defect type of the sample pipeline weld defect; calculates the intermediate identification loss between the sample defect position and the intermediate identified defect position, and between the sample defect type and the intermediate identified defect type; in response to the intermediate identification loss being less than the loss threshold, extracts a regional image from the weld defect image sample based on the intermediate identified defect position; calls the model to be trained to perform defect identification on the regional image to obtain the identified defect position and the identified defect type of the sample pipeline weld defect.
[0071] Exemplarily, the server calls the model to be trained starting from the upper left corner of the regional image and performs a convolution operation with a single pixel size as the step size, wherein the movement range of the regional image in the four directions of up, down, left and right is st1 minus 1 pixel, and the identified defect position and identified defect type of the sample pipeline weld defect are obtained.
[0072] Exemplarily, when extracting the regional image, the server adjusts the location area of the intermediate identified defect location according to a specified ratio, and extracts the regional image based on the adjusted location area. Exemplarily, the location area of the intermediate identified defect location is enlarged according to a specified ratio, for example, the location area of the intermediate identified defect location is enlarged to 1.5 times according to a ratio of 1:1.5, and then the regional image is extracted based on the adjusted location area.
[0073] Step 403 , calculating the recognition loss between the sample defect position and the recognized defect position, and between the sample defect type and the recognized defect type.
[0074] For example, (p, x min ,y min ,x max ,y max, type) as the sample defect location and sample defect type of the sample pipeline weld defect, with (p', x min ',y min ',x max ',y max ', type') as the identified defect position and defect type of the sample pipeline weld defect, calculate the p error between p and p', and calculate (x min ,y min ,x max ,y max ) and (x min ',y min ',x max ',y max '), calculate the position error between type and type', and calculate the defect type error between type and type'. The above three error sets are loss errors. Exemplarily, the server calculates the weighted sum of the above three errors to obtain the loss error.
[0075] Exemplarily, the position error is characterized by an intersection-and-union ratio, with the overlapping position area of the sample defect position and the identified defect position as the numerator and the union position area of the sample defect position and the identified defect position as the denominator to calculate the position error. Exemplarily, the intersection-and-union ratio threshold is between 0.7 and 1. When the intersection-and-union ratio exceeds the intersection-and-union ratio threshold, the position error can be used.
[0076] Optionally, a first weight corresponding to the defect position and a second weight corresponding to the defect type are set in the server; the server calculates a first recognition loss between the sample defect position and the identified defect position, and calculates a second recognition loss between the sample defect type and the identified defect type; calculates a first product of the first recognition loss and the first weight, calculates a second product of the second recognition loss and the second weight, and adds the first product to the second product to obtain the recognition loss.
[0077] Step 404, adjusting the model parameters of the model to be trained based on the recognition loss, iteratively training the model to be trained based on the m weld defect image samples, and finally obtaining a weld defect recognition model.
[0078] Exemplarily, the server performs back-propagation training on the model to be trained based on the recognition loss, adjusts the model parameters of the model to be trained, iteratively trains the model to be trained based on m weld defect image samples, and finally obtains a weld defect recognition model.
[0079] Exemplarily, after obtaining the trained weld defect recognition model, the server also uses j weld defect images to test the weld defect recognition model; it should be noted that weld defect images are stored in the database, and the weld defects are divided into a training set and a test set in a ratio of 4:1; wherein the training set includes the above-mentioned m weld defect image samples, which are used to train the model to be trained; and the test set includes j weld defect images, which are used to test the weld defect recognition model.
[0080] In summary, the training method of the weld defect recognition model provided in this embodiment uses images of various types of pipeline weld defects for model training, so that when the trained weld defect recognition model is called, it can objectively and accurately output images marked with the location and type of pipeline weld defects, so that the application of the weld defect recognition model can avoid the problem of reduced accuracy of pipeline weld defect recognition caused by various subjective and objective factors such as video fatigue, emotional changes, weak ambient light, and low image clarity caused by professionals watching similar pictures for a long time; or, provide strong reference data, professionals can quickly and finally determine the location and type of pipeline weld defects based on the pipeline weld defects identified by the machine; improve the recognition efficiency of weld defects and reduce the subjective error of weld defect recognition. The method also performs two convolution calculations on an image, and uses the regional image with the smallest loss error calculated by the first convolution as the input of the second convolution calculation, so that the final calculated loss error is more accurate.
[0081] Figure 6 A block diagram of a weld defect recognition device provided by an exemplary embodiment of the present application is shown. The device can be implemented as part or all of a server or terminal through software, hardware, or a combination of both. The device is provided with a weld defect recognition model based on a convolutional neural network, and the device includes:
[0082] A first acquisition module 512 is used to acquire an image to be identified, where the image to be identified is a weld image of a long-distance pipeline;
[0083] The first recognition module 514 is used to call the weld defect recognition model to perform defect recognition on the image to be recognized, and obtain the defect position and defect type of the pipeline weld defect;
[0084] The marking module 516 is used to mark the pipeline weld defect in the image to be identified based on the defect position and defect type, and obtain an image marked with the pipeline weld defect.
[0085] In summary, the weld defect recognition device provided in this embodiment, when it is necessary to recognize the weld defects of the pipeline, calls the weld defect recognition model to perform calculation and recognition on the weld image of the pipeline, directly outputs an image marked with the position and type of the weld defects of the pipeline, and objectively and accurately identifies the weld defects of the pipeline, thereby avoiding the problem of reduced accuracy of pipeline weld defect recognition caused by various subjective and objective factors such as video fatigue, emotional changes, weak ambient light, and low image clarity caused by professionals watching similar pictures for a long time, so that the output result is more stable; or, the pipeline weld defects recognized by the above machine can be used as powerful reference data, and professionals can quickly and finally determine the position and type of the pipeline weld defects based on the pipeline weld defects recognized by the machine; the recognition efficiency of weld defects is improved, and the subjective error of weld defect recognition is reduced.
[0086] Figure 7 A block diagram of a training device for a weld defect recognition model provided by an exemplary embodiment of the present application is shown. The device can be implemented as part or all of a server or terminal through software, hardware, or a combination of both. The device includes:
[0087] The second acquisition module 522 is used to acquire m weld defect image samples from the database, where the weld defect image samples are marked with sample defect positions and sample defect types of sample pipeline weld defects;
[0088] The second recognition module 524 is used to call the model to be trained to perform defect recognition on the weld defect image sample to obtain the recognized defect position and recognized defect type of the sample pipeline weld defect;
[0089] A calculation module 526, for calculating the recognition loss between the sample defect position and the recognition defect position, and the sample defect type and the recognition defect type;
[0090] The training module 528 is used to adjust the model parameters of the model to be trained based on the recognition loss, iteratively train the model to be trained based on m weld defect image samples, and finally obtain a weld defect recognition model, where m is a positive integer greater than 1.
[0091] In some embodiments, the second identification module 524 is configured to:
[0092] Calling the model to be trained to perform defect recognition on the weld defect image sample to obtain at least two groups of intermediate recognition results of the sample pipeline weld defects, each group of intermediate recognition results including an intermediate recognition defect position and an intermediate recognition defect type;
[0093] For each of the at least two groups of intermediate recognition results, calculating the recognition loss between the sample defect position and the intermediate recognition defect position, and between the sample defect type and the intermediate recognition defect type, and finally obtaining at least two intermediate recognition losses corresponding to the at least two groups of intermediate recognition results;
[0094] extracting a regional image from the weld defect image sample based on an intermediate recognition defect position corresponding to a minimum intermediate recognition loss among at least two intermediate recognition losses;
[0095] The model to be trained is called to perform defect recognition on the regional image to obtain the identified defect position and identified defect type of the sample pipeline weld defect.
[0096] In some embodiments, the second identification module 524 is configured to:
[0097] The model to be trained is called to perform defect recognition on the weld defect image sample to obtain the intermediate recognition defect position and intermediate recognition defect type of the sample pipeline weld defect;
[0098] Calculating the intermediate recognition loss between the sample defect position and the intermediate recognition defect position, and between the sample defect type and the intermediate recognition defect type;
[0099] In response to the intermediate recognition loss being less than a loss threshold, extracting a regional image from the weld defect image sample based on the intermediate recognition defect location;
[0100] The model to be trained is called to perform defect recognition on the regional image to obtain the identified defect position and identified defect type of the sample pipeline weld defect.
[0101] In some embodiments, a first weight corresponding to a defect position and a second weight corresponding to a defect type are set in a computer device; a calculation module 526 is used to:
[0102] calculating a first recognition loss between the sample defect position and the recognized defect position;
[0103] Calculating a second recognition loss between the sample defect type and the recognition defect type;
[0104] A first product of a first recognition loss and a first weight is calculated, a second product of a second recognition loss and a second weight is calculated, and the first product and the second product are added to obtain the recognition loss.
[0105] In summary, the training device for the weld defect recognition model provided in the present embodiment uses images of various types of pipeline weld defects for model training, so that when the trained weld defect recognition model is called, it can objectively and accurately output an image marked with the position and type of the pipeline weld defect, so that the application of the weld defect recognition model can avoid the problem of reduced accuracy of pipeline weld defect recognition caused by various subjective and objective factors such as video fatigue, emotional changes, weak ambient light, and low picture clarity caused by professionals watching similar pictures for a long time; or, provide strong reference data, professionals can quickly and finally determine the position and type of pipeline weld defects based on the pipeline weld defects identified by the machine; improve the recognition efficiency of weld defects and reduce the subjective error of weld defect recognition.
[0106] The present application also provides a computer device, which includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by the processor to implement the weld defect identification method as described above, or the training method of the weld defect identification model.
[0107] The present application also provides a computer-readable storage medium, which stores at least one instruction, at least one program, code set or instruction set. The at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the weld defect identification method provided by the above-mentioned method embodiments, or the training method of the weld defect identification model.
[0108] The present application also provides a computer program product, the computer program product includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the weld defect recognition method as described above, or the training method of the weld defect recognition model.
[0109] It should be understood that the "plurality" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.
[0110] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0111] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A weld defect identification method, characterized in that: Applied in a computer device, the computer device is provided with a weld defect recognition model constructed based on a convolutional neural network, and the method comprises: Acquire an image to be identified, where the image to be identified is a captured weld image of a long-distance pipeline; Calling the weld defect recognition model to perform defect recognition on the image to be recognized, and obtaining the defect position and defect type of the pipeline weld defect; Marking the pipeline weld defect in the image to be identified based on the defect position and the defect type, and obtaining an image marked with the pipeline weld defect; The training process of the weld defect recognition model includes: Acquire m weld defect image samples from a database, wherein the weld defect image samples are marked with sample defect positions and sample defect types of sample pipeline weld defects; Calling the model to be trained to perform defect recognition on the weld defect image sample to obtain the identified defect position and identified defect type of the sample pipeline weld defect; calculating the recognition loss between the sample defect position and the recognition defect position, and between the sample defect type and the recognition defect type; Adjusting the model parameters of the model to be trained based on the recognition loss, iteratively training the model to be trained based on the m weld defect image samples, and finally obtaining the weld defect recognition model, where m is a positive integer greater than 1; The calling of the model to be trained to perform defect recognition on the weld defect image sample to obtain the identified defect position and identified defect type of the sample pipeline weld defect includes: Calling the to-be-trained model to perform defect recognition on the weld defect image sample to obtain at least two groups of intermediate recognition results of the sample pipeline weld defects, each group of intermediate recognition results including an intermediate recognition defect position and an intermediate recognition defect type; For each of the at least two groups of intermediate recognition results, calculating the recognition loss between the sample defect position and the intermediate recognition defect position, and between the sample defect type and the intermediate recognition defect type, and finally obtaining at least two intermediate recognition losses corresponding to the at least two groups of intermediate recognition results; extracting a regional image from the weld defect image sample based on an intermediate recognition defect position corresponding to a minimum intermediate recognition loss among the at least two intermediate recognition losses; The model to be trained is called to perform defect recognition on the regional image to obtain the recognized defect position and the recognized defect type of the sample pipeline weld defect.
2. The method according to claim 1, characterized in that The calling of the model to be trained to perform defect recognition on the weld defect image sample to obtain the identified defect position and identified defect type of the sample pipeline weld defect includes: Calling the model to be trained to perform defect recognition on the weld defect image sample to obtain an intermediate recognition defect position and an intermediate recognition defect type of the sample pipeline weld defect; calculating an intermediate recognition loss between the sample defect position and the intermediate recognition defect position, and between the sample defect type and the intermediate recognition defect type; In response to the intermediate recognition loss being less than a loss threshold, extracting a regional image from the weld defect image sample based on the intermediate recognition defect location; The model to be trained is called to perform defect recognition on the regional image to obtain the recognized defect position and the recognized defect type of the sample pipeline weld defect.
3. The method according to any one of claims 1 to 2, characterized in that: The computer device is provided with a first weight corresponding to the defect position and a second weight corresponding to the defect type; The calculating the identification loss between the sample defect position and the identified defect position, and between the sample defect type and the identified defect type, comprises: calculating a first recognition loss between the sample defect position and the recognition defect position; calculating a second recognition loss between the sample defect type and the recognition defect type; A first product of the first recognition loss and the first weight is calculated, a second product of the second recognition loss and the second weight is calculated, and the first product and the second product are added to obtain the recognition loss.
4. A method for training a weld defect recognition model, characterized in that: The method comprises: Acquire m weld defect image samples from a database, wherein the weld defect image samples are marked with sample defect positions and sample defect types of sample pipeline weld defects; Calling the model to be trained to perform defect recognition on the weld defect image sample to obtain the identified defect position and identified defect type of the sample pipeline weld defect; calculating the recognition loss between the sample defect position and the recognition defect position, and between the sample defect type and the recognition defect type; Adjusting the model parameters of the model to be trained based on the recognition loss, iteratively training the model to be trained based on the m weld defect image samples, and finally obtaining a weld defect recognition model, where m is a positive integer greater than 1; The calling of the model to be trained to perform defect recognition on the weld defect image sample to obtain the identified defect position and identified defect type of the sample pipeline weld defect includes: Calling the to-be-trained model to perform defect recognition on the weld defect image sample to obtain at least two groups of intermediate recognition results of the sample pipeline weld defects, each group of intermediate recognition results including an intermediate recognition defect position and an intermediate recognition defect type; For each of the at least two groups of intermediate recognition results, calculating the recognition loss between the sample defect position and the intermediate recognition defect position, and between the sample defect type and the intermediate recognition defect type, and finally obtaining at least two intermediate recognition losses corresponding to the at least two groups of intermediate recognition results; extracting a regional image from the weld defect image sample based on an intermediate recognition defect position corresponding to a minimum intermediate recognition loss among the at least two intermediate recognition losses; The model to be trained is called to perform defect recognition on the regional image to obtain the recognized defect position and the recognized defect type of the sample pipeline weld defect.
5. A weld defect identification device, characterized in that: The device is provided with a weld defect recognition model constructed based on a convolutional neural network, and the device comprises: A first acquisition module is used to acquire an image to be identified, wherein the image to be identified is a collected weld image of a long-distance pipeline; A first recognition module is used to call the weld defect recognition model to perform defect recognition on the image to be recognized, and obtain the defect position and defect type of the pipeline weld defect; a marking module, configured to mark the pipeline weld defect in the image to be identified based on the defect position and the defect type, and obtain an image marked with the pipeline weld defect; A second acquisition module is used to acquire m weld defect image samples from a database, wherein the weld defect image samples are marked with sample defect positions and sample defect types of sample pipeline weld defects; The second recognition module is used to call the model to be trained to perform defect recognition on the weld defect image sample to obtain the identified defect position and identified defect type of the sample pipeline weld defect; A calculation module, used for calculating the recognition loss between the sample defect position and the recognition defect position, and between the sample defect type and the recognition defect type; A training module, used for adjusting the model parameters of the model to be trained based on the recognition loss, iteratively training the model to be trained based on the m weld defect image samples, and finally obtaining the weld defect recognition model, where m is a positive integer greater than 1; The second identification module is used to: The calling of the model to be trained to perform defect recognition on the weld defect image sample to obtain the identified defect position and identified defect type of the sample pipeline weld defect includes: Calling the to-be-trained model to perform defect recognition on the weld defect image sample to obtain at least two groups of intermediate recognition results of the sample pipeline weld defects, each group of intermediate recognition results including an intermediate recognition defect position and an intermediate recognition defect type; For each of the at least two groups of intermediate recognition results, calculating the recognition loss between the sample defect position and the intermediate recognition defect position, and between the sample defect type and the intermediate recognition defect type, and finally obtaining at least two intermediate recognition losses corresponding to the at least two groups of intermediate recognition results; extracting a regional image from the weld defect image sample based on an intermediate recognition defect position corresponding to a minimum intermediate recognition loss among the at least two intermediate recognition losses; The model to be trained is called to perform defect recognition on the regional image to obtain the recognized defect position and the recognized defect type of the sample pipeline weld defect.
6. A training device for a weld defect recognition model, characterized in that: The device comprises: A second acquisition module is used to acquire m weld defect image samples from a database, wherein the weld defect image samples are marked with sample defect positions and sample defect types of sample pipeline weld defects; The second recognition module is used to call the model to be trained to perform defect recognition on the weld defect image sample to obtain the identified defect position and identified defect type of the sample pipeline weld defect; A calculation module, used for calculating the recognition loss between the sample defect position and the recognition defect position, and between the sample defect type and the recognition defect type; A training module, used for adjusting the model parameters of the model to be trained based on the recognition loss, iteratively training the model to be trained based on the m weld defect image samples, and finally obtaining a weld defect recognition model, where m is a positive integer greater than 1; The second identification module is used to: The calling of the model to be trained to perform defect recognition on the weld defect image sample to obtain the identified defect position and identified defect type of the sample pipeline weld defect includes: Calling the to-be-trained model to perform defect recognition on the weld defect image sample to obtain at least two groups of intermediate recognition results of the sample pipeline weld defects, each group of intermediate recognition results including an intermediate recognition defect position and an intermediate recognition defect type; For each of the at least two groups of intermediate recognition results, calculating the recognition loss between the sample defect position and the intermediate recognition defect position, and between the sample defect type and the intermediate recognition defect type, and finally obtaining at least two intermediate recognition losses corresponding to the at least two groups of intermediate recognition results; extracting a regional image from the weld defect image sample based on an intermediate recognition defect position corresponding to a minimum intermediate recognition loss among the at least two intermediate recognition losses; The model to be trained is called to perform defect recognition on the regional image to obtain the recognized defect position and the recognized defect type of the sample pipeline weld defect.
7. A computer device, characterized in that: The computer device includes: a processor and a memory, the memory stores a computer program, and the computer program is loaded and executed by the processor to implement the weld defect identification method as described in any one of claims 1 to 3, or the training method of the weld defect identification model as described in claim 4.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which is loaded and executed by a processor to implement the weld defect identification method as described in any one of claims 1 to 3, or the weld defect identification model training method as described in claim 4.