Motor temperature prediction model training method, motor temperature prediction method and device
By pre-training and fine-tuning the motor temperature prediction model, combined with freezing and adjusting the parameters of the coded block, the problems of high cost and low accuracy in the prediction of multiple types of motor temperatures are solved, and efficient and accurate motor temperature prediction is achieved.
Patent Information
- Application Number
- CN202411083970.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-12-20
AI Technical Summary
Existing motor temperature prediction methods require training of a large number of models when facing multiple types of motors, resulting in increased costs and difficult to guarantee prediction accuracy.
Using a motor temperature prediction model training method, by obtaining the target sample data of at least two types of motors, first pre-training the motor temperature prediction model, then fine-tuning the pre-trained model, frozen the parameters of some coded blocks, and not adjusted. Freeze the encoded blocks to obtain the final model.
Improves the prediction accuracy of motor temperature and significantly reduces training costs, avoiding the need to retrain their respective models.
Smart Images

Figure CN119167740A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of motor technology, and in particular to a motor temperature prediction model training method, a motor temperature prediction method and a motor temperature prediction device. Background Art
[0002] The motor is an indispensable component in the vehicle. Due to various factors such as the motor type, the motor temperature change pattern varies among different models. The existing motor temperature prediction method uses a large amount of data from each type of motor to train the corresponding model, and uses the corresponding model to predict the motor temperature based on the data of the corresponding type of motor. However, with the development of technology, more and more types of motors are put into use, which will increase the number of models that need to be trained and the training cost. Summary of the invention
[0003] The main technical problem solved by the present application is to provide a motor temperature prediction model training method, a motor temperature prediction method and a device, which can improve the prediction accuracy of the motor temperature and save costs.
[0004] To solve the above technical problems, the first aspect of the present application provides a method for training a motor temperature prediction model, the method comprising: obtaining target sample data of at least two types of motors, the target sample data comprising first target sample data and second target sample data respectively belonging to different types of motors; using the first target sample data to pre-train the motor temperature prediction model to obtain a pre-trained motor temperature prediction model; using the second target sample data to fine-tune the pre-trained motor temperature prediction model to obtain a final motor temperature prediction model; wherein, during the fine-tuning process, the parameters of at least part of the coding blocks of the pre-trained motor temperature prediction model are frozen, and the parameters of the unfrozen coding blocks are adjusted.
[0005] Among them, the pre-trained motor temperature prediction model is fine-tuned using the second target sample data to obtain the final motor temperature prediction model, including: freezing the parameters of each coding block in turn according to the order of each coding block in the pre-trained motor temperature prediction model, and adjusting the parameters of the unfrozen coding blocks to obtain the final motor temperature prediction model.
[0006] Among them, the currently frozen coding block includes the previously frozen coding block, and the coding block that is arranged after the previously frozen coding block and adjacent to the last coding block in the previously frozen coding block; among them, the first frozen coding block is the bottom-level coding block of the pre-trained motor temperature prediction model.
[0007] Among them, the motor temperature prediction model is pre-trained using the first target sample data to obtain a pre-trained motor temperature prediction model, including: using the motor temperature prediction model to predict based on the first target sample data to obtain a first predicted temperature; based on the difference between the first predicted temperature and the first actual temperature, adjusting the parameters of the motor temperature prediction model to obtain a pre-trained motor temperature prediction model.
[0008] Among them, the pre-trained motor temperature prediction model is fine-tuned using the second target sample data to obtain the final motor temperature prediction model, including: using the pre-trained motor temperature prediction model to make a prediction based on the second target sample data to obtain a second predicted temperature; based on the difference between the second predicted temperature and the second true temperature, adjusting the parameters of the unfrozen coding block in the pre-trained motor temperature prediction model to obtain the pre-trained motor temperature prediction model.
[0009] In the fine-tuning process, the step of freezing the parameters of at least part of the encoding block of the pre-trained motor temperature prediction model is performed multiple times.
[0010] Among them, the pre-trained motor temperature prediction model is fine-tuned using the second target sample data to obtain the final motor temperature prediction model, including: for each freezing process, using the pre-trained motor temperature prediction model to make a prediction based on the second target sample data to obtain a second predicted temperature; based on the difference between the second predicted temperature and the second true temperature, determining the loss; based on the loss, adjusting the parameters of the unfrozen coding blocks in the pre-trained motor temperature prediction model to obtain a candidate motor temperature prediction model; based on the losses corresponding to multiple freezing processes, selecting the final motor temperature prediction model from multiple candidate motor temperature prediction models.
[0011] Wherein, based on the losses corresponding to multiple freezing processes, a final motor temperature prediction model is selected from multiple candidate motor temperature prediction models, including: taking the candidate motor temperature prediction model corresponding to the minimum loss as the final motor temperature prediction model.
[0012] Among them, after pre-training the motor temperature prediction model using the first target sample data to obtain the pre-trained motor temperature prediction model, and before fine-tuning the pre-trained motor temperature prediction model using the second target sample data, it also includes: reducing the hyperparameters of the pre-trained motor temperature prediction model; wherein the hyperparameters include at least one of the learning rate, batch size, and discard rate.
[0013] Among them, the motor temperature prediction model includes a multi-head attention model, which includes multiple sequentially connected encoding blocks and feature aggregation layers.
[0014] Wherein, obtaining sample data of at least two types of motors includes: obtaining initial sample data of at least two types of motors; preprocessing the initial sample data to obtain target sample data; wherein the preprocessing includes at least one of abnormal data elimination and data standardization.
[0015] Among them, preprocessing includes eliminating abnormal data; preprocessing the initial sample data to obtain target sample data, including: eliminating the initial sample data that meets preset conditions in the initial sample data; wherein the preset conditions include that the initial sample data has not changed within a preset time period, and / or the initial sample data meets a preset range, and the preset range is determined based on the mean of the initial sample data and the standard deviation of the initial sample data.
[0016] Among them, the initial sample data includes at least one of data acquisition time, rear motor direct-axis current feedback value, rear motor quadrature-axis current feedback value, rear motor direct-axis voltage feedback value, rear motor quadrature-axis voltage feedback value, rear motor speed, rear motor actual torque feedback value, rear motor temperature, and rear motor water inlet temperature.
[0017] Among them, the preset conditions also include at least one of the following: the rear motor speed and the actual torque feedback value of the rear motor meet the first preset value, the water inlet temperature of the rear motor meets the second preset value, and the direct-axis voltage feedback value of the rear motor and / or the quadrature-axis voltage feedback value of the rear motor meet the third preset value.
[0018] Among them, preprocessing includes data standardization; the initial sample data includes multiple sample feature data; the initial sample data includes first initial sample data and second initial sample data, and the first initial sample data and the second initial sample data belong to different types of motors; the initial sample data are preprocessed to obtain target sample data, including: calculating the mean of each first sample feature data in the first initial sample data, and the standard deviation of each first sample feature data; standardizing each first sample feature data using the mean and standard deviation, and standardizing each second sample feature data in the second initial sample data using the mean and standard deviation.
[0019] To solve the above technical problems, the second aspect of the present application provides a motor temperature prediction method, which includes: obtaining target data of the motor; using a motor temperature prediction model to predict based on the target data to obtain the target temperature of the motor; wherein the motor temperature prediction model is trained using the training method of the motor temperature prediction model provided by the first aspect above.
[0020] To solve the above technical problems, the third aspect of the present application provides an electronic device, which includes a memory and a processor, the memory storing program instructions; the processor is used to execute the program instructions stored in the memory to implement the method provided by the first or second aspect above.
[0021] To solve the above technical problems, the fourth aspect of the present application provides a computer-readable storage medium, which is used to store program instructions, and the program instructions can be executed by a processor to implement the method provided by the first aspect or the second aspect above.
[0022] The beneficial effect of the present application is: different from the prior art, the present application uses the first target sample data to pre-train the motor temperature prediction model to obtain the pre-trained motor temperature prediction model; then uses the second target sample data to fine-tune the pre-trained motor temperature prediction model to obtain the final motor temperature prediction model; wherein, during the fine-tuning process, the parameters of at least part of the coding blocks of the pre-trained motor temperature prediction model are frozen, and the parameters of the unfrozen coding blocks are adjusted. Since the first target sample data and the second target sample data belong to different types of motors, the pre-trained motor temperature prediction model is obtained by training with the first target sample data, so that the pre-trained motor temperature prediction model has the ability to predict the motor temperature; then the pre-trained motor temperature prediction model is fine-tuned using the second target sample data, so that the final motor temperature prediction model can accurately predict the temperature of other types of motors, thereby improving the prediction accuracy of the motor temperature. Compared with using the first target sample data and the second target sample data to train the corresponding models, the solution provided by the present application only needs to use the second target sample data to fine-tune the model after training the model with the first target sample data, without the need for re-training, which can significantly reduce the training cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is a flow chart of an implementation method of a motor temperature prediction model training method provided by the present application;
[0024] Figure 2 It is a schematic diagram of the framework structure of an implementation scheme of a motor temperature prediction model provided by the present application;
[0025] Figure 3 It is a schematic diagram of the framework structure of an implementation scheme of a multi-head attention block provided in this application;
[0026] Figure 4 It is a schematic diagram of the framework structure of an implementation scheme of a feature convergence layer provided by the present application;
[0027] Figure 5 It is a flow chart of another implementation method of the motor temperature prediction model training method provided by the present application;
[0028] Figure 6 is a schematic diagram of a second real temperature and a second predicted temperature corresponding to second target sample data in a test set;
[0029] Figure 7It is a flow chart of an implementation method of a motor temperature prediction method provided by the present application;
[0030] Figure 8 It is a schematic diagram of the framework structure of an embodiment of an electronic device provided by the present application;
[0031] Fig. 9 It is a schematic diagram of the framework structure of an implementation scheme of a computer-readable storage medium provided in this application. DETAILED DESCRIPTION
[0032] The following is a clear and complete description of the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0033] It should be noted that in the embodiments of the present application, there are descriptions involving "first", "second", etc., which are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of the features.
[0034] In the description of the application, the meaning of "multiple" is at least two, for example, two, three, etc., unless otherwise clearly and specifically limited. In the embodiment of the present application, all directional indications (such as up, down, left, right, front, back ...) are only used to explain the relative position relationship, movement, etc. between the components under a certain specific posture (as shown in the drawings). If the specific posture changes, the directional indication also changes accordingly. In addition, the terms "including" and "having" and any of their deformations are intended to cover non-exclusive inclusions. For example, the process, method, system, product or equipment comprising a series of steps or units is not limited to the steps or units listed, but optionally also includes the steps or units not listed, or optionally also includes other steps or units inherent to these processes, methods, products or equipment.
[0035] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0036] Please refer to Figure 1-Figure 4 , Figure 1 is a flow chart of an implementation method of a motor temperature prediction model training method provided by the present application, Figure 2 is a schematic diagram of the framework structure of an implementation scheme of a motor temperature prediction model provided by the present application, Figure 3 It is a schematic diagram of the framework structure of an implementation scheme of a multi-head attention block provided in this application. Figure 4 Schematic diagram of the framework structure of an embodiment of the feature convergence layer provided by the present application. The method comprises:
[0037] S11: Acquire target sample data of at least two types of motors, where the target sample data includes first target sample data and second target sample data belonging to different types of motors.
[0038] The target sample data provided in this embodiment is used to train the motor temperature prediction model. In one embodiment, the target sample data may include data of at least two types of motors, and the at least two types of motors may include motors that have been used for a long time and motors that have been used for a short time, the long time used is, for example, more than 3 months, and the short time used is, for example, less than 3 months. Taking the example that the target sample data includes first target sample data and second target sample data belonging to different types of motors, the first target sample data may be data of a motor that has been used for a long time, and the second target sample data may be data of a motor that has been used for a short time, that is, the amount of data of the first target sample data is greater than the amount of data of the second target sample data.
[0039] In a specific embodiment, the first target sample data may include multiple, each first target sample data corresponds to a type of motor. Similarly, the second target sample data may also include multiple, each second target sample data corresponds to a type of motor. The first target sample data and the second target sample data belong to different types of motors. In a preferred embodiment, the first target sample data and the second target sample data are both 1. For example, the first target sample data may belong to type A motor, and the second target sample data may belong to type B motor.
[0040] In another preferred embodiment, the first target sample data includes a plurality of data, and the second target sample data includes 1 data. For example, the first target sample data may belong to type A motor, type B motor, type C motor, and the second target sample data may belong to type D motor.
[0041] In one embodiment, the target sample data may be initial sample data of at least two types of motors. The initial sample data is collected using sensors on the vehicle where the motors are located. The initial sample data may include but is not limited to at least one of the following: data collection time, rear motor direct-axis current feedback value, rear motor quadrature-axis current feedback value, rear motor direct-axis voltage feedback value, rear motor quadrature-axis voltage feedback value, rear motor speed, rear motor actual torque feedback value, rear motor temperature, and rear motor water inlet temperature.
[0042] In another embodiment, the target sample data may be obtained by preprocessing the initial sample data, where the preprocessing includes but is not limited to at least one of abnormal data removal and data standardization.
[0043] It can be understood that in this embodiment, the target sample data can be the data of the motor at multiple moments, or the data of the motor within a time period. Taking the target sample data including the direct-axis current feedback value of the rear motor as an example, the direct-axis current feedback value of the rear motor can be the feedback value corresponding to multiple moments, or it can be the feedback value within a time period. The feedback value within a time period can be expressed linearly.
[0044] S12: Pre-training the motor temperature prediction model using the first target sample data to obtain a pre-trained motor temperature prediction model.
[0045] In one embodiment, the first target sample data is input into the motor temperature prediction model, and the motor temperature prediction model outputs the first predicted temperature. Based on the difference between the first predicted temperature and the first real temperature corresponding to the first target sample data, the parameters of the motor temperature prediction model are adjusted to obtain a pre-trained motor temperature prediction model. In a specific embodiment, the loss can be determined based on the first predicted temperature and the first real temperature, and then the parameters of the motor temperature prediction model are adjusted based on the loss. Among them, the loss function can use the mean square error, and the loss function expression is shown in the following formula.
[0046]
[0047] Among them, MSE is the mean square error loss, n is the number of the first target sample data, y i is the first real temperature corresponding to the i-th first target sample data, is the first predicted temperature corresponding to the i-th first target sample data.
[0048] During the pre-training process, the hyperparameters of the motor temperature prediction model are set by the user, and the hyperparameters may include at least one of the training round, the learning rate, the batch size, and the dropout rate. In a specific embodiment, during the pre-training process, the training round (epoch) is set to 30, the learning rate is set to 0.0001, the batch size (batch_size) is set to 128, the optimizer uses the Adam optimizer, and the random dropout (dropout) is set to 0.2.
[0049] In one embodiment, the first target sample data can be divided into a training set and a validation set. The motor temperature prediction model is trained using the first target sample data in the training set. The trained motor temperature prediction model is validated using the first target sample data in the validation set. The parameters of the model when the loss on the validation set is minimal are selected to obtain a pre-trained motor temperature prediction model. That is, the model parameters corresponding to the epoch when the loss of the parameters of the pre-trained motor temperature prediction model on the validation set is minimal. In other embodiments, the first target sample data can be divided into a training set, a validation set, and a test set, and the test set is used to test the trained motor temperature prediction model.
[0050] The motor temperature prediction model in the present application may include a multi-head attention model, and may also include at least one of a temporal convolutional network (TCN), a long short-term memory network (LSTM), a recurrent neural network (RNN), etc.
[0051] In a specific implementation, the motor temperature prediction model includes a multi-head attention model, which includes a plurality of sequentially connected encoding blocks and feature aggregation layers. Specifically, Figure 2 As shown in Figure 1, the motor temperature prediction model includes an input embedding layer, 10 encoding blocks, and a feature aggregation layer. The first encoding block is connected to the input embedding layer, and the last encoding block is connected to the feature aggregation layer. The structure of each encoding block is the same, including a multi-head attention block connected in sequence, a residual connection and a batch normalization layer, a feedforward layer, another residual connection and a batch normalization layer.
[0052] Specifically, each target sample data is converted into an embedding vector through the input embedding layer, and the embedding vector can be a vector matrix x with a time step of n and a feature number of m (in one embodiment, m=7) n×m Then, position information is added to each embedding vector by fixed position encoding based on sine and cosine functions. In order to keep the framework of all encoder blocks the same, for example, h heads are set in the multi-head attention layer, and each head extracts k features. So in the vector matrix x n×m Before being passed to the multi-head attention block, it needs to pass through a fully connected layer to convert it into a feature vector matrix X with a total number of features of d = h × k n×d .
[0053] In each sublayer of the Encoder, residual connections are used. For example, for the multi-head attention block in the first sublayer of the Encoder, the feature vector matrix X n×d The output through this layer is sublayer(X n×d ), and then pass through a residual connection to satisfy X n×d +sublayer(X n×d ), after the addition calculation of the residual connection, batch normalization is applied to obtain the final output of the first sub-layer. The first sub-layer includes a multi-head attention block, a residual connection and a batch normalization layer. The residual connection allows the shallow features of the network to be used in the deep layer, and batch normalization keeps the mean variance of the input of each batch consistent. The second sub-layer position-based feedforward network uses two fully connected layers. The first fully connected layer uses the ReLU activation function, and the second fully connected layer does not use the activation function. Position-based means that the feature vector of each position or time step is transformed in the same way, which enhances the representation ability of the feature and introduces nonlinearity. The second sub-layer includes a feedforward layer, another residual connection and a batch normalization layer.
[0054] Among them, Figure 3 As shown in Figure 1, the multi-head attention block includes two fully connected layers and at least two attention layers. After the query, key, and value are processed by the first fully connected layer, they are input to each attention layer for processing. The features processed by each attention layer are connected and then input to the second fully connected layer for processing. For the multi-head attention block of the first encoding block, the query, key, and value are all from the feature vector matrix X n×d ,For the multi-head attention blocks other than the first encoding block, the query,key and value all come from the output of the previous encoding block.
[0055] Furthermore, the output of the last coding block is input into the feature aggregation layer, which processes the output to obtain the predicted value of the motor temperature. The feature aggregation layer is used to comprehensively consider the information of the n time series vectors output by the coding block and convert them into a feature vector for model prediction. Specifically, Figure 4 As shown in the figure, for the n input time series vectors, the length dimension of the time series vector is regarded as the channel dimension, and the position dimension of the time series vector is regarded as the feature dimension. The n time series vectors are compressed into a vector of length n using a one-dimensional convolution kernel. In this process, the ReLU activation function can be used, and after normalization, it is input into a fully connected layer to be converted into a weight vector of length n. The fully connected layer can use the Sigmoid activation function and perform normalization. Finally, the weight vector of length n is multiplied with the original input n time series vectors to obtain a vector of length d, which is then input into the fully connected layer to obtain the final motor temperature prediction value.
[0056] S13: fine-tuning the pre-trained motor temperature prediction model using the second target sample data to obtain a final motor temperature prediction model.
[0057] In one embodiment, during the fine-tuning process, the parameters of at least part of the coding blocks of the pre-trained motor temperature prediction model can be frozen, and the parameters of the unfrozen coding blocks can be adjusted. The fine-tuning process can specifically be to use the pre-trained motor temperature prediction model to make a prediction based on the second target sample data to obtain a second predicted temperature; based on the difference between the second predicted temperature and the second actual temperature, adjust the parameters of the unfrozen coding blocks in the pre-trained motor temperature prediction model to obtain the pre-trained motor temperature prediction model.
[0058] Among them, during the fine-tuning process, the step of freezing the parameters of at least part of the coding blocks of the pre-trained motor temperature prediction model can be executed only once, or it can be executed multiple times. If the freezing step is executed multiple times, the parameters of each coding block can be frozen in turn according to the order of the coding blocks in the pre-trained motor temperature prediction model, and the parameters of the unfrozen coding blocks can be adjusted to obtain the final motor temperature prediction model.
[0059] The pre-trained motor temperature prediction model may include an input embedding layer, a plurality of sequentially connected coding blocks, and a feature aggregation layer, wherein the first coding block among the sequentially connected coding blocks is connected to the input embedding layer, the first coding block is the coding block at the bottom layer of the pre-trained motor temperature prediction model, and the last coding block among the sequentially connected coding blocks is connected to the feature aggregation layer. In one embodiment, one coding block may be frozen sequentially, for example, the first coding block is frozen for the first time, the second coding block is frozen for the second time, and so on.
[0060] In a specific implementation, the coding blocks to be frozen each time can be determined in the following manner, and each freezing process is regarded as the current freezing, and the coding blocks to be frozen in the current time include the coding blocks frozen in the previous time, and the coding blocks arranged after the coding blocks frozen in the previous time and adjacent to the last coding block in the coding blocks frozen in the previous time; wherein, the coding blocks frozen for the first time are the coding blocks at the bottom layer of the pre-trained motor temperature prediction model. Taking the pre-trained motor temperature prediction model as an example, which includes 10 coding blocks connected in sequence, the 10 coding blocks are numbered 1-10 respectively, the parameters of coding block 1 are frozen for the first time, and the parameters of coding blocks 2 to 9 are adjusted; the parameters of coding blocks 1 and 2 are frozen for the second time, and the parameters of coding blocks 3 to 9 are adjusted; the parameters of coding blocks 1 to 3 are frozen for the third time, and the parameters of coding blocks 4 to 9 are adjusted, and so on, until the parameters of all coding blocks are frozen.
[0061] If the steps of freezing the parameters of at least part of the coding blocks of the pre-trained motor temperature prediction model are performed multiple times during the fine-tuning process, for each freezing process, the pre-trained motor temperature prediction model is used to predict based on the second target sample data to obtain a second predicted temperature; based on the difference between the second predicted temperature and the second real temperature, the loss is determined; based on the loss, the parameters of the unfrozen coding blocks in the pre-trained motor temperature prediction model are adjusted to obtain a candidate motor temperature prediction model; based on the losses corresponding to the multiple freezing processes, the final motor temperature prediction model is selected from multiple candidate motor temperature prediction models. Among them, the loss can be obtained using a mean square error loss function.
[0062] In one embodiment, based on the losses corresponding to multiple freezing processes, a final motor temperature prediction model is selected from multiple candidate motor temperature prediction models, including: taking the candidate motor temperature prediction model corresponding to the minimum loss as the final motor temperature prediction model.
[0063] It can be understood that when the pre-trained motor temperature prediction model is fine-tuned using the second target sample data, the second target sample data can be divided into a training set and a validation set, and the parameters of the unfrozen coding blocks in the pre-trained motor temperature prediction model are adjusted based on the difference between the second predicted temperature and the second actual temperature corresponding to the second target sample data in the training set. The loss is determined using the difference between the second predicted temperature and the second actual temperature corresponding to the second target sample data in the validation set, and the parameters of the pre-trained motor temperature prediction model can be selectively updated based on the loss. If there are multiple freezing processes, the candidate motor temperature prediction model corresponding to the smallest loss on the validation set is selected as the final motor temperature prediction model.
[0064] In one embodiment, after the motor temperature prediction model is pre-trained using the first target sample data to obtain the pre-trained motor temperature prediction model, and before the pre-trained motor temperature prediction model is fine-tuned using the second target sample data, the hyperparameters of the pre-trained motor temperature prediction model can be reduced; wherein the hyperparameters include at least one of the learning rate, batch size, and dropout rate. For example, in the process of pre-training the motor temperature prediction model, the learning rate is set to 0.0001, the batch size is set to 128, and the random dropout is set to 0.2 in the hyperparameters of the motor temperature prediction model; when fine-tuning the pre-trained motor temperature prediction model, the learning rate is set to 0.000001, the batch size is set to 64, and the random dropout is set to 0 in the hyperparameters of the pre-trained motor temperature prediction model.
[0065] In the above method, the motor temperature prediction model is pre-trained using the first target sample data to obtain a pre-trained motor temperature prediction model; the pre-trained motor temperature prediction model is fine-tuned using the second target sample data to obtain the final motor temperature prediction model; wherein, during the fine-tuning process, the parameters of at least part of the coding blocks of the pre-trained motor temperature prediction model are frozen, and the parameters of the unfrozen coding blocks are adjusted. Since the first target sample data and the second target sample data belong to different types of motors, the pre-trained motor temperature prediction model is obtained by training with the first target sample data, so that the pre-trained motor temperature prediction model has the ability to predict the motor temperature; the pre-trained motor temperature prediction model is fine-tuned using the second target sample data, so that the final motor temperature prediction model can accurately predict the temperature of other types of motors, thereby improving the prediction accuracy of the motor temperature. Compared with using the first target sample data and the second target sample data to train the corresponding models, the solution provided by the present application only needs to use the second target sample data to fine-tune the model after training the model with the first target sample data, without the need for re-training, which can significantly reduce the training cost.
[0066] In other embodiments, in addition to the pre-training-fine-tuning training method provided in this application, other transfer learning algorithms may also be used, such as domain adaptation methods, which are mainly divided into sample weight transfer method, feature transformation transfer method and model pre-training transfer method. The key to the sample weight transfer method is to consider the similarity between the first target sample data and the second target sample data, and to maximize the similarity between the sample subset extracted from the first target sample data and the second target sample data by learning the weights of the source domain samples; the idea of the feature change transfer method is that both the first target sample data and the second target sample data are very important and cannot be screened by weights, so consider projecting the first target sample data and the second target sample data to a common feature subspace so that the sample distributions of the two are consistent in the subspace, and at this time, a feature transformation function needs to be learned.
[0067] See also Figure 5 , Figure 5 : is a flow chart of another embodiment of the motor temperature prediction model training method provided by the present application, the method comprising:
[0068] S51: Acquire initial sample data of at least two types of motors.
[0069] In one embodiment, the initial sample data may be detected by a sensor on the vehicle where the motor is located. The initial sample data may include first initial sample data and second initial sample data, and the first initial sample data and the second initial sample data belong to different types of motors. In one embodiment, the first initial sample data may be data of a motor that has been used for a long time, and the second initial sample data may be data of a motor that has been used for a short time, that is, the data volume of the first initial sample data is greater than the data volume of the second initial sample data.
[0070] The first initial sample data and the second initial sample data may include at least one of data acquisition time, rear motor direct axis current feedback value, rear motor quadrature axis current feedback value, rear motor direct axis voltage feedback value, rear motor quadrature axis voltage feedback value, rear motor speed, rear motor actual torque feedback value, rear motor temperature, rear motor water inlet temperature, and ON2 power supply. The ON2 power supply is used to supply power to the vehicle where the motor is located.
[0071] S52: Preprocess the initial sample data to obtain target sample data.
[0072] The target sample data includes first target sample data and second target sample data belonging to different types of motors, respectively. The first target sample data is obtained by preprocessing the first initial sample data, and the second target sample data is obtained by preprocessing the second initial sample data. In one embodiment, a source domain data set and a target domain data set can be established, and the first target sample data is stored in the source domain data set, and the second target sample data is stored in the target domain data set. The preprocessing may include at least one of abnormal data removal and data standardization.
[0073] In one embodiment, the preprocessing may include the elimination of abnormal data. The initial sample data may be the motor data within a period of time, and the period of time may be a driving segment of the vehicle. By determining the driving segment of the vehicle where the motor is located, the abnormal driving segment in the driving segment is eliminated to obtain the motor data in the remaining driving segment, and the motor data in the remaining driving segment is the target sample data. Specifically, the segment in the power-on state signal can be retained by the ON2 power signal to obtain the initial driving segment. It can be understood that the initial driving segment may include multiple, each initial driving segment represents the time period from the start-up to the shutdown of the ON2 power supply. In each driving segment, the initial sample data that meets the preset conditions in the initial sample data can be eliminated, and the preset conditions include that the initial sample data does not change within the preset time period, and / or the initial sample data meets the preset range, and the preset range is determined based on the mean of the initial sample data and the standard deviation of the initial sample data; the preset conditions may also include at least one of the following: the rear motor speed and the rear motor actual torque feedback value meet the first preset value, the rear motor water inlet temperature meets the second preset value, and the rear motor direct axis voltage feedback value and / or the rear motor quadrature axis voltage feedback value meet the third preset value.
[0074] In a specific embodiment, the first preset value is 0, then in each driving segment, the data points where the rear motor speed is 0 and the actual torque feedback value of the rear motor is 0 can be eliminated. After elimination, it can be calculated whether the interval between two adjacent time points is greater than the preset time interval. If greater, the driving segment is subdivided into multiple driving segments.
[0075] In a specific embodiment, the second preset value can be set to 100, and the third preset value can be set to 800. Then, in each driving segment, the data points where the rear motor water inlet temperature exceeds 100 can be deleted; the data points where the rear motor direct-axis voltage feedback value and / or the rear motor quadrature-axis voltage feedback value exceeds 800 can be deleted.
[0076] In a specific embodiment, the preset condition includes that the initial sample data does not change within a preset time period. If the initial sample data is the temperature of the water inlet of the rear motor, the preset condition is that the temperature of the water inlet of the rear motor does not change within the first preset time period, and the first preset time period can be 10 minutes, or it can be the time period where 200 sampling points are located. That is, in each driving segment, the segment where the temperature of the water inlet of the rear motor does not change within a duration of about 10 minutes in 200 sampling points can be eliminated. If the initial sample data is other data except the temperature of the water inlet of the rear motor, the preset condition is that the other data except the temperature of the water inlet of the rear motor does not change within a second preset time period, and the first preset time period can be 1 minute, or it can be the time period where 20 sampling points are located. Taking the initial sample data as the feedback value of the direct-axis current of the rear motor as an example, the segment where the feedback value of the direct-axis current of the rear motor does not change within a duration of about 1 minute in 20 consecutive sampling points in the driving segment can be deleted.
[0077] In a specific embodiment, the preset condition includes that the initial sample data satisfies the preset range, and the preset range is determined based on the mean of the initial sample data and the standard deviation of the initial sample data. At this time, the initial sample data is any one of the data acquisition time, the rear motor direct axis current feedback value, the rear motor quadrature axis current feedback value, the rear motor direct axis voltage feedback value, the rear motor quadrature axis voltage feedback value, the rear motor speed, the rear motor actual torque feedback value, the rear motor temperature, and the rear motor water inlet temperature. Taking the rear motor direct axis current feedback value as the initial sample data as an example, the mean and standard deviation of the rear motor direct axis current feedback value in all driving segments are calculated, and the preset range is obtained by adding and subtracting 3 times the standard deviation from the mean, and the segments in the current driving segment where the rear motor direct axis current feedback value falls within the preset range are eliminated.
[0078] It is understandable that the above preset conditions, preset values, preset time periods, and preset ranges are all illustrative, and in other implementations, they are not limited to the above examples. By preprocessing the initial sample data to obtain the target sample data, the accuracy of the target sample data can be improved.
[0079] In other implementations, abnormal data removal may also use methods such as box plots and isolation forests.
[0080] In another embodiment, the preprocessing may include data standardization. The initial sample data includes a plurality of sample feature data; the initial sample data includes a first initial sample data and a second initial sample data, the first initial sample data and the second initial sample data belong to different types of motors, the first initial sample data includes a plurality of first sample feature data, and the second initial sample data includes a plurality of second sample feature data. The mean of each first sample feature data in the first initial sample data and the standard deviation of each first sample feature data are calculated; each first sample feature data is standardized using the mean and the standard deviation, and each second sample feature data in the second initial sample data is standardized using the mean and the standard deviation.
[0081] Specifically, the first initial sample data and the second initial sample data may include at least one of data acquisition time, rear motor direct axis current feedback value, rear motor quadrature axis current feedback value, rear motor direct axis voltage feedback value, rear motor quadrature axis voltage feedback value, rear motor speed, rear motor actual torque feedback value, rear motor temperature, and rear motor water inlet temperature. Among them, the data acquisition time belongs to a sample characteristic data, and the rear motor direct axis current feedback value also belongs to a sample characteristic data.
[0082] Taking the rear motor temperature as an example, the mean of all rear motor temperatures in the first initial sample data and the standard deviation of the rear motor temperature are calculated; all rear motor temperatures in the first initial sample data are standardized using the mean and standard deviation, and all rear motor temperatures in the second initial sample data are standardized using the mean and standard deviation. It can be understood that other sample feature data are also standardized in this way, which will not be described in detail here.
[0083] In one embodiment, the standardization may specifically adopt a Z-Score standardization method, and the Z-Score standardization method is shown in the following formula.
[0084]
[0085] Where x′ is the deviation from the mean in units of standard deviation, x is the first sample feature data or the second sample feature data, is the mean of each first sample feature data, and σ is the standard deviation of each first sample feature data.
[0086] In the above implementation mode, each second sample feature data in the second initial sample data is standardized using the mean and standard deviation of each first sample feature data in the first initial sample data. Since the number of the first initial sample data is much larger than the number of the second initial sample data, and the first initial sample data is data of a motor that has been used for a long time, the first initial sample data has a higher accuracy rate. The standardization using the mean and standard deviation of each first sample feature data contained therein has a higher accuracy rate.
[0087] It is understandable that in other embodiments, the mean and standard deviation of each first sample characteristic data in the first initial sample data and each second sample characteristic data in the second initial sample data can also be calculated, and then each first sample characteristic data is standardized using the mean and standard deviation, and each second sample characteristic data in the second initial sample data is standardized using the mean and standard deviation. Similarly, taking the rear motor temperature as an example of the sample characteristic data, the mean of all rear motor temperatures in the first initial sample data and all rear motor temperatures in the second initial sample data, and the standard deviation of all rear motor temperatures in the first initial sample data and all rear motor temperatures in the second initial sample data are calculated; all rear motor temperatures in the first initial sample data are standardized using the mean and standard deviation, and all rear motor temperatures in the second initial sample data are standardized using the mean and standard deviation.
[0088] S53: Pre-training the motor temperature prediction model using the first target sample data to obtain a pre-trained motor temperature prediction model.
[0089] S54: fine-tuning the pre-trained motor temperature prediction model using the second target sample data to obtain a final motor temperature prediction model.
[0090] For the specific implementation of steps S53 and S54, please refer to steps S12 and S13 in the above implementation, which will not be described again here.
[0091] To further illustrate the effect of the motor temperature prediction model obtained by the training method provided above, the following test data are provided (please refer to Table 1 and Figure 6). As shown in Table 1, after freezing part of the coding blocks of the pre-trained motor temperature prediction model during the fine-tuning process, the pre-trained motor temperature prediction model is used to predict based on the second target sample data to obtain a second predicted temperature, and based on the difference between the second predicted temperature and the second true temperature, the loss is determined. That is, Table 1 characterizes the relationship between the number of frozen coding blocks and the loss. Among them, the coding blocks currently frozen include the coding blocks frozen last time, and the coding blocks that are arranged after the coding blocks frozen last time and are adjacent to the last coding block in the coding blocks frozen last time; wherein, the coding blocks frozen for the first time are the coding blocks at the bottom layer of the pre-trained motor temperature prediction model.
[0092] Table 1 Relationship between the number of frozen coding blocks and loss
[0093]
[0094]
[0095] It can be seen from Table 1 that when the number of frozen coding blocks is 3, the minimum loss is 7.3862. Before fine-tuning the pre-trained motor temperature prediction model, the second target sample data is tested using the pre-trained motor temperature prediction model, and the loss obtained by the test is 67.2343, which is much larger than the loss obtained after fine-tuning. It can be seen that the pre-trained motor temperature prediction model trained using the first target sample data of one type of motor has very poor accuracy when predicting the temperature of another type of motor. After the present application fine-tunes the pre-trained motor temperature prediction model using the second target sample data, the final motor temperature prediction model significantly improves the accuracy when predicting the temperature of another type of motor based on the second target sample data of another type of motor. Furthermore, the present application only needs to fine-tune the pre-trained motor temperature prediction model, which can save model training time.
[0096] In one embodiment, the second target sample data includes second target sample data in a training set and second target sample data in a test set. The second target sample data in the training set is used to train the pre-trained motor temperature prediction model, and the second target sample data in the test set is used to test the pre-trained motor temperature prediction model after training. Figure 6 is a schematic diagram of the second real temperature and the second predicted temperature corresponding to the second target sample data in the test set. Figure 6 It can be seen that the second predicted temperature is close to the second real temperature, which can indicate that after the pre-trained motor temperature prediction model is trained using the second target sample data in the training set, the final motor temperature prediction model obtained can more accurately predict the temperature of the motor.
[0097] See also Figure 7 , Figure 7 : is a flow chart of an embodiment of a method for predicting motor temperature provided by the present application, the method comprising:
[0098] S71: Acquire target data of the motor.
[0099] In one implementation, the target data of the motor may be data generated by a motor that has been used for a shorter time. A motor that has been used for a shorter time may also be understood as a motor that has been on the market for a shorter time or has generated less data.
[0100] S72: Use the motor temperature prediction model to perform prediction based on the target data to obtain a target temperature of the motor.
[0101] The motor temperature prediction model can be trained using any of the motor temperature prediction model training method embodiments provided above. In a specific embodiment, the motor temperature prediction model is pre-trained using the first target sample data to obtain a pre-trained motor temperature prediction model, and then the pre-trained motor temperature prediction model is fine-tuned using the second target sample data to obtain a final motor temperature prediction model. The second target sample data may include data generated by the target motor, the target motor and the motor corresponding to the target data may belong to the same type, and the first target sample data and the second target sample data belong to different types of motors, respectively.
[0102] See also Figure 8 , Figure 8 It is a schematic diagram of the framework structure of an embodiment of an electronic device provided in the present application.
[0103] The electronic device 80 includes a memory 81 and a processor 82 coupled to each other, the memory 81 stores program instructions, and the processor 82 is used to execute the program instructions to implement the steps in any of the above method embodiments. Specifically, the electronic device 80 may include but is not limited to: a desktop computer, a laptop computer, a server, a mobile phone, a tablet computer, etc., which are not limited here.
[0104] Specifically, the processor 82 is used to control itself and the memory 81 to implement the steps in any of the above method embodiments. The processor 82 can also be called a CPU (Central Processing Unit). The processor 82 may be an integrated circuit chip with signal processing capabilities. The processor 82 can also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 82 can be implemented by an integrated circuit chip.
[0105] See also Fig. 9 , Fig. 9 It is a schematic diagram of the framework structure of an implementation scheme of a computer-readable storage medium provided in this application.
[0106] The computer-readable storage medium 90 stores program instructions 91 , which are used to implement the steps in any of the above method embodiments when executed by a processor.
[0107] The computer-readable storage medium 90 may specifically be a medium that can store computer programs, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or may be a server that stores the computer program. The server may send the stored computer program to other devices for execution, or may also execute the stored computer program itself.
[0108] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
[0109] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A motor temperature prediction model training method, characterized in that: include: Acquire target sample data of at least two types of motors, wherein the target sample data includes first target sample data and second target sample data respectively belonging to different types of motors; Pre-training a motor temperature prediction model using the first target sample data to obtain a pre-trained motor temperature prediction model; The pre-trained motor temperature prediction model is fine-tuned using the second target sample data to obtain a final motor temperature prediction model; wherein, during the fine-tuning process, parameters of at least part of the coding blocks of the pre-trained motor temperature prediction model are frozen, and parameters of the unfrozen coding blocks are adjusted.
2. The method according to claim 1, characterized in that The method of fine-tuning the pre-trained motor temperature prediction model by using the second target sample data to obtain a final motor temperature prediction model includes: According to the order of the coding blocks in the pre-trained motor temperature prediction model, the parameters of the coding blocks are frozen in sequence, and the parameters of the unfrozen coding blocks are adjusted to obtain the final motor temperature prediction model.
3. The method according to claim 2, characterized in that The coding block currently frozen includes the coding block frozen last time, and the coding block that is arranged after the coding block frozen last time and adjacent to the last coding block in the coding block frozen last time; wherein, the coding block frozen for the first time is the bottom-level coding block of the pre-trained motor temperature prediction model.
4. The method according to claim 1, characterized in that: The method of pre-training the motor temperature prediction model by using the first target sample data to obtain the pre-trained motor temperature prediction model includes: Using the motor temperature prediction model to make a prediction based on the first target sample data to obtain a first predicted temperature; based on the difference between the first predicted temperature and the first real temperature, adjusting the parameters of the motor temperature prediction model to obtain the pre-trained motor temperature prediction model; And / or, using the second target sample data to fine-tune the pre-trained motor temperature prediction model to obtain a final motor temperature prediction model, including: The pre-trained motor temperature prediction model is used to perform prediction based on the second target sample data to obtain a second predicted temperature; based on the difference between the second predicted temperature and the second actual temperature, the parameters of the unfrozen coding block in the pre-trained motor temperature prediction model are adjusted to obtain the pre-trained motor temperature prediction model.
5. The method according to claim 1, characterized in that During the fine-tuning process, the step of freezing the parameters of at least part of the encoding block of the pre-trained motor temperature prediction model is performed multiple times; The method of fine-tuning the pre-trained motor temperature prediction model by using the second target sample data to obtain a final motor temperature prediction model includes: For each freezing process, using the pre-trained motor temperature prediction model to perform prediction based on the second target sample data to obtain a second predicted temperature; Determine a loss based on a difference between the second predicted temperature and the second real temperature; adjust parameters of the unfrozen coding block in the pre-trained motor temperature prediction model based on the loss to obtain a candidate motor temperature prediction model; Based on the losses corresponding to the multiple freezing processes, the final motor temperature prediction model is selected from a plurality of candidate motor temperature prediction models.
6. The method according to claim 5, characterized in that The final motor temperature prediction model is selected from a plurality of candidate motor temperature prediction models based on the losses corresponding to the multiple freezing processes, comprising: The candidate motor temperature prediction model corresponding to the minimum loss is used as the final motor temperature prediction model.
7. The method according to claim 1, characterized in that After the motor temperature prediction model is pre-trained by using the first target sample data to obtain the pre-trained motor temperature prediction model, and before the pre-trained motor temperature prediction model is fine-tuned by using the second target sample data, the method further includes: Reduce the hyperparameters of the pre-trained motor temperature prediction model; wherein the hyperparameters include at least one of a learning rate, a batch size, and a dropout rate.
8. The method according to claim 1, characterized in that The motor temperature prediction model includes a multi-head attention model, which includes a plurality of encoding blocks and feature aggregation layers connected in sequence.
9. The method according to claim 1, characterized in that: The step of obtaining target sample data of at least two types of motors includes: Acquiring initial sample data of the at least two types of motors; The initial sample data is preprocessed to obtain the target sample data; wherein the preprocessing includes at least one of abnormal data elimination and data standardization.
10. The method according to claim 9, characterized in that The preprocessing includes abnormal data elimination; The preprocessing of the initial sample data to obtain the target sample data includes: The initial sample data that meets preset conditions in the initial sample data are eliminated; wherein the preset conditions include that the initial sample data has not changed within a preset time period, and / or the initial sample data meets a preset range, and the preset range is determined based on the mean of the initial sample data and the standard deviation of the initial sample data.
11. The method according to claim 10, characterized in that The initial sample data includes at least one of data acquisition time, a rear motor direct-axis current feedback value, a rear motor quadrature-axis current feedback value, a rear motor direct-axis voltage feedback value, a rear motor quadrature-axis voltage feedback value, a rear motor speed, a rear motor actual torque feedback value, a rear motor temperature, and a rear motor water inlet temperature; The preset condition also includes at least one of the following: The rear motor speed and the rear motor actual torque feedback value meet the first preset value, the rear motor water inlet temperature meets the second preset value, and the rear motor direct-axis voltage feedback value and / or the rear motor quadrature-axis voltage feedback value meet the third preset value.
12. The method according to claim 9, characterized in that The preprocessing includes data standardization; the initial sample data includes a plurality of sample feature data; the initial sample data includes a first initial sample data and a second initial sample data, the first initial sample data and the second initial sample data belong to different types of motors; The preprocessing of the initial sample data to obtain the target sample data includes: Calculating the mean of each first sample characteristic data in the first initial sample data and the standard deviation of each first sample characteristic data; The first sample characteristic data are standardized using the mean and the standard deviation, and the second sample characteristic data in the second initial sample data are standardized using the mean and the standard deviation.
13. A method for predicting motor temperature, characterized in that: include: Get the target data of the motor; A motor temperature prediction model is used to perform prediction based on the target data to obtain a target temperature of the motor; wherein the motor temperature prediction model is trained using the motor temperature prediction model training method described in any one of claims 1-12.
14. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores program instructions; The processor is used to execute the program instructions stored in the memory to implement the method according to any one of claims 1 to 13.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store program instructions, and the program instructions can be executed by a processor to implement the method according to any one of claims 1 to 13.
Citation Information
Cited By
Model training method and device, rotor temperature determination method and device, electronic equipment and storage medium
CN121188479A
