Phase model construction method based on U-Net network
Through the phase model based on U-Net network, combined with residual block, Inception module and attention gate module, the efficiency and accuracy problems of existing phase deployment technology in high noise and complex scenarios are solved, and efficient and accurate phase deployment is achieved.
Patent Information
- Application Number
- CN202411267981.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2025-02-28
AI Technical Summary
When dealing with high noise and complex scenarios, existing phase expansion technology has low computing efficiency, insufficient noise resistance, and has problems such as slow speed and low measurement efficiency.
Using a phase model based on U-Net network, the loss function is optimized to improve the robustness and efficiency of the model by generating suitable data sets, constructing a U-Net network structure containing residual blocks and Inception modules, and introducing attention gate modules and weight decay strategies.
High-precision phase expansion in high noise and complex environments is achieved, which improves measurement reliability and speed, and reduces computational cost and algorithm complexity.
Smart Images

Figure CN119538983A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for constructing a phase model, and in particular to a method for constructing a phase model based on a U-Net network. Background Art
[0002] In the process of fringe data processing, the optical interferometry method is used to extract the fringe centerline, thereby improving the corresponding measurement accuracy, but various difficulties are faced in implementation. In order to solve this problem, phase measurement technology came into being. Phase is essentially the time delay in wave propagation, which can be used as a carrier of information about the measured object, usually such as the base surface on the object to be measured, micro-deformation caused by extrusion, and the three-dimensional morphology represented by the related object. Since the three-dimensional morphology of the object to be measured requires a specific measurement method to obtain relevant information about the object to be measured, a higher-precision measurement method is required.
[0003] The purpose of studying spatial phase unwrapping using deep learning is to address some challenges in the phase unwrapping process of traditional methods. Traditional methods usually rely on manually designed rules and heuristic algorithms to solve the phase unwrapping problem, which is prone to error accumulation and high computational complexity in complex scenarios.
[0004] The estimation of absolute phase (true position) is an important but challenging problem in many imaging or measurement techniques, such as optical interferometry (OI), magnetic resonance imaging (MRI), fringe projection profilometry (FPP), and interferometric synthetic aperture radar (InSAR). Importantly, the estimated absolute phase for the above applications is proportional to the desired physical quantity, such as thickness or refractive index distribution for OI, magnetic susceptibility distribution or blood flow velocity for MRI, three-dimensional (3D) distribution of the object surface for FPP, and topographic surface height or ground deformation for InSAR. The initial stage of the above application is limited to the range of (-π,π] because it is an arctan function calculated from the complex amplitude field (CAF). The spatial phase unwrapping technology has high computational efficiency, but it is not robust to severe noise conditions. For a few algorithms with strong noise resistance, there is a problem of large computational complexity and slow speed. The temporal phase unwrapping technology has high accuracy and certain robustness and noise resistance, but because the phase unwrapping is achieved pixel by pixel in the time direction, it is necessary to project multiple patterns in time sequence and it is impossible to complete the phase unwrapping using a single wrapped phase. Therefore, there are inevitably problems such as low measurement efficiency and slow measurement speed. In order to overcome Overcoming the shortcomings of existing traditional phase unwrapping technology, it is possible to achieve more accurate phase unwrapping in a shorter time in practical applications. Researchers are gradually tending to design an efficient architecture for the phase unwrapping process, trying to find a direct correspondence between the absolute phase and the wrapped phase. Recently developed machine learning architectures, especially deep neural networks, can be effectively used for computational image formation. Phase unwrapping technology based on deep learning is mainly aimed at improving measurement efficiency and reducing the number of projection patterns, thus reflecting the superiority of deep learning for phase unwrapping in speed. Recently, deep learning-based methods have been proposed as an alternative to traditional phase unwrapping to improve speed and accuracy.
[0005] For phase wrapping images collected under high noise and special conditions, the phase demodulation method used has never been able to achieve a qualitative improvement, that is, there has been no significant improvement in demodulation accuracy or operation time. However, with the vigorous development of artificial intelligence related technologies, deep learning has achieved good results in the field of computer vision. In recent years, relevant researchers have also combined deep learning with the field of optical detection, such as extending to wavefront detection, fringe analysis, etc. The present invention proposes a method based on deep learning to solve the problem of phase wrapping, which can achieve high-precision phase demodulation for the characteristics of insensitivity under high noise.
[0006] Deep learning has achieved remarkable results in recent years and has been widely used in image processing, speech recognition, natural language processing and other fields. However, in the field of radar imaging, especially in spatial phase unwrapping, the application of deep learning is relatively small. Therefore, the purpose of this invention is to explore the use of deep learning technology for deep learning spatial phase unwrapping, and to reveal its significance and potential applications. Deep learning phase unwrapping is a technology that uses deep learning algorithms to process and reconstruct phase images. Phase unwrapping has a wide range of applications in optics, medical imaging, radar, communications and other fields, and the development of deep learning phase unwrapping technology will bring many important meanings and prospects to these fields.
[0007] Phase unwrapping With the continuous development of deep learning, it has been integrated into all walks of life. Many methods of deep learning phase unwrapping have gradually emerged. Since they are not constrained by the Itoh condition (a stability condition in control theory used to determine whether the system is asymptotically stable, proposed by Japanese control theorist Itoh in the 1960s), these methods are still effective in the presence of noise, discontinuity and aliasing. Although deep learning-based methods have been effectively applied in the task of phase unwrapping, they are still difficult to use in actual applications due to their high computational consumption, complex models and long time consumption.
[0008] The traditional U-Net network was originally used for medical image segmentation. Its structural feature is a symmetrical U-shape, which can gradually downsample and upsample the input image and perform jump connections in the middle layer to obtain better semantic information and spatial information. In subsequent studies, in order to solve the problem of phase unwrapping errors caused by severe noise and undersampling, a database generation method for phase type objects and a one-step deep learning phase unwrapping method were proposed. The essential core of this network is U-Net. This method network runs relatively quickly and can run automatically without additional pre-processing or post-processing, and has good robustness. However, when processing a large number of high-resolution images and complex scenes, it still requires longer training time and greater computing resources.
[0009] Phase unwrapping is a signal processing concept used to solve the problem of phase jumps in signals. In some applications, the phase of the signal may be limited or abrupt, resulting in discontinuous jumps in the phase value at certain locations. The goal of phase unwrapping is to eliminate these phase jumps so that the phase value remains continuous throughout the signal range. Among the traditional phase unwrapping methods, the spatial phase unwrapping technology has high computational efficiency, but it is not robust to severe noise conditions. For a few algorithms with strong noise resistance, there is a problem of large computational complexity leading to slow speed. The temporal phase unwrapping technology has high accuracy and certain robustness and noise resistance, but because the phase unwrapping is achieved pixel by pixel in the time direction, it is necessary to project multiple patterns in the time sequence and it is impossible to complete the phase unwrapping using a single wrapped phase. Therefore, there are inevitably problems such as low measurement efficiency and slow measurement speed. When unwrapping phases with strong noise, high overlap, and discontinuous points, traditional methods often cannot solve the problem well. It also requires a lot of manual participation and continuous attempts to solve it. In practical applications, phase unwrapping is widely used in various fields, including optical coherence tomography, radar signal processing, seismic data processing, etc. As the application requirements continue to increase, deep learning intervention is necessary. We analyze and study the evaluation indicators, data sets, loss functions, attention gate modules, etc., and innovate by combining existing methods. Summary of the invention
[0010] The purpose of the present invention is to solve the problem that in the existing phase unwrapping methods, the spatial phase unwrapping technology has high computational efficiency but is not robust to severe noise conditions, and for very few algorithms with strong noise resistance, there is a large amount of calculation resulting in slow speed. A method for constructing a phase model based on a U-Net network is proposed.
[0011] The above purpose is achieved through the following technical solutions:
[0012] A method for constructing a phase model based on a U-Net network is implemented by the following steps:
[0013] Step 1: Generate a data set. The method for generating the data set is to use one of the following methods: random matrix enlargement (RME), Gaussian function superposition (GFS), or Zernike polynomial superposition (ZPS).
[0014] Step 2: Preprocess the generated data and determine the size and parameters of the data set;
[0015] Step 3: Construct a phase unwrapping model based on the U-net network;
[0016] Step 4: Construct the loss function and optimization method in phase unwrapping; when training the model, set the learning rate for training so that the model converges faster and the model effect is better; at the same time, introduce the weight decay strategy, which is equivalent to L2 norm regularization. Regularization reduces the learned model parameter value by adding a penalty term to the model loss function.
[0017] Furthermore, in the process of generating the data set described in step 1, the random matrix enlargement RME includes: generating an initial square matrix, whose size is 2×2 to 25×25, whose value range is 2 to 100, and whose distribution type is a random distribution of a uniform distribution random matrix or a Gaussian distribution random matrix; then, converting the matrix into a larger matrix (256×256) by different interpolation methods, and the interpolation method is nearest neighbor interpolation, bilinear interpolation or bicubic interpolation;
[0018] The Gaussian function superposition method GFS includes: randomly generating a number of Gaussian functions 1 to 20 with different means, variances and amplitudes, and then superimposing them by addition or subtraction; in GFS, the Gaussian function is used to ensure continuity, and randomness is introduced by changing the Gaussian parameters and superimposing random functions; the GFS formula is as follows:
[0019]
[0020] Where f(x) is the absolute phase function of the output, x is the independent variable, n is the number of Gaussian functions, and w i is the weight of the i-th Gaussian function, μ i is the mean of the ith Gaussian function, σ i is the variance of the i-th Gaussian function;
[0021] Zernike polynomial superposition ZPS generates matrices of random numbers through Zernike polynomials of different coefficients of the first 30 orders, and then superimposes these matrices by addition or subtraction; the continuity is guaranteed by the Zernike polynomials, and the random strength of the polynomials introduces randomness;
[0022] By using the orthogonality of Zernike polynomials, the complex optical phase distribution can be expressed by weighted superposition of polynomials of different orders; the formula of ZPS is as follows:
[0023]
[0024] Among them, a nm is the coefficient of each Zernike mode, indicating the contribution of this mode to the overall phase distribution; Z nm (x, y) is an (n)th order and (m)th degree Zernike polynomial representing a specific distortion mode; by adjusting the value of each coefficient, the importance of different distortion modes in the overall phase distribution is adjusted.
[0025] Furthermore, the steps of constructing the phase unwrapping model based on the U-net network described in step 3 are specifically:
[0026] Based on the original U-Net network, the residual block and Inception module are added to obtain the network structure. The network consists of an encoding path, a decoding path and a bridging path. The encoding path consists of a convolution layer and a pooling layer, which is used to gradually reduce the size of the image and extract features. A residual block structure is added to it. The pooling layer selects the Max pooling 2×2 module. The input feature map is divided into non-overlapping 2×2 areas, and then the maximum value in each area is selected as the output value; to reduce the spatial size of the feature map by half, and then output it to the next step; the decoding path uses a transposed convolution operation, whose convolution kernel size is a combination of 3×3 and a residual block module. The feature map generated by upsampling is concatenated with the feature map on the left, and then concatenated with the low-level surface feature high-resolution picture on the left, merging features from different sources or different levels together so that the model can better utilize information from different sources or levels, thereby improving the performance and generalization ability of the model;
[0027] Combine the idea of Inception with the residual block network structure to obtain a network structure in which the four correct paths use 1, 2, 3, and 4 3×3 convolutions to more effectively extract features of different scales, and then connect them together through the concatenate operation and output them to the activation function ReLU.
[0028] By applying linear transformation and nonlinear activation function in sequence, the feature map x is obtained at the output of the lth layer of the attention gate module l , choose rectified linear units: Among them, i and c represent the spatial dimension and channel dimension respectively; the feature activation is expressed as: Where * represents the convolution operation; the function f(x l ; Φ l )=x (l+1) Applied to the convolutional layer l, represented by a trainable kernel parameter Φ l ; Input features (x l ) is scaled with the attention coefficient (α) computed in AG; the spatial region is selected by analyzing the activation and context information provided by the gating signal (g), which is collected at a coarser scale; the grid resampling of the attention coefficients uses trilinear interpolation; a gating vector is used for each pixel i to determine the focus area; the gating vector contains contextual information to prune lower-level feature responses, using AGs for natural image classification; additive attention is used to obtain the gating coefficient; the recipe for adding attention is as follows:
[0029]
[0030] in, Corresponding to the sigmoid activation function; ψ T (·) represents the casting function; AG consists of a set of parameters Θ att Representation, including: linear transformation Bias term b ψ ∈R, It is called vector-based concatenation attention, where the concatenated features x l and g are linearly mapped to an intermediate space of R dimensions;
[0031] AGs are incorporated into the standard U-Net architecture. In addition, AGs filter neuron activations during the forward and backward passes. During the backward pass, the gradients originating from the background region are weighted downward. The l-1 layer convolution parameter update rule is expressed as:
[0032]
[0033] The first gradient term on the right is Scaling; for multi-dimensional AGs, Corresponding to a vector at each grid scale; extracting and fusing complementary information in each sub-AG to define the output of the jump connection; performing a linear transformation, the input feature map is downsampled to the resolution of the gating signal; the corresponding linear transformation decouples the feature map and maps it to a low-dimensional space for gating operations; low-level feature mapping, using deep supervision to force the intermediate feature map to have semantic distinctions at each image scale.
[0034] Furthermore, the steps of constructing the loss function and optimization method in phase unwrapping described in step 4 are specifically:
[0035] MAE is used to measure the mean absolute error between the predicted value and the true value. The calculation formula of the MAE loss function is as follows:
[0036]
[0037] Where n represents the number of samples, y i represents the true value, represents the predicted value, Σ represents the sum;
[0038] When training a neural network, optimization algorithms such as gradient descent are used to minimize the MAE loss function so that the model's predicted value is closer to the true value; by adjusting the model parameters, the smaller the value of the loss function, the better the model's fitting effect.
[0039] The beneficial effects of the present invention are:
[0040] The present invention is based on deep learning, and reduces the operation and detection time by optimizing and improving the U-net model. The method also uses the following three indicators for accuracy estimation: root mean square error RMSE (root mean square error mean RMSEm, root mean square error standard deviation RMSEsd represents stability), the proportion of failed samples (Proportion of FailedSamples, PFS), and the average proportion of incorrect pixels in failed samples (Proportion of Incorrect Pixel, PIP), to improve the accuracy, timeliness and significance of phase unwrapping. Specifically:
[0041] 1. The method of the present invention can better adapt to network training by selecting a suitable data set generation method. By generating a corresponding training data set, it can better adapt to the network and obtain an ideal result.
[0042] 2. The present invention first uses the data set supervision for pre-training, and then uses the physical model supervision for re-training. At the same time, it also adopts a weight decay strategy to ensure that the network can have good convergence and shorten the model training time.
[0043] 3. The phase unwrapping model based on the U-Net network constructed by the present invention is based on the understanding of the residual block and the Inception module, and the residual block is constructed in the original network through the Inception idea, thereby obtaining Res-UNet, and introducing the attention gate (AG) in the connection channel. MAE loss is used as the loss function, which can improve the running speed of the model, and can obtain a more accurate and lightweight model for phase unwrapping, while also ensuring the accuracy, timeliness and significance of the network model.
[0044] 4. In view of the complex measurement environment, the complexity of the measured object itself and the low signal-to-noise ratio environment, the phase unwrapping based on the U-Net phase unwrapping network model has good noise resistance, which improves the reliability and accuracy of the measurement; it also has good robustness, ensuring the effectiveness and reliability of the measurement.
[0045] 5. Compared with previous methods, the model designed by the present invention has made great progress in calculation cost, while increasing the measurement speed and simplifying the algorithm process, which has higher reliability and universality than complex algorithms. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 is a flow chart of the method of the present invention;
[0047] Figure 2It is a Gaussian function superposition method operation demonstration diagram involved in the present invention;
[0048] Figure 3 is a diagram of a construction model of a residual block involved in the present invention;
[0049] Figure 4 is a diagram of Res-UNet involved in the present invention;
[0050] Figure 5 is a diagram of the residual block structure involved in the present invention;
[0051] Figure 6 It is a diagram of the principle diagram of the attention gate (AG) involved in the present invention. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. Specific implementation method one:
[0054] A method for constructing a phase model based on a U-Net network in this embodiment is as follows: Figure 1 As shown, the method is implemented by the following steps:
[0055] Step 1, generate a data set. The method of generating the data set is to use one of the methods of random matrix enlargement RME (Random Matrix Enlargement), Gaussian function superposition GFS (Gaussian Functions Superposition) or Zernike polynomials superposition ZPS (Zernike polynomials superposition);
[0056] Step 2: Preprocess the generated data and determine the size and parameters of the data set;
[0057] Step 3: Construct a phase unwrapping model based on the U-net network;
[0058] Step 4, construct the loss function and optimization method in phase unwrapping; when training the model, set a suitable learning rate. Learning (Learning rate) is an important hyperparameter in supervised learning and deep learning, which determines whether the objective function can converge to the local minimum and when it converges to the minimum. A suitable learning rate can make the objective function converge to the local minimum within a suitable time. Since the loss is large in the early stage of training, the calculated gradient is also large. If a larger learning rate is set, the model can easily skip the optimal point and it is difficult to pull it back later. In order to avoid the above situation and prevent overfitting, a learning rate warm-up strategy is introduced to make the learning rate smaller in the first few rounds or some steps of training. Under the small learning rate of preheating, the model can slowly tend to stabilize. After the model is relatively stable, the pre-set learning rate is selected for training, so that the model convergence speed becomes faster and the model effect is better; at the same time, the present invention also introduces a weight decay strategy, which is equivalent to L2 norm regularization. Regularization reduces the learned model parameter value by adding a penalty term to the model loss function, which is also a common means to deal with overfitting. Specific implementation method 2:
[0060] The present embodiment is a method for constructing a phase model based on a U-Net network, which is different from the specific embodiment 1 in that in the process of generating a data set described in step 1, the random matrix amplification RME includes: generating an initial square matrix, whose size is 2×2 to 25×25, whose value range is 2 to 100, and whose distribution type is a random distribution of a uniformly distributed random matrix or a Gaussian distributed random matrix; then, the matrix is converted into a larger matrix (256×256) by different interpolation methods, and the interpolation method is nearest neighbor interpolation, bilinear interpolation or bicubic interpolation. There are four random parameters in the real phase generation process; the size of the initial matrix determines the number and position of the extreme value points of the final real phase. The range of the initial matrix determines the gradient of the final real phase. The distribution type and interpolation method of the initial matrix determine the distribution of the final real phase;
[0061] The Gaussian function superposition method GFS includes: randomly generating a number of Gaussian functions with different means (randomly set to 2 to 127 in the x and y directions), variances (randomly set to 100 to 1000) and amplitudes (randomly set to 0 to 1) from 1 to 20, and then superimposing them by addition or subtraction; Figure 2 As shown in Figure 1, three 128×128 Gaussian functions are linearly mapped to a higher absolute phase h by addition and subtraction. In GFS, Gaussian functions are used to ensure continuity, while randomness is introduced by changing Gaussian parameters and superimposing random functions; the GFS formula is as follows:
[0062]
[0063] Where f(x) is the absolute phase function of the output, x is the independent variable, n is the number of Gaussian functions, and w i is the weight of the i-th Gaussian function, μ i is the mean of the ith Gaussian function, σ i is the variance of the i-th Gaussian function;
[0064] Zernike polynomial superposition ZPS generates a matrix of random numbers through Zernike polynomials of different coefficients (randomly set to 0 to 1) of the first 30 orders (the first-order coefficient is set to 0), and then superimposes these matrices by addition or subtraction; the ZPS method is similar to the GFS method, except that the Gaussian function is replaced by Zernike polynomials, which guarantee continuity, and the random intensity of these polynomials introduces randomness;
[0065] By using the orthogonality of Zernike polynomials, the complex optical phase distribution can be expressed by weighted superposition of polynomials of different orders; the formula of ZPS is as follows:
[0066]
[0067] Among them, a nm is the coefficient of each Zernike mode, indicating the contribution of this mode to the overall phase distribution; Z nm (x, y) is an (n)th order and (m)th degree Zernike polynomial representing a specific distortion mode; by adjusting the value of each coefficient, the importance of different distortion modes in the overall phase distribution is adjusted. Specific implementation method three:
[0069] The method for constructing a phase model based on a U-Net network in this embodiment is different from the specific embodiment 2 in that the step of constructing a phase unwrapping model based on a U-net network in step 3 is specifically:
[0070] Convolutional Neural Networks (CNNs) represent the current workhorse of computer vision applications, and nearly all state-of-the-art architectures for different tasks in visual recognition are based on CNNs in recent times. The core of CNNs is convolution, which learns spatial kernels / filters for visual recognition. Most CNNs use relatively small kernel sizes, typically 3×3, because increasing the kernel size comes with a large cost in terms of the number of parameters and computational complexity. To cope with the fact that small kernel sizes cannot cover large areas of the input, CNNs use concatenated convolutions with small kernel sizes and downsampling layers to gradually reduce the size of the input and increase the receptive field of the network. However, two problems arise. First, although for many current CNNs the theoretical receptive field can cover a large portion or even the entire input, current research shows that the empirical receptive field is much smaller than the theoretical one, even more than 2.7 times smaller in the higher layers of the network. Second, downsampling the input without previously obtaining sufficient contextual information can affect the learning process and recognition performance of the network, because before downsampling is performed, useful pedestrian details are lost because the receptive field is not large enough to capture different dependencies in the scene. To be able to capture such a diverse range of categories and such varying scales, using a single type of kernel (such as standard convolution) with a single spatial size may not be the best solution to handle this complexity.
[0071] The residual block is composed of two components: the residual unit and the residual connection. First, let's look at the residual unit. In a convolutional neural network, each layer transforms the input, usually using operations such as convolution and activation functions. However, when the network is deep, the gradient may disappear or explode, resulting in training difficulties and performance degradation. Figure 3 , the input is transformed through the residual unit to obtain the intermediate output, and the residual connection is made with the original input, and then the final output is obtained after a series of transformations. The introduction of residual blocks can effectively alleviate the gradient vanishing and gradient exploding problems, making neural networks easier to train and optimize. It is widely used in various deep learning tasks, such as image classification, object detection, and speech recognition.
[0072] The Inception module is a feature extraction module for convolutional neural networks (CNNs) proposed by Google in 2014. It is designed to increase the width and depth of the network, thereby improving the network's expressiveness and performance. Traditional convolutional neural networks use fixed-size convolution kernels to extract features, which limits the network's receptive field size and feature extraction capabilities. The Inception module extracts multi-scale feature information by using convolution kernels of different sizes and pooling operations in parallel. The Inception module consists of multiple parallel convolutional layers and pooling operations, including 1x1 convolution, 3x3 convolution, 5x5 convolution, and maximum pooling. These operations extract features from the input at different scales and concatenate their outputs in the channel dimension.
[0073] By using the Inception module, the network can simultaneously obtain feature information of multiple scales and has a larger receptive field and stronger expression ability. This allows the network to better adapt to images of different sizes and complexities, improving the performance of tasks such as classification, detection, and segmentation.
[0074] Res-UNet based on U-Net, residual block and Inception module. The inception module is introduced into the residual block. Figure 4 As shown in , it consists of an encoding path (left), a decoding path (right), and a bridge path (middle). The encoding and decoding paths each contain four residual blocks. The residual block of the encoding path is followed by a maximum pooling for downsampling, and the residual block of the decoding path is preceded by a transposed convolution for upsampling. Figure 5 As shown in the figure, the Inception module is inserted into the residual block, which includes branch 0, branch 1, branch 2, branch 3 and branch 4.
[0075] Based on the original U-Net network, the residual block and Inception module are added to obtain the following Figure 4 The network structure in the figure is composed of an encoding path (left), a decoding path (right) and a bridging path (middle). The encoding path consists of convolutional layers and pooling layers, which are used to gradually reduce the size of the image and extract features. The residual block structure is added as Figure 5As shown in , the pooling layer selects the Max pooling 2×2 module, the input feature map is divided into non-overlapping 2×2 areas, and then the maximum value is selected in each area as the output value; this can reduce the spatial size of the feature map by half, and then output it to the next step; the decoding path uses the transpose convolution operation, whose convolution kernel size is a combination of 3×3 and residual block modules, and the feature map generated by upsampling is concatenated with the feature map on the left. The pooling layer will lose image information and reduce image resolution permanently, which has some impact on image segmentation tasks. Although it has little impact on image classification tasks, upsampling can make low-resolution images containing high-level abstract features become high-resolution while retaining high-level abstract features, and then concatenate with the high-resolution image of low-level surface features on the left, merging features from different sources or different levels together so that the model can better utilize information from different sources or levels, thereby improving the performance and generalization ability of the model;
[0076] Combine the idea of Inception with the residual block network structure, and we get Figure 5 In the network structure, N and N / 4 represent the number of channels. The four correct paths use 1, 2, 3, and 4 3×3 convolutions to more effectively extract features of different scales, and then are connected together through the concatenate operation and output to the activation function ReLU (Rectified Linear Unit).
[0077] Attention Gates:
[0078] AGs are commonly used for natural image analysis, knowledge graphs, and image captioning, machine translation, and classification tasks in language processing (NLP). Initial work explored attention maps by explaining the gradient of the output class score with respect to the input image. Trainable attention, on the other hand, is enforced by design and is divided into hard and soft attention. Hard attention, such as iterative region proposals and cropping, is usually non-differentiable and relies on reinforcement learning for parameter updates, which makes model training more difficult. Recursive hard attention was used in to detect abnormalities in chest x-ray scans. In contrast, soft attention is probabilistic and utilizes standard backpropagation without the need for Monte Carlo sampling. For example, additive soft attention has been used for sentence-to-sentence translation and has recently been applied to image classification. Channel-wise attention has been used to highlight important feature dimensions, which achieved the best performance in the ILSVRC 2017 image classification challenge. Self-attention techniques have been proposed to remove the reliance on external gating information. For example, non-local self-attention has been used to capture long-range dependencies. It has also been used to perform class-specific pooling using self-attention, resulting in more accurate and robust image classification performance.
[0079] By applying linear transformation and nonlinear activation function in sequence, the feature map x is obtained at the output of the lth layer of the attention gate module l , choose rectified linear units: Among them, i and c represent the spatial dimension and channel dimension respectively; the feature activation is expressed as: Where * represents the convolution operation; the function f(x l ; Φ l )=x (l+1) Applied to the convolutional layer l, represented by a trainable kernel parameter Φ l ; Input features (x l ) is scaled with the attention coefficient (α) calculated in AG; the spatial region is selected by analyzing the activation and context information provided by the gating signal (g), which is collected at a coarser scale; the grid resampling of the attention coefficients uses trilinear interpolation; Figure 6 As shown, a gating vector is used for each pixel i to determine the focus area; the gating vector contains contextual information to prune lower-level feature responses, using AGs for natural image classification; additive attention is used to obtain the gating coefficient; the recipe for adding attention is as follows:
[0080]
[0081] in, Corresponding to the sigmoid activation function. ψ T (·) represents the pouring function. AG consists of a set of parameters Θ attRepresentation, including: linear transformation Bias term b ψ ∈R, It is called vector-based concatenation attention, where the concatenated features x l and g are linearly mapped to an intermediate space of R dimensions;
[0082] AGs are incorporated into the standard U-Net architecture to highlight the salient properties of skip connection transfer. The information extracted from the coarse scale is used for gating to disambiguate irrelevant and noisy responses in the skip connection. This is performed before the connection operation and only relevant activations are merged. In addition, AGs filter neuron activations during the forward pass and the backward pass. During the backward pass, gradients originating from background regions are weighted downward, which allows model parameters in shallower layers to be updated based on spatial regions that are relevant to a given task. The l-1 layer convolution parameter update rule is stated as:
[0083]
[0084] The first gradient term on the right is Scaling; for multi-dimensional AGs, Corresponding to a vector at each grid scale; complementary information is extracted and fused in each sub-AG to define the output of the skip connection; to reduce the number of trainable parameters and computational complexity of AGs, the input feature map is downsampled to the resolution of the gating signal without any spatial support by performing a linear transformation (1×1×1 convolution), similar to a non-local block; the corresponding linear transformation decouples the feature map and maps it to a low-dimensional space for the gating operation; low-level feature maps, i.e., the first skip connection, are not used in the gating function because they do not represent the input data in the high-dimensional space. Deep supervision is used to enforce that the intermediate feature maps are semantically distinct at each image scale. This helps ensure that attention units at different scales have the ability to influence the response to a large range of image foreground content. Therefore, dense predictions are prevented from being reconstructed from a small subset of skip connections. Specific implementation method four:
[0086] The method for constructing a phase model based on a U-Net network in this embodiment is different from the specific embodiment 3 in that the steps of constructing the loss function and optimization method in the phase unwrapping described in step 4 are specifically:
[0087] In supervised machine learning, whether it is a regression problem or a classification problem, the loss function is indispensable. The loss function is used to measure the degree of inconsistency between the model's predicted value f(x) and the true value y. If the loss function is very small, it means that the machine learning model is very close to the true distribution of the data, and the model performance is good; if the loss function is very large, it means that the machine learning model is very different from the true distribution of the data, and the model performance is poor. The main task of training a model is to use optimization methods to find the model parameters that minimize the loss function.
[0088] No loss function is suitable for all types of data. The choice of loss function depends on many factors, including whether there are outliers, the choice of machine learning algorithm, the time efficiency of running gradient descent, whether it is easy to find the derivative of the function, and the confidence of the prediction result. The present invention adopts MAE (Mean Absolute Error), which is a loss function used to measure the average absolute error between the predicted value and the true value. In regression problems, MAE is often used as an indicator to evaluate model performance. The calculation formula of MAE loss function is as follows:
[0089]
[0090] Where n represents the number of samples, y i represents the true value, represents the predicted value, Σ represents the sum;
[0091] The characteristic of the MAE loss function is that it is insensitive to errors. It only focuses on the absolute value of the difference between the predicted value and the true value, regardless of the direction. In some practical applications, more attention is paid to the degree to which the predicted value deviates from the true value, rather than just whether the predicted value is equal to the true value. Therefore, the MAE loss function can provide a more comprehensive model performance evaluation.
[0092] When training a neural network, optimization algorithms such as gradient descent are used to minimize the MAE loss function so that the model's predicted value is closer to the true value. By adjusting the model parameters, the smaller the value of the loss function is, the better the model's fitting effect is. In summary, the MAE loss function is a loss function used for regression problems. It is used to measure the mean absolute error between the predicted value and the true value. It is insensitive to errors and can provide a more comprehensive model performance evaluation.
[0093] This implementation method analyzes and studies the evaluation indicators, data sets, loss functions, attention gate modules, etc., combines existing methods for innovation, and constructs a phase unwrapping network based on U-Net to ensure the accuracy, timeliness and significance of the network model.
[0094] The embodiments of the present invention disclose preferred embodiments, but are not limited thereto. A person skilled in the art can easily understand the spirit of the present invention based on the above embodiments and make different extensions and changes. However, as long as they do not deviate from the spirit of the present invention, they are all within the protection scope of the present invention.
Claims
1. A method for constructing a phase model based on a U-Net network, characterized in that: The method is implemented by the following steps: Step 1: Generate a data set. The method for generating the data set is to use one of the following methods: random matrix enlargement (RME), Gaussian function superposition (GFS), or Zernike polynomial superposition (ZPS). Step 2: Preprocess the generated data and determine the size and parameters of the data set; Step 3: Construct a phase unwrapping model based on the U-net network; Step 4: Construct the loss function and optimization method in phase unwrapping; when training the model, set the learning rate for training so that the model converges faster and the model effect is better; at the same time, introduce the weight decay strategy, which is equivalent to L2 norm regularization. Regularization reduces the learned model parameter value by adding a penalty term to the model loss function.
2. The method for constructing a phase model based on a U-Net network according to claim 1, characterized in that: In the process of generating a data set described in step 1, the random matrix enlargement RME includes: generating an initial square matrix, whose size is 2×2 to 25×25, whose value range is 2 to 100, and whose distribution type is a random distribution of a uniform distribution random matrix or a Gaussian distribution random matrix; then, converting the matrix into a larger matrix (256×256) by different interpolation methods, and the interpolation method is nearest neighbor interpolation, bilinear interpolation or bicubic interpolation; The Gaussian function superposition method GFS includes: randomly generating a number of Gaussian functions 1 to 20 with different means, variances and amplitudes, and then superimposing them by addition or subtraction; in GFS, the Gaussian function is used to ensure continuity, and randomness is introduced by changing the Gaussian parameters and superimposing random functions; the GFS formula is as follows: Where f(x) is the absolute phase function of the output, x is the independent variable, n is the number of Gaussian functions, and w i is the weight of the i-th Gaussian function, μ i is the mean of the ith Gaussian function, σ i is the variance of the i-th Gaussian function; Zernike polynomial superposition ZPS generates matrices of random numbers through Zernike polynomials of different coefficients of the first 30 orders, and then superimposes these matrices by addition or subtraction; the continuity is guaranteed by the Zernike polynomials, and the random strength of the polynomials introduces randomness; By using the orthogonality of Zernike polynomials, the complex optical phase distribution can be expressed by weighted superposition of polynomials of different orders; the formula of ZPS is as follows: Among them, a nm is the coefficient of each Zernike mode, indicating the contribution of this mode to the overall phase distribution; Z nm (x, y) is an (n)th order and (m)th degree Zernike polynomial representing a specific distortion mode; by adjusting the value of each coefficient, the importance of different distortion modes in the overall phase distribution is adjusted.
3. The method for constructing a phase model based on a U-Net network according to claim 2, characterized in that: The steps of constructing the phase unwrapping model based on the U-net network described in step 3 are specifically: Based on the original U-Net network, residual blocks and Inception modules are added to obtain the network structure. The network consists of an encoding path, a decoding path, and a bridge path. The encoding path consists of convolutional layers and pooling layers, which are used to gradually reduce the size of the image and extract features. A residual block structure is added to it. The pooling layer selects the Max pooling 2×2 module. The input feature map is divided into non-overlapping 2×2 areas, and then the maximum value in each area is selected as the output value. The spatial size of the feature map is reduced by half and then output to the next step; the decoding path uses a transposed convolution operation with a convolution kernel size of 3×3 and a residual block module. The feature map generated by upsampling is concatenated with the feature map on the left, and then concatenated with the high-resolution image of the low-level surface features on the left. Features from different sources or different levels are merged together to enable the model to better utilize information from different sources or levels, thereby improving the performance and generalization ability of the model. Combine the idea of Inception with the residual block network structure to obtain a network structure in which the four correct paths use 1, 2, 3, and 4 3×3 convolutions to more effectively extract features of different scales, and then connect them together through the concatenate operation and output them to the activation function ReLU. By applying linear transformation and nonlinear activation function in sequence, the feature map x is obtained at the output of the lth layer of the attention gate module l , choose rectified linear units: Among them, i and c represent the spatial dimension and channel dimension respectively; the feature activation is expressed as: Where * represents the convolution operation; the function f(x l ; Φ l )=x (l+1) Applied to the convolutional layer l, represented by a trainable kernel parameter Φ l ; Input features (x l ) is scaled with the attention coefficient (α) computed in AG; the spatial region is selected by analyzing the activation and context information provided by the gating signal (g), which is collected at a coarser scale; the grid resampling of the attention coefficients uses trilinear interpolation; a gating vector is used for each pixel i to determine the focus area; the gating vector contains contextual information to prune lower-level feature responses, using AGs for natural image classification; additive attention is used to obtain the gating coefficient; the recipe for adding attention is as follows: in, Corresponding to the sigmoid activation function; ψ T (·) represents the casting function; AG consists of a set of parameters Θ att Representation, including: linear transformation Bias term b ψ ∈R, It is called vector-based concatenation attention, where the concatenated features x l and g are linearly mapped to an intermediate space of R dimensions; AGs are incorporated into the standard U-Net architecture. In addition, AGs filter neuron activations during the forward and backward passes. During the backward pass, the gradients originating from the background region are weighted downward. The l-1 layer convolution parameter update rule is expressed as: The first gradient term on the right is Scaling; for multi-dimensional AGs, Corresponding to a vector at each grid scale; extracting and fusing complementary information in each sub-AG to define the output of the jump connection; performing a linear transformation, the input feature map is downsampled to the resolution of the gating signal; the corresponding linear transformation decouples the feature map and maps it to a low-dimensional space for gating operations; low-level feature mapping, using deep supervision to force the intermediate feature map to have semantic distinctions at each image scale.
4. The method for constructing a phase model based on a U-Net network according to claim 3, characterized in that: The steps of constructing the loss function and optimization method in phase unwrapping described in step 4 are specifically: MAE is used to measure the mean absolute error between the predicted value and the true value. The calculation formula of the MAE loss function is as follows: Where n represents the number of samples, y i represents the true value, represents the predicted value, Σ represents the sum; When training a neural network, optimization algorithms such as gradient descent are used to minimize the MAE loss function so that the model's predicted value is closer to the true value; by adjusting the model parameters, the smaller the value of the loss function, the better the model's fitting effect.