Handwriting prediction method based on enhanced hybrid linear network and semantic prior constraint
Patent Information
- Application Number
- CN202610916000.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-24
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2046-06-24
AI Technical Summary
[0004]鉴于以上现有技术的缺陷,本发明提供一种基于增强型混合线性网络与语义先验约束的笔迹预测方法,以解决现有技术中笔迹预测精度与模型轻量化难以兼得、缺乏语义先验约束导致预测轨迹异常的技术问题
[0020]本发明的有益效果:本发明提出的一种基于增强型混合线性网络与语义先验约束的笔迹预测方法,该方法通过构建独立训练的轨迹分类模型与轨迹预测模型,将轨迹分类语义先验作为约束引入预测过程,实现了时序-空间特征与语义先验的深度耦合;创新性地采用低秩分解与混合特征筛选技术,在将总模型参数量控制于100K以内的同时,有效抑制了轨迹抖动、偏离与超前等问题;该方法无需高端硬件即可实现跟手流畅的书写体验,预测轨迹与真实笔迹的贴合度高,在快速书写及笔画转折等挑战性场景下仍能保持稳定预测精度,显著提升了触控设备的书写跟手感与用户体验。
Smart Images

Figure CN122454588B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of deep learning and touch technology, and in particular to a handwriting prediction method based on an enhanced hybrid linear network and semantic prior constraints. Background Technology
[0002] With the popularization of digital office and education, touch writing has become one of the core methods of human-computer interaction, and is widely used in devices such as interactive whiteboards, conference machines, smartphones, electronic whiteboards, and tablets. Existing handwriting trajectory prediction technologies mainly face three major technical bottlenecks: First, it is difficult to balance accuracy and lightweight design. Although traditional models based on GRU and Transformer can achieve high-precision prediction, the number of parameters is usually over one million, making it difficult to adapt to low-end and mid-range hardware devices. Second, there is a lack of effective semantic constraints. Single regression task models cannot understand trajectory types (such as straight lines, curves, circles, etc.), which leads to problems such as jitter, deviation, or leading in predicted trajectories. Third, feature extraction is not comprehensive enough. Most models only focus on temporal dependence or a single dimension of spatial features, failing to fully explore the mixed feature expression of trajectories.
[0003] In existing technologies, some solutions extract hybrid features by simply concatenating convolutional neural networks and recurrent neural networks, but lack effective feature selection and fusion mechanisms, leading to feature redundancy and decreased prediction accuracy. Furthermore, existing lightweight models often achieve parameter control by crudely reducing the number of network layers or channels, which easily results in insufficient feature representation capabilities and fails to meet the high-precision requirements of real-time writing. Therefore, there is an urgent need for a trajectory prediction scheme that balances lightweight design, high accuracy, and semantic constraints, improving the accuracy and naturalness of trajectory prediction while controlling model complexity. Summary of the Invention
[0004] In view of the above-mentioned deficiencies of the prior art, the present invention provides a handwriting prediction method based on an enhanced hybrid linear network and semantic prior constraints, so as to solve the technical problems in the prior art where it is difficult to achieve both handwriting prediction accuracy and model lightweighting, and the lack of semantic prior constraints leads to abnormal prediction trajectories.
[0005] To achieve the above and other related objectives, this invention provides a handwriting prediction method based on an enhanced hybrid linear network and semantic prior constraints. The method includes: acquiring raw call point data generated during touch writing, preprocessing and normalizing the raw call point data to generate a fixed-length temporal sequence data; inputting the temporal sequence data into a pre-trained trajectory classification model to output the probability distribution of the semantic category to which the current writing trajectory belongs; inputting the temporal sequence data into a pre-trained trajectory prediction model, and introducing the probability distribution as a prior constraint into the inference process of the trajectory prediction model, with the trajectory prediction model outputting multiple predicted call point coordinates; correcting the predicted call point coordinates, and smoothly connecting the corrected predicted call points with the real call points in the raw call point data to generate a predicted writing trajectory for real-time display.
[0006] In one embodiment of the present invention, the original reporting data is preprocessed and normalized to generate time-series data of fixed length, including: removing outliers and aligning the original reporting data with time; calculating the velocity, direction angle, and curvature of the actual reporting points based on their coordinates and timestamps; normalizing the coordinates, velocity, direction angle, and curvature of the actual reporting points using a multi-dimensional fixed-range normalization strategy to obtain normalized multi-dimensional data; and generating the time-series data based on the multi-dimensional data of a preset length.
[0007] In one embodiment of the present invention, the trajectory classification model includes: a temporal feature extraction branch, which takes the temporal sequence data as input and uses an enhanced hybrid linear layer as the core to extract deep temporal features and output a deep temporal feature vector; a spatial feature extraction branch, which takes the temporal sequence data as input and uses a multi-kernel one-dimensional convolutional network as the core to extract local spatial features and output a deep spatial feature vector; an attention fusion module, which performs attention-weighted fusion of the deep temporal feature vector and the deep spatial feature vector to output a comprehensive fusion feature; and a classification output module, which maps the comprehensive fusion feature to a category dimension and normalizes it using a Softmax function to output the probability distribution of the trajectory semantic category.
[0008] In one embodiment of the present invention, the temporal feature extraction branch includes, in sequence: an enhanced hybrid linear layer, used to perform channel adaptive weighting, multi-scale temporal domain segmentation, and low-rank detrended projection processing on the temporal sequence data to obtain a first intermediate feature; a first random deactivation layer, used to perform random deactivation processing on the first intermediate feature; and a first fully connected layer, used to map the randomly deactivated feature to a specified dimension and output the temporal deep feature vector.
[0009] In one embodiment of the present invention, the enhanced hybrid linear layer includes, in sequence: a channel adaptive weighting submodule, used to calculate the global average feature of the time series data in the time dimension, generate weight coefficients for each feature channel through a fully connected layer and normalize them using Softmax, broadcast the normalized weight coefficients to the time dimension and multiply them element-wise with the time series data to output a weighted time series sequence; a multi-scale temporal domain segmentation submodule, used to preset at least two segmentation number configurations, reshape the weighted time series sequence into a three-dimensional tensor of "number of segments × segment length × feature dimension" for each configuration, calculate the local average feature within each segment and flatten it into a one-dimensional vector, and obtain temporal domain feature vectors of multiple scales through independent linear mapping layers; and a low-rank detrended projection submodule, used to calculate... The global average feature vector of the weighted time series is calculated in the time dimension. The global average feature vector is subtracted from the feature of each time step of the weighted time series to obtain the detrended residual sequence. The detrended residual sequence is then transformed sequentially by a first low-rank projection matrix and a second low-rank restoration matrix. The restored sequence is then aggregated in the time dimension to output a low-rank feature vector. An adaptive feature fusion submodule is used to stack time-domain feature vectors of multiple scales with the low-rank feature vector along the feature path dimension to obtain a stacked feature tensor. The weight coefficients of each feature are generated by normalizing the learnable fusion weight vector with Softmax. The weight coefficients are broadcast and multiplied element-wise with the stacked feature tensor and summed along the feature path dimension to output the first intermediate feature.
[0010] In one embodiment of the present invention, the spatial feature extraction branch includes: a first one-dimensional convolutional layer and a second one-dimensional convolutional layer, wherein the first one-dimensional convolutional layer and the second one-dimensional convolutional layer are set in parallel, and local spatial features are extracted in parallel using convolutional kernels with different receptive fields, and a second intermediate feature and a third intermediate feature are output respectively; a ReLU activation layer and a batch normalization layer are connected after each one-dimensional convolutional layer, and are used to perform nonlinear activation and batch normalization on the output of each one-dimensional convolutional layer; a channel concatenation layer is used to concatenate the two intermediate features after nonlinear activation and batch normalization in the channel dimension, and output the concatenated feature; a first max pooling layer is used to perform pooling compression on the concatenated feature; a first flattening layer is used to flatten the pooled compressed feature into a one-dimensional vector; a second random deactivation layer is used to perform random deactivation processing on the flattened one-dimensional vector; and a second fully connected layer is used to map the randomly deactivated feature to a specified dimension, and output the deep spatial feature vector.
[0011] In one embodiment of the present invention, the attention fusion module is used to input the temporal deep feature vector and the spatial deep feature vector into the attention layer after expanding their dimensions, calculate the interaction weights of the two features and generate an attention output vector, and concatenate the attention output vector, the temporal deep feature vector and the spatial deep feature vector to obtain a comprehensive fused feature.
[0012] In one embodiment of the present invention, the classification output module includes: a third fully connected layer for mapping the integrated fusion features to a high-dimensional latent space; a fourth fully connected layer for mapping the features of the high-dimensional latent space to the category number dimension; and a Softmax layer for normalizing the output of the fourth fully connected layer and outputting the probability distribution of the trajectory semantic category.
[0013] In one embodiment of the present invention, the inference process of the trajectory prediction model is introduced as a prior constraint by using a probability distribution as a confidence factor; each element in the probability distribution is multiplied by the confidence factor to obtain a prior constraint feature matrix with adaptive confidence weighting, so that the semantic features under high confidence are enhanced and the semantic features under low confidence are suppressed; and the prior constraint feature matrix is introduced into the inference process of the trajectory prediction model.
[0014] In one embodiment of the present invention, the trajectory prediction model includes: a GRU feature extraction branch, which takes the time-series data as input, extracts time-dependent features, and outputs a global time-series feature vector; a convolutional feature extraction branch, which takes the time-series data as input, extracts local spatial morphological features, and outputs a spatial feature vector; a channel attention module, which concatenates the global time-series feature vector and the spatial feature vector along the channel dimension, generates a channel weight vector through a compression-reduction structure attention subnet, performs channel adaptive recalibration on the concatenated features, and outputs the recalibrated comprehensive trajectory features; a prior feature processing branch, which weights the probability distribution with confidence, processes it sequentially through a fully connected layer and a ReLU activation layer, and outputs prior features after nonlinear mapping; a dynamic gating fusion module, which performs dynamic gating fusion of the comprehensive trajectory features and the prior features, and outputs fused features; and a coordinate coupling prediction module, which nonlinearly maps the fused features through a fully connected layer and outputs multiple predicted point coordinates through a linear regression layer.
[0015] In one embodiment of the present invention, the GRU feature extraction branch includes: a first gated recurrent unit layer, which adopts a bidirectional gated recurrent unit structure with 32 hidden units, for extracting bidirectional temporal dependency features of the time-series data and outputting a temporal context sequence; a first normalization layer, for performing layer normalization processing on the temporal context sequence; a second gated recurrent unit layer, which adopts a unidirectional gated recurrent unit structure with 64 hidden units, for further extracting temporal dependency features from the normalized temporal context sequence; and a second normalization layer, for performing layer normalization processing on the output of the second gated recurrent unit layer and outputting the global temporal feature vector.
[0016] In one embodiment of the present invention, the convolutional feature extraction branch includes: a first convolutional layer, employing a one-dimensional convolutional structure with a kernel size of 3, used to extract local spatial features of the time-series data and output a first convolutional feature; a second max-pooling layer, used to perform pooling compression on the first convolutional feature and output a pooled feature; a second convolutional layer, employing a one-dimensional convolutional structure with a kernel size of 5, used to further extract local spatial features from the pooled feature and output a second convolutional feature; a second flattening layer, used to flatten the second convolutional feature into a one-dimensional vector; and a fifth fully connected layer, used to map the flattened one-dimensional vector to a specified dimension and output the spatial feature vector.
[0017] In one embodiment of the present invention, the channel attention module includes: a first feature concatenation unit, used to concatenate the global temporal feature vector and the spatial feature vector along the channel dimension, and output a concatenated feature vector; a compression unit, employing a fully connected layer structure, used to map the concatenated feature vector to a 16-dimensional latent space, and output compressed features; a restoration unit, employing a fully connected layer structure, used to map the compressed features back to the original channel dimension, and output restored features; a normalization unit, employing a Softmax function, used to normalize the restored features and generate a channel weight vector; a recalibration unit, used to multiply the channel weight vector and the concatenated feature vector element-wise, and output a weighted feature; and a layer normalization unit, used to perform layer normalization on the weighted feature, and output the comprehensive trajectory feature.
[0018] In one embodiment of the present invention, the dynamic gating fusion module includes: a second feature splicing unit, used to splice the prior features and the comprehensive trajectory features to output spliced fusion features; a gating generation unit, using a single neuron fully connected layer and a Sigmoid activation function, used to generate scalar gating coefficients based on the spliced fusion features; and a gating weighting unit, using the gating coefficients to scale the prior features and the comprehensive trajectory features as a whole before splicing them to output fusion features.
[0019] In one embodiment of the present invention, the correction of the predicted reporting point coordinates includes: performing angle constraint detection on the predicted reporting points: obtaining the direction angle change values of three consecutive reporting points in the real reporting point sequence, and calculating the mean and standard deviation of the direction angle change; sequentially calculating the predicted direction angle change of each predicted reporting point relative to the last two real reporting points; if the absolute value of the difference between the predicted direction angle change and the mean direction angle change is greater than the product of a first preset empirical coefficient and the standard deviation, then deleting the predicted reporting point and all subsequent predicted reporting points; performing distance constraint detection on the predicted reporting points that pass the angle constraint detection: calculating the first Euclidean distance between the first and last points in the real reporting point sequence; sequentially calculating the second Euclidean distance between each predicted reporting point and the last real reporting point; if the second Euclidean distance is greater than the product of a second preset empirical coefficient and the first Euclidean distance, then deleting the predicted reporting point; if all predicted reporting points are deleted, then generating a replacement predicted reporting point based on the movement trend of the real reporting point sequence.
[0020] The beneficial effects of this invention are as follows: This invention proposes a handwriting prediction method based on an enhanced hybrid linear network and semantic prior constraints. This method constructs independently trained trajectory classification and trajectory prediction models, and introduces trajectory classification semantic priors as constraints into the prediction process, achieving deep coupling between temporal-spatial features and semantic priors. It innovatively adopts low-rank decomposition and hybrid feature selection techniques, effectively suppressing problems such as trajectory jitter, deviation, and lead while keeping the total number of model parameters within 100K. This method can achieve a smooth writing experience without high-end hardware, and the predicted trajectory has a high degree of fit with the real handwriting. It can still maintain stable prediction accuracy in challenging scenarios such as fast writing and stroke transitions, significantly improving the writing responsiveness and user experience of touch devices. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. The accompanying drawings are incorporated in and constitute a part of this specification, illustrating embodiments consistent with this application, and are used together with the description to explain the principles of this application. Obviously, the drawings described below are merely some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings without creative effort.
[0022] Figure 1 A flowchart of a handwriting prediction method provided in an embodiment of the present invention;
[0023] Figure 2 This is an architecture diagram of a trajectory classification model provided in an embodiment of the present invention;
[0024] Figure 3This is an architectural diagram of an enhanced hybrid linear layer provided in an embodiment of the present invention;
[0025] Figure 4 This is an architecture diagram of a trajectory prediction model provided in an embodiment of the present invention. Detailed Implementation
[0026] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. It should be noted that, unless otherwise specified, the following embodiments and features can be combined with each other. In addition to the specific methods, equipment, and materials used in the embodiments, based on the knowledge of the prior art and the description of the present invention by those skilled in the art, any prior art methods, equipment, and materials similar to or equivalent to the methods, equipment, and materials in the embodiments of the present invention can be used to implement the present invention.
[0027] It should be understood that the terminology used in the embodiments of this invention is for describing specific particular implementations and not for limiting the scope of protection of this invention. Unless otherwise defined, all technical and scientific terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art.
[0028] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the invention. However, it will be apparent to those skilled in the art that embodiments of the invention may be practiced without these specific details. In some embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the invention.
[0029] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functions, and operations that may be implemented in the methods and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0030] The following describes the implementation of the present invention through specific embodiments. In the textual description of this embodiment, to distinguish network layers with the same name in different modules, they are labeled with serial numbers such as "first random deactivation layer" and "second random deactivation layer"; however, this distinction is not made in the accompanying drawings, and common English abbreviations in the art are used uniformly, such as Dropout, Conv1d, Dense, Flatten, etc.
[0031] Please see Figure 1 , Figure 1 This invention provides a handwriting prediction method based on an enhanced hybrid linear network and semantic prior constraints, which includes steps S101 to S104.
[0032] Step S101: Acquire the raw point reporting data generated during the touch writing process, and preprocess and normalize the raw point reporting data to generate a fixed-length time series data. By capturing the point reporting data on the touch screen in real time and performing preprocessing, the discrete raw point reporting sequence is converted into a normalized fixed-length time series, providing structured input for subsequent models, and eliminating the dimensional differences caused by different devices and different writing habits.
[0033] In a specific embodiment of the present invention, the original reporting data is preprocessed and normalized to generate time-series data of fixed length, including: (1) removing outliers and aligning the time of the original reporting data; (2) calculating the velocity, direction angle and curvature of the real reporting points based on the coordinates and timestamps of the real reporting points; (3) normalizing the coordinates, velocity, direction angle and curvature of the real reporting points using a multi-dimensional fixed-range normalization strategy to obtain normalized multi-dimensional data; (4) generating time-series data based on the multi-dimensional data of a preset length.
[0034] In this embodiment, the dimensionally fixed-range normalization strategy is, for example, that the X-coordinate normalization interval is [0, x]. max The normalized interval for the Y-coordinate is [0, y]. max The normalized intervals for velocity V ([0, 10]), direction angle R ([0, 360]), and curvature C ([0, 1]) are: [0, 1]. The normalization formula is as follows:
[0035] ,
[0036] Where data represents the value of the corresponding dimension. norm These are the normalized values, with listlow being the minimum value for each dimension and listhigh being the maximum value for each dimension, ensuring the consistency of data distribution.
[0037] Through the aforementioned dimensional fixed-range normalization process, each physical quantity is mapped to a unified numerical range, eliminating the influence of factors such as coordinate dimensions and writing speed differences on model training. The introduction of curvature C is one of the key technical features of this invention. Curvature is obtained by calculating the reciprocal of the circumcircle radius for three consecutive trajectory points, directly quantifying the degree of curvature in handwriting. Compared to traditional methods that rely solely on coordinates and speed, curvature features provide a more accurate geometric prior for subsequent classification models, enabling the model to clearly distinguish different handwriting types such as straight lines (curvature approaching 0), gentle curves (small curvature), and sharp curves (large curvature). This significantly improves the classification model's ability to discriminate complex trajectories and provides a more discriminative semantic constraint basis for the prediction model.
[0038] In a specific embodiment of the present invention, the time-series data is generated using a dynamic sliding window mechanism, specifically including: (1) starting from the first real report point collected after the pen is put down, storing the multidimensional data of each real report point into the window in sequence; (2) when the number of real report points in the window does not reach the preset length, trajectory classification and trajectory prediction are not performed temporarily; (3) when the number of real report points in the window reaches the preset length, the multidimensional data of all real report points in the window are used as time-series data; (4) thereafter, for each new real report point data collected, the earliest real report point data in the window is removed, and the new real report point data is added to the window to form a new time-series data; (5) repeat the above steps until the pen lifting event is detected.
[0039] The introduction of a dynamic sliding window mechanism enables real-time rolling updates of time-series data. Prediction is not performed when the window is not full at the initial stage of writing, avoiding prediction distortion due to insufficient data. Once the window is full, it is updated and a new round of prediction is triggered for each new data point collected, ensuring the real-time nature and continuity of prediction. This mechanism effectively controls the stability of the computational load, avoids processing delays caused by rebuilding the window each time, and ensures that the prediction model always infers based on the latest historical trajectory information, significantly improving the prediction response speed in fast writing scenarios.
[0040] Step S102: Input the time-series data into a pre-trained trajectory classification model and output the probability distribution of the semantic category to which the current writing trajectory belongs. This step utilizes the pre-trained trajectory classification model to perform semantic understanding of the current writing content and outputs the probability distribution of each category. This provides prior knowledge of stroke types for subsequent trajectory prediction, enabling the prediction process to perceive whether the current writing is a straight line, a curve, or a complex stroke, fundamentally solving the problem of blind prediction in traditional prediction models.
[0041] Please see Figure 2In a specific embodiment of the present invention, the trajectory classification model includes a temporal feature extraction branch, a spatial feature extraction branch, an attention fusion module, and a classification output module. The temporal feature extraction branch takes temporal sequence data as input and uses an enhanced hybrid linear layer as its core to extract deep temporal features and output a deep temporal feature vector. The spatial feature extraction branch takes temporal sequence data as input and uses a multi-kernel one-dimensional convolutional network as its core to extract local spatial features and output a deep spatial feature vector. The attention fusion module performs attention-weighted fusion of the deep temporal feature vector and the deep spatial feature vector to output a comprehensive fused feature. The classification output module maps the comprehensive fused feature to a category dimension and normalizes it using a Softmax function to output the probability distribution of the trajectory semantic category.
[0042] This trajectory classification model employs a dual-path parallel extraction and attention-based fusion output architecture. The temporal feature extraction branch, centered on an enhanced MixLinear layer (i.e., an enhanced hybrid linear layer), efficiently captures the long-term and short-term dependencies of handwriting over time through innovative mechanisms such as channel adaptive weighting, multi-scale temporal partitioning, and low-rank detrended projection. The spatial feature extraction branch extracts local spatial morphological features through multi-kernel parallel convolution. The two feature paths are interactively weighted by the attention fusion module and then mapped to the semantic category space by the classification output module. This architecture, while ensuring classification accuracy, keeps the number of parameters extremely low through low-rank decomposition, resolving the technical contradiction of traditional classification models' difficulty in simultaneously achieving accuracy and lightweight design, and providing highly reliable semantic priors for the prediction model.
[0043] In a specific embodiment of the present invention, the temporal feature extraction branch includes an enhanced hybrid linear layer, a first random deactivation layer, and a first fully connected layer connected in sequence. The enhanced hybrid linear layer is used to perform channel adaptive weighting, multi-scale temporal domain segmentation, and low-rank detrended projection processing on the temporal sequence data to obtain a first intermediate feature; the first random deactivation layer is used to perform random deactivation processing on the first intermediate feature; and the first fully connected layer is used to map the randomly deactivated feature to a specified dimension to output a deep temporal feature vector.
[0044] This temporal feature extraction branch innovates on the core of its approach with an enhanced MixLinear layer, replacing traditional recurrent network structures such as LSTM or GRU. The enhanced MixLinear layer significantly reduces the number of parameters while maintaining temporal modeling capabilities through low-rank decomposition and multi-scale block partitioning. The subsequent first randomly deactivated layer randomly discards neurons with a probability of 0.1, effectively preventing overfitting; the first fully connected layer maps features to 16 dimensions, achieving feature compression and dimensionality unification. This branch can still extract highly expressive deep temporal features with a very small number of parameters, providing crucial temporal discrimination criteria for classification tasks.
[0045] Please refer to Figure 3 , in a specific embodiment of the present invention, the enhanced hybrid linear layer includes a channel adaptive weighting sub-module, a multi-scale time-domain block sub-module, a low-rank detrending projection sub-module, and an adaptive feature fusion sub-module connected in sequence. Among them, the channel adaptive weighting sub-module is used to calculate the global average feature of the time series data in the time dimension, generate the weight coefficients of each feature channel through a fully connected layer and normalize them through Softmax, broadcast the normalized weight coefficients to the time dimension and multiply them element by element with the time series data, and output the weighted time series. The multi-scale time-domain block sub-module is used to preset at least two block number configurations. For each configuration, the weighted time series is reshaped into a three-dimensional tensor of "number of blocks × block length × feature dimension", calculate the local average feature within each block and flatten it into a one-dimensional vector, and obtain time-domain feature vectors of multiple scales through independent linear mapping layers respectively. The low-rank detrending projection sub-module is used to calculate the global average feature vector of the weighted time series in the time dimension, subtract the global average feature vector from the feature of each time step of the weighted time series to obtain a detrended residual sequence, and transform the detrended residual sequence successively through a first low-rank projection matrix and a second low-rank reduction matrix, and perform time dimension aggregation on the reduced sequence to output a low-rank feature vector. The adaptive feature fusion sub-module is used to stack the time-domain feature vectors of multiple scales and the low-rank feature vector along the feature path dimension to obtain a stacked feature tensor, generate the weight coefficients of each path of features through a learnable fusion weight vector after Softmax normalization, broadcast the weight coefficients and multiply them element by element with the stacked feature tensor and sum along the feature path dimension to output a first intermediate feature.
[0046] In the multi-scale time-domain block sub-module, for an input sequence with length L, the block number configurations include dividing the sequence into N1 blocks with length L / N1 and dividing it into N2 blocks with length L / N2, where both N1 and N2 are greater than 1, and N1 < N2 < L, so as to achieve the extraction of micro-fluctuation and macro-trend features.
[0047] In the low-rank detrending projection sub-module, the rank R of the first low-rank projection matrix is strictly less than the original feature dimension D, so that the number of parameters in the low-rank latent space is only D×R, and the dual effects of feature denoising and model lightweighting are achieved by restricting the matrix rank; the calculation formula of the detrended residual sequence is:
[0048] ,
[0049] where, represents the weighted feature vector at the t-th time step, T is the sequence length, is the detrended residual feature vector.
[0050] The enhanced hybrid linear layer is the core innovative module of this invention. Its four sub-modules work collaboratively: the channel adaptive weighting sub-module generates channel weights through global average features and Softmax normalization, achieving recalibration of feature channels and focusing the model on important feature channels; the multi-scale temporal block segmentation sub-module divides the sequence into different numbers of blocks, calculates the local average features within each block, and performs independent linear mapping to achieve multi-scale modeling of micro-fluctuations and macro-trends; the low-rank detrending projection sub-module first subtracts the global mean of the time dimension to eliminate the trend term, and then achieves feature denoising and parameter compression through low-rank matrix decomposition (the first projection matrix compresses D dimensions to R dimensions, and the second restoration matrix maps back to D dimensions), reducing the number of parameters from D×D to 2×D×R; the adaptive feature fusion sub-module performs weighted fusion of features from various paths through learnable weight vectors. This design can still extract rich multi-scale temporal features even under parameter constraints.
[0051] See also Figure 2 In a specific embodiment of the present invention, the spatial feature extraction branch includes a first one-dimensional convolutional layer and a second one-dimensional convolutional layer, a ReLU activation layer and a batch normalization layer, a channel splicing layer, a first max pooling layer, a first flattening layer, a second random deactivation layer and a second fully connected layer. The system consists of two parallel one-dimensional convolutional layers, each using kernels with different receptive fields to extract local spatial features and outputting second and third intermediate features, respectively. A ReLU activation layer and a batch normalization layer, connected after each one-dimensional convolutional layer, perform non-linear activation and batch normalization on the outputs of each layer. A channel concatenation layer concatenates the two intermediate features after non-linear activation and batch normalization along the channel dimension, outputting the concatenated feature. A first max-pooling layer performs pooling compression on the concatenated feature. A first flattening layer flattens the pooled and compressed feature into a one-dimensional vector. A second random deactivation layer randomly deactivates the flattened one-dimensional vector. A second fully connected layer maps the randomly deactivated feature to a specified dimension, outputting a deep spatial feature vector.
[0052] This spatial feature extraction branch employs a dual-path parallel convolutional structure. Two one-dimensional convolutional layers use kernels of different sizes (e.g., kernel 3 and kernel 5) to extract local spatial features in parallel, enabling simultaneous perception of spatial patterns at different scales. After introducing nonlinearity through ReLU activation and batch normalization to accelerate convergence, a channel splicing layer fuses the features from both paths, allowing the model to simultaneously obtain both fine-grained and coarse-grained spatial morphological information. A max-pooling layer compresses the feature dimension, a flattening layer converts two-dimensional features into one-dimensional vectors, a random deactivation layer prevents overfitting, and finally, a fully connected layer outputs a deep spatial feature vector. This branch extracts rich spatial discriminative features with very few parameters, forming an effective temporal-spatial complementarity with the enhanced MixLinear branch.
[0053] In a specific embodiment of the present invention, the attention fusion module is used to expand the dimensions of the temporal deep feature vector and the spatial deep feature vector before inputting them into the attention layer. It calculates the interaction weights of the two feature vectors and generates an attention output vector. The attention output vector, the temporal deep feature vector, and the spatial deep feature vector are then concatenated to obtain a comprehensive fused feature. This attention fusion module first expands the temporal deep feature vector and the spatial deep feature vector to the same dimension, inputs them into the attention layer to calculate the interaction weights of the two feature vectors, and generates an attention output vector. This vector reflects the correlation strength between the temporal and spatial features across different dimensions. Subsequently, the attention output vector is concatenated with the original two feature vectors to obtain a comprehensive fused feature that incorporates the interaction weights. This allows the subsequent classifier to simultaneously utilize the original features and their attention weighting information, improving the accuracy of the classification decision.
[0054] In a specific embodiment of the present invention, the classification output module includes a third fully connected layer, a fourth fully connected layer, and a Softmax layer. The third fully connected layer maps the integrated features to a high-dimensional latent space; the fourth fully connected layer maps the features from the high-dimensional latent space to the category number dimension; and the Softmax layer normalizes the output of the fourth fully connected layer, outputting the probability distribution of the trajectory semantic category. The classification output module employs a two-layer cascaded fully connected structure: the third fully connected layer maps the integrated features to a high-dimensional latent space (e.g., 32-dimensional), enhancing the model's ability to distinguish category boundaries; the fourth fully connected layer maps the features from the high-dimensional latent space to the category number dimension (e.g., 8 categories); and the Softmax layer converts the output into a probability distribution. This design introduces a high-dimensional latent space at the front end of the classifier, which, compared to directly mapping to the category dimension, allows for the learning of richer category discrimination boundaries, thus improving classification accuracy.
[0055] In a specific embodiment of the present invention, the probability distribution is introduced as a prior constraint into the inference process of the trajectory prediction model, including: (1) extracting the maximum probability value from the probability distribution as a confidence factor; (2) multiplying each element in the probability distribution by the confidence factor to obtain a prior constraint feature matrix with adaptive confidence weighting, so that the semantic features under high confidence are enhanced and the semantic features under low confidence are suppressed; (3) introducing the prior constraint feature matrix into the inference process of the trajectory prediction model. The core of this confidence adaptive weighting mechanism is that when the classification model has a high confidence in the current trajectory (the maximum probability value is close to 1), the weighted prior features maintain the original amplitude, which strongly constrains the prediction process; when the confidence is low (the maximum probability value is small), the overall amplitude of the prior features is compressed, weakening the influence of unreliable priors. This mechanism realizes the adaptive screening of semantic priors, avoids misleading the prediction process by incorrect classification results, and improves the robustness of the prediction model.
[0056] Step S103: Input the time-series data into the pre-trained trajectory prediction model, and introduce the probability distribution as a prior constraint into the inference process of the trajectory prediction model. The trajectory prediction model then outputs multiple predicted point coordinates. This step simultaneously feeds the time-series data into the trajectory prediction model and introduces the probability distribution output by the classification model in step S102 as a prior constraint into the prediction model's inference process. Guided by the classification prior, the prediction model can adaptively adjust its prediction strategy according to the current handwriting type. For example, straight trajectories maintain a straight extension, and curved trajectories maintain a smooth transition, effectively suppressing the problems of prediction point advance and deviation.
[0057] Please see Figure 4 The trajectory prediction model includes a GRU feature extraction branch, a convolutional feature extraction branch, a channel attention module, a prior feature processing branch, a dynamic gating fusion module, and a coordinate coupling prediction module. Specifically, the GRU feature extraction branch takes time-series data as input to extract time-dependent features and outputs a global time-series feature vector; the convolutional feature extraction branch takes time-series data as input to extract local spatial morphological features and outputs a spatial feature vector; the channel attention module concatenates the global time-series feature vector and the spatial feature vector along the channel dimension, generates channel weight vectors through a compression-reduction structure attention subnet, performs adaptive channel recalibration on the concatenated features, and outputs the recalibrated comprehensive trajectory features; the prior feature processing branch weights the probability distribution with confidence and processes it sequentially through a fully connected layer and a ReLU activation layer, outputting prior features after nonlinear mapping; the dynamic gating fusion module dynamically gating and fusing the comprehensive trajectory features and prior features, outputting fused features; and the coordinate coupling prediction module nonlinearly maps the fused features through a fully connected layer and outputs multiple predicted point coordinates through a linear regression layer.
[0058] This trajectory prediction model innovatively introduces a semantic prior constraint mechanism based on the traditional "temporal + spatial" dual-path feature extraction. The GRU feature extraction branch uses a "bidirectional + unidirectional" two-layer structure to extract long-range temporal dependencies, while the convolutional feature extraction branch extracts local spatial morphology through cascaded convolutions. The two feature paths undergo adaptive recalibration of feature channels via a channel attention module. Simultaneously, the probability distribution output by the classification model is weighted by confidence, fully connected, and activated by ReLU to form highly expressive prior features. The dynamic gating fusion module dynamically adjusts the contribution of prior features through gating coefficients—strengthening prior constraints at high confidence and weakening constraints at low confidence. The coordinate-coupled prediction module regresses and outputs future trajectory points after multi-layer fully connected nonlinear mapping. This architecture achieves deep coupling between temporal-spatial features and semantic priors, significantly improving prediction accuracy and robustness with a relatively low parameter count.
[0059] In a specific embodiment of the present invention, the GRU feature extraction branch includes a first gated recurrent unit layer, a first normalization layer, a second gated recurrent unit layer, and a second normalization layer. The first gated recurrent unit layer adopts a bidirectional gated recurrent unit structure with 32 hidden units, used to extract bidirectional temporal dependency features from the time-series data, outputting a time-series context sequence with a dimension of T×64. The first normalization layer is used to perform layer normalization processing on the time-series context sequence. The second gated recurrent unit layer adopts a unidirectional gated recurrent unit structure with 64 hidden units, used to further extract temporal dependency features from the normalized time-series context sequence; the second normalization layer is used to perform layer normalization processing on the output of the second gated recurrent unit layer, outputting a global temporal feature vector with a dimension of 64.
[0060] The GRU feature extraction branch employs a two-layer stacked structure of "bidirectional + unidirectional". The first-layer bidirectional GRU (hidden unit 32) simultaneously captures sequence context information from both directions, outputting a temporal context sequence with a dimension of T×64, enabling the model to perceive the motion trends in both directions before and after the current trajectory point. After layer normalization, the second-layer unidirectional GRU (hidden unit 64) further extracts temporal dependent features, and after another layer normalization, outputs a global temporal feature vector with a dimension of 64. Compared to a single-layer GRU, this design has stronger temporal modeling capabilities, and layer normalization accelerates training convergence and stabilizes feature distribution, providing high-quality temporal features for subsequent fusion.
[0061] In a specific embodiment of the present invention, the convolutional feature extraction branch includes a first convolutional layer, a second max-pooling layer, a second convolutional layer, a second flattening layer, and a fifth fully connected layer. The first convolutional layer employs a one-dimensional convolutional structure with a kernel size of 3, used to extract local spatial features from time-series data and output first convolutional features. The second max-pooling layer is used to pool and compress the first convolutional features, outputting pooled features. The second convolutional layer employs a one-dimensional convolutional structure with a kernel size of 5, used to further extract local spatial features from the pooled features and output second convolutional features. The second flattening layer flattens the second convolutional features into a one-dimensional vector. The fifth fully connected layer maps the flattened one-dimensional vector to a specified dimension, outputting a spatial feature vector.
[0062] The convolutional feature extraction branch employs a cascaded convolutional structure: the first convolutional layer uses a small kernel (size 3) to capture microscopic local geometric patterns (such as local curvature and slight directional changes) between adjacent trajectory points; after max pooling to compress the feature dimension and expand the receptive field, the second convolutional layer uses a larger kernel (size 5) to extract macroscopic spatial morphological features (such as overall curvature trends) over a larger time span. The flattening layer converts two-dimensional features into one-dimensional vectors, and the fully connected layer (32-dimensional) maps the features to a specified dimension. This design, in contrast to parallel convolutions in classification models, is more suitable for extracting hierarchical spatial motion features for trajectory prediction.
[0063] In a specific embodiment of the present invention, the channel attention module includes a first feature concatenation unit, a compression unit, a restoration unit, a normalization unit, a recalibration unit, and a layer normalization unit. Specifically, the first feature concatenation unit concatenates the global temporal feature vector and the spatial feature vector along the channel dimension, outputting a concatenated feature vector; the compression unit employs a fully connected layer structure to map the concatenated feature vector to a 16-dimensional latent space, outputting compressed features; the restoration unit employs a fully connected layer structure to map the compressed features back to the original channel dimension, outputting restored features; the normalization unit uses the Softmax function to normalize the restored features, generating a channel weight vector; the recalibration unit multiplies the channel weight vector element-wise with the concatenated feature vector, outputting weighted features; and the layer normalization unit performs layer normalization on the weighted features, outputting comprehensive trajectory features.
[0064] This channel attention module employs a compression-reduction structure to recalibrate the channels of the concatenated 96-dimensional composite trajectory features. The compression unit maps the 96-dimensional features to a 16-dimensional latent space through a fully connected layer, aggregating information about the dependencies between channels. The reduction unit maps the 16-dimensional features back to 96 dimensions, restoring the original number of channels. Softmax normalization generates channel weight vectors with values ranging from 0 to 1. The recalibration unit multiplies the weight vectors element-wise with the original features, achieving adaptive enhancement or suppression of feature channels. Layer normalization standardizes the weighted features. This mechanism enables the model to focus on feature channels that contribute more to the prediction task, suppress redundant information, and improve the discriminative power of feature representation.
[0065] In a specific embodiment of the present invention, the dynamic gating fusion module includes a second feature splicing unit, a gating generation unit, and a gating weighting unit. The second feature splicing unit splices prior features with comprehensive trajectory features to output a spliced fusion feature. The gating generation unit uses a single-neuron fully connected layer and a Sigmoid activation function to generate a scalar gating coefficient g based on the spliced fusion feature. The gating weighting unit uses the gating coefficient to scale the prior features and comprehensive trajectory features before splicing them to output the fusion feature; that is, it multiplies the prior features and comprehensive trajectory features by g and (1-g) respectively and then splices them to obtain the fusion feature. The core of this dynamic gating fusion module is the gating coefficient g, which has a value range of (0,1) and is generated by the Sigmoid function based on the spliced fusion feature. g reflects the importance of the classification prior features to the current prediction task: when g is close to 1, the prior features are enhanced, dominating the prediction direction; when g is close to 0, the prior features are suppressed, and the prediction mainly relies on the trajectory motion features. The gated weighted unit uses g and (1-g) to scale the prior features and the comprehensive trajectory features as a whole and then concatenates them, realizing the adaptive fusion of prior knowledge. This enables the prediction model to dynamically adjust the strength of prior constraints according to the classification confidence and trajectory status, which significantly improves the robustness and adaptability of the prediction.
[0066] Understandably, the trajectory classification model and the trajectory prediction model are trained independently. The training data was collected by inviting multiple users with different writing habits to write various handwriting trajectory samples on touch devices, including eight semantic categories: Chinese character strokes, Arabic numerals, English letters, straight lines, polylines, wavy lines, arcs, and curves. Each classification sample contains original reporting data and corresponding manually labeled semantic category tags; each prediction sample contains original reporting data and the true coordinates of several future reporting points. To expand the dataset size and improve the model's generalization ability, data augmentation was performed using translation, rotation, scaling, and adding random noise. The augmented dataset was divided into training and validation sets in an 8:2 ratio. Both used the Adam optimizer and were trained until the validation set loss converged. During training, the trajectory prediction model's input included time-series data, while the input to the prior feature processing branch came from the probability distribution output by the trajectory classification model, forming a decoupled collaboration between the models.
[0067] Step S104: Correct the predicted reporting point coordinates and smoothly connect the corrected predicted reporting points with the actual reporting points in the original reporting point data to generate a predicted writing trajectory for real-time display. This step performs dual constraint detection on the predicted reporting point coordinates output by the model using angle and distance, eliminating abnormal predicted points that do not conform to the motion law and preventing trajectory jumps or deviations. For predicted reporting points that pass the detection or substitute points generated as fallbacks, Bézier curve smoothing technology is used to connect them with the end point of the actual trajectory, ensuring a smooth transition between the predicted trajectory and the actual writing trajectory with continuous position and tangent direction, eliminating visual angles and sudden speed changes.
[0068] In a specific embodiment of the present invention, the predicted reporting point coordinates are corrected, which specifically includes the following steps.
[0069] (1) Angle constraint detection for predicted reporting points: Obtain the direction angle change values of three consecutive reporting points in the real reporting point sequence, and calculate the mean and standard deviation of the direction angle change; calculate the predicted direction angle change of each predicted reporting point relative to the last two real reporting points in turn; if the absolute value of the difference between the predicted direction angle change and the mean direction angle change is greater than the product of the first preset empirical coefficient and the standard deviation, then delete the predicted reporting point and all subsequent predicted reporting points. The core basis of this angle constraint detection is the motion inertia of the writing trajectory: Under normal circumstances, the direction angle change of the handwriting should remain relatively stable during the writing process, and there will be no drastic changes. By calculating the mean and standard deviation of the direction angle change of the historical real reporting point sequence, the normal change range of the current writing motion can be established. When the direction angle change of a certain predicted reporting point relative to the historical trajectory deviates significantly from this range (exceeding the mean ± k1 times the standard deviation), it indicates that the predicted point violates the motion inertia law and should be eliminated, and all subsequent predicted points should be deleted at the same time to prevent the accumulation and propagation of errors.
[0070] (2) Distance constraint detection is performed on the predicted reporting points that pass the angle constraint detection: the first Euclidean distance between the first and last points of the real reporting point sequence is calculated; the second Euclidean distance between each predicted reporting point and the last real reporting point is calculated in turn; if the second Euclidean distance is greater than the product of the second preset empirical coefficient and the first Euclidean distance, the predicted reporting point is deleted. Distance constraint detection, as a supplement to angle constraint, is used to remove predicted points that exceed the reasonable range. Its core logic is: under normal circumstances, the distance between the predicted reporting point and the last real reporting point should not be much greater than the overall movement range of the historical trajectory. Using the Euclidean distance between the first and last points of the real reporting point sequence as a reference scale, when the distance between a predicted reporting point and the real end point exceeds k2 times the reference, it indicates that the prediction drift is too large and the predicted point is unreliable. Through the layer-by-layer filtering of the two-level constraints, it is ensured that the final retained predicted points simultaneously meet the requirements of angle smoothness and distance reasonableness.
[0071] (3) After angle constraint detection and distance constraint detection, if there are still predicted reporting points, they are used as corrected predicted reporting points for subsequent smooth connection processing; if all predicted reporting points are deleted, a substitute predicted reporting point is generated based on the motion trend of the real reporting point sequence. In the steps, if there are still predicted reporting points after angle constraint and distance constraint detection, these predicted reporting points are used as corrected valid predicted points and directly enter the subsequent smooth connection processing. If all predicted reporting points are judged to be unreasonable and are removed, in order to avoid trajectory interruption, a fallback mechanism is activated: a substitute predicted reporting point is generated based on the motion trend of the historical real reporting point sequence. The generation of the substitute predicted point can be achieved by linear extrapolation (based on the straight line extension of the velocity direction of the last two points) or directional angle extrapolation (maintaining the current directional angle change trend). Subsequently, a cubic Bézier curve is used to smoothly connect the corrected predicted reporting point (or substitute predicted reporting point) with the last real reporting point. By adjusting the control points, the position of the connection point is ensured to be continuous and the tangent direction is continuous, thereby realizing the natural fusion of the predicted trajectory and the real writing trajectory.
[0072] It should be noted that the steps of the various methods described above are only for clarity. In practice, they can be combined into one step or some steps can be split into multiple steps. As long as they contain the same logical relationship, they are all within the scope of protection of this application. Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but without changing the core design of the algorithm and process, are also within the scope of protection of this patent.
[0073] In summary, this invention proposes a handwriting prediction method based on an enhanced hybrid linear network and semantic prior constraints. By constructing independently trained low-rank enhanced MixLinear lightweight classification models and semantically enhanced hybrid feature prediction models, the method incorporates trajectory classification semantic priors as constraints into the prediction process, achieving deep coupling between temporal-spatial features and semantic priors. It innovatively employs hybrid feature selection techniques such as low-rank decomposition and multi-scale temporal block partitioning, effectively suppressing issues like trajectory jitter, deviation, and lead while keeping the total number of model parameters below 100K. The introduction of curvature features enables the model to accurately perceive the curvature of the handwriting, and the adaptive weighted confidence mechanism avoids misleading predictions due to misclassification. This method achieves a smooth and responsive writing experience without requiring high-end hardware, and the predicted trajectory closely matches the real handwriting, making it suitable for various touch devices such as interactive whiteboards, conference systems, and electronic whiteboards.
[0074] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.
Claims
1. A handwriting prediction method based on enhanced hybrid linear networks and semantic prior constraints, characterized in that, The method includes: The raw point data generated during the touch writing process is acquired, and the raw point data is preprocessed and normalized to generate a fixed-length time sequence data. The time-series data is input into a pre-trained trajectory classification model, which outputs the probability distribution of the semantic category to which the current writing trajectory belongs. The time series data is input into a pre-trained trajectory prediction model, and the probability distribution is used as a prior constraint in the inference process of the trajectory prediction model. The trajectory prediction model outputs multiple predicted point coordinates. The predicted reporting coordinates are corrected, and the corrected predicted reporting coordinates are smoothly connected with the actual reporting coordinates in the original reporting data to generate a predicted writing trajectory for real-time display.
2. The handwriting prediction method based on enhanced hybrid linear networks and semantic prior constraints according to claim 1, characterized in that, The original reporting data is preprocessed and normalized to generate fixed-length time-series data, including: The original reporting data is subjected to outlier removal and time alignment. The velocity, direction angle, and curvature of the actual reported point are calculated based on the coordinates and timestamp of the actual reported point. The coordinates, velocity, direction angle, and curvature of the actual reported points are normalized using a multi-dimensional fixed-range normalization strategy to obtain normalized multi-dimensional data. The time-series data is generated based on the multidimensional data of a preset length.
3. The handwriting prediction method based on enhanced hybrid linear networks and semantic prior constraints according to claim 1, characterized in that, The trajectory classification model includes: The temporal feature extraction branch takes the temporal sequence data as input and uses an enhanced hybrid linear layer as its core to extract deep temporal features and output a deep temporal feature vector. The spatial feature extraction branch takes the time-series data as input and uses a multi-kernel one-dimensional convolutional network as its core to extract local spatial features and output a deep spatial feature vector. The attention fusion module is used to perform attention-weighted fusion of the temporal deep feature vector and the spatial deep feature vector to output a comprehensive fused feature; and The classification output module is used to map the integrated features to the category dimension, and normalize them using the Softmax function to output the probability distribution of the trajectory semantic category.
4. The handwriting prediction method based on enhanced hybrid linear networks and semantic prior constraints according to claim 3, characterized in that, The temporal feature extraction branch includes the following sequentially connected components: An enhanced hybrid linear layer is used to perform channel-adaptive weighting, multi-scale temporal block division, and low-rank detrended projection processing on the time-series data to obtain the first intermediate feature; The first random deactivation layer is used to randomly deactivate the first intermediate feature; as well as The first fully connected layer is used to map the features after random deactivation to a specified dimension and output the temporal deep feature vector.
5. The handwriting prediction method based on enhanced hybrid linear networks and semantic prior constraints according to claim 4, characterized in that, The enhanced hybrid linear layer comprises the following sequentially connected components: The channel adaptive weighting submodule is used to calculate the global average feature of the time series data in the time dimension. It generates the weight coefficients of each feature channel through a fully connected layer and normalizes them with Softmax. The normalized weight coefficients are broadcast to the time dimension and multiplied element by element with the time series data to output a weighted time series. The multi-scale temporal segmentation submodule is used to preset at least two segmentation number configurations. For each configuration, the weighted temporal sequence is reshaped into a three-dimensional tensor of "number of segments × segment length × feature dimension". The local average features within each segment are calculated and flattened into a one-dimensional vector. Temporal feature vectors of multiple scales are obtained through independent linear mapping layers. The low-rank detrended projection submodule is used to calculate the global average feature vector of the weighted time series in the time dimension, subtract the global average feature vector from the feature of each time step of the weighted time series to obtain the detrended residual sequence, and transform the detrended residual sequence sequentially through the first low-rank projection matrix and the second low-rank restoration matrix, and aggregate the restored sequence in the time dimension to output the low-rank feature vector. The adaptive feature fusion submodule is used to stack the time-domain feature vectors of the multiple scales and the low-rank feature vectors along the feature path dimension to obtain a stacked feature tensor. After the learnable fusion weight vector is normalized by Softmax, the weight coefficients of each feature are generated. After the weight coefficients are broadcast, they are multiplied element by element with the stacked feature tensor and summed along the feature path dimension to output the first intermediate feature.
6. The handwriting prediction method based on enhanced hybrid linear networks and semantic prior constraints according to claim 3, characterized in that, The spatial feature extraction branch includes: The first one-dimensional convolutional layer and the second one-dimensional convolutional layer are set in parallel. They use convolutional kernels with different receptive fields to extract local spatial features in parallel and output the second intermediate feature and the third intermediate feature respectively. ReLU activation layers and batch normalization layers are connected after each one-dimensional convolutional layer and are used to perform non-linear activation and batch normalization on the output of each one-dimensional convolutional layer. The channel stitching layer is used to stitch together the intermediate features of the two channels after nonlinear activation and batch normalization, and output the stitched features. The first max pooling layer is used to pool and compress the spliced features; The first flattening layer is used to flatten the pooled compressed features into a one-dimensional vector. The second random deactivation layer is used to randomly deactivate the flattened one-dimensional vector; and The second fully connected layer is used to map the features after random deactivation to a specified dimension and output a deep feature vector in the spatial space.
7. The handwriting prediction method based on enhanced hybrid linear networks and semantic prior constraints according to claim 1, characterized in that, The trajectory prediction model includes: The GRU feature extraction branch takes the time-series data as input to extract time-dependent features and outputs a global time-series feature vector. The convolutional feature extraction branch takes the time-series data as input to extract local spatial morphological features and outputs a spatial feature vector. The channel attention module is used to concatenate the global temporal feature vector and the spatial feature vector along the channel dimension, generate channel weight vectors through a compression-decomposition structured attention subnet, perform channel adaptive recalibration on the concatenated features, and output the recalibrated comprehensive trajectory features. The prior feature processing branch is used to weight the probability distribution with confidence and then process it through a fully connected layer and a ReLU activation layer in sequence, outputting prior features that have undergone nonlinear mapping. The dynamic gating fusion module is used to dynamically gating and fusing the integrated trajectory features and the prior features, and output the fused features; The coordinate coupling prediction module is used to nonlinearly map the fused features through a fully connected layer and then output multiple predicted point coordinates through a linear regression layer.
8. The handwriting prediction method based on enhanced hybrid linear networks and semantic prior constraints according to claim 7, characterized in that, The GRU feature extraction branch includes: The first gated recurrent unit layer adopts a bidirectional gated recurrent unit structure with 32 hidden units. It is used to extract the bidirectional temporal dependency features of the time series data and output the temporal context sequence. The first normalization layer is used to perform layer normalization processing on the temporal context sequence; The second gated recurrent unit layer, employing a unidirectional gated recurrent unit structure, has 64 hidden units and is used to further extract temporal dependency features from the normalized temporal context sequence; and The second normalization layer is used to perform layer normalization processing on the output of the second gated recurrent unit layer and output the global temporal feature vector.
9. The handwriting prediction method based on enhanced hybrid linear networks and semantic prior constraints according to claim 7, characterized in that, The convolutional feature extraction branch includes: The first convolutional layer adopts a one-dimensional convolutional structure with a kernel size of 3, and is used to extract the local spatial features of the time series data and output the first convolutional features. The second max pooling layer is used to perform pooling compression on the first convolutional features and output pooled features. The second convolutional layer adopts a one-dimensional convolutional structure with a kernel size of 5. It is used to further extract local spatial features from the pooling features and output the second convolutional features. The second flattening layer is used to flatten the second convolutional feature into a one-dimensional vector; and The fifth fully connected layer is used to map the flattened one-dimensional vector to a specified dimension and output the spatial feature vector.
10. The handwriting prediction method based on enhanced hybrid linear networks and semantic prior constraints according to claim 7, characterized in that, The channel attention module includes: The first feature concatenation unit is used to concatenate the global temporal feature vector and the spatial feature vector along the channel dimension, and output the concatenated feature vector; The compression unit, employing a fully connected layer structure, maps the concatenated feature vectors to a 16-dimensional latent space and outputs compressed features. The restoration unit, employing a fully connected layer structure, is used to map the compressed features back to the original channel dimension and output the restored features. The normalization unit uses the Softmax function to normalize the restored features and generate a channel weight vector. A recalibration unit is used to multiply the channel weight vector element-wise with the concatenated feature vector to output a weighted feature; and A layer normalization unit is used to perform layer normalization processing on the weighted features and output the comprehensive trajectory features; The dynamic gating fusion module includes: The second feature splicing unit is used to splice the prior features with the comprehensive trajectory features and output spliced and fused features; The gating generation unit employs a single-neuron fully connected layer and a Sigmoid activation function to generate scalar gating coefficients based on the splicing and fusion features. The gated weighting unit uses the gate coefficients to scale and concatenate the prior features and the integrated trajectory features to output the fused features.
Citation Information
Patent Citations
Writing track prediction method, device and equipment
CN121050596A
Handwriting real-time prediction method based on hybrid time sequence convolutional network
CN121807214A