Calligraphy robot arm control method and system based on stroke flow direction prediction
By using KNN clustering and LSTM neural network to predict stroke flow, the problem of traditional writing robotic arms being unable to intelligently write Chinese characters has been solved, thus optimizing and standardizing the writing effect of the robotic arm.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUILIN UNIV OF ELECTRONIC TECH
- Filing Date
- 2022-05-26
- Publication Date
- 2026-05-08
AI Technical Summary
Traditional robotic arms for writing characters cannot write intelligently according to calligraphy theory, and cannot optimize fonts or break down Chinese characters to generate correct writing strokes.
A stroke flow prediction method based on KNN clustering and LSTM neural network is adopted. Through components such as shooting equipment, data acquisition, historical data storage, data preprocessing, stroke flow generation and robotic arm output, Chinese characters can be split and optimized for writing.
The overall effect of the robotic arm writing Chinese characters has been improved. By continuously optimizing the stroke flow, the standardization and accuracy of the writing have been enhanced.
Smart Images

Figure CN115056216B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automatic control technology, specifically to a control method and system for a calligraphy robotic arm based on stroke flow direction prediction. Background Technology
[0002] Traditional writing robotic arms have limited functionality and struggle to write characters intelligently according to calligraphy theory, particularly in the process of character formation. They simply write according to a pre-programmed sequence, unable to optimize the font based on past writing results to improve future writing. Furthermore, they cannot break down complete Chinese characters to generate correct strokes. Summary of the Invention
[0003] This invention provides a calligraphy robotic arm control method and system based on stroke flow direction prediction, including a shooting device, a data acquisition component, a historical data storage component, a time acquisition component, a KNN clustering algorithm data preprocessing component, an LSTM neural network data analysis component, a stroke flow direction generation component, a stroke overlap degree feedback component, and a robotic arm output component.
[0004] The technical solution of this invention involves a character construction method based on stroke flow direction. This method can break down a complete character into strokes, and then construct and write the character based on the stroke flow direction predicted at the current time. The steps include: ① breaking down a character into multiple strokes. ② determining the starting and ending points of each stroke according to a standard font. ③ generating the current stroke flow direction for each stroke based on historical data and the current time. ④ determining whether the current stroke overlap is greater than a threshold. If it is less than the threshold, repeating steps ② and ③; if it is greater than the threshold, combining the strokes according to their starting positions to form a complete writing sequence.
[0005] The technical solution of this invention also involves a method for predicting stroke flow direction based on KNN clustering and LSTM neural network. The steps include: ① Clustering historical data using the KNN algorithm. ② Adding measured data and re-performing KNN clustering, preprocessing the measured data. ③ Training an LSTM neural network using the historical data. ④ Inputting the processed measured data into the trained LSTM neural network, which then outputs the stroke flow direction within the calligraphy robotic arm and the predicted stroke flow rate for each region at the next moment.
[0006] Based on the historical writing results of the calligraphy robotic arm and the error between it and the standard stroke flow, and the set threshold, a reliable stroke flow prediction model within the calligraphy robotic arm was established using the KNN clustering algorithm and the LSTM neural network algorithm. Based on this model, a shooting feedback system for the calligraphy robotic arm was implemented, which can break down complete Chinese characters into strokes and continuously optimize the writing effect of each stroke based on the historical writing results of the calligraphy robotic arm, ultimately improving the overall ability of the robotic arm to write Chinese characters.
[0007] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the above-described calligraphy robotic arm control method based on stroke flow direction prediction.
[0008] This invention can continuously optimize the strokes in the font based on historical data of the writing results of the robotic arm, making the overall writing effect more standardized, and ultimately improving the writing effect of the robotic arm itself. Attached Figure Description
[0009] Figure 1 This is a flowchart of the character formation system in this invention;
[0010] Figure 2 This is a structural block diagram of the character formation system in this invention. Detailed Implementation
[0011] The present invention will be further described below with reference to the accompanying drawings, so as to facilitate a more detailed understanding of the technical solution, ultimate purpose and experimental results of the present invention.
[0012] like Figure 1 As shown, the system inputs the Chinese character to be written. The system breaks down the Chinese character into strokes, preprocesses the historical data for each stroke using the KNN clustering algorithm, and then inputs it into the LSTM neural network for analysis. After that, it generates the stroke flow direction of the stroke at the current moment. If the stroke overlap is less than a set threshold, the relevant weights are modified and the above operation is repeated. If the stroke overlap is greater than the threshold, the strokes generated from the Chinese character to be input are combined into the writing trajectory of the Chinese character according to the starting position of the strokes, and the trajectory is input into the robotic arm output device.
[0013] like Figure 2 As shown, the energy-saving calligraphy writing and character formation system based on stroke flow direction prediction includes a shooting device, a data acquisition component, a historical data storage component, a time acquisition component, a KNN clustering algorithm data preprocessing component, an LSTM neural network data analysis component, a stroke flow direction generation component, a stroke overlap degree feedback component, and a robotic arm output component.
[0014] The imaging equipment and time acquisition component collect image information and current time data within the writing area of the calligraphy robotic arm and transmit them to the data acquisition component. The data acquisition component summarizes the image information and current time data within the writing area of the calligraphy robotic arm and transmits them to the historical data storage component and the KNN clustering algorithm preprocessing component for subsequent calculations related to stroke flow direction and stroke overlap.
[0015] The historical data storage component stores the image information and corresponding time data from the data acquisition component, and provides the data to the KNN clustering algorithm preprocessing component and the LSTM neural network data analysis component for analysis and processing.
[0016] The KNN clustering algorithm preprocessing component and the LSTM neural network data analysis component input the stroke information and time data collected at the current moment, along with historical data, into the KNN clustering model and the LSTM neural network analysis component. Through analysis, the predicted results of the stroke flow direction of the calligraphy robotic arm in the interval from the current moment to the next moment are obtained.
[0017] Stroke flow prediction methods based on KNN clustering and LSTM neural networks include:
[0018] Step 1: Input the historical data from the historical data storage component into the preset KNN clustering algorithm model. The input historical data is clustered into several clusters, each containing several data samples. The number of clusters is set by the covariance requirements within and between clusters. The results are temporarily stored in the KNN model component.
[0019] Step 2: Based on Step 1, add the current measured data and re-cluster the data. Cluster the current measured data into the corresponding clusters, and input the n data A1~An in the clusters where the data belongs, together with the current measured data An+1, into the LSTM neural network model.
[0020] Step 3: Input the historical data from the historical data storage component into the LSTM neural network model to initialize the model. If the model has already been initialized, skip this step.
[0021] Step 4: Input the data A1~An+1 obtained from the KNN model in Step 2 into the trained LSTM model in sequence to obtain the corresponding output values F(Ai), i=1,2,3,...,n,n+1. Take the weighted average of the output values Fout as the result output. The specific value of parameter t can be adjusted according to the actual situation.
[0022] .
[0023] The stroke flow direction generation component generates stroke information for the current time period based on the stroke flow direction prediction results provided by the LSTM neural network data analysis component, and provides this information to the stroke overlap feedback component. The stroke overlap feedback component compares the stroke information provided by the stroke flow direction generation component for the current time period with the corresponding standard stroke information to determine the percentage of stroke overlap. If the result is less than a set threshold, the information is re-input into the KNN clustering algorithm preprocessing component, the corresponding weights are adjusted, and the calculation is repeated. If the result is greater than the set threshold, the stroke information is output to the robotic arm output device.
[0024] The robotic arm output device will output stroke flow information for the current time period, as determined by the stroke overlap feedback component.
Claims
1. A method for controlling a calligraphy robotic arm based on stroke flow direction prediction, characterized in that, The method includes the following steps: (1) Collect image information of the writing area of the calligraphy robotic arm using a camera; summarize the collected image information and current time data as historical data; (2) Input the historical data into the preset KNN clustering algorithm model. The historical data is clustered into several clusters, each containing several data samples. The number of clusters is set by the covariance requirements within the clusters and the covariance requirements between the clusters. The results are temporarily stored in the KNN model. (3) Based on the previous step, the current measured data is added and re-clustered. The current measured data is clustered into the corresponding cluster, and the n data A1~An in the cluster where the data is located are input into the LSTM neural network model together with the current measured data An+1. (4) Input the historical data into the LSTM neural network model to initialize the model. If the model has already been initialized, skip this step. (5) Input the data A1~An+1 obtained from the KNN model in step (3) into the trained LSTM model in sequence to obtain the corresponding output value F(Ai), i=1,2,3,...,n,n+1, and take the weighted average value Fout of the output value F(Ai) as the result output.
2. The calligraphy robotic arm control system constructed by the control method of claim 1, characterized in that, The system includes: (1) Imaging equipment: to capture image information within the writing area of the calligraphy robotic arm and transmit it to the data acquisition component; (2) Time acquisition component: Collects the current time data and passes it to the data acquisition component and the stroke flow generation component; (3) Data acquisition component: It summarizes the image information and current time data within the writing area of the calligraphy robotic arm and transmits them to the historical data storage component and the KNN clustering algorithm preprocessing component for subsequent calculations of stroke flow direction and stroke overlap. (4) Historical data storage component: Stores the image information and corresponding time data of the data acquisition component, and provides the data to the KNN clustering algorithm preprocessing component and the LSTM neural network data analysis component for analysis and processing; (5) KNN clustering algorithm preprocessing component: Input the stroke information and time data collected at the current time together with the historical data into the KNN clustering model for preprocessing, and input the preprocessed data into the LSTM neural network analysis component; (6) LSTM Neural Network Data Analysis Component: Input the relevant data provided by the KNN clustering algorithm preprocessing component and the historical data storage component into the LSTM neural network model for analysis, and obtain the prediction results of the stroke flow direction of the calligraphy robot arm in the interval from the current time to the next time. (7) Stroke flow direction generation component: Based on the stroke flow direction prediction results provided by the LSTM neural network data analysis component, generate stroke information for the current time period and provide it to the stroke overlap feedback component. (8) Stroke overlap feedback component: compares the stroke information provided by the stroke flow generation component within the current time period with the corresponding standard stroke information to obtain the percentage of stroke overlap; if the result is less than the set threshold, the corresponding information is re-input into the KNN clustering algorithm preprocessing component, the corresponding weights are adjusted, and the calculation is performed again; if the result is greater than the set threshold, the stroke information is output to the robotic arm output device. (9) Robotic arm output device: Outputs stroke flow information within the current time period as determined by the stroke overlap feedback component.
3. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the calligraphy robotic arm control method based on stroke flow prediction as described in claim 1.
Citation Information
Patent Citations
Stroke recommendation method of calligraphy mechanical arm based on neighborhood
CN114925252A