A method and system for stitching digital X-ray images of tension cable clamps
By combining the AKAZE algorithm and mesh model feature matching with the improved recursive stitching neural network E-RSNet for image fusion, the problem of overlapping region artifacts caused by parallax in digital ray images of tension clamps was solved. This achieved high-precision and efficient image stitching, improving image quality and speed, and providing a solid foundation for defect detection.
Patent Information
- Application Number
- CN202411825014.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2044-12-12
AI Technical Summary
Existing image stitching techniques suffer from parallax artifacts in overlapping areas of digital ray images of tension clamps. Furthermore, eliminating projection distortion in non-overlapping areas destroys image structural information, leading to discontinuities in the transition.
Feature points are extracted using the AKAZE algorithm, feature matching is performed using a grid model, and image fusion is achieved through an improved recursive stitching neural network E-RSNet. The grid model is optimized by combining global and local similarity constraints, and a recursive feature fusion module and a multi-head self-attention mechanism are introduced to adjust the parameters of the global homography transformation model.
It effectively solved the problem of artifacts in overlapping areas caused by parallax, improved the naturalness and accuracy of image stitching, and enhanced the stitching speed and quality, laying the foundation for subsequent detection of defects in tension clamps.
Smart Images

Figure CN119887513B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image stitching technology, and in particular to a method and system for stitching digital X-ray images of tension cable clamps. Background Technology
[0002] Image stitching technology has been widely used in recent years, especially in the fields of panoramic image generation, remote sensing image processing, medical imaging, and virtual reality. Its core purpose is to align two or more images with overlapping areas in the same scene to generate a single image with a larger field of view without reducing resolution. Image stitching generally consists of several steps, including image preprocessing, image registration, and image fusion. Image registration includes steps such as feature point detection, feature matching, and parameter model estimation.
[0003] Most commonly used image stitching methods are based on feature point matching, such as ORBD, SIFT, SURF, and KAZE. However, they are still limited by the time cost of feature point extraction and suffer from ghosting and blurring problems. While considering improving image alignment, more and more scholars are focusing on reducing projection distortion in non-overlapping areas. Some scholars have proposed protecting non-overlapping areas to ensure that the final mosaic panoramic image is more natural. However, when most algorithms eliminate projection distortion in non-overlapping areas, they also destroy the structural information in the image, resulting in discontinuities in the transition from overlapping to non-overlapping areas. Summary of the Invention
[0004] In view of the above-mentioned problems, the present invention is proposed.
[0005] Therefore, the problem to be solved by this invention is how to address the parallax in images produced by two consecutive X-ray images of tension clamps. A method for stitching digital X-ray images of tension clamps is proposed, which adjusts the parameters of the global homography transformation model based on a weight factor calculated by distance, thereby solving the problem of artifacts in overlapping areas caused by parallax.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0007] In a first aspect, embodiments of the present invention provide a method for stitching digital ray images of tension clamps, comprising: acquiring digital ray images of tension clamps and preprocessing them to obtain a preprocessed image; performing feature point detection on the preprocessed image and extracting feature points; using a mesh model to perform feature matching on the extracted feature points to obtain an image to be registered; and performing image fusion based on the image to be registered to realize the stitching of digital ray images of tension clamps.
[0008] As a preferred embodiment of the stitching method for digital ray images of tension clamps according to the present invention, the digital ray image of the tension clamp includes a reference image and a target image; obtaining the preprocessed image refers to preprocessing the reference image and the target image to obtain the preprocessed reference image and the target image.
[0009] As a preferred embodiment of the stitching method for digital ray images of tension clamps described in this invention, the feature point detection of the preprocessed image refers to extracting feature points from the preprocessed reference image and the target image using the AKAZE algorithm. The feature point detection includes the following steps: constructing a scale space using nonlinear diffusion filtering, introducing a Local Difference Binary Descriptor (M-LDB), obtaining the descriptor through the AKAZE feature algorithm, and describing the brightness at different scale levels as the divergence of the flow function, thereby describing the change in image brightness at different scale spaces. The specific formula is as follows:
[0010]
[0011] in, Let be the gradient; div(·) be the divergence; c(·) be the transfer function. The larger the evolution time t, the larger the scale parameter. In order to use the nonlinear diffusion filter equation, the discrete scale factor needs to be converted into a time unit. The original image is processed by Gaussian filtering. The value at the T% position of the gradient histogram of the input image after filtering is used as the control factor. After obtaining the input image and the control factor, the FED algorithm is used to solve the nonlinear diffusion filter equation to obtain the scale space. The specific formula of the scale space is as follows:
[0012] L i+1 =[I+τA(L i )]L i
[0013] Where I is the identity matrix; A(L) i Let be the matrix of the image in dimension i; τ be the time step; after constructing the scale space, apply non-maximum suppression to each pixel to obtain the corresponding Hessian matrix; detect the feature points and compare them with other pixels at the same level and in the two layers above and below, and then search for the maximum value of the Hessian matrix; use Taylor formula to perform sub-pixel level precise localization, and the corresponding position is the final localization point of the feature point.
[0014] As a preferred embodiment of the stitching method for digital ray images of tension clamps described in this invention, the following steps are taken: Feature matching of extracted feature points using a mesh model refers to optimizing the mesh model based on the APAP algorithm, using global and local similarity as constraints, and then using the optimized mesh model to perform feature matching on the extracted feature points to obtain the image to be registered; Global similarity refers to adding global similarity constraints to reduce distortion during image registration, assuming image I... i Given the scale factor s and rotation angle θ, the specific formula for the global similarity constraint is as follows:
[0015]
[0016] Where V represents all grid points; E i For image I i The edge; These are the coefficients for the similarity transformation; The weighting function is used; the local similarity refers to the principle of gradually transitioning from overlapping to non-overlapping regions to reduce overall image shape distortion and ensure similar transformation between them. The specific formula for local similarity constraints is as follows:
[0017]
[0018] Among them, v i For image I i Grid points; The positions of the grid points on the original image; This represents the location of the deformable mesh point.
[0019] As a preferred embodiment of the stitching method for digital X-ray images of tension clamps described in this invention, image fusion based on the image to be registered refers to designing an improved recursive stitching neural network E-RSNet for image fusion; the core of the improved recursive stitching neural network E-RSNet lies in the recursive feature fusion module, which integrates image features of different scales through a multi-level feature fusion strategy; let the feature representation of the input image be Y1, and the recursive feature fusion module and the point convolution kernel K... point Perform a convolution operation to obtain the fused feature representation Y, as shown in the following formula:
[0020] Y = Y1#K point
[0021] Where # represents the convolution operation; K point The parameters are learnable point convolution kernels; the network architecture of the improved recursive concatenation neural network E-RSNet is based on the encoder-decoder structure of EfficientNet, and the specific architecture is as follows:
[0022] F encode =EfficientNet(X)
[0023] F*decode = Decoder(F*encode)
[0024] Y1 = F * decode * K * depth
[0025] Based on the core model, the improved recursive splicing neural network E-RSNet introduces a recursive feature fusion module and a multi-head self-attention mechanism, including: the recursive feature fusion module fuses features at different levels through multiple iterations; the multi-head self-attention mechanism enables the network to focus on key regions in the image.
[0026] As a preferred embodiment of the stitching method for digital ray images of tension cable clamps described in this invention, the self-attention mechanism achieves focusing on important features by calculating the correlation weights between different positions. The specific formula of the self-attention mechanism is as follows:
[0027]
[0028] Where Q represents the query; K represents the key; V represents the value; d k The dimension of the key; the multi-head self-attention mechanism is applied multiple times in the improved recursive concatenation neural network E-RSNet. By computing attention in parallel in different subspaces, global information in the image is mined. The self-attention mechanism is further extended to obtain the multi-head self-attention mechanism. The specific formula of the multi-head self-attention mechanism is as follows:
[0029] Y t+1 =Attention(Y) t )+X*K depth
[0030] Among them, Y t Let be the feature map after the t-th iteration; Attention(·) is the result of the multi-head self-attention mechanism processing the feature map.
[0031] As a preferred embodiment of the stitching method for digital X-ray images of tension cable clamps described in this invention, in order to improve the performance of the improved recursive stitching neural network E-RSNet, optimizations are made to key modules, including dynamic weight adjustment of the recursive feature fusion module, hierarchical attention module with multi-head self-attention mechanism, and dynamic pruning and mixed precision quantization technology of the model; the dynamic weight adjustment of the recursive feature fusion module refers to adopting a dynamic weight adjustment strategy for the recursive feature fusion module, so that features at different levels can be adaptively assigned different weights during the fusion process, let the feature of the (l)th layer be Y. (l)The weighted fusion formula is as follows:
[0032]
[0033] Where, α (l) Here are the dynamic weight parameters for layer (l); the hierarchical attention module of the multi-head self-attention mechanism refers to the introduction of a hierarchical attention module into the multi-head self-attention mechanism, which calculates the attention weights at different scales, as shown in the following formula:
[0034] MultiHeadAttention(Q,K,V)=Concat(head1,head2,...,head h W O
[0035]
[0036] Among them, head i Let be the attention of the i-th head.
[0037] Secondly, to further address the security issues in image stitching, this invention provides a stitching system for digital ray images of tension clamps, comprising: an image acquisition module for acquiring digital ray images of tension clamps as reference and target images and performing preprocessing to obtain preprocessed reference and target images; a feature extraction module for extracting feature points from the preprocessed reference and target images using the AKAZE algorithm; a feature matching module for optimizing a mesh model using the APAP algorithm with global and local similarity as constraints, and performing feature matching on the extracted feature points using the optimized mesh model to obtain the image to be registered; and an image stitching module for performing image fusion on the image to be registered using an improved recursive stitching neural network E-RSNet.
[0038] Thirdly, embodiments of the present invention provide a computer device, including a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program is executed by the processor, it implements any step of the stitching method for digital X-ray images of tension clamps as described in the first aspect of the present invention.
[0039] Fourthly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, it implements any step of the stitching method for digital X-ray images of tension clamps as described in the first aspect of the present invention.
[0040] The beneficial effects of this invention are as follows: This invention addresses the parallax issue arising from two consecutive X-ray images of tension clamps. It adjusts the parameters of the global homography transformation model based on a distance-calculated weight factor, resolving the artifact problem in overlapping areas caused by parallax. Utilizing the APAP algorithm, it optimizes the mesh model by using global and local similarity as constraints. Simultaneously, during multi-image stitching, it selects appropriate scales and rotation angles for each image to be registered, improving the naturalness of the stitching. Furthermore, it employs an improved recursive stitching neural network, E-RSNet, for image fusion. An encoder-decoder architecture is built based on EficientNet, and an improved recursive feature fusion module and multi-head self-attention mechanism are introduced to achieve high-precision real-time image stitching, significantly improving the quality and speed of X-ray image stitching and laying the foundation for subsequent defect detection of tension clamps. Attached Figure Description
[0041] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein:
[0042] Figure 1 This is an overall flowchart of the method for stitching digital X-ray images of tension clamps in Example 1.
[0043] Figure 2 This is a schematic diagram of the computer device in Example 3. Detailed Implementation
[0044] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0045] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0046] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.
[0047] Example 1
[0048] Reference Figure 1This is the first embodiment of the present invention, which provides a method for stitching digital X-ray images of tension clamps.
[0049] Existing image stitching methods mainly suffer from the following problems: limited by the time cost of feature point extraction, there are issues of ghosting and blurring; while considering improvements in image alignment, more and more scholars are focusing on reducing projection distortion in non-overlapping areas, and some scholars have proposed protecting non-overlapping areas to ensure that the final mosaic panoramic image is more natural; however, when most algorithms eliminate projection distortion in non-overlapping areas, they also destroy the structural information in the image, resulting in discontinuities in the transition from overlapping to non-overlapping areas.
[0050] This application provides a method for effectively solving the problems mentioned above. The following will describe in detail how to implement the stitching method for digital X-ray images of tension clamps using multiple embodiments.
[0051] Figure 1 A flowchart illustrating the overall process for stitching digital ray images of tension cable clamps is provided, including:
[0052] S1: Acquire digital ray images of tension clamps and perform preprocessing to obtain preprocessed images.
[0053] Preferably, the digital X-ray image of the tension clamp includes a reference image and a target image.
[0054] Specifically, obtaining a preprocessed image refers to preprocessing the reference image and the target image to obtain the preprocessed reference image and target image.
[0055] S2: Perform feature point detection on the preprocessed image and extract feature points.
[0056] Preferably, feature point detection of the preprocessed image refers to using the AKAZE algorithm to extract feature points from the preprocessed reference image and the target image.
[0057] Specifically, feature point detection includes the following steps: The AKAZE algorithm is an accelerated version of KAZE features. It utilizes nonlinear diffusion filtering to construct a scale space and introduces an effectively improved local difference binary descriptor, M-LDB. The descriptor obtained through the AKAZE feature algorithm has rotation invariance, scale invariance, and illumination invariance. The nonlinear diffusion filtering equation describes the brightness at different scale levels as the divergence of the flow function, thereby describing the change of image brightness in different scale spaces. The specific formula is as follows:
[0058]
[0059] in, is the gradient; div(·) is the divergence; c(·) is the transfer function, which enables the divergence structure to adapt to the local structure of the image. The larger the evolution time t, the larger the scale parameter.
[0060] To use the nonlinear diffusion filter equation, the discrete scale factor needs to be converted into a time unit. The original image is then processed using a Gaussian filter. The value at the 70% position of the gradient histogram of the filtered input image is used as a control factor. After obtaining the input image and the control factor, the FED algorithm is used to solve the nonlinear diffusion filter equation to obtain the scale space. The specific formula for the scale space is as follows:
[0061] L i+1 =[I+τA(L i )]L i
[0062] Where I is the identity matrix; A(L) i ) is the matrix of the image in dimension i, i∈[0,N-1]; τ is the time step.
[0063] After constructing the scale space, non-maximum suppression can be applied to each pixel to obtain the corresponding Hessian matrix.
[0064] Feature points are detected and compared with other pixels at the same level and in the two layers above and below, thereby searching for the maximum value of the Hessian matrix.
[0065] Using Taylor's formula, precise sub-pixel level localization is achieved, and the corresponding position is the final localization point of the feature point.
[0066] S3: Use a grid model to perform feature matching on the extracted feature points to obtain the image to be registered.
[0067] Preferably, feature matching of extracted feature points using a grid model refers to optimizing the grid model based on the APAP algorithm, using global similarity and local similarity as constraints, and then using the optimized grid model to perform feature matching on the extracted feature points to obtain the image to be registered.
[0068] Specifically, global similarity refers to the addition of global similarity constraints to reduce distortion during image registration. Without these constraints, the final stitching result may be tilted and distorted. Assuming image I has been determined... i Given the scale factor s and rotation angle θ, the specific formula for the global similarity constraint is as follows:
[0069]
[0070] Where V represents all grid points; E i For image Ii The edge; These are the coefficients for the similarity transformation; For the weight function, more weight is given to regions far from the overlapping area; the alignment term plays an important role in the overlapping area, and for the parts far from the overlapping area, the similarity experience is more important because there is no alignment constraint.
[0071] Specifically, local similarity refers to reducing overall image shape distortion and ensuring similar transformation between overlapping and non-overlapping regions. It involves a gradual transition from overlapping to non-overlapping regions to improve the naturalness of the stitching. The specific formula for local similarity constraints is as follows:
[0072]
[0073] Among them, v i For image I i Grid points; The positions of the grid points on the original image; This represents the location of the deformable mesh point.
[0074] S4: Perform image fusion based on the image to be registered to realize the stitching of digital ray images of tension clamps.
[0075] Preferably, image fusion based on the image to be registered refers to designing an improved recursive stitching neural network E-RSNet for image fusion. The improved recursive stitching neural network E-RSNet is based on EficientNet to build an encoder-decoder architecture and introduces an improved recursive feature fusion module and a multi-head self-attention mechanism to achieve high-precision real-time image stitching, significantly improving the quality and speed of X-ray image stitching, and laying the foundation for subsequent tension clamp defect detection.
[0076] It should be noted that in the process of X-ray image stitching and defect identification of power line tension clamps, high-precision image stitching is the foundation for accurate defect detection. To address the shortcomings of existing image stitching methods in terms of real-time performance and accuracy, an improved recursive stitching neural network, E-RSNet, is proposed. The improved recursive stitching neural network E-RSNet is based on the encoder-decoder architecture of EfficientNet and integrates an improved recursive feature fusion module and a multi-head self-attention mechanism, aiming to improve the accuracy and efficiency of image stitching.
[0077] Specifically, the core of the improved recursive concatenation neural network E-RSNet lies in the recursive feature fusion module. This module effectively integrates image features at different scales through a multi-level feature fusion strategy. Let the feature representation of the input image be Y1, which is then combined with a point convolution kernel K by the recursive feature fusion module. point Perform a convolution operation to obtain the fused feature representation Y, as shown in the following formula:
[0078] Y = Y1#K point
[0079] Where # represents the convolution operation; K point These are the learnable point convolution kernel parameters.
[0080] Ideally, by utilizing the specific formula of the fused feature representation, the key operations in the feature fusion process are reflected. By introducing point convolution kernels, the expressive power and fusion effect of the features are enhanced. The recursive feature fusion module repeatedly applies the specific formula of the fused feature representation at different levels, realizing the deep fusion of multi-scale features and significantly improving the accuracy of image stitching.
[0081] Furthermore, the improved recursive concatenation neural network E-RSNet's network architecture is based on the encoder-decoder structure of EfficientNet, aiming to balance model complexity and computational efficiency. The specific architecture is as follows:
[0082] F encode =EfficientNet(X)
[0083] F*decode = Decoder(F*encode)
[0084] Y1 = F * decode * K * depth
[0085] It should be noted that the encoder is responsible for extracting high-level semantic features of the input image, while the decoder restores the spatial resolution of the image through upsampling operations, ensuring that the detailed information of the feature map is preserved. Through the above process, the improved recurrent stitching neural network E-RSNet can effectively generate the preliminary feature map Y1, providing a solid foundation for subsequent stitching and defect detection.
[0086] Furthermore, based on the core model, the improved recursive stitching neural network E-RSNet introduces a recursive feature fusion module and a multi-head self-attention mechanism to further optimize feature representation. The recursive feature fusion module enhances the ability to capture image details by fusing features at different levels through multiple iterations.
[0087] The multi-head self-attention mechanism enables the network to focus on key areas in the image, improving the accuracy and efficiency of stitching.
[0088] Furthermore, the introduction of multi-head self-attention mechanism further enhances the model's ability to capture key information in the image. The self-attention mechanism focuses on important features by calculating the correlation weights between different locations, thereby improving the accuracy and robustness of the stitching. The specific formula of the self-attention mechanism is as follows:
[0089]
[0090] Where Q stands for Query; K for Key; V for Value; and d... k The dimension of the key.
[0091] Specifically, the multi-head self-attention mechanism is applied multiple times in the improved recurrent concatenation neural network E-RSNet. By computing attention in parallel in different subspaces, it fully mines the global information in the image, enhancing the model's ability to identify complex defects. The self-attention mechanism is further extended to obtain the multi-head self-attention mechanism. The specific formula of the multi-head self-attention mechanism is as follows:
[0092] Y t+1 =Attention(Y) t )+X*K depth
[0093] Among them, Y t Let t be the feature map after the t-th iteration; Attention(·) is the result of the multi-head self-attention mechanism processing the feature map, where the network can gradually optimize the feature representation through recursive iteration to achieve high-precision image stitching.
[0094] Preferably, in order to further improve the performance of the improved recursive splicing neural network E-RSNet, multiple optimizations have been made to the key modules, including dynamic weight adjustment of the recursive feature fusion module, hierarchical attention module of multi-head self-attention mechanism, and dynamic pruning and hybrid precision quantization technology of the model.
[0095] Specifically, the dynamic weight adjustment of the recursive feature fusion module refers to the adoption of a dynamic weight adjustment strategy for the recursive feature fusion module, which enables features at different levels to be adaptively assigned different weights during the fusion process, thereby improving the flexibility and adaptability of feature fusion. Let the feature of the (l)th layer be Y. (l) The weighted fusion formula is as follows:
[0096]
[0097] Where, α (l) The dynamic weight parameters of the (l)th layer are automatically learned through the training process. The dynamic weight adjustment of the recursive feature fusion module effectively alleviates the imbalance problem of features at different levels during the fusion process, ensuring the stability and consistency of feature fusion.
[0098] Specifically, the hierarchical attention module in the multi-head self-attention mechanism refers to the introduction of a hierarchical attention module into the multi-head self-attention mechanism. By calculating attention weights at different scales, it further enhances the model's ability to perceive multi-scale features. The specific formula is as follows:
[0099] MultiHeadAttention(Q,K,V)=Concat(head1,head2,...,head h W O
[0100]
[0101] Among them, head i Let be the attention of the i-th head.
[0102] Ideally, by utilizing a multi-head self-attention mechanism, the model can simultaneously capture multiple feature relationships in different subspaces, thereby enhancing the image stitching effect; the hierarchical attention module independently calculates attention weights at different scales, ensuring comprehensive capture of various detailed features and improving the overall performance of the model.
[0103] In summary, this invention addresses the parallax issue arising from two consecutive X-ray images of tension clamps. It adjusts the parameters of the global homography transformation model based on a distance-calculated weighting factor to resolve the artifact problem in overlapping areas caused by parallax. Utilizing the APAP algorithm, it optimizes the mesh model by using global and local similarity as constraints. Furthermore, during multi-image stitching, it selects appropriate scales and rotation angles for each image to be registered, improving the naturalness of the stitching. Finally, it employs an improved recursive stitching neural network, E-RSNet, for image fusion. An encoder-decoder architecture is built based on EficientNet, and an improved recursive feature fusion module and multi-head self-attention mechanism are introduced to achieve high-precision real-time image stitching, significantly improving the quality and speed of X-ray image stitching and laying the foundation for subsequent defect detection of tension clamps.
[0104] Example 2, an embodiment of the present invention, provides a stitching system for digital ray images of tension clamps, comprising: an image acquisition module for acquiring digital ray images of tension clamps as reference images and target images and performing preprocessing to obtain preprocessed reference images and target images; a feature extraction module for extracting feature points from the preprocessed reference images and target images using the AKAZE algorithm; a feature matching module for optimizing a mesh model using the APAP algorithm with global and local similarity as constraints, and performing feature matching on the extracted feature points using the optimized mesh model to obtain an image to be registered; and an image stitching module for performing image fusion on the images to be registered using an improved recursive stitching neural network E-RSNet.
[0105] Example 3 is an embodiment of the present invention, which differs from the previous embodiment in that:
[0106] like Figure 2 As shown, if the function 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 the present invention, or the part that contributes to the prior art, or a 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 described in the various embodiments of the present 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.
[0107] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0108] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0109] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0110] Example 4 is an embodiment of the present invention, which provides a method for stitching digital X-ray images of tension clamps. To verify the beneficial effects of the present invention, a simulation experiment is conducted for scientific demonstration.
[0111] This example simulates the acquisition of 10 ray images of tension clamps taken from different angles, each image measuring 2048×2048 pixels. All images underwent preliminary preprocessing, including brightness equalization, noise removal, and image cropping. Subsequently, the AKAZE algorithm was used to detect feature points in the preprocessed images. The AKAZE algorithm constructs a scale space through nonlinear diffusion filtering and extracts feature points with rotation, scale, and illumination invariance using the M-LDB descriptor. After feature point extraction, the APAP algorithm based on a grid model is applied for feature matching, and the optimized grid model is further used to obtain the image to be registered. After registration, an improved recursive stitching neural network, E-RSNet, is used for image fusion. The improved recursive stitching neural network E-RSNet is based on the EfficientNet architecture and combines a recursive feature fusion module and a multi-head self-attention mechanism to ensure high accuracy and efficiency of the stitching results.
[0112] To verify the effectiveness of the method of the present invention, it was compared with the existing stitching method based on traditional feature point matching to evaluate the quality of the stitched image and the accuracy of defect detection. The comparison data is shown in Table 1.
[0113] Table 1 Comparison data between the present invention and the prior art
[0114]
[0115] As can be seen from the table above, the number of feature points generated by the AKAZE algorithm and nonlinear diffusion filtering in this invention is far higher than that of traditional methods. This indicates that the present invention is more refined in the feature extraction process, capable of capturing more key feature points, thereby improving the accuracy and stability of image stitching. In terms of image registration time, the method of this invention is also significantly better than traditional methods. By utilizing grid model optimization and the APAP algorithm, the stitching time is greatly shortened, especially when registering more complex images, where the registration speed is significantly improved, highlighting the advantages of this invention in real-time performance. The stitching quality score in the table shows that the present invention, through the multi-head self-attention mechanism in the improved recursive stitching neural network E-RSNet, successfully improves the detail preservation and visual consistency of the stitched image, reduces stitching gaps and discontinuities, and ensures higher stitching quality. Defect detection is one of the key applications of X-ray image stitching of tension clamps. The data shows that the defect detection accuracy of the stitching method of this invention is significantly better than that of traditional stitching methods, further proving the efficiency and reliability of the method of this invention in practical applications.
[0116] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A method for stitching digital ray images of tension cable clamps, characterized in that: include: Acquire digital ray images of tension clamps and perform preprocessing to obtain preprocessed images; Feature point detection is performed on the preprocessed image to extract feature points; The extracted feature points are matched using a grid model to obtain the image to be registered; Image fusion is performed based on the image to be registered to achieve the stitching of digital ray images of tension clamps; Image fusion based on the image to be registered refers to designing an improved recursive stitching neural network, E-RSNet, for image fusion. The core of the improved recursive concatenation neural network E-RSNet lies in the recursive feature fusion module. This module integrates image features of different scales through a multi-level feature fusion strategy. Let the feature representation of the input image be Y1, which is then processed by the recursive feature fusion module and a point convolution kernel K. point Perform a convolution operation to obtain the fused feature representation Y, as shown in the following formula: Y=Y1#K point Where # represents the convolution operation; K point These are the learnable point convolution kernel parameters; The improved recursive concatenation neural network E-RSNet's network architecture is based on the encoder-decoder structure of EfficientNet, and the specific architecture is as follows: F encode =EfficientNet(X) F*decode = Decoder(F*encode) Y1 = F * decode * K * depth Building upon the core model, the improved recurrent concatenation neural network E-RSNet introduces a recurrent feature fusion module and a multi-head self-attention mechanism, including: The recursive feature fusion module fuses features at different levels through multiple iterations; Multi-head self-attention mechanisms enable networks to focus on key regions in an image; The self-attention mechanism focuses on important features by calculating the correlation weights between different locations. The specific formula for the self-attention mechanism is as follows: Where Q represents the query; K represents the key; V represents the value; d k The dimension of the key; Multi-head self-attention mechanism has been applied multiple times in the improved recurrent concatenation neural network E-RSNet. By computing attention in parallel in different subspaces, global information in the image is mined. The self-attention mechanism is further extended to obtain the multi-head self-attention mechanism. The specific formula of the multi-head self-attention mechanism is as follows: Y t+1 *Attention(Y t )+X*K depth Among them, Y t Let be the feature map after the t-th iteration; Attention(·) is the result of the multi-head self-attention mechanism processing the feature map; To improve the performance of the improved recursive splicing neural network E-RSNet, optimizations were made to key modules, including dynamic weight adjustment of the recursive feature fusion module, hierarchical attention module of multi-head self-attention mechanism, and dynamic pruning and hybrid precision quantization techniques of the model. The dynamic weight adjustment of the recursive feature fusion module refers to the adoption of a dynamic weight adjustment strategy for the recursive feature fusion module, so that features at different levels can be adaptively assigned different weights during the fusion process. Let the feature of the (l)th layer be Y. (l) The weighted fusion formula is as follows: Where, α (l) The dynamic weight parameters of the (l)th layer; The hierarchical attention module in the multi-head self-attention mechanism refers to the introduction of a hierarchical attention module into the multi-head self-attention mechanism, which calculates attention weights at different scales. The specific formula is as follows: MultiHeadAttention(Q,K,V)=Concat(head1,head2,...,head h )W O head i =Attention(QW i Q ,KW i K ,VW i V ) Among them, head i Let be the attention of the i-th head.
2. The method for stitching digital X-ray images of tension clamps as described in claim 1, characterized in that: The digital X-ray image of the tension clamp includes a reference image and a target image; The term "obtaining a preprocessed image" refers to preprocessing the reference image and the target image to obtain the preprocessed reference image and the target image.
3. The method for stitching digital X-ray images of tension clamps as described in claim 2, characterized in that: Feature point detection of the preprocessed image refers to extracting feature points from the preprocessed reference image and target image using the AKAZE algorithm; The feature point detection includes the following steps: A scale space is constructed using nonlinear diffusion filtering, and a local difference binary descriptor (M-LDB) is introduced. The descriptor is obtained through the AKAZE feature algorithm. The nonlinear diffusion filtering equation describes the brightness at different scale levels as the divergence of the flow function, thereby describing the variation of image brightness in different scale spaces. The specific formula is as follows: in, is the gradient; div(·) is the divergence; c(·) is the transfer function, and the larger the evolution time t, the larger the scale parameter. To use the nonlinear diffusion filter equation, the discrete scale factor needs to be converted into a time unit. The original image is then processed using a Gaussian filter. The value at position T% of the gradient histogram of the filtered input image is used as a control factor. After obtaining the input image and the control factor, the FED algorithm is used to solve the nonlinear diffusion filter equation, yielding the scale space. The specific formula for the scale space is as follows: L i+1 =[I+τA(L i )]L i Where I is the identity matrix; A(L) i ) represents the matrix of the image in dimension i; τ is the time step; After constructing the scale space, non-maximum suppression is applied to each pixel to obtain the corresponding Hessian matrix; Feature points are detected and compared with other pixels at the same level and in the two layers above and below, and then the maximum value of the Hessian matrix is searched. Using Taylor's formula, precise sub-pixel level localization is achieved, and the corresponding position is the final localization point of the feature point.
4. The method for stitching digital X-ray images of tension clamps as described in claim 3, characterized in that: The aforementioned feature matching of extracted feature points using a grid model refers to optimizing the grid model based on the APAP algorithm, using global similarity and local similarity as constraints, and then using the optimized grid model to perform feature matching on the extracted feature points to obtain the image to be registered. The global similarity mentioned refers to the addition of global similarity constraints to reduce distortion during image registration. Assuming image I... i Given the scale factor s and rotation angle θ, the specific formula for the global similarity constraint is as follows: Where V represents all grid points; E i For image I i The edge; and These are the coefficients for the similarity transformation; For weighting functions; The local similarity refers to the principle of reducing overall image shape distortion and ensuring similar transformation between overlapping and non-overlapping regions by gradually transitioning from overlapping to non-overlapping regions. The specific formula for local similarity constraints is as follows: Among them, v i For image I i Grid points; The positions of the grid points on the original image; This represents the location of the deformable mesh point.
5. A stitching system for digital ray images of tension clamps, based on the stitching method for digital ray images of tension clamps according to any one of claims 1 to 4, characterized in that: include, The image acquisition module is used to acquire digital ray images of tension clamps as reference images and target images, and to preprocess them to obtain preprocessed reference images and target images; The feature extraction module is used to extract feature points from the preprocessed reference image and target image using the AKAZE algorithm; The feature matching module is used to optimize the grid model by using global similarity and local similarity as constraints based on the APAP algorithm. The optimized grid model is then used to perform feature matching on the extracted feature points to obtain the image to be registered. The image stitching module is used to perform image fusion on the images to be registered using the improved recursive stitching neural network E-RSNet.
6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, it implements the steps of the stitching method for digital X-ray images of tension clamps as described in any one of claims 1 to 4.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the stitching method for digital X-ray images of tension clamps as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Unmanned aerial vehicle aerial image splicing method based on linear feature protection and grid optimization
CN112435163A
Power transmission line strain clamp defect detection method based on improved YOLOX algorithm
CN114723750A