Intelligent calligraphy evaluation method and system

By establishing the geometric relationship of reference points in calligraphy fonts and using graph neural networks, the problem of insufficient accuracy in calligraphy font evaluation in the existing technology is solved, and a more accurate calligraphy evaluation is achieved.

CN118942102BActive Publication Date: 2025-03-28YANBIAN UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410918628.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-10
Publication Date
2025-03-28
Estimated Expiration
2044-07-10

AI Technical Summary

Technical Problem

In the computer evaluation of calligraphy fonts, it is difficult to accurately extract effective feature information in font images, resulting in insufficient accuracy of calligraphy evaluation.

Method used

By establishing the geometric relationship between reference points inside the font, a graph neural network is used to simulate human evaluation of the internal structure of copied fonts, and then a similarity score is given.

Benefits of technology

It improves the accuracy of calligraphy evaluation, so that the evaluation score can more accurately reflect the topological relationship of various elements within the font, and reduces the evaluation error caused by artificial subjectivity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118942102B_ABST
    Figure CN118942102B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image evaluation technology, and specifically provides an intelligent calligraphy evaluation method and system, including: extracting and matching feature points of a preprocessed font image to be evaluated and a standard font image to obtain multiple matching point pairs; screening the multiple matching point pairs to obtain a first reference point group and a second reference point group corresponding to multiple target matching point pairs; inputting the first reference point group and the second reference point group into a graph isomorphism network to extract image feature vectors to obtain a first image feature vector and a second image feature vector; and obtaining an evaluation score based on the cosine similarity between the first image feature vector and the second image feature vector. The present application uses the reference points inside the font image as a basis, establishes the geometric relationship between the reference points inside the font, and then uses a graph neural network to simulate the internal structure of the font that humans evaluate and copy to give a similarity score, so that the evaluation score can more accurately reflect the topological relationship between the elements inside the font.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of image evaluation, and in particular to an intelligent calligraphy evaluation method and system. Background Art

[0002] As a shining pearl in the history of human art, Chinese calligraphy has always attracted much attention for its analysis and evaluation using artificial intelligence. In the existing research progress on the evaluation of copied calligraphy characters by information technology, the calligraphy fonts are usually photographed or scanned and converted into image files that can be processed by computers. Then, structural features are constructed based on the basic elements of Chinese characters such as strokes, components, and feature points, so as to judge calligraphy by feature comparison. However, for computers, the information contained in the font image is composed of all pixels, and the internal structure and topological relationship between the calligraphy fonts are complex. This makes it difficult for computers to accurately extract effective feature information from the font image based on pixels, and calculate through these feature information to complete the evaluation of the beauty of the font image. Summary of the invention

[0003] In response to the above problems, the present application provides an intelligent calligraphy evaluation method, which is based on the reference points inside the font image, establishes the geometric relationship between the reference points inside the font, and then uses a graph neural network to simulate the internal structure of the font that humans evaluate and copy to give a similarity score. The obtained evaluation score can more accurately reflect the topological relationship between the elements inside the font, thereby improving the accuracy of calligraphy evaluation.

[0004] To achieve the purpose of this application, this application provides the following technical solutions:

[0005] In a first aspect, the present application provides an intelligent calligraphy evaluation method, comprising:

[0006] A scale-invariant feature transformation algorithm is used to extract feature points from the preprocessed font image to be evaluated and the standard font image, respectively, and feature points are matched between the preprocessed font image to be evaluated and the standard font image to obtain a plurality of matching point pairs; the plurality of matching point pairs are screened based on the positional relationship of the matching point pairs to obtain a first reference point group and a second reference point group corresponding to a plurality of target matching point pairs; wherein the first reference point group is located in the font image to be evaluated, and the second reference point group is located in the standard font image; a first graph data object is constructed based on the first reference point group, a second graph data object is constructed based on the second reference point group, and the first graph data object and the second graph data object are respectively input into a pre-trained graph isomorphism network to extract image feature vectors to obtain a first image feature vector corresponding to the font image to be evaluated and a second image feature vector corresponding to the standard font image; a first evaluation score for the font image to be evaluated is determined based on the cosine similarity between the first image feature vector and the second image feature vector.

[0007] In a possible implementation, the screening of the plurality of matching point pairs based on the positional relationship of the matching point pairs to obtain a first reference point group and a second reference point group corresponding to a plurality of target matching point pairs includes: calculating the length and slope of a matching line segment corresponding to each of the matching point pairs; determining a two-dimensional histogram of the length and slope based on the length and slope of each of the matching line segments to obtain a frequency distribution of the length and slope of the matching line segment corresponding to each of the matching point pairs in a two-dimensional space; determining a frequency peak in the two-dimensional histogram, and using Euclidean distance to calculate a distance value between each of the matching point pairs and the frequency peak; sorting each of the distance values ​​to obtain a sorted matching point sequence; and screening the matching point sequence based on a preset threshold to obtain a target matching point pair group, and determining the coordinates of a plurality of feature points corresponding to a plurality of target matching point pairs in the target matching point pair group in the font image to be evaluated as a first reference point group. A test point group, wherein the coordinates of the multiple feature points corresponding to the multiple target matching point pairs in the target matching point pair group in the standard font image are determined as a second reference point group; the first graph data object is constructed based on the first reference point group, including: the multiple feature points in the first reference point group are respectively used as nodes, and any two of the nodes are connected to obtain the first graph data object; wherein the straight-line distance connecting any two of the nodes is used as the weight of the edge of the first graph data object, and the coordinates of each of the nodes are used as the attributes of each of the nodes; the second graph data object is constructed based on the second reference point group, including: the multiple feature points in the second reference point group are respectively used as nodes, and any two of the nodes are connected to obtain the second graph data object; wherein the straight-line distance connecting any two of the nodes is used as the weight of the edge of the second graph data object, and the coordinates of each of the nodes are used as the attributes of each of the nodes.

[0008] In a possible implementation, before using the scale-invariant feature transformation algorithm to extract feature points from the preprocessed font image to be evaluated and the standard font image, the method includes: acquiring the font image to be evaluated and the standard font image; preprocessing the font image to be evaluated and the standard font image to obtain the preprocessed font image to be evaluated and the standard font image; preprocessing the font image to be evaluated and the standard font image to obtain the preprocessed font image to be evaluated and the standard font image, including: reading the font image to be evaluated and the standard font image, and adjusting the font image to be evaluated and the standard font image to a fixed size to obtain the font image to be evaluated and the standard font image of the same size; converting the font image to be evaluated and the standard font image into a grayscale image mode to obtain the preprocessed font image to be evaluated and the standard font image.

[0009] In a possible implementation, the method also includes a second evaluation score, and the second evaluation score and the first evaluation score are both evaluation reference scores for the font image to be evaluated; the method also includes: obtaining the font image to be evaluated and the standard font image, and preprocessing the font image to be evaluated and the standard font image to obtain the edge of the font image to be evaluated and the edge of the standard font image; calling a first OpenCV library function to extract contours from the edge of the font image to be evaluated and the edge of the standard font image, respectively, and drawing on a blank mask image to form a first contour corresponding to the font image to be evaluated and a second contour corresponding to the standard font image, wherein the blank mask image matches the size of the font image to be evaluated; calculating the intersection area and the union area between the first contour and the second contour, and determining the ratio of the intersection area to the union area as the second evaluation score.

[0010] In a possible implementation, the method also includes a third evaluation score, and the third evaluation score and the first evaluation score are both evaluation reference scores for the font image to be evaluated; after drawing a first contour corresponding to the font image to be evaluated and a second contour corresponding to the standard font image on the blank mask image, the method also includes: calling a second OpenCV library function to connect multiple convex points at the outermost edge of the first contour to generate a first convex hull; based on the second OpenCV library function, connecting multiple convex points at the outermost edge of the second contour to generate a second convex hull; calculating the intersection area and union area between the first convex hull and the second convex hull, and determining the ratio of the intersection area to the union area as the third evaluation score.

[0011] In a possible implementation, the method further includes a fourth evaluation score and a fifth evaluation score, and the fourth evaluation score, the fifth evaluation score and the first evaluation score are all evaluation reference scores for the font image to be evaluated; the method further includes: acquiring the font image to be evaluated and the standard font image, and preprocessing the font image to be evaluated and the standard font image to obtain the preprocessed font image to be evaluated and the standard font image; calculating the first projection histogram of pixels with Boolean values ​​of 0 in the preprocessed font image to be evaluated at multiple angles; calculating the second projection histogram of pixels with Boolean values ​​of 0 in the preprocessed standard font image at the multiple angles; based on the first projection histogram and the second projection histogram, calculating the overlap ratio between the preprocessed font image to be evaluated and the preprocessed standard font image to obtain the fourth evaluation score; using the following formula to calculate the correlation coefficient r between the projection image of the font image to be evaluated and the projection image of the standard font image at each angle, and obtaining the correlation corresponding to each angle:

[0012]

[0013] Among them, r is the correlation coefficient, X i is the number of pixels at each coordinate on the X-axis corresponding to the standard font image, and Y i is the number of pixels at each coordinate on the X-axis corresponding to the font image to be evaluated, where the unit length is pixel; μ X and μ Y is the average number of pixel points on all coordinates of the standard font image and the font image to be evaluated with 1 pixel as the unit; n is the length of the projection histogram of the standard font image and the font image to be evaluated on the X-axis, where the dimension is pixel; the arithmetic mean of the correlation corresponding to each angle in the multiple angles is calculated to obtain the fifth evaluation score.

[0014] In a possible implementation, after determining the first evaluation score of the font image to be evaluated, the method further includes: generating a stroke model group based on a plurality of calligraphy single-character image training, wherein the stroke model group includes a plurality of stroke sub-models; determining a copying stroke image corresponding to each stroke of the copying font based on the plurality of stroke sub-models; after determining a target standard font corresponding to the copying font from a standard font library, determining a predicted stroke image corresponding to each stroke of the target standard font based on the plurality of stroke sub-models; and extracting the stroke contour of each predicted stroke image to obtain a predicted stroke contour image; displaying each predicted stroke contour image of the target standard font on the copying stroke image of the copying font respectively, to obtain a stroke visual guidance image based on each stroke; for each stroke of the copying font, calculating and drawing projection histograms of each corresponding stroke of the copying font and the target standard font at multiple angles, and generating and outputting evaluation guidance for each stroke from an evaluation lexicon based on parameter features in each direction.

[0015] In a possible implementation, the training and generating of a stroke model group based on multiple calligraphy single-word logo images includes: obtaining multiple calligraphy single-word images, and performing binarization and manual denoising on the multiple calligraphy single-word images to obtain a sample font database; drawing stroke images of each sample font in the sample font database respectively, and naming and classifying each stroke image according to the stroke image name and stroke order, and establishing a training data set corresponding to each stroke; for each stroke, training the constructed neural network model based on the training data set corresponding to the stroke to obtain a stroke model group including multiple strokes; wherein each stroke corresponds to a stroke sub-model; wherein the neural network model It includes a generator network and a discriminator network; for each stroke, the constructed neural network model is trained based on the training data set to obtain a stroke sub-model corresponding to the stroke, including: initializing the generator network and the discriminator network; based on the discriminator network, the real image and the generated image generated by the generator network are discriminated, and the discriminator network loss and the generator network loss are calculated; the discriminator network loss and the generator network loss are recorded, and the generator network parameters and the discriminator network parameters are updated based on the defined optimizer to minimize the discriminator loss and the generator loss, and to generate the best image effect, thereby obtaining a stroke sub-model based on the optimal network parameters.

[0016] In a possible implementation, the method also includes: performing data enhancement on the calligraphy fonts in the acquired calligraphy image data set one by one to obtain a calligraphy font enhanced data set; using the trained SimCLR model to extract the feature vector of the font image to be evaluated to obtain a first feature vector and a second feature vector; normalizing the first feature vector and the second feature vector to obtain a normalized first feature vector and a second feature vector; calculating the cosine similarity between the normalized first feature vector and the second feature vector to obtain a sixth evaluation score for the font image to be evaluated.

[0017] In a second aspect, the present application provides an intelligent calligraphy evaluation system, comprising:

[0018] A matching module, used to extract feature points from the preprocessed font image to be evaluated and the standard font image respectively using a scale-invariant feature transformation algorithm, and to match feature points between the preprocessed font image to be evaluated and the standard font image to obtain a plurality of matching point pairs;

[0019] A screening module, configured to screen the plurality of matching point pairs based on the positional relationship of the matching point pairs to obtain a first reference point group and a second reference point group corresponding to the plurality of target matching point pairs; wherein the first reference point group is located in the font image to be evaluated, and the second reference point group is located in the standard font image;

[0020] a vector extraction module, configured to construct a first graph data object based on the first reference point group, construct a second graph data object based on the second reference point group, and input the first graph data object and the second graph data object into a pre-trained graph isomorphism network to extract image feature vectors, thereby obtaining a first image feature vector corresponding to the font image to be evaluated and a second image feature vector corresponding to the standard font image;

[0021] The determination module is used to determine a first evaluation score for the font image to be evaluated based on the cosine similarity between the first image feature vector and the second image feature vector.

[0022] Through the intelligent calligraphy evaluation method and system provided by the present application, after using a scale-invariant feature transformation algorithm to extract feature points and match corresponding feature points of the preprocessed font image to be evaluated and the standard font image, multiple matching point pairs between the font image to be evaluated and the standard font image are obtained; then, after screening the multiple matching point pairs, a first reference point group located in the font image to be evaluated and a second reference point group located in the standard font image are obtained, and the first reference point group and the second reference point group are respectively input into a pre-trained graph isomorphism network to extract image feature vectors, so as to obtain a first image feature vector corresponding to the font image to be evaluated and a second image feature vector corresponding to the standard font image; finally, based on the cosine similarity between the first image feature vector and the second image feature vector, a first evaluation score is generated. The intelligent calligraphy evaluation method of the present application is based on the reference points inside the font image, establishes the geometric relationship between the reference points inside the font, and then uses a graph neural network to simulate the internal structure of the font copied by humans to give a similarity score, so that the obtained evaluation score can more accurately reflect the topological relationship of each element inside the font, thereby improving the accuracy of the calligraphy evaluation work; at the same time, compared with the prior art that requires deep learning training and verification based on a calligraphy key point data set constructed based on manual annotation to achieve key point similarity evaluation, the intelligent calligraphy evaluation method of the present application can reduce the workload and avoid evaluation errors caused by human subjectivity. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The accompanying drawings are used to provide a further understanding of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation to the present application.

[0024] Figure 1 An optional flow chart of the intelligent calligraphy evaluation method provided in the embodiment of the present application;

[0025] Figure 2 An optional flow chart of the intelligent calligraphy evaluation method provided in the embodiment of the present application;

[0026] Figure 3 An optional flow chart of the intelligent calligraphy evaluation method provided in the embodiment of the present application;

[0027] Figure 4 An optional flow chart of the intelligent calligraphy evaluation method provided in the embodiment of the present application;

[0028] Figure 5 An optional flow chart of the intelligent calligraphy evaluation method provided in the embodiment of the present application;

[0029] Figure 6 An optional flow chart of the intelligent calligraphy evaluation method provided in the embodiment of the present application;

[0030] Figure 7 A schematic diagram of constructing a stroke data set as an example of a calligraphy font provided in an embodiment of the present application;

[0031] Figure 8 A schematic diagram of the production process of a calligraphy font dataset provided in an embodiment of the present application;

[0032] Fig. 9 A stroke splitting network generator diagram provided in an embodiment of the present application;

[0033] Fig.10 A stroke splitting network discriminator diagram provided in an embodiment of the present application;

[0034] Fig.11 A stroke splitting result diagram provided as a calligraphy font example in an embodiment of the present application;

[0035] Fig.12 A visual guide diagram for stroke splitting as an example of a calligraphy font provided in an embodiment of the present application;

[0036] Fig.13 An example diagram of the generated part and the projected part of a single stroke after splitting provided in an embodiment of the present application;

[0037] Fig.14 An optional flow chart of the intelligent calligraphy evaluation method provided in the embodiment of the present application;

[0038] Fig.15 A shape feature result diagram provided as a calligraphy font example in an embodiment of the present application;

[0039] Fig.16 A structural feature result diagram provided as a calligraphy font example in an embodiment of the present application;

[0040] Fig.17The projection feature result diagram of the calligraphy font example provided in the embodiment of the present application at different angles;

[0041] Fig.18 A schematic diagram of feature point matching of a calligraphy font example provided in an embodiment of the present application before feature point screening;

[0042] Fig.19 A schematic diagram of feature point matching of a calligraphy font example provided in an embodiment of the present application after feature point screening;

[0043] Fig. 20 A two-dimensional histogram of a reference point matching graph of a calligraphy font example provided in an embodiment of the present application;

[0044] Fig.21 A schematic diagram of a skeleton constructed based on reference points in a calligraphy font example provided in an embodiment of the present application;

[0045] Fig. 22 A diagram showing the training process of a calligraphy font example provided in an embodiment of the present application in a graph isomorphism network;

[0046] Fig.23 An optional flow chart of the intelligent calligraphy evaluation method provided in the embodiment of the present application;

[0047] Fig.24 A conceptual diagram of a model of an intelligent calligraphy evaluation method provided in an embodiment of the present application;

[0048] Fig.25 A schematic diagram of the structure of the intelligent calligraphy evaluation system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0050] The terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features; in the description of this application, unless otherwise specified, "plurality" means two or more.

[0051] For calligraphy, the structure of the fonts in calligraphy, also known as the body structure and the frame structure, is an indispensable part of calligraphy. How to improve the accuracy of the evaluation on the basis of reasonable and comprehensive evaluation needs to be studied. The Chinese patent with application number "202110100196.1" discloses a computer vision-based intelligent evaluation and guidance method for calligraphy copying. This method performs font registration on the calligraphy font image, extracts the font skeleton of the calligraphy image, and calculates the skeleton similarity between the copying font and the original font, and the features extracted by machine learning training to obtain a comprehensive score to automatically evaluate and visually guide the copying font. When the calligraphy font is scored for key point similarity, it is necessary to complete the training and verification of the calligraphy font key point detection model based on the deep learning target detection algorithm through the center point of the target box. Here, the construction of the calligraphy key point data set requires a large amount of manual annotation by calligraphy experts, resulting in a large workload and different experts' scores for specific calligraphy copying works may incorporate some aesthetic errors of other calligraphy styles. This leads to the possibility of large errors when the manual annotation results of calligraphy experts are used as label training models.

[0052] Combine the following Figures 1 to 25 The illustrated embodiments describe the technical solution of the present invention.

[0053] Example 1

[0054] Figure 1 An optional flow chart of the intelligent calligraphy evaluation method provided in the embodiment of the present application is as follows: Figure 1 As shown, the method of this embodiment includes the following steps S101 to S104:

[0055] Step S101: extract feature points from the preprocessed font image to be evaluated and the standard font image respectively using a scale-invariant feature transformation algorithm, and perform feature point matching between the preprocessed font image to be evaluated and the standard font image to obtain a plurality of matching point pairs.

[0056] In the embodiment of the present application, the scale-invariant feature transform (SIFT) algorithm is used to extract the feature points and descriptors of the font image, and the feature points between the font image to be evaluated and the standard font image are matched to obtain multiple matching point pairs. Here, the font image refers to the font image to be evaluated and the standard font image.

[0057] In the embodiment of the present application, the SIFT object is created using the cv2.SIFT_create() function; then the detectAndCompute() method is used to extract the feature points and descriptors of the font image. After the feature points are matched using cv2.BFMatcher, the knnMatch() method is used to obtain multiple matching point pairs between the font image to be evaluated and the standard font image.

[0058] In an embodiment of the present application, before performing all operations, it is necessary to obtain the font image to be evaluated and the standard font image; and preprocess the font image to be evaluated and the standard font image to obtain the preprocessed font image to be evaluated and the standard font image to ensure the stability and consistency of feature point extraction and subsequent calculations. In practical applications, the standard font image can be a corresponding standard font image obtained from a standard font database based on the font type and target text of the font image to be evaluated after the font image to be evaluated is identified. The standard font database may include but is not limited to font types such as regular script, cursive script, running script, official script, and seal script. As an example, when the intelligent calligraphy evaluation method of the present application is applied on a server, a picture corresponding to the font to be evaluated uploaded by the user through a terminal device, that is, the font image to be evaluated, is obtained.

[0059] In a possible implementation, Figure 2 As shown, the content of preprocessing the font image to be evaluated and the standard font image may include the following steps S1011 to S1012:

[0060] Step S1011 : reading the font image to be evaluated and the standard font image, and adjusting the font image to be evaluated and the standard font image to fixed sizes, so as to obtain the font image to be evaluated and the standard font image of the same size.

[0061] In an embodiment of the present application, the cv2.imread() function in the OpenCV library is called to read the font image to be evaluated and the standard font image, and then the cv2.resize() function in the OpenCV library is used to adjust the font image to be evaluated and the standard font image to a fixed size. Exemplarily, the fixed size can be 512x512 pixels.

[0062] Step S1012: converting the font image to be evaluated and the standard font image into a grayscale image mode to obtain the pre-processed font image to be evaluated and the standard font image.

[0063] In an embodiment of the present application, after obtaining a fixed-size font image to be evaluated and a standard font image, the cv2.cvtColor() function in the OpenCV library is used to convert the font image to be evaluated and the standard font image into grayscale images to obtain the preprocessed font image to be evaluated and the standard font image.

[0064] Step S102: screening the multiple matching point pairs based on the positional relationship of the matching point pairs to obtain a first reference point group and a second reference point group corresponding to multiple target matching point pairs; wherein the first reference point group is located in the font image to be evaluated, and the second reference point group is located in the standard font image.

[0065] In the embodiment of the present application, in order to filter out erroneous matching points to obtain reference points, it is necessary to first filter the feature points between the font image to be evaluated and the standard font image, specifically including: using the matching condition Lowe's ratio test to filter unreliable matching points.

[0066] In the embodiment of the present application, based on the statistics of the geometric relationship between the multiple matching point pairs between the font image to be evaluated and the standard font image, the multiple matching point pairs are screened. In a possible implementation, the statistics of the geometric relationship between the multiple matching point pairs between the font image to be evaluated and the standard font image may include the following steps S1021 to S1024:

[0067] Step S1021: Calculate the length and slope of the matching line segment corresponding to each matching point pair.

[0068] Step S1022: Determine a two-dimensional histogram of the length and slope based on the length and slope of each matching line segment to obtain a frequency distribution of the length and slope of the matching line segment corresponding to each matching point pair in a two-dimensional space.

[0069] In the embodiment of the present application, the numpy.histogram2d() function is used to calculate the two-dimensional histogram of length and slope.

[0070] Step S1023: determine a frequency peak in the two-dimensional histogram, and use Euclidean distance to calculate the distance value between the coordinates of each matching point pair in the two-dimensional graph and the frequency peak.

[0071] In an embodiment of the present application, after comparing and determining the main frequency peak (i.e., the maximum peak) of the length and slope in the two-dimensional histogram, the Euclidean distance is used to calculate the distance value between the coordinates of each matching point pair in the two-dimensional graph and the maximum peak to obtain the distance from the feature point to the maximum peak.

[0072] Step S1024, sort each of the distance values ​​to obtain a sorted matching point sequence; and filter the matching point sequence based on a preset threshold to obtain a target matching point pair group, and determine the multiple feature point coordinates corresponding to the multiple target matching point pairs in the target matching point pair group in the font image to be evaluated as a first reference point group, and determine the multiple feature point coordinates corresponding to the multiple target matching point pairs in the target matching point pair group in the standard font image as a second reference point group.

[0073] In an embodiment of the present application, each of the distance values ​​is sorted in order from small to large to obtain a matching point sequence sorted based on the distance value, and in the matching point sequence, a set of matching points with small distance values ​​is selected as a target matching point pair group. In an embodiment of the present application, a preset threshold is used to filter feature points that are far away from the maximum peak based on the matching point sequence to obtain a target reference point. Exemplarily, the statistical test optimal value of the preset threshold is 0.75. Here, the target reference point is the feature point coordinates corresponding to the target matching point pair in the font image to be evaluated / standard font image.

[0074] In an embodiment of the present application, the first reference point group is a set of multiple feature point coordinates corresponding to multiple target matching point pairs in the font image to be evaluated; the second reference point group is a set of multiple feature point coordinates corresponding to multiple target matching point pairs in the standard font image.

[0075] Step S103: construct a first graph data object based on the first reference point group, construct a second graph data object based on the second reference point group, and input the first graph data object and the second graph data object into a pre-trained graph isomorphism network to extract image feature vectors, so as to obtain a first image feature vector corresponding to the font image to be evaluated and a second image feature vector corresponding to the standard font image.

[0076] In an embodiment of the present application, in the first graph data object, each reference point (each reference point in the first reference point group in the first graph data object) is taken as a node, the coordinates of the node are taken as the attributes of the node, any two nodes are connected to each other as an edge, the straight-line distance between the two nodes is taken as the weight of the edge, and the constructed graph is input into a graph isomorphism network pre-trained using map data. In the second graph data object, each reference point (each reference point in the second reference point group in the second graph data object) is taken as a node, the coordinates of the node are taken as the attributes of the node, any two nodes are connected to each other as an edge, the straight-line distance between the two nodes is taken as the weight of the edge, and the constructed graph is input into a graph isomorphism network pre-trained using map data.

[0077] In an embodiment of the present application, the content of a graph isomorphism network (GIN) model trained based on the coordinates of multiple feature points (i.e., reference points) and the geometric relationship between the coordinates of the feature points (i.e., reference points) may include:

[0078] a. Node construction: taking the obtained coordinates of multiple reference points as node attributes;

[0079] b. Edge construction: construct edges based on the Euclidean distance between the reference point coordinates, and the edge weight is the Euclidean distance between the reference point coordinates;

[0080] c. Graph data conversion: Use torch_geometric.data.Data to convert the constructed nodes, edges and their attributes into graph data objects to obtain a graph isomorphic network.

[0081] In an embodiment of the present application, map data is downloaded from OpenStreetMap, and processed using the OSMnx tool to construct graph data. As an example, a certain number of locations (nodes) are randomly selected on the map of the target area, the attributes of the nodes are their geographical coordinates (such as longitude and latitude), the edges are the straight-line distances between the locations, and the weights are the Euclidean distance lengths between the locations. In a possible implementation, NetworkX is used to construct graph structure data, and the number of nodes in each graph is between 5 and 20. In an embodiment of the present application, the constructed GIN model is trained using the constructed graph data, and the GIN model with the lowest loss is selected as the trained model by adjusting model tuning methods such as hyperparameters. Among them, the mean squared error (MSE) is used as the loss function to measure model performance. As an example, the GIN model of the embodiment of the present application includes 5 convolutional layers.

[0082] In a possible implementation, the GIN model is fine-tuned by freezing the first three convolutional layers of the GIN model and only fine-tuning the last two convolutional layers. The GIN model can be fine-tuned using a calligraphy image dataset, and the model performance can be further optimized by adjusting the learning rate and training rounds.

[0083] In an embodiment of the present application, the first image data object and the second image data object are input into a pre-trained and fine-tuned GIN model to extract a first image feature vector corresponding to the font image to be evaluated and a second image feature vector corresponding to the standard font image.

[0084] Step S104: Determine a first evaluation score for the to-be-evaluated font image based on the cosine similarity between the first image feature vector and the second image feature vector.

[0085] In the embodiment of the present application, the cosine similarity between the first image feature vector of the font image to be evaluated and the second image feature vector of the standard font image is calculated to obtain an evaluation score for the font image to be evaluated.

[0086] Through the intelligent calligraphy evaluation method provided by the present application, after using the SIFT algorithm to extract feature points and match corresponding feature points of the preprocessed font image to be evaluated and the standard font image, multiple matching point pairs between the font image to be evaluated and the standard font image are obtained; then, after screening the multiple matching point pairs, a first reference point group located in the font image to be evaluated and a second reference point group located in the standard font image are obtained, and the first reference point group and the second reference point group are respectively input into a pre-trained graph isomorphism network to extract image feature vectors, so as to obtain a first image feature vector corresponding to the font image to be evaluated and a second image feature vector corresponding to the standard font image; finally, based on the cosine similarity between the first image feature vector and the second image feature vector, a first evaluation score is generated. The intelligent calligraphy evaluation method of the present application is based on the reference points inside the font image, establishes the geometric relationship between the reference points inside the font, and then uses a graph neural network to simulate the internal structure of the font copied by humans to give a similarity score, so that the obtained evaluation score can more accurately reflect the topological relationship of each element inside the font, thereby improving the accuracy of the calligraphy evaluation work; at the same time, compared with the prior art that requires deep learning training and verification based on a calligraphy key point data set constructed based on manual annotation to achieve key point similarity evaluation, the intelligent calligraphy evaluation method of the present application can reduce the workload and avoid evaluation errors caused by human subjectivity.

[0087] Example 2

[0088] Based on the above embodiment, after obtaining the first evaluation score based on the internal structure of the font image, the method of this embodiment also provides an intelligent calligraphy evaluation method, which is used to use the first evaluation score and the evaluation scores of other dimensions as evaluation scores of different dimensions of the font to be evaluated; the evaluation scores of other dimensions may include font shape feature evaluation, font structure feature evaluation and projection feature evaluation.

[0089] Figure 3 An optional flow chart of the intelligent calligraphy evaluation method provided in the embodiment of the present application is as follows: Figure 3 As shown, the method of this embodiment includes the following steps S301 to S303:

[0090] Step S301: Acquire the font image to be evaluated and the standard font image, and pre-process the font image to be evaluated and the standard font image to obtain the edge of the font image to be evaluated and the edge of the standard font image.

[0091] In the embodiment of the present application, the standard font image and the font image to be evaluated are loaded by the cv2.imread function, and the two images are adjusted to the same size using the cv2.resize function. Exemplarily, the size can be 512x512 pixels. After the two images are adjusted to the same size, dotted lines and grids are drawn on the two images for auxiliary comparison and visual reference, and then the standard font image and the font image to be evaluated are converted into grayscale images using the cv2.cvtColor function, and the image edges of the two images are extracted using the cv2.Canny function.

[0092] Step S302: Call a first OpenCV library function to extract contours from the edges of the font image to be evaluated and the edges of the standard font image, respectively, and draw a first contour corresponding to the font image to be evaluated and a second contour corresponding to the standard font image on a blank mask image, wherein the blank mask image matches the size of the font image to be evaluated.

[0093] In the embodiment of the present application, the first OpenCV library function refers to the cv2.findContours function, which is called from the OpenCV library to extract the respective contours from the edge images of the two images to achieve shape feature comparison between the font image to be evaluated and the standard font image.

[0094] In the embodiment of the present application, a blank mask image matching the target image size is created, and the cv2.drawContours function is used to draw contours on the blank mask based on the font image to be evaluated and the standard font image. Here, the target image size refers to the image size obtained after adjustment in step S301.

[0095] Step S303: Calculate the intersection area and the union area between the first contour and the second contour, and determine the ratio of the intersection area to the union area as the second evaluation score.

[0096] In the embodiment of the present application, the intersection and union of the masks are calculated using cv2.bitwise_and and cv2.bitwise_or functions, and the areas of the intersection and union are calculated using cv2.countNonZero function.

[0097] In an embodiment of the present application, after obtaining the second evaluation score based on the font shape features, the edge of the standard font image can be thickened and overlaid on the font image to be evaluated, the overlapping part can be displayed in green, and the draw_mizige_dashed function can be used to draw a mizige grid to generate a final visual comparison result image.

[0098] Figure 4This is an optional flow chart of the intelligent calligraphy evaluation method provided in the embodiment of the present application. After step S302 of the above embodiment, Figure 4 As shown, the method of this embodiment includes the following steps S401 to S402:

[0099] Step S401, calling a second OpenCV library function to connect multiple convex points at the outermost periphery of the first contour to generate a first convex hull; and connecting multiple convex points at the outermost periphery of the second contour based on the second OpenCV library function to generate a second convex hull.

[0100] In the embodiment of the present application, the second OpenCV library function is the convexHull function, which is used to calculate the convex hull and draw the generated convex hull on the blank mask image.

[0101] Step S402: Calculate the intersection area and the union area between the first convex hull and the second convex hull, and determine the ratio of the intersection area to the union area as the third evaluation score.

[0102] In the embodiment of the present application, the ratio of the overlapping area of ​​the first convex hull and the union area of ​​the second convex hull is calculated to evaluate As a feasible implementation, bitwise_and and bitwise_or are used to calculate the first convex Package and second The intersection area and union area of ​​the convex hull are calculated, and the ratio of the intersection area to the union area is calculated to obtain the evaluation score.

[0103] Figure 5 An optional flow chart of the intelligent calligraphy evaluation method provided in the embodiment of the present application is as follows: Figure 5 As shown, the method of this embodiment includes the following steps S501 to S503:

[0104] Step S501: Acquire the font image to be evaluated and the standard font image, and preprocess the font image to be evaluated and the standard font image to obtain the preprocessed font image to be evaluated and the standard font image.

[0105] In the embodiment of the present application, Numpy and Matplotlib libraries are used to define a projection histogram, an overlap ratio, and a correlation calculation function for calculating the projection histogram of an image in different directions and a similarity measure.

[0106] In the embodiment of the present application, the font image to be evaluated and the standard font image are preprocessed in the same manner as in the above embodiment to obtain grayscale images of the same size; and then the grayscale images are binarized.

[0107] Step S502, calculating the first projection histograms of the pixels with Boolean values ​​of 0 in the preprocessed font image to be evaluated at multiple angles; calculating the second projection histograms of the pixels with Boolean values ​​of 0 in the preprocessed standard font image at the multiple angles.

[0108] In the embodiment of the present application, the projection histograms of pixels with Boolean values ​​of 0 in the font image to be evaluated and the standard font image in the directions of 0, -45, 45 and 90 degrees are calculated respectively to compare the similarities between the font to be evaluated and the standard font in these directions.

[0109] Step S503: Based on the first projection histogram and the second projection histogram, the overlap ratio between the preprocessed font image to be evaluated and the preprocessed standard font image is calculated to obtain the fourth evaluation score.

[0110] In the embodiment of the present application, the overlap ratios between the preprocessed font image to be evaluated and the preprocessed standard font image in different directions are summarized to obtain a final score as the fourth evaluation score.

[0111] In a possible implementation, Formula 2 is used to calculate the correlation coefficient between the projection image of the font image to be evaluated and the projection image of the standard font image at each angle to obtain the correlation corresponding to each angle:

[0112]

[0113] Among them, r is the correlation coefficient, X i is the number of pixels at each coordinate on the X-axis corresponding to the standard font image, and Y i is the number of pixels at each coordinate on the X-axis corresponding to the font image to be evaluated, where the unit length is pixel; μ X and μ Y is the average number of pixel points on all coordinates of the standard font image and the font image to be evaluated with 1 pixel as the unit; n is the length of the projection histogram of the standard font image and the font image to be evaluated on the X-axis, where the dimension is pixel; the arithmetic mean of the correlation corresponding to each angle in the multiple angles is calculated to obtain the fifth evaluation score.

[0114] The intelligent calligraphy evaluation method of this embodiment can form evaluation and guidance results independently from aspects such as the font shape, structure, skeleton and the internal structure of the font by providing multi-dimensional evaluation results of the font image to be evaluated.

[0115] Example 3

[0116] Based on the above embodiment, after determining the evaluation score of the font image to be evaluated, the embodiment of the present application further provides an intelligent calligraphy evaluation method. Figure 6 An optional flow chart of the intelligent calligraphy evaluation method provided in the embodiment of the present application is as follows: Figure 6 As shown, the method of this embodiment includes the following steps S601 to S605:

[0117] Step S601: Generate a stroke model group based on a plurality of calligraphy single-word image training, wherein the stroke model group includes a plurality of stroke sub-models.

[0118] In an embodiment of the present application, the training and generating of a stroke model group based on multiple calligraphy single-word logo images includes: obtaining multiple calligraphy single-word images, and performing binarization and manual denoising on the multiple calligraphy single-word images to obtain a sample font database; respectively drawing the stroke images of each sample font in the sample font database, and naming and classifying each stroke image according to the stroke image name and stroke order, and establishing a training data set corresponding to each stroke; for each stroke, training the constructed neural network model based on the training data set corresponding to the stroke, and obtaining a stroke model group including multiple strokes; wherein each stroke corresponds to a stroke sub-model.

[0119] In the embodiment of the present application, the original font image in the calligraphy font data set is binarized, and the image of each stroke is drawn separately using the procreate software to obtain the segmented stroke image, and the strokes are named according to the calligraphy image name and stroke order; the calligraphy font image and the segmented stroke image are converted into RGB images; the stroke image is changed to .png format, the calligraphy image is changed to .jpg format, and folders are set according to the strokes, and the images of the same strokes are placed in the same folder, and the calligraphy images are placed alternately. Exemplarily, Figure 7 A schematic diagram of constructing a stroke data set as an example of calligraphy fonts provided in an embodiment of the present application is provided. This method is used to establish a test set and a training set for each stroke; then the constructed neural network model is trained based on the training data set corresponding to the strokes to obtain a stroke model group including multiple strokes.

[0120] In the embodiment of the present application, the calligraphy font dataset is an original dataset, and its production process is as follows: Figure 8 The standard font library comes from famous calligraphy and inscriptions. Figure 7 The standard font library is obtained after the steps shown are processed. Among them, the rounded rectangular box represents the start and end nodes, the right-angled rectangular box represents the production node, and the parallelogram box represents the output node of the production process.

[0121] In an embodiment of the present application, the calligraphy font data is preprocessed, the input image corresponding to the calligraphy font data is converted into a tensor, the input image size is adjusted to a uniform size (such as 256x 256 pixels), and the input image is standardized so that its mean is 0.5 and its standard deviation is 0.5. Then, a custom dataset class is created to load images and corresponding annotated images; the glob module is used to read the image file path, and the calligraphy stroke segmentation dataset image file list is loaded in sequence, a training dataset and a test dataset are created, and the DataLoader class in the Pytorch framework is used to load the data.

[0122] In an embodiment of the present application, the neural network model includes a generator network and a discriminator network; for each stroke, the constructed neural network model is trained based on the training data set to obtain a stroke sub-model corresponding to the stroke, including: initializing the generator network and the discriminator network; based on the discriminator network, discriminating between the real image and the generated image generated by the generator network, and calculating the discriminator network loss and the generator network loss; recording the discriminator network loss and the generator network loss, and updating the generator network parameters and the discriminator network parameters based on the defined optimizer to minimize the discriminator loss and the generator loss, and to achieve the best generated image effect, thereby obtaining a stroke sub-model based on the optimal network parameters.

[0123] In the embodiments of the present application, Fig. 9 A stroke splitting network generator diagram provided in an embodiment of the present application; Fig.10 The stroke splitting network discriminator diagram provided in the embodiment of the present application; Fig. 9 , Fig.10 As described above, the structure design of the stroke splitting network is:

[0124] ①The generator network includes downsampling layers and upsampling layers.

[0125] ②The downsampling layer uses 6 convolutional layers and LeakyReLU activation function.

[0126] ③The upsampling layer uses 6 deconvolution layers and LeakyReLU activation function.

[0127] ④ Use skip connections to pass the features in the downsampling process to the corresponding upsampling layer.

[0128] ⑤The last layer uses the tanh activation function to generate the final image.

[0129] ⑦The discriminator network uses convolutional layers and LeakyReLU activation functions.

[0130] ⑧The discriminator downsamples through two convolutional layers, extracts features using one intermediate convolutional layer, and performs binary classification using one output layer convolutional layer; meanwhile, the normalization layer normalizes the features after each downsampling step.

[0131] Train the stroke model based on the above model structure:

[0132] ①Set the training device, such as a Graphics Processing Unit (GPU).

[0133] ②Initialize the generator and discriminator models.

[0134] ③Define the loss functions (binary cross-entropy loss and L1 loss).

[0135] ④Define the optimizers for the generator and discriminator (such as the Adam optimizer).

[0136] ⑤The discriminator discriminates the real images and calculates the loss of the real images.

[0137] ⑥The generator generates images and calculates the loss of the generated images through the discriminator.

[0138] ⑦The discriminator loss includes the sum of the real image loss and the generated image loss.

[0139] ⑧The generator loss includes the sum of the loss of the generated images through the discriminator and the L1 loss between the generated images and the real images.

[0140] ⑨Use the optimizers to update the parameters of the discriminator and generator respectively.

[0141] ⑩During the training process, record the loss values of the discriminator and generator, and continuously adjust the hyperparameters according to the loss values until the stroke sub-model with the best generalization performance, the lowest loss, and the best generated image effect is obtained. In the embodiments of the present application, during the training process, save the model parameters and training status of the generator and discriminator, and save the state dictionary and training information of the model to a file at the specified path. Thus, a model can be obtained for each stroke. For example, if the character "春" has 9 strokes, 9 models will be obtained and uniformly placed in the model folder, named after the character; when calling the stroke model, traverse all the model files (.pth format) in the model folder, and for each model file, create a new generator instance and load the model parameters Number; Set the generator model to evaluation mode (eval() method). Fig.11 The calligraphy characters provided in the embodiments of the present application body Example stroke splitting result diagram.

[0142] In the embodiments of the present application, among multiple font images, in addition to the existence of the same single stroke, there are also the same radicals or partial font structures, such as the three dots part of "river" and "sea", and the upper half part of "spring" and "feng". In a feasible implementation manner, in the case where there are already the same radicals and their positions in the Chinese character structure are the same, the combined sub-model of the same radicals can be selected as a whole in the trained stroke sub-model to reduce the training amount.

[0143] Step S602: Determine the corresponding traced stroke images for each stroke of the traced font based on the multiple stroke sub-models.

[0144] In the embodiments of the present application, after reading the traced font, the model corresponding to each stroke of the input traced font is used to generate the corresponding traced stroke images for each stroke, and the generated traced stroke images are saved.

[0145] Step S603: After determining the target standard font corresponding to the traced font from the standard font library, determine the corresponding predicted stroke images for each stroke of the target standard font based on the multiple stroke sub-models; and extract the stroke contours of each predicted stroke image to obtain the predicted stroke contour images.

[0146] In the embodiments of the present application, after reading the traced font, the traced font is recognized, and the target standard font corresponding to the traced font is determined from the standard font library; then the model corresponding to each stroke of the target standard font is used to generate the corresponding predicted stroke images for each stroke, and the generated predicted stroke images are saved. In some feasible implementation manners, the cv2.Canny function is used to extract the image edges to obtain the predicted stroke contour images of the predicted stroke images of the target standard font, and the predicted stroke contour images are used to provide visual identification and guidance for the traced stroke images of the traced font.

[0147] Step S604: Display each predicted stroke contour image of the target standard font correspondingly on the traced stroke image of the traced font to obtain the stroke visual guidance images based on each stroke. Fig.12 It is the visualized guidance diagram of stroke splitting as an example of calligraphy font provided by the embodiments of the present application.

[0148] Step S605: For each stroke of the traced font, calculate and draw the projection histograms of each corresponding stroke of the traced font and the target standard font at multiple angles, and generate and output the evaluation guidance for each stroke from the evaluation corpus based on the parameter features in each direction.

[0149] In an embodiment of the present application, projection histograms of the copy image and the standard image at 0°, 45°, 90°, and -90° are calculated and plotted, and an evaluation output is generated from an evaluation vocabulary based on four features of the stroke in each direction: the peak shape of the projection image, the area of ​​the projection image, the length of the projection image on the x-axis, and the position of the projection image. Fig.13 An example diagram of the generated part and the projected part of a single stroke after splitting provided in an embodiment of the present application.

[0150] The embodiment of the present application uses the pix2pix network to perform calligraphy stroke segmentation, so that the stroke segmentation process only requires a small amount of stroke segmentation data set to achieve good results, and effectively provides guidance at the calligraphy font stroke level.

[0151] Example 4

[0152] Based on the above embodiments, the present application also provides an intelligent calligraphy evaluation method. Fig.14 An optional flow chart of the intelligent calligraphy evaluation method provided in the embodiment of the present application is as follows: Fig.14 As shown, the method of this embodiment includes the following steps S1401 to S1404:

[0153] Step S1401: perform data enhancement on the calligraphy fonts in the acquired calligraphy font data set one by one to obtain a calligraphy font enhanced data set.

[0154] In an embodiment of the present application, after loading the calligraphy character dataset from the specified path, the dataset is divided into a training set and a validation set with a ratio of 80:20, and torch.utils.data.DataLoader is used to load the training set and the validation set.

[0155] In an embodiment of the present application, after the calligraphy font is resized, data enhancement is performed on the calligraphy font one by one, and the content of the data enhancement includes: ① random cropping: RandomCrop; ② random horizontal flip: RandomHorizontalFlip; ③ random color jitter: ColorJitter; ④ random rotation: RandomRotation; ⑤ random affine transformation: RandomAffine; ⑥ random elastic transformation: RandomElasticTransform; ⑦ image normalization: Normalize.

[0156] In the embodiment of the present application, a pre-trained ResNet-152 model is used, the last fully connected layer is removed, and it is replaced with a custom fully connected layer; the first six layers of ResNet-152 are frozen to maintain the feature extraction capability of the pre-trained model; Projection Head: a series of fully connected layers, batch normalization (BatchNorm), ReLU activation, and Dropout layers are added to the feature vector after feature extraction to further process the features. Among them, a contrast loss function is used to measure the similarity between feature vectors, and the similarity of positive and negative samples is calculated, and the similarity distribution is adjusted according to the temperature parameter; the AdamW optimizer is used, the learning rate is set to 1e-3, and the weight decay is 1e-6; the StepLR scheduler is used to reduce the learning rate by 10 times every 30 epochs.

[0157] In the embodiment of the present application, the training set is iterated through the data loader, the loss of forward propagation is calculated, and the model parameters are updated by back propagation; after each epoch, the training loss is calculated and recorded. After each epoch, the model performance is evaluated using the validation set, and the validation loss is calculated. If the validation loss of the current epoch is better than the previous best validation loss, the current model parameters are saved, and the optimal model parameters and training loss records are saved at the same time.

[0158] Step S1402: Use the trained SimCLR model to extract the feature vector of the font image to be evaluated to obtain a first feature vector and a second feature vector.

[0159] In the embodiment of the present application, the trained SimCLR model is used to extract the feature vector of the input image. For each pair of input images (imgL, imgR), the model generates two feature vectors (feature_L, feature_R).

[0160] Step 1403: Normalize the first eigenvector and the second eigenvector to obtain normalized first eigenvector and second eigenvector.

[0161] In the embodiment of the present application, the extracted feature vector is normalized to ensure that the modulus of the feature vector is 1. The normalization operation can avoid similarity calculation errors caused by scale differences of feature vectors.

[0162] Step 1404: Calculate the cosine similarity between the normalized first eigenvector and the second eigenvector to obtain a sixth evaluation score for the font image to be evaluated.

[0163] In the embodiments of the present application, the technical details may include:

[0164] ①Import necessary libraries: including PyTorch, torchvision and other necessary image processing and scientific computing libraries.

[0165] ②Define the random elastic transformation class: implement the RandomElasticTransform class and define the random elastic transformation method.

[0166] ③Define data enhancement function: implement the transform_func function and apply various data enhancement methods.

[0167] ④Define the model class: implement the SimCLRStage1 class and define the feature extraction and projection head based on ResNet-152.

[0168] ⑤Define contrast loss class: implement ContrastiveLoss class and calculate contrast loss.

[0169] ⑥Define the training function: Implement the train function, which includes the entire process of data loading, model training, verification, and result saving.

[0170] ⑦Define evaluation function: implement the evaluate function to evaluate model performance on the validation set.

[0171] ⑧Main function entry: Use argparse to parse command line parameters and start the training process.

[0172] The embodiment of the present application realizes the feature extraction of calligraphy characters based on the advantages of the self-supervised learning method in extracting rich and robust calligraphy character features through data enhancement method and contrastive learning strategy, and gives the evaluation score of the copied font by calculating the cosine similarity. It does not require a large amount of data with calligrapher scoring annotations and manually annotated feature points, which greatly reduces the workload in the calligraphy evaluation process.

[0173] Example 5

[0174] The embodiment of the present application also provides an intelligent calligraphy evaluation method, which uses four manual feature evaluation methods to simultaneously evaluate the copied characters, so as to achieve the system's imitation of human evaluation behavior, including:

[0175] The first method is shape feature evaluation. As the most intuitive method, the visualized image can also give users a very good visual effect.

[0176] This technical solution includes the following steps:

[0177] ① Image loading and preprocessing: Use cv2.imread function to load the standard image and the copied image, and use cv2.resize function to resize the two images to the same size (512x512 pixels).

[0178] ② Draw dotted line function: Provides a function for drawing dotted lines on an image. The function input includes the starting point, end point, color, line thickness, and gap length. The function calculates the distance between two points and draws a dotted line between the two points at the specified interval.

[0179] ③ Draw a grid: Provide a function to draw a grid on the image. The grid includes horizontal, vertical and diagonal dotted lines, as well as solid lines for the border. The grid is used to assist comparison and visual reference.

[0180] ④Image conversion and edge extraction: Use the cv2.cvtColor function to convert the standard image and the copied image into grayscale images, and use the cv2.Canny function to extract the image edges.

[0181] ⑤Contour extraction: Use cv2.findContours function to extract contours from edge images. Contours are used to compare the shape features of images.

[0182] ⑥Mask creation and area calculation: Create a blank mask image that matches the size of the target image and use the cv2.drawContours function to draw contours on the mask. Use the cv2.bitwise_and and cv2.bitwise_or functions to calculate the intersection and union of the masks. Use the cv2.countNonZero function to calculate the area of ​​the intersection and union.

[0183] ⑦Similarity calculation: The similarity score of the two images is obtained by calculating the ratio of the intersection area to the union area.

[0184] ⑧ Visualize the comparison results: Thicken the edges of the standard image and overlay it on the traced image, displaying the overlapping parts in green. Use the draw_mizige_dashed function to draw a mizige grid and generate the final comparison result image. Fig.15 This is a shape feature result diagram provided as an example of a calligraphy font in an embodiment of the present application.

[0185] ⑨Result display and saving: Use the cv2.imshow function to display the comparison result image, and use the cv2.imwrite function to save the result image to a local file.

[0186] The second method is structural feature evaluation; this technical solution includes the following steps:

[0187] ① Image loading and preprocessing: First, load the images of standard characters and copied characters, and resize them to 512x512 pixels to ensure consistency in subsequent processing. Use the OpenCV library to read and adjust the images;

[0188] ② Draw a dotted grid: Draw a dotted grid on the image to facilitate the comparison between the standard characters and the copied characters. Define a function draw_dotted_line to draw dotted lines and add horizontal, vertical and diagonal dotted grids on the image;

[0189] ③Contour extraction and drawing: Convert the image to grayscale and use the Canny algorithm to extract the edge. Then use the findContours function to find the contour and draw it on the blank mask;

[0190] ④ Convex hull calculation and drawing: Calculate the convex hull of each contour and draw it. Use the convexHull function to calculate the convex hull and draw it on the image;

[0191] ⑤ Overlap ratio calculation: Evaluate similarity by calculating the ratio of the overlapping area to the union area of ​​the two contour convex hulls. Use the bitwise_and and bitwise_or functions to calculate the intersection and union, and calculate the overlap ratio to get the evaluation score;

[0192] ⑥ Final image drawing: Overlay the outlines of the standard character and the copied character, draw a grid, and display the final result. Use the addWeighted function to overlay the image and display the final result. Fig.16 A structural feature result diagram of a calligraphy font example provided in an embodiment of the present application.

[0193] The third method is projection feature evaluation; this technical solution includes the following steps:

[0194] ① Import libraries and define functions: Use Numpy and Matplotlib libraries to define projection histogram, overlap ratio and correlation calculation functions. These functions are used to calculate the projection histogram of the image in different directions and the similarity measurement;

[0195] ② Image loading and preprocessing: load the standard characters and copied characters, convert them into grayscale images, and adjust the size to ensure consistency. Then perform binary processing on the images;

[0196] ③ Projection histogram calculation: Calculate the projection histogram of the pixels with Boolean value 0 in the image in the directions of 0, -45, 45 and 90 degrees, and compare the similarity between the standard word and the copied word in these directions;

[0197] ④ Calculation of overlap ratio and correlation: By projecting the histogram, the overlap ratio and correlation of the standard character and the copied character are calculated to evaluate the similarity. Using the following formula, the correlation scores and overlap ratio scores of the four angles are arithmetically averaged to form the final two scores;

[0198]

[0199] Among them, r is the correlation coefficient, X i is the number of pixels at each coordinate on the X-axis corresponding to the standard font image, and Y i is the number of pixels at each coordinate on the X-axis corresponding to the font image to be evaluated, where the unit length is pixel; μ X and μ Y is the average number of pixels in all coordinates of the standard font image and the font image to be evaluated with 1 pixel as the unit; n is the length of the projection histogram of the standard font image and the font image to be evaluated on the X-axis, where the dimension is pixel. Fig.17 The projection feature result diagram of the calligraphy font example provided in the embodiment of the present application at different angles.

[0200] The fourth method is skeleton feature evaluation. The present embodiment proposes the concept of reference points: points that can provide position references for copyists during writing. In this embodiment, the SIFT algorithm is used to extract feature points and filter them to obtain reference points, and a graph neural network is used to simulate human evaluation of the internal structure of the copied characters and give a similarity score. This technical solution includes the following steps:

[0201] Ⅰ. Reference point extraction.

[0202] ① Image preprocessing: Before all operations, the input image needs to be preprocessed to ensure the stability and consistency of feature point extraction and subsequent calculations. The preprocessing steps include: 1) Image reading: Use the cv2.imread() function in the OpenCV library to read the input image; 2) Image resizing: Use the cv2.resize() function to resize the image to a fixed size (e.g. 512x512); 3) Grayscale: Use the cv2.cvtColor() function to convert the image to a grayscale image.

[0203] ② Feature point extraction: Use the SIFT algorithm to extract the feature points and descriptors of the image, and match the feature points between the two images. The steps include: 1) Create a SIFT object: Use the cv2.SIFT_create() function to create a SIFT object; 2) Detect and calculate feature points and descriptors: Use the detectAndCompute() method to extract feature points and descriptors; 3) Feature point matching: Use cv2.BFMatcher to match feature points, and obtain matching point pairs through the knnMatch() method.

[0204] ③ Feature point filtering and statistics: In order to filter out erroneous matching points and obtain reference points, it is necessary to filter the feature points and count the geometric relationships between the matching points. Fig.18Schematic diagram of feature point matching before feature point screening for the calligraphy font example provided in the embodiment of the present application. The steps include: 1) filtering matching points: using the matching condition Lowe's ratiotest to filter unreliable matching points; 2) calculating the length and slope of the matching line segment: for each pair of matching points, calculating the Euclidean distance (length) and slope between the two feature points; 3) calculating the histogram of length and slope: using the numpy.histogram2d() function to calculate the two-dimensional histogram of length and slope; 4) finding the main peak: finding the main peak of the two-dimensional histogram of length and slope; 5) calculating the distance from the feature point to the main peak: using the Euclidean distance to calculate the distance from each pair of feature points to the main peak; 6) using the threshold to filter the feature points: determining a distance threshold, and filtering out feature points that are far from the main peak according to this threshold. In the embodiment of the present application, the distance threshold is determined by the best threshold statistics of 2000 calligraphy characters, and the result is 0.75. The screened points are reference points for subsequent construction of graph data objects. Fig.19 A schematic diagram of feature point matching of the calligraphy font example provided in an embodiment of the present application after feature point screening. Fig. 20 A two-dimensional histogram of a reference point matching graph of a calligraphy font example provided in an embodiment of the present application.

[0205] ④Construct graph data objects: construct reference points and their geometric relationships into graph data objects for input into the graph isomorphic network. Fig.21 This is a skeleton diagram based on reference points in the calligraphy font example provided in the embodiment of the present application. The steps include: 1) Node construction: taking the coordinates of the reference points as node attributes; 2) Edge construction: constructing edges based on the Euclidean distance between the reference points, and the weight of the edge is the Euclidean distance between the reference points; 3) Graph data conversion: using torch_geometric.data.Data to convert nodes, edges and their attributes into graph data objects.

[0206] Ⅱ. Extract features and calculate similarity scores using graph isomorphism networks:

[0207] ① Data preparation: Download map data from OpenStreetMap and use OSMnx tools to process and construct graph data. Randomly select a certain number of locations (nodes) on the map of the target area (such as Xi'an). The attributes of the nodes are their geographic coordinates (latitude and longitude), the edges are the straight-line distances between the locations, and the weights are the distance lengths. Use NetworkX to construct graph structure data, with the number of nodes in each graph ranging from 5 to 20;

[0208] ② Training of graph isomorphism network model: Construct a graph isomorphism network (GIN) with 5 convolutional layers. Use the constructed graph data to train the GIN model, and select the model with the lowest loss by adjusting the hyperparameters and other model tuning methods. Use mean squared error (MSE) as the loss function to measure model performance; Fig. 22 A diagram showing the training process of a calligraphy font example in a graph isomorphism network provided in an embodiment of the present application;

[0209] ③Model fine-tuning: Freeze the first three convolutional layers of the GIN model and only fine-tune the last two convolutional layers. Fine-tune using the calligraphy dataset and further optimize the model performance by adjusting the learning rate and training rounds;

[0210] ④Similarity score calculation: 1) Input the graph data into the pre-trained and fine-tuned GIN model to extract the image feature vector; 2) Calculate the cosine similarity of the image feature vectors of the standard character and the copied character as the evaluation score.

[0211] In the embodiment of the present application, the above four methods and the evaluation paths based on different starting points in the above-mentioned embodiments 3 and 4 can be combined as the output result of the entire calligraphy evaluation. Fig.23 A schematic diagram of an optional flow chart of the intelligent calligraphy evaluation method provided in the embodiment of the present application, wherein Fig.23 The standard characters correspond to the standard font images in the embodiment of the present application, and the user's characters correspond to the font images to be evaluated in the embodiment of the present application. Fig.24 A conceptual diagram of a model of the intelligent calligraphy evaluation method provided in an embodiment of the present application.

[0212] Example 6

[0213] The present application embodiment also provides an intelligent calligraphy evaluation system 700. Fig.25 The structural diagram of the intelligent calligraphy evaluation system 700 provided in the embodiment of the present application includes:

[0214] A matching module 701 is used to extract feature points from the preprocessed font image to be evaluated and the standard font image respectively using a scale-invariant feature transformation algorithm, and to match feature points between the preprocessed font image to be evaluated and the standard font image to obtain a plurality of matching point pairs;

[0215] A screening module 702 is used to screen the multiple matching point pairs based on the positional relationship of the matching point pairs to obtain a first reference point group and a second reference point group corresponding to the multiple target matching point pairs; wherein the first reference point group is located in the font image to be evaluated, and the second reference point group is located in the standard font image;

[0216] A vector extraction module 703 is used to construct a first graph data object based on the first reference point group, construct a second graph data object based on the second reference point group, and input the first graph data object and the second graph data object into a pre-trained graph isomorphism network to extract image feature vectors, so as to obtain a first image feature vector corresponding to the font image to be evaluated and a second image feature vector corresponding to the standard font image;

[0217] The determination module 704 is configured to determine a first evaluation score for the to-be-evaluated font image based on the cosine similarity between the first image feature vector and the second image feature vector.

[0218] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the intelligent calligraphy evaluation method in any embodiment of the present application. Specifically, a system or device equipped with a storage medium can be provided, on which a software program code that implements the functions of any of the above embodiments is stored, and a computer (or CPU or MPU) of the system or device reads and executes the program code stored in the storage medium.

[0219] In particular, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit (CPU), the above-mentioned functions defined in the system of the present application are executed.

[0220] It should be noted that the computer-readable storage medium shown in the present invention can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable storage medium other than a computer-readable storage medium that can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0221] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0222] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0223] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation of the present invention.

[0224] In the several embodiments provided in the present application, it should be understood that the disclosed systems, modules and methods can be implemented in other ways. For example, the module embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, modules or units, which can be electrical, mechanical or other forms.

[0225] The above embodiments are only used to illustrate the technical solution of the present application, but not to limit it. The present application is not limited to the exact structure described above and illustrated in the accompanying drawings, and it cannot be determined that the specific implementation of the present application is limited to these descriptions. For ordinary technicians in the technical field to which the present application belongs, various changes and modifications made without departing from the concept of the present application should be deemed to belong to the protection scope of the present application.

Claims

1. An intelligent calligraphy evaluation method, characterized in that: include: Using a scale-invariant feature transformation algorithm, feature points are extracted from the preprocessed font image to be evaluated and the standard font image, and feature points are matched between the preprocessed font image to be evaluated and the standard font image to obtain a plurality of matching point pairs; The plurality of matching point pairs are screened based on the positional relationship of the matching point pairs to obtain a first reference point group and a second reference point group corresponding to the plurality of target matching point pairs; wherein the first reference point group is located in the font image to be evaluated, and the second reference point group is located in the standard font image; Constructing a first graph data object based on the first reference point group, constructing a second graph data object based on the second reference point group, and inputting the first graph data object and the second graph data object into a pre-trained graph isomorphism network to extract image feature vectors, thereby obtaining a first image feature vector corresponding to the font image to be evaluated and a second image feature vector corresponding to the standard font image; Determining a first evaluation score for the to-be-evaluated font image based on the cosine similarity between the first image feature vector and the second image feature vector; The method of screening the plurality of matching point pairs based on the positional relationship of the matching point pairs to obtain a first reference point group and a second reference point group corresponding to a plurality of target matching point pairs includes: Calculate the length and slope of the matching line segment corresponding to each matching point pair; Determine a two-dimensional histogram of the length and the slope based on the length and the slope of each matching line segment to obtain a frequency distribution of the length and the slope of the matching line segment corresponding to each matching point pair in a two-dimensional space; Determine a frequency peak in the two-dimensional histogram, and use Euclidean distance to calculate the distance value between each matching point pair and the frequency peak; Each of the distance values ​​is sorted to obtain a sorted matching point sequence; and the matching point sequence is screened based on a preset threshold to obtain a target matching point pair group, and a plurality of feature point coordinates corresponding to a plurality of target matching point pairs in the target matching point pair group in the font image to be evaluated are determined as a first reference point group, and a plurality of feature point coordinates corresponding to a plurality of target matching point pairs in the target matching point pair group in the standard font image are determined as a second reference point group.

2. The intelligent calligraphy evaluation method according to claim 1, characterized in that: The constructing a first graph data object based on the first reference point group includes: The plurality of feature points in the first reference point group are respectively used as nodes, and any two of the nodes are connected to obtain the first graph data object; wherein the straight line distance connecting any two of the nodes is used as the weight of the edge of the first graph data object, and the coordinates of each of the nodes are used as the attributes of each of the nodes; The constructing a second graph data object based on the second reference point group comprises: The plurality of feature points in the second reference point group are respectively used as nodes, and any two of the nodes are connected to obtain the second graph data object; wherein the straight-line distance connecting any two of the nodes is used as the weight of the edge of the second graph data object, and the coordinates of each of the nodes are used as the attributes of each of the nodes.

3. The intelligent calligraphy evaluation method according to claim 1, characterized in that: Before extracting feature points from the preprocessed font image to be evaluated and the standard font image using a scale-invariant feature transformation algorithm, the method includes: Acquire the font image to be evaluated and the standard font image; Preprocessing the font image to be evaluated and the standard font image to obtain the preprocessed font image to be evaluated and the standard font image; The preprocessing of the font image to be evaluated and the standard font image to obtain the preprocessed font image to be evaluated and the standard font image comprises: Reading the font image to be evaluated and the standard font image, and adjusting the font image to be evaluated and the standard font image to fixed sizes, so as to obtain the font image to be evaluated and the standard font image of the same size; The font image to be evaluated and the standard font image are converted into a grayscale image mode to obtain the preprocessed font image to be evaluated and the standard font image.

4. The intelligent calligraphy evaluation method according to claim 1, characterized in that: The method further includes a second evaluation score, wherein the second evaluation score and the first evaluation score are both evaluation reference scores for the font image to be evaluated; the method further includes: Acquire the font image to be evaluated and the standard font image, and preprocess the font image to be evaluated and the standard font image to obtain the edge of the font image to be evaluated and the edge of the standard font image; Calling a first OpenCV library function to extract contours from the edges of the font image to be evaluated and the edges of the standard font image, respectively, and drawing a first contour corresponding to the font image to be evaluated and a second contour corresponding to the standard font image on a blank mask image, wherein the blank mask image matches the size of the font image to be evaluated; An intersection area and a union area between the first contour and the second contour are calculated, and a ratio of the intersection area to the union area is determined as the second evaluation score.

5. The intelligent calligraphy evaluation method according to claim 4, characterized in that: The method further includes a third evaluation score, and the third evaluation score and the first evaluation score are both evaluation reference scores for the font image to be evaluated; after drawing a first outline corresponding to the font image to be evaluated and a second outline corresponding to the standard font image on the blank mask image, the method further includes: Calling a second OpenCV library function to connect multiple convex points at the outermost periphery of the first contour to generate a first convex hull; connecting multiple convex points at the outermost periphery of the second contour based on the second OpenCV library function to generate a second convex hull; An intersection area and a union area between the first convex hull and the second convex hull are calculated, and a ratio of the intersection area to the union area is determined as the third evaluation score.

6. The intelligent calligraphy evaluation method according to claim 1, characterized in that: The method further includes a fourth evaluation score and a fifth evaluation score, wherein the fourth evaluation score, the fifth evaluation score and the first evaluation score are all evaluation reference scores for the font image to be evaluated; The method further comprises: Acquire the font image to be evaluated and the standard font image, and preprocess the font image to be evaluated and the standard font image to obtain the preprocessed font image to be evaluated and the standard font image; Calculating first projection histograms of pixels having a Boolean value of 0 in the preprocessed font image to be evaluated at multiple angles; Calculating second projection histograms of pixels having a Boolean value of 0 in the preprocessed standard font image at the plurality of angles; Based on the first projection histogram and the second projection histogram, calculating the overlap ratio between the preprocessed font image to be evaluated and the preprocessed standard font image to obtain the fourth evaluation score; Formula 1 is used to calculate the correlation coefficient r between the projection image of the font image to be evaluated and the projection image of the standard font image at each angle, and the correlation corresponding to each angle is obtained: Among them, r is the correlation coefficient, X i is the number of pixels at each coordinate on the X-axis corresponding to the standard font image, and Y i is the number of pixels at each coordinate on the X-axis corresponding to the font image to be evaluated, where the unit length is pixel; μ X and μ Y is the mean value of the number of pixels in all coordinates of the standard font image and the font image to be evaluated with 1 pixel as the unit; n is the length of the projection histogram of the standard font image and the font image to be evaluated on the X-axis, where the dimension is pixel; An arithmetic mean of the correlation corresponding to each of the multiple angles is calculated to obtain the fifth evaluation score.

7. The intelligent calligraphy evaluation method according to any one of claims 1 to 6, characterized in that: After determining the first evaluation score of the font image to be evaluated, the method further includes: Generate a stroke model group based on a plurality of calligraphy single-word image training, wherein the stroke model group includes a plurality of stroke sub-models; Determine the copying stroke image corresponding to each stroke of the copied font based on the multiple stroke sub-models; After determining the target standard font corresponding to the copied font from the standard font library, determining the predicted stroke images corresponding to each stroke of the target standard font based on the multiple stroke sub-models; and extracting the stroke contour of each predicted stroke image to obtain a predicted stroke contour image; Displaying each predicted stroke outline image of the target standard font on the copied stroke image of the copied font to obtain a stroke visual guidance image based on each stroke; For each stroke of the copied font, the projection histograms of each corresponding stroke of the copied font and the target standard font at multiple angles are calculated and drawn, and based on the parameter features in each direction, evaluation guidance for each stroke is generated and output from the evaluation vocabulary.

8. The intelligent calligraphy evaluation method according to claim 7, characterized in that: The method of generating a stroke model group based on a plurality of calligraphy single-word logo images training comprises: Acquire a plurality of calligraphy single-word images, and perform binarization processing and manual denoising processing on the plurality of calligraphy single-word images to obtain a sample font database; Drawing stroke images of each sample font in the sample font database respectively, naming and classifying each stroke image according to the stroke image name and stroke order, and establishing a training data set corresponding to each stroke; For each stroke, the constructed neural network model is trained based on the training data set corresponding to the stroke to obtain a stroke model group including multiple strokes; wherein each stroke corresponds to a stroke sub-model; The neural network model includes a generator network and a discriminator network; for each stroke, the constructed neural network model is trained based on the training data set to obtain a stroke sub-model corresponding to the stroke, including: Initializing the generator network and the discriminator network; Based on the discriminator network, the real image and the generated image generated by the generator network are discriminated, and the discriminator network loss and the generator network loss are calculated; The discriminator network loss and the generator network loss are recorded, and the generator network parameters and the discriminator network parameters are updated based on the defined optimizer to minimize the discriminator network loss and the generator network loss and achieve the best image generation effect, thereby obtaining a stroke sub-model based on the optimal network parameters.

9. The intelligent calligraphy evaluation method according to claim 1, characterized in that: The method further comprises: Performing data enhancement on calligraphy characters images in the acquired calligraphy font dataset one by one to obtain an enhanced dataset; Extracting a feature vector of the font image to be evaluated using the trained SimCLR model to obtain a first feature vector and a second feature vector; Normalizing the first eigenvector and the second eigenvector to obtain a normalized first eigenvector and a normalized second eigenvector; The cosine similarity between the normalized first eigenvector and the second eigenvector is calculated to obtain a sixth evaluation score for the font image to be evaluated.

10. An intelligent calligraphy evaluation system, characterized in that: The system comprises: A matching module, used to extract feature points from the preprocessed font image to be evaluated and the standard font image respectively using a scale-invariant feature transformation algorithm, and to match feature points between the preprocessed font image to be evaluated and the standard font image to obtain a plurality of matching point pairs; A screening module is used to screen the multiple matching point pairs based on the positional relationship of the matching point pairs to obtain a first reference point group and a second reference point group corresponding to multiple target matching point pairs; wherein the first reference point group is located in the font image to be evaluated, and the second reference point group is located in the standard font image; the screening of the multiple matching point pairs based on the positional relationship of the matching point pairs to obtain a first reference point group and a second reference point group corresponding to multiple target matching point pairs includes: calculating the length and slope of the matching line segment corresponding to each of the matching point pairs; determining a two-dimensional histogram of the length and slope based on the length and slope of each of the matching line segments to obtain each of the matching point pairs; The frequency distribution of the length and slope of the corresponding matching line segment in the two-dimensional space; determining the frequency peak in the two-dimensional histogram, and using the Euclidean distance to calculate the distance value between each matching point pair and the frequency peak; sorting each distance value to obtain a sorted matching point sequence; and screening the matching point sequence based on a preset threshold to obtain a target matching point pair group, and determining the coordinates of multiple feature points corresponding to multiple target matching point pairs in the target matching point pair group in the font image to be evaluated as a first reference point group, and determining the coordinates of multiple feature points corresponding to multiple target matching point pairs in the target matching point pair group in the standard font image as a second reference point group; a vector extraction module, configured to construct a first graph data object based on the first reference point group, construct a second graph data object based on the second reference point group, and input the first graph data object and the second graph data object into a pre-trained graph isomorphism network to extract image feature vectors, thereby obtaining a first image feature vector corresponding to the font image to be evaluated and a second image feature vector corresponding to the standard font image; The determination module is used to determine a first evaluation score for the font image to be evaluated based on the cosine similarity between the first image feature vector and the second image feature vector.

Citation Information

Patent Citations

  • Calligraphy copy intelligent evaluation and guidance method based on computer vision

    CN112800936A

  • Hard-tipped pen calligraphy work evaluation method

    CN111738141A

  • Text image similarity evaluation method and device, electronic equipment and storage medium

    CN113255667A