Search

CN-115056216-B - Handwriting mechanical arm control method and system based on stroke flow trend prediction

CN115056216BCN 115056216 BCN115056216 BCN 115056216BCN-115056216-B

Abstract

The invention discloses a handwriting mechanical arm control method based on stroke flow trend prediction, which comprises the steps of collecting image information in a handwriting mechanical arm writing area through shooting equipment, summarizing the image information and current time data to serve as historical data, inputting the historical data into a preset KNN model, clustering the historical data into a plurality of clusters, setting the number of the clusters according to covariance requirements in the clusters and covariance requirements among the clusters, temporarily storing obtained results in the KNN model, then adding current measured data to cluster again, clustering the current measured data into corresponding clusters, inputting n data A1-An in the clusters where the data are located into An LSTM model together with the current measured data an+1, inputting the historical data into the LSTM model to initialize the model, sequentially inputting the data A1-an+1 obtained in the KNN model into the trained LSTM model to obtain corresponding output values, and taking a weighted average value of the output values as the result to be output.

Inventors

  • XIE WU
  • WANG XINGYU
  • FAN YONG
  • WU SHUQIN
  • ZHOU TIAN

Assignees

  • 桂林电子科技大学

Dates

Publication Date
20260508
Application Date
20220526

Claims (3)

  1. 1. A handwriting mechanical arm control method based on stroke flow trend prediction is characterized by comprising the following steps: (1) Collecting image information and current time data which are collected as historical data; (2) Inputting the historical data into a preset KNN clustering algorithm model, clustering the historical data into a plurality of clusters, wherein each cluster comprises a plurality of data samples, the number of the clusters is set by covariance requirements in the clusters and covariance requirements among the clusters, and the obtained result is temporarily stored in the KNN model; (3) Adding current measured data on the basis of the previous step to cluster again, clustering the current measured data into corresponding clusters, and inputting n data A1-An in the clusters where the data are located and the current measured data an+1 into An LSTM neural network model; (4) Inputting the historical data into the LSTM neural network model to initialize the model, and skipping the step if the model is initialized; (5) Sequentially inputting the data A1-an+1 obtained in the KNN model in the step (3) into a trained LSTM model to obtain corresponding output values F (Ai), i=1, 2,3, & gt, n, n+1, and taking a weighted average Fout of the output values F (Ai) as a result to output.
  2. 2. A handwriting robotic arm control system constructed by the control method of claim 1, said system comprising: (1) The shooting equipment is used for acquiring image information in a handwriting mechanical arm writing area and transmitting the image information to the data acquisition component; (2) The moment acquisition component is used for acquiring current time data and transmitting the current time data to the data acquisition component and the stroke flow generation component; (3) The data acquisition component collects image information and current time data in a handwriting area of the handwriting mechanical arm and transmits the image information and the current time data to the historical data storage component and the KNN clustering algorithm preprocessing component so as to facilitate the subsequent related calculation of stroke flow trend and stroke overlapping degree; (4) The historical data storage component is used for storing the image information and the corresponding time data of the data acquisition component and providing the data for the KNN clustering algorithm preprocessing component and the LSTM neural network data analysis component for analysis and processing; (5) The KNN clustering algorithm preprocessing component inputs the stroke information, time and other data collected at the current moment and the historical data into the KNN clustering model together for preprocessing, and inputs the preprocessed data into the LSTM neural network analysis component; (6) Inputting relevant data provided by the KNN clustering algorithm preprocessing component and the history data storage component into an LSTM neural network model for analysis to obtain a prediction result of stroke flow trend of the handwriting mechanical arm in a period from the current moment to the next moment; (7) The stroke flow direction generating component generates stroke information in the current time period according to the stroke flow direction prediction result provided by the LSTM neural network data analysis component and provides the stroke information to the stroke superposition degree feedback component; (8) The stroke coincidence degree feedback component is used for comparing the stroke information in the current time period provided by the stroke flow direction generating component with the corresponding standard stroke information to obtain the percentage of the stroke coincidence degree, and re-transmitting the corresponding information to the KNN clustering algorithm preprocessing component to adjust the corresponding weight and re-calculate if the result is smaller than the set threshold value; (9) And the mechanical arm output equipment is used for outputting the stroke flow information in the current time period judged by the stroke superposition degree feedback component.
  3. 3. A non-transitory computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the steps of the stroke flow direction prediction based handwriting robot arm control method of claim 1.

Description

Handwriting mechanical arm control method and system based on stroke flow trend prediction Technical Field The invention relates to the technical field of automatic control, in particular to a handwriting mechanical arm control method and system based on stroke flow direction prediction. Background The traditional writing mechanical arm has limited functions, is difficult to intelligently write according to the handwriting theory, and is particularly difficult to realize the writing formation in the writing process according to the handwriting theory. The traditional writing mechanical arm only writes according to a set program, the fonts can not be optimized in a targeted mode according to the historical writing results so that the subsequent writing of the characters is better, and the traditional writing mechanical arm can not disassemble the complete Chinese characters to generate correct writing strokes. Disclosure of Invention The invention provides a handwriting mechanical arm control method and system based on stroke flow trend prediction, comprising shooting equipment, a data acquisition component, a historical data storage component, a moment acquisition component, a KNN clustering algorithm data preprocessing component, an LSTM neural network data analysis component, a stroke flow trend generation component, a stroke superposition degree feedback component, a mechanical arm output component and the like. The invention relates to a character constructing method based on stroke flow trend, which can split a complete character into strokes, and then construct and write according to the stroke flow trend predicted at the current time, and comprises the steps of ① splitting a character into a plurality of strokes. ② And determining a stroke starting point and a stroke end point according to the standard font. ③ And generating the current stroke flow trend for the single stroke according to the historical data and the current moment. ④ Judging whether the superposition degree of the current strokes is greater than a threshold value, if so, repeating the step ②、③, and if so, combining the strokes according to the initial positions to form a complete writing sequence. The invention also relates to a stroke flow trend prediction method based on KNN clustering and LSTM neural network, which comprises the following steps of ① clustering historical data based on a KNN algorithm. ② And adding the measured data to carry out KNN clustering again, and preprocessing the measured data. ③ LSTM neural networks are trained using historical data. ④ Inputting the processed measured data into a trained LSTM neural network, and outputting stroke flow trend in the handwriting mechanical arm and stroke flow prediction results at the next moment of each region by the LSTM neural network. According to the historical writing result of the handwriting mechanical arm, the error formed by the handwriting mechanical arm and the standard stroke flow and a set threshold value, a reliable prediction model of the stroke flow trend in the handwriting mechanical arm is established through a KNN clustering algorithm and an LSTM neural network algorithm, a shooting feedback system of the handwriting mechanical arm is realized according to the model, the whole Chinese character can be split into strokes, the writing effect of each stroke is continuously optimized according to the historical writing result of the handwriting mechanical arm, and finally the effect of improving the capability of the mechanical arm to write the whole Chinese character is achieved. The invention also provides a non-transitory computer readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the handwriting mechanical arm control method based on stroke flow direction prediction. According to the invention, on the basis of the historical data of the mechanical arm writing result, the strokes in the fonts can be continuously optimized, so that the overall writing effect is more standard, and finally, the purpose of improving the self writing effect of the mechanical arm is achieved. Drawings FIG. 1 is a flow chart of a word forming system in the present invention; fig. 2 is a block diagram of the word forming system in the present invention. Detailed Description The invention is further described below with reference to the accompanying drawings, which facilitate a more detailed understanding of the technical solutions, the final objects and the experimental effects of the invention. As shown in FIG. 1, a Chinese character input system to be written splits a Chinese character to be written into strokes, uses a KNN clustering algorithm to preprocess historical data for each stroke, inputs an LSTM neural network to analyze, then generates a stroke flow trend at the current moment of the stroke, modifies related weights to carry out the operation again if the stroke overlapping degree is smaller than