A model training method, system, device and storage medium
Patent Information
- Application Number
- CN202611197987.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-07
- Publication Date
- 2026-10-16
AI Technical Summary
[0004]然而,现有技术中各滑动窗口作为独立样本训练,未考虑跨窗口时序一致性约束,导致相邻窗口预测结果在重叠时间点存在较大偏差,尾端点序列产生高频抖动,且预测步长越长抖动越严重
[0005]为了解决上述技术问题或者至少部分地解决上述技术问题,本公开提供了一种模型训练方法、系统、设备和存储介质。
Smart Images

Figure CN122926013A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computers, and more particularly to a model training method, system, device, and storage medium. Background Technology
[0002] As smart devices develop towards intelligence, using artificial intelligence technology to accurately predict motion posture has become an important means to improve the motion control and interactive experience of robots and intelligent vehicles.
[0003] Existing technologies mainly use inertial measurement units (IMUs) to collect attitude data, extract samples from continuous time series through a sliding window sampling method, and train a time series prediction model. Each window is used independently as a training sample, and the model is trained using historical data as input and future multi-step data as labels.
[0004] However, in existing technologies, each sliding window is trained as an independent sample, without considering cross-window temporal consistency constraints. This leads to significant deviations in prediction results between adjacent windows at overlapping time points, resulting in high-frequency jitter in the tail endpoint sequence, with the jitter becoming more severe as the prediction step size increases. Furthermore, existing loss functions only constrain the continuity within a single prediction, failing to address the temporal inconsistency problem between multiple predictions. Summary of the Invention
[0005] To address, or at least partially address, the aforementioned technical problems, this disclosure provides a model training method, system, device, and storage medium.
[0006] A first aspect of this disclosure provides a model training method, comprising: acquiring a data sequence of a target object over consecutive time steps; using a sliding window to extract multiple sample segments from the data sequence, the multiple sample segments including at least adjacent first sample segments and second sample segments, the first sample segment including a first data segment and a first label segment, the second sample segment including a second data segment and a second label segment, the first label segment and the second label segment having overlapping time steps; using a target model to process the first data segment and the second data segment respectively to obtain a first prediction segment corresponding to the first data segment and a second prediction segment corresponding to the second data segment; and updating the parameters of the target model based on the differences between the first prediction segment and the first label segment, the differences between the second prediction segment and the second label segment, and the differences between the first prediction segment and the second prediction segment.
[0007] In some embodiments, updating the parameters of the target model based on the differences between the first predicted segment and the first labeled segment, the differences between the second predicted segment and the second labeled segment, and the differences between the first predicted segment and the second predicted segment includes: determining a first loss function based on the differences between the first predicted segment and the first labeled segment, and the differences between the second predicted segment and the second labeled segment, wherein the first loss function is used to constrain the single-window prediction accuracy of the target model output; determining a second loss function based on the differences between the first predicted segment and the second predicted segment, wherein the second loss function is used to constrain the cross-window temporal coherence of the target model output; and updating the parameters of the target model using the first loss function and the second loss function.
[0008] In some embodiments, determining a second loss function based on the difference between a first prediction segment and a second prediction segment includes: obtaining a first sub-segment corresponding to an overlapping time step from the first prediction segment and obtaining a second sub-segment corresponding to an overlapping time step from the second prediction segment; and determining the second loss function based on the difference between the first sub-segment and the second sub-segment at at least one identical time step in the overlapping time step.
[0009] In some embodiments, updating the parameters of the target model using a first loss function and a second loss function includes: weighting and fusing the first loss function and the second loss function according to preset weights to obtain a total loss function; and updating the network parameters of the target model through backpropagation based on the total loss.
[0010] In some embodiments, the method further includes: acquiring target window data, the target window data including a data sequence at a first consecutive time step; generating a prediction sequence at a second consecutive time step based on the target window data using a trained target model, the first consecutive time step and the second consecutive time step being adjacent; acquiring target data at a preset time step from the prediction sequence; storing the target data in a cache area, the cache area including multiple historical target data, the multiple historical target data corresponding to data at the preset time step in the prediction sequence corresponding to the multiple historical window data respectively.
[0011] In some embodiments, the method further includes: acquiring a set of target data in a cache region, the set of target data including target data and multiple historical target data; determining data change characteristics of the set of target data, the data change characteristics being used to characterize the degree of data oscillation in the set of target data; determining a dynamic filtering window size for the set of target data based on the data change characteristics; and outputting a smoothed output value for the target window data based on the dynamic filtering window size.
[0012] In some embodiments, outputting a smoothed output value for target window data based on the dynamic filtering window size includes: outputting target data as a smoothed output value in response to the dynamic filtering window size being less than or equal to a preset threshold; and selecting a number of data equal to the dynamic filtering window size from a set of target data for smoothing processing in response to the dynamic filtering window size being greater than the preset threshold, and outputting the processing result as a smoothed output value.
[0013] A second aspect of this disclosure provides a system for model training, comprising: an acquisition module for acquiring a data sequence of a target object over consecutive time steps; a truncation module for using a sliding window to truncate multiple sample segments from the data sequence, the multiple sample segments including at least adjacent first sample segments and second sample segments, the first sample segment including a first data segment and a first label segment, the second sample segment including a second data segment and a second label segment, the first label segment and the second label segment having overlapping time steps; an inference module for using a target model to process the first data segment and the second data segment respectively to obtain a first prediction segment corresponding to the first data segment and a second prediction segment corresponding to the second data segment; and a parameter update module for updating the parameters of the target model based on the differences between the first prediction segment and the first label segment, the differences between the second prediction segment and the second label segment, and the differences between the first prediction segment and the second prediction segment.
[0014] A third aspect of this disclosure provides a computing device, including: a processor; a memory for storing processor-executable instructions; the processor being configured to read the executable instructions from the memory and execute the instructions to implement the method of the first aspect.
[0015] A fourth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement the method of the first aspect described above. Attached Figure Description
[0016] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0017] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 A flowchart of a model training method provided in an embodiment of this disclosure is shown; Figure 2A schematic diagram of a sample pair construction process provided in an embodiment of this disclosure is shown; Figure 3 A schematic diagram of a model training process provided in an embodiment of this disclosure is shown; Figure 4 A schematic diagram of a model reasoning process provided in an embodiment of this disclosure is shown; Figure 5 A schematic diagram illustrating a model training and inference process provided in an embodiment of this disclosure is shown; Figure 6 A schematic diagram of the structure of a system for model training provided in an embodiment of this disclosure is shown; Figure 7 A schematic diagram of the structure of a computing device provided in an embodiment of this disclosure is shown. Detailed Implementation
[0019] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.
[0020] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0021] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0022] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0023] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0024] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0025] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0026] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0027] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0028] Before providing a detailed description of the embodiments of this disclosure, the technical background involved in this disclosure will be described and analyzed here so that those skilled in the art can have a clearer understanding of the embodiments of this disclosure.
[0029] Traditional methods primarily employ independent sliding window sampling to extract samples, with each window serving as an independent training sample to predict future data over multiple steps based on historical data. However, independent training for each window fails to consider cross-window temporal consistency constraints, leading to significant deviations in prediction results between adjacent windows at overlapping time points. This results in high-frequency jitter in the tail-end sequence, which worsens with increasing prediction step size. Furthermore, existing loss functions only constrain the continuity within a single prediction, failing to address the temporal inconsistency between multiple predictions.
[0030] Based on this, embodiments of this disclosure provide a model training scheme. The scheme includes: acquiring a data sequence of a target object over consecutive time steps; using a sliding window to extract multiple sample segments from the data sequence, the multiple sample segments including at least adjacent first and second sample segments, the first sample segment including a first data segment and a first label segment, the second sample segment including a second data segment and a second label segment, the first label segment and the second label segment having overlapping time steps; using a target model to process the first data segment and the second data segment respectively, obtaining a first prediction segment corresponding to the first data segment and a second prediction segment corresponding to the second data segment; and updating the parameters of the target model based on the differences between the first prediction segment and the first label segment, the differences between the second prediction segment and the second label segment, and the differences between the first prediction segment and the second prediction segment.
[0031] Through the above technical solution, the embodiments of this disclosure can use multiple related sample segments to participate in training simultaneously, and the first label segment and the second label segment in the multiple sample segments have overlapping parts in time steps. This allows the model to perceive the temporal correlation information of multiple windows at each parameter update, making the prediction results of adjacent windows tend to be consistent in overlapping time steps. On this basis, further adding temporal consistency loss as an explicit constraint can more effectively guide the model to focus on the coherence of cross-window output and enhance the model's robustness to small input shifts.
[0032] Figure 1 A flowchart of a model training method provided in an embodiment of this disclosure is shown. This method can be executed by a model training system, which can be implemented in software and / or hardware. The model training system can be configured in a computing device, such as a server or terminal, wherein the terminal specifically includes a computer or tablet computer, etc. Figure 1 As shown, the model training method provided in this embodiment includes the following steps: S110. Obtain the data sequence of the target object in consecutive time steps.
[0033] The target object can refer to a mobile device whose motion state changes over time, and examples include, but are not limited to, intelligent vehicles and robotic systems. Intelligent vehicles can be cars with autonomous or assisted driving functions, and robotic systems can be various industrial robots, service robots, or biomimetic robots with motion capabilities.
[0034] It is understood that the specific types of the target objects described above are merely illustrative examples, and this disclosure is not intended to limit the specific types of the target objects.
[0035] In some embodiments, the target object may be configured with sensor components, including but not limited to: an inertial measurement unit, a lidar, and a camera. In some embodiments, the computing device may acquire motion state data (e.g., attitude data or position data of the target object) of the target object collected in real time at a preset sampling frequency by the sensor components, and may use the acquired motion state data as raw data samples for the construction of subsequent data sequences. In some embodiments, the data points and time steps in the raw data samples may correspond one-to-one, and the time interval between adjacent data points may be fixed, for example, the i-th data point corresponds to the i-th sampling time, and the time interval between adjacent data points is equal to the sampling period (or a preset time step).
[0036] Furthermore, the computing device can construct a data sequence based on the original data sample. Specifically, the computing device can extract a window [t-N+1, t+Δt] of total length N+Δt from the original data sample, with the current sampling time t as the reference, as a data sequence, so that multiple sample segments can be extracted from it subsequently. Here, t represents the current sampling time, N represents the total length of each sample segment, and Δt represents the random step size difference between the starting positions of adjacent sample segments in multiple sample segments.
[0037] As an example, assuming N=15, Δt=2, t=100, the window of this data sequence starts at the 100-15+1=86th time step and ends at the 100+2=102nd time step. That is, the data sequence covers continuous data from the 86th time step to the 102nd time step, with a total length of 17 time steps (i.e., N+Δt=17).
[0038] By acquiring the aforementioned data sequence, this embodiment of the present disclosure provides a data foundation for subsequent sliding window truncation and model training, enabling the target model to maintain stable predictive performance in different operating scenarios. Furthermore, by introducing a random step size difference, this embodiment of the present disclosure allows the target model to adapt to input variations under different sliding spans, reducing its sensitivity to a fixed time phase and effectively improving the model's robustness to small shifts in input data.
[0039] S120. Using a sliding window, extract multiple sample segments from the data sequence. The multiple sample segments include at least an adjacent first sample segment and a second sample segment. The first sample segment includes a first data segment and a first label segment. The second sample segment includes a second data segment and a second label segment. The first label segment and the second label segment have overlapping time steps.
[0040] In some embodiments, the computing device may use a sliding window to extract multiple sample segments from the acquired data sequence for subsequent training of the target model.
[0041] In some embodiments, such a sliding window may include multiple window instances (e.g., two or more), each window instance having the same length, and each adjacent window instance may have a fixed offset Δt or a random offset Δt on the time axis. Optionally, such a sliding window may include a single sliding window, which the computing device can slide multiple times and use the results of these multiple slides as input to the target model.
[0042] In some embodiments, a computing device may simultaneously intercept multiple sample segments from time series data based on such a sliding window, and the label segments of each intercepted sample segment partially overlap in time steps. As an example, the sliding window may include a reference input window and at least one associated input window, the reference input window and each associated input window have the same length, both being N, and each adjacent window instance may have a fixed Δt or a random offset Δt on the time axis.
[0043] For ease of description, the following description is given by taking a sliding window including one reference input window and one associated input window as an example.
[0044] In some embodiments, such a sliding window may include a reference input window and one associated input window, both the reference input window and the associated input window may intercept sample segments with a data length of N, Δt is a random offset step between the starting positions of the reference input window and the associated input window, and in some embodiments, the value range of such Δt may be 1≤Δt<P, where P represents the number of time steps included in the label segment, so as to ensure that the label segments of the two sample segments overlap in time.
[0045] In some embodiments, the computing device may obtain a "sample pair" including two sample segments from the data sequence based on the reference input window and the associated input window in the sliding window.
[0046] Figure 2 shows a schematic diagram of a sample pair construction process provided by an embodiment of the present disclosure, such as Figure 2 shown in the figure, the computing device may use the reference input window W A and the associated input window W B to simultaneously intercept one sample pair from the data sequence. Specifically, the computing device may, based on the reference window W A intercept the sequence data of the continuous sampling time period [t-N+1, t] as the first sample segment, and may, based on the associated input window W B intercept the sequence data of the continuous sampling time period [t-N+1+Δt, t+Δt] as the second sample segment. Wherein, W A and W B have a window size of N, and the difference between their starting positions is Δt (1≤Δt<P) time steps.
[0047] As an example, assuming N=15, Δt=2, t=100, the computing device may, based on the reference window W A intercept the first sample segment whose window start position of the continuous sampling time period is the 100-15+1=86th time step and end position is the 100th time step. The computing device may, based on the associated input window W BThe window for extracting continuous sampling time periods starts at time step 100-15+1+2=88 and ends at time step 100+2=102, representing the second sample segment.
[0048] In some embodiments, each sample segment may consist of two parts: a data segment and a label segment. For example, the data segment may include data from the first preset number of time steps in the sample segment, and the label segment may include data from the last preset number of time steps in the sample segment. The data segment can be used as input to the target model, and the label segment can be used to compare with the predicted output of the target model to calculate the loss during the training process of the target model.
[0049] As an example, the total length of each sample segment is denoted as N. The data from the first H time steps can be used as the data segment, and the data from the last P time steps can be used as the label segment, i.e., N = H + P, where H and P are preset positive integers. H represents the number of time steps contained in the data segment, and P represents the number of time steps contained in the label segment. For example, N = 15, H = 10, P = 5, meaning each sample segment contains 10 historical data points and 5 future data points, with the 10 historical data points as input and the 5 future data points as labels. The data segment and label segment are temporally continuous and do not overlap within the sample segment.
[0050] In some embodiments, the first sample segment may include a first data segment and a first label segment, and the second sample segment may include a second data segment and a second label segment. The first label segment and the second label segment have overlapping time steps.
[0051] As an example, the first data segment can be H consecutive time steps extracted from the data sequence, and the first label segment is P consecutive time steps of data immediately following the first data segment. The first data segment and the first label segment together constitute the first sample segment. The second data segment can be H consecutive time steps of data extracted from the same data sequence, and the second label segment is P consecutive time steps of data immediately following the second data segment. The second data segment and the second label segment together constitute the second sample segment.
[0052] To facilitate understanding, the following example uses specific numerical values. Assume the total length of each sample segment is N=15, where the data segment length is H=10 and the label segment length is P=5. The first sample segment is extracted starting from the first time step of the data sequence; therefore, the first data segment contains data from time steps 1 to 10, and the first label segment contains data from time steps 11 to 15. The second sample segment is extracted starting from the third time step of the same data sequence (i.e., Δt=2); therefore, the second data segment contains data from time steps 3 to 12, and the second label segment contains data from time steps 13 to 17. The first label segment covers time steps 11 to 15, and the second label segment covers time steps 13 to 17. There is an overlap between the two in time steps 13 to 15, with an overlap length of 3 time steps. This overlapped time step forms the data basis for subsequent calculation of cross-window temporal consistency loss.
[0053] In the above manner, the embodiments of this disclosure can construct a first sample segment and a second sample segment with temporal overlap through the two associated sliding windows, so that the model can learn multiple related window information at the same time during training, laying a data foundation for subsequently applying cross-window temporal consistency constraints.
[0054] For ease of description, the following description uses a sliding window consisting of a base input window and two associated input windows as an example.
[0055] In some embodiments, such a sliding window may include a reference input window W. A , Associated input window W B and associated input window W C Reference input window W A , Associated input window W B and associated input window W C Both can extract a sample segment of length N, where Δt is W. A W B and W C Random offset step size between starting positions.
[0056] In some embodiments, the computing device may reference an input window W A , Associated input window W B and associated input window W C Three sample segments are extracted simultaneously from the data sequence.
[0057] In some embodiments, the first sample segment may include a first data segment and a first label segment, the second sample segment may include a second data segment and a second label segment, and the third sample segment may include a third data segment and a third label segment.
[0058] As an example, the first data segment can be H consecutive time steps extracted from the data sequence, and the first label segment is P consecutive time steps immediately following the first data segment. The first data segment and the first label segment together constitute the first sample segment. The second data segment can be H consecutive time steps extracted from the same data sequence, and the second label segment is P consecutive time steps immediately following the second data segment. The second data segment and the second label segment together constitute the second sample segment. The third data segment can be H consecutive time steps extracted from the same data sequence, and the third label segment is P consecutive time steps immediately following the third data segment. The third data segment and the third label segment together constitute the third sample segment.
[0059] To facilitate understanding, the following examples are illustrated with specific numerical values. Assume that the total length of each sample segment is N=15, where the data segment length is H=10 and the label segment length is P=5.
[0060] The first sample segment can be extracted from the first time step of the data sequence. The first data segment is the data from the 1st to the 10th time steps, and the first label segment is the data from the 11th to the 15th time steps.
[0061] The second sample segment can be extracted starting from the third time step of the same data sequence (i.e., Δt=2). The second data segment consists of the data from the third to the 12th time steps, and the second label segment consists of the data from the 13th to the 17th time steps.
[0062] The third sample segment can be extracted starting from the 5th time step of the data sequence. Therefore, the third data segment consists of the data from the 5th to the 14th time steps, and the third label segment consists of the data from the 15th to the 19th time steps.
[0063] The first label segment covers time steps 11 to 15, the second label segment covers time steps 13 to 17, and the third label segment covers time steps 15 to 19. The first and second label segments overlap at time steps 13 to 15 (overlapping for 3 time steps); the second and third label segments overlap at time steps 15 to 17 (overlapping for 3 time steps). These overlapping time steps form the data basis for subsequent calculations of cross-window timing consistency loss.
[0064] In the above manner, the embodiments of this disclosure can construct a first sample segment, a second sample segment, and a third sample segment with temporal overlap through the three associated sliding windows, so that the model can learn multiple related window information at the same time during training, laying a data foundation for subsequently applying cross-window temporal consistency constraints.
[0065] Understandably, the specific number of sliding windows can be determined based on actual training needs. For example, when using two window instances, sample pairs can be constructed; when using three or more window instances, sample groups can be constructed. In other words, this disclosure is not intended to limit the number of sliding windows (or the number of sample segments), but only to ensure that there are overlapping time steps between two adjacent sample segments, so that the subsequent temporal consistency loss can participate in the training of the target model based on the overlapping time steps.
[0066] In some embodiments, it is assumed that the multiple sample segments include two or more sample segments (e.g., a first sample segment, a second sample segment, and a third sample segment). Two different adjacent sample segments may have the same time step interval or different time step intervals. As an example, the time step interval between the first and second sample segments may be 2, and the time step interval between the second and third sample segments may also be 2. As another example, the time step interval between the first and second sample segments may be 2, the time step interval between the first and second sample segments may be 4, and so on.
[0067] It is understood that this disclosure does not impose specific limitations in this regard. In practical applications, it is sufficient to ensure that the label segments or prediction segments corresponding to adjacent sample segments have at least one overlapping time step.
[0068] To further enhance the target model's ability to perceive dynamic features of data, in some embodiments, the computing device can perform augmentation processing on the original data (e.g., original data samples, data sequences, or multiple sample segments). For example, the original data can be subjected to first-order differencing, and the resulting differencing sequence can be used as an auxiliary channel. This sequence can then be concatenated with the original data along the channel dimension and input into the target model, thereby helping the target model to more accurately capture the dynamic characteristics of the target object.
[0069] It is understood that the above data augmentation methods are merely illustrative examples, and this disclosure is not intended to limit the specific implementation methods of data augmentation.
[0070] S130. Using the target model, process the first data segment and the second data segment respectively to obtain the first prediction segment corresponding to the first data segment and the second prediction segment corresponding to the second data segment.
[0071] In some embodiments, after extracting multiple sample segments from a data sequence, the computing device can input each data segment from the multiple sample segments into the target model for processing, thereby outputting the prediction segment corresponding to the data segment.
[0072] A prediction segment refers to the sequence of predicted values for multiple future time steps output by the target model for an input data segment. For each input data segment, the target model can output a corresponding prediction segment, which covers the same number of time steps as the label segment.
[0073] For ease of description, the embodiments of this disclosure will be described below using two sample segments as examples.
[0074] In some embodiments, the computing device can input the first data segment from the constructed first sample segment and the second data segment from the second sample segment into the model for forward propagation, thereby obtaining the corresponding multi-step prediction output. , .
[0075] The first prediction segment (or future time point prediction data) corresponding to such a first data segment can be represented as:
[0076] The first label corresponding to such a first predicted segment can be represented as:
[0077] The second prediction segment (or future time point prediction data) corresponding to such a second data segment can be represented as:
[0078] The second label corresponding to such a second predicted segment can be represented as:
[0079] In other embodiments, the computing device may also simultaneously input the first data segment and the second data segment into the target model, and the target model may process the first data segment and the second data segment respectively to output the first prediction segment and the second prediction segment.
[0080] Because the starting positions of the first and second sample segments differ by a preset number of time steps, and their total lengths are the same, there is an offset between the first and second data segments on the time axis. Consequently, the first and second prediction segments output by the target model overlap in time steps. In other words, the future time step ranges covered by the first and second prediction segments share a common portion on the time axis, which is the overlapping time step.
[0081] To facilitate understanding, the following example uses specific numerical values. Assume the data segment length H = 10, the label segment length P = 5, and the total length of each sample segment N = 15. The first sample segment is extracted starting from the first time step; therefore, the first data segment covers time steps 1 to 10, and the first prediction segment covers the predicted values from time steps 11 to 15. The second sample segment is extracted starting from the second time step; therefore, the second data segment covers time steps 2 to 11, and the second prediction segment covers the predicted values from time steps 12 to 16. Thus, it can be seen that the first prediction segment (time steps 11 to 15) and the second prediction segment (time steps 12 to 16) overlap at time steps 12 to 15, with an overlap length of 4 time steps.
[0082] In other embodiments, when multiple sample segments include three or more sample segments, the target model processes each data segment separately to obtain its corresponding prediction segment, and adjacent prediction segments have an overlapping relationship in time steps.
[0083] In some embodiments, the target model may include a time series prediction model built on a neural network, such as a recurrent neural network, a long short-term memory network, a gated recurrent unit, or a Transformer. This disclosure does not limit the specific network structure of the target model, as long as it can achieve multi-step prediction of time series data.
[0084] In the above manner, the embodiments of this disclosure can use the same target model to process multiple time-related data segments to obtain multiple prediction segments that overlap in time steps, providing a data basis for subsequent calculation of cross-window temporal consistency loss.
[0085] S140. Based on the differences between the first prediction segment and the first label segment, the differences between the second prediction segment and the second label segment, and the differences between the first prediction segment and the second prediction segment, update the parameters of the target model.
[0086] Specifically, the computing device can determine a first loss function (also known as the main task loss) based on the differences between the first predicted segment and the first labeled segment, and the differences between the second predicted segment and the second labeled segment. This first loss function can be used to constrain the single-window prediction accuracy of the target model output. Furthermore, the computing device can update the model parameters based on this first loss function.
[0087] In some embodiments, the first loss function can be used to measure the error between the predicted segment output by the target model for each input data segment and the corresponding label segment. This error can be calculated using various metrics; for example, the computing device can calculate the first predicted segment... and the first tag segment The mean squared error (MSE), mean absolute error (MAE), etc., are used to determine the first loss function. It is understood that the specific implementation described above is merely illustrative, and this disclosure is not intended to limit the specific method of determining the first loss function.
[0088] Furthermore, the computing device can determine a second loss function based on the difference between the first and second prediction segments. This second loss function can be used to constrain the cross-window temporal coherence of the target model output.
[0089] Specifically, the first and second prediction segments overlap in time steps, corresponding to the predicted physical quantities of the same target object within the same future time period. Ideally, although the first and second prediction segments are obtained from different input data segments (i.e., the first data segment and the second data segment) through prediction by the target model, their predicted values at the overlapping time steps should be consistent. In other words, when the two input data segments differ by only a small number of time steps on the time axis, their corresponding predicted outputs should be consistent over the overlapping time period. If there is a significant difference in their predicted values at the overlapping time steps, it indicates that the target model is overly sensitive to inputs with different phases. This sensitivity is one of the reasons for high-frequency jitter in the tail endpoint sequence during streaming inference. Therefore, it is necessary to constrain this difference.
[0090] Based on the above principle, this embodiment of the present disclosure determines the second loss function by calculating the difference between the first prediction segment and the second prediction segment at the overlapping time step, and then trains the model based on the second loss function.
[0091] Specifically, the computing device can obtain a first sub-segment corresponding to an overlapping time step from the first prediction segment and a second sub-segment corresponding to an overlapping time step from the second prediction segment. Further, the computing device can determine a second loss function based on the difference between the first and second sub-segments at at least one identical time step within the overlapping time steps. Further, the computing device can train the target model using both the first and second loss functions.
[0092] In some embodiments, the second loss function (i.e., cross-window temporal consistency loss) is constructed as follows: The computing device can first locate the overlapping region of the first prediction segment and the second prediction segment on the time axis. Since the label segments of the first sample segment and the second sample segment partially overlap in time steps (for example, the first label segment covers the time period [t-P+1, t], the second label segment covers the time period [t-P+1+Δt, t+Δt], and the overlapping time period is [t-P+1+Δt, t]), the first prediction segment and the second prediction segment also have corresponding predicted value sub-segments in this overlapping time period. The computing device can extract the predicted values within this overlapping time period from the first prediction segment to form the first sub-segment, and extract the predicted values within this overlapping time period from the second prediction segment to form the second sub-segment. The first sub-segment and the second sub-segment correspond one-to-one in time steps, that is, each contains the same number of time steps and each time step points to the same physical time.
[0093] As an example, the computing device can calculate the distance or difference between the first segment and the second segment, and use this difference as the value of the second loss function. As an example, the formula for calculating this second loss function can be expressed as:
[0094] in, This indicates the first prediction segment. This indicates the second prediction segment. Display window and The time difference is Δt steps. Let P represent the predicted point. The distance metric here can include, but is not limited to: L1 norm, L2 norm, variants of L1 norm, variants of L2 norm, and cosine similarity.
[0095] It is understood that the above formula is only an illustrative example. The computing device can calculate the difference for all time steps of the overlapping part, or it can calculate the difference only for a portion of the time steps in the overlapping part (such as the last time step or the Pth prediction point in the overlapping time steps) to reduce computational overhead.
[0096] Furthermore, the computing device can construct a total loss function based on the first loss function and the second loss function. As an example, the computing device can weight and fuse the first loss function and the second loss function according to preset weights. As an example, the total loss function can be expressed as:
[0097] in, For the first loss function, The second loss function is defined by α and β, which are the corresponding weight coefficients. The values of α and β can be fixed constants (e.g., α=0.7, β=0.3), or they can change dynamically with the increase of training rounds (e.g., β is smaller in the early stage of training to prioritize the accuracy of single-window prediction, and β is gradually increased in the later stage of training to enhance cross-window consistency constraints). This disclosure does not impose specific limitations on this.
[0098] Finally, the computing device can perform backpropagation updates on the target model based on the aforementioned total loss function. Specifically, the computing device can calculate the gradient of the total loss function with respect to each network parameter of the target model, and adjust the values of each parameter along the gradient descent direction to minimize the total loss. Through the above training process, the target model can learn cross-window temporal consistency while ensuring single-window prediction accuracy; that is, when the input undergoes a small time shift, its predicted output remains stable and consistent in the overlapping part.
[0099] In this way, the target model, after training, only needs a single window input to obtain a smooth output sequence during the inference stage, which solves the high-frequency jitter problem caused by inconsistent cross-window prediction in the existing technology.
[0100] It is understood that the above embodiments illustrate the example of using the entire overlapping portion of two prediction segments in the calculation of the second loss function. In other embodiments, the computing device may also select only one or more specific time steps in the overlapping portion (e.g., the last time step ultimately used for downstream tasks) to calculate the difference, thereby further reducing computational complexity. Furthermore, the second loss function can also calculate the consistency loss pairwise or as a whole between three or more prediction segments; this disclosure does not specifically limit this, and those skilled in the art can flexibly configure it according to actual training resources and accuracy requirements.
[0101] In this way, embodiments of the present disclosure can constrain the target model to maintain consistency in the overlapping portions of multiple temporally correlated input data segments. By minimizing the second loss function, the target model's output tends to be stable and smooth when faced with inputs that have slight shifts in the time axis.
[0102] Figure 3 A schematic diagram of a model training process provided in an embodiment of this disclosure is shown. Figure 3 As shown, in step 301, the computing device can randomly sample the step size difference Δt and construct a window W: [t-N+1, t+Δt] based on the step size difference, and save the continuous time series data within the window as a data sequence.
[0103] In step 302, the computing device can extract a reference window W from the data sequence. A [t-N+1, t] and associated window WB : [t-N+1+Δt, t+Δt]. W A and W B both have a window size of N (N=H+P), and there is a difference of Δt time steps between their starting positions, where 1≤Δt<P, to ensure that W A and the label segment of W B have temporal overlap. Each sample segment includes the first H data points as the input data segment and the last P data points as the label segment.
[0104] In step 303, the computing device may feed the input data segments in W A and W B into the target model for forward propagation, to obtain the respective corresponding prediction outputs and . corresponds to the future P time steps covered by the label segment of W A , corresponds to the future P time steps covered by the label segment of W B .
[0105] In step 304, the computing device may calculate the main task loss and the consistency loss of the overlapping region, and perform weighted summation on the two to obtain the total loss. The main task loss is the sum or average of the error between and the corresponding real label , and the error between and the corresponding real label ; the consistency loss is the deviation between and at the overlapping time steps.
[0106] In step 305, the computing device may perform back propagation on the total loss to update network parameters, completing one training iteration. When a preset training termination condition is satisfied, the training ends, and the trained target model file is output. Through the above training process, while ensuring the prediction accuracy of a single window, the model can be forced to learn cross-window temporal consistency, so that smooth and stable prediction sequences can be output in the inference phase.
[0107] The inference phase of the target model will be described below.
[0108] In some embodiments, the computing device may acquire target window data, which may include a data sequence on consecutive first time steps. Taking an intelligent vehicle as an example, during the driving process of the vehicle, the computing device may acquire attitude data of the current moment and the H-1 moments before the current moment from the real-time data stream of the inertial measurement unit, to form a real-time window data sequence with a length of H, and the sequence is input as the target window data into the trained target model.
[0109] In some embodiments, the method of acquiring target window data can be consistent with the method of constructing input data segments during the training phase. That is, the data format, data dimensions, and time steps of the target window data match the historical data segments during the training phase to ensure the effectiveness of model inference.
[0110] As an example, if the first H data points of each sample segment in the training phase are used as the input data segment, then the target window data in the inference phase should also be a data sequence containing H consecutive time steps, and the time interval between adjacent data points should be the same as the sampling period in the training phase. This ensures that the data distribution of the inference input to the target model is consistent with the data distribution of the training input, thereby ensuring the reliability of the inference output.
[0111] In some embodiments, the computing device may utilize a trained target model to generate a prediction sequence at a second consecutive time step based on target window data, wherein the first and second consecutive time steps are adjacent. Further, the computing device may obtain target data at a preset time step from the prediction sequence and store the target data in a cache area. This cache area may include multiple historical target data sets, each corresponding to data at a preset time step in the prediction sequence corresponding to a different historical window data set.
[0112] Specifically, the target model takes target window data as input during the inference phase and outputs a predicted sequence at the second consecutive time step. The first consecutive time step refers to the time period covered by the target window data, and the second consecutive time step refers to the future time period covered by the predicted sequence; the two are adjacent and do not overlap on the time axis. As an example, if the target window data includes historical data from the current time and H-1 previous times, the predicted sequence corresponds to P consecutive time steps after the current time, meaning the last time step of the first consecutive time step is adjacent to the first time step of the second consecutive time step.
[0113] In some embodiments, the preset time step may refer to the last time step in the prediction sequence, i.e., the future time step furthest from the current time. It is understood that the preset time step may also be other positions in the prediction sequence (e.g., the first time step or some intermediate time step), which can be determined according to the actual needs of the downstream task, and this disclosure does not limit this. The computing device extracts the predicted value at the preset time step as the target data and stores it in a cache area for subsequent adaptive filtering processing.
[0114] In some embodiments, such a cache area may include multiple historical target data, which may correspond to data at a preset time step in the prediction sequence corresponding to multiple historical window data.
[0115] In some embodiments, this cache area may be used to maintain a fixed-length first-in first-out (FIFO) cache queue. This cache queue may be represented, for example, as:
[0116] where t is the current moment, is the target data at the preset time step in the inference result at the current moment, (i<t) is the historical target data at the preset time step corresponding to historical moment i, .
[0117] Specifically, after obtaining the target data in each inference, the computing device may push the target data to the tail of the queue, and when the queue length exceeds , the historical target data at the head of the queue may be moved out of the queue. The data in this queue may be arranged in chronological order, always retaining the latest preset time step prediction values at the inference moments. It should be understood that The specific value of may be comprehensively determined according to factors such as the dynamic characteristics of the target object, the sampling frequency, and the tolerance of downstream applications to delay, and the present disclosure does not make specific limitation thereto.
[0118] By maintaining the above cache area, the computing device can retain necessary time series data for subsequent adaptive filtering processing, so that the filtering operation can be performed based on a set of consecutive historical prediction values, thereby obtaining sufficient statistical information in the time dimension to effectively suppress random high-frequency noise.
[0119] In some embodiments, the computing device may acquire a set of target data in the cache area, and such a set of target data may include the target data and a plurality of historical target data. The computing device may determine a data variation feature of the set of target data, and the data variation feature is used to characterize the data oscillation degree in the set of target data.
[0120] Specifically, the plurality of target data stored in the cache area are prediction values at preset time steps in the model prediction sequence at different historical moments, which are arranged in chronological order to form a length of first-in first-out (FIFO) cache queue, that is, the target data obtained from the latest inference is continuously enqueued, and when the queue length exceeds the preset maximum length , the earliest data is moved out of the queue. As the inference process continues, this queue slides forward continuously, always retaining the latest preset time step prediction values at the inference moments.
[0121] It can be understood that The specific value can be determined comprehensively based on factors such as the dynamic characteristics of the target object, the sampling frequency of the prediction task, and the tolerance of downstream applications for latency. This disclosure does not impose specific limitations on this.
[0122] In some embodiments, the above-mentioned data change characteristics can be used to characterize the degree of oscillation of a set of target data in the cache queue. For example, the stability or fluctuation range of the data can be quantified by calculating the first-order difference sequence of the data, the change of adjacent difference signs, the sum of the absolute values of the second-order differences, the local information entropy, etc.
[0123] As an example, a computing device can first perform a first-order difference operation on a set of target data in a cache queue to obtain a difference sequence between adjacent time steps; then, it can count the number of sign inversions of adjacent difference values in the difference sequence. The more sign inversions, the more frequently the target data fluctuates up and down in a short period of time, i.e., the higher the degree of oscillation; conversely, the fewer sign inversions, the more consistent the trend of the target data changes, and the lower the degree of oscillation.
[0124] As another example, the aforementioned data variation characteristics can also be quantified by calculating the sum of the absolute values of the second-order differences of a set of target data in the buffer queue. Specifically, based on the first-order difference sequence, the computing device can perform another difference operation on adjacent difference values to obtain a second-order difference sequence, and then take the absolute values of each second-order difference and sum them. High-frequency reciprocating jitter will cause the absolute value of the second-order difference to amplify rapidly, while the second-order difference value of a monotonically rising or monotonically falling smooth signal is close to 0. Therefore, when the sum of the absolute values of the second-order differences is greater than a preset threshold, the current signal is determined to be in a high-frequency oscillation state, and the computing device dynamically increases the filtering window; conversely, when the sum of the absolute values of the second-order differences is less than or equal to the preset threshold, the current signal is determined to have a monotonically changing trend.
[0125] It is understood that the sum of the absolute values of the second-order differences and the sign inversion count are both exemplary ways to quantify the degree of signal oscillation. Those skilled in the art can choose other equivalent methods (such as local information entropy) to characterize the data change characteristics according to actual needs, as long as the characteristics used can reflect the degree of fluctuation of a set of target data in the cache queue. This disclosure does not make any specific limitations on this.
[0126] By identifying the aforementioned data change characteristics, the computing device can quantify the fluctuations in the data at the tail end of the current prediction sequence, thus providing a basis for subsequent adaptive adjustment of the filtering window. If the data change characteristics reflect that the current target data is in a high-frequency oscillating state, it indicates that the model prediction results have large random fluctuations, requiring a larger filtering window for smoothing. If the data change characteristics reflect that the current target data exhibits a monotonically increasing or monotonically decreasing stable trend, it indicates that the target object is in a highly dynamic stage of rapid attitude changes, in which case filtering should be reduced or even canceled to avoid introducing delays. Therefore, the extraction of data change characteristics enables subsequent filtering to adaptively adjust the filtering strength according to the actual state of the signal.
[0127] In some embodiments, the computing device may determine the size of a dynamic filtering window for a set of target data based on data variation characteristics. Furthermore, the computing device may output a smoothed output value for the target window data based on the dynamic filtering window size.
[0128] Specifically, the computing device can determine the dynamic filtering window size at the current moment based on the aforementioned data change characteristics (e.g., the number of sign inversions or the sum of the absolute values of second-order differences). The dynamic filter window size can be used to indicate the number of data points involved in subsequent filtering calculations; its value ranges from 1 to... Between. The higher the degree of oscillation in the data change characteristics, The larger the value of , the lower the degree of oscillation. The smaller the value, the better.
[0129] In some embodiments, the computing device may initialize the effective filter window size. Each time a signal reversal event is detected (or the sum of the absolute values of the second-order differences exceeds a set threshold), [the following will occur]. Accumulate according to a preset step size (e.g.) (until the end of the traversal, and the maximum value is no more than) .
[0130] Furthermore, in determining Then, the computing device can output a smoothed output value based on this dynamic filtering window size. Specifically, the computing device can... Compare with a preset threshold (e.g., 1). As an example, when When less than or equal to a preset threshold (i.e. ≤1) indicates that the target data in the current cache queue shows a monotonically increasing or monotonically decreasing trend, and the signal itself is relatively smooth with no obvious jitter. At this time, the computing device can directly process the current target data. The output value is sent to the downstream task module as a smooth output without any filtering. This pass-through mode ensures that the output signal does not have phase delay introduced by filtering when the target object is in a rapid attitude change phase.
[0131] As another example, when When it is greater than the preset threshold (i.e.) >1) indicates that the target data in the current cache queue exhibits high-frequency repetitive jitter, requiring filtering to suppress random noise. At this time, the computing device selects the data from the cache queue Q that is closest to the current time. A subqueue consisting of data points can be represented as:
[0132] In some embodiments, the computing device may smooth the sub-queue according to a preset smoothing algorithm and output the processing result as a smoothed output value. The smoothing method includes, but is not limited to: arithmetic mean (e.g., calculating the mean of all data in the sub-queue as the output), Gaussian weighted mean (e.g., calculating the weighted mean after assigning different weights to each data point in the sub-queue according to Gaussian weights), or median filtering (e.g., taking the median of the sub-queue as the output).
[0133] In this way, the embodiments of this disclosure can make the output sequence smoother and more stable. At the same time, since the filter window size is adaptively determined according to the degree of signal oscillation, it will not introduce unnecessary delay when the signal is stable, nor will it be insufficiently filtered when the signal jitter is severe.
[0134] In practical implementation, the above two output methods are based on The comparison result with the preset threshold is automatically switched. The computing device can recalculate based on the current state of the cache queue at each inference time. Based on this, it selects between direct output and smooth output.
[0135] In this way, the present disclosure achieves adaptive control of the filtering intensity by dynamically adjusting the size of the filtering window. When it is necessary to eliminate jitter, the filtering window is increased to obtain a smooth output, and when it is necessary to quickly track signal changes, the filtering window is reduced to maintain real-time performance, so that the output signal can maintain excellent performance in various operating scenarios.
[0136] Figure 4 The diagram illustrates a model inference process provided in an embodiment of this disclosure, such as... Figure 4 As shown, in step 401, the computing device can input the acquired streaming target window data into the trained target model for inference. In step 402, the computing device can obtain the prediction sequence for the next P time steps, and extract the tail endpoints from the prediction sequence. and will Push the data into the buffer queue Q, where the length of queue Q is fixed. When the queue is full, the oldest data is removed from the queue to ensure that the queue always contains the most recent data. The predicted value of the tail endpoint at each inference time.
[0137] In step 403, the computing device can compute the first-order difference sequence D of queue Q, where This first-order difference sequence can reflect the direction and magnitude of change between adjacent tail endpoints in the queue.
[0138] In step 404, the computing device may initialize the dynamic filtering window. =1, then iterate through the difference sequence D, checking the product of two adjacent difference values in turn. The sign of the value. In step 405, the computing device responds to determining... A value less than 0 indicates that the signal has undergone a direction reversal within this local range (i.e., the signal shows a peak or trough), which is characteristic of high-frequency reciprocating jitter. In step 406, the computing device can... Increase by n (n is the preset step size, n≥1); if ≥0 indicates that the signal maintains a monotonic trend (continuously rising or continuously falling) within this local range. In step 407, It can remain unchanged. During the traversal, The value is limited to 1 to between.
[0139] In step 408, after the traversal is complete, the computing device can determine... Is it equal to 1? In step 409, the computing device responds to... A value of 1 indicates that the signal changes in the current buffer queue have a consistent trend (monotonically increasing or monotonically decreasing) and no obvious jitter. In this case, the computing device can skip the filtering operation and directly use the latest inference value. The output is sent to the downstream task module to achieve a physical zero-latency response.
[0140] In step 410, the computing device responds to This indicates that the current signal has high-frequency reciprocating jitter. At this time, the computing device extracts the most recent jitter from the buffer queue Q. The data points are processed by low-pass filtering (e.g., arithmetic mean, Gaussian weighted average, or median filtering), and the filtering result is output as a smooth output value, thereby effectively suppressing random spikes at the prediction tail endpoints and making the output sequence smoother and more stable.
[0141] Through the above reasoning process, the embodiments of this disclosure can adaptively select whether to filter and the intensity of the filter based on the real-time changes in the signal after the model inference outputs, thereby suppressing high-frequency jitter while ensuring the real-time response capability of rapidly changing signals.
[0142] During the online inference phase, low-pass filtering with adaptive window size can also be implemented using other alternatives. One such alternative is the exponential moving average method, where the filter coefficients can dynamically adjust with the filter window size. Dynamic adjustment, specifically, when When the coefficient increases, the exponential smoothing coefficient decreases accordingly to enhance the suppression of high-frequency jitter; when As the coefficient of exponential smoothing decreases, the coefficient of exponential smoothing increases accordingly to enhance the ability to track rapid changes in the signal. Because exponential moving averages are simple to calculate and have low storage overhead, they are particularly suitable for computationally limited automotive embedded systems.
[0143] As an alternative, the variable window size filtering can be replaced with a fixed window size filtering method with variable weight kernels. Specifically, the filter window size is kept fixed. The weight allocation of each data point in the buffer queue remains unchanged, but is dynamically adjusted based on the result of the difference sign reversal count (or the sum of the absolute values of the second-order differences). The final output is... When a monotonic, non-reversing signal is detected, the latest data point can be dynamically updated. weight Set the weight to 1, and set all other weights to 0. In this case, the output is equivalent to directly outputting the target data, achieving a zero-latency response. When severe jitter is detected, the weights are evenly distributed (e.g., degenerating to an arithmetic mean, where each weight is 1 / ...). This method achieves deep smoothing filtering. Without changing the physical window size, it achieves the same beneficial effects as monotonic changes with zero latency and extremely smooth high-frequency fluctuations, while avoiding the cache management complexity caused by variable window operations.
[0144] It is understood that the above-mentioned filtering alternatives are all equivalent transformations of the embodiments of this disclosure, and those skilled in the art can flexibly choose according to the actual application scenario and computing resources. This disclosure does not make any specific limitations in this regard.
[0145] Figure 5 A schematic diagram illustrating a model training and inference process provided in an embodiment of this disclosure is shown. Figure 5 As shown, the technical solution provided in this embodiment generally includes two parts: an offline training optimization module and an online inference adaptive module.
[0146] In the offline training optimization module, in step 501, the computing device can first acquire the raw offline continuous time-series data. In step 502, the computing device can construct sample pairs based on this data. Each sample pair can contain two associated sample segments, each consisting of a historical data segment and a corresponding label segment. In step 503, the computing device can input the constructed sample pairs into the neural network for forward propagation, calculating the main task prediction loss and the temporal consistency loss. In step 504, the computing device can determine the total loss based on the main task loss and the temporal consistency loss, and update the network weights through backpropagation, thereby completing the offline training of the model. After training, the trained model file is obtained, which can be used for subsequent online inference.
[0147] In the online inference adaptive module, in step 505, the computing device can load the trained target model file and perform real-time inference on the online streaming data 506. In step 507, after obtaining the prediction sequence for P future time points each time through inference, the computing device can extract the tail endpoint prediction value from the prediction sequence. and press it into a length of The data is stored in a streaming buffer FIFO queue Q. In step 508, the computing device can perform first-order difference calculations on the data in queue Q and detect sign inversion of adjacent difference values to determine the dynamic filtering window. In step 509, after determining the dynamic filtering window, the computing device can perform adaptive low-pass filtering on the buffer queue according to the window size. In step 510, the computing device can output a filtered, delay-free, debouncing, smooth output value for use by downstream task modules.
[0148] Through the synergistic cooperation of offline training and online inference, the embodiments of this disclosure enable the model to learn smooth prediction capabilities during the training phase through cross-window temporal consistency constraints. At the same time, during the inference phase, adaptive filtering further suppresses residual high-frequency jitter. The two complement each other and work together to achieve a balance between "smoothness" and "real-time performance" in temporal multi-step prediction.
[0149] This disclosure also provides a corresponding system for implementing the above methods or steps. Figure 6 A schematic diagram of the structure of a system 600 for model training provided in an embodiment of this disclosure is shown.
[0150] In this embodiment of the disclosure, system 600 may be located within a computing device and is understood as a portion of the functional modules within the aforementioned computing device. Specifically, the computing device may be a server or a terminal, wherein the terminal may specifically include mobile phones, computers, or tablet computers, etc., without limitation.
[0151] like Figure 6As shown, system 600 includes: an acquisition module 610, used to acquire a data sequence of a target object over consecutive time steps; a truncation module 620, used to use a sliding window to truncate multiple sample segments from the data sequence, the multiple sample segments including at least adjacent first sample segments and second sample segments, the first sample segment including a first data segment and a first label segment, the second sample segment including a second data segment and a second label segment, the first label segment and the second label segment having overlapping time steps; an inference module 630, used to use a target model to process the first data segment and the second data segment respectively to obtain a first prediction segment corresponding to the first data segment and a second prediction segment corresponding to the second data segment; and a parameter update module 640, used to update the parameters of the target model based on the differences between the first prediction segment and the first label segment, the differences between the second prediction segment and the second label segment, and the differences between the first prediction segment and the second prediction segment.
[0152] It should be noted that, Figure 6 The system 600 shown can execute the various steps in the above method embodiments and achieve the various processes and effects in the above method embodiments, which will not be elaborated here.
[0153] Figure 7 A schematic diagram of the structure of a computing device provided in an embodiment of this disclosure is shown. In this embodiment, Figure 7 The computing device shown can be a server or a terminal, where the terminal specifically includes mobile phones, computers, or tablets, etc., without limitation.
[0154] like Figure 7 As shown, the computing device may include a processor 710 and a memory 720 storing computer program instructions.
[0155] Specifically, the processor 710 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this disclosure.
[0156] Memory 720 may include a large-capacity storage for information or instructions. For example, and not limitingly, memory 720 may include a hard disk drive (HDD), a floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 720 may include removable or non-removable (or fixed) media. Where appropriate, memory 720 may be internal or external to the integrated gateway device. In a particular embodiment, memory 720 is a non-volatile solid-state memory. In a particular embodiment, memory 720 includes read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (Electrically Programmable ROM, EPROM), an electrically erasable programmable PROM (EEPROM), an electrically alterable ROM (EAROM), or flash memory, or a combination of two or more of these.
[0157] The processor 710 reads and executes computer program instructions stored in the memory 720 to perform the methods or steps provided in the embodiments of this disclosure.
[0158] In one example, the computing device may also include a transceiver 730 and a bus 740. Wherein, as... Figure 7 As shown, the processor 710, memory 720 and transceiver 730 are connected via bus 740 and communicate with each other.
[0159] Bus 740 may include hardware, software, or both. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industrial Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 740 may include one or more buses.
[0160] This disclosure also provides a computer-readable storage medium that can store a computer program that, when executed by a processor, causes the processor to implement the methods provided in this disclosure.
[0161] The aforementioned storage medium may, for example, include a memory 720 containing computer program instructions, which can be executed by a processor 710 of a computing device to perform the methods provided in the embodiments of this disclosure. Optionally, the storage medium may be a non-transitory computer-readable storage medium, such as a ROM, random access memory (RAM), compact disc ROM (CD-ROM), magnetic tape, floppy disk, and optical data storage device.
[0162] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A model training method, characterized in that, The method includes: Obtain the data sequence of the target object over consecutive time steps; Using a sliding window, multiple sample segments are extracted from the data sequence. The multiple sample segments include at least an adjacent first sample segment and a second sample segment. The first sample segment includes a first data segment and a first label segment. The second sample segment includes a second data segment and a second label segment. The first label segment and the second label segment have overlapping time steps. Using the target model, the first data segment and the second data segment are processed respectively to obtain the first prediction segment corresponding to the first data segment and the second prediction segment corresponding to the second data segment. The target model is updated with parameters based on the differences between the first prediction segment and the first label segment, the second prediction segment and the second label segment, and the first prediction segment and the second prediction segment.
2. The method according to claim 1, characterized in that, The step of updating the parameters of the target model based on the differences between the first predicted segment and the first labeled segment, the differences between the second predicted segment and the second labeled segment, and the differences between the first predicted segment and the second predicted segment includes: A first loss function is determined based on the difference between the first prediction segment and the first label segment, and the difference between the second prediction segment and the second label segment. The first loss function is used to constrain the single-window prediction accuracy of the target model output. Based on the difference between the first prediction segment and the second prediction segment, a second loss function is determined. The second loss function is used to constrain the cross-window temporal coherence of the target model output. The parameters of the target model are updated using the first loss function and the second loss function.
3. The method according to claim 2, characterized in that, The step of determining the second loss function based on the difference between the first prediction segment and the second prediction segment includes: Obtain a first sub-segment corresponding to the overlapping time step from the first prediction segment, and obtain a second sub-segment corresponding to the overlapping time step from the second prediction segment; The second loss function is determined based on the difference between the first sub-segment and the second sub-segment at at least one identical time step in the overlapping time steps.
4. The method according to claim 2, characterized in that, The step of updating the parameters of the target model using the first loss function and the second loss function includes: The first loss function and the second loss function are weighted and fused according to preset weights to obtain the total loss function; Based on the total loss, the network parameters of the target model are updated through backpropagation.
5. The method according to claim 1, characterized in that, The method further includes: Acquire target window data, the target window data including a data sequence over a first consecutive time step; Using the trained target model, a prediction sequence at a second consecutive time step is generated based on the target window data, wherein the first consecutive time step and the second consecutive time step are adjacent. Obtain the target data at the preset time step from the predicted sequence; The target data is stored in a cache area, which includes multiple historical target data, each of which corresponds to data at the preset time step in the prediction sequence corresponding to multiple historical window data.
6. The method according to claim 5, characterized in that, The method further includes: Obtain a set of target data from the cache area, the set of target data including the target data and the plurality of historical target data; Determine the data variation characteristics of the set of target data, wherein the data variation characteristics are used to characterize the degree of data oscillation in the set of target data; Based on the data change characteristics, determine the dynamic filtering window size for the set of target data; Based on the dynamic filtering window size, a smooth output value is output for the target window data.
7. The method according to claim 6, characterized in that, The step of outputting a smoothed output value for the target window data based on the dynamic filtering window size includes: In response to the dynamic filtering window size being less than or equal to a preset threshold, the target data is output as the smoothed output value; In response to the dynamic filtering window size being greater than the preset threshold, a number of data points equal to the dynamic filtering window size are selected from the set of target data for smoothing processing, and the processing result is output as the smoothed output value.
8. A system for model training, characterized in that, The system includes: The acquisition module is used to acquire the data sequence of the target object over consecutive time steps. The interception module is used to intercept multiple sample segments from the data sequence using a sliding window. The multiple sample segments include at least an adjacent first sample segment and a second sample segment. The first sample segment includes a first data segment and a first label segment. The second sample segment includes a second data segment and a second label segment. The first label segment and the second label segment have overlapping time steps. The inference module is used to process the first data segment and the second data segment respectively using the target model to obtain a first prediction segment corresponding to the first data segment and a second prediction segment corresponding to the second data segment; and The parameter update module is used to update the parameters of the target model based on the differences between the first prediction segment and the first label segment, the differences between the second prediction segment and the second label segment, and the differences between the first prediction segment and the second prediction segment.
9. A computing device, characterized in that, include: processor; Memory, used to store executable instructions; The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the method of any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program that, when executed by a processor, causes the processor to implement the method described in any one of claims 1-7.