Multi-style dynamic word combination method based on generative adversarial network
By expressing Chinese characters into IDS sequences and using generative adversarial networks to optimize styles, the problem of unsightly generation of non-standard Chinese characters and artistic Chinese characters in the existing technology is solved, and the effect of multi-style dynamic character grouping is achieved.
Patent Information
- Application Number
- CN202210041793.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-14
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2042-01-14
AI Technical Summary
It is difficult for the prior art to effectively generate beautiful characters of non-standard Chinese characters and artistic Chinese characters, especially in the generation of special Chinese characters and artistic Chinese characters outside the standard character set, there are problems such as fixed structural layout and lack of interspersed strokes.
By expressing Chinese characters as IDS sequences, a glyph vector model of each substructure is constructed, and a style optimization model based on a generative adversarial network is used to optimize the style of the Chinese characters to achieve multi-style dynamic character grouping.
A multi-style dynamic character grouping is realized for any Chinese character character. The generated characters are similar to the original Chinese characters when restoring the standard character set, and more beautiful results can be generated for special Chinese characters and artistic Chinese characters outside the standard character set.
Smart Images

Figure CN114359038B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of computer-aided design, and in particular relates to a multi-style dynamic character grouping method based on a generative adversarial network. Background Art
[0002] Expanding the character set for Chinese characters of a specific style has always been an important project in the field of Chinese character design. In recent years, deep learning technology, especially style transfer methods based on variational autoencoders (VAE) and generative adversarial networks (GAN), has made some progress in the generation of Chinese character glyphs. Some representative works include: Zhang Y, Zhang Y, Cai W. Separating style and content for generalized style transfer[C] / / Proceedings of the IEEE conference on computer vision and pattern recognition. 2018: 8447-8455. Xie Y, Chen X, Sun L, et al. DG-Font: Deformable Generative Networks for Unsupervised Font Generation[C] / / Proceedings of the IEEE / CVF Conference on Computer Vision and Pattern Recognition. 2021: 5130-5140.
[0003] The commonality of these methods is that when faced with a target style font that covers fewer characters, it is necessary to select a font that covers more characters as the source style font, and expand its character set by migrating the Chinese character glyphs in it to the target style. Therefore, for a specific Chinese character, to generate a glyph with the target style, the source style font must already contain the Chinese character in order to generate it effectively.
[0004] Although this style transfer method solves the problem of font expansion in the commonly used Chinese character set to a certain extent, in actual applications, we sometimes encounter some non-standard characters, such as rare characters, variant characters, and artistic characters. These characters have a relatively unique structure and do not exist in the commonly used Chinese character set. Therefore, it is often difficult to find a source font with the glyph of the character. At this time, the above-mentioned type of neural network cannot be used for transfer generation.
[0005] For this type of special Chinese characters, some high-level Chinese character semantic knowledge can be used to describe their structural composition. A representative example is the ideographic description sequence IDS, a prefix expression sequence that describes the way Chinese characters are constructed. Currently, there are some studies that use IDS sequences as input to neural networks to generate glyphs of a specified style, but the glyphs in the generated results are not beautiful enough and have many structural problems.
[0006] Whether the Chinese character shape is beautiful depends largely on the structure of the character itself, that is, the combination of the various sub-components within the character. In the past thirty years, there have been many studies on the automatic structure of Chinese characters (dynamic character grouping) using the semantics of Chinese characters. Early studies set structural codes based on expert knowledge for parameterized dynamic character grouping [Fan Jianping, Intelligent Chinese Character Design and Experimental System ICCDS; 1990], but the expert knowledge-based method has a strong dependence on manual work and is difficult to mathematically model. After the IDS standard was established, there were also some attempts to structure rare characters based on graphics methods [Mo Liping, A Dynamic Generation Method for Xiangxi Folk Miao Character Shapes and Its Implementation Path, 2016], but the character shapes generated by graphics methods often have defects in structure such as a relatively fixed structure layout and lack of stroke interlacing.
[0007] In summary, the current method that only uses deep learning is mainly aimed at modern Chinese characters within the regular character set, and cannot generate special Chinese characters outside the character set very well. The results of dynamic character generation using only the graphics method have certain limitations. There is still a lack of research on combining the two for multi-style dynamic optimization. Summary of the invention
[0008] In view of the above, the purpose of the present invention is to provide a multi-style dynamic character assembly method based on a generative adversarial network, which performs preliminary dynamic character assembly through a graphics method, and optimizes the results of dynamic character assembly of multiple styles of fonts based on an adversarial network, thereby achieving better character shape effect.
[0009] In order to achieve the above-mentioned invention object, the present invention provides the following technical solutions:
[0010] A multi-style dynamic word combination method based on a generative adversarial network comprises the following steps:
[0011] The Chinese character is expressed as an IDS sequence, wherein the IDS sequence includes a plurality of characters constituting a substructure of the Chinese character and an IDC character representing layout information of the substructure;
[0012] Constructing a glyph vector model of each substructure, and performing vector combination on the glyph vector models of the substructures according to the layout information of the substructures presented by the IDC characters to obtain a glyph vector model of the Chinese character;
[0013] The style optimization model built based on the generative adversarial network is used to perform style optimization processing on the glyph image corresponding to the glyph vector model of Chinese characters.
[0014] Wherein, the IDC characters include IDC characters of stacked structure, including The IDC characters include the IDC characters of the surrounding structure, including
[0015] In one embodiment, constructing a glyph vector model for each substructure includes:
[0016] The skeleton key point set of each substructure is represented as a two-dimensional point coordinate sequence S = ((x i ,y i ));
[0017] The first offset vector of each substructure's contour node relative to the matching skeleton key point is represented as a two-dimensional vector sequence Offset1 = ((Δx i ,Δy i ));
[0018] The second offset vector of the handle point relative to the associated contour node is expressed as a two-dimensional vector sequence Offset2 = ((Δx i ,Δy i )).
[0019] In one embodiment, when the IDC character is an IDC character of a stacked structure, that is, when the glyph vector models of the substructures are vector-combined according to the layout information of the stacked structure, the vector combining step includes:
[0020] S11, normalizing the coordinate origin of the skeleton key points of the glyph vector model of the substructure;
[0021] S12, performing scaling transformation on each substructure, including:
[0022] According to the number of black pixels in the binary glyph image corresponding to the glyph vector model, the glyph proportion of each substructure in the Chinese character is calculated. k ;
[0023] According to the glyph bounding box and glyph proportion ratio of each substructure u , the gap distance between each substructure, and the blank distance between the combined glyph and the edge of the square canvas, calculate the expansion and contraction coefficient Factor of each substructure k ;
[0024] Using the scaling factor Factor kPerform scaling transformation on the skeleton key points, the first offset vector and the second offset vector of each substructure to obtain the skeleton key point set The first offset vector sequence Offset1′ k , the second offset vector sequence Offset2′ k ;
[0025] S13, for the skeleton key point set The skeleton key points in the coordinate transformation are transformed so that the skeleton key point set The coordinates of the skeleton key points in the range [0, L] are obtained to obtain the skeleton key point set
[0026] S14, the skeleton key points of all substructures are set The first offset vector sequence Offset1′ k , the second offset vector sequence Offset2′ k Merge separately.
[0027] In one embodiment, when the IDC character is an IDC character of an enclosing structure, that is, when the glyph vector models of the substructures are vector-combined according to the layout information of the enclosing structure, the two substructures to be vector-combined are defined as an enclosing substructure and an enclosed substructure, and the vector combining step includes:
[0028] S21, normalizing the coordinate origin of the skeleton key points of the glyph vector model of the enclosed substructure to obtain a skeleton key point set after the coordinate origin normalization
[0029] S22, calculating the maximum inscribed rectangle that can be contained in the enclosed substructure, and calculating the scaling transformation coefficient required for the enclosed substructure to be embedded in the maximum inscribed rectangle of the enclosing substructure;
[0030] S23, using the scaling transformation coefficient to perform scaling transformation on the skeleton key points, the first offset vector and the second offset vector of the enclosed substructure to obtain a skeleton key point set The first offset vector sequence Offset1′ 2 , the second offset vector sequence Offset2′ 2 ;
[0031] S24, transform and adjust the skeleton key points, the first offset vector, and the second offset vector of the enclosed substructure, so that its maximum inscribed rectangle has enough space for the enclosed substructure to be embedded, and obtain an adjusted skeleton key point set The first offset vector sequence Offset1′ 1 , the second offset vector sequence Offset2′ 1 ;
[0032] S25, the skeleton key point set for the enclosed substructure and the skeleton keypoint set of the enclosed substructure The skeleton key points in the image are transformed so that the enclosed substructure is moved to the center of the largest inscribed rectangle of the transformed enclosed substructure, and the skeleton key point set is obtained. and skeleton keypoint set
[0033] S26, the skeleton key points of the two substructures are set and The first offset vector sequence Offset1′ 2 and Offset1′ 1 , the second offset vector sequence Offset2′ 2 and Offset2′ 1 Merge separately.
[0034] In one embodiment, when a style optimization model is constructed based on a generative adversarial network, zi2zi is preferably used as a generative adversarial network, a Chinese character glyph vector model obtained by vector combination is used as a sample, and the original glyph of the Chinese character is used as a sample label;
[0035] When the vectors are combined to obtain the Chinese character vector model, the gap between each substructure is calculated by Sampling is performed to achieve data enhancement of samples, where For interval Uniform distribution on
[0036] The sample labels corresponding to the data-enhanced sample set are used to perform adversarial learning on the generative adversarial network to optimize the parameters of the generative adversarial network. The generator part of the parameter-optimized optimized generative adversarial network is used as a style optimization model.
[0037] Compared with the prior art, the present invention has the following beneficial effects:
[0038] The multi-style dynamic character grouping method based on the generative adversarial network provided in the embodiment can generate any Chinese characters through IDS, and use the generative adversarial network to optimize the style, so that the character shapes generated when restoring the Chinese character shapes in the standard character set are similar to the original Chinese characters. For special Chinese characters outside the standard character set and artificial artistic Chinese characters, more beautiful results can also be generated. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0040] Figure 1 is a flow chart of a multi-style dynamic word combination method based on a generative adversarial network provided by an embodiment;
[0041] Figure 2 It is an example of the meaning and structure of IDC provided by the embodiment;
[0042] Figure 3 It is an example of a Chinese character structure tree provided in the embodiment;
[0043] Figure 4 is an example of a glyph bounding box provided in an embodiment;
[0044] Figure 5 is an example of the maximum inscribed rectangle of a glyph provided in the embodiment;
[0045] Figure 6 It is a schematic diagram of dynamic character grouping of non-standard Chinese characters using IDS provided by the embodiment;
[0046] Figure 7 The embodiment provides the method of using IDS to generate artistic Chinese characters;
[0047] Figure 8 It is a dynamic word combination flow chart provided by the embodiment;
[0048] Fig. 9 This is an example of dynamic word grouping provided by the embodiment;
[0049] Fig.10 is an example diagram of pad and gap provided in the embodiment;
[0050] Fig.11 This is an example of a glyph vector model provided by an embodiment expanding a maximum inscribed rectangle through transformation;
[0051] Fig.12 It is an example of visualization of reference points under different IDCs provided by the embodiment;
[0052] Fig.13 is an example of data enhancement provided by an embodiment;
[0053] Fig.14 is a comparison diagram of the restoration effect of Chinese characters in the standard character set provided by the embodiment;
[0054] Fig.15It is the Chinese character generation effect within the non-standard character set provided by the embodiment. Detailed implementation manners
[0055] To make the objectives, technical solutions and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific implementation manners described herein are only used to explain the present invention and do not limit the protection scope of the present invention.
[0056] Figure 1 It is the flowchart of the multi-style dynamic character composition method based on the generative adversarial network provided by the embodiment. As Figure 1 shown, the multi-style dynamic character composition method based on the generative adversarial network provided by the embodiment includes the following steps:
[0057] Step 1: Express a Chinese character as an IDS sequence. The IDS sequence includes characters of multiple sub-structures that make up the Chinese character and IDC characters representing the layout information of the sub-structures.
[0058] The ideographic description sequence IDS is a postfix expression describing the Chinese character formation method. There are two types of characters in IDS. One is the regular Chinese character component character, and the other is the ideographic description character IDC. There are 12 types of IDC characters as control characters in total. As Figure 2 shown, the syntax of IDS requires that three IDSs follow the 3-element IDC character ( and ), and two IDSs need to follow other 2-element IDC characters. Therefore, for a Chinese character, using the IDC character to disassemble the Chinese character, the IDS corresponding to its sub-structure can be obtained. This process can be repeated multiple times. When no further splitting is possible, a Chinese character structure tree can be obtained. In the tree, IDC is located at the branch node, and the sub-structure characters are located at the leaf node. As Figure 3 shown. IDS is the postfix expression of this Chinese character structure tree.
[0059] For the IDC representing the stacked structure which is a 2-element or 3-element IDC, the Chinese character sub-structures corresponding to the subsequent IDSs follow the rules of first left then right and first up then down in the corresponding layout; for the IDC representing the enclosed structure both are 2-element IDCs, and the layout rule is that the sub-structure corresponding to the first IDS encloses the sub-structure corresponding to the second subsequent IDS. For the IDC representing the overlapping structure its reflected layout rules are complex and not unified. For example, both the characters "夷" ( big bow) and "乖" ( thousand north) use , but the character formation methods are completely different. Therefore, the method of the present invention does not involve Chinese characters with IDC structures of overlapping structures in the corresponding IDS.
[0060] In the embodiment, Chinese characters are decomposed to obtain each substructure, and a Chinese character structure tree is constructed for the Chinese characters by utilizing IDS to organize and manage the substructures. Thus, an IDS sequence corresponding to the Chinese characters is obtained, wherein the IDS sequence includes characters of the substructure and IDC characters representing layout information of the substructure, specifically including IDC characters of stacked structures and IDC characters of stacked structures.
[0061] Step 2: construct a glyph vector model for each substructure.
[0062] In the embodiment, a glyph vector model is constructed for each substructure in the IDS sequence, a multi-style font library of OTF or TTF format font files is used as the font library, and a glyph vector model of the substructure is constructed according to the Chinese character vector outline data provided by the font library. The specific method of constructing the glyph vector model refers to the method of constructing the glyph vector model disclosed in patent document CN112232022A, which specifically includes:
[0063] The skeleton key point set of each substructure is represented as a two-dimensional point coordinate sequence S = ((x i ,y i )), stored in an array list of length 2;
[0064] The first offset vector of each substructure's contour node relative to the matching skeleton key point is represented as a two-dimensional vector sequence Offset1 = ((Δx i ,Δy i )), represented by an array list of length 2, the length of the array list of the skeleton key points is the same as the length of the array list of the first offset vector;
[0065] The association between handle points and contour nodes is implemented as a list. The list records the subscripts of contour nodes associated with the handle points in the order of handle points, so that the association between handle points and contour nodes can be simply and clearly expressed.
[0066] The second offset vector of the handle point relative to the associated contour node is expressed as a two-dimensional vector sequence Offset2 = ((Δx i ,Δy i )), stored in an array list of length 2.
[0067] Step 3: Perform vector combination on the glyph vector models of the substructures according to the layout information of the substructures presented by the IDC characters to obtain the glyph vector model of the Chinese character.
[0068] The dynamic character composition of iconography is achieved by parsing the IDS data corresponding to Chinese characters. Starting from continuously vector - combining smaller sub - structures according to the IDC and merging them upward into larger sub - structures, a complete character glyph is finally obtained. Its advantage lies in that as long as the glyphs corresponding to the sub - structures (usually radicals) in the IDS exist in the font data, dynamic character composition can be generated. Even for some special Chinese characters outside the conventional character sets, their IDS sequences can be obtained by analyzing their glyph structures and then generated, as shown in Figure 6 shown. It is even possible to generate artistic Chinese characters that originally did not exist by reasonably creating IDS, as shown in Figure 7 shown.
[0069] Based on the characteristics of the IDS postfix expression, it can be parsed using two stacks. By continuously combining smaller sub - structures into larger sub - structures from back to front, dynamic character composition is finally completed. The specific process is as follows:
[0070] (a) Obtain the IDS string sequence corresponding to a Chinese character and specify the target style of dynamic character composition;
[0071] (b) Split the IDS string into individual characters and push them into the first stack (stack A) in order. At the same time, prepare another empty stack (stack B);
[0072] (c) Take out the character at the top of stack A and check its type. If it is a component character, construct the glyph vector model of its target style using the font data and push the glyph vector model into stack B; if it is an IDC, according to the arity of the IDC, take out 2 to 3 glyph vector models of sub - structures from the top of stack B in turn. After vector - combining them into a glyph vector model of a larger sub - structure, push it back into stack B;
[0073] (d) Determine whether stack A is empty. If it is not empty, return to step (b); if it is empty, the loop ends. Take out the glyph vector model at the top of stack B, which is the result of the dynamic character composition of the corresponding Chinese character, and output the corresponding glyph picture.
[0074] Figure 8 、 9 respectively give the flow chart of dynamic character composition and the combination results of sub - structures at each stage and the internal changes of the two stacks during the process of taking the character "hao" (IDS: 亠口冖毛) as an example for dynamic character composition.
[0075] In the embodiment, the vector combination is achieved by the method of graphics affine transformation, so that the glyph vector models of smaller sub - structures are combined according to the layout information provided by the IDC to form a glyph vector model of a larger sub - structure. For the two types of IDC, namely the stacked structure and the enclosed structure, the vector combination adopts the following two different methods.
[0076] Method 1: Stacked structure vector combination method.
[0077] When the IDC character is an IDC character with a stacked structure, the vector combination of the stacked structure performs a vector transformation on the glyph vector models of the sub-structures corresponding to 2 or 3 IDS following the IDC, and then arranges them in parallel in a left-right or up-down form to achieve the stacked effect. Specifically, the steps of the stacked structure vector combination include:
[0078] Step 11, normalize the coordinate origin of the key points of the skeleton of the glyph vector model of the sub-structure.
[0079] In the embodiment, for the character glyph in a square canvas with side length L (i.e., the resolution is L×L), the coordinates of the key points of the skeleton in the glyph vector model fall within [0, L] in both the x and y directions. It is necessary to normalize the coordinates of the key points of the skeleton to be symmetric about the origin (falling within the range of [-L / 2, L / 2]) for subsequent scaling transformation and position layout. For the sub-structure located at the center of a square canvas with side length L, the normalization of the coordinate origin of the key points of the glyph vector model of the sub-structure is as follows:
[0080]
[0081] Among them, is the set of key points of the skeleton after coordinate origin normalization of the k-th sub-structure, and S k is the original set of key points of the skeleton of the k-th sub-structure;
[0082] However, for some sub-structures, their glyph images will deviate significantly from the center of the canvas, such as Figure 3 shown by "宀". For the glyph vector model of such sub-structures, the origin coordinates can be normalized using the intersection point of the diagonal of its bounding box. In the embodiment, the glyph bounding box refers to the smallest rectangle that encloses the glyph image in the glyph canvas where the character glyph is located. Figure 4 shows an example of the bounding box of the character "宀" with a roof. Denote the lower left corner coordinates of the glyph bounding box of the k-th sub-structure as (x k,l , y k,d ), and the upper right corner coordinates as (x k,r , y k,u ), then the normalization of the coordinate origin of the key points of the glyph vector model of the sub-structure is as follows:
[0083]
[0084] Step 12, perform scaling transformation on each sub-structure.
[0085] In the embodiment, the proportion of each substructure in the combined character is first calculated. The number of black pixels P in the binary image corresponding to the glyph vector model of each substructure can be used to approximate the glyph stroke length, and then the glyph proportion of each substructure in the Chinese character is calculated using the following formula: k :
[0086]
[0087] Where n is the number of substructures. When n=2, when IDC= When n=3, w k is the weighting coefficient, which represents some empirical weights of substructures at different positions in the layout. For example, in a Chinese character with a left-right structure, the left substructure is generally smaller than the right substructure, so the corresponding weighting coefficient of the left substructure will be slightly smaller than that of the right one. k Represents the total number of black pixels in the binary glyph image (the glyph is black pixels and the background canvas is white pixels) corresponding to the glyph vector model of the k-th substructure.
[0088] In the embodiment, in order to prevent a substructure stroke length from being much smaller than the other substructure stroke lengths, resulting in its glyph proportion being too small, a glyph proportion lower limit MinRatio(IDC) is also set. The value of MinRatio(IDC) is different. In the embodiment, the following value is recommended:
[0089]
[0090] In the embodiment, the glyph proportion Ratio of each substructure in the Chinese character is set according to the lower limit of the glyph proportion MinRatio (IDC). k Optimize the processing, when the font size ratio k When it is less than MinRatio(IDC), the font size ratio is k Optimized to:
[0091] Ratio′ k =MinRatio(IDC)
[0092] When the font size ratio k When it is greater than or equal to MinRatio(IDC), the font ratio is Ratio k Optimized to:
[0093]
[0094] Among them, Ratio′ k For the optimized glyph proportion, Ratio′k It indicates the sum of the adjusted glyph proportion values of all substructures whose original glyph proportion is less than MinRatio(IDC). Ratio k It indicates the sum of the original glyph proportion values of all substructures whose original glyph proportion is greater than MinRatio(IDC). Through adjustment, it can be ensured
[0095] Secondly, according to the glyph bounding box and glyph proportion ratio of each substructure k , the gap distance between each substructure, and the pad distance between the combined glyph and the edge of the square canvas, calculate the scaling transformation coefficient Factor of each substructure k .
[0096] In the embodiment, the gap distance gap and the blank distance pad are as follows: Fig.10 In the embodiment, different scaling factors Factor are used for different IDC characters. k Calculation method.
[0097] For IDC characters with left-right structure and left-center-right structure, that is, for IDC characters and The scaling transformation only exists in the x direction. First calculate the target width:
[0098] width k =(L-2×pad-(n-1)×gap)×Ratio′ k
[0099] Then calculate the scaling factor:
[0100]
[0101] For IDC characters with upper-lower structure and upper-middle-lower structure, that is, for IDC characters and The scaling transformation only exists in the y direction. First calculate the target height:
[0102] height k =(L-2×pad-(n-1)×gap)×Ratio′ k
[0103] Then calculate the scaling factor:
[0104]
[0105] In the above formula, n is the number of substructures (how many elements of IDC are there), when When n=2, When n=3, the values of gap and pad are generally determined as follows:
[0106]
[0107] Finally, using the scaling factor Factor k Perform scaling transformation on the skeleton key points, the first offset vector and the second offset vector of each substructure to obtain the skeleton key point set The first offset vector sequence Offset1′ k , the second offset vector sequence Offset2′ k .
[0108] Using the scaling factor Factor k The skeleton key points of each substructure are scaled and transformed to obtain a skeleton key point set for:
[0109]
[0110] Using the scaling factor Factor k The first offset vector of each substructure is scaled to obtain the first offset vector sequence Offset1′ k for:
[0111]
[0112] Using the scaling factor Factor k The second offset vector of each substructure is scaled to obtain a second offset vector sequence Offset2′ k for:
[0113]
[0114] Among them, Offset1 k and Offset2 k The first offset vector sequence of the original contour node of the kth substructure relative to the matching skeleton key point and the second offset vector sequence of the handle point relative to the associated contour node; Offset1′ k and Offset2′ k It is a first offset vector sequence of the contour nodes after the k-th substructure scaling transformation relative to the matching skeleton key points and a second offset vector sequence of the handle points relative to the associated contour nodes.
[0115] Step 13: Set the skeleton key points The skeleton key points in the coordinate transformation are transformed so that the skeleton key point set The coordinates of the skeleton key points in the range [0, L] are obtained to obtain the skeleton key point set
[0116] In the embodiment, due to the obtained The coordinate range of the skeleton key points is normalized by the origin and falls within the range of [-L / 2, L / 2]. To transform it back to the range of [0, L], the following mobile layout is required, that is, the skeleton key point set Perform coordinate transformation to obtain the skeleton key point set for:
[0117]
[0118] Where n is the total number of substructures,
[0119] This layout formula is used to conform to the stacking structure In the layout, the Chinese character substructure corresponding to IDC and subsequent IDS follows the rule of left first, then right, and top first, then bottom.
[0120] Step 14: Set the skeleton key points of all substructures The first offset vector sequence Offset1′ k , the second offset vector sequence Offset2′ k Merge separately.
[0121] In the embodiment, the glyph vector models of all substructures are merged to obtain a new glyph vector model. For the skeleton key point set, the contour nodes are relative to the first offset vector sequence of the matching skeleton key points, and the handle points are relative to the second offset vector sequence of the associated contour nodes. The merged form is as follows:
[0122]
[0123] Offset1 new =Offset1′ 1 +…+Offset1′ n
[0124] Offset2 new =Offset2′ 1 +…+Offset2′ n
[0125] It should be noted that the plus sign here means connecting the lists.
[0126] Method 2: Enclosing structure vector combination method.
[0127] The vector combination of the surrounding structure performs a vector transformation on the sub-structures corresponding to the subsequent 2 IDSs of the IDC, so that the glyph vector model of the first sub-structure has enough space for the glyph vector model of the second sub-structure to be embedded, thereby achieving the surrounding effect. In the embodiment, the second sub-structure in the inner periphery is defined as the surrounded sub-structure, and the first sub-structure in the outer periphery is defined as the surrounding sub-structure. Specifically, the steps of the vector combination of the surrounding structure include:
[0128] Step 21, normalize the coordinate origin of the skeleton key points of the glyph vector model of the surrounded sub-structure to obtain the set of skeleton key points after coordinate origin normalization
[0129] In the embodiment, the method of step 11 is used to normalize the coordinate origin of the skeleton key points of the glyph vector model of the surrounded sub-structure, that is, the second sub-structure with k = 2, to obtain the set of skeleton key points
[0130] Step 22, calculate the maximum inscribed rectangle that can be accommodated inside the surrounding sub-structure, and at the same time calculate the scaling transformation coefficient required for the surrounded sub-structure to be embedded in the maximum inscribed rectangle of the surrounding sub-structure.
[0131] In the glyph image, the rectangular area with the largest blank (no glyph strokes) within the glyph bounding box is the maximum inscribed rectangle. Figure 5 An example of the maximum inscribed rectangle of the character "户" is given. The calculation of the maximum inscribed rectangle of the glyph can be obtained by binarizing the glyph image and cropping according to the inside of the glyph bounding box to obtain the glyph binary image without white space. Then, apply the histogram maximum rectangle algorithm to this glyph binary image in the horizontal (x direction) and vertical (y direction) respectively. The calculation in the horizontal direction can obtain the coordinates of the left and right edges of the maximum inscribed rectangle (corresponding to Recx i,l , Recx i,r ), and the calculation in the vertical direction can obtain the coordinates of the upper and lower edges of the maximum inscribed rectangle (corresponding to Recy i,d , Recy i,u ), thereby obtaining the range of the maximum inscribed rectangle.
[0132] Based on the definition of the maximum inscribed rectangle, calculate the maximum inscribed rectangle that can be accommodated inside the surrounding sub-structure (that is, the first sub-structure, k = 1), and record the lower left coordinate of the maximum inscribed rectangle as (Recx 1,l , Recy 1,d ), and the upper right coordinate as (Recx 1,r , Recy 1,u ).
[0133] In the embodiment, the scaling transformation coefficient includes the scaling transformation coefficient Factor in the x direction 2.xAnd the scaling factor in the y direction 2,y , the calculation methods include:
[0134]
[0135]
[0136] Among them, (x 2,l ,y 2,d ) represents the lower left corner coordinate of the glyph bounding box of the enclosed substructure, (x 2,r ,y 2,u ) represents the coordinates of the upper right corner of the glyph bounding box of the enclosed substructure;
[0137] In order to prevent the enclosed substructure from being enlarged or over-reduced, a scaling factor lower limit MinFactor is set for the scaling transformation coefficient, and the MinFactor is preferably 0.4. The scaling transformation coefficient is optimized according to the set scaling factor lower limit MinFactor, including:
[0138] Factor′ 2,x =max(Factor 2,x , MinFactor)
[0139] Factor′ 2,y =max(Factor 2,y , MinFactor)
[0140] Among them, Factor′ 2,x and Factor′ 2,y are the optimized scaling transformation coefficients respectively, and max() is the maximum value function.
[0141] Step 23, using the scaling transformation coefficient to scale the skeleton key points, the first offset vector and the second offset vector of the enclosed substructure to obtain a skeleton key point set The first offset vector sequence Offset1′ 2 , the second offset vector Offset2′ 2 .
[0142] In the embodiment, the scaling factor Factor′ is used 2,x , Factor′ 2,y The skeleton key points, the first offset vector and the second offset vector of the enclosed substructure (k=2) are scaled and transformed.
[0143] Skeleton keypoint set for the enclosed substructure The scaling transformation is:
[0144]
[0145] The first offset vector sequence Offset1 for the contour nodes of the enclosed substructure relative to the matching skeleton key points 2 , the scaling transformation is:
[0146]
[0147] The second offset vector sequence Offset2 for the handle points of the enclosed substructure relative to the associated contour node 2 , the scaling transformation is:
[0148]
[0149] Step 24, transform and adjust the skeleton key points and the first offset vector and the second offset vector of the enclosed substructure, and adjust its maximum inscribed rectangle to have enough space for the enclosed substructure to be embedded, and obtain the adjusted skeleton key point set The first offset vector sequence Offset1′ 1 , the second offset vector sequence Offset2′ 1 .
[0150] In the embodiment, the transformation method of the skeleton key points of the enclosed substructure is:
[0151]
[0152] Among them, f x (x i ), f y (y i ) is the skeleton key point (x i ,y i ) is as follows:
[0153]
[0154]
[0155] The first offset vector sequence Offset1 for the contour nodes of the enclosed substructure relative to the matching skeleton key points 1 , the scaling transformation is:
[0156]
[0157] Among them, g x (Δx i ), g y (Δy i ) is the first offset vector (Δx i , Δy i) is as follows:
[0158]
[0159]
[0160] Note that x (Δx i ), g v (Δy i ) The distinguishing condition of the transformation is not (Δx i , Δy i ) itself, but rather the subscript corresponding to (x i ,y i ), this is to ensure the consistency of the transformation of the skeleton key points and the first offset vector.
[0161] The second offset vector sequence Offset2 for the handle points of the enclosed substructure relative to the associated contour node 1 , the scaling transformation is:
[0162] Offset2′ 1 =Offset2 1
[0163] The transformation function f of the above skeleton key points x (x i ), f y (y i ) and the first offset vector transformation function g x (Δx i ), g y (Δy i ), (x 1,ref ,y 1,ref ) is the coordinate of the reference point of the coordinate transformation; (x 1,l ,y 1,d ) is the lower left corner coordinate of the glyph bounding box of the enclosing substructure, (x 1,r ,y 1,u ) is the coordinate of the upper right corner of the glyph bounding box of the enclosing substructure; Factor 1,xl , Factor 1,xr Factor is the contraction coefficient of the key points of the skeleton points on the left and right sides of the reference point in the x direction; 1,yd , Factor 1,yu It is the shrinkage coefficient of the skeleton key points below and above the reference point in the y direction.
[0164] The operation of the skeleton key points is based on the reference point (x 1,ref ,y 1,ref ) as the reference, the substructure to be enclosed corresponds to the glyph vector model located to the left of the reference point (xi ≤x 1,ref ) to the left edge of the glyph bounding box by Factor 1,xl The coefficient of contraction; located to the right of the reference point (x i >x 1,ref )'s skeleton keypoint to the right edge of the glyph bounding box Factor 1,xr The coefficient of contraction; located below the reference point (y i ≤y 1,ref )'s skeleton keypoint to the lower edge of the glyph bounding box Factor 1,yd The coefficient of contraction; located above the reference point (y i >y 1,ref )'s skeleton keypoint to the upper edge of the glyph bounding box Factor 1,yu The coefficient of contraction.
[0165] By contracting in four directions, the maximum inscribed rectangle of the glyph of the enclosing substructure is expanded. Fig.11 Given the IDS sequence " In "Well Water", the "well" is transformed to expand its maximum inscribed rectangle so that the "water" can be embedded.
[0166] The choice of reference point depends on the specific enclosing structure. In practice, the following choices are generally adopted:
[0167]
[0168] Fig.12 Given different IDC, the reference point (x 1,ref ,y 1,ref ) is located.
[0169] For the four scaling factors 1,xl , Factor 1,xr , Factor 1,yd , Factor 1,yu The value of needs to be determined according to the scaling factor Factor′ of the enclosed substructure. 2,x and Factor′ 2,y Decide.
[0170] 1. If Factor′ 2,x =MinFactor, then Factor 2,x ≤MinFactor. This means that the maximum inscribed rectangle of the enclosing substructure is narrow in the x direction. 1,xl , Factor 1,xr It can be calculated as follows:
[0171]
[0172] β xl =x 1,ref -α x (x 1,ref -Recx 1,l )
[0173]
[0174] β xr =x 1,ref -α x (x 1,ref -Recx 1,r )
[0175]
[0176] 2. If Factor′ 2,x >MinFactor, then the maximum inscribed rectangle of the substructure enclosing the glyph does not need to be expanded in the x direction, then Factor 1,xl =Factor 1,xr =1, then f x (x) = x, that is, the coordinates of all skeleton key points remain unchanged in the x direction.
[0177] 3. If Factor′ 2,y =MinFactor, then Factor 2,y ≤MinFactor. This means that the maximum inscribed rectangle of the enclosing substructure is narrow in the y direction. 1,yd , Factor 1,yu It can be calculated as follows:
[0178]
[0179] β yd =y 1,ref -α y (y 1,ref -Recy 1,d )
[0180]
[0181] β yu =y 1,ref -α y (y 1,ref -Recy 1,u )
[0182]
[0183] 4. If Factor′2,y >MinFactor, then the maximum inscribed rectangle of the substructure does not need to be expanded in the y direction, then Factor 1,yd =Factor 1,yu =1, then f y (y) = y, that is, the coordinates of all skeleton key points remain unchanged in the y direction.
[0184] After the skeleton key points and the first and second offsets are transformed, the maximum inscribed rectangle of the enclosing substructure has changed. Recalculate the transformed maximum inscribed rectangle of the enclosing substructure and record its lower left corner coordinate as (Recx′ 1,l , Recy′ 1,d ), the coordinate of the upper right corner is (Recx′ 1,r , Recy′ 1,u ).
[0185] Step 25: Set the skeleton key points of the enclosed substructure and the skeleton keypoint set of the enclosed substructure The skeleton key points in the image are transformed so that the enclosed substructure is moved to the center of the largest inscribed rectangle of the transformed enclosed substructure, and the skeleton key point set is obtained. and skeleton keypoint set
[0186] As in step 13, the skeleton key points need to be moved and laid out. The difference is that the substructure enclosed in the enclosing structure vector combination has not been normalized for the coordinate origin of the skeleton key points, so it only needs to be laid out in the original position, that is,
[0187]
[0188] For the enclosed substructure, the mobile layout is as follows:
[0189]
[0190] Where (Recx′ 1,l , Recy′ 1,d ) and (Recx′ 1,r , Recy′ 1,u ) are the lower left and upper right corner coordinates of the maximum inscribed rectangle of the enclosed substructure recalculated after transformation by the skeleton key points and the first offset vector and the second offset vector.
[0191] By rearranging, the enclosed substructure can be moved to the center of the largest inscribed rectangle of the transformed enclosed substructure. See the example Fig.11 .
[0192] Step 26: Set the skeleton key points of the two substructures and The first offset vector sequence and the second offset vector sequence are merged respectively.
[0193] In the embodiment, the glyph vector models of all substructures are merged to obtain a new glyph vector model. Since the IDCs of the enclosing structures are all binary IDCs, that is, n=2. Therefore, the merged form is as follows:
[0194]
[0195] Offset1 new =Offset1′ 1 +Offset1′ 2
[0196] Offset2 new =Offset2′ 1 +Offset2′ 2
[0197] It should be noted that the plus sign here still means connecting the lists.
[0198] Step 4: Use the style optimization model built based on the generative adversarial network to perform style optimization processing on the glyph image corresponding to the glyph vector model of the Chinese character.
[0199] The glyphs obtained by dynamic grouping of characters in graphics have certain limitations, which are reflected in the defects of the glyph structure, such as unreasonable proportion of substructures, lack of interlacing of strokes between substructures, etc. To this end, the embodiment uses a style optimization model constructed based on a generative adversarial network to optimize the results, thereby obtaining better results.
[0200] Image conversion models based on generative adversarial networks are generally improvements and variants of the classic model pix2pix. Such models generally perform image-to-image type conversion tasks, and the model can convert one type of image into another style of image. Assuming that there are two groups of different types of images, A and B, a training set with one-to-one correspondence between type A and type B images is constructed from them. The model learns how to convert type A images into type B images through this training set. This stage is generally called the training stage of the model. When encountering a new type A image, the model can convert it into the corresponding type B image without having seen the corresponding B image. This stage is generally called the testing or prediction stage of the model.
[0201] In the embodiment, when constructing the stylized optimization model, the generative adversarial network uses zi2zi, which is a network that can train multiple styles of glyphs at the same time by specifying the number. In this technical method, if there are m fonts, for each font, the glyph set obtained by dynamic grouping is paired with the corresponding style glyph set to form a data set. Pairing expansion Pairing, where the subscript is the number that distinguishes the style. Sending such a dataset to the network can simultaneously train fonts of multiple styles to optimize the glyph structure, and further play the role of data enhancement, improving the generalization ability of the network.
[0202] In the embodiment, the construction method of the style optimization model includes: for a font of a specific style in the character library, in the training stage, the Chinese characters in the character table are dynamically grouped according to their IDS, and the glyph image output by the obtained glyph vector model is used as the A-type image, and its original glyph is used as the B-type graphic. The two are paired one by one by Chinese characters to form a training set, and the training sets of multiple styles of fonts are distinguished by numbers and sent to zi2zi for training together, and finally a style optimization model is obtained.
[0203] Note that both type A and type B images are generated using font data, the difference is that the glyphs of the characters in type A images are obtained by dynamic combination of graphics, and the glyphs have defects, while the glyphs of the characters in type B images are original glyphs without defects. What the network needs to learn through training is how to optimize the glyphs with defects in structure, reduce the defects in structure, and generate beautiful glyphs.
[0204] In order to enhance the generalization ability of the model, the gap distance between substructures in the dynamic grouping of graphics can be collected as in, For interval Uniform distribution on .
[0205] Since the value of the gap will have a subtle effect on the scaling coefficients in the vector combination, changing the gap from a fixed value to a sampled value will make the result of dynamic word grouping in graphics a certain degree of randomness. Specifically, for the same IDS, when dynamic word grouping is repeated, there will be slight differences in the gaps between substructures and the size of substructures in the result of each dynamic word grouping. Data enhancement is achieved by pairing the glyphs obtained by performing dynamic word grouping of a Chinese character several times according to its IDS with the original glyph of the Chinese character. Fig.13 An example is given to improve the generalization ability of the model so that it can produce certain optimization effects when faced with defective structures of different glyphs.
[0206] After training, the above-mentioned generative adversarial network can optimize any results obtained by dynamically combining characters using graphics, including Chinese characters that do not exist in the standard character set, and even artistic Chinese characters created using IDS.
[0207] The multi-style dynamic character grouping method based on the generative adversarial network provided in the embodiment can generate any Chinese characters through IDS, and use the generative adversarial network to optimize, so that the character shapes generated when restoring the Chinese character shapes in the standard character set are similar to the original Chinese characters, such as Fig.14 For special Chinese characters outside the standard character set and artificial artistic Chinese characters, it can also generate more beautiful results, such as Fig.15 , providing an effective solution for automatically expanding font character sets and artistically creating new Chinese characters.
[0208] The specific implementation methods described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A multi-style dynamic word combination method based on generative adversarial network, characterized in that: The following steps are involved: The Chinese character is expressed as an ideographic description sequence IDS, wherein the IDS sequence includes a plurality of characters constituting a substructure of the Chinese character and an IDC character representing layout information of the substructure; Constructing a glyph vector model of each substructure, and performing vector combination on the glyph vector models of the substructures according to the layout information of the substructures presented by the IDC characters to obtain a glyph vector model of the Chinese character; Using a style optimization model built based on a generative adversarial network, the glyph image corresponding to the glyph vector model of Chinese characters is style optimized; When the IDC character is an IDC character of a stacked structure, that is, when the glyph vector models of the substructures are vector-combined according to the layout information of the stacked structure, the vector combining step includes: S11, standardizing the coordinate origin of the skeleton key points of the substructure glyph vector model, including: For a substructure in the center of a square canvas with a side length of L, the coordinate origin of the skeleton key points of the substructure's glyph vector model is standardized as follows: in, is the skeleton key point set after the k-th substructure coordinate origin is normalized, S k is the original skeleton key point set of the kth substructure; For a substructure that deviates from the center of the square canvas, the coordinate origin of the skeleton key points of the substructure's glyph vector model is standardized as follows: Among them, (x k,l ,y k,d ) is the lower left corner coordinate of the glyph bounding box of the kth substructure, (x k,r ,y k,u ) is the coordinate of the upper right corner of the glyph bounding box of the kth substructure; S12, performing scaling transformation on each substructure, including: According to the number of black pixels in the binary glyph image corresponding to the glyph vector model, the glyph proportion of each substructure in the Chinese character is calculated. k ; According to the glyph bounding box and glyph proportion ratio of each substructure k , the gap distance between each substructure, and the blank distance between the combined glyph and the edge of the square canvas, calculate the expansion and contraction coefficient Factor of each substructure k ; Using the scaling factor Factor k Perform scaling transformation on the skeleton key points, the first offset vector and the second offset vector of each substructure to obtain the skeleton key point set The first offset vector sequence Offset1 ′ k , the second offset vector sequence Offset2 ′ k ; S13, for the skeleton key point set The skeleton key points in the coordinate transformation are transformed so that the skeleton key point set The coordinates of the skeleton key points in the range [0, L] are obtained to obtain the skeleton key point set. S14, the skeleton key points of all substructures are set The first offset vector sequence Offset1 ′ k , the second offset vector sequence Offset2 ′ k Merge separately; When the IDC character is an IDC character of an enclosing structure, that is, when the glyph vector models of the substructures are vector-combined according to the layout information of the enclosing structure, the two substructures to be vector-combined are defined as an enclosing substructure and an enclosed substructure, and the vector combination step includes: S21, normalizing the coordinate origin of the skeleton key points of the glyph vector model of the enclosed substructure to obtain a skeleton key point set after the coordinate origin normalization S22, calculating the maximum inscribed rectangle that can be contained in the enclosed substructure, and calculating the scaling transformation coefficient required for the enclosed substructure to be embedded in the maximum inscribed rectangle of the enclosing substructure; S23, using the scaling transformation coefficient to perform scaling transformation on the skeleton key points, the first offset vector and the second offset vector of the enclosed substructure to obtain a skeleton key point set The first offset vector sequence Offset1 ′ 2. Second offset vector sequence Offset2 ′ 2; S24, transform and adjust the skeleton key points, the first offset vector, and the second offset vector of the enclosed substructure, so that its maximum inscribed rectangle has enough space for the enclosed substructure to be embedded, and obtain an adjusted skeleton key point set The first offset vector sequence Offset1 ′ 1. Second offset vector sequence Offset2 ′ 1; S25, the skeleton key point set for the enclosed substructure and the skeleton keypoint set of the enclosed substructure The skeleton key points in the image are transformed so that the enclosed substructure is moved to the center of the largest inscribed rectangle of the transformed enclosed substructure, and the skeleton key point set is obtained. and skeleton keypoint set S26, the skeleton key points of the two substructures are set and The first offset vector sequence Offset1 ′ 2 and Offset1 ′ 1. Second offset vector sequence Offset2 ′ 2 and Offset2 ′ 1 Merge them separately.
2. The multi-style dynamic word combination method based on generative adversarial network according to claim 1 is characterized in that: The IDC characters include IDC characters of a stacked structure, including The IDC characters include the IDC characters of the surrounding structure, including The step of constructing a glyph vector model for each substructure includes: The skeleton key point set of each substructure is represented as a two-dimensional point coordinate sequence S = ((x i ,y i )); The first offset vector of each substructure's contour node relative to the matching skeleton key point is represented as a two-dimensional vector sequence Offset1 = ((Δx i ,Δy i )); The second offset vector of the handle point relative to the associated contour node is expressed as a two-dimensional vector sequence Offset2 = ((Δx i ,Δy i )).
3. The multi-style dynamic word combination method based on generative adversarial network according to claim 1 is characterized in that: In S12, the following formula is used to calculate the glyph proportion of each substructure in the Chinese character: k : Among them, w k is the weighting coefficient, P k The total number of black pixels in the binary glyph image corresponding to the glyph vector model of the k-th substructure; According to the set lower limit of glyph proportion MinRatio(IDC), the glyph proportion Ratio of each substructure in the Chinese character is calculated. k Optimize the processing. For different IDC characters, the lower limit of the glyph ratio MinRatio(IDC) has different values. When the font size ratio k When it is less than MinRatio(IDC), the font size ratio is k Optimized to: Reason ′ k =MinRatio(IDC) When the font size ratio k When it is greater than or equal to MinRatio(IDC), the font ratio is Ratio k Optimized to: Among them, Ratio ′ k This is the optimized glyph ratio.
4. The multi-style dynamic word combination method based on generative adversarial network according to claim 1 is characterized in that: In S12, the scaling factor of each substructure is Factor k The calculation methods include: For IDC characters and The scaling transformation only exists in the x direction. First calculate the target width: width k =(L-2×pad-(n-1)×gap)×Ratio ′ k , and then calculate the scaling coefficient: For IDC characters and The scaling transformation only exists in the y direction. First calculate the target height: height k =(L-2×pad-(n-1)×gap)×Ratio ′ k , and then calculate the scaling coefficient: Among them, gap represents the gap distance between each substructure, and pad represents the blank distance between the combined glyph and the edge of the square canvas.
5. The multi-style dynamic word combination method based on generative adversarial network according to claim 1 is characterized in that: In S12, the scaling factor Factor is used k The skeleton key points of each substructure are scaled and transformed to obtain a skeleton key point set for: Using the scaling factor Factor k The first offset vector of each substructure is scaled to obtain the first offset vector sequence Offset1 ′ k for: Using the scaling factor Factor k The second offset vector of each substructure is scaled to obtain the second offset vector sequence Offset2 ′ k for: Skeleton key point set The skeleton key points in the coordinate transformation are obtained, and the skeleton key point set for:
6. The multi-style dynamic word combination method based on generative adversarial network according to claim 1 is characterized in that: In S22, the scaling transformation coefficient includes the scaling transformation coefficient Factor in the x direction. 2,x And the scaling factor in the y direction 2,y , the calculation methods include: Among them, (Recx 1,l ,Recy 1,d ) represents the coordinates of the lower left corner of the largest inscribed rectangle, (Recx 1,r ,Recy 1,u ) represents the coordinate of the upper right corner of the largest inscribed rectangle, gap is the gap distance between two substructures, (x 2,l ,y 2,d ) represents the lower left corner coordinate of the glyph bounding box of the enclosed substructure, (x 2,r ,y 2,u ) represents the coordinates of the upper right corner of the glyph bounding box of the enclosed substructure; The scaling transformation coefficient is optimized according to the set scaling factor lower limit MinFactor, including: Factor2 ′ ,x =max(Factor 2,x ,MinFactor) Factor2 ′ ,y =max(Factor 2,y ,MinFactor) Among them, Factor2 ′ ,x and Factor2 ′ ,y are the optimized scaling transformation coefficients, and max() is the maximum value function; In S23, the skeleton key point set for the enclosed substructure The skeleton key points within the scope are transformed into: For the first offset vector sequence Offset12 of the contour node of the enclosed substructure relative to the matching skeleton key point, the scaling transformation is: For the second offset vector sequence Offset22 of the handle points of the enclosed substructure relative to the associated contour nodes, the scaling transformation is:
7. The multi-style dynamic word combination method based on generative adversarial network according to claim 1 is characterized in that: In S24, the transformation method of the skeleton key points of the enclosed substructure is: Among them, f x (x i ),f y (y i ) is the skeleton key point (x i ,y i ) is as follows: The scaling transformation of the first offset vector sequence Offset11 of the contour node of the enclosed substructure relative to the matching skeleton key point is: Among them, g x (Δx i ),g y (Δy i ) is the first offset vector (Δx i ,Δy i ) is as follows: The scaling transformation of the second offset vector sequence Offset21 of the handle points of the enclosed substructure relative to the associated contour node is: Offset2 ′ 1=Offset21 The transformation function f of the above skeleton key points x (x i ),f y (y i ) and the first offset vector transformation function g x (Δx i ),g y (Δy i ), (x 1,ref ,y 1,ref ) is the coordinate of the reference point of the coordinate transformation; (x 1,l ,y 1,d ) is the lower left corner coordinate of the glyph bounding box of the enclosing substructure, (x 1,r ,y 1,u ) is the coordinate of the upper right corner of the glyph bounding box of the enclosing substructure; Factor 1,xl ,Factor 1,xr Factor is the contraction coefficient of the key points of the skeleton points on the left and right sides of the reference point in the x direction; 1,yd ,Factor 1,yu is the contraction coefficient of the skeleton key points on the lower and upper sides of the reference point in the y direction; In S25, the skeleton key point set is obtained using the following formula and skeleton keypoint set 8. The multi-style dynamic word combination method based on generative adversarial network according to claim 1 is characterized in that: When constructing a style optimization model based on a generative adversarial network, zi2zi is preferably used as the generative adversarial network, the glyph vector model of Chinese characters obtained by vector combination is used as a sample, and the original glyph of Chinese characters is used as the sample label; When the vectors are combined to obtain the glyph vector model of Chinese characters, the gap distance between each substructure is calculated by Sampling is performed to achieve data enhancement of samples, where For interval Uniform distribution on The sample labels corresponding to the data-enhanced sample set are used to perform adversarial learning on the generative adversarial network to optimize the parameters of the generative adversarial network. The generator part of the parameter-optimized optimized generative adversarial network is used as a style optimization model.
Citation Information
Patent Citations
Regular expression matching method and regular expression matching device based on template-based multidimensional finite automaton TMFA
CN106878289A
Chinese character pattern and layout design method and system for dynamically adjusting parameters
CN112232022A