Chinese character writing practice method and device, storage medium and computer equipment
By extracting and evaluating the strokes and structure information of Chinese character writing, personalized teaching suggestions are provided, and the problem of incomplete evaluation of Chinese character writing in the existing technology is solved, which improves the practice effect and students' learning interest.
Patent Information
- Application Number
- CN202510308187.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-14
- Publication Date
- 2025-07-11
AI Technical Summary
The existing Chinese character writing practice methods are mainly limited to the image matching of writing fonts and standard fonts. The evaluation effect needs to be improved, and it is impossible to fully evaluate students' Chinese character writing ability.
By obtaining writing font pictures, using image processing and text recognition technology to extract strokes and structure information, perform writing strokes and structure scoring, and recommend personalized writing teaching information based on the score.
It improves the accuracy and objectivity of Chinese character writing exercises, provides targeted learning suggestions, improves students' writing ability and understanding of Chinese characters and Chinese culture, and stimulates their interest in learning.
Smart Images

Figure CN120299334A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and particularly to a Chinese character writing practice method, device, storage medium and computer device. Background Art
[0002] Chinese character practice plays an important role in Chinese education and has many positive effects on the growth of students. First of all, through Chinese character practice, students can master the composition, pronunciation and meaning of Chinese characters, thereby improving their basic language ability, memory and attention to detail, which is particularly important for their reading comprehension and written expression. Secondly, as an important carrier of Chinese culture, learning Chinese characters helps primary school students understand and identify with Chinese culture and enhance their cultural identity.
[0003] However, with the popularization of digitalization and electronic devices, the writing ability of many students has declined, the practice time has decreased, and the number of spelling mistakes has increased. Although the change of modern teaching methods has brought some gamified and interactive learning experiences, it has also reduced traditional pen-and-paper practice. Nevertheless, Chinese character practice is still irreplaceably important for standardizing writing, enhancing memory and literacy ability, improving comprehensive quality and promoting thinking development.
[0004] At present, most Chinese character writing practice methods are limited to evaluating the practice effect by matching the writing font with the standard font, and the effect of Chinese character writing practice needs to be improved. Summary of the Invention
[0005] In view of this, the embodiments of the present application provide a Chinese character writing practice method, device, storage medium and computer device, which helps to achieve a comprehensive evaluation of Chinese character writing practice and improve the effect of Chinese character writing practice.
[0006] According to one aspect of the present application, a Chinese character writing practice method is provided, and the method includes:
[0007] Obtain a writing font picture for Chinese character writing practice for a reference character;
[0008] Extract strokes from the writing font picture according to the standard writing information of the reference character to obtain the writing stroke information of at least one stroke corresponding to the writing font picture, and determine the writing structure information of the writing font picture according to the writing stroke information and the standard writing information of the reference character;
[0009] Determine the writing structure score of the writing font picture based on the writing structure information, and determine the writing stroke score of the writing font picture based on the writing stroke information;
[0010] Recommend writing teaching information according to the writing structure score and the writing stroke score.
[0011] Optionally, before extracting strokes from the handwritten font image according to the standard writing information of the reference character, the method further includes:
[0012] Obtaining a plurality of reference character samples, standard writing information samples corresponding to each reference character sample, handwritten font image samples for the reference character samples, and stroke annotation information corresponding to the handwritten font image samples, wherein the standard writing information samples include standard stroke information samples;
[0013] Using a stroke extraction model to be trained to extract strokes from the handwritten font image samples based on the standard stroke information samples, obtaining stroke prediction information corresponding to the handwritten font image samples, and optimizing the model of the stroke extraction model to be trained based on the stroke prediction information and the stroke annotation information to obtain a target stroke extraction model;
[0014] Correspondingly, extracting strokes from the handwritten font image according to the standard writing information of the reference character to obtain writing stroke information of at least one stroke corresponding to the handwritten font image, including:
[0015] Inputting the standard stroke information in the standard writing information of the reference character and the handwritten font image into the target stroke extraction model for stroke extraction to obtain writing stroke information of at least one stroke corresponding to the handwritten font image.
[0016] Optionally, determining the writing structure information of the handwritten font image according to the writing stroke information and the standard writing information of the reference character, including:
[0017] Dividing the writing stroke information into at least one structural component according to the structural composition information in the standard writing information of the reference character to obtain the writing structure information of the handwritten font image.
[0018] Optionally, determining the writing structure score of the handwritten font image based on the writing structure information, including:
[0019] Determining component features corresponding to each structural component according to each structural component of the writing structure information, wherein the component features include a circumscribed rectangle of the component and / or the centroid of the component;
[0020] Determining a component score for each structural component according to the component features of each structural component and the standard component features of each structural component in the reference character, and determining the writing structure score of the handwritten font image based on the component scores of each structural component.
[0021] Optionally, determining the writing structure score of the written font image based on the component scores of each structural component includes:
[0022] Determining the center of gravity of the written font image according to the writing stroke information, and determining the overall structure score of the written font image according to the center of gravity of the written font image and the standard center of gravity of the reference character corresponding to the reference character;
[0023] Determining the writing structure score of the written font image according to the component scores of each structural component and the overall structure score.
[0024] Optionally, the writing stroke information includes stroke images; determining the writing stroke score of the written font image based on the writing stroke information includes:
[0025] For any one stroke, using a thinning algorithm to thin the stroke image of the stroke so that the stroke in the stroke image becomes a skeleton image with a width of one pixel, and respectively determining the corresponding relationship between each pixel point in the thinned stroke image and each pixel point in the standard thinned stroke image of the stroke in the reference character, and determining the score of each pixel point in the thinned stroke image according to the positions of the pixel points in the thinned stroke image and the corresponding pixel points in the standard thinned stroke image;
[0026] Determining the stroke score of each stroke according to the scores of each pixel point in each stroke, and determining the writing stroke score of the written font image according to the stroke scores of each stroke.
[0027] Optionally, the step of respectively determining the corresponding relationship between each pixel point in the thinned stroke image and each pixel point in the standard thinned stroke image of the stroke in the reference character includes:
[0028] Performing adjacent foreground pixel search based on any one foreground pixel in the thinned stroke image, and determining the order of the foreground pixel and the corresponding adjacent foreground pixels according to the writing rules of the stroke in the reference character, and continuing to perform foreground pixel search on the thinned stroke image until the order of all foreground pixels in the thinned stroke image is determined, and encoding the foreground pixels based on the order of all foreground pixels in the thinned stroke image;
[0029] Respectively determining the corresponding relationship between each pixel point in the thinned stroke image and each pixel point in the standard thinned stroke image according to the sequential encoding of all foreground pixels in the thinned stroke image and the standard sequential encoding of all foreground pixels in the standard thinned image.
[0030] Optionally, determining the correspondence between each pixel point in the refined stroke image and each pixel point in the standard refined stroke image according to the sequential encoding of each foreground pixel in the refined stroke image and the standard sequential encoding of each foreground pixel in the standard refined image includes:
[0031] Calculating the ratio of the sequential encoding of each foreground pixel in the refined stroke image to the number of foreground pixels in the refined stroke image as the relative position of each foreground pixel in the refined stroke image, calculating the product of the relative position and the total number of foreground pixels in the standard refined image and then taking the integer, and determining the correspondence between each pixel point in the refined stroke image and each pixel point in the standard refined stroke image according to the pixel point with the standard sequential encoding corresponding to the integer result.
[0032] Optionally, before determining the writing stroke score of the writing font image according to the stroke score of each stroke, the method further includes:
[0033] Identifying the number of connected stroke writings and the number of repeated stroke writings in the writing stroke information according to the standard stroke information in the standard writing information of the reference character;
[0034] Correspondingly, determining the writing stroke score of the writing font image according to the stroke score of each stroke includes:
[0035] Determining the writing stroke score of the writing font image according to the stroke score of each stroke, the number of connected stroke writings, and the number of repeated stroke writings.
[0036] Optionally, determining the writing stroke score of the writing font image according to the score of each stroke, the number of connected stroke writings, and the number of repeated stroke writings includes:
[0037] In the case where the Chinese character writing practice is an offline practice, determining the writing stroke score of the writing font image according to the score of each stroke, the number of connected stroke writings, and the number of repeated stroke writings;
[0038] In the case where the Chinese character writing practice is an online practice, obtaining the writing trajectory of the Chinese character writing practice, identifying the number of wrongly-written stroke orders and the number of wrongly-written stroke directions in the writing trajectory according to the writing trajectory and the standard writing rules in the standard writing information of the reference character, and determining the writing stroke score of the writing font image according to the score of each stroke, the number of connected stroke writings, the number of repeated stroke writings, the number of wrongly-written stroke orders, and the number of wrongly-written stroke directions.
[0039] Optionally, the writing teaching information recommendation based on the writing structure score and the writing stroke score includes:
[0040] If the sum of the writing structure score and the writing stroke score is less than a preset writing score, output writing prompt words based on the writing structure score and the writing stroke score, and recommend the writing teaching information of the reference character;
[0041] If the component score of any component part in the writing structure score is less than the first preset component score, determine the first teaching character that matches the any component part, and recommend the writing teaching information of the first teaching character;
[0042] If the writing structure score is less than the first preset structure score, determine the second teaching character that matches the writing structure of the reference character, and recommend the writing teaching information of the second teaching character;
[0043] If the stroke score of any stroke in the writing stroke score is less than the second preset stroke score, determine the third teaching character that matches the any stroke and recommend the writing teaching information of the third teaching character, and / or recommend the writing teaching information of the any stroke.
[0044] Optionally, the method further includes:
[0045] Obtain the historical writing structure score and the historical writing stroke score for practicing Chinese character writing for multiple historical reference characters, where the historical writing structure score includes the historical structure component scores of the respective structure components corresponding to the historical reference characters, and the historical writing stroke score includes the historical stroke scores of each stroke corresponding to the historical reference characters;
[0046] Statistically analyze the historical structure component scores of historical reference characters with the same structure components, the historical writing structure scores of historical reference characters with the same writing structure, and the historical writing stroke scores of historical reference characters with the same strokes;
[0047] If the statistical data of the historical structure component scores for any same structure component is less than the second preset component score, determine the fourth teaching character that matches the any same structure component, and recommend the writing teaching information of the fourth teaching character;
[0048] If the statistical data of the historical writing structure scores for any same writing structure is less than the second preset structure score, determine the fifth teaching character that matches the any same writing structure, and recommend the writing teaching information of the fifth teaching character;
[0049] If the historical stroke score statistical data for any same stroke is less than the second preset stroke score, determine the sixth teaching character that matches the any same stroke and recommend the writing teaching information of the sixth teaching character, and / or recommend the writing teaching information of the any same stroke.
[0050] According to another aspect of the present application, there is provided a Chinese character writing practice device, the device includes:
[0051] A picture acquisition module, configured to acquire a writing font picture for practicing Chinese character writing for a reference character;
[0052] A stroke extraction module, configured to extract strokes from the writing font picture according to the standard writing information of the reference character, obtain the writing stroke information of at least one stroke corresponding to the writing font picture, and determine the writing structure information of the writing font picture according to the writing stroke information and the standard writing information of the reference character;
[0053] A writing scoring module, configured to determine the writing structure score of the writing font picture based on the writing structure information, and determine the writing stroke score of the writing font picture based on the writing stroke information;
[0054] A teaching recommendation module, configured to recommend writing teaching information according to the writing structure score and the writing stroke score.
[0055] Optionally, the device further includes: a model training module, configured to:
[0056] Acquire a plurality of reference character samples, the standard writing information samples corresponding to each reference character sample, the writing font picture samples for the reference character samples, and the stroke annotation information corresponding to the writing font picture samples, wherein the standard writing information samples include standard stroke information samples;
[0057] Extract strokes from the writing font picture samples by a stroke extraction model to be trained based on the standard stroke information samples, obtain the stroke prediction information corresponding to the writing font picture samples, and optimize the model of the stroke extraction model to be trained based on the stroke prediction information and the stroke annotation information to obtain a target stroke extraction model;
[0058] Correspondingly, the stroke extraction module is further configured to:
[0059] Input the standard stroke information in the standard writing information of the reference character and the writing font picture into the target stroke extraction model for stroke extraction, to obtain the writing stroke information of at least one stroke corresponding to the writing font picture.
[0060] Optionally, the stroke extraction module is further configured to:
[0061] According to the structural composition information in the standard writing information of the reference character, divide the writing stroke information into at least one structural composition part to obtain the writing structure information of the writing font picture.
[0062] Optionally, the writing scoring module is further configured to:
[0063] Determine the component features corresponding to each structural composition part according to each structural composition part of the writing structure information, where the component features include the circumscribed rectangle of the component and / or the centroid of the component;
[0064] Determine the component scores of each structural composition part according to the component features of each structural composition part and the standard component features of each structural composition part in the reference character, and determine the writing structure score of the writing font picture based on the component scores of each structural composition part.
[0065] Optionally, the writing scoring module is further configured to:
[0066] Determine the centroid of the font of the writing font picture according to the writing stroke information, and determine the overall structure score of the writing font picture according to the centroid of the font and the standard centroid of the font corresponding to the reference character;
[0067] Determine the writing structure score of the writing font picture according to the component scores of each structural composition part and the overall structure score.
[0068] Optionally, the writing scoring module is further configured to:
[0069] For any one stroke, use a thinning algorithm to thin the stroke picture of the stroke so that the stroke in the stroke picture becomes a skeleton picture with a width of one pixel. According to the thinned stroke picture and the standard thinned stroke picture of the stroke in the reference character, determine the corresponding relationship between each pixel point in the thinned stroke picture and each pixel point in the standard thinned stroke picture, and determine the score of each pixel point in the thinned stroke picture according to the position of each pixel point in the thinned stroke picture and the position of the corresponding pixel point in the standard thinned stroke picture;
[0070] Determine the stroke score of each stroke according to the scores of each pixel point in each stroke, and determine the writing stroke score of the writing font picture according to the stroke scores of each stroke.
[0071] Optionally, the writing scoring module is further configured to:
[0072] Search for adjacent foreground pixels based on any foreground pixel in the refined stroke image, determine the order of the foreground pixel and the corresponding adjacent foreground pixels according to the writing rules of the stroke in the reference character, continue to search for foreground pixels in the refined stroke image until the order of each foreground pixel in the refined stroke image is determined, and encode the foreground pixels based on the order of each foreground pixel in the refined stroke image;
[0073] According to the sequential encoding of each foreground pixel in the refined stroke image and the standard sequential encoding of each foreground pixel in the standard refined image, determine the corresponding relationship between each pixel point in the refined stroke image and each pixel point in the standard refined stroke image.
[0074] Optionally, the writing scoring module is further configured to:
[0075] Calculate the ratio of the sequential encoding of each foreground pixel in the refined stroke image to the number of foreground pixels in the refined stroke image as the relative position of each foreground pixel in the refined stroke image, calculate the product of the relative position and the total number of foreground pixels in the standard refined image and then round it, and determine the corresponding relationship between each pixel point in the refined stroke image and each pixel point in the standard refined stroke image according to the pixel point with the standard sequential encoding corresponding to the rounding result.
[0076] Optionally, the writing scoring module is further configured to:
[0077] Identify the number of connected-stroke writings and the number of repeated-stroke writings in the writing stroke information according to the standard stroke information in the standard writing information of the reference character;
[0078] Determine the writing stroke score of the writing font image according to the stroke score of each stroke, the number of connected-stroke writings, and the number of repeated-stroke writings.
[0079] Optionally, the writing scoring module is further configured to:
[0080] In the case where the Chinese character writing practice is an offline practice, determine the writing stroke score of the writing font image according to the score of each stroke, the number of connected-stroke writings, and the number of repeated-stroke writings.
[0081] In the case where the Chinese character writing practice is an online practice, obtain the writing trajectory of the Chinese character writing practice. According to the writing trajectory and the standard writing rules in the standard writing information of the reference character, identify the number of strokes with incorrect writing order and the number of strokes with incorrect writing direction in the writing trajectory, and determine the writing stroke score of the writing font picture according to the score of each stroke, the number of connected strokes, the number of repeated strokes, the number of strokes with incorrect writing order, and the number of strokes with incorrect writing direction.
[0082] Optionally, the teaching recommendation module is further configured to:
[0083] If the sum of the writing structure score and the writing stroke score is less than the preset writing score, output a writing prompt message based on the writing structure score and the writing stroke score, and recommend the writing teaching information of the reference character;
[0084] If the component score of any structural component in the writing structure score is less than the first preset component score, determine the first teaching character that matches the any structural component, and recommend the writing teaching information of the first teaching character;
[0085] If the writing structure score is less than the first preset structure score, determine the second teaching character that matches the writing structure of the reference character, and recommend the writing teaching information of the second teaching character;
[0086] If the stroke score of any stroke in the writing stroke score is less than the second preset stroke score, determine the third teaching character that matches the any stroke and recommend the writing teaching information of the third teaching character, and / or recommend the writing teaching information of the any stroke.
[0087] Optionally, the teaching recommendation module is further configured to:
[0088] Obtain the historical writing structure score and historical writing stroke score for Chinese character writing practice for multiple historical reference characters, where the historical writing structure score includes the historical structure component scores of the respective structural components corresponding to the historical reference characters, and the historical writing stroke score includes the historical stroke scores of each stroke corresponding to the historical reference characters;
[0089] Statistically analyze the historical structure component scores of historical reference characters with the same structural components, the historical writing structure scores of historical reference characters with the same writing structure, and the historical stroke scores of historical reference characters with the same strokes;
[0090] If the historical component score statistics for any identical structural component is less than the second preset component score, determine the fourth teaching character that matches the any identical structural component, and recommend the writing teaching information for the fourth teaching character;
[0091] If the historical writing structure score statistics for any identical writing structure is less than the second preset structure score, determine the fifth teaching character that matches the any identical writing structure, and recommend the writing teaching information for the fifth teaching character;
[0092] If the historical stroke score statistics for any identical stroke is less than the second preset stroke score, determine the sixth teaching character that matches the any identical stroke and recommend the writing teaching information for the sixth teaching character, and / or recommend the writing teaching information for the any identical stroke.
[0093] According to another aspect of the present application, there is provided a storage medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned Chinese character writing practice method is implemented.
[0094] According to still another aspect of the present application, there is provided a computer device, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, and when the processor executes the program, the above-mentioned Chinese character writing practice method is implemented.
[0095] By means of the above technical solutions, a Chinese character writing practice method, device, storage medium and computer device provided by the embodiments of the present application obtain a Chinese character writing font picture of a user, extract stroke and structure information by using image processing and character recognition technologies, and give writing stroke and structure scores based on this information. Finally, personalized writing teaching information is recommended according to the scores to improve the effect of Chinese character writing practice and the learning interest of students. The embodiments of the present application evaluate and guide students' Chinese character writing practice in an intelligent manner, not only improving the accuracy and objectivity of the evaluation, but also being able to provide targeted learning suggestions according to the actual situation of students, thereby effectively improving students' writing ability, enhancing the understanding and recognition of Chinese characters and Chinese culture, enriching students' learning experience, and stimulating learning interest.
[0096] The above description is only an overview of the technical solutions of the present application. In order to be able to understand the technical means of the present application more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the present application more obvious and understandable, the specific embodiments of the present application are given below. BRIEF DESCRIPTION OF THE DRAWINGS
[0097] The accompanying drawings described herein are used to provide a further understanding of the present application and form a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation of the present application. In the drawings:
[0098] Figure 1 A schematic flowchart of a Chinese character writing practice method provided by an embodiment of the present application is shown;
[0099] Figure 2 A schematic flowchart of another Chinese character writing practice method provided by an embodiment of the present application is shown;
[0100] Figure 3 A schematic structural diagram of a Chinese character writing practice device provided by an embodiment of the present application is shown. Detailed implementation manners
[0101] The present application will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments. It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments may be combined with each other.
[0102] In this embodiment, a Chinese character writing practice method is provided. As Figure 1 shown, the method includes:
[0103] Step 101, obtaining a writing font picture for practicing writing Chinese characters for a reference character.
[0104] Among them, the writing font picture refers to an image containing the Chinese characters written by the user obtained by means such as taking a photo or scanning during the Chinese character writing practice, or an image generated by writing practice with a stylus on devices such as mobile phones and tablets. The reference character refers to the target Chinese character for which the user practices writing, and it corresponds to standard writing information. Among them, the writing process of the student can be directly photographed by the camera of intelligent devices such as mobile phones and tablet computers to obtain a real-time writing font picture. The student can also scan the written paper through a scanner or upload it to a designated learning platform after taking a photo, so as to obtain the writing font picture. It is also possible to collect the image generated by the student's writing practice with a stylus.
[0105] Step 102, extracting strokes from the writing font picture according to the standard writing information of the reference character to obtain the writing stroke information of at least one stroke corresponding to the writing font picture, and determining the writing structure information of the writing font picture according to the writing stroke information and the standard writing information of the reference character.
[0106] Among them, stroke extraction refers to the process of identifying and separating each stroke from a handwritten font image. The handwritten stroke information includes features such as the shape, order, and position of the strokes, while the handwritten structure information reflects the overall layout and structural characteristics of the Chinese characters in the handwritten font image. Specifically, image processing algorithms can be used to preprocess the handwritten font image, such as denoising and binarization, to improve the accuracy of stroke extraction. Then, a stroke extraction algorithm is used to identify and separate each stroke in the image to obtain the handwritten stroke information. At the same time, by combining the standard writing information of the reference characters, the handwritten structure information of the handwritten font image, such as the relative position and overall layout of the strokes, is determined through comparative analysis.
[0107] Step 103: Determine the writing structure score of the handwritten font image based on the handwritten structure information, and determine the writing stroke score of the handwritten font image based on the handwritten stroke information.
[0108] Among them, a set of scoring criteria can be designed to quantify the handwritten structure information and the handwritten stroke information. For the handwritten structure information, it can be evaluated whether the overall layout of the strokes is reasonable and whether the proportions of each part are coordinated, etc.; for the handwritten stroke information, attention can be paid to whether the shape of the strokes is standard, whether the order is correct, and whether there are missing or redundant strokes, etc. According to these scoring criteria, the writing structure score and the writing stroke score are given respectively.
[0109] Step 104: Recommend writing teaching information according to the writing structure score and the writing stroke score.
[0110] Among them, according to the writing structure score and the writing stroke score, the writing level of the student can be comprehensively judged, and corresponding teaching information can be recommended accordingly. For example, for students with lower scores, more basic exercises and detailed stroke guidance can be recommended; while for students with higher scores, more advanced writing skills and cultural background knowledge can be provided. In addition, relevant learning resources and activities can be recommended personalized according to the student's learning progress and interests to enhance the student's learning interest and effect.
[0111] By applying the technical solution of this embodiment, by obtaining the Chinese character handwritten font image of the user, using image processing and character recognition technologies to extract stroke and structure information, and giving writing stroke and structure scores based on this information, and finally recommending personalized writing teaching information according to the scores to improve the effect of Chinese character writing practice and the learning interest of students. The embodiment of the present application evaluates and guides the Chinese character writing practice of students in an intelligent way, which not only improves the accuracy and objectivity of the evaluation, but also can provide targeted learning suggestions according to the actual situation of the students, thus effectively improving the writing ability of the students, enhancing the understanding and recognition of Chinese characters and Chinese culture, and at the same time enriching the learning experience of the students and stimulating the learning interest.
[0112] Further, as a refinement and extension of the specific implementation manner of the above embodiment, in order to completely illustrate the specific implementation process of this embodiment, another Chinese character writing practice method is provided. For example, Figure 2 as shown, this method includes:
[0113] Step 201: Obtain a writing font image for practicing Chinese character writing for a reference character.
[0114] In the embodiment of the present application, a writing font image obtained by a user after practicing writing a certain reference character is obtained. If it is offline writing practice, the writing font image can be obtained by means such as taking pictures and scanning. If it is online writing practice, the writing trajectory can be converted into a writing font image.
[0115] Step 202: Input the standard stroke information in the standard writing information of the reference character and the writing font image into the target stroke extraction model for stroke extraction, to obtain the writing stroke information of at least one stroke corresponding to the writing font image.
[0116] Wherein, before step 202, it further includes: obtaining a plurality of reference character samples, standard writing information samples corresponding to each reference character sample, writing font image samples for the reference character samples, and stroke annotation information corresponding to the writing font image samples, wherein the standard writing information samples include standard stroke information samples; using the stroke extraction model to be trained to perform stroke extraction on the writing font image samples based on the standard stroke information samples, to obtain stroke prediction information corresponding to the writing font image samples, and optimizing the model of the stroke extraction model to be trained based on the stroke prediction information and the stroke annotation information, to obtain a target stroke extraction model.
[0117] In the embodiments of the present application, before officially extracting strokes, it is necessary to first train a target stroke extraction model. This includes collecting multiple reference character samples and their corresponding standard writing information samples, writing font image samples, and stroke annotation information. Then, these information are used to train and optimize the stroke extraction model to be trained until the model can accurately extract stroke information from the writing font images. Specifically, the stroke extraction model can use the U-Net model, and the training method is as follows: construct a training dataset, which mainly includes two parts: one part is the data of reference characters, which includes the standard writing information samples of reference characters (the font of the reference characters can be selected, here taking "regular script" as an example, and for other fonts, only need to replace the reference characters with the corresponding font data), including the stroke names of reference characters, the corresponding single-stroke images of each stroke of the reference characters, and can also include the stroke order of reference characters, the structure of reference characters, radicals, components, and the stroke order index of each component; the other part is the images of user-written Chinese characters and the corresponding single-stroke images of each of them, as well as the stroke name annotations for the single-stroke images of each of them; and normalize them to the same size. The input of U-Net is: the reference character image, the user-written Chinese character image, a certain stroke of the reference character (the stroke to be extracted); the output is: the corresponding stroke of the user-written Chinese character. After the model outputs the corresponding stroke of the user-written Chinese character, the model is optimized according to the annotation information of the stroke until the model is trained. According to different practice scenarios, it can be divided into an offline practice scenario (writing on paper) and an online practice scenario (writing on the screen), and their data are images and writing trajectories respectively. The writing trajectories need to be converted into images before stroke extraction is performed on them. Through the trained target stroke extraction model, stroke information can be accurately extracted from the user's writing font images and compared with the standard stroke information, so as to more accurately evaluate the user's writing quality.
[0118] Step 203: According to the structural composition information in the standard writing information of the reference character, divide the writing stroke information into at least one structural composition part to obtain the writing structure information of the writing font image.
[0119] In the embodiments of the present application, after obtaining the writing stroke information, according to the standard structural composition information of the reference character, these stroke information are divided into different structural composition parts, so as to obtain the writing structure information of the user's writing font image, which helps to further analyze the user's writing habits and problems subsequently.
[0120] Step 204: Determine the component features corresponding to each structural component of the writing structure information. The component features include the circumscribed rectangle of the component and / or the centroid of the component. Determine the component scores of each structural component according to the component features of each structural component and the standard component features of each structural component in the reference character, and determine the writing structure score of the writing font image based on the component scores of each structural component.
[0121] In the embodiment of the present application, first, determine the component features of each structural component. These features may include the circumscribed rectangle of the component (i.e., the smallest rectangle that can completely contain the component) and / or the centroid of the component (i.e., the geometric center of the component in the image). These features help to more precisely describe and compare the similarities and differences between different structural components. After obtaining the component features of each structural component, compare these features with the standard component features of each structural component in the reference character. By calculating the similarity or distance between the features, a component score can be determined for each structural component. This score reflects the degree of closeness between the structural component in the user's writing and the standard writing. Finally, based on the component scores of each structural component, determine the writing structure score of the entire writing font image through weighted average or other statistical methods. This score comprehensively reflects the overall performance of all structural components in the user's writing. By determining the component features of each structural component and comparing them with the standard features, the present application can more carefully evaluate the accuracy and standardization of each part in the user's writing, helping the user to more clearly understand the writing problems and take corresponding improvement measures.
[0122] In an alternative embodiment, the determining the writing structure score of the writing font image based on the component scores of each structural component includes: determining the centroid of the font of the writing font image according to the writing stroke information, and determining the overall structure score of the writing font image according to the centroid of the font and the standard centroid of the reference character corresponding to the writing font image; determining the writing structure score of the writing font image according to the component scores of each structural component and the overall structure score.
[0123] In this embodiment, the writing stroke information can also be used to determine the center of gravity of the writing font picture. The center of gravity of a font is a key point in the font structure, which reflects the overall balance and stability of the font. By comparing and analyzing the positions and lengths of the writing strokes, the position of the center of gravity of the font can be accurately located. Further, the determined center of gravity of the writing font is compared with the standard center of gravity of the reference font corresponding to the reference character to measure the deviation degree of the writing font in the overall structure. The standard center of gravity of the font is usually statistically obtained based on the reference font samples and represents the ideal font structure balance. By calculating the difference between the actual center of gravity of the font and the standard center of gravity of the font, a score reflecting the overall structure quality, that is, the overall structure score, can be obtained. Finally, the overall structure score and the scores of each structural component are combined and comprehensively considered to determine the writing structure score of the writing font picture. Thus, the writing structure quality of the writing font picture can be evaluated more comprehensively and accurately, providing a useful reference for subsequent font improvement or teaching. Specifically, the loss calculation of the writing structure score can be performed through the following formula: n represents the number of components of a Chinese character, Dk1 represents the distance between the circumscribed rectangles of the k-th component of the writing character and the reference character, Ck represents the distance between the centers of gravity of the k-th component of the writing character and the reference character, and TC represents the distance between the overall centers of gravity of the writing character and the reference character. Then, the loss calculation value is converted into a writing structure score. Among them, the greater the loss, the lower the score; conversely, the smaller the loss, the higher the score.
[0124] Step 205: For any stroke, use a thinning algorithm to thin the stroke picture of the stroke so that the stroke in the stroke picture becomes a skeleton picture with a width of one pixel. According to the thinned stroke picture and the standard thinned stroke picture of the stroke in the reference character, determine the corresponding relationship between each pixel point in the thinned stroke picture and each pixel point in the standard thinned stroke picture, and determine the score of each pixel point in the thinned stroke picture according to the positions of the pixel points in the thinned stroke picture and the corresponding pixel points in the standard thinned stroke picture; determine the stroke score of each stroke according to the scores of each pixel point in each stroke, and determine the writing stroke score of the writing font picture according to the stroke scores of each stroke.
[0125] In the embodiments of the present application, for each extracted stroke, the stroke width in the stroke image is reduced to one pixel to form a skeleton image, which is convenient for subsequent pixel-level comparison. Specifically, thinning algorithms (such as Zhang-Suen thinning algorithm, Guo-Hall thinning algorithm, etc.) can be used to process the stroke image. These algorithms iteratively remove edge pixels until all stroke widths are reduced to one pixel. Then, a pixel point correspondence relationship is established between the thinned stroke image and the standard thinned stroke image of the corresponding stroke in the reference character. Among them, through image registration technology or feature matching algorithms, the corresponding position of each pixel point in the thinned stroke image in the standard thinned stroke image can be found. Further, the position difference between each pixel point in the thinned stroke image and its corresponding pixel point in the standard thinned stroke image is compared. The smaller the position difference, the higher the score. By synthesizing the scores of all pixel points, the overall score of a single stroke is obtained. Among them, operations such as averaging, weighted averaging, or taking the median of the scores of all pixel points can be performed to obtain the final score of the stroke. Finally, by synthesizing the scores of all strokes, the overall stroke score of the written font image is obtained. Here, the scores of all strokes can also be combined by methods such as averaging, weighted averaging, or taking the median to obtain the written stroke score of the written font image. Thus, the accurate evaluation of the stroke quality in the written font image is realized, which helps to improve the writing quality and guide the writing training.
[0126] In an alternative embodiment, the determining the correspondence relationship between each pixel point in the thinned stroke image and each pixel point in the standard thinned stroke image of the corresponding stroke in the reference character respectively includes: performing adjacent foreground pixel search based on any foreground pixel in the thinned stroke image, and determining the order of the foreground pixel and the corresponding adjacent foreground pixel according to the writing rule of the corresponding stroke in the reference character, and continuing to perform foreground pixel search on the thinned stroke image until the order of each foreground pixel in the thinned stroke image is determined, and encoding the foreground pixels based on the order of each foreground pixel in the thinned stroke image; determining the correspondence relationship between each pixel point in the thinned stroke image and each pixel point in the standard thinned stroke image respectively according to the order encoding of each foreground pixel in the thinned stroke image and the standard order encoding of each foreground pixel in the standard thinned image.
[0127] In this embodiment, a method based on foreground pixel search and encoding can be adopted to determine the correspondence of pixel points. First, select any foreground pixel (i.e., the pixel representing the stroke part) from the refined stroke picture as the starting point, and perform adjacent foreground pixel search, that is, find other foreground pixels adjacent to the current foreground pixel. According to the writing rules of the stroke in the reference character (such as stroke order, stroke direction, etc.), determine the sequential relationship between the current foreground pixel and the found adjacent foreground pixels. Guided by the determined sequential relationship, continue to perform foreground pixel search on the refined stroke picture. During the search process, assign a unique sequential code to each foreground pixel, and this code reflects the relative position and order of the pixel in the stroke. When all foreground pixels are searched and encoded, a code sequence representing the order of all foreground pixels in the refined stroke picture is formed. Additionally, perform the same processing on the standard refined stroke picture to form a standard code sequence representing the order of its foreground pixels. Here, the processing of the standard refined stroke picture can be completed in advance or at this time, and no limitation is made here. Further, by comparing the code sequence of the refined stroke picture with the code sequence of the standard refined picture, the correspondence of each pixel point in the two pictures can be determined. Specifically, it is to find the corresponding position of the code of each foreground pixel in the refined stroke picture in the code sequence of the standard refined picture, so as to determine the correspondence between them.
[0128] Through steps such as foreground pixel search, order determination, encoding, and comparison, the embodiment of this application realizes the accurate determination of the correspondence of pixel points between the refined stroke picture and the standard refined stroke picture, not only considering the shape and position of the stroke, but also considering the writing rules and order of the stroke, which helps to more accurately evaluate the writing quality subsequently.
[0129] In an alternative embodiment, the determining the correspondence of each pixel point in the refined stroke picture with each pixel point in the standard refined stroke picture according to the sequential codes of the foreground pixels in the refined stroke picture and the standard sequential codes of the foreground pixels in the standard refined picture includes: calculating the ratio of the sequential code of each foreground pixel in the refined stroke picture to the number of foreground pixels in the refined stroke picture as the relative position of each foreground pixel in the refined stroke picture, calculating the product of the relative position and the total number of foreground pixels in the standard refined picture and then taking the integer, and determining the correspondence of each pixel point in the refined stroke picture with each pixel point in the standard refined stroke picture according to the pixel point corresponding to the integer result's standard sequential code.
[0130] In this embodiment, a method based on relative position and proportional mapping is adopted to determine the corresponding relationship between the pixels in the refined stroke picture and the standard refined stroke picture. Specifically, for each foreground pixel in the refined stroke picture, calculate the ratio of its sequential code to the total number of foreground pixels in this picture. This ratio represents the relative position of this pixel in the stroke. The formula is expressed as: relative position = sequential code of foreground pixel / total number of foreground pixels. Use the relative position obtained from the previous step, multiply it by the total number of foreground pixels in the standard refined picture, and then perform operations such as rounding down or rounding up. The formula can be expressed as: mapped position = integer part (relative position * total number of foreground pixels in the standard refined picture). According to the mapped position, find the corresponding pixel point in the coding sequence of the standard refined picture. This pixel point is the corresponding point of the current foreground pixel in the refined stroke picture in the standard refined picture. Repeat the above steps for each foreground pixel in the refined stroke picture until the corresponding positions of all pixel points in the standard refined picture are determined. This method determines the corresponding relationship between the pixels in the refined stroke picture and the standard refined stroke picture by calculating relative position and proportional mapping, which helps to simply and quickly evaluate the writing quality.
[0131] In an alternative embodiment, before determining the writing stroke score of the writing font picture according to the stroke scores of each stroke, the method further includes: identifying the number of connected stroke writings and the number of repeated stroke writings in the writing stroke information according to the standard stroke information in the standard writing information of the reference character; correspondingly, determining the writing stroke score of the writing font picture according to the stroke scores of each stroke includes: determining the writing stroke score of the writing font picture according to the stroke scores of each stroke, the number of connected stroke writings, and the number of repeated stroke writings.
[0132] In this embodiment, the recognition of the number of connected strokes and the number of repeated strokes is also carried out to more comprehensively evaluate the writing stroke quality of the written font picture. Specifically, according to the standard stroke information in the standard writing information of the reference character, the number of connected strokes and the number of repeated strokes in the writing stroke information can be recognized. Among them, connected stroke writing refers to the phenomenon that two or more strokes are continuously written without interruption during the writing process. Repeated stroke writing refers to the situation where certain strokes are repeatedly written when writing the same character (although these strokes may only appear once in the standard writing). Connected stroke writing may cause the boundaries between strokes to be blurred, affecting the accuracy of writing. Repeated stroke writing may indicate that the writer's attention is not concentrated enough or the writing skills are not proficient enough. Further, when determining the writing stroke score of the written font picture according to the stroke score of each stroke, the influence of the number of connected strokes and the number of repeated strokes is considered. A deduction item can be set for connected stroke writing and repeated stroke writing respectively. Combining the stroke score of each stroke, the influence of the number of connected strokes and the number of repeated strokes, the writing stroke score of the written font picture is comprehensively calculated. By introducing the recognition of the number of connected strokes and the number of repeated strokes and correspondingly adjusting the stroke score, the embodiment of the present application can more comprehensively evaluate the writing stroke quality of the written font picture. This method not only considers the shape and position accuracy of the strokes themselves, but also considers the fluency and skillfulness during the writing process, providing richer information for writing quality evaluation.
[0133] In an alternative embodiment, determining the writing stroke score of the written font picture according to the score of each stroke, the number of connected strokes, and the number of repeated strokes includes: when the Chinese character writing practice is offline practice, determining the writing stroke score of the written font picture according to the score of each stroke, the number of connected strokes, and the number of repeated strokes; when the Chinese character writing practice is online practice, obtaining the writing trajectory of the Chinese character writing practice, identifying the number of wrongly-written strokes in writing order and the number of wrongly-written strokes in writing direction in the writing trajectory according to the writing trajectory and the standard writing rules in the standard writing information of the reference character, and determining the writing stroke score of the written font picture according to the score of each stroke, the number of connected strokes, the number of repeated strokes, the number of wrongly-written strokes in writing order, and the number of wrongly-written strokes in writing direction.
[0134] In this embodiment, when the Chinese character writing practice is an online practice, such as writing on the screen, it is also possible to obtain the writing trajectory data of the Chinese character writing practice performed on the electronic device. According to the writing trajectory and the standard writing rules, the number of strokes with incorrect writing order and the number of strokes with incorrect writing direction are identified. When calculating the writing stroke score, the number of strokes with incorrect writing order and the number of strokes with incorrect writing direction can also be considered. For example, the loss calculation of the writing stroke score can be performed through the following formula:
[0135] Where m represents the number of pixels of the reference stroke, Dk2 represents the distance between the k-th point of the reference character stroke and the corresponding position of the user's stroke, Cn represents the number of strokes of the heavy stroke, Ln represents the number of connected strokes, Sn represents the number of strokes with incorrect writing order, and Dn represents the number of strokes with incorrect writing direction. After determining the loss result of the writing stroke score, the writing stroke score can be further determined. Among them, the greater the loss, the lower the score; conversely, the smaller the loss, the higher the score. For the case where the Chinese character writing practice is an offline practice, the number of strokes with incorrect writing order and the number of strokes with incorrect writing direction do not need to be considered. By considering the writing practices in two different scenarios, offline and online, and determining the writing stroke score according to the characteristics and requirements of each scenario, the embodiments of the present application can more comprehensively evaluate the writing quality of the writer.
[0136] Step 206: Recommend writing teaching information according to the writing structure score and the writing stroke score.
[0137] In an alternative embodiment, step 206 includes:
[0138] If the sum of the writing structure score and the writing stroke score is less than the preset writing score, output writing prompt words based on the writing structure score and the writing stroke score, and recommend the writing teaching information of the reference character;
[0139] If the component score of any component part in the writing structure score is less than the first preset component score, determine the first teaching character that matches the any component part, and recommend the writing teaching information of the first teaching character;
[0140] If the writing structure score is less than the first preset structure score, determine the second teaching character that matches the writing structure of the reference character, and recommend the writing teaching information of the second teaching character;
[0141] If the stroke score of any stroke in the writing stroke score is less than the second preset stroke score, determine the third teaching character that matches the any stroke and recommend the writing teaching information of the third teaching character, and / or recommend the writing teaching information of the any stroke.
[0142] In the above embodiments, personalized recommendations for writing teaching information can be made based on the writing structure score and the writing stroke score. If the sum of the writing structure score and the writing stroke score is less than the preset writing score, specific prompt information can be generated according to the writing structure score and the writing stroke score, such as "Your writing structure is not accurate enough, and the strokes also need improvement." And writing teaching videos, graphic tutorials, etc. related to the reference character of the current exercise are provided to help the user improve their writing. If the score of any structural component in the writing structure score is less than the first preset component score, then a character similar to this structural component can be selected as the teaching character (i.e., the first teaching character) for the user to focus on practicing this part, and writing teaching videos, graphic tutorials, etc. related to the first teaching character are provided. If the writing structure score is less than the first preset structure score, then a character with a similar overall structure to the reference character can be selected as the teaching character (i.e., the second teaching character) to help the user understand and improve the overall structure, and writing teaching videos, graphic tutorials, etc. related to the second teaching character are provided. If the score of any stroke in the writing stroke score is less than the second preset stroke score, then a character with the same stroke as this stroke can be selected as the teaching character (i.e., the third teaching character) for the user to focus on practicing this stroke, and writing teaching videos, graphic tutorials, etc. related to the third teaching character are provided. In addition, teaching information such as the writing skills and practice methods of this stroke can also be directly provided. Among them, the preset writing score, the first preset component score, the first preset structure score, and the second preset stroke score should be reasonably set according to the actual situation to ensure the accuracy and effectiveness of the recommendation strategy. In practical applications, the recommendation strategy can be further adjusted and optimized according to the user's writing habits and levels to achieve more personalized teaching recommendations. In addition, the above recommendation strategies can be combined to provide more comprehensive and specific writing teaching information. Through the above steps and strategies, appropriate writing teaching information can be recommended for the user according to the user's writing structure score and writing stroke score to help the user improve their writing level.
[0143] In an alternative embodiment, the method further includes:
[0144] Obtaining the historical writing structure score and the historical writing stroke score for practicing Chinese character writing for multiple historical reference characters, where the historical writing structure score includes the historical structure component scores of the respective structural components corresponding to the historical reference characters, and the historical writing stroke score includes the historical stroke scores of each stroke corresponding to the historical reference characters;
[0145] Counting the historical structure component scores of the historical reference characters with the same structural components, the historical writing structure scores of the historical reference characters with the same writing structure, and the historical stroke scores of the historical reference characters with the same stroke;
[0146] If the historical component score statistics for any identical structural component are less than the second preset component score, determine the fourth teaching character that matches the any identical structural component, and recommend the writing teaching information of the fourth teaching character;
[0147] If the historical writing structure score statistics for any identical writing structure are less than the second preset structure score, determine the fifth teaching character that matches the any identical writing structure, and recommend the writing teaching information of the fifth teaching character;
[0148] If the historical stroke score statistics for any identical stroke are less than the second preset stroke score, determine the sixth teaching character that matches the any identical stroke and recommend the writing teaching information of the sixth teaching character, and / or recommend the writing teaching information of the any identical stroke.
[0149] In the above embodiments, the recommendation of writing teaching information can be further optimized by introducing historical data. Specifically, first, obtain the historical writing structure scores and historical writing stroke scores of multiple historical reference characters (each reference character is regarded as a historical reference character after completing the writing practice of that reference character, and the writing structure score and writing stroke score of this reference character are used as the historical writing structure score and historical writing stroke score). These scores include the scores of each structural component and each stroke. Statistically analyze the scores of historical reference characters with the same structural components, the same writing structure, and the same strokes, and based on the statistical results, recommend corresponding teaching characters or writing teaching information for the structural components, writing structures, or strokes with lower scores. Among them, statistically analyze the historical structural component scores of historical reference characters with the same structural components to obtain statistical data such as the score distribution or average value of this structural component. Statistically analyze the historical writing structure scores of historical reference characters with the same writing structure to obtain statistical data such as the score distribution or average value of this writing structure. Statistically analyze the historical stroke scores of historical reference characters with the same strokes to obtain statistical data such as the score distribution or average value of this stroke. Further, if the statistical data of the historical structural component scores (such as the average value) for any same structural component is less than the second preset component score, determine the fourth teaching character that matches this structural component and recommend the writing teaching information of the fourth teaching character to help the user improve the writing of this structural component. If the statistical data of the historical writing structure scores (such as the average value) for any same writing structure is less than the second preset structure score, determine the fifth teaching character that matches this writing structure and recommend the writing teaching information of the fifth teaching character to help the user improve the overall writing structure. If the statistical data of the historical stroke scores (such as the average value) for any same stroke is less than the second preset stroke score, determine the sixth teaching character that matches this stroke and recommend the writing teaching information of the sixth teaching character, or directly recommend the writing teaching information of this stroke to help the user improve the writing of this stroke. In the embodiments of the present application, the second preset component score and the second preset structure score should be reasonably set according to the actual situation to ensure the accuracy and effectiveness of the recommendation strategy. Through this implementation method, the method can make full use of historical data to provide more accurate and personalized writing teaching information recommendations for users, helping users more effectively improve their writing levels.
[0150] Further, as Figure 1 a specific implementation of the method, the embodiments of the present application provide a Chinese character writing practice device, as Figure 3 shown, the device includes:
[0151] A picture acquisition module, configured to acquire a writing font picture for practicing Chinese character writing for a reference character;
[0152] A stroke extraction module, configured to extract strokes from the handwritten font image according to the standard writing information of the reference character, obtain the writing stroke information of at least one stroke corresponding to the handwritten font image, and determine the writing structure information of the handwritten font image according to the writing stroke information and the standard writing information of the reference character;
[0153] A writing scoring module, configured to determine the writing structure score of the handwritten font image based on the writing structure information, and determine the writing stroke score of the handwritten font image based on the writing stroke information;
[0154] A teaching recommendation module, configured to recommend writing teaching information according to the writing structure score and the writing stroke score.
[0155] Optionally, the apparatus further includes: a model training module, configured to:
[0156] Obtain a plurality of reference character samples, the standard writing information samples corresponding to each reference character sample, the handwritten font image samples for the reference character samples, and the stroke annotation information corresponding to the handwritten font image samples, wherein the standard writing information samples include standard stroke information samples;
[0157] Extract strokes from the handwritten font image samples by a stroke extraction model to be trained based on the standard stroke information samples, obtain the stroke prediction information corresponding to the handwritten font image samples, and optimize the stroke extraction model to be trained based on the stroke prediction information and the stroke annotation information to obtain a target stroke extraction model;
[0158] Correspondingly, the stroke extraction module is further configured to:
[0159] Input the standard stroke information in the standard writing information of the reference character and the handwritten font image into the target stroke extraction model for stroke extraction, to obtain the writing stroke information of at least one stroke corresponding to the handwritten font image.
[0160] Optionally, the stroke extraction module is further configured to:
[0161] Divide the writing stroke information into at least one structural component according to the structural composition information in the standard writing information of the reference character, to obtain the writing structure information of the handwritten font image.
[0162] Optionally, the writing scoring module is further configured to:
[0163] Determine the component features corresponding to each structural component according to the structural components of the writing structure information, wherein the component features include the circumscribed rectangle of the component and / or the centroid of the component;
[0164] Determine the component scores of each structural component according to the component features of each structural component and the standard component features of each structural component in the reference character, and determine the writing structure score of the writing font image based on the component scores of each structural component.
[0165] Optionally, the writing scoring module is further configured to:
[0166] Determine the center of gravity of the writing font image according to the writing stroke information, and determine the overall structure score of the writing font image according to the center of gravity of the writing and the standard center of gravity of the reference character corresponding to the reference character;
[0167] Determine the writing structure score of the writing font image according to the component scores of each structural component and the overall structure score.
[0168] Optionally, the writing scoring module is further configured to:
[0169] For any stroke, use a thinning algorithm to thin the stroke image of the stroke so that the stroke in the stroke image becomes a skeleton image with a width of one pixel. According to the thinned stroke image and the standard thinned stroke image of the stroke in the reference character, determine the corresponding relationship between each pixel point in the thinned stroke image and each pixel point in the standard thinned stroke image, and determine the score of each pixel point in the thinned stroke image according to the position of each pixel point in the thinned stroke image and the position of the corresponding pixel point in the standard thinned stroke image;
[0170] Determine the stroke score of each stroke according to the scores of each pixel point in each stroke, and determine the writing stroke score of the writing font image according to the stroke scores of each stroke.
[0171] Optionally, the writing scoring module is further configured to:
[0172] Perform adjacent foreground pixel search based on any foreground pixel in the thinned stroke image, and determine the order of the foreground pixel and the corresponding adjacent foreground pixel according to the writing rules of the stroke in the reference character, and continue to perform foreground pixel search on the thinned stroke image until the order of each foreground pixel in the thinned stroke image is determined, and perform foreground pixel encoding based on the order of each foreground pixel in the thinned stroke image;
[0173] Determine the corresponding relationship between each pixel point in the refined stroke image and each pixel point in the standard refined stroke image respectively according to the sequential encoding of each foreground pixel in the refined stroke image and the standard sequential encoding of each foreground pixel in the standard refined image.
[0174] Optionally, the writing scoring module is further configured to:
[0175] Calculate the ratio of the sequential encoding of each foreground pixel in the refined stroke image to the number of foreground pixels in the refined stroke image as the relative position of each foreground pixel in the refined stroke image, calculate the product of the relative position and the total number of foreground pixels in the standard refined image and then round it, and determine the corresponding relationship between each pixel point in the refined stroke image and each pixel point in the standard refined stroke image according to the pixel point with the standard sequential encoding corresponding to the rounding result.
[0176] Optionally, the writing scoring module is further configured to:
[0177] Identify the number of connected stroke writings and the number of repeated stroke writings in the writing stroke information according to the standard stroke information in the standard writing information of the reference character;
[0178] Determine the writing stroke score of the writing font image according to the stroke score of each stroke, the number of connected stroke writings and the number of repeated stroke writings.
[0179] Optionally, the writing scoring module is further configured to:
[0180] In the case where the Chinese character writing practice is offline practice, determine the writing stroke score of the writing font image according to the score of each stroke, the number of connected stroke writings and the number of repeated stroke writings;
[0181] In the case where the Chinese character writing practice is online practice, obtain the writing trajectory of the Chinese character writing practice, identify the number of wrongly-written stroke orders and the number of wrongly-written stroke directions in the writing trajectory according to the writing trajectory and the standard writing rules in the standard writing information of the reference character, and determine the writing stroke score of the writing font image according to the score of each stroke, the number of connected stroke writings, the number of repeated stroke writings, the number of wrongly-written stroke orders and the number of wrongly-written stroke directions.
[0182] Optionally, the teaching recommendation module is further configured to:
[0183] If the sum of the writing structure score and the writing stroke score is less than a preset writing score, writing prompt words are output based on the writing structure score and the writing stroke score, and writing teaching information of the reference character is recommended;
[0184] If the component score of any structural component in the writing structure score is less than the first preset component score, the first teaching character matching the any structural component is determined, and writing teaching information of the first teaching character is recommended;
[0185] If the writing structure score is less than the first preset structure score, the second teaching character matching the writing structure of the reference character is determined, and writing teaching information of the second teaching character is recommended;
[0186] If the stroke score of any stroke in the writing stroke score is less than the second preset stroke score, the third teaching character matching the any stroke is determined and writing teaching information of the third teaching character is recommended, and / or, writing teaching information of the any stroke is recommended.
[0187] Optionally, the teaching recommendation module is further configured to:
[0188] Obtain historical writing structure scores and historical writing stroke scores for practicing Chinese character writing for multiple historical reference characters, where the historical writing structure scores include historical structure component scores of each structural component corresponding to the historical reference characters, and the historical writing stroke scores include historical stroke scores of each stroke corresponding to the historical reference characters;
[0189] Statistically analyze the historical structure component scores of historical reference characters with the same structural components, the historical writing structure scores of historical reference characters with the same writing structure, and the historical writing stroke scores of historical reference characters with the same strokes;
[0190] If the statistical data of the historical structure component scores for any same structural component is less than the second preset component score, the fourth teaching character matching the any same structural component is determined, and writing teaching information of the fourth teaching character is recommended;
[0191] If the statistical data of the historical writing structure scores for any same writing structure is less than the second preset structure score, the fifth teaching character matching the any same writing structure is determined, and writing teaching information of the fifth teaching character is recommended;
[0192] If the historical stroke score statistical data for any identical stroke is less than the second preset stroke score, determine the sixth teaching character that matches the any identical stroke and recommend the writing teaching information of the sixth teaching character, and / or recommend the writing teaching information of the any identical stroke.
[0193] It should be noted that for other corresponding descriptions of each functional unit involved in a Chinese character writing practice device provided in an embodiment of the present application, reference can be made to Figures 1 to 2 the corresponding description in the method, which will not be elaborated here.
[0194] An embodiment of the present application further provides a computer device, which may specifically be a personal computer, a server, a network device, etc. The computer device includes a bus, a processor, a memory, and a communication interface, and may further include an input / output interface and a display device. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store location information. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps in each method embodiment are implemented.
[0195] Those skilled in the art can understand that the structure of the above computer device is only a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components, or combine certain components, or have different component arrangements.
[0196] In one embodiment, a computer-readable storage medium is provided. The computer-readable storage medium may be non-volatile or volatile, and stores a computer program. When the computer program is executed by a processor, the steps in each of the above method embodiments are implemented.
[0197] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the steps in each of the above method embodiments are implemented.
[0198] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data that have been authorized by the user or fully authorized by all parties.
[0199] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.
[0200] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0201] The above-described embodiments merely represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A Chinese character writing practice method, characterized in that, The method includes: Obtaining a writing font image for practicing Chinese character writing for a reference character; Performing stroke extraction on the writing font image according to the standard writing information of the reference character to obtain writing stroke information of at least one stroke corresponding to the writing font image, and determining writing structure information of the writing font image according to the writing stroke information and the standard writing information of the reference character; Determining a writing structure score of the writing font image based on the writing structure information, and determining a writing stroke score of the writing font image based on the writing stroke information; Performing writing teaching information recommendation according to the writing structure score and the writing stroke score.
2. The method according to claim 1, wherein Before performing stroke extraction on the writing font image according to the standard writing information of the reference character, the method further includes: Obtaining a plurality of reference character samples, standard writing information samples corresponding to each reference character sample, writing font image samples for the reference character samples, and stroke annotation information corresponding to the writing font image samples, wherein the standard writing information samples include standard stroke information samples; Performing stroke extraction on the writing font image samples by a stroke extraction model to be trained based on the standard stroke information samples to obtain stroke prediction information corresponding to the writing font image samples, and optimizing the stroke extraction model to be trained based on the stroke prediction information and the stroke annotation information to obtain a target stroke extraction model; Correspondingly, performing stroke extraction on the writing font image according to the standard writing information of the reference character to obtain writing stroke information of at least one stroke corresponding to the writing font image, includes: Inputting the standard stroke information and the writing font image in the standard writing information of the reference character into the target stroke extraction model for stroke extraction to obtain writing stroke information of at least one stroke corresponding to the writing font image.
3. The method according to claim 1, wherein Determining the writing structure information of the writing font image according to the writing stroke information and the standard writing information of the reference character, includes: Dividing the writing stroke information into at least one structural component according to the structural composition information in the standard writing information of the reference character to obtain the writing structure information of the writing font image.
4. The method according to claim 3, wherein Determining the writing structure score of the writing font image based on the writing structure information, includes: Determining component features corresponding to each structural component according to each structural component of the writing structure information, wherein the component features include a component circumscribed rectangle and / or a component centroid; Determining a component score for each structural component according to the component features of each structural component and the standard component features of each structural component in the reference character, and determining the writing structure score of the writing font image based on the component scores of each structural component.
5. The method according to claim 4, wherein Determining the writing structure score of the writing font image based on the component scores of each structural component, includes: Determine the center of gravity of the written font image based on the above-mentioned writing stroke information, and determine the overall structure score of the written font image according to the center of gravity of the written font image and the standard center of gravity of the reference character corresponding to the reference character; Determine the writing structure score of the written font image according to the component scores of each structural component and the overall structure score.
6. The method according to claim 1, characterized in that, The writing stroke information includes stroke images; the determining of the writing stroke score of the written font image based on the writing stroke information includes: For any one stroke, use a thinning algorithm to thin the stroke image of the stroke so that the stroke in the stroke image becomes a skeleton image with a width of one pixel. According to the thinned stroke image and the standard thinned stroke image of the stroke in the reference character, respectively determine the corresponding relationship between each pixel point in the thinned stroke image and each pixel point in the standard thinned stroke image, and according to the positions of the pixel points in the thinned stroke image and the corresponding pixel points in the standard thinned stroke image, determine the scores of each pixel point in the thinned stroke image; Determine the stroke score of each stroke according to the scores of each pixel point in each stroke, and determine the writing stroke score of the written font image according to the stroke scores of each stroke.
7. The method according to claim 6, wherein The determining of the corresponding relationship between each pixel point in the thinned stroke image and each pixel point in the standard thinned stroke image of the stroke in the reference character respectively includes: Perform adjacent foreground pixel search based on any foreground pixel in the thinned stroke image, and determine the order of the foreground pixel and the corresponding adjacent foreground pixels according to the writing rules of the stroke in the reference character, and continue to perform foreground pixel search on the thinned stroke image until the order of all foreground pixels in the thinned stroke image is determined, and perform encoding of foreground pixels based on the order of all foreground pixels in the thinned stroke image; Determine the corresponding relationship between each pixel point in the thinned stroke image and each pixel point in the standard thinned stroke image respectively according to the sequential encoding of each foreground pixel in the thinned stroke image and the standard sequential encoding of each foreground pixel in the standard thinned image.
8. The method according to claim 7, characterized in that The determining of the corresponding relationship between each pixel point in the thinned stroke image and each pixel point in the standard thinned stroke image respectively according to the sequential encoding of each foreground pixel in the thinned stroke image and the standard sequential encoding of each foreground pixel in the standard thinned image includes: Calculate the ratio of the sequential encoding of each foreground pixel in the thinned stroke image to the number of foreground pixels in the thinned stroke image as the relative position of each foreground pixel in the thinned stroke image, and calculate the product of the relative position and the total number of foreground pixels in the standard thinned image and then round it. Determine the corresponding relationship between each pixel point in the thinned stroke image and each pixel point in the standard thinned stroke image according to the pixel point with the standard sequential encoding corresponding to the rounding result.
9. The method according to claim 6, wherein Before determining the writing stroke score of the written font image according to the stroke scores of each stroke, the method further includes: Identifying the number of connected-stroke writings and the number of repeated-stroke writings in the writing stroke information according to the standard stroke information in the standard writing information of the reference character; Correspondingly, determining the writing stroke score of the written font image according to the stroke scores of each stroke includes: Determining the writing stroke score of the written font image according to the stroke scores of each stroke, the number of connected-stroke writings, and the number of repeated-stroke writings.
10. The method according to claim 9, wherein Determining the writing stroke score of the written font image according to the score of each stroke, the number of connected-stroke writings, and the number of repeated-stroke writings includes: In the case where the Chinese character writing practice is offline practice, determining the writing stroke score of the written font image according to the score of each stroke, the number of connected-stroke writings, and the number of repeated-stroke writings; In the case where the Chinese character writing practice is online practice, obtaining the writing trajectory of the Chinese character writing practice, identifying the number of wrongly-written strokes in writing sequence and the number of wrongly-written strokes in writing direction in the writing trajectory according to the writing trajectory and the standard writing rules in the standard writing information of the reference character, and determining the writing stroke score of the written font image according to the score of each stroke, the number of connected-stroke writings, the number of repeated-stroke writings, the number of wrongly-written strokes in writing sequence, and the number of wrongly-written strokes in writing direction.
11. The method according to any one of claims 1 to 10, characterized in that, Carrying out writing teaching information recommendation according to the writing structure score and the writing stroke score includes: If the sum of the writing structure score and the writing stroke score is less than a preset writing score, outputting writing prompt words according to the writing structure score and the writing stroke score, and recommending the writing teaching information of the reference character; If the component score of any structure component in the writing structure score is less than a first preset component score, determining a first teaching character that matches the any structure component, and recommending the writing teaching information of the first teaching character; If the writing structure score is less than a first preset structure score, determining a second teaching character that matches the writing structure of the reference character, and recommending the writing teaching information of the second teaching character; If the stroke score of any stroke in the writing stroke score is less than a second preset stroke score, determining a third teaching character that matches the any stroke and recommending the writing teaching information of the third teaching character, and / or recommending the writing teaching information of the any stroke.
12. The method according to any one of claims 1 to 10, characterized in that, The method further includes: Obtaining the historical writing structure scores and historical writing stroke scores for Chinese character writing practice for multiple historical reference characters, where the historical writing structure scores include historical structure component scores of each structure component corresponding to the historical reference characters, and the historical writing stroke scores include historical stroke scores of each stroke corresponding to the historical reference characters; Statistically analyze the historical structural component scores of historical reference characters with the same structural components, the historical writing structure scores of historical reference characters with the same writing structure, and the historical stroke scores of historical reference characters with the same strokes; If the statistical data of the historical structural component scores for any of the same structural components is less than the second preset component score, determine the fourth teaching character that matches the any same structural component, and recommend the writing teaching information of the fourth teaching character; If the statistical data of the historical writing structure scores for any of the same writing structures is less than the second preset structure score, determine the fifth teaching character that matches the any same writing structure, and recommend the writing teaching information of the fifth teaching character; If the statistical data of the historical stroke scores for any of the same strokes is less than the second preset stroke score, determine the sixth teaching character that matches the any same stroke and recommend the writing teaching information of the sixth teaching character, and / or recommend the writing teaching information of the any same stroke.
13. A Chinese character writing practice device, characterized in that, The device includes: An image acquisition module for acquiring a writing font image for practicing Chinese character writing for a reference character; A stroke extraction module for extracting strokes from the writing font image according to the standard writing information of the reference character, obtaining the writing stroke information of at least one stroke corresponding to the writing font image, and determining the writing structure information of the writing font image according to the writing stroke information and the standard writing information of the reference character; A writing scoring module for determining the writing structure score of the writing font image based on the writing structure information and determining the writing stroke score of the writing font image based on the writing stroke information; A teaching recommendation module for recommending writing teaching information according to the writing structure score and the writing stroke score.
14. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method according to any one of claims 1 to 12.
15. A computer device, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein, When the processor executes the computer program, it implements the method according to any one of claims 1 to 12.