Detection method and device suitable for repeated X-ray welding seam negative film, electronic equipment and storage medium
By calculating the hash value and Hamming distance of the X-ray weld backsheet area, and judging the similarity to determine the duplicate negative, the problems of low detection efficiency and large resource utilization in the prior art are solved, and automated detection and efficient detection are realized.
Patent Information
- Application Number
- CN202510070821.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-16
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2045-01-16
AI Technical Summary
In the prior art, the repeated detection efficiency of X-ray weld backsheets is low, and the neural network model occupies a large amount of computing resources and storage resources, and the detection accuracy is greatly affected by the quality and quantity of samples, which can easily cause inaccurate detection.
By determining the hash values and Hamming distances of the weld area, the base material area and the entire area of the negative, the similarity of each area is calculated, and whether all similarities are less than the set threshold value are determined to determine whether there is a duplicate negative.
The automatic detection of repeated X-ray weld backsheets is realized, the detection efficiency is improved, and it is robust to manual forgery and tampering, and is not affected by the quality of the training sample.
Smart Images

Figure CN119477924A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of weld film detection, and is a detection method, device, electronic equipment and storage medium suitable for repeated X-ray weld films. Background Art
[0002] When using X-ray flaw detectors to image internal defects in welds, when the same object is photographed multiple times with the same angle, position or parameters or when the X-ray flaw detector fails, duplicate X-ray weld films may be produced. In addition, duplicate X-ray weld films may also be produced due to human malpractice such as copying X-ray weld films, covering the weld area or parent material area of one X-ray weld film with the weld area or parent material area of another X-ray weld film.
[0003] Therefore, before weld defect detection, it is generally necessary to evaluate the quality of X-ray weld films. This evaluation process mainly tests the imaging quality and repeatability of X-ray weld films, thereby ensuring the quality of X-ray weld film data and preventing cheating.
[0004] Currently, the commonly used X-ray weld film repeatability detection is mostly done manually, and a small part is done by machine. Manual completion relies on the staff to perform repeated detection of X-ray weld films based on the image shooting parameters and image identification. This method has a high accuracy rate, but the efficiency is very low. Using a machine to complete the X-ray weld film repeatedly uses a computer algorithm or a neural network model. However, the use of a neural network model to repeatedly detect X-ray weld films occupies a large amount of computing resources and storage resources, is easily limited to local convergence, and the detection accuracy of the neural network model is greatly affected by the quality and quantity of the sample, which can easily cause inaccurate detection.
[0005] An existing public patent document, publication number CN118015305A, discloses a method for identifying identical films of welding X-ray films, the method comprising: establishing a historical film image library; training a first preset model using historical film images to obtain a first model for identifying defect classification features, and collecting dynamic information used to characterize the changing state of the neural network during the training process of the first model, based on which, training a second preset model to obtain a second model for identifying defect index features indicating defect features on film images; using each model to respectively predict defect classification features and defect index features of the film to be identified; screening out images having the same type of defects as the film to be identified from the image library and recording them as first images, and comparing and analyzing the first image with the predicted defect index features to diagnose whether there are images in the image library having the same welding features as the film to be identified.
[0006] The second existing public patent document, with publication number CN110084807B, discloses a method for detecting the forgery of weld flaw detection film images. First, the colloid weld flaw detection film image is scanned into a digitized weld flaw detection film image, and the digitized weld flaw detection film image is sorted according to the film number, and the image is submitted in the order of the film number. Then, the feature summary represented by the hash value in the weld flaw detection film image is extracted, and compared with the feature summary saved in the database, so as to detect the weld flaw detection film image submitted repeatedly. Furthermore, the newly submitted weld flaw detection film image and the weld flaw detection film image last saved in the database are matched with each other in the overlap area based on the SIFT algorithm and the SSIM similarity, so as to detect the weld flaw detection film image that is not submitted repeatedly but has the mismatched overlap area. Summary of the invention
[0007] The present invention provides a detection method, device, electronic device and storage medium suitable for repeated X-ray weld film, which overcomes the shortcomings of the above-mentioned prior art and can effectively solve the problems of low repeated detection efficiency of existing manual X-ray weld film repeated detection methods and the need to occupy a large amount of computing resources and storage resources of neural network model X-ray weld film repeated detection methods.
[0008] One of the technical solutions of the present invention is achieved by the following measures: A detection method suitable for repeated X-ray weld films, comprising: Determine the weld area, the base material area and the whole film area in the first X-ray weld film and the second X-ray weld film respectively; Select at least two region types, and determine hash values and Hamming distances of corresponding regions in the first X-ray weld film and the second X-ray weld film, respectively; Determine the similarity between the first X-ray weld film and the second X-ray weld film in each selected area according to the hash value and the Hamming distance; in, is the similarity of region x; is the Hamming distance of region x; is the hash value length of region x in the original X-ray weld film, where the original X-ray weld film is the first X-ray weld film or the second X-ray weld film; It is determined whether all similarities are less than or equal to a set threshold, and if no, there are duplicate negatives.
[0009] The following are further optimizations and / or improvements to the above technical solutions: The above-mentioned respectively determining the weld area, the base material area and the whole film area in the first X-ray weld film and the second X-ray weld film includes: Extracting multiple column pixel point sets in the horizontal direction based on the set width on the first X-ray weld film, and taking the column pixel point with the largest peak width in each column pixel point set as the center point of the weld area; Obtain the true curve and the fitting curve of each column pixel set, and take the column pixel point with the largest gray value difference between the true curve and the fitting curve as the boundary point of the weld area, wherein the fitting curve is obtained by fitting using the least square method; The median absolute deviation method is used to remove abnormal boundary points in all weld area boundary points and extract effective weld area boundary points; Determine the upper boundary and the lower boundary of the weld area based on the boundary points of the effective weld area, and divide the weld area according to the upper boundary and the lower boundary of the weld area; The remaining area after removing the weld area in the first X-ray weld film is the base material area; Repeat the above process to determine the weld area, base material area and the entire film area in the second X-ray weld film.
[0010] The above-mentioned determining the upper boundary and the lower boundary of the weld area based on the boundary points of the effective weld area, and segmenting the weld area according to the upper boundary and the lower boundary of the weld area, includes: Determine an upper boundary point set and a lower boundary point set based on the boundary points of the effective weld area; The value corresponding to the minimum ordinate in the upper boundary point set is used as the upper boundary of the segmentation area, and the value corresponding to the maximum ordinate in the lower boundary point set is used as the lower boundary of the segmentation area to obtain the vertical range of the weld area; Splits the weld area based on its vertical extent.
[0011] The selecting at least two region types and determining the hash values and Hamming distances of the corresponding regions in the first X-ray weld film and the second X-ray weld film respectively include: Select at least two area types from the weld area, parent material area, and film full area; For each region type, the pHash method is used to calculate the hash values of the corresponding regions in the first X-ray weld film and the second X-ray weld film respectively; For each region type, a Hamming distance between a hash value of a corresponding region in the first X-ray weld film and a hash value of a corresponding region in the second X-ray weld film is determined.
[0012] The above judgment is whether all similarities are less than or equal to the set threshold. In response to no, the original X-ray weld film selected when obtaining the similarity of the area is determined, and after determination, the other X-ray weld film is a duplicate film of the original X-ray weld film.
[0013] The second technical solution of the present invention is achieved by the following measures: a detection device suitable for repeated X-ray weld film, comprising: A region segmentation unit is used to determine the weld region, the base material region and the entire region of the film in the first X-ray weld film and the second X-ray weld film respectively; A first detection unit selects at least two region types and determines hash values and Hamming distances of corresponding regions in the first X-ray weld film and the second X-ray weld film, respectively; A second detection unit determines the similarity between the first X-ray weld film and the second X-ray weld film in each selected area according to the hash value and the Hamming distance; in, is the similarity of region x; is the Hamming distance of region x; is the hash value length of region x in the original X-ray weld film, where the original X-ray weld film is the first X-ray weld film or the second X-ray weld film; The judging unit judges whether all similarities are less than a set threshold, and if no, there are duplicate negatives.
[0014] The following are further optimizations and / or improvements to the above technical solutions: The above-mentioned region segmentation unit comprises: Weld area segmentation module, including: Extracting multiple column pixel point sets in the horizontal direction based on the set width on the first X-ray weld film, and taking the column pixel point with the largest peak width in each column pixel point set as the center point of the weld area; Obtain the true curve and the fitting curve of each column pixel set, and take the column pixel point with the largest gray value difference between the true curve and the fitting curve as the boundary point of the weld area, wherein the fitting curve is obtained by fitting using the least square method; The median absolute deviation method is used to remove abnormal boundary points in all weld area boundary points and extract effective weld area boundary points; Determine the upper boundary and the lower boundary of the weld area based on the boundary points of the effective weld area, and divide the weld area according to the upper boundary and the lower boundary of the weld area; The parent material region segmentation module removes the weld region from the first X-ray weld film and defines the remaining region as the parent material region.
[0015] The first detection unit comprises: A region selection module selects at least two region types from the weld region, the base material region, and the entire film region; The hash value obtaining module calculates the hash values of the corresponding areas in the first X-ray weld film and the second X-ray weld film respectively for each area type by using the pHash method; The Hamming distance obtaining module determines the Hamming distance between the hash value of the corresponding area in the first X-ray weld film and the hash value of the corresponding area in the second X-ray weld film.
[0016] The third technical solution of the present invention is achieved through the following measures: an electronic device, including 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 steps in the detection method suitable for repeating X-ray weld films.
[0017] The fourth technical solution of the present invention is achieved through the following measures: a storage medium, on which is stored a computer program that can be read by a computer, and the computer program is configured to execute the steps in the detection method applicable to repeated X-ray weld films when running.
[0018] The present invention divides the polarity regions of X-ray weld films, and determines the similarity of corresponding regions by calculating the hash values and Hamming distances of at least two regions, thereby judging whether two X-ray weld films are repeated. This process effectively realizes the automation of repeated X-ray weld film detection, improves the efficiency of repeated X-ray weld film detection, and has good robustness against some artificial forgery and tampering. Compared with manual detection, it is accurate and efficient, and compared with neural network model detection, it does not need to occupy a large amount of computer computing resources and storage resources, does not need to update training regularly, and is not affected by the quality of training samples. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Attached Figure 1 A schematic flow chart of a detection method provided for one embodiment of the present invention.
[0020] Attached Figure 2 A schematic flow chart of a weld area extraction method provided in accordance with an embodiment of the present invention.
[0021] Attached Figure 3 A schematic flow chart of a weld region segmentation method provided in accordance with an embodiment of the present invention.
[0022] Attached Figure 4 A schematic flow chart of a method for obtaining a hash value and a Hamming distance provided by an embodiment of the present invention.
[0023] Attached Figure 5 A schematic diagram of an X-ray weld film to be inspected provided in one embodiment of the present invention, wherein Figure 5 (a) is the first X-ray weld film, Figure 5 (b) Second X-ray weld film.
[0024] Attached Figure 6 A schematic diagram of a curve fitting result provided by an embodiment of the present invention, wherein Figure 6 (a) is the first X-ray weld film Figure 5 (a) Schematic diagram of the curve fitting results, Figure 6 (b) is the second X-ray weld film Figure 5 (b) Schematic diagram of the curve fitting results.
[0025] Attached Figure 7 An embodiment of the present invention provides Figure 5 Schematic diagram of the weld area boundary point extraction results, where Figure 7 (a) is the first X-ray weld film Figure 5 (a) Schematic diagram of the weld area boundary point extraction results. Figure 7 (b) is the second X-ray weld film Figure 5 (b) Schematic diagram of the weld area boundary point extraction results.
[0026] Attached Figure 8 An embodiment of the present invention provides Figure 5 Schematic diagram of weld area segmentation results, where Figure 8 (a) is the first X-ray weld film Figure 5 (a) Schematic diagram of the weld area segmentation result. Figure 8 (b) is the second X-ray weld film Figure 5 (b) Schematic diagram of weld area segmentation results.
[0027] Attached Fig. 9 A schematic diagram of another X-ray weld film to be inspected provided in one embodiment of the present invention, wherein Fig. 9 (a) is the original X-ray weld film. Fig. 9 (b) Tampering with X-ray weld films.
[0028] Attached Fig.10 An embodiment of the present invention provides Fig. 9 Schematic diagram of weld area segmentation, where Fig.10 (a1), Fig.10 (b1) are the original X-ray weld films. Fig. 9 (a) Tampering with X-ray weld films Fig. 9 (b) Schematic diagram of the weld area boundary point extraction results. Fig.10 (a2), Fig.10 (b2) are the original X-ray weld films. Fig. 9 (a) Tampering with X-ray weld films Fig. 9 (b) Schematic diagram of weld area segmentation.
[0029] Attached Fig.11A schematic diagram of another X-ray weld film to be inspected provided in one embodiment of the present invention, wherein Fig.11 (a) is the original X-ray weld film. Fig.11 (b) Tampering with X-ray weld films.
[0030] Attached Fig.12 An embodiment of the present invention provides Fig.11 Schematic diagram of weld area segmentation, where Fig.12 (a1), Fig.12 (b1) are the original X-ray weld films. Fig.11 (a) Tampering with X-ray weld films Fig.11 (b) Schematic diagram of the weld area boundary point extraction results. Fig.12 (a2), Fig.12 (b2) are the original X-ray weld films. Fig.11 (a) Tampering with X-ray weld films Fig.11 (b) Schematic diagram of weld area segmentation.
[0031] Attached Fig.13 A schematic diagram of another X-ray weld film to be inspected is provided for an embodiment of the present invention, wherein Fig.13 (a) is the first original X-ray weld film, Fig.13 (b) is the second original X-ray weld film, Fig.13 (c) Tampering with X-ray weld films.
[0032] Attached Fig.14 An embodiment of the present invention provides Fig.13 Schematic diagram of weld area segmentation, where Fig.14 (a1), Fig.14 (b1) are the first original X-ray weld films Fig.13 (a) Tampering with X-ray weld films Fig.13 (c) Schematic diagram of the weld area boundary point extraction results. Fig.14 (a2), Fig.14 (b2) are the first original X-ray weld films Fig.13 (a) Tampering with X-ray weld films Fig.13 (c) Schematic diagram of weld area segmentation.
[0033] Attached Fig.15 A schematic diagram of another X-ray weld film to be inspected is provided in one embodiment of the present invention, wherein Fig.15 (a) is the first original X-ray weld film, Fig.15 (b) is the second original X-ray weld film, Fig.15 (c) Tampering with X-ray weld films.
[0034] Attached Fig.16 An embodiment of the present invention provides Fig.15 Schematic diagram of weld area segmentation, where Fig.16 (a1), Fig.16 (b1) are the first original X-ray weld films Fig.15 (a) Tampering with X-ray weld films Fig.15 (c) Schematic diagram of the weld area boundary point extraction results. Fig.16 (a2), Fig.16 (b2) are the first original X-ray weld films Fig.15 (a) Tampering with X-ray weld films Fig.15 (c) Schematic diagram of weld area segmentation.
[0035] Attached Fig.17 A schematic diagram of the structure of a detection device provided in one embodiment of the present invention. DETAILED DESCRIPTION
[0036] The present invention is not limited by the following embodiments, and specific implementation methods can be determined based on the technical solution of the present invention and actual conditions.
[0037] Those skilled in the art will understand that, unless otherwise stated, a "module" or "unit" in the embodiments of the present invention refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as a processing circuit or memory) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0038] In addition, the term “plurality” in the embodiments of the present invention refers to two or more than two, and “first” and “second” are used to distinguish descriptions and should not be understood as implying relative importance.
[0039] The embodiments of the present invention provide a detection method, device, electronic device and storage medium suitable for repeated X-ray weld films. The detection device suitable for repeated X-ray weld films can be integrated in a computer device, which can be a server or a terminal or other device; it can also be executed by a terminal and a server together, and the above examples should not be understood as limiting the present invention.
[0040] The above-mentioned terminal may include a mobile phone, a wearable smart device, a tablet computer, a notebook computer, a personal computer (PC), and a vehicle-mounted computer, etc., and the present invention does not limit this. The present invention does not limit the number of terminal devices.
[0041] The above-mentioned server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, as well as big data and artificial intelligence platforms. The present invention does not impose any restrictions on this.
[0042] For example, the computer device determines the weld area, the base material area and the whole film area in the first X-ray weld film and the second X-ray weld film respectively, selects at least two area types, determines the hash value and the Hamming distance of the corresponding area in the first X-ray weld film and the second X-ray weld film respectively, determines the similarity of the first X-ray weld film and the second X-ray weld film in each selected area according to the hash value and the Hamming distance, and judges whether all similarities are less than a set threshold. If no, there is a duplicate film. In this way, not only the automation of duplicate X-ray weld film detection is realized, the accuracy of detection is guaranteed, but also there is no need to occupy a large amount of computer computing resources and storage resources like the machine detection method using the neural network model.
[0043] Based on this, the technical solution of the present invention will be introduced and explained in combination with several examples below.
[0044] Embodiment 1: As attached Figure 1 As shown, an embodiment of the present invention discloses a detection method suitable for repeated X-ray weld films, comprising: Step S110, respectively determining the weld area, the base material area and the entire film area in the first X-ray weld film and the second X-ray weld film.
[0045] The above region segmentation can be accomplished through image recognition and other methods.
[0046] Step S120, selecting at least two region types, and determining hash values and Hamming distances of corresponding regions in the first X-ray weld film and the second X-ray weld film, respectively.
[0047] The above-mentioned Hamming distance is used to determine the similarity between two hash values. The smaller the Hamming distance, the higher the similarity between the two hash values. This embodiment introduces the Hamming distance to determine the similarity between the hash values of the same type of area in the first X-ray weld film and the second X-ray weld film.
[0048] Specifically, for example, if the weld area and the base material area are selected, it is necessary to determine the hash value of the weld area and the hash value of the base material area in the first X-ray weld film, the hash value of the weld area and the hash value of the base material area in the second X-ray weld film, and determine the similarity (i.e., the Hamming distance) between the hash values of the weld area in the first X-ray weld film and the second X-ray weld film, and the similarity (i.e., the Hamming distance) between the hash values of the base material area in the first X-ray weld film and the second X-ray weld film.
[0049] Step S130, determining the similarity between the first X-ray weld film and the second X-ray weld film in each selected area according to the hash value and the Hamming distance; in, is the similarity of region x; is the Hamming distance of region x; is the hash value length of region x in the original X-ray weld film, where the original X-ray weld film is the first X-ray weld film or the second X-ray weld film.
[0050] The selection of the above-mentioned original X-ray weld film can be determined according to needs.
[0051] It should also be noted that the Hamming distance is the number of different elements in two images or image areas calculated based on the hash value. Therefore, the difference between the two images or image areas is the ratio of the number of different elements in the two images or image areas to the hash value length, and the similarity between the two images or image areas is the ratio of the number of identical elements in the two images or image areas to the hash length, and the sum of the difference and the similarity is 1. Therefore, the present invention obtains the similarity calculation formula in step S130, and calculates the similarity between each area of two or more X-ray weld films by this formula.
[0052] Furthermore, the similarity calculation formula established in the present invention based on the Hamming distance and the hash value can be effectively applied to large-scale X-ray weld film repeatability detection based on the high efficiency of the Hamming distance calculation and the high robustness to slight changes.
[0053] Step S140, determining whether all similarities are less than or equal to a set threshold, and if no, there are duplicate negatives.
[0054] It should be noted that it is determined whether all similarities are less than or equal to the set threshold. In response to no, the original X-ray weld film selected when obtaining the similarity of the region is determined, and the other X-ray weld film is a duplicate of the original X-ray weld film. is the hash value length of area x of the first X-ray weld film. If it is determined that not all similarities are less than the set threshold, it indicates that the second X-ray weld film is a duplicate of the first X-ray weld film, and the area x whose similarity is greater than the set threshold is determined, and area x is the area where the duplication occurs.
[0055] In this step, weights can also be introduced, that is, the weights of each area are set according to the different proportions of the area, and the similarities of each selected area are weighted fused to obtain a comprehensive similarity, which is compared with the set threshold to determine whether there are duplicate negatives, thereby preventing the situation where a slight offset in the image leads to low similarity and improving the accuracy of detection.
[0056] The present invention discloses a detection method suitable for repeated X-ray weld films, which divides the polarity regions of X-ray weld films, calculates the hash values and Hamming distances of at least two regions, determines the similarity of the corresponding regions, and thereby determines whether two X-ray weld films are repeated. This process effectively realizes the automation of repeated X-ray weld film detection, improves the efficiency of repeated X-ray weld film detection, and has good robustness against some artificial forgery and tampering. Compared with manual detection, it is accurate and efficient, and compared with neural network model detection, it does not need to occupy a large amount of computer computing resources and storage resources, does not need to update training regularly, and is not affected by the quality of training samples.
[0057] Embodiment 2: The embodiment of the present invention is a further optimization of the above embodiment, wherein the weld area, the base material area and the whole film area in the first X-ray weld film and the second X-ray weld film are respectively determined, including: (1) The entire area of the first X-ray weld film is regarded as the entire film area.
[0058] (2) As attached Figure 2 As shown, extracting the weld area in the first X-ray weld film includes: Step S210, extracting multiple column pixel point sets along the horizontal direction based on the set width on the first X-ray weld film, and taking the column pixel point with the largest peak width in each column pixel point set as the center point of the weld area.
[0059] The set width may be 10 to 200 pixels, which is specifically determined by the length of the X-ray weld film.
[0060] After obtaining multiple column pixel point sets as above, mean filtering can be performed on each column pixel point set to remove noise, but a balance must be struck between distortion and denoising effects, and a convolution kernel of appropriate size must be selected.
[0061] After mean filtering, the peak position is found in each column pixel set. If there is only one peak, the corresponding column pixel point is used as the weld center point of the column pixel set. If there are multiple peaks, the column pixel point with the largest peak width is selected as the weld area center point of the column pixel set. If the peak position is not found in the column pixel set, the column pixel set is skipped.
[0062] Since there will be interference information such as digital marks on both sides of the weld area, welding head name, date information and label text on the X-ray weld film, multiple peaks may appear. For multiple peaks, considering that the width of the weld area is usually larger than the width of the characters, the sum of the width of the brightness increasing interval and the width of the decreasing interval within a certain brightness range on the left and right sides of the peak is taken as the width interval of the peak, and the peak with the largest value is selected as the center point of the weld.
[0063] Step S220, obtaining a true curve and a fitting curve for each set of column pixel points, and taking the column pixel point with the largest grayscale value difference between the true curve and the fitting curve as the boundary point of the weld area, wherein the fitting curve is obtained by least squares fitting.
[0064] Use the least squares method to fit the column pixel grayscale curve to the column pixel point set, that is, fit the data to a polynomial of a given order (which can be but is not limited to 2). Specifically, for a set of data , use k-order polynomial for fitting, the fitted target polynomial is as follows: After fitting, the coefficients of the k-order polynomial are obtained, and the fitting effect is evaluated using the fitting error. The fitting error is as follows: in, is the fitting error; k is the order of the polynomial; are the coefficients of the k-order polynomial; is the true gray value of the true curve of the column pixel set at the i-th column pixel; is the position of the i-th column pixel point in the column pixel point set.
[0065] According to the fitted k-order polynomial, use the following formula to calculate the left and right sides of the peak point in turn to find the boundary points on the left and right sides (that is, find the column pixel point with the largest difference between the real value curve and the fitted curve); in, is the difference; is the fitting grayscale value of the i-th column pixel point in the fitting curve of the column pixel point set; is the true gray value of the true curve of the column pixel set at the i-th column pixel.
[0066] Step S230, using the median absolute deviation method to remove abnormal boundary points from all weld area boundary points, and extracting effective weld area boundary points.
[0067] The median absolute deviation method uses the distance between each value in the data set and the median to measure the degree of dispersion of the data, which is widely used in anomaly detection. Specifically, it is as follows: in, is the pixel position of the i-th boundary point; is the location set of all boundary points, To calculate the median of the data; in this example, the absolute deviation between each weld area boundary point and the median is calculated respectively, and then the median of all absolute deviations is calculated to obtain the MAD threshold.
[0068] Based on the MAD threshold, the abnormal boundary point judgment conditions shown below are constructed, and the points that meet the conditions are abnormal boundary points; in, is the pixel position of the boundary point of the i-th weld area, is the median of the pixel positions of all weld area boundary points.
[0069] Step S240, determining the upper boundary and the lower boundary of the weld area based on the boundary points of the effective weld area, and segmenting the weld area according to the upper boundary and the lower boundary of the weld area.
[0070] Specifically, as attached Figure 3 As shown, including: Step S241, determining an upper boundary point set and a lower boundary point set based on the boundary points of the effective weld area.
[0071] According to whether the boundary point of the weld area in the real curve of the column pixel point set is located on the left side or the right side of the peak value, the upper boundary point set and the lower boundary point set are divided.
[0072] Step S242, taking the value corresponding to the minimum ordinate in the upper boundary point set as the upper boundary of the segmented area, and taking the value corresponding to the maximum ordinate in the lower boundary point set as the lower boundary of the segmented area, to obtain the vertical range of the weld area.
[0073] Step S243, segmenting the weld area based on the vertical range.
[0074] (3) The remaining area after removing the weld area in the first X-ray weld film is the base material area.
[0075] (4) Repeat the above process to determine the weld area, base material area and the entire film area in the second X-ray weld film.
[0076] Embodiment 3: As attached Figure 4 As shown, the embodiment of the present invention is a further optimization of the above embodiment, wherein at least two region types are selected, and the hash values and Hamming distances of the corresponding regions are determined in the first X-ray weld film and the second X-ray weld film, respectively, including: Step S310, selecting at least two area types from among the weld area, the base material area and the entire film area.
[0077] Step S320: For each region type, the pHash method is used to calculate the hash values of the corresponding regions in the first X-ray weld film and the second X-ray weld film.
[0078] Specifically, the process of using the pHash method to calculate the hash value of a certain area in the X-ray weld film includes: (1) Read the X-ray weld film and perform a two-dimensional discrete cosine transform (DCT transform) on it to obtain the low-frequency part of the X-ray weld film, that is, the film contour information; in, , are all orthogonal normalization coefficients; when , All are 0, ,otherwise, ; Pixel points in the X-ray weld film The grayscale value of , N is the dimension of the X-ray weld film.
[0079] (2) Cut off the 8x8 area (low-frequency coefficients) in the upper left corner of the DCT transform result and call this area , then Perform mean calculation to obtain the average value A; (3) Each value in is compared with the average value A to generate a binary matrix, in which the comparison of each element is performed using the following formula; (4) Finally, the binary matrix Converted into a one-dimensional array and merged into a string form, which is the pHash value of the X-ray weld film.
[0080] Step S330: for each region type, determine the Hamming distance between the hash value of the corresponding region in the first X-ray weld film and the hash value of the corresponding region in the second X-ray weld film.
[0081] Specifically, taking the selected area types of weld area and base material area as an example, the hash value, Hamming distance and similarity of the corresponding areas in the first X-ray weld film and the second X-ray weld film are calculated respectively.
[0082] The hash values of the first X-ray weld film in the corresponding weld area and parent material area are as follows: in, is the weld area of the first X-ray weld film; It is the base metal area of the first X-ray weld film; is the hash value of the weld area in the first X-ray weld film; is the hash value of the base metal area in the first X-ray weld film; The hash values of the second X-ray weld film in the corresponding weld area and parent material area are as follows: in, The weld area of the second X-ray weld film; It is the base metal area of the second X-ray weld film; is the hash value of the weld area in the second X-ray weld film; is the hash value of the base metal area in the second X-ray weld film; The Hamming distance between the first X-ray weld film and the second X-ray weld film in the weld area is as follows: in, is the Hamming distance of the weld area; The Hamming distance between the first X-ray weld film and the second X-ray weld film in the parent material area is as follows: in, is the Hamming distance of the parent material area; Above It means counting the number of elements in the binary string that are 1, and the two hash values are XORed to get different positions, and then used Statistics will give the difference between the two positions.
[0083] Determine the similarity between the first X-ray weld film and the second X-ray weld film in each selected area according to the hash value and the Hamming distance; in, is the similarity between the first X-ray weld film and the second X-ray weld film in the weld area; is the similarity between the first X-ray weld film and the second X-ray weld film in the base material area.
[0084] In Example 1, it is described that the Hamming distance is the number of different elements in two images or image regions calculated based on the hash value, so the difference between the two images or image regions is the ratio of the number of different elements in the two images or image regions to the hash value length, and the similarity between the two images or image regions is the ratio of the number of identical elements in the two images or image regions to the hash length, and the sum of the difference and the similarity is 1. Therefore, the present invention obtains the similarity calculation formula in step S130, and calculates the similarity between each region of two or more X-ray weld films by this formula.
[0085] It should also be noted that in the above formula, It means counting the number of elements in the binary string that are 1, and the two hash values are XORed to get different positions, and then used By counting, we can get the difference between the two positions, that is, the number of different elements in the two.
[0086] Example 4: The example of the present invention introduces a specific X-ray weld film to verify the effectiveness of the detection method disclosed in the present invention that is applicable to repeated X-ray weld films.
[0087] (1) Obtain the attached Figure 5 The two original X-ray weld negative films shown are respectively set as the first X-ray weld negative films. Figure 5 (a) and the second X-ray weld film Figure 5 (b); (2) First X-ray weld film Figure 5 (a) and the second X-ray weld film Figure 5 (b) Perform Gaussian filtering and smoothing to remove noise; (3) Extract multiple pixel point sets in the horizontal direction based on the set width on the first X-ray weld film, and take the pixel point with the largest peak width in each pixel point set as the center point of the weld area. Figure 6 The blue curve in is a set of column pixels, where the column pixel with the largest peak width is the center point of the weld area of the column (i.e., the set of column pixels); (4) Obtain the true curve and fitting curve of each column pixel set, and take the column pixel point with the largest gray value difference between the true curve and the fitting curve as the boundary point of the weld area. Figure 6The yellow curve in the figure is the fitting curve obtained by fitting a certain pixel set using the least square method, and the green curve is the gray value difference curve between the true curve and the fitting curve corresponding to the pixel set. Figure 6 The red point in the middle is the pixel point with the largest gray value difference, which is taken as the boundary point of the weld area; It should be noted that Figure 6 (a) and Figure 6 (b) are Figure 5 (a) and Figure 5 (b) Schematic diagram of the curve fitting results.
[0088] Based on steps (3) and (4), the weld area boundary point extraction results are shown in the attached figure. Figure 7 As shown, attached Figure 7 The red point is the center point of the weld area, and the blue point is the boundary point of the weld area; Figure 7 (a) and Figure 7 (b) are Figure 5 (a) and Figure 5 (b) Schematic diagram of the weld area boundary point extraction results; (5) Determine the upper and lower boundaries of the weld area based on the boundary points of the effective weld area, and divide the weld area according to the upper and lower boundaries of the weld area, as shown in the attached figure. Figure 8 The green rectangle in the figure is the weld area obtained by segmentation. Figure 8 (a) and Figure 8 (b) are Figure 5 (a) and Figure 5 (b) Schematic diagram of weld area segmentation results; (6) Select the weld area, the base material area and the entire film area, determine the hash value and the Hamming distance of the corresponding area in the first X-ray weld film and the second X-ray weld film, and determine the similarity between the first X-ray weld film and the second X-ray weld film in each selected area based on the hash value and the Hamming distance, as shown in Table 1; Table 1 Similarity calculation results .
[0089] If the weld area, base material area and full film area in the table are all less than or equal to the set threshold (the set threshold is set to 90%), there is no duplicate film between the first X-ray weld film and the second X-ray weld film.
[0090] Example 5: The embodiment of the present invention introduces repeated X-ray weld films from three aspects: adding noise, improving brightness, and replacing weld areas, to verify the effectiveness of the detection method disclosed in the present invention that is applicable to repeated X-ray weld films.
[0091] (I) After adding noise to the original X-ray weld film, the corresponding tampered X-ray weld film is obtained, as shown in the attached figure. Fig. 9 As shown, the original X-ray weld film is Fig. 9 (a) Tampering of X-ray weld film Fig. 9 (b), where the specific noise parameters include: type is Gaussian noise, mean is 0, variance sigma is 6, and the weld area extraction results are shown in the attached figure. Fig.10 As shown ( Fig.10 (a1), Fig.10 (b1) are Fig. 9 (a) and Fig. 9 (b) The weld area boundary point extraction result, Fig.10 (a2), Fig.10 (b2) are Fig. 9 (a) and Fig. 9 (b) The weld area segmentation result), the similarity of the weld area, the base material area and the whole film area obtained by the method disclosed in the present invention is shown in Table 2: Table 2 Similarity calculation results .
[0092] It can be seen from Table 2 that if the original X-ray weld film and the tampered X-ray weld film are greater than the set threshold (the set threshold is set to 90%) in the weld area, the base material area and the entire film area, then the two X-ray weld films are repeated.
[0093] (ii) After increasing the brightness of the original X-ray weld film, the corresponding tampered X-ray weld film is obtained, as shown in the attached Fig.11 As shown, the original X-ray weld film is Fig.11 (a) Tampering of X-ray weld film Fig.11 (b), where the specific parameters for improving brightness include: brightness adjustment factor is 1.2, and the weld area extraction results are shown in the attached figure. Fig.12 As shown ( Fig.12 (a1), Fig.12 (b1) are Fig.11 (a) and Fig.11 (b) The weld area boundary point extraction result, Fig.12 (a2), Fig.12 (b2) Don’t Fig.11 (a) and Fig.11 (b) The weld area segmentation result), the similarity of the weld area, the base material area and the whole film area obtained by the method disclosed in the present invention is shown in Table 3: Table 3 Similarity calculation results .
[0094] It can be seen from Table 3 that if the original X-ray weld film and the tampered X-ray weld film are greater than the set threshold (the set threshold is set to 90%) in the weld area, the base material area and the entire film area, the two X-ray weld films are repeated.
[0095] (III) As attached Fig.13 As shown, the first original X-ray weld film Fig.13 (a) The weld area is replaced by the first original X-ray weld film Fig.13 (b) The weld area, forming a tampered X-ray weld film Fig.13 (c) The weld area extraction results are shown in the attached figure. Fig.14 As shown ( Fig.14 (a1), Fig.14 (b1) are Fig.13 (a) Fig.13 (c) The weld area boundary point extraction result, Fig.14 (a2), Fig.14 (b2) are Fig.13 (a) Fig.13 (c) The weld area segmentation result), the similarity of the weld area, the base material area and the whole film area obtained by the method disclosed in the present invention is shown in Table 4: Table 4. Similarity calculation results .
[0096] It can be seen from Table 4 that the original X-ray weld film and the tampered X-ray weld film are both greater than the set threshold (the set threshold is set to 90%) in the parent material area and the whole film area, then the two X-ray weld films are repeated in the parent material area and the whole film area.
[0097] (IV) As attached Fig.15 As shown, the first original X-ray weld film Fig.15 (a) The base metal area is replaced by the second original X-ray weld film Fig.15 (b) The base metal area forms a tampered X-ray weld film Fig.15 (c) The weld area extraction results are shown in the attached figure. Fig.16 As shown ( Fig.16 (a1), Fig.16 (b1) is Fig.15 (a) Fig.15 (c) The weld area boundary point extraction result, Fig.16 (a2), Fig.16 (b2) is attached Fig.15 middle Fig.15 (a) Fig.15 (c) The weld area segmentation result), the similarity of the weld area, the base material area and the whole film area obtained by the method disclosed in the present invention is shown in Table 5: Table 5. Similarity calculation results .
[0098] It can be seen from Table 5 that the original X-ray weld film and the tampered X-ray weld film are both greater than the set threshold in the weld area (the set threshold is set to 90%), and the two X-ray weld films are repeated in the weld area.
[0099] Through the description of the above four examples, the method disclosed in the present invention can accurately perform repeated detection of X-ray weld films.
[0100] Embodiment 6: As attached Fig.17 As shown, the embodiment of the present invention discloses a detection device suitable for repeated X-ray weld film, comprising: A region segmentation unit is used to determine the weld region, the base material region and the entire region of the film in the first X-ray weld film and the second X-ray weld film respectively; A first detection unit selects at least two region types and determines hash values and Hamming distances of corresponding regions in the first X-ray weld film and the second X-ray weld film, respectively; A second detection unit determines the similarity between the first X-ray weld film and the second X-ray weld film in each selected area according to the hash value and the Hamming distance; in, is the similarity of region x; is the Hamming distance of region x; is the hash value length of region x in the original X-ray weld film, where the original X-ray weld film is the first X-ray weld film or the second X-ray weld film; The judging unit judges whether all similarities are less than a set threshold, and if no, there are duplicate negatives.
[0101] The regional segmentation unit includes: Weld area segmentation module, including: Extracting multiple column pixel point sets in the horizontal direction based on the set width on the first X-ray weld film, and taking the column pixel point with the largest peak width in each column pixel point set as the center point of the weld area; Obtain the true curve and the fitting curve of each column pixel set, and take the column pixel point with the largest gray value difference between the true curve and the fitting curve as the boundary point of the weld area, wherein the fitting curve is obtained by fitting using the least square method; The median absolute deviation method is used to remove abnormal boundary points in all weld area boundary points and extract effective weld area boundary points; Determine the upper boundary and the lower boundary of the weld area based on the boundary points of the effective weld area, and divide the weld area according to the upper boundary and the lower boundary of the weld area; The parent material region segmentation module removes the weld region from the first X-ray weld film and defines the remaining region as the parent material region.
[0102] The first detection unit comprises: A region selection module selects at least two region types from the weld region, the base material region, and the entire film region; The hash value obtaining module calculates the hash values of the corresponding areas in the first X-ray weld film and the second X-ray weld film respectively for each area type by using the pHash method; The Hamming distance obtaining module determines the Hamming distance between the hash value of the corresponding area in the first X-ray weld film and the hash value of the corresponding area in the second X-ray weld film.
[0103] Embodiment 7: The embodiment of the present invention discloses a storage medium, on which is stored a computer program that can be read by a computer, and the computer program is configured to execute a detection method applicable to repeated X-ray weld films when running.
[0104] The above storage medium may include, but is not limited to: a USB flash drive, a read-only memory, a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0105] Embodiment 8: The embodiment of the present invention discloses an electronic device, including 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 a detection method suitable for repeated X-ray weld films.
[0106] The processor may be a central processing unit (CPU), a general purpose processor, a digital signal processor (DSP), an ASIC, an FPGA or other programmable logic device, a transistor logic device, a hardware component or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of the present invention. It may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like. The memory may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory, a mobile hard disk, a magnetic disk or an optical disk.
[0107] It should be understood by those skilled in the art that the embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The solutions in the embodiments of the present invention may be implemented in various computer languages, for example, object-oriented programming language Java and interpreted scripting language JavaScript, etc.
[0108] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0109] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0110] The above content is only a specific implementation mode of the present invention, which has strong adaptability and implementation effect, but the protection scope of the present invention is not limited to this. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered within the protection scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope covered by the present invention.
Claims
1. A method for detecting repeated X-ray weld films, characterized in that: include: Determine the weld area, the base material area and the whole film area in the first X-ray weld film and the second X-ray weld film respectively; Select at least two region types, and determine hash values and Hamming distances of corresponding regions in the first X-ray weld film and the second X-ray weld film, respectively; Determine the similarity between the first X-ray weld film and the second X-ray weld film in each selected area according to the hash value and the Hamming distance; in, For Region x similarity; For Region x The Hamming distance of is the hash value length of region x in the original X-ray weld film, where the original X-ray weld film is the first X-ray weld film or the second X-ray weld film; It is determined whether all similarities are less than or equal to a set threshold, and if no, there are duplicate negatives.
2. The detection method for repeated X-ray weld films according to claim 1, characterized in that: The method of respectively determining the weld area, the base material area and the whole film area in the first X-ray weld film and the second X-ray weld film comprises: Extracting multiple column pixel point sets in the horizontal direction based on the set width on the first X-ray weld film, and taking the column pixel point with the largest peak width in each column pixel point set as the center point of the weld area; Obtain the true curve and the fitting curve of each column pixel set, and take the column pixel point with the largest gray value difference between the true curve and the fitting curve as the boundary point of the weld area, wherein the fitting curve is obtained by fitting using the least square method; The median absolute deviation method is used to remove abnormal boundary points in all weld area boundary points and extract effective weld area boundary points; Determine the upper boundary and the lower boundary of the weld area based on the boundary points of the effective weld area, and divide the weld area according to the upper boundary and the lower boundary of the weld area; The remaining area after removing the weld area in the first X-ray weld film is the base material area; Repeat the above process to determine the weld area, base material area and the entire film area in the second X-ray weld film.
3. The detection method for repeated X-ray weld films according to claim 2, characterized in that: The method of determining the upper boundary and the lower boundary of the weld area based on the boundary points of the effective weld area, and segmenting the weld area according to the upper boundary and the lower boundary of the weld area, comprises: Determine an upper boundary point set and a lower boundary point set based on the boundary points of the effective weld area; The value corresponding to the minimum ordinate in the upper boundary point set is used as the upper boundary of the segmentation area, and the value corresponding to the maximum ordinate in the lower boundary point set is used as the lower boundary of the segmentation area to obtain the vertical range of the weld area; Splits the weld area based on its vertical extent.
4. The detection method for repeated X-ray weld films according to claim 1, 2 or 3, characterized in that: The selecting at least two region types and determining the hash values and Hamming distances of the corresponding regions in the first X-ray weld film and the second X-ray weld film respectively include: Select at least two area types from the weld area, parent material area, and film full area; For each region type, the pHash method is used to calculate the hash values of the corresponding regions in the first X-ray weld film and the second X-ray weld film respectively; For each region type, a Hamming distance between a hash value of a corresponding region in the first X-ray weld film and a hash value of a corresponding region in the second X-ray weld film is determined.
5. The detection method for repeated X-ray weld films according to claim 1, 2 or 3, characterized in that: The determination is as to whether all similarities are less than or equal to a set threshold. If no, the original X-ray weld film selected when obtaining the similarity of the region is determined, and after determination, the other X-ray weld film is a duplicate of the original X-ray weld film.
6. A detection device for repeated X-ray weld films using the method as claimed in any one of claims 1 to 5, characterized in that: include: A region segmentation unit is used to determine the weld region, the base material region and the entire region of the film in the first X-ray weld film and the second X-ray weld film respectively; A first detection unit selects at least two region types and determines hash values and Hamming distances of corresponding regions in the first X-ray weld film and the second X-ray weld film, respectively; A second detection unit determines the similarity between the first X-ray weld film and the second X-ray weld film in each selected area according to the hash value and the Hamming distance; in, is the similarity of region x; is the Hamming distance of region x; is the hash value length of region x in the original X-ray weld film, where the original X-ray weld film is the first X-ray weld film or the second X-ray weld film; The judging unit judges whether all similarities are less than a set threshold, and if no, there are duplicate negatives.
7. The detection device for repeated X-ray weld films according to claim 6, characterized in that: The region segmentation unit comprises: Weld area segmentation module, including: Extracting multiple column pixel point sets in the horizontal direction based on the set width on the first X-ray weld film, and taking the column pixel point with the largest peak width in each column pixel point set as the center point of the weld area; Obtain the true curve and the fitting curve of each column pixel set, and take the column pixel point with the largest gray value difference between the true curve and the fitting curve as the boundary point of the weld area, wherein the fitting curve is obtained by fitting using the least square method; The median absolute deviation method is used to remove abnormal boundary points in all weld area boundary points and extract effective weld area boundary points; Determine the upper boundary and the lower boundary of the weld area based on the boundary points of the effective weld area, and divide the weld area according to the upper boundary and the lower boundary of the weld area; The base metal region segmentation module removes the weld region from the first X-ray weld film and defines the remaining region as the base metal region.
8. The detection device for repeated X-ray weld films according to claim 6 or 7, characterized in that: The first detection unit comprises: A region selection module selects at least two region types from the weld region, the base material region, and the entire film region; The hash value obtaining module calculates the hash values of the corresponding areas in the first X-ray weld film and the second X-ray weld film respectively for each area type by using the pHash method; The Hamming distance obtaining module determines the Hamming distance between the hash value of the corresponding area in the first X-ray weld film and the hash value of the corresponding area in the second X-ray weld film.
9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the steps in the method according to any one of claims 1 to 5.
10. A storage medium, characterized in that: The storage medium stores a computer program that can be read by a computer, and the computer program is configured to execute the steps of the method according to any one of claims 1 to 5 when running.
Citation Information
Patent Citations
A method for detecting falsified weld flaw inspection film images
CN110084807B
Weld joint recognition method based on texture partition
CN101135652A
Method of recognizing circular defects based on weld X-ray digital images
CN106780493A
Image splicing method and system and electronic equipment
CN109949227A
Detection method for welding seam flaw detection negative image counterfeiting
CN110084807A