Three-dimensional space magnetic field prediction method and system based on point cloud
Through a three-dimensional spatial magnetic field prediction method based on point cloud, combined with the ResUnet-Transformer model and Bayesian optimization and tuning hyperparameters, the computing resource and time consumption problems of magnetic field simulation of complex power equipment in the existing technology are solved, and fast and efficient magnetic field distribution prediction is achieved.
Patent Information
- Application Number
- CN202411771092.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-03-25
AI Technical Summary
The prior art requires a lot of computing resources and time to simulate magnetic field of complex power equipment, and the prior model cannot be effectively established, resulting in the inability to meet the speed requirements of digital twins.
The three-dimensional spatial magnetic field prediction method based on point cloud is used to describe the three-dimensional structural information of the components to be tested through point clouds, and the convolution and upsampling operations are fusion characteristics, as input to the ResUnet-Transformer model, and the hyperparameters are tuned through Bayesian optimization.
Reliance on personnel experience is reduced, the efficiency of building three-dimensional point cloud data sets under different geometric structural parameters is improved, and a clear three-dimensional spatial magnetic field distribution is achieved quickly and clearly.
Smart Images

Figure CN119693587A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of magnetic field prediction technology, and in particular to a three-dimensional space magnetic field prediction method and system based on point cloud. Background Art
[0002] At present, the magnetic field simulation of power equipment is mainly carried out through numerical simulation methods such as finite difference method, finite element method, moment method, etc. Numerical simulation technology represented by finite element method has been applied since the 1960s. It mainly uses electronic computers for numerical calculation and image display to study engineering and physical problems. Its development has basically solved conventional engineering problems. However, as the structure of power equipment such as large motors and transformers becomes increasingly complex, in order to improve the accuracy, fine mesh division is required when simulating complex power equipment, which may take dozens or even hundreds of hours and consume a lot of computer resources. In severe cases, it will cause the system to crash and fail to complete the task. At the same time, the finite element method cannot establish a priori models using previous simulation results. When the geometric structure parameters change slightly, it is necessary to re-model and calculate. Especially when performing large-scale computing tasks, the time cost required increases exponentially, which cannot meet the speed requirements of digital twins.
[0003] It can be seen that the above existing methods still have inconveniences and defects in use, and are in urgent need of further improvement. How to create a new three-dimensional magnetic field prediction method based on point cloud has become a goal that the industry urgently needs to improve. Summary of the invention
[0004] In view of this, an embodiment of the present disclosure provides a three-dimensional magnetic field prediction method based on point cloud, which at least partially solves the problems existing in the prior art.
[0005] In a first aspect, an embodiment of the present disclosure provides a method for predicting a three-dimensional magnetic field based on a point cloud, the method comprising the following steps:
[0006] The three-dimensional structure information of the component to be measured is described by using the point cloud to obtain a three-dimensional point cloud data set; wherein each three-dimensional point cloud data in the three-dimensional point cloud data set contains the spatial coordinates and the magnitude of the magnetic induction intensity of the point;
[0007] Preprocessing the three-dimensional point cloud data set;
[0008] The preprocessed three-dimensional point cloud data set is input into the network model, and the network model outputs the spatial magnetic field distribution corresponding to the three-dimensional point cloud coordinates.
[0009] According to a specific implementation of the embodiment of the present disclosure, the preprocessing of the three-dimensional point cloud data set includes:
[0010] Convolution and upsampling operations are performed on the three-dimensional point cloud data set to fuse the features of the three spatial dimensions of the three-dimensional point cloud data set, specifically including the following steps:
[0011] The dimension of the point cloud data is changed from 32×32×32 to 1×32×32 through convolution operation;
[0012] After transforming the second, third, and fourth dimensions of the point cloud data to the channel dimension, three similar convolution operations are performed to change the dimension of the point cloud data from 32×32×32 to 3×32×32;
[0013] The dimension-transformed point cloud data is upsampled four times to change the dimension of the point cloud data from 3×32×32 to 3×512×512.
[0014] According to a specific implementation of the embodiment of the present disclosure, the method further includes: training the network model, specifically including the following steps:
[0015] The network model is trained based on the pre-collected samples; the network model uses MSE as the loss function and iterates 1500 times;
[0016] Based on the Adam optimization algorithm, the cosine annealing algorithm is used to adaptively adjust the learning rate.
[0017] According to a specific implementation of the embodiment of the present disclosure, the method further includes: tuning the hyperparameters of the network model, including:
[0018] The Optuna hyperparameter optimization framework is used to automatically tune the hyperparameters based on the Bayesian optimization algorithm; the hyperparameters include batch-size, initial learning rate and dropout, and the specific steps include:
[0019] Determine whether the model is initialized; wherein, when the model is initialized, the sample points selected in the previous round are used to train the proxy model; when the model is not initialized, the initialization points are randomly generated to train the proxy model;
[0020] The next sample point is selected by using the confidence upper bound function as the acquisition function; whether the sample point satisfies the target value is determined; when it does not meet the target value, the proxy model is trained by using the sample point; when it meets the target value, the sample point is output.
[0021] According to a specific implementation of an embodiment of the present disclosure, the network model is a ResUnet-Transformer model.
[0022] In a second aspect, an embodiment of the present disclosure provides a three-dimensional magnetic field prediction system based on point cloud, the system comprising:
[0023] A point cloud module is configured to describe the three-dimensional structural information of the component to be measured using a point cloud to obtain a three-dimensional point cloud data set; wherein each three-dimensional point cloud data in the three-dimensional point cloud data set includes the spatial coordinates and the magnitude of the magnetic induction intensity of the point;
[0024] A preprocessing module, configured to preprocess the three-dimensional point cloud data set;
[0025] The output module is configured to input the preprocessed three-dimensional point cloud data set into the network model, and the network model outputs the spatial magnetic field distribution corresponding to the three-dimensional point cloud coordinates.
[0026] According to a specific implementation of the embodiment of the present disclosure, the system further includes:
[0027] The convolution module is configured to perform convolution and upsampling operations on the three-dimensional point cloud dataset to fuse the features of the three-dimensional point cloud dataset in three spatial dimensions, and specifically includes the following steps:
[0028] The dimension of the point cloud data is changed from 32×32×32 to 1×32×32 through convolution operation;
[0029] After transforming the second, third, and fourth dimensions of the point cloud data to the channel dimension, three similar convolution operations are performed to change the dimension of the point cloud data from 32×32×32 to 3×32×32;
[0030] The dimension-transformed point cloud data is upsampled four times to change the dimension of the point cloud data from 3×32×32 to 3×512×512.
[0031] The point cloud-based three-dimensional magnetic field prediction method in the disclosed embodiment improves the construction of a three-dimensional point cloud data set under different geometric structure parameters; uses convolution and upsampling operations to preprocess the input data, fuses the features of the point cloud data in three spatial dimensions, and uses it as the input of the ResUnet-Transformer model after dimensional transformation, and selects the model hyperparameters based on Bayesian optimization, which can reduce the dependence on human experience to a certain extent and obtain a clear three-dimensional magnetic field distribution. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The above is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0033] Figure 1 A schematic diagram of a process flow of a three-dimensional magnetic field prediction method based on point cloud provided in an embodiment of the present disclosure;
[0034] Figure 2A schematic diagram of point cloud disorder provided in an embodiment of the present disclosure;
[0035] Figure 3 An unstructured schematic diagram of a point cloud provided by an embodiment of the present disclosure;
[0036] Figure 4 A schematic diagram of density inconsistency of a point cloud provided by an embodiment of the present disclosure;
[0037] Figure 5 A schematic diagram of the distribution of three-dimensional point cloud data on a transformer surface provided by an embodiment of the present disclosure;
[0038] Figure 6 A schematic diagram of transformer magnetic field distribution provided by an embodiment of the present disclosure;
[0039] Figure 7 A schematic diagram of a data preprocessing process provided by an embodiment of the present disclosure;
[0040] Figure 8 A schematic diagram of a training process provided by an embodiment of the present disclosure;
[0041] Fig. 9 A Bayesian algorithm flow chart provided for an embodiment of the present disclosure;
[0042] Fig.10 A schematic diagram of MSE changes when the number of iterations is 50 provided in an embodiment of the present disclosure;
[0043] Fig.11 A schematic diagram of MSE changes when the number of iterations is 500 provided in an embodiment of the present disclosure;
[0044] Fig.12 A schematic diagram of MSE changes when the number of iterations is 1000 provided in an embodiment of the present disclosure;
[0045] Fig.13 A schematic diagram of MSE changes when the number of iterations is 1500 provided in an embodiment of the present disclosure;
[0046] Fig.14 A schematic diagram for comparing magnetic field results under different iteration times provided in an embodiment of the present disclosure;
[0047] Fig.15 A schematic diagram of percentage error at different iteration times provided by an embodiment of the present disclosure;
[0048] Fig.16 A schematic diagram of MSE comparison of a test set under different loss functions provided in an embodiment of the present disclosure;
[0049] Fig.17A schematic diagram for comparing magnetic field results under different loss function conditions provided by an embodiment of the present disclosure;
[0050] Fig.18 A schematic diagram of percentage error under different loss functions provided in an embodiment of the present disclosure;
[0051] Fig.19 A schematic diagram of the structure of a point cloud-based three-dimensional magnetic field prediction system provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0052] The embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0053] The following describes the embodiments of the present disclosure through specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.
[0054] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described in this application can be embodied in a wide variety of forms, and any specific structure and / or function described in this application is merely illustrative. Based on this disclosure, it should be understood by those skilled in the art that an aspect described in this application can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number of aspects described in this application can be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described in this application can be used to implement this device and / or practice this method.
[0055] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects described may be practiced without these specific details.
[0056] The embodiment of the present invention provides a three-dimensional magnetic field prediction method based on point cloud. By applying the ResUnet-Transformer model to the solution calculation of the three-dimensional magnetic field, the component to be tested is taken as the research object to study the three-dimensional magnetic field prediction method based on point cloud. Although the simulation calculation of multi-physical fields using numerical simulation methods such as finite element method is time-consuming, the spatial distribution characteristics of the three-dimensional field can be obtained.
[0057] Firstly, the point cloud is used to describe the three-dimensional structural information of the component to be tested, and the three-dimensional point cloud dataset under different geometric structure parameters is constructed using the finite element method; secondly, the input data is preprocessed using convolution and upsampling operations, and the features of the point cloud data in three spatial dimensions are fused respectively, and the dimensionality is transformed as the input of the ResUnet-Transformer model; finally, the Bayesian optimization algorithm is used to automatically tune the model hyperparameters, and training is performed based on the three-dimensional point cloud dataset. The influence of different numbers of iterations and loss functions on the magnetic field prediction results is analyzed, which provides a research idea for deep learning methods to solve three-dimensional magnetic field problems.
[0058] Figure 1 A schematic diagram of the process of a point cloud-based three-dimensional magnetic field prediction method provided in an embodiment of the present disclosure.
[0059] like Figure 1 As shown, at step S110, the three-dimensional structural information of the component to be measured is described using point cloud to obtain a three-dimensional point cloud data set; wherein each three-dimensional point cloud data in the three-dimensional point cloud data set includes the spatial coordinates and the magnitude of the magnetic induction intensity of the point.
[0060] More specifically, the process proceeds to step S120.
[0061] In step S120, the three-dimensional point cloud data set is preprocessed.
[0062] In an embodiment of the present invention, the preprocessing of the three-dimensional point cloud dataset includes: performing convolution and upsampling operations on the three-dimensional point cloud dataset, and fusing the features of the three-dimensional point cloud dataset in three spatial dimensions respectively, which specifically includes the following steps:
[0063] The dimension of the point cloud data is changed from 32×32×32 to 1×32×32 through convolution operation;
[0064] After transforming the second, third, and fourth dimensions of the point cloud data to the channel dimension, three similar convolution operations are performed to change the dimension of the point cloud data from 32×32×32 to 3×32×32;
[0065] The dimension-transformed point cloud data is upsampled four times to change the dimension of the point cloud data from 3×32×32 to 3×512×512.
[0066] Next, go to step S130.
[0067] In step S130, the preprocessed three-dimensional point cloud data set is input into the network model, and the network model outputs the spatial magnetic field distribution corresponding to the three-dimensional point cloud coordinates.
[0068] In an embodiment of the present invention, the method also includes: training a network model, specifically including the following steps: training the network model based on pre-collected samples; the network model uses MSE as a loss function and iterates 1500 times; based on the Adam optimization algorithm, a cosine annealing algorithm is used to adaptively adjust the learning rate.
[0069] In an embodiment of the present invention, the method also includes: tuning the hyperparameters of the network model, including: using the Optuna hyperparameter optimization framework to automatically tune the hyperparameters based on the Bayesian optimization algorithm; wherein the hyperparameters include Batch-size, initial learning rate and Dropout, and specifically include the following steps: determining whether the model is initialized; wherein, when the model is initialized, using the sample points selected in the previous round to train the proxy model; when the model is not initialized, randomly generating initialization points to train the proxy model; using the confidence upper bound function as the acquisition function to select the next sample point; determining whether the sample point meets the target value; wherein, when not satisfied, using the sample point to train the proxy model; when satisfied, outputting the sample point.
[0070] In an embodiment of the present invention, the network model is a ResUnet-Transformer model.
[0071] More specifically, the present invention is verified by examples below:
[0072] 1.1 Point cloud data and its characteristics
[0073] Point cloud data is a massive collection of points that describes the spatial distribution and surface characteristics of an object in three-dimensional space. It is a data format widely used in three-dimensional vision systems. Compared with two-dimensional image data, point cloud data contains depth information and rich spatial information. It can effectively describe the size, shape, position, and direction of an object, and present the spatial form of the object in three dimensions. Point cloud data has the following characteristics:
[0074] (1) Disorder
[0075] For image data, the data storage form of grayscale images is usually a two-dimensional array, where the values at different positions in the array represent the pixel values of the image. They are arranged in a certain order to form the information of the entire image. If the pixel value or its position in the array is changed, the corresponding image information will also change. Unlike image data, point cloud data is a collection of points without a specific order. Changing the order of the points does not affect the structure of the spatial object represented by the point cloud, and it is disordered. Figure 2 As shown, although the arrangement order of the five small orange circles inside the three blue circles is different, it does not affect their meanings, and they all represent blue circles.
[0076] (2) Unstructured
[0077] For image data, the distance between each pixel in the image is fixed, and the image is organized in a regular grid, and each pixel has a fixed position. Therefore, a two-dimensional image is structured data. The situation of point cloud data is slightly different. Each point in the point cloud data has its coordinates in three-dimensional space, but the distance between them is not fixed. Point cloud data is composed of a large number of discrete points. The distribution of these points in space is irregular, and the distance and connection relationship between them are dynamically changing, depending on factors such as the way the point cloud data is collected, the complexity of the scene, and the sampling density. Therefore, point cloud data is generally considered to be unstructured data. For example Figure 3 As shown, the distance between each point in the point cloud and its adjacent points is different.
[0078] (3) Density inconsistency
[0079] Under different point cloud data acquisition methods, the number and distribution density of points in different areas or parts are not the same, that is, some areas may have more points, while other areas may have only a few points. Figure 4 shown.
[0080] 1.2 Point cloud dataset construction and preprocessing
[0081] Taking the three-dimensional amorphous alloy transformer as an example, the three-dimensional spatial magnetic field of AMT is analyzed in combination with the ResUnet-Transformer model. The AMT finite element model is established by finite element simulation software. Considering that AMT is a three-dimensional model with a complex structure, only the XZ view of AMT is selected as the observation direction for magnetic field analysis and calculation. This application uses three-dimensional point cloud data to describe the three-dimensional structural information of AMT, and uses its three-dimensional point cloud data as the input of the ResUnet-Transformer model. The three-dimensional point cloud data of the AMT surface is exported by finite element simulation software. Each point cloud data point contains the spatial coordinates of the point (x, y, z) and the magnitude of the magnetic induction intensity of the point. The distribution of point cloud data on the AMT surface is as follows: Figure 5 shown.
[0082] When performing the convolution operation, the convolution kernel slides on the input data in the form of a sliding window. If the input data is a square or a cube, the convolution kernel will be relatively simple when scanning the data, and no additional padding operations are required. The input size is generally an exponential power of 2, such as 32, 128, and 256. The geometric structure parameters of AMT are changed, and the values of its structural variables are shown in Table 1. Under each geometric structure parameter setting condition, the spatial coordinates (x, y, z) of the three-dimensional point cloud data are set with a certain step size, and a total of 32×32×32=32768 data points are obtained. In addition to the spatial coordinates (x, y, z), each data point also contains the corresponding magnetic induction intensity under the coordinates. In summary, a total of 5×5×4×6=600 sets of data are obtained under different geometric structure parameter settings of the transformer, and each set of data contains 32768 data points.
[0083] Table 1 AMT structural variable values
[0084]
[0085] Since the input of the network model is 3D point cloud data, the data points exported from the simulation software need to be reshaped into 32×32×32 size to transform them into matrix data. The point cloud data is represented by 32678 data points, and the position of the point is represented by coordinates. The purpose of adding coordinate information is to allow the network model to learn the position information of the AMT. The output of the network model is the 3D magnetic field of the component to be tested, such as Figure 6 shown.
[0086] The input of the network model is three-dimensional point cloud data, and the output is the spatial magnetic field distribution corresponding to the three-dimensional point cloud coordinates. Since the input and output data dimensions are inconsistent, in order to speed up the calculation speed of the neural network, data preprocessing is required before the data is input into the network model.
[0087] First, the point cloud data is transformed in dimension through convolution operation. After the convolution operation, the dimension of the point cloud data changes from the original 32×32×32 to 1×32×32. The convolution operation here mainly serves the purpose of data dimensionality reduction. Secondly, the point cloud data contains three coordinates x, y, and z. In order to enable the model to learn the spatial information of the input features from different coordinate positions and enhance the feature expression ability, the second, third, and fourth dimensions of the original point cloud data are transformed into channel dimensions, and three similar convolution operations are performed. In this way, each convolution operation is equivalent to a dimension transformation of a coordinate. After three convolution operations, the data dimension changes from the original 32×32×32 to 3×32×32. Finally, the point cloud data that has undergone dimension transformation is subjected to four upsampling operations. The upsampling process uses transposed convolution and the number of channels remains unchanged. The size of the feature matrix becomes twice the original size. After the upsampling, two convolution operations are performed for feature extraction. After four upsampling operations and two convolution operations, the data dimension changes from the original 3×32×32 to 3×512×512. In this process, the number of feature channels remains unchanged. The above data preprocessing process is as follows: Figure 7 shown.
[0088] 1.3 Hyperparameter Tuning Based on Bayesian Optimization
[0089] 1.31 Loss Function and Evaluation Metrics
[0090] The main hardware configuration used for network model training in this application is Nvidia GeForce RTX 4090 GPU and 13th Gen Intel(R) Core(TM) i9-13900K CPU, and the main software configuration is Python 3.10, Numpy 1.23.5, CUDA 12.2 and Pytorch 2.0.0 under Window 11 system. The training flow chart is as follows: Figure 8 shown.
[0091] During the network training process, 500 sample sets were used for training. To explore the impact of the loss function on the model prediction performance, three loss functions, MSE, MAE and MSE+MAE, were used for comparative analysis. The Adam optimizer was used as the minimization objective function. On the basis of the Adam optimization algorithm, the cosine annealing algorithm was used to adaptively adjust the learning rate so that it gradually decreased with the increase in the number of training steps.
[0092] Prediction accuracy is an important indicator to measure the performance of a prediction model. This application uses the MSE and MAPE between the true value and the predicted value as quantitative calculations of prediction accuracy. Selecting these two evaluation indicators can comprehensively evaluate the performance of the prediction model. The calculation formulas of MAE, MSE and MAPE are shown in Formula (1), Formula (2) and Formula (3) respectively.
[0093]
[0094] In the formula, N is the number of samples, and i are the predicted value and actual value of the ith sample respectively. The range of MAPE and MSE is [0, +∞]. The smaller the value, the better the prediction effect of the model.
[0095] 1.32 Bayesian-based model hyperparameter selection
[0096] This application uses the Optuna hyperparameter optimization framework to automatically tune hyperparameters, which can reduce the reliance on human experience to a certain extent. The hyperparameter tuning algorithm uses the Bayesian optimization (BO) algorithm.
[0097] The core idea of the BO algorithm is to infer the global optimal solution of the objective function by constructing a posterior probability model of the objective function. The objective function is usually regarded as a black box, and a series of points are selected in a given parameter space for evaluation, and the parameters are gradually adjusted using these evaluation results to finally find the optimal solution. Let X = x1, x2, ..., x3 be a set of hyperparameter combinations, f(x) be the objective function corresponding to the hyperparameter x, and the principle of Bayesian optimization is to find x∈X such that
[0098]
[0099] Gaussian process regression is a common probabilistic proxy model used in Bayesian optimization. During optimization, it is first assumed that the performance of the hyperparameters follows a Gaussian distribution at each value point. Then, the observation results of the first n points are modeled using Gaussian process regression. Finally, the posterior probability distribution is calculated to obtain the expected mean and expected variance of each hyperparameter at each value point. The expected mean represents the expected performance of the hyperparameter at the corresponding value point, while the expected variance represents the degree of uncertainty of the expected performance. Exploitation and exploration are two important concepts in Bayesian optimization. If too much emphasis is placed on development, the algorithm may converge to the local optimal solution too early and miss the possibility of the global optimal solution. On the contrary, if too much emphasis is placed on exploration, the algorithm may spend too much time exploring areas that are unlikely to contain the global optimal solution, resulting in inefficiency. In the process of hyperparameter optimization, development tends to select hyperparameter combinations with higher expected mean values on the objective function value, which means that it will use previously evaluated data to select points with higher expected performance as much as possible for the next evaluation; exploration will select hyperparameter combinations with higher expected variances in order to explore the hyperparameter space more extensively and find possible global optimal solutions. In order to make full use of existing information and find the optimal solution while exploring new hyperparameter spaces, it is necessary to reasonably balance development and exploration. The sampling function (AcquisitionFunction, AF) can guide the selection of the next hyperparameter point based on the current objective function value and the uncertainty of the Bayesian model, playing a role in balancing development and exploration. Choosing a suitable sampling function is crucial to optimizing the performance and efficiency of the algorithm. Common sampling functions include:
[0100] (1) Upper Confidence Bound (UCB)
[0101] UCB(x)=μ(x)+νσ(x)……(5)
[0102] Where μ(x) represents the expected mean of the objective function at point x, σ(x) represents the expected standard deviation at point x, and v is the adjustment parameter used to balance the degree of development and exploration. A larger v value will emphasize exploration more, while a smaller v value will emphasize development more.
[0103] (2) Expected Improvement (EI)
[0104]
[0105] In the formula, Φ(·) and φ(·) represent the standard normal cumulative distribution and the standard normal distribution function, respectively, and f(x * ) is the currently known best objective function value, and the EI function measures the probability of reaching or exceeding the current best value f(x *), the next point is selected by maximizing the EI function.
[0106] (3) Probability of Improvement (PI)
[0107] PI(x)=P(f(x)≥f(x * )+c)……(7)
[0108] In the formula, f(x) is the expected value of the objective function at point x, f(x * ) is the currently known best objective function value, c is a threshold that controls the degree of improvement, and the probability improvement function calculates the probability of reaching or exceeding the current best value f(x) at point x. * )+c, that is, the improved probability at the next sampling point.
[0109] This application tunes the three hyperparameters of batch size, initial learning rate, and Dropout in the ResUnet-Transformer model, and their value ranges are shown in Table 2.
[0110] Table 2 Hyperparameter value ranges
[0111]
[0112] After determining the hyperparameter value space, select the confidence upper bound function UCB as the sampling function and Gaussian process regression as the probability proxy model. The hyperparameter process based on Bayesian optimization is as follows: Fig. 9 The optimized hyperparameter values are shown in Table 3.
[0113] Table 3 Hyperparameter values after Bayesian optimization
[0114]
[0115]
[0116] 1.4ResUnet-Transformer prediction results and analysis
[0117] 1.41 Analysis of the impact of the number of iterations
[0118] After determining the initial learning rate, batch size, and Dropout hyperparameters, in order to explore the impact of different iterations on the prediction results, the loss function selected is MSE. Using MSE can ensure that the loss function used in the training and testing stages is consistent with the evaluation index, which helps to comprehensively evaluate the performance of the model. While keeping other parameters unchanged, four iterations are set for comparative analysis, namely, iteration Epoch = 50, 500, 1000, and 1500. The changes in MSE of the training set and the test set when Epoch = 50 and 500 are shown in the figure below. Fig.10 , Fig.11 As shown in Figure 2, when Epoch = 1000 and 1500, the changes in the test set and the test set MSE are recorded every 100 iterations, as shown in Figure 2. Fig.12 , Fig.13 shown.
[0119] From the analysis of the figure, we can see that due to the introduction of Dropout, there is no obvious overfitting phenomenon in the test set and the training set; the error fluctuation of the test set is larger than that of the training set. After about 14 iterations, the error of the test set drops below 0.02. As the number of iterations increases, the error fluctuation of the test set decreases, and the peak is significantly reduced.
[0120] From the analysis of the figure, we can see that when the number of iterations is 500, the error of the training set is significantly reduced, and its mean square error mostly fluctuates around 0.02, which is relatively stable overall; the error of the test set fluctuates more than that of the training set, but it shows an overall downward trend, and the final error also drops to around 0.02. As the number of iterations increases from 50 to 500, the error of the test set does not decrease significantly.
[0121] From the analysis of the figure, we can see that with the increase of the number of iterations, the error of the training set gradually decreases from 0.072 to 0.015, and the later error fluctuates around 0.016; the error fluctuation of the test set is still large compared to the training set. After the number of iterations reaches 600, the error fluctuation of the test set decreases, and the later error mainly fluctuates around 0.018. The error of the test set can be reduced to below 0.016.
[0122] From the analysis of the figure, we can see that after multiple iterations, the error of the training set gradually stabilizes, and the fluctuation is significantly reduced compared to the previous times, and the error further decreases; the error fluctuation of the test set is large. When it converges to a certain value, the error will increase sharply, and then decrease again, but compared with the previous times, the error is significantly reduced, mainly fluctuating around 0.01, and the lowest error of the test set can converge to around 0.006.
[0123] Under different iteration numbers, the training time of the model and the MSE and MAPE of the test set are recorded, and the results are shown in Table 4. The table clearly shows how the test set error changes with the number of iterations. When the number of iterations is 50, the training time is the shortest, only 0.32h, but the test set error is large, with an MSE of 1.82×10 -2 , MAPE is 9.8%; when the number of iterations is 500, the error of the test set does not decrease, and is even slightly higher than the error when the number of iterations is 50. The corresponding training time is increased from 0.32h to 4.03h, which consumes time resources but does not achieve good results; when the number of iterations is 1000, the error of the test set decreases, and the MSE increases from 1.84×10 -2 Reduced to 1.58×10 -2 , and achieved certain results, proving that the number of iterations has an impact on model performance, but the training time of the model further increased, from 4.03h to 8.13h; when the number of iterations is 1500, the test set error is greatly reduced, an order of magnitude lower than the previous times, and the corresponding training time increases from 8.13h to 13.77h. Although the training of the model consumes a certain amount of time, the results obtained are considerable.
[0124] Table 4 Prediction error and training time of the model under different iteration numbers
[0125]
[0126] In order to more intuitively see the changes in the magnetic field with different iteration times, several groups of prediction results are randomly selected under different geometric structure parameter settings for comparison. The comparison results are shown in Figure 2. Fig.14 As shown. From the analysis of the prediction results in the table, it can be seen that when the number of iterations is 50, the prediction result is poor, the magnetic field has a rough overall outline, but the edge magnetic field will show an irregular distribution of "burr-like", which will be correspondingly "deformed" compared to the real three-dimensional magnetic field in space, and the magnetic field distribution is fuzzy; when the number of iterations is 500, this situation has not been improved. The predicted magnetic field distribution has an overall outline, but it is still fuzzy in some areas, especially where the magnetic field change rate is large; when the number of iterations is 1000, the error of the test set is further reduced, the predicted magnetic field distribution has a clear outline, and the "burr-like" phenomenon of the edge magnetic field is alleviated accordingly, but there will be "spots" in some areas; when the number of iterations is 1500, the error of the test set is greatly reduced, and the MSE is reduced to 0.61×10 -2 , MAPE drops below 5%, at which time a clearer magnetic field distribution can be seen, and the "burr-like" phenomenon of the edge magnetic field and the "spot" phenomenon in individual areas are significantly improved.
[0127] To sum up, the more iterations there are, the more obvious the advantages of the method of solving the three-dimensional magnetic field in this application are. The advancement of the ResUnet-Transformer model has been verified. This application uses the three-dimensional point cloud data of the transformer as the input of the ResUnet-Transformer model, and realizes the mapping from geometric structure parameters to the three-dimensional magnetic field. It provides a research idea for deep learning to solve the three-dimensional magnetic field problem, and indirectly illustrates the superiority of the ResUnet-Transformer model.
[0128] Under the above four iteration numbers, a group of prediction results are randomly selected to compare with the finite element simulation results. The point-by-point absolute percentage errors between the predicted values and the true values under different iteration numbers are shown as follows: Fig.15 As shown. From the analysis of the figure, it can be seen that the predicted results under different iteration numbers are quite different from the finite element simulation results. When the iteration number is 50 and 500, although the average absolute percentage error is about 10%, there are obvious errors in places where the magnetic field change rate is large, such as the edge area of the transformer and the iron core corner position; when the iteration number is 1000, the maximum value of the point-by-point absolute percentage error decreases, and the average absolute percentage error has dropped to 7.9%, but it is still not satisfactory from the prediction results; when the iteration number is 1500, the average absolute percentage error is 4.6%. Combined with the prediction results in the table, although there are certain errors in individual areas, the maximum value of the point-by-point absolute percentage error between the predicted value and the true value is about 10%, but the prediction results are very close to the finite element simulation results, with a clearer outline.
[0129] The ResUnet-Transformer model uses 500 sets of sample data and iterates 1500 times to complete the training. The training time is 13.77h. From the perspective of model training, it consumes a certain amount of time cost. If the time for making the sample set is considered, it needs to consume more time cost. However, from a long-term perspective, the trained model can be called multiple times and directly used for the prediction of the spatial magnetic field. It may be more advantageous to use the finite element method to calculate a single sample, but when the geometric structure parameters change, it needs to be recalculated and the prior model cannot be established. Especially in large-scale calculations or multiple calculations, the time required for the finite element method increases exponentially. The first training of the present application method may take a certain amount of time, but it can establish a prior model. When the geometric structure parameters change, it does not need to be recalculated. The magnetic field calculation result can be obtained by giving the model input again. The more the number of calculations or the larger the calculation scale, the more obvious the advantages of the present application method. The present application method can be used in combination with the finite element method to deal with complex engineering problems. When the number of calculations is small or the calculation scale is not large, the finite element method is used to solve. When the number of calculations increases or the structure of the simulation model is complex, the present application method can be used to solve the magnetic field.
[0130] 1.42 Loss Function Impact Analysis
[0131] In order to explore the impact of different loss functions on the model prediction results, the number of iterations was set to 1500, and the values of the initial learning rate, batch size and Dropout were consistent with those in Section 1.3.2. While keeping other parameters unchanged, three loss functions, MSE, MAE and MSE+MAE, were used for comparative analysis. The training time of the model and the MSE and MAPE of the test set were recorded. The comparison results are shown in Table 5.
[0132] Table 5 Prediction error and training time of the model under different loss function conditions
[0133]
[0134] From the table analysis, we can see that when the number of iterations is 1500, there is no obvious difference in the training time of the model, which is roughly maintained within 12-14 hours. However, judging from the performance of the test set, different loss functions will have a certain impact on the prediction performance of the model.
[0135] When the loss function is MAE, the MSE of the test set is 1.36×10 -2 , MAPE is 7.2%, which may be due to the fact that MAE is insensitive to outliers and the relatively small amount of data. Compared with MSE and MSE+MAE, the errors of these two loss functions are relatively large.
[0136] When the loss function is MSE, the error on the test set is significantly reduced compared to the MAE loss function, and the MSE of the test set is 0.61×10 -2 , MAPE is 4.6%.
[0137] When the loss function is MSE+MAE, the error of the test set is further reduced, and the model performance is slightly improved. At this time, the MSE of the test set is 0.44×10 -2 , MAPE is 4.1%. To intuitively see how the MSE of the test set changes with the number of iterations under the three loss functions, the MSE of the test set is recorded every 100 iterations, as shown in Fig.16 As shown, the ordinate in the figure represents the MSE of the test set, and the legend represents three loss functions.
[0138] From the analysis of the figure, we can see that when the loss function is MSE+MAE and MAE, the MSE of the test set fluctuates greatly and has poor robustness. Although from the table data, the error of the test set when the loss function is MSE+MAE is the lowest among the three in the most ideal case, its robustness is poor. When the loss function is MSE, the error of the test set is not much different from that when the loss function is MSE+MAE, and its fluctuation range is small, so overall, when the loss function is set to MSE, the performance of the model is relatively optimal.
[0139] In order to more intuitively see the change of magnetic field under different loss functions, several groups of prediction results are randomly selected under different geometric structure parameter settings for comparison. The comparison results are shown in Figure 2. Fig.17 shown.
[0140] from Fig.17 From the predicted magnetic field results, when the loss function is MAE, the magnetic field distribution predicted by the ResUnet-Transformer model will have a "burr-like" phenomenon in the edge area, which does not conform to the laws of physics. When the loss function is MSE+MAE, the predicted magnetic field is clearer and the edge area of the magnetic field is more uniform, but Fig.16 The analysis shows that the robustness of the test set using MSE+MAE as the loss function is poor. When the loss function is MSE, the predicted magnetic field distribution is less different from that when the loss function is MSE+MAE in the most ideal case, and also has a clearer outline.
[0141] In order to intuitively show the gap between the predicted magnetic field distribution and the finite element simulation results under the three loss functions, a group of predicted results are randomly selected under the above three loss functions for comparison with the finite element simulation results. The point-by-point absolute percentage errors between the predicted values and the true values under different loss functions are shown in Figure 2. Fig.18 shown.
[0142] From the analysis of the figure, we can see that the absolute percentage error of the test set with MAE as the loss function is the largest in the three cases, and there will be obvious errors in the edge area of the magnetic field and the area with a large flux change rate. The maximum value of the point-by-point absolute percentage error in the other two cases is about 10%. From the figure, we can see that the maximum absolute percentage error when MSE is used as the loss function will be larger, which is consistent with the previous analysis.
[0143] In summary, when the number of iterations is 1500, the error of the test set is the largest when the MAE loss function is used. The maximum percentage errors when MSE+MAE and MSE alone are used as loss functions are basically the same, and there is no obvious difference. If we only look at it from the perspective of the best prediction accuracy, MSE+MAE has the highest prediction accuracy when used as a loss function, but the overall error of the test set is very unstable and has poor robustness. Therefore, in order to ensure the robustness and prediction accuracy of the model, it is more appropriate to select MSE as the loss function.
[0144] 1.5 Summary
[0145] Taking the three-dimensional magnetic field problem of the component to be tested as an example, the present invention applies the ResUnet-Transformer model to solve the three-dimensional magnetic field problem and studies the three-dimensional magnetic field prediction method based on point cloud. The specific conclusions are as follows:
[0146] (1) Study the basic characteristics of point cloud data and analyze the characteristics of three-dimensional point cloud data compared with two-dimensional image data. Use point cloud to describe the three-dimensional structure information of amorphous alloy transformers and construct three-dimensional point cloud data sets under different geometric structure parameters;
[0147] (2) The input data is preprocessed using convolution and upsampling operations. The features of the three spatial dimensions of the point cloud data are fused and transformed as the input of the ResUnet-Transformer model. The model hyperparameters are selected based on Bayesian optimization, which can reduce the dependence on human experience to a certain extent.
[0148] (3) The effects of different loss iterations and different loss functions on the model prediction performance were studied. The results show that using MSE as the loss function can obtain a clear three-dimensional magnetic field distribution after 1500 iterations, and the MSE of the test set is 0.61×10 -2 , MAPE is 4.6%.
[0149] Fig.19 The point cloud-based three-dimensional magnetic field prediction system 1900 provided by the present invention is shown, including a point cloud module 1901 , a preprocessing module 1902 and an output module 1903 .
[0150] The point cloud module 1901 is used to describe the three-dimensional structural information of the component to be measured by using the point cloud to obtain a three-dimensional point cloud data set; wherein each three-dimensional point cloud data in the three-dimensional point cloud data set contains the spatial coordinates and the magnitude of the magnetic induction intensity of the point;
[0151] The preprocessing module 1902 is used to preprocess the three-dimensional point cloud data set;
[0152] The output module 1903 is used to input the preprocessed three-dimensional point cloud data set into the network model, and the network model outputs the spatial magnetic field distribution corresponding to the three-dimensional point cloud coordinates.
[0153] In an embodiment of the present invention, the system further includes: a convolution module configured to perform convolution and upsampling operations on the three-dimensional point cloud dataset, and fuse the features of the three-dimensional point cloud dataset in three spatial dimensions respectively, specifically including the following steps:
[0154] The dimension of the point cloud data is changed from 32×32×32 to 1×32×32 through convolution operation;
[0155] After transforming the second, third, and fourth dimensions of the point cloud data to the channel dimension, three similar convolution operations are performed to change the dimension of the point cloud data from 32×32×32 to 3×32×32;
[0156] The dimension-transformed point cloud data is upsampled four times to change the dimension of the point cloud data from 3×32×32 to 3×512×512.
[0157] The above is only a specific implementation of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present disclosure should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A three-dimensional magnetic field prediction method based on point cloud, characterized in that: The method comprises the following steps: The three-dimensional structure information of the component to be measured is described by using the point cloud to obtain a three-dimensional point cloud data set; wherein each three-dimensional point cloud data in the three-dimensional point cloud data set contains the spatial coordinates and the magnitude of the magnetic induction intensity of the point; Preprocessing the three-dimensional point cloud data set; The preprocessed three-dimensional point cloud data set is input into the network model, and the network model outputs the spatial magnetic field distribution corresponding to the three-dimensional point cloud coordinates.
2. The three-dimensional magnetic field prediction method based on point cloud according to claim 1 is characterized in that: The preprocessing of the three-dimensional point cloud data set includes: Convolution and upsampling operations are performed on the three-dimensional point cloud data set to fuse the features of the three spatial dimensions of the three-dimensional point cloud data set, specifically including the following steps: The dimension of the point cloud data is changed from 32×32×32 to 1×32×32 through convolution operation; After transforming the second, third, and fourth dimensions of the point cloud data to the channel dimension, three similar convolution operations are performed to change the dimension of the point cloud data from 32×32×32 to 3×32×32; The dimension-transformed point cloud data is upsampled four times to change the dimension of the point cloud data from 3×32×32 to 3×512×512.
3. The three-dimensional magnetic field prediction method based on point cloud according to claim 1, characterized in that: The method further comprises: training the network model, specifically comprising the following steps: The network model is trained based on the pre-collected samples; the network model uses MSE as the loss function and iterates 1500 times; Based on the Adam optimization algorithm, the cosine annealing algorithm is used to adaptively adjust the learning rate.
4. The three-dimensional magnetic field prediction method based on point cloud according to claim 3 is characterized in that: The method further includes: tuning the hyperparameters of the network model, including: The Optuna hyperparameter optimization framework is used to automatically tune the hyperparameters based on the Bayesian optimization algorithm; the hyperparameters include batch-size, initial learning rate and dropout, and the specific steps include: Determine whether the model is initialized; wherein, when the model is initialized, the sample points selected in the previous round are used to train the proxy model; when the model is not initialized, the initialization points are randomly generated to train the proxy model; The next sample point is selected by using the confidence upper bound function as the acquisition function; whether the sample point satisfies the target value is determined; when it does not meet the target value, the proxy model is trained by using the sample point; when it meets the target value, the sample point is output.
5. The three-dimensional magnetic field prediction method based on point cloud according to any one of claims 1 to 4, characterized in that: The network model is a ResUnet-Transformer model.
6. A three-dimensional magnetic field prediction system based on point cloud, characterized in that: The system comprises: A point cloud module is configured to describe the three-dimensional structural information of the component to be measured using a point cloud to obtain a three-dimensional point cloud data set; wherein each three-dimensional point cloud data in the three-dimensional point cloud data set includes the spatial coordinates and the magnitude of the magnetic induction intensity of the point; A preprocessing module, configured to preprocess the three-dimensional point cloud data set; The output module is configured to input the preprocessed three-dimensional point cloud data set into the network model, and the network model outputs the spatial magnetic field distribution corresponding to the three-dimensional point cloud coordinates.
7. The point cloud-based three-dimensional magnetic field prediction system according to claim 6, characterized in that: The system further comprises: The convolution module is configured to perform convolution and upsampling operations on the three-dimensional point cloud dataset to fuse the features of the three-dimensional point cloud dataset in three spatial dimensions, and specifically includes the following steps: The dimension of the point cloud data is changed from 32×32×32 to 1×32×32 through convolution operation; After transforming the second, third, and fourth dimensions of the point cloud data to the channel dimension, three similar convolution operations are performed to change the dimension of the point cloud data from 32×32×32 to 3×32×32; The dimension-transformed point cloud data is upsampled four times to change the dimension of the point cloud data from 3×32×32 to 3×512×512.