Pipeline butt joint weld defect segmentation method and device and storage medium
By establishing technical means, the problem of automatic segmentation of X-ray joint weld images has been solved, realizing rapid and efficient segmentation of butt joint weld images with strong adaptability and adaptability to images with different grayscale differences.
Patent Information
- Application Number
- CN202211643635.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-20
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2042-12-20
AI Technical Summary
In existing technologies, X-ray images of butt joint welds are blurry, have poor imaging quality, and are difficult to automatically segment point-like and line-like defects.
By establishing a two-layer 3D table, using energy functions to constrain pixel types, solving a system of differential equations, determining defect areas, avoiding repeated threshold calculations, and supporting parallel computing.
It achieves automatic segmentation of weld seam images of butt joints, has strong adaptability, fast calculation, and can adapt to images with different grayscale differences, thus improving detection efficiency.
Smart Images

Figure CN115984303B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, and in particular to a pipeline butt joint weld defect segmentation method, device and storage medium. BACKGROUND
[0002] Welding technology is widely used in oil and gas pipeline industry. Butt joint welding is the most common welding method in pipeline construction, and defects in butt joint welds can cause pipeline rupture and explosion. Therefore, defect detection and identification in butt joint welds are particularly important in the pipeline transportation industry.
[0003] The detection of butt joint weld defects is achieved by non-destructive testing (NDT) method. Among various non-destructive testing methods, the defect detection of butt joint weld images based on X-ray is the most important method. The segmentation of defect images is an important basis for defect recognition. At present, the X-ray butt joint weld image is blurred, and the imaging quality is poor, making it difficult to automatically segment the point and line defects of the butt joint X-ray weld image. SUMMARY
[0004] The technical problem to be solved by the present application is to provide a pipeline butt joint weld defect segmentation method, device and storage medium to solve the problems existing in the prior art.
[0005] To solve the above technical problems, the present application provides a pipeline butt joint weld defect segmentation method, which comprises: acquiring a pipeline butt joint X-ray weld image, determining the gray value of each pixel point in the image; establishing two layers of three-dimensional tables representing whether the pixel point is a defect, and storing pixel point type elements in the two layers of three-dimensional tables; using an energy function to constrain the type division of each pixel point, and any type of pixel point has the smallest gray value difference with its surrounding pixel points of the same type, and any pixel point is not an isolated point; solving the energy function to obtain a system of differential equations about the pixel point type elements, and solving the system of differential equations to obtain the pixel point type; determining the defect area according to the average gray value size of different type pixel point areas.
[0006] To solve the above technical problems, the present application also provides a pipeline butt joint weld defect segmentation device, which comprises: an X-ray weld image acquisition module, a two-layer three-dimensional table establishment module, an energy function establishment module, a pixel point type solving module and a defect segmentation module.
[0007] The X-ray weld image acquisition module acquires X-ray weld images of pipe butt joints and determines the grayscale value of each pixel in the image. The two-layer solid table creation module establishes a two-layer solid table to characterize whether a pixel is a defect, storing pixel type elements in the two-layer solid table. The energy function creation module uses the energy function to constrain each pixel for type classification, ensuring that any pixel of a certain type has the minimum grayscale value difference with its surrounding pixels of the same type, and that no pixel is an isolated point. The pixel type solution module solves the energy function to obtain a system of differential equations about the pixel type, and solves the system of differential equations to obtain the pixel type. The defect segmentation module determines the defect region based on the average grayscale value of different types of pixel regions.
[0008] To address the aforementioned technical problems, the present invention also provides a computer-readable storage medium including instructions that, when executed on a computer, cause the computer to perform the pipe butt joint weld defect segmentation method provided by the above-described technical solution.
[0009] To solve the above-mentioned technical problems, the present invention also provides a pipe butt joint weld defect segmentation device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the pipe butt joint weld defect segmentation method provided by the above-mentioned technical solution.
[0010] The beneficial effects of this invention are as follows: It uses a two-layer three-dimensional table to characterize whether a pixel is a defect, constrains each pixel using an energy function, and obtains a system of differential equations concerning the pixel type by solving the energy function. Solving this system of differential equations yields the pixel type, and then the defect region is determined based on the average grayscale value of different pixel types. Because different X-ray butt joint weld images have large grayscale differences, it is difficult to distinguish defects in different images using a fixed average grayscale value, making it difficult to achieve automatic defect segmentation using thresholding. This invention achieves defect segmentation by solving a system of differential equations, avoiding repeated threshold calculations. Furthermore, the form of the differential equation system supports parallel computing, which can accelerate the calculation speed when hardware conditions permit. This invention can automatically segment point and line defects in X-ray butt joint weld images, exhibiting strong adaptability and fast calculation.
[0011] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0012] Figure 1 A flowchart of a pipe butt joint weld defect segmentation method provided in an embodiment of the present invention;
[0013] Figure 2 A two-layer stereoscopic representation provided for embodiments of the present invention;
[0014] Figure 3 A schematic diagram of a pipe butt joint weld defect segmentation device provided in an embodiment of the present invention;
[0015] Figure 4 This is an X-ray weld image of a butt joint provided in Embodiment 1 of the present invention;
[0016] Figure 5 This is a schematic diagram of a two-layer three-dimensional representation provided in Embodiment 1 of the present invention;
[0017] Figure 6 This is a defect segmentation diagram of an X-ray weld image of a butt joint provided in Embodiment 1 of the present invention;
[0018] Figure 7 This is an X-ray weld image of a butt joint provided in Embodiment 2 of the present invention;
[0019] Figure 8 This is a schematic diagram of a two-layer three-dimensional representation provided in Embodiment 2 of the present invention;
[0020] Figure 9 This is a defect segmentation diagram of an X-ray weld image of a butt joint provided in Embodiment 2 of the present invention;
[0021] Figure 10 This is an X-ray weld image of a butt joint provided in Embodiment 3 of the present invention;
[0022] Figure 11 This is a schematic diagram of a two-layer three-dimensional representation provided in Embodiment 3 of the present invention;
[0023] Figure 12 This is a defect segmentation diagram of an X-ray weld image of a butt joint provided in Embodiment 3 of the present invention. Detailed Implementation
[0024] The following specific examples illustrate the implementation of this disclosure. Those skilled in the art can easily understand other advantages and effects of this disclosure from the content disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. This disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this disclosure. It should be noted that, in the absence of conflict, the following embodiments and features in the embodiments can be combined with each other. Based on the embodiments in this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0025] It should be noted that various aspects of embodiments within the scope of the appended claims are described below. It will be apparent that the aspects described herein can be embodied in a wide variety of forms, and any particular structure and / or function described herein is merely illustrative. Based on this disclosure, those skilled in the art will understand that one aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number of aspects set forth herein can be used to implement the device and / or practice the method. Additionally, this device and / or method can be implemented using structures and / or functionalities other than one or more of the aspects set forth herein.
[0026] Figure 1 A flowchart illustrating a method for segmenting weld defects in pipe butt joints provided in an embodiment of the present invention. Figure 1 As shown, the method includes:
[0027] S1, acquire X-ray weld images of pipe butt joints and determine the grayscale value of each pixel in the image;
[0028] Specifically, define the grayscale variable g. ij , 1≤i≤N, 1≤j≤M. N is the height of the X-ray weld image of the butt joint, M is the width of the X-ray weld image of the butt joint, and the variable g ij Used to characterize the grayscale value of pixel (i,j).
[0029] S2, establish a two-layer 3D table to represent whether a pixel is a defect, and store pixel type elements in the two-layer 3D table.
[0030] like Figure 2 As shown, the two-layer 3D table consists of two layers, each containing N rows and M columns, where N is the height of the X-ray weld image and M is the width of the X-ray weld image; the pixel type element stored in the two-layer 3D table is denoted as v. kij Where k = 1 or 2, v 1ij This represents the pixel type element in the i-th row and j-th column of the upper layer of a two-layer 3D table, v. 2ij This represents the pixel type element in the i-th row and j-th column of the lower layer of the two-layer 3D table, where i = 1, 2, ..., N, and j = 1, 2, ..., M.
[0031] S3 uses an energy function to constrain each pixel to classify it into different types, and each type of pixel has the smallest gray value difference with its surrounding pixels of the same type, and each pixel is not an isolated point.
[0032] Specifically, the first term of the energy function constrains that each pixel must be classified into either the first category (defect) or the second category (non-defect); the second term of the energy function constrains that any pixel of any category has the minimum gray value difference with its surrounding pixels of the same category. This term enables automatic threshold calculation and takes into account the positional information of the pixel; the third term constrains that neither defective nor non-defective pixels can exist as isolated points, thus eliminating the interference of salt-and-pepper noise.
[0033] S4, Solve the energy function to obtain a system of differential equations about the pixel type, and solve the system of differential equations to obtain the pixel type;
[0034] S5, determine the defect area based on the average gray value of different types of pixel areas.
[0035] This invention employs a two-layer 3D table to characterize whether a pixel is a defect. Each pixel is constrained by an energy function. By solving the energy function, a system of differential equations concerning the pixel type is obtained. Solving this system of differential equations determines the pixel type, and then the defect region is determined based on the average grayscale value of different pixel types. This invention achieves defect segmentation by solving a system of differential equations, avoiding repeated threshold calculations. Furthermore, the form of the differential equations supports parallel computing, accelerating computation when hardware conditions permit. This invention can automatically segment point and line defects in X-ray weld images of butt joints, demonstrating strong adaptability and rapid computation.
[0036] Alternatively, the energy function formula is as follows:
[0037]
[0038] Where Δ is the normalization coefficient; E is the energy function value; E1, E2 and E3 are coefficients greater than 0; i, j, k, o, p are variables; N is the height of the X-ray weld image; M is the width of the X-ray weld image; C is the number of image categories, with a value of 2, representing the first and second category pixels.
[0039] In this embodiment of the invention, the first term of the energy function constrains each pixel to be classified into either a first category (defect) or a second category (non-defect); the second term of the energy function constrains any pixel of any category to have the minimum grayscale value difference with its surrounding pixels of the same category. This term enables automatic threshold calculation and takes into account the positional information of the pixel; the third term constrains that neither defective nor non-defective pixels can exist as isolated points, thus eliminating the interference of salt-and-pepper noise.
[0040] Alternatively, the energy function can be solved using the following formula:
[0041]
[0042] Obtain the system of differential equations regarding pixel type:
[0043]
[0044] Among them, u kij u is an intermediate variable. v The normalization coefficients are obtained by solving the energy function using the Euler method to obtain the element values v of each unit in the two-layer solid table. kij v kij For pixel-type elements, representing the category of pixel (i,j), defined as follows: v 1ij When v = 1, it indicates that pixel (i,j) belongs to the first class. 1ij = 0 indicates that pixel (i,j) belongs to the second class, v 2ij When v = 1, it indicates that pixel (i,j) belongs to the second class. 2ij When the value is 0, it indicates that pixel (i,j) belongs to the first class. That is:
[0045]
[0046]
[0047] The present invention achieves defect segmentation by solving a system of differential equations, avoiding repeated threshold calculations. Furthermore, the form of the system of differential equations can support parallel computing, which can speed up the calculation when the hardware conditions are met.
[0048] Optionally, the defect area is determined based on the average gray value of different types of pixel areas, including: calculating the average gray value of the first type of pixels and the average gray value of the second type of pixels, as shown in the following formula:
[0049]
[0050]
[0051] Where ave1 is the average gray value of the first type of pixels, ave2 is the average gray value of the second type of pixels, N is the height of the X-ray weld image, M is the width of the X-ray weld image, and g ij Let be the grayscale value of pixel (i,j).
[0052] If the average gray value of the first type of pixels is greater than the average gray value of the second type of pixels, then all v 1ij Pixels (i,j) with a value of 1 are considered defects and are highlighted. 1ij Pixels (i,j) with a value of 0 are non-defective and are marked in black.
[0053] If the average gray value of the first type of pixels is less than or equal to the average gray value of the second type of pixels, then all v 1ij Pixels (i,j) with a value of 0 are considered defects and are highlighted. 1ij Pixels (i,j) with a value of 1 are non-defective and are marked in black.
[0054] The present invention will now be described in detail with reference to specific embodiments.
[0055] Example 1:
[0056] X-ray weld images of butt joints are as follows Figure 4 As shown, N = 193, M = 193.
[0057] S1: Define the grayscale variable g ij 1≤i≤N, 1≤j≤M. N is the height of the X-ray weld image of the butt joint, M is the width of the X-ray weld image of the butt joint, N=193, M=193, variable g ij Used to characterize the grayscale value of pixel (i,j).
[0058] S2: Establish a two-layer 3D table to represent whether a pixel is a defect, such as Figure 5 As shown.
[0059] v kij For pixel-type elements, representing the category of pixel (i,j), defined as follows:
[0060]
[0061]
[0062] S3: Establish the following energy function:
[0063]
[0064] Where Δ is the normalization coefficient, typically taken as 0.01 or less; E represents the energy function value; E1 = 200, E2 = 55, E3 = 120; i, j, k, o, p are variables; the first term of the energy function constrains that each pixel must be classified into either the first or second class. The second term of the energy function constrains that any pixel of any class has the minimum grayscale difference with its surrounding pixels of the same class. This term enables automatic threshold calculation and takes into account the pixel's positional information. The third term constrains that neither defective nor non-defective pixels can exist as isolated points, eliminating the interference of salt-and-pepper noise.
[0065] S4: Solve equation (3) using equation (4);
[0066]
[0067] Among them, u kij v is an intermediate variable; kij These are the values of each element in the two-layer 3D table.
[0068] S5: From equations (3) and (4), the dynamic equation for solving equation (3) is:
[0069]
[0070] Among them, u v The normalization coefficient is set to 0.001 or less. The element values v of each unit in the two-layer solid table can be obtained by solving equation (3) using the Euler method. kij v kij Select elements for pixel type, representing the category of pixel (i,j), defined as follows: v 1ij When v = 1, it indicates that pixel (i,j) belongs to the first class. 1ij =0 indicates that pixel (i,j) belongs to the second class. 2ij When v = 1, it indicates that pixel (i,j) belongs to the second class. 2ij = 0 indicates that pixel (i,j) belongs to the first class.
[0071] S6: Define the average gray value ave1 of the first type of pixels and the average gray value ave2 of the second type of pixels. The calculation formulas are shown in equations (6) and (7).
[0072]
[0073]
[0074] Among them, v 1ij and v 2ij The definition is as follows: v 1ij When v = 1, it indicates that pixel (i,j) belongs to the first class. 1ij =0 indicates that pixel (i,j) belongs to the second class. 2ij When v = 1, it indicates that pixel (i,j) belongs to the second class. 2ij = 0 indicates that pixel (i,j) belongs to the first class.
[0075] S7: If ave1 > ave2, then all v 1ij Pixels (i,j) with a value of 1 are considered defects and are highlighted. 1ij Pixels with a value of 0 (i,j) are considered non-defective and are marked entirely in black. Otherwise, all v... 1ij Pixels (i,j) with a value of 0 are considered defects and are highlighted. 1ij Pixels (i,j) with a value of 1 are non-defects and are marked in black. This image shows the defect segmentation result, as follows: Figure 6 As shown.
[0076] Example 2:
[0077] X-ray weld images of butt joints are as follows Figure 7 As shown, N = 205, M = 205.
[0078] S1: Define the grayscale variable g ij 1≤i≤N, 1≤j≤M. N is the height of the X-ray weld image of the butt joint, M is the width of the X-ray weld image of the butt joint, N=205, M=205, variable g ij Used to characterize the grayscale value of pixel (i,j).
[0079] S2: Establish a two-layer 3D table to represent whether a pixel is a defect, such as Figure 8 As shown.
[0080] v kij For pixel-type elements, representing the category of pixel (i,j), defined as follows:
[0081]
[0082]
[0083] S3: Establish the following energy function:
[0084]
[0085] Where Δ is the normalization coefficient, typically taken as 0.01 or less; E represents the energy function value; E1 = 200, E2 = 55, E3 = 120; i, j, k, o, p are variables; the first term of the energy function constrains that each pixel must be classified into either the first or second class. The second term of the energy function constrains that any pixel of any class has the minimum grayscale difference with its surrounding pixels of the same class. This term enables automatic threshold calculation and takes into account the pixel's positional information. The third term constrains that neither defective nor non-defective pixels can exist as isolated points, eliminating the interference of salt-and-pepper noise.
[0086] S4: Solve equation (3) using equation (4):
[0087]
[0088] Among them, u ki j is an intermediate variable; v kij These are the values of each element in the two-layer 3D table.
[0089] S5: From equations (3) and (4), the dynamic equation for solving equation (3) is:
[0090]
[0091] Among them, u v The normalization coefficient is set to 0.001 or less. The element values v of each unit in the two-layer solid table can be obtained by solving equation (3) using the Euler method. kij v kij Select elements for pixel type, representing the category of pixel (i,j), defined as follows: v 1ij When v = 1, it indicates that pixel (i,j) belongs to the first class. 1ij =0 indicates that pixel (i,j) belongs to the second class. 2ij When v = 1, it indicates that pixel (i,j) belongs to the second class. 2ij = 0 indicates that pixel (i,j) belongs to the first class.
[0092] S6: Define the average gray value ave1 of the first type of pixels and the average gray value ave2 of the second type of pixels. The calculation formulas are shown in equations (6) and (7).
[0093]
[0094]
[0095] Among them, v 1ij and v 2ij The definition is as follows: v 1ij When v = 1, it indicates that pixel (i,j) belongs to the first class. 1ij =0 indicates that pixel (i,j) belongs to the second class. 2ij When v = 1, it indicates that pixel (i,j) belongs to the second class. 2ij = 0 indicates that pixel (i,j) belongs to the first class.
[0096] S7: If ave1 > ave2, then all v 1ij Pixels (i,j) with a value of 1 are considered defects and are highlighted. 1ij Pixels with a value of 0 (i,j) are considered non-defective and are marked entirely in black. Otherwise, all v... 1ij Pixels (i,j) with a value of 0 are considered defects and are highlighted. 1ij Pixels (i,j) with a value of 1 are non-defects and are marked in black. This image shows the defect segmentation result, as follows: Figure 9 As shown.
[0097] Example 3:
[0098] X-ray weld images of butt joints are as follows Figure 10 As shown, N = 144, M = 144.
[0099] S1: Define the grayscale variable g ij1≤i≤N, 1≤j≤M. N is the height of the X-ray weld image of the butt joint, M is the width of the X-ray weld image of the butt joint, N=144, M=144, variable g ij Used to characterize the grayscale value of pixel (i,j).
[0100] S2: Establish a two-layer 3D table to represent whether a pixel is a defect, such as Figure 11 As shown.
[0101] v kij For pixel-type elements, representing the category of pixel (i,j), defined as follows:
[0102]
[0103]
[0104] S3: Establish the following energy function:
[0105]
[0106] Where Δ is the normalization coefficient, typically taken as 0.01 or less; E represents the energy function value; E1 = 200, E2 = 55, E3 = 120; i, j, k, o, p are variables; the first term of the energy function constrains that each pixel must be classified into either the first or second class. The second term of the energy function constrains that any pixel of any class has the minimum grayscale difference with its surrounding pixels of the same class. This term enables automatic threshold calculation and takes into account the pixel's positional information. The third term constrains that neither defective nor non-defective pixels can exist as isolated points, eliminating the interference of salt-and-pepper noise.
[0107] S4: Solve equation (3) using equation (4):
[0108]
[0109] Among them, u kij v is an intermediate variable; kij These are the values of each element in the two-layer 3D table.
[0110] S5: From equations (3) and (4), the dynamic equation for solving equation (3) is:
[0111]
[0112] Among them, u v The normalization coefficient is set to 0.001 or less. The element values v of each unit in the two-layer solid table can be obtained by solving equation (3) using the Euler method. kij v kijSelect elements for pixel type, representing the category of pixel (i,j), defined as follows: v 1ij When v = 1, it indicates that pixel (i,j) belongs to the first class. 1ij =0 indicates that pixel (i,j) belongs to the second class. 2ij When v = 1, it indicates that pixel (i,j) belongs to the second class. 2ij = 0 indicates that pixel (i,j) belongs to the first class.
[0113] S6: Define the average gray value ave1 of the first type of pixels and the average gray value ave2 of the second type of pixels. The calculation formulas are shown in equations (6) and (7).
[0114]
[0115]
[0116] Among them, v 1ij and v 2ij The definition is as follows: v 1ij When v = 1, it indicates that pixel (i,j) belongs to the first class. 1ij =0 indicates that pixel (i,j) belongs to the second class. 2ij When v = 1, it indicates that pixel (i,j) belongs to the second class. 2ij = 0 indicates that pixel (i,j) belongs to the first class.
[0117] S7: If ave1 > ave2, then all v 1ij Pixels (i,j) with a value of 1 are considered defects and are highlighted. 1ij Pixels with a value of 0 (i,j) are considered non-defective and are marked entirely in black. Otherwise, all v... 1ij Pixels (i,j) with a value of 0 are considered defects and are highlighted. 1ij Pixels (i,j) with a value of 1 are non-defects and are marked in black. This image shows the defect segmentation result, as follows: Figure 12 As shown.
[0118] This invention also provides a pipe butt joint weld defect segmentation device, comprising: an X-ray weld image acquisition module, a two-layer stereo table establishment module, an energy function establishment module, a pixel type solving module, and a defect segmentation module.
[0119] The X-ray weld image acquisition module acquires X-ray weld images of pipe butt joints and determines the grayscale value of each pixel in the image. The two-layer solid table creation module establishes a two-layer solid table to characterize whether a pixel is a defect, storing pixel type elements in the two-layer solid table. The energy function creation module uses the energy function to constrain each pixel for type classification, ensuring that any pixel of a certain type has the minimum grayscale value difference with its surrounding pixels of the same type, and that no pixel is an isolated point. The pixel type solution module solves the energy function to obtain a system of differential equations about the pixel type, and solves the system of differential equations to obtain the pixel type. The defect segmentation module determines the defect region based on the average grayscale value of different types of pixel regions.
[0120] This invention also provides a computer-readable storage medium including instructions that, when executed on a computer, cause the computer to perform the pipe butt joint weld defect segmentation method provided in the above embodiments.
[0121] like Figure 3 As shown, this embodiment of the invention also provides a pipe butt joint weld defect segmentation device 3000, which includes a processor 3001, a memory 3003, and a computer program stored in the memory 3003 and executable on the processor 3001. When the processor 3001 executes the program, it implements the pipe butt joint weld defect segmentation method provided in the above embodiment.
[0122] The processor 3001 and memory 3003 are connected, for example, via a bus 3002. Optionally, the electronic device 3000 may also include a transceiver 3003, which can be used for data interaction between the electronic device and other electronic devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 3003 is not limited to one, and the structure of the electronic device 3000 does not constitute a limitation on the embodiments of the present invention.
[0123] Processor 3001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this invention. Processor 3001 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0124] Bus 3002 may include a pathway for transmitting information between the aforementioned components. Bus 3002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 3002 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 3 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0125] The memory 3003 may be ROM (Read Only Memory) or other types of static storage devices capable of storing static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices capable of storing information and instructions, or EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto.
[0126] The memory 3003 stores the application program code (computer program) that executes the present invention, and its execution is controlled by the processor 3001. The processor 3001 executes the application program code stored in the memory 3003 to implement the content shown in the foregoing method embodiments.
[0127] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described apparatus and unit can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0128] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0129] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of the present invention, depending on actual needs.
[0130] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0131] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0132] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for segmenting weld defects in pipe butt joints, characterized in that, include: Acquire X-ray weld images of pipe butt joints and determine the grayscale value of each pixel in the image; A two-layer stereo table is established to characterize whether a pixel is a defect, and the two-layer stereo table stores pixel type elements. The two-layer three-dimensional table includes two layers, each of which includes N rows and M columns, where N is the height of the X-ray weld image and M is the width of the X-ray weld image; The pixel type elements stored in the two-layer 3D table are denoted as v. kij Where k = 1 or 2, v 1ij This represents the pixel type element in the i-th row and j-th column of the upper layer of the two-layer 3D table, v 2ij This represents the pixel type element in the i-th row and j-th column of the lower layer table in the two-layer 3D table, where i = 1, 2...N, j = 1, 2...M; Each pixel is classified into different types using an energy function constraint, whereby any pixel of a certain type has the minimum gray value difference with its surrounding pixels of the same type, and no pixel is an isolated point. Solving the energy function yields a system of differential equations concerning pixel type; solving the system of differential equations yields the pixel type. Defect areas are determined based on the average grayscale value of different types of pixel regions.
2. The method for segmenting weld defects in pipe butt joints according to claim 1, characterized in that, The energy function formula is as follows: Where Δ is the normalization coefficient; E is the energy function value; E1, E2, and E3 are coefficients greater than 0; i, j, k, o, and p are variables; N is the height of the X-ray weld image; M is the width of the X-ray weld image; C is the number of image categories, with a value of 2, representing the first and second categories of pixels; the first term of the energy function constrains each pixel to be classified into either the first or second category; the second term of the energy function constrains any pixel of any category to have the minimum gray value difference with its surrounding pixels of the same category; and the third term constrains any pixel to be an isolated point.
3. The method for segmenting weld defects in pipe butt joints according to claim 2, characterized in that, The energy function can be solved using the following formula: Obtain the system of differential equations regarding pixel type: Among them, u kij u is an intermediate variable. v The normalization coefficients are obtained by solving the energy function using the Euler method to obtain the element values v of each unit in the two-layer solid table. kij v kij For pixel-type elements, representing the category of pixel (i,j), defined as follows: v 1ij When v = 1, it indicates that pixel (i,j) belongs to the first class. 1ij = 0 indicates that pixel (i,j) belongs to the second class, v 2ij When v = 1, it indicates that pixel (i,j) belongs to the second class. 2ij = 0 indicates that pixel (i,j) belongs to the first class.
4. The method for segmenting weld defects in pipe butt joints according to claim 3, characterized in that, The step of determining the defect region based on the average grayscale value of different types of pixel regions includes: Calculate the average gray value of the first type of pixels and the average gray value of the second type of pixels. If the average gray value of the first type of pixels is greater than the average gray value of the second type of pixels, then all v 1ij Pixels (i,j) with a value of 1 are considered defects and are highlighted. 1ij Pixels (i,j) with a value of 0 are non-defective and are marked in black.
5. The method for segmenting weld defects in pipe butt joints according to claim 4, characterized in that, The step of determining the defect region based on the average gray value of different types of pixel regions further includes: if the average gray value of the first type of pixels is less than or equal to the average gray value of the second type of pixels, then all v 1ij Pixels (i,j) with a value of 0 are considered defects and are highlighted. 1ij Pixels (i,j) with a value of 1 are non-defective and are marked in black.
6. The method for segmenting weld defects in pipe butt joints according to claim 4, characterized in that, The formula for calculating the average gray value of the first type of pixels and the average gray value of the second type of pixels is as follows: Where ave1 is the average gray value of the first type of pixels, ave2 is the average gray value of the second type of pixels, N is the height of the X-ray weld image, M is the width of the X-ray weld image, and g ij Let be the grayscale value of pixel (i,j).
7. A device for dividing weld defects in pipe butt joints, characterized in that, include: The X-ray weld image acquisition module is used to acquire X-ray weld images of pipe butt joints and determine the grayscale value of each pixel in the image. A two-layer stereo table creation module is used to create a two-layer stereo table that characterizes whether a pixel is a defect. The two-layer stereo table stores pixel type elements. The two-layer three-dimensional table includes two layers, each of which includes N rows and M columns, where N is the height of the X-ray weld image and M is the width of the X-ray weld image; The pixel type elements stored in the two-layer 3D table are denoted as v. kij Where k = 1 or 2, v 1ij This represents the pixel type element in the i-th row and j-th column of the upper layer of the two-layer 3D table, v 2ij This represents the pixel type element in the i-th row and j-th column of the lower layer table in the two-layer 3D table, where i = 1, 2...N, j = 1, 2...M; The energy function establishment module is used to constrain each pixel point to classify it into different types using the energy function, and each type of pixel point has the minimum gray value difference with its surrounding pixels of the same type, and each pixel point is not an isolated point. A pixel type solving module is used to solve the energy function to obtain a system of differential equations about the pixel type, and solve the system of differential equations to obtain the pixel type. The defect segmentation module is used to determine the defect region based on the average gray value of different types of pixel regions.
8. A computer-readable storage medium comprising instructions, characterized in that, When the instructions are executed on a computer, the computer performs the pipe butt joint weld defect segmentation method according to any one of claims 1 to 6.
9. A device for segmenting weld defects in pipe butt joints, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the pipe butt joint weld defect segmentation method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Tube panel welding seam detection method and system, electronic equipment and storage medium
CN114648517A
Method and system for identifying weld data in welding process of dust remover
CN115082464A