Particle image velocity measurement method based on depth Transform model

Through the particle image speed measurement method based on the depth Transformer model, the multi-head self-attention mechanism and feature fusion technology are used to solve the problem of insufficient accuracy and efficiency in complex flow fields in traditional methods, achieving higher speed measurement accuracy and robustness.

CN119810476AActive Publication Date: 2025-04-11南宁桂电电子科技研究院有限公司 +1

Patent Information

Application Number
CN202411856340.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-04-11
Estimated Expiration
2044-12-17

AI Technical Summary

Technical Problem

Traditional particle image speed measurement technology is limited in accuracy and robustness in high gradient flow fields, complex flow fields or low signal-to-noise ratios, and has high computational complexity and low efficiency in processing large-scale data.

Method used

The particle image speed measurement method based on the depth Transformer model is adopted, and feature extraction is performed through the multi-head self-attention mechanism, combining feature fusion and displacement predictors to improve the speed measurement accuracy and efficiency.

Benefits of technology

It significantly improves the accuracy and robustness of velocity field measurement, reduces the computational complexity, improves the efficiency of processing large-scale data, and is suitable for complex flow field environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119810476A_ABST
    Figure CN119810476A_ABST
Patent Text Reader

Abstract

The invention discloses a particle image velocity measurement method based on a depth Transform model, and the method comprises the steps: firstly carrying out the preprocessing of a particle image, including data normalization and noise removal, so as to enhance the generalization capability of the model; thirdly, designing a novel feature fusion strategy, and combining a multi-head self-attention mechanism in a deep Transform model with a position sensing feedforward network to realize multi-scale and multi-dimensional feature extraction of the particle image; in addition, the invention further provides an optimization algorithm based on gradient accumulation so as to accelerate the convergence speed of the model and improve the training efficiency. Experiments carried out on a plurality of disclosed PIV data sets prove that the method provided by the invention is superior to the existing mainstream velocity measurement method in the aspects of velocity field measurement accuracy, convergence rate and model robustness, and shows that the method has a wide application prospect in the field of particle image velocity measurement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of particle image processing, and in particular to a particle image velocimetry method based on a deep Transformer model. Background Art

[0002] Traditional particle image velocimetry (PIV) mainly relies on correlation algorithms to calculate particle displacements. Although this method can provide relatively accurate results in many cases, its accuracy and robustness are limited in high-gradient flow fields, complex flow fields, or low signal-to-noise ratio conditions. In addition, traditional correlation algorithms have high computational complexity and are inefficient when processing large-scale data. These limitations have prompted researchers to look for more advanced methods to improve the accuracy and efficiency of PIV velocity field measurements.

[0003] With the development of deep learning technology, convolutional neural network (CNN) has become the mainstream method for particle image velocimetry due to its powerful feature extraction ability. CNN automatically learns features through a multi-layer structure, effectively improving the measurement accuracy of the velocity field. However, CNN mainly focuses on the extraction of local features, and has limited ability to capture global information and long-distance dependencies, and cannot well capture the motion trajectory of particles at different time points. This limitation is particularly evident in complex flow fields, limiting its application in high-precision PIV measurement.

[0004] The Transformer model was initially successful in the field of natural language processing (NLP). Its core mechanism is the self-attention mechanism. This mechanism can effectively capture long-range dependencies when processing sequence data, making the Transformer model more capable when processing time series data in complex flow fields. In addition, the Transformer model has good parallel processing capabilities and strong generalization capabilities, and can adapt to a variety of different flow field environments.

[0005] The PIV method based on the deep Transformer model has many advantages. First, the Transformer model can capture subtle changes in complex flow fields and improve the measurement accuracy of the velocity field. Second, compared with traditional methods, the Transformer model is more efficient in processing large amounts of image data, especially in a parallel computing environment. In addition, the Transformer model has strong generalization capabilities and can be applied to different flow field environments and adapt to a variety of test conditions. By combining the Transformer model and PIV technology, the measurement accuracy and efficiency of the fluid velocity field can be significantly improved, providing strong support for fluid mechanics research and industrial applications. Summary of the invention

[0006] The purpose of the present invention is to address the deficiencies in the prior art and propose a particle image velocimetry method based on a deep Transformer model. This method is superior to the existing mainstream velocimetry methods in terms of velocity field measurement accuracy, convergence speed and model robustness, showing its broad application prospects in the field of particle image velocimetry.

[0007] The technical solution for achieving the purpose of the present invention is:

[0008] A particle image velocimetry method based on a deep Transformer model comprises the following steps:

[0009] 1) Data preprocessing: First, the particle image data is normalized. The pixel values ​​at different time points are scaled to a uniform range or distribution through the minimum-maximum normalization or Z-score normalization method to eliminate the dimensional differences between different time points and ensure the consistency of the data in the subsequent processing steps. In addition, the particle image data is subjected to noise analysis and a filter is used to reduce image noise to improve the quality of feature extraction. Then, the preprocessed particle image data is annotated and randomly divided into a training set, a validation set, and a test set.

[0010] 2) Feature extraction: After normalization and denoising, the multi-head self-attention mechanism in the deep Transformer model is used to extract features from the particle image data. This mechanism can capture dependencies of different scales and positions simultaneously by processing the attention of multiple heads in parallel, and extract global and local features that reflect the motion characteristics of particles;

[0011] 3) Feature fusion: After feature extraction, global features and local features are integrated through a fusion layer. The fusion layer includes 1x1 convolution operations or depth-wise separable convolutions to adjust the dimensions of feature channels and enhance the expressiveness of features through weighted averaging or feature weighted sum.

[0012] 4) Displacement prediction: Design a displacement predictor to make the final displacement prediction based on the fused features. The displacement predictor maps the features to the predetermined velocity field to complete the particle image velocity measurement task, and then performs post-processing;

[0013] 5) Model optimization: Use labeled particle image data to train the model. During the training process, use the back-propagation algorithm combined with gradient descent or its variants to optimize the model parameters. By defining the loss function, monitor the performance of the model on the training set, and use early stopping and regularization strategies to prevent overfitting to ensure that the model has good generalization ability.

[0014] The data preprocessing step in step 1) also includes removing noise from the particle image data to further improve the accuracy of feature extraction: first, the particle image data is subjected to noise identification, and the noise type is distinguished by visual inspection or automatic algorithm. Subsequently, noise analysis is performed, and the spatial distribution and spectral characteristics of the noise are deeply understood by using fast Fourier transform (FFT) or wavelet transform tools. Based on these noise analyses, the most suitable denoising algorithm is selected, and the filter parameters are adjusted to achieve the best denoising effect. Then, the adjusted filter is applied to the particle image data for actual denoising to reduce noise interference while retaining key information and details. Finally, the effect of the denoising is verified by visual inspection of quantitative indicators to ensure that the noise is effectively removed and the key features of the image data are not damaged.

[0015] The deep Transformer model in step 2) includes multiple continuous Transformer layers, each of which is composed of a multi-head self-attention mechanism and a feedforward network for gradually extracting and refining features. The multi-head self-attention mechanism and the feedforward network are regarded as feature layers. Each Transformer layer contains two main components:

[0016] 2.1 Each Transformer layer is equipped with a multi-head self-attention module, which can process multiple "heads" in parallel. Each "head" independently calculates the attention weights of different parts. This design allows the model to capture the dependencies of input data from different angles and scales at the same time, thereby comprehensively extracting global and local features in particle images;

[0017] 2.2. Feedforward network: After the self-attention mechanism, each Transformer layer also contains one or more feedforward networks. The feedforward network is usually composed of several linear transformations and nonlinear activation functions. The feedforward network further processes and refines the output of the self-attention mechanism. The role of the feedforward network is to abstract and transform the features at a deeper level, enhancing the model's ability to express complex features.

[0018] In the deep Transformer model, successive Transformer layers work together in this structured way, with each layer further extracting and refining features based on the previous layer. As the number of layers increases, the model can capture more complex and abstract features, thus providing richer and more powerful information for the particle image velocimetry task.

[0019] In addition, the deep Transformer model also includes other auxiliary components, namely layer normalization and residual connections, to improve the training stability of the model and avoid the problem of gradient disappearance or explosion. Layer normalization stabilizes the training process by normalizing the input of each layer, while residual connections allow gradients to flow directly, making the training of deep networks possible.

[0020] Through the designed deep Transformer model, this technical solution method can effectively process particle image data, gradually extract features from shallow to deep layers, and finally achieve accurate velocity field measurement. The design of this model not only improves the accuracy of velocity measurement, but also enhances the model's generalization ability to new data, enabling it to perform well in various particle image velocity measurement tasks.

[0021] The core feature of the multi-head self-attention mechanism is that it can process multiple attention "heads" in parallel, each head independently calculates the attention weight, and merges these weight results to capture features of different scales. The following are the specific details of the mechanism:

[0022] 2.1.1 Number of attention heads: In the multi-head self-attention mechanism, the number of attention heads is a hyperparameter. This number can be adjusted according to the complexity of the model and the characteristics of the data. Increasing the number of heads enables the model to learn the characteristics of the data from multiple angles at the same time.

[0023] 2.1.2 Input feature segmentation: The input features are segmented into multiple parts, each of which corresponds to an attention head. This segmentation can be a simple average segmentation or a complex segmentation based on specific rules. The purpose is to allow each head to focus on different parts of the input data.

[0024] 2.1.3 Scaled dot product attention: Each head performs a scaled dot product attention operation, and obtains a preliminary attention score by calculating the dot product between the query, key, and value. In order to stabilize the training process, the dot product result will be scaled, and the scaling factor is the reciprocal root of the number of attention heads;

[0025] 2.1.4 Calculation of attention weights: The scaled dot product results are normalized by the softmax function to obtain the attention weights of each head. These weights reflect the importance of different input features relative to each head.

[0026] 2.1.5 Weighted summation: According to the calculated attention weights, the corresponding values ​​are weighted summed to obtain the weighted output;

[0027] 2.1.6 Merging results: The weighted output results of all heads are merged by concatenation or weighted summation. This merging process integrates the multi-scale features captured by different heads and provides a comprehensive feature representation for the subsequent feedforward network.

[0028] 2.1.7 Linear transformation: Apply linear transformation on the merged feature representation to increase the nonlinear expression capability of the model and provide input for the next layer or subsequent model components;

[0029] By extracting multi-scale and multi-angle features from particle image data, this technical solution can more accurately predict the velocity field of particles, improve the accuracy and robustness of velocity measurement, and is suitable for various complex flow field environments and application scenarios.

[0030] The feature fusion in step 3) further enhances the integration effect of features by adopting a weighted fusion strategy. The following are the specific details of the weighted fusion strategy:

[0031] 3.1 Extraction of feature representations: At multiple stages of the deep Transformer model, feature representations at different levels are extracted. These feature representations include global features obtained from the self-attention layer and local features obtained from the feedforward network.

[0032] 3.2 Initialization of feature weights: Initialize the weights for the feature representation of each layer. These weights can be set randomly or based on prior knowledge to facilitate model adjustment during training.

[0033] 3.3 Design of weighting mechanism: Design a weighting mechanism that dynamically adjusts the weight of each layer of features according to their importance. Weighting can be achieved through a learnable parameter vector, with each feature layer corresponding to a weight parameter.

[0034] 3.4 Construction of loss function: A loss function is constructed, which not only considers the accuracy of velocity field prediction, but also includes a regularization term to guide the optimization of feature weights to ensure that the model does not overly rely on a specific feature layer. The loss function is expressed as:

[0035]

[0036] in, is the mean square error loss, which is used to measure the difference between the predicted velocity field and the true velocity field; λ is the weight of the regularization term; is the regularization loss, which is L1 or L2 regularization;

[0037] 3.5 Back propagation and weight update: During model training, the gradient of the loss function with respect to the feature weight is calculated through the back propagation algorithm, and these gradients are used to update the weight parameters so that the model can automatically learn the optimal feature fusion ratio;

[0038] 3.6 Application of weight optimization algorithm: Select appropriate optimization algorithm to adjust feature weights and optimize fusion effects. The selection and parameter setting of optimization algorithm have an important impact on the training efficiency and final performance of the model.

[0039] 3.7 Implementation of fusion layer: Implement the fusion layer, which accepts feature representations and corresponding weights from different layers, and integrates the feature representations and corresponding weights of different layers into a unified feature vector by weighted summation;

[0040] 3.8 Evaluation of feature fusion effect: During the training process, the effect of feature fusion is continuously evaluated by monitoring the performance on the validation set to ensure that the fusion strategy can improve the accuracy and robustness of speed measurement;

[0041] The feature fusion step of the technical solution can automatically learn the importance of different features and adjust their weights accordingly, thereby achieving effective integration of features. This weighted fusion strategy not only improves the expressiveness of features, but also enhances the velocity field measurement performance of the model for particle image data. In the step 4), the displacement predictor uses one or more fully connected layers, which are responsible for mapping the comprehensive feature vector obtained by the feature fusion of step 3) to the final velocity field prediction result, that is, the fused features are first input into the fully connected layer, and each fully connected layer contains a large number of neuron nodes, which are linearly combined with the input features through weights and biases, and then nonlinearity is introduced through nonlinear activation functions, so that the displacement predictor can learn and simulate complex displacement patterns. In this way, the fully connected layer can further abstract and transform the features and extract the most critical information for the prediction task. In addition, the output of the fully connected layer can be directly connected to the linear layer or other types of output layers to determine the velocity field value of each particle or image block.

[0042] In step 5), the model is trained using an optimization algorithm with a momentum term or an adaptive learning rate adjustment strategy. These algorithms are designed to accelerate the convergence of the model and improve the training efficiency. The following are the specific details and formulas:

[0043] 5.1 Use of momentum term: The momentum term helps the model converge faster and avoid falling into local minima by adding the accumulation of the previous step gradient during the gradient descent process. The update formula of the momentum term is expressed as:

[0044]

[0045] θt =θ t-1 -v t

[0046] Among them, θ t is the model parameter at step t; η is the learning rate; β is the momentum hyperparameter; is the gradient of the loss function with respect to the model parameters; v t is the cumulative gradient;

[0047] 5.2 Adaptive learning rate adjustment strategy: The adaptive learning rate adjustment strategy improves training efficiency by dynamically adjusting the learning rate according to the historical gradient of the parameters. The adaptive learning rate optimization algorithms include Adam and RMSprop. The update formula of the Adam optimizer is expressed as:

[0048]

[0049] Among them, θ t is the model parameter at step t; η is the learning rate; β 1 and β 2 are the decay rates of the gradient and the square of the gradient respectively; ε is a 10 -8 to 10 -6 A constant between , used to prevent division by zero errors; and are the moving averages of the bias-corrected gradient and the squared gradient, respectively;

[0050] By adopting these optimization algorithms, parameter updates during model training will be more effective and can converge to the minimum loss value faster, thereby improving training efficiency. The momentum term helps the model overcome local minima, and the adaptive learning rate adjustment strategy ensures that each parameter is updated with an appropriate step size to avoid problems caused by excessive or small learning rates. The combined application of these optimization techniques makes the particle image velocimetry method based on the deep Transformer model more efficient and stable during training. In the step 4), non-maximum suppression technology, i.e., NMS, is introduced when performing post-processing to further improve the accuracy and robustness of the velocimetry results. After the model completes the preliminary prediction, non-maximum suppression is used as a post-processing method to optimize the velocimetry results through the following steps:

[0051] 4.1. Determine the local maximum: For each pixel in the velocity measurement result, non-maximum suppression checks whether the value of each pixel in the local neighborhood is the maximum. If the velocity field confidence of a pixel is not the highest in its neighborhood, the pixel will be suppressed or ignored;

[0052] 4.2. Set threshold: Determine a confidence threshold. Only speed measurement results above this threshold will be considered for the next non-maximum value check.

[0053] 4.3. Perform NMS: Traverse the speed measurement results, and for each category, perform non-maximum suppression. If the confidence of a pixel is not the highest value of the same category in the 3x3 or larger neighborhood of the pixel, reduce the confidence of the pixel or mark the pixel as background;

[0054] 4.4. Refine the boundary: Through NMS processing, remove those pixels with low confidence, so that the boundary of the velocity field is clearer and more accurate;

[0055] 4.5. Iterative optimization: NMS is executed iteratively, and each iteration can further improve the quality of the speed measurement results;

[0056] 4.6. Multi-category processing: For multi-category speed measurement problems, NMS can be applied to each category independently, or adjusted according to the relationship between different categories;

[0057] Through this post-processing step, the technical solution method not only improves the visual effect of the image, but also enhances the accuracy and robustness of the speed measurement results. Especially when processing particle images with complex boundaries and overlapping areas, NMS can effectively remove erroneous predictions and retain correct information, thereby providing more reliable speed measurement results in practical applications.

[0058] A computer-readable storage medium, on which a computer program is stored, the computer program is used to execute the steps of the particle image velocimetry method based on the deep Transformer model, the storage medium is a hard disk drive, a solid-state drive, an optical disk, a USB flash drive, an SD card or other non-volatile storage device, the program is written in a high-level programming language, relies on TensorFlow, PyTorch, Keras or Scikit-learn deep learning framework, and is designed to run across platforms, compatible with Windows, Linux and macOS operating systems. In addition, the program provides a user-friendly interface that allows users to input data, configure parameters, perform speed measurement and display results, and contains detailed documentation, sample code and error handling mechanisms. The program is also optimized for GPU or TPU hardware accelerators to improve execution efficiency. Through these features, the storage medium enables the particle image velocimetry method based on the deep Transformer model to be implemented on a variety of general-purpose computing devices, providing users with an easy-to-use and efficient particle image processing tool.

[0059] An electronic device is provided, which is equipped with a processor and a memory, and the memory stores a computer program that can be run on the processor, and when the computer program is executed by the processor, the steps of the particle image velocimetry method based on the deep Transformer model are implemented. The electronic device is a smart phone, a tablet computer, a laptop computer or a dedicated computing device.

[0060] This technical solution method can not only automatically extract complex features in PIV image data, but also effectively make velocity measurement decisions on the velocity field, significantly improving the accuracy and efficiency of calculations.

[0061] This technical solution provides an innovative solution to the technical difficulties in the field of particle image measurement. First, it effectively captures the particle motion trajectory at different time points through the self-attention mechanism of the deep Transformer model, solving the limitations of the traditional CNN method in processing time series data. Secondly, in response to the high-dimensional problem of high-resolution PIV images, this technical solution adopts efficient data preprocessing technology and feature fusion strategy, which reduces the data dimension while retaining key information, and enhances the model's processing ability for high-dimensional data. In addition, this technical solution also designs an innovative feature fusion strategy to effectively integrate temporal features and spatial features, thereby improving the expressiveness and robustness of features. In terms of model training and optimization, the efficiency and stability of model training are improved through the carefully designed network architecture and loss function combined with advanced optimization algorithms. At the same time, in order to improve the generalization ability of the model, this technical solution adopts technologies such as cross-validation and multi-task learning to ensure the adaptability of the model to new data. Finally, through post-processing technology and post-displacement optimization strategy, the accuracy and robustness of velocity field measurement are further improved, meeting the needs of automation and real-time processing, and providing an efficient and accurate velocity field measurement method for PIV technology.

[0062] The innovation of this technical solution lies in two core protection points: first, it adopts a deep Transformer model, which uses the self-attention mechanism to effectively capture the global context and long-distance dependencies in PIV images, which is difficult to achieve for traditional convolutional neural networks, thereby significantly improving the accuracy of velocity field measurement; second, this technical solution designs a unique feature fusion strategy, which can effectively integrate temporal features and spatial features, enhancing the model's ability to express complex PIV data, which is crucial to improving the accuracy and robustness of velocity field measurement. Through the combination of these two key technologies, this technical solution not only optimizes the PIV velocity field measurement process, but also greatly improves the processing efficiency and reliability of the results, bringing breakthrough progress to fluid dynamics research and industrial applications.

[0063] This technical solution has significant beneficial effects: first, through the self-attention mechanism of the deep Transformer model, it can fully capture the global information and long-distance dependencies in the PIV image, which greatly improves the accuracy and generalization ability of the velocity field measurement; second, the innovative feature fusion strategy effectively integrates the temporal and spatial features, enhances the model's ability to recognize image details and structures, and thus improves the precision and robustness of the velocity field measurement results; in addition, the optimized model training and post-processing process further improves the accuracy of the velocity field measurement, while ensuring the rapid convergence and real-time processing capabilities of the model, so that this technical solution can provide an efficient and reliable velocity field measurement solution in practical applications. These beneficial effects work together to make this technical solution have important application value and broad market prospects in the fields of fluid dynamics research and industrial applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] Figure 1 is a flow chart of an embodiment;

[0065] Figure 2 This is a schematic diagram of the motion trajectory of particles captured and distinguished at different time points by the method in Example 2. DETAILED DESCRIPTION

[0066] The content of the present invention is further described below in conjunction with the drawings and embodiments, but the present invention is not limited thereto.

[0067] Embodiment 1:

[0068] Reference Figure 1 , a particle image velocimetry method based on a deep Transformer model, comprising the following steps:

[0069] S1. Experimental environment configuration

[0070] The experiment was conducted on a server equipped with an NVIDIA GeForce RTX 3080 GPU, an Intel Core i9 processor and 64GB RAM, running the Ubuntu 20.04 operating system. PyTorch 1.8 was used as the deep learning framework, and CUDA 11.3 and cuDNN 8.0.5 were installed to optimize GPU acceleration performance.

[0071] S2. Detailed steps of data preprocessing

[0072] The particle image velocimetry (PIV) dataset used in the experiment contains particle images at multiple time points, and the spatial resolution of each image is 2048x2048 pixels. Data preprocessing includes two main steps: normalization and noise removal: Normalization: The pixel values ​​of each image are scaled to the [0,1] interval through linear transformation to eliminate the dimensional differences between different images. Noise removal: A 3x3 Gaussian filter is used to remove image noise, where the standard deviation σ of the Gaussian kernel is set to 0.5 to reduce Gaussian noise in the image.

[0073] After preprocessing, the image dataset is randomly divided into training set (60%), validation set (20%) and test set (20%).

[0074] S3. Deep Transformer model architecture parameters

[0075] The deep Transformer model is composed of 6 stacked Transformer layers, each of which is configured with 8 self-attention heads. Each head processes a dimension of 64, and the feedforward network contains two linear layers, where the output dimension of the first linear layer is set to 256, and the ReLU activation function is used to introduce nonlinearity. The model also includes layer normalization and residual connections to improve the training efficiency of deep networks.

[0076] S4. Feature extraction and fusion strategy

[0077] The input PIV image data is first subjected to feature extraction through a deep Transformer model. After each Transformer layer, the dimension of the feature map is adjusted by bilinear interpolation to maintain the temporal and spatial consistency of the feature map. The feature fusion strategy adopts weighted fusion, in which the weights are initialized to equal values ​​and automatically adjusted by the back-propagation algorithm during the training process to optimize the integration effect of the features.

[0078] S5. Displacement predictor design and parameters

[0079] The displacement predictor consists of two fully connected layers. The number of nodes in the first fully connected layer is 2048, and the number of nodes in the second fully connected layer matches the output dimension of the prediction task. Assuming that the task involves displacement prediction in two directions, the number of nodes in the second layer is 2. The ReLU activation function is used between the two layers.

[0080] S6. Model training and optimization algorithm

[0081] The model training uses the cross entropy loss function, and the optimization algorithm is Adam, with parameters β1 = 0.9, β2 = 0.999, and ε = 10^-8. The initial learning rate is set to 0.001, and the learning rate decays by 0.1 times every 5 epochs during training. The early stopping method is used to control overfitting. If the loss on the validation set does not decrease for 10 consecutive epochs, the training is stopped.

[0082] S7, post-processing technology application

[0083] The predicted displacement results are post-processed by non-maximum suppression (NMS) to improve the accuracy and robustness of velocity field measurements. The confidence threshold of NMS is set to 0.3 and the neighborhood size is 3x3 pixels to remove pixels with low confidence in displacement prediction and retain the motion trajectory of the main particles.

[0084] S8. Experimental Results and Analysis

[0085] 200 labeled samples randomly selected from the DNS_turbulence dataset are used as training samples, and the remaining samples are used as test samples. Table 1 shows the overall velocity measurement accuracy of different particle image velocimetry methods, where HS represents the velocity measurement results obtained using the traditional Horn-Schunck algorithm, 1D-CNN represents the velocity measurement results obtained using a one-dimensional convolutional neural network, 2D-CNN represents the velocity measurement results obtained using a two-dimensional convolutional neural network, and 3D-CNN represents the velocity measurement results obtained using a three-dimensional convolutional neural network. From the results in the table, it can be seen that compared with the traditional models and deep learning models commonly used for particle image velocimetry, this example can obtain higher velocity measurement accuracy.

[0086] Table 1

[0087] Evaluation indicators / methods HS 1D-CNN 2D-CNN 3D-CNN Methods in this example Overall speed measurement accuracy 88.59 85.17 91.58 93.06 96.26

[0088] S9. Conclusion

[0089] The experimental results fully demonstrate the effectiveness of the particle image velocimetry method based on the deep Transformer model proposed in this example in improving the measurement accuracy and robustness of the velocity field. The global feature capture capability and adaptive feature fusion strategy of the model significantly improve the measurement performance. In addition, the experiment also demonstrated the application potential and wide applicability of the DC method in actual PIV tasks, providing a reliable solution for fluid dynamics research and industrial applications.

[0090] Embodiment 2:

[0091] Another specific implementation of this example further illustrates the application of the particle image velocimetry method based on the deep Transformer model, including detailed experimental design, parameter setting, execution steps, and result analysis.

[0092] S1. Experimental Platform and Dataset

[0093] The experiment was conducted on a cloud server equipped with four NVIDIA A100 GPUs, each with 80GB of video memory, two AMD EPYC 7742 processors and 512GB of RAM. The operating system was CentOS 7.9, and the deep learning framework was TensorFlow 2.5.

[0094] S2. PIV dataset preparation

[0095] The particle image velocimetry (PIV) dataset used in the experiment contains five different flow field scenes, and the particle image of each scene has 256 time points with a spatial resolution of 256x256 pixels. The dataset has been preprocessed, including noise removal and time alignment of the particle image, to improve the accuracy of subsequent velocity field measurements.

[0096] S3, Customized Design of Deep Transformer Model

[0097] The model consists of 8 Transformer layers, each using 4 attention heads. The input dimension of the model is (512, 512, 10), that is, the velocity field feature of each pixel is composed of particle images at 10 time points. The hidden layer dimension of the feedforward network is set to 512. Each layer in the model is followed by a residual connection after the normalization operation.

[0098] S4. Optimization strategy for feature extraction and fusion

[0099] The model input is extracted through the deep Transformer layer, and the output feature map of each layer is mixed through 1x1 convolution to achieve optimal fusion of features. After feature fusion, it is converted into a one-dimensional feature vector through the global average pooling layer.

[0100] S5. Construction and training of speed tester

[0101] The speedometer consists of a fully connected layer with 1024 nodes and an output layer, the number of nodes in the output layer corresponds to the number of speed segments in the dataset. The speedometer training uses the Softmax activation function and the categorical cross entropy loss function. The optimizer uses SGD, the learning rate is initially set to 0.01, and the momentum parameter is 0.9.

[0102] S6. Detailed process of model training

[0103] The model training was performed for 100 epochs, and the model performance was evaluated on the validation set at the end of each epoch. Data augmentation techniques, including random rotation and flipping, were used to enhance the generalization ability of the model. The learning rate was adjusted dynamically during the training process. If the validation loss did not decrease for three consecutive epochs, the learning rate was reduced by half.

[0104] S7, post-processing and result optimization

[0105] The displacement prediction results are post-processed by morphological operations, including erosion and dilation, to remove small noise points and repair the boundaries of particle motion trajectories. In addition, the conditional random field (CRF) is applied to optimize the displacement prediction results to consider the spatial relationship between pixels.

[0106] S8. Evaluation and analysis of experimental results

[0107] The velocity field measurement accuracy of the model on the test set reached 92%, and the average endpoint error (AEE) was 18.29. Table 2 shows the average endpoint error comparison of different models in the particle image velocimetry method, showing that the model has excellent measurement performance for PIV data. Figure 2 As shown in the visual analysis, the model can accurately capture and distinguish the motion trajectories of particles at different time points.

[0108] Table 2

[0109] Evaluation indicators / methods HS 1D-CNN 2D-CNN 3D-CNN Methods in this example AEE 25.92 29.83 24.60 20.57 18.29

[0110] S9. Experimental Conclusion

[0111] This implementation demonstrates the efficiency and superiority of the deep Transformer model in the task of particle image velocimetry. Through a carefully designed model architecture, optimized feature extraction and fusion strategies, and meticulous post-processing steps, the method in this example performs well in velocity field measurement accuracy, robustness, and practicality, demonstrating its potential for application in fluid dynamics research and industrial applications.

Claims

1. A particle image velocimetry method based on a deep Transformer model, characterized in that: The following steps are involved: 1) Data preprocessing: First, the particle image data is normalized. The pixel values ​​at different time points are scaled to a uniform range or distribution through the minimum-maximum normalization or Z-score normalization method to eliminate the dimensional differences between different time points and ensure the consistency of the data in the subsequent processing steps. In addition, the particle image data is subjected to noise analysis and a filter is used to reduce image noise to improve the quality of feature extraction. Then, the preprocessed particle image data is annotated and randomly divided into a training set, a validation set, and a test set. 2) Feature extraction: After normalization and denoising, the multi-head self-attention mechanism in the deep Transformer model is used to extract features from the particle image data. This mechanism can capture dependencies of different scales and positions simultaneously by processing the attention of multiple heads in parallel, and extract global and local features that reflect the motion characteristics of particles; 3) Feature fusion: After feature extraction, global features and local features are integrated through a fusion layer. The fusion layer includes 1x1 convolution operations or depth-wise separable convolutions to adjust the dimensions of feature channels and enhance the expressiveness of features through weighted averaging or feature weighted sum. 4) Displacement prediction: Design a displacement predictor to make the final displacement prediction based on the fused features. The displacement predictor maps the features to the predetermined velocity field to complete the particle image velocity measurement task, and then performs post-processing; 5) Model optimization: Use labeled particle image data to train the model. During the training process, use the back-propagation algorithm combined with gradient descent or its variants to optimize the model parameters. By defining the loss function, monitor the performance of the model on the training set, and use early stopping and regularization strategies to prevent overfitting to ensure that the model has good generalization ability.

2. The particle image velocimetry method based on the deep Transformer model according to claim 1 is characterized in that: The data preprocessing step in step 1) also includes removing noise from the particle image data to further improve the accuracy of feature extraction: first, the particle image data is subjected to noise identification, and the noise type is distinguished by visual inspection or automatic algorithm. Subsequently, noise analysis is performed, and the spatial distribution and spectral characteristics of the noise are deeply understood by using fast Fourier transform or wavelet transform tools. Based on these noise analyses, the most suitable denoising algorithm is selected, and the filter parameters are adjusted to achieve the best denoising effect. Then, the adjusted filter is applied to perform actual denoising on the particle image data to reduce noise interference while retaining key information and details. Finally, the effect of the denoising is verified by visual inspection of quantitative indicators to ensure that the noise is effectively removed and the key features of the image data are not damaged.

3. The particle image velocimetry method based on the deep Transformer model according to claim 1 is characterized in that: The deep Transformer model in step 2) includes multiple continuous Transformer layers, each of which is composed of a multi-head self-attention mechanism and a feedforward network for gradually extracting and refining features. The multi-head self-attention mechanism and the feedforward network are regarded as feature layers. Each Transformer layer contains two main components: 2.1 Each Transformer layer is equipped with a multi-head self-attention module, which can process multiple "heads" in parallel. Each "head" independently calculates the attention weights of different parts. This design allows the model to capture the dependencies of input data from different angles and scales at the same time, thereby comprehensively extracting global and local features in particle images; 2.

2. Feedforward network: After the self-attention mechanism, each Transformer layer also contains one or more feedforward networks. The feedforward network consists of several linear transformations and nonlinear activation functions. The feedforward network further processes and refines the output of the self-attention mechanism. The role of the feedforward network is to abstract and transform the features at a deeper level, enhancing the model's ability to express complex features. In the deep Transformer model, successive Transformer layers work together in this structured way, with each layer further extracting and refining features based on the previous layer. As the number of layers increases, the model can capture more complex and abstract features, thus providing richer and more powerful information for the particle image velocimetry task. In addition, the deep Transformer model also includes other auxiliary components, namely layer normalization and residual connections, to improve the training stability of the model and avoid the problem of gradient disappearance or explosion. Layer normalization stabilizes the training process by normalizing the input of each layer, while residual connections allow gradients to flow directly, making the training of deep networks possible.

4. The particle image velocimetry method based on the deep Transformer model according to claim 3 is characterized in that: The core feature of the multi-head self-attention mechanism is that it can process multiple attention "heads" in parallel, each head independently calculates the attention weight, and merges these weight results to capture features of different scales. The following are the specific details of the mechanism: 2.1.1 Number of attention heads: In the multi-head self-attention mechanism, the number of attention heads is a hyperparameter. This number can be adjusted according to the complexity of the model and the characteristics of the data. Increasing the number of heads enables the model to learn the characteristics of the data from multiple angles at the same time. 2.1.2 Input feature segmentation: The input features are segmented into multiple parts, each of which corresponds to an attention head. This segmentation can be a simple average segmentation or a complex segmentation based on specific rules. The purpose is to allow each head to focus on different parts of the input data. 2.1.3 Scaled dot product attention: Each head performs a scaled dot product attention operation, and obtains a preliminary attention score by calculating the dot product between the query, key, and value. In order to stabilize the training process, the dot product result will be scaled, and the scaling factor is the reciprocal root of the number of attention heads; 2.1.4 Calculation of attention weights: The scaled dot product results are normalized by the softmax function to obtain the attention weights of each head. These weights reflect the importance of different input features relative to each head. 2.1.5 Weighted summation: According to the calculated attention weights, the corresponding values ​​are weighted summed to obtain the weighted output; 2.1.6 Merging results: The weighted output results of all heads are merged by concatenation or weighted summation. This merging process integrates the multi-scale features captured by different heads and provides a comprehensive feature representation for the subsequent feedforward network. 2.1.7 Linear Transformation: Linear transformation is applied on the merged feature representation to increase the nonlinear expression capability of the model and provide input for the next layer or subsequent model components.

5. The particle image velocimetry method based on the deep Transformer model according to claim 1, characterized in that: The feature fusion in step 3) further enhances the integration effect of features by adopting a weighted fusion strategy. The following are the specific details of the weighted fusion strategy: 3.1 Extraction of feature representations: At multiple stages of the deep Transformer model, feature representations at different levels are extracted. These feature representations include global features obtained from the self-attention layer and local features obtained from the feedforward network. 3.2 Initialization of feature weights: Initialize the weights for the feature representation of each layer. These weights can be set randomly or based on prior knowledge to facilitate model adjustment during training. 3.3 Design of weighting mechanism: Design a weighting mechanism that dynamically adjusts the weight of each layer of features according to their importance. Weighting can be achieved through a learnable parameter vector, with each feature layer corresponding to a weight parameter. 3.4 Construction of loss function: A loss function is constructed, which not only considers the accuracy of velocity field prediction, but also includes a regularization term to guide the optimization of feature weights to ensure that the model does not overly rely on a specific feature layer. The loss function is expressed as: in, is the mean square error loss, which is used to measure the difference between the predicted velocity field and the true velocity field; λ is the weight of the regularization term; is the regularization loss, which is L1 or L2 regularization; 3.5 Back propagation and weight update: During model training, the gradient of the loss function with respect to the feature weight is calculated through the back propagation algorithm, and these gradients are used to update the weight parameters so that the model can automatically learn the optimal feature fusion ratio; 3.6 Application of weight optimization algorithm: Select appropriate optimization algorithm to adjust feature weights and optimize fusion effects. The selection and parameter setting of optimization algorithm have an important impact on the training efficiency and final performance of the model. 3.7 Implementation of fusion layer: Implement the fusion layer, which accepts feature representations and corresponding weights from different layers, and integrates the feature representations and corresponding weights of different layers into a unified feature vector by weighted summation; 3.8 Evaluation of feature fusion effect: During the training process, the effect of feature fusion is continuously evaluated by monitoring the performance on the validation set to ensure that the fusion strategy can improve the accuracy and robustness of speed measurement.

6. The particle image velocimetry method based on the deep Transformer model according to claim 1 is characterized in that: In the step 4), the displacement predictor uses one or more fully connected layers, which are responsible for mapping the comprehensive feature vector obtained by feature fusion in step 3) to the final velocity field prediction result, that is, the fused features are first input into the fully connected layer, and each fully connected layer contains a large number of neuron nodes, which are linearly combined with the input features through weights and biases, and then nonlinearity is introduced through a nonlinear activation function, so that the displacement predictor can learn and simulate complex displacement patterns. In this way, the fully connected layer can further abstract and transform the features and extract the most critical information for the prediction task. In addition, the output of the fully connected layer can be directly connected to the linear layer or other types of output layers to determine the velocity field value of each particle or image block.

7. The particle image velocimetry method based on the deep Transformer model according to claim 1 is characterized in that: In step 5), the model is trained using an optimization algorithm with a momentum term or an adaptive learning rate adjustment strategy. These algorithms are designed to accelerate the convergence of the model and improve the training efficiency. The following are the specific details and formulas: 5.1 Use of momentum term: The momentum term helps the model converge faster and avoid falling into local minima by adding the accumulation of the previous step gradient during the gradient descent process. The update formula of the momentum term is expressed as: i t =θ t-1 -v t Among them, θ t is the model parameter at step t; η is the learning rate; β is the momentum hyperparameter; is the gradient of the loss function with respect to the model parameters; v t is the cumulative gradient; 5.2 Adaptive learning rate adjustment strategy: The adaptive learning rate adjustment strategy improves training efficiency by dynamically adjusting the learning rate according to the historical gradient of the parameters. The adaptive learning rate optimization algorithms include Adam and RMSprop. The update formula of the Adam optimizer is expressed as: Among them, θ t is the model parameter of the tth step; η is the learning rate; β1 and β2 are the decay rates of the gradient and the square of the gradient, respectively; ε is a 10 -8 to 10 -6 A constant between , used to prevent division by zero errors; and are the moving averages of the bias-corrected gradient and the squared gradient, respectively.

8. The particle image velocimetry method based on the deep Transformer model according to claim 1 is characterized in that: In the step 4), non-maximum suppression technology (NMS) is introduced during post-processing to further improve the accuracy and robustness of the speed measurement results. After the model completes the initial prediction, non-maximum suppression is used as a post-processing method to optimize the speed measurement results through the following steps: 4.

1. Determine the local maximum: For each pixel in the velocity measurement result, non-maximum suppression checks whether the value of each pixel in the local neighborhood is the maximum. If the velocity field confidence of a pixel is not the highest in its neighborhood, the pixel will be suppressed or ignored; 4.

2. Set threshold: Determine a confidence threshold. Only speed measurement results above this threshold will be considered for the next non-maximum value check. 4.

3. Perform NMS: Traverse the speed measurement results, and for each category, perform non-maximum suppression. If the confidence of a pixel is not the highest value of the same category in the 3x3 or larger neighborhood of the pixel, reduce the confidence of the pixel or mark the pixel as background; 4.

4. Refine the boundary: Through NMS processing, remove those pixels with low confidence, so that the boundary of the velocity field is clearer and more accurate; 4.

5. Iterative optimization: NMS is executed iteratively, and each iteration can further improve the quality of the speed measurement results; 4.

6. Multi-category processing: For multi-category speed measurement problems, NMS can be applied to each category independently, or adjusted according to the relationship between different categories.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: The computer program is used to execute the steps of the particle image velocimetry method based on the deep Transformer model as described in any one of claims 1 to 8. The storage medium is a hard disk drive, a solid state drive, an optical disk, a USB flash drive, an SD card or other non-volatile storage device. The program is written in a high-level programming language, relies on the TensorFlow, PyTorch, Keras or Scikit-learn deep learning framework, and is designed to run across platforms and is compatible with Windows, Linux and macOS operating systems. In addition, the program provides a user-friendly interface that allows users to input data, configure parameters, perform speed tests and display results. It also includes detailed documentation, sample code and error handling mechanisms. The program is also optimized for GPU or TPU hardware accelerators.

10. An electronic device, the device being equipped with a processor and a memory, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the computer program is executed by a processor, the steps of the particle image velocimetry method based on a deep Transformer model described in any one of claims 1 to 8 are implemented, and the electronic device is a smart phone, a tablet computer, a laptop computer or a dedicated computing device.

Citation Information

Patent Citations

  • PIV speed measurement method and device based on Fourier feature enhancement and global matching

    CN117825743A

  • One-Shot Visual Language Reasoning Over Graphical Depictions of Data

    US20240386215A1

Cited By

  • Particle flow classification method based on quantum complete graph self-attention network

    CN120430429A

  • A particle flow classification method based on quantum complete graph self-attention network

    CN120430429B