A Particle Image Velocity Measurement Method Based on Deep Transformer Model
The particle image velocimetry method based on the deep Transformer model solves the accuracy and efficiency problems of traditional methods in complex flow fields, and realizes high-precision and robust velocity field measurement, which is suitable for fluid mechanics research and industrial applications.
Patent Information
- Application Number
- CN202411856340.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2044-12-17
AI Technical Summary
Traditional particle image velocimetry techniques lack accuracy and robustness in high-gradient flow fields, complex flow fields, or low signal-to-noise ratio conditions, and have high computational complexity, making them difficult to process large-scale data.
A particle image velocimetry method based on a deep Transformer model is adopted. Through data preprocessing, feature extraction, feature fusion and displacement prediction, combined with a multi-head self-attention mechanism and a feedforward network, a displacement predictor is designed. Optimization algorithms and post-processing techniques are used to improve the accuracy and efficiency of velocimetry.
It significantly improves the accuracy and robustness of velocity field measurements, is suitable for complex flow field environments, enhances the model's generalization ability and processing efficiency, and meets the needs of fluid mechanics research and industrial applications.
Smart Images

Figure CN119810476B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of particle image processing technology, and in particular to a particle image velocimetry method based on a deep Transformer model. Background Technology
[0002] Traditional particle image velocimetry (PIV) relies primarily on correlation algorithms to calculate particle displacement. While this method provides 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 scenarios. Furthermore, traditional correlation algorithms are computationally complex and inefficient when processing large-scale data. These limitations have prompted researchers to seek more advanced methods to improve the accuracy and efficiency of PIV velocity field measurements.
[0003] With the development of deep learning technology, Convolutional Neural Networks (CNNs) have become the mainstream method for particle image velocimetry due to their powerful feature extraction capabilities. CNNs automatically learn features through multi-layer structures, effectively improving the measurement accuracy of velocity fields. However, CNNs mainly focus on extracting local features and have limited ability to capture global information and long-range dependencies, making it difficult to accurately capture the trajectory of particles at different time points. This limitation is particularly evident in complex flow fields, restricting its application in high-precision PIV measurements.
[0004] The Transformer model initially achieved success in the field of Natural Language Processing (NLP), with its core mechanism being self-attention. This mechanism effectively captures long-range dependencies when processing sequential data, enabling the Transformer model to demonstrate stronger capabilities when handling time-series data in complex flow fields. Furthermore, the Transformer model possesses good parallel processing capabilities and strong generalization ability, allowing it to adapt to various different flow field environments.
[0005] The PIV method based on the deep Transformer model offers several advantages. First, the Transformer model can capture subtle changes in complex flow fields, improving the measurement accuracy of the velocity field. Second, compared to traditional methods, the Transformer model is more efficient in processing large amounts of image data, especially in parallel computing environments. Furthermore, the Transformer model has strong generalization capabilities, applicable to different flow field environments and adaptable to various testing conditions. By combining the Transformer model and PIV technology, the measurement accuracy and efficiency of fluid velocity fields can be significantly improved, providing strong support for fluid mechanics research and industrial applications. Summary of the Invention
[0006] The purpose of this invention is to address the shortcomings of existing technologies by proposing a particle image velocimetry method based on a deep Transformer model. This method outperforms existing mainstream velocimetry methods in terms of velocity field measurement accuracy, convergence speed, and model robustness, demonstrating its broad application prospects in the field of particle image velocimetry.
[0007] The technical solution to achieve the objective of this invention is:
[0008] A particle image velocimetry method based on a deep Transformer model includes the following steps:
[0009] 1) Data Preprocessing: First, the particle image data is normalized by using min-max normalization or Z-score normalization to scale the pixel values at different time points to a uniform range or distribution, thereby eliminating dimensional differences between different time points and ensuring data consistency in subsequent processing steps. In addition, noise analysis is performed on the particle image data, and filters are used to reduce image noise to improve the quality of feature extraction. Then, the preprocessed particle image data is labeled, and the labeled particle image data is randomly divided into training set, validation set, and 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 the dependencies of different scales and positions at the same time by processing the attention of multiple heads in parallel, and extract global and local features that reflect the particle motion characteristics.
[0011] 3) Feature fusion: After feature extraction, a fusion layer is used to integrate global and local features. The fusion layer includes 1x1 convolution operations or depthwise separable convolutions to adjust the dimension of feature channels and enhance the expressive power of features through weighted averaging or feature weighted summation.
[0012] 4) Displacement prediction: Design a displacement predictor to perform final displacement prediction based on the fused features. The displacement predictor maps the features to a predetermined velocity field to complete the particle image velocimetry task, and then performs post-processing.
[0013] 5) Model optimization: The model is trained using labeled particle image data. During training, the backpropagation algorithm combined with gradient descent or its variants is used to optimize the model parameters. By defining a loss function, the performance of the model on the training set is monitored, and early stopping and regularization strategies are used to prevent overfitting and ensure that the model has good generalization ability.
[0014] The data preprocessing step in step 1) further includes noise removal of the particle image data to further improve the accuracy of feature extraction: First, noise identification is performed on the particle image data, and the noise type is distinguished through visual inspection or automatic algorithms. Then, noise analysis is performed, and the spatial distribution and spectral characteristics of the noise are understood in depth 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. Next, the adjusted filter is applied to the particle image data for actual denoising processing to reduce noise interference while retaining key information and details. Finally, the effect of denoising processing is verified through visual inspection of quantitative indicators to ensure that noise is effectively removed while the key features of the image data are not damaged.
[0015] In step 2), the deep Transformer model includes multiple consecutive Transformer layers. Each Transformer layer consists of a multi-head self-attention mechanism and a feedforward network, used to progressively extract and refine features. The multi-head self-attention mechanism and the feedforward network are considered 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 the input data from different angles and scales at the same time, thereby comprehensively extracting global and local features in the particle image.
[0017] 2.2. Feedforward Network: Following 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 non-linear activation functions. The feedforward network further processes and refines the output of the self-attention mechanism. The role of the feedforward network is to perform deeper abstraction and transformation of features, and enhance the model's ability to express complex features.
[0018] In the deep Transformer model, successive Transformer layers work together in this structured way. Each layer further extracts and refines 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 particle image velocimetry tasks.
[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 gradient vanishing or exploding problems. Layer normalization stabilizes the training process by normalizing the input of each layer, while residual connections allow gradients to flow directly, thus making the training of deep networks possible.
[0020] By employing a designed deep Transformer model, this technical approach effectively processes particle image data, progressively extracting features from shallow to deep layers, and ultimately achieving accurate velocity field measurement. This model design not only improves the accuracy of velocity measurement but also enhances its generalization ability to new data, enabling it to perform exceptionally well in various particle image velocimetry tasks.
[0021] The core feature of the multi-head self-attention mechanism is its ability to process multiple attention "heads" in parallel. Each head independently calculates attention weights, and these weight results are combined to capture features at different scales. The specific details of this mechanism are as follows:
[0022] 2.1.1 Number of attention heads: In multi-head self-attention mechanisms, 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 features of the data from multiple perspectives simultaneously.
[0023] 2.1.2 Input Feature Segmentation: The input features are segmented into multiple parts, each corresponding to an attention head. This segmentation can be a simple average segmentation or a complex segmentation based on specific rules. The goal is to allow each head to focus on different parts of the input data.
[0024] 2.1.3 Scaling Dot Product Attention: Each head performs a scaling dot product attention operation. By calculating the dot product between the query, key, and value, an initial attention score is obtained. To stabilize the training process, the dot product results are scaled. The scaling factor is the inverse root of the number of attention heads.
[0025] 2.1.4 Calculation of attention weights: The scaled dot product results are normalized using the softmax function to obtain the attention weights for each head. These weights reflect the importance of different input features relative to each head.
[0026] 2.1.5 Weighted Summation: Based on the calculated attention weights, the corresponding values are summed using weighted methods to obtain the weighted output;
[0027] 2.1.6 Result merging: The weighted output results of all heads are merged by splicing or weighted summation. This merging process integrates the multi-scale features captured by different heads, providing a comprehensive feature representation for the subsequent feedforward network.
[0028] 2.1.7 Linear Transformation: Applying linear transformations to the merged feature representations increases the non-linear expressive power of the model and provides 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 applicable to various complex flow field environments and application scenarios.
[0030] In step 3), the feature fusion further enhances the integration effect by adopting a weighted fusion strategy. The specific details of this weighted fusion strategy are as follows:
[0031] 3.1 Feature Representation Extraction: In 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 weights for the feature representation of each layer. These weights can be initialized randomly or set based on prior knowledge so that the model can be adjusted during training.
[0033] 3.3 Design of weighting mechanism: Design a weighting mechanism that dynamically adjusts the weights of each feature layer according to its importance. The weighting can be achieved through a learnable parameter vector, with each feature layer corresponding to a weight parameter.
[0034] 3.4 Construction of the Loss Function: A loss function is constructed that considers not only the accuracy of velocity field prediction but also includes a regularization term to guide the optimization of feature weights, ensuring that the model does not overly rely on any particular feature layer. The loss function is expressed as follows:
[0035]
[0036] in, λ is the mean squared error loss, used to measure the difference between the predicted velocity field and the actual velocity field; λ is the weight of the regularization term. It is the regularization loss, which is either L1 or L2 regularization;
[0037] 3.5 Backpropagation and Weight Update: During model training, the gradient of the loss function with respect to the feature weights is calculated through the backpropagation algorithm. These gradients are used to update the weight parameters, enabling the model to automatically learn the optimal feature fusion ratio.
[0038] 3.6 Application of weight optimization algorithms: Selecting appropriate optimization algorithms to adjust feature weights and optimize fusion effects. The selection of optimization algorithms and parameter settings have a significant impact on the training efficiency and final performance of the model.
[0039] 3.7 Implementation of the fusion layer: Implement the fusion layer, which accepts feature representations and corresponding weights from different layers, and integrates the feature representations and corresponding weights from different layers into a unified feature vector by weighted summation;
[0040] 3.8 Evaluation of Feature Fusion Effect: During training, 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 this technical solution can automatically learn the importance of different features and adjust their weights accordingly, achieving effective feature integration. This weighted fusion strategy not only improves the expressive power of features but also enhances the model's velocity field measurement performance for particle image data. In step 4), the displacement predictor uses one or more fully connected layers. These fully connected layers 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 layers. Each fully connected layer contains a large number of neuron nodes. These nodes are linearly combined with the input features through weights and biases, and then nonlinearity is introduced through a nonlinear activation function, enabling the displacement predictor to learn and simulate complex displacement patterns. In this way, the fully connected layers 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 layers can be directly connected to linear layers 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 optimization algorithms employing momentum term or adaptive learning rate adjustment strategies. These algorithms are designed to accelerate model convergence and improve training efficiency. The specific details and formulas are as follows:
[0043] 5.1 Use of the Momentum Term: The momentum term, by incorporating the accumulation of the previous gradient during gradient descent, helps the model converge faster and avoid getting trapped in local minima. The update formula for the momentum term is expressed as:
[0044]
[0045] θt =θ t-1 -v t
[0046] Where, θ t These are the model parameters at step t; η is the learning rate; β is the momentum hyperparameter. It is the gradient of the loss function with respect to the model parameters; v t It 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 based on the historical gradients of the parameters. Adaptive learning rate optimization algorithms include Adam and RMSprop. The update formula for the Adam optimizer is expressed as:
[0048]
[0049] Where, θ t These are the model parameters at step t; η is the learning rate; β1 and β2 are the decay rates of the gradient and the squared gradient, respectively; ε is a 10... -8 Up to 10 -6 A constant between these values is used to prevent division by zero errors; and These are the bias-corrected gradient and the moving average of the squared gradient, respectively.
[0050] By employing these optimization algorithms, parameter updates during model training become more efficient, converging to the minimum loss value faster and thus improving training efficiency. The momentum term helps the model overcome local minima, while the adaptive learning rate adjustment strategy ensures that each parameter is updated with an appropriate step size, avoiding problems caused by excessively large 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 step 4), non-maximum suppression (NMS) is introduced during post-processing to further improve the accuracy and robustness of the velocimetry results. After the model completes its initial prediction, NMS is used as a post-processing method to optimize the velocimetry results through the following steps:
[0051] 4.1. Determine local maxima: For each pixel in the velocity measurement result, non-maximum suppression checks whether the value of each pixel in its local neighborhood is the maximum. If the velocity field confidence of a pixel is not the highest in its neighborhood, then this pixel will be suppressed or ignored.
[0052] 4.2. Setting a threshold: Determine a confidence threshold. Only speed measurement results that are higher than this threshold will be considered for the next non-maximum check.
[0053] 4.3. Perform NMS: Traverse the velocity measurement results. 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 that pixel, then reduce the confidence of that pixel or mark the pixel as background.
[0054] 4.4. Refining the boundary: Through NMS processing, pixels with low confidence are removed, thereby making the boundary of the velocity field clearer and more accurate;
[0055] 4.5. Iterative Optimization: NMS is executed iteratively, and each iteration further improves the quality of the velocity measurement results;
[0056] 4.6. Multi-category processing: For multi-category speed measurement problems, NMS can be applied independently to each category, or adjusted according to the relationship between different categories;
[0057] Through this post-processing step, the proposed technical solution not only improves the visual effect of the image, but also enhances the accuracy and robustness of the velocity measurement results. In particular, when processing particle images with complex boundaries and overlapping regions, NMS can effectively remove erroneous predictions and retain correct information, thereby providing more reliable velocity measurement results in practical applications.
[0058] A computer-readable storage medium storing a computer program for performing the steps of the aforementioned particle image velocimetry method based on a deep Transformer model is disclosed. The storage medium may be a hard disk drive, solid-state drive, optical disk, USB flash drive, SD card, or other non-volatile storage device. The program is written in a high-level programming language, relies on deep learning frameworks such as TensorFlow, PyTorch, Keras, or Scikit-learn, and is designed for cross-platform operation, compatible with Windows, Linux, and macOS operating systems. Furthermore, the program provides a user-friendly interface, allowing users to input data, configure parameters, perform velocimetry, and display results. It also includes detailed documentation, sample code, and error handling mechanisms. The program is 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 a 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 run on the processor. When the computer program is executed by the processor, it implements the steps of the particle image velocimetry method based on the deep Transformer model described above. The electronic device is a smartphone, tablet computer, laptop computer, or a dedicated computing device.
[0060] This technical solution can not only automatically extract complex features from PIV image data, but also effectively make velocity measurement decisions on the velocity field, significantly improving the accuracy and efficiency of the calculation.
[0061] This technical solution addresses the technical challenges in particle image measurement by offering an innovative approach. First, it effectively captures particle trajectories at different time points using the self-attention mechanism of a deep Transformer model, overcoming the limitations of traditional CNN methods in processing time-series data. Second, addressing the high dimensionality challenge of high-resolution PIV images, this solution employs efficient data preprocessing techniques and feature fusion strategies, reducing data dimensionality while preserving key information and enhancing the model's ability to handle high-dimensional data. Furthermore, this solution designs an innovative feature fusion strategy that effectively integrates temporal and spatial features, improving feature expressiveness and robustness. In terms of model training and optimization, a carefully designed network architecture and loss function, combined with advanced optimization algorithms, improve the efficiency and stability of model training. Simultaneously, to enhance the model's generalization ability, this solution utilizes cross-validation and multi-task learning techniques, ensuring the model's adaptability to new data. Finally, post-processing techniques and post-displacement optimization strategies further improve the accuracy and robustness of velocity field measurement, meeting the needs of automated 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 employs a deep Transformer model, which effectively captures the global context and long-range dependencies in PIV images using a self-attention mechanism—a feat difficult to achieve with traditional convolutional neural networks—thus significantly improving the accuracy of velocity field measurement. Second, this technical solution designs a unique feature fusion strategy that effectively integrates temporal and spatial features, enhancing the model's ability to represent complex PIV data. This is crucial for 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 significantly improves processing efficiency and result reliability, bringing groundbreaking progress to fluid dynamics research and industrial applications.
[0063] This technical solution offers significant advantages: First, the self-attention mechanism of the deep Transformer model comprehensively captures global information and long-range dependencies in PIV images, greatly improving the accuracy and generalization ability of velocity field measurement. Second, the innovative feature fusion strategy effectively integrates temporal and spatial features, enhancing the model's ability to recognize image details and structures, thereby improving the precision and robustness of velocity field measurement results. Furthermore, the optimized model training and post-processing workflow further improves the accuracy of velocity field measurement while ensuring rapid model convergence and real-time processing capabilities, enabling this technical solution to provide an efficient and reliable velocity field measurement solution in practical applications. These combined advantages give this technical solution significant application value and broad market prospects in fluid dynamics research and industrial applications. Attached Figure Description
[0064] Figure 1 Flowchart for an embodiment;
[0065] Figure 2 This is a schematic diagram illustrating how the method in Example 2 captures and distinguishes the trajectories of particles at different points in time. Detailed Implementation
[0066] The present invention will be further described below with reference to the accompanying drawings and embodiments, but this is not intended to limit the scope of the invention.
[0067] Example 1:
[0068] Reference Figure 1 A particle image velocimetry method based on a deep Transformer model includes 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, 64GB of RAM, and running Ubuntu 20.04. PyTorch 1.8 was used as the deep learning framework, with CUDA 11.3 and cuDNN 8.0.5 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, each with a spatial resolution of 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 using a linear transformation to eliminate 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 images.
[0073] After preprocessing, the image dataset is randomly divided into a training set (60%), a validation set (20%), and a test set (20%).
[0074] S3, Deep Transformer model architecture parameters
[0075] The deep Transformer model consists of six stacked Transformer layers, each configured with eight self-attention heads. Each head processes a dimension of 64. The feedforward network contains two linear layers, with the output dimension of the first linear layer set to 256. The ReLU activation function is used to introduce non-linearity. The model also includes layer normalization and residual connections to improve the training efficiency of the deep network.
[0076] S4. Feature Extraction and Fusion Strategy
[0077] The input PIV image data is first processed by a deep Transformer model for feature extraction. After each Transformer layer, the dimensionality of the feature map is adjusted using bilinear interpolation to maintain temporal and spatial consistency. A weighted fusion strategy is employed, where weights are initialized to equal values and automatically adjusted during training via backpropagation to optimize feature integration.
[0078] S5, Displacement Predictor Design and Parameters
[0079] The displacement predictor consists of two fully connected layers. The first fully connected layer has 2048 nodes, and the number of nodes in the second fully connected layer matches the output dimension of the prediction task. For example, if the task involves displacement prediction in two directions, the second layer has 2 nodes. The ReLU activation function is used between the two layers.
[0080] S6, Model Training and Optimization Algorithms
[0081] The model training uses the cross-entropy loss function, and the optimization algorithm chosen 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 a factor of 0.1 every 5 epochs during training. Early stopping is used to control overfitting; training is stopped if the loss on the validation set does not decrease for 10 consecutive epochs.
[0082] S7, Post-processing technology application
[0083] The predicted displacement results were post-processed using non-maximum suppression (NMS) to improve the accuracy and robustness of the velocity field measurements. The confidence threshold for NMS was set to 0.3, with a neighborhood size of 3x3 pixels, to remove pixels with low confidence in the displacement prediction while preserving the motion trajectories of the main particles.
[0084] S8. Experimental Results and Analysis
[0085] Two hundred labeled samples were randomly selected from the DNS_turbulence dataset as training samples, and the remaining samples were used as test samples. Table 1 shows the overall velocimetry accuracy of different methods for particle image velocimetry, where HS represents the velocimetry result obtained using the traditional Horn-Schunck algorithm, 1D-CNN represents the velocimetry result obtained using a one-dimensional convolutional neural network, 2D-CNN represents the velocimetry result obtained using a two-dimensional convolutional neural network, and 3D-CNN represents the velocimetry result obtained using a three-dimensional convolutional neural network. The results in the table show that this example achieves higher velocimetry accuracy compared to traditional models and deep learning models commonly used for particle image velocimetry.
[0086] Table 1
[0087] Evaluation indicators / methods HS 1D-CNN 2D-CNN 3D-CNN This example method Overall speed measurement accuracy 88.59 85.17 91.58 93.06 96.26
[0088] S9. Conclusion
[0089] Experimental results fully demonstrate the effectiveness of the proposed particle image velocimetry method based on the deep Transformer model in improving the accuracy and robustness of velocity field measurements. The model's global feature capture capability and adaptive feature fusion strategy significantly enhance measurement performance. Furthermore, the experiments showcase the application potential and broad applicability of this method in practical PIV tasks, providing a reliable solution for fluid dynamics research and industrial applications.
[0090] Example 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 settings, 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 used was TensorFlow 2.5.
[0094] Preparation of S2 and PIV datasets
[0095] The Particle Image Velocimetry (PIV) dataset used in the experiment contains five different flow field scenarios, with each scenario's particle images having 256 time points and a spatial resolution of 256x256 pixels. The dataset underwent preprocessing, including noise removal and time alignment of the particle images, to improve the accuracy of subsequent velocity field measurements.
[0096] Customized design of S3 and deep Transformer models
[0097] The model consists of 8 Transformer layers, each using 4 attention heads. The input dimension is (512, 512, 10), meaning the velocity field feature of each pixel is composed of particle images from 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 normalization.
[0098] S4. Optimization Strategies for Feature Extraction and Fusion
[0099] The model input is processed through deep Transformer layers for feature extraction. The output feature map of each layer is then mixed through 1x1 convolutions to optimize feature fusion. After feature fusion, it is converted into a one-dimensional feature vector through a global average pooling layer.
[0100] S5. Construction and Training of the Speed Measuring Device
[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 is trained using the Softmax activation function and the classification cross-entropy loss function. The optimizer uses SGD with an initial learning rate of 0.01 and a momentum parameter of 0.9.
[0102] S6. Detailed Process of Model Training
[0103] The model was trained for 100 epochs, with performance evaluated on a validation set at the end of each epoch. Data augmentation techniques, including random rotations and flips, were used to enhance the model's generalization ability. The learning rate was dynamically adjusted during training; if the validation loss did not decrease for three consecutive epochs, the learning rate was halved.
[0104] S7. Post-processing and Result Optimization
[0105] The displacement prediction results are post-processed using morphological operations, including erosion and dilation, to remove small noise points and restore the boundaries of particle trajectories. Furthermore, a Conditional Random Field (CRF) is applied to optimize the displacement prediction results to account for spatial relationships between pixels.
[0106] S8. Evaluation and Analysis of Experimental Results
[0107] The model achieved a velocity field measurement accuracy of 92% on the test set, with an average endpoint error (AEE) of 18.29. Table 2 compares the average endpoint errors of different models in particle image velocimetry, demonstrating the model's excellent measurement performance on PIV data. (The text then abruptly shifts to a seemingly unrelated topic about a specific model and its accuracy.) Figure 2 The visualization analysis shown demonstrates that the model can accurately capture and distinguish the trajectories of particles at different points in time.
[0108] Table 2
[0109] Evaluation indicators / methods HS 1D-CNN 2D-CNN 3D-CNN This example method AEE 25.92 29.83 24.60 20.57 18.29
[0110] S9. Experimental Conclusions
[0111] This implementation demonstrates the efficiency and superiority of deep Transformer models in 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 exhibits excellent performance in terms of velocity field measurement accuracy, robustness, and practicality, proving its application potential in fluid dynamics research and industrial applications.
Claims
1. A particle image velocimetry method based on a deep Transformer model, characterized in that, Includes the following steps: 1) Data Preprocessing: First, normalization is performed on the particle image data. Min-max normalization or Z-score normalization methods are used to scale the pixel values at different time points to a uniform range or distribution, eliminating dimensional differences between time points and ensuring data consistency in subsequent processing steps. In addition, noise analysis is performed on the particle image data, and filters are used to reduce image noise to improve the quality of feature extraction. Then, the preprocessed particle image data is labeled, and the labeled particle image data is randomly divided into training, validation, and test sets. 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 the dependencies of different scales and positions at the same time by processing the attention of multiple heads in parallel, and extract global and local features that reflect the particle motion characteristics. 3) Feature fusion: After feature extraction, a fusion layer is used to integrate global and local features. The fusion layer includes 1x1 convolution operations or depthwise separable convolutions to adjust the dimension of feature channels and enhance the expressive power of features through weighted averaging or feature weighted summation. 4) Displacement prediction: Design a displacement predictor to perform final displacement prediction based on the fused features. The displacement predictor maps the features to a predetermined velocity field to complete the particle image velocimetry task, and then performs post-processing. 5) Model optimization: The model is trained using labeled particle image data. During training, the backpropagation algorithm combined with gradient descent or its variants is used to optimize the model parameters. By defining a loss function, the performance of the model on the training set is monitored, and early stopping and regularization strategies are used to prevent overfitting and ensure that the model has good generalization ability. The model was trained using optimization algorithms employing momentum term or adaptive learning rate adjustment strategies, specifically including the following: 5.1 Use of the Momentum Term: The momentum term, by incorporating the accumulation of the previous gradient during gradient descent, helps the model converge faster and avoid getting trapped in local minima. The update formula for the momentum term is expressed as: ; ; in, These are the model parameters at step t; It is the learning rate; It is a momentum hyperparameter; It is the gradient of the loss function with respect to the model parameters; It 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 based on the historical gradients of the parameters. Adaptive learning rate optimization algorithms include Adam and RMSprop. The update formula for the Adam optimizer is expressed as: ; ; ; ; ; in, These are the model parameters at step t; It is the learning rate; and These are the decay rates of the gradient and the squared gradient, respectively. It is a 10 −8 Up to 10 −6 A constant between these values is used to prevent division by zero errors; and These are the bias-corrected gradient and the moving average of the squared gradient, respectively.
2. The particle image velocimetry method based on a deep Transformer model according to claim 1, characterized in that, The data preprocessing step in step 1) further includes noise removal of the particle image data to further improve the accuracy of feature extraction: First, noise identification is performed on the particle image data, and the noise type is distinguished through visual inspection or automatic algorithms. Then, noise analysis is performed, and tools such as Fast Fourier Transform or Wavelet Transform are used to deeply understand the spatial distribution and spectral characteristics of the noise. Based on these noise analyses, the most suitable denoising algorithm is selected, and the filter parameters are adjusted to achieve the best denoising effect. Next, the adjusted filter is applied to the particle image data for actual denoising processing to reduce noise interference while retaining key information and details. Finally, the effect of denoising processing is verified through visual inspection of quantitative indicators to ensure that noise is effectively removed while the key features of the image data are not damaged.
3. The particle image velocimetry method based on a deep Transformer model according to claim 1, characterized in that, In step 2), the deep Transformer model comprises multiple consecutive Transformer layers. Each Transformer layer consists of a multi-head self-attention mechanism and a feedforward network, used to progressively extract and refine features. The multi-head self-attention mechanism and the feedforward network are considered 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 the input data from different angles and scales at the same time, thereby comprehensively extracting global and local features in the particle image. 2.2 Feedforward Network: Following the self-attention mechanism, each Transformer layer also contains one or more feedforward networks. The feedforward network consists of several linear transformations and non-linear activation functions. The feedforward network further processes and refines the output of the self-attention mechanism. The role of the feedforward network is to perform deeper abstraction and transformation of features, thereby enhancing the model's ability to express complex features. In the deep Transformer model, successive Transformer layers work together in this structured way. Each layer further extracts and refines 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 particle image velocimetry tasks. In addition, deep Transformer models also include other auxiliary components, namely layer normalization and residual connections, to improve the training stability of the model and avoid gradient vanishing or exploding problems. Layer normalization stabilizes the training process by normalizing the input of each layer, while residual connections allow gradients to flow directly, thus making it possible to train deep networks.
4. The particle image velocimetry method based on the deep Transformer model according to claim 3, characterized in that, The core feature of the multi-head self-attention mechanism is its ability to process multiple attention "heads" in parallel. Each head independently calculates attention weights, and these weight results are combined to capture features at different scales. The specific details of this mechanism are as follows: 2.1.1 Number of attention heads: In multi-head self-attention mechanisms, 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 features of the data from multiple perspectives at the same time. 2.1.2 Input feature segmentation: The input features are segmented into multiple parts, each part corresponding to an attention head. This segmentation can be a simple average segmentation or a complex segmentation based on specific rules. The goal is to allow each head to focus on different parts of the input data. 2.1.3 Scaling Dot Product Attention: Each head performs a scaling dot product attention operation. By calculating the dot product between the query, key, and value, an initial attention score is obtained. To stabilize the training process, the dot product results are scaled. The scaling factor is the inverse root of the number of attention heads. 2.1.4 Calculation of attention weights: The scaled dot product results are normalized using the softmax function to obtain the attention weights for each head. These weights reflect the importance of different input features relative to each head. 2.1.5 Weighted Summation: Based on the calculated attention weights, the corresponding values are summed using weighted methods to obtain the weighted output; 2.1.6 Result merging: The weighted output results of all heads are merged by splicing or weighted summation. This merging process integrates the multi-scale features captured by different heads, providing a comprehensive feature representation for the subsequent feedforward network. 2.1.7 Linear Transformation: Applying linear transformations to the merged feature representations increases the non-linear expressive power of the model and provides input for the next layer or subsequent model components.
5. The particle image velocimetry method based on a deep Transformer model according to claim 1, characterized in that, In step 3), the feature fusion further enhances the integration effect by adopting a weighted fusion strategy. The specific details of this weighted fusion strategy are as follows: 3.1 Feature Representation Extraction: In 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 weights for the feature representation of each layer. These weights can be initialized randomly or set based on prior knowledge so that the model can be adjusted during training. 3.3 Design of weighting mechanism: Design a weighting mechanism that dynamically adjusts the weights of each feature layer according to its importance. The weighting can be achieved through a learnable parameter vector, with each feature layer corresponding to a weight parameter. 3.4 Construction of the Loss Function: A loss function is constructed that considers not only the accuracy of velocity field prediction but also includes a regularization term to guide the optimization of feature weights, ensuring that the model does not overly rely on any particular feature layer. The loss function is expressed as follows: ; in, It is the mean squared error loss, used to measure the difference between the predicted velocity field and the actual velocity field; It is the weight of the regularization term; It is the regularization loss, which is either L1 or L2 regularization; 3.5 Backpropagation and Weight Update: During model training, the gradient of the loss function with respect to the feature weights is calculated through the backpropagation algorithm. These gradients are used to update the weight parameters, enabling the model to automatically learn the optimal feature fusion ratio. 3.6 Application of weight optimization algorithms: Selecting appropriate optimization algorithms to adjust feature weights and optimize fusion effects. The selection of optimization algorithms and parameter settings have a significant impact on the training efficiency and final performance of the model. 3.7 Implementation of the fusion layer: Implement the fusion layer, which accepts feature representations and corresponding weights from different layers, and integrates the feature representations and corresponding weights from different layers into a unified feature vector by weighted summation; 3.8 Evaluation of Feature Fusion Effect: During training, 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 the speed measurement.
6. The particle image velocimetry method based on a deep Transformer model according to claim 1, characterized in that, In step 4), the displacement predictor employs one or more fully connected layers. These fully connected layers 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 layers. Each fully connected layer contains a large number of neuron nodes. These nodes are linearly combined with the input features through weights and biases. Then, nonlinearity is introduced through a nonlinear activation function, enabling the displacement predictor to learn and simulate complex displacement patterns. In this way, the fully connected layers 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 layers can be directly connected to linear layers or other types of output layers to determine the velocity field value of each particle or image patch.
7. The particle image velocimetry method based on a deep Transformer model according to claim 1, characterized in that, In step 4), nonmaximum suppression (NMS) is introduced during post-processing to further improve the accuracy and robustness of the velocity measurement results. After the model completes the initial prediction, NMS is used as a post-processing method to optimize the velocity measurement results through the following steps: 4.
1. Determine local maxima: For each pixel in the velocity measurement result, non-maximum suppression checks whether the value of each pixel in its local neighborhood is the maximum. If the velocity field confidence of a pixel is not the highest in its neighborhood, then this pixel will be suppressed or ignored. 4.
2. Set a threshold: Determine a confidence threshold. Only speed measurement results that are higher than this threshold will be considered for the next non-maximum check. 4.
3. Perform NMS: Traverse the velocity measurement results. 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 that pixel, then reduce the confidence of that pixel or mark the pixel as background. 4.
4. Refining Boundaries: Through NMS processing, pixels with low confidence are removed, thereby making the boundaries of the velocity field clearer and more accurate; 4.
5. Iterative Optimization: NMS is executed iteratively, and each iteration further improves the quality of the velocity measurement results; 4.
6. Multi-category processing: For multi-category speed measurement problems, NMS can be applied independently to each category, or adjusted according to the relationship between different categories.
8. A computer-readable storage medium storing a computer program, 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 7. The storage medium is a 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, 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 velocimetry, 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.
9. An electronic device equipped with a processor and a memory, wherein the memory stores a computer program executable on the processor, characterized in that, When the computer program is executed by the processor, it implements the steps of the particle image velocimetry method based on the deep Transformer model as described in any one of claims 1 to 7.
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