Graphics generation method, device and computer readable storage medium

By using graphic inference and update of action quality value methods in graphic generation, geometric materials are automatically generated, solving the problems of low generation efficiency and high labor costs in the existing technology, and efficient and automated material generation is achieved.

CN113763503BActive Publication Date: 2025-03-18BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110128226.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-29
Publication Date
2025-03-18
Estimated Expiration
2041-01-29

AI Technical Summary

Technical Problem

The generation efficiency of existing geometric materials is low, the labor cost is high, and it is difficult to automate and efficiently generate.

Method used

During the graphic inference process, each step of action is selected according to the mass values ​​of various actions performed under various states, and the graph is generated, and the mass value of action is updated according to the similarity between the generated graph and the target graph until the preset conditions are met.

Benefits of technology

It realizes efficient generation of geometric materials, reduces labor costs and improves generation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113763503B_ABST
    Figure CN113763503B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a method, device and computer-readable storage medium for generating graphics, and relates to the field of computer technology. The method disclosed in the present disclosure includes: selecting each step of action according to the quality values ​​of performing various actions in various states during the graphics reasoning process, wherein the state is an initial state or a state after performing an action, and the action includes: for the graphics with the smallest granularity in the current state, selecting the processing method of the graphics, the number of sub-graphics of the graphics or the processing parameters of the graphics; generating graphics according to each selected step of action; updating the quality values ​​of various actions in various states according to the similarity between the generated graphics and the target graphics; repeating the above steps until the similarity between the generated graphics and the target graphics meets the preset conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a graphics generation method, device and computer-readable storage medium. Background Art

[0002] In graphic design, a large number of geometric materials are used, and these materials are obtained by combining multiple geometric shapes.

[0003] Currently, the generation of a geometric material is generally performed by manually editing a synthesis script, and a computer executes fixed generation steps according to the synthesis script to complete the generation of the material. Summary of the invention

[0004] The inventor found that the generation of existing geometric materials is realized by manually editing scripts, which is actually still manually setting rules and then executed by machines. The machine performs autonomous learning to realize the generation of materials. Therefore, the generation efficiency of materials by manually editing scripts is low and the labor cost is high.

[0005] A technical problem to be solved by the present disclosure is: how to improve the efficiency of generating geometric materials and reduce labor costs.

[0006] According to some embodiments of the present disclosure, a graphics generation method is provided, comprising: selecting each action step according to the quality values ​​of performing various actions in various states during the graphics reasoning process, wherein the state is an initial state or a state after performing an action, and the actions include: for the graph with the smallest granularity in the current state, selecting the processing method of the graph, the number of sub-graphs of the graph, or the processing parameters of the graph; generating a graph according to each selected action step; updating the quality values ​​of various actions in various states according to the similarity between the generated graph and the target graph; repeating the above steps until the similarity between the generated graph and the target graph meets the preset conditions.

[0007] In some embodiments, according to the quality values ​​of executing various actions in various states during the graphics reasoning process, selecting each step of the action includes: selecting the next action according to the current state of the graphics reasoning and the quality values ​​of executing various actions in the current state, wherein, when the previous action is to select a processing method for the graphics with the smallest granularity in the previous state, the next action is to select processing parameters for the graphics, and when the previous action is to select processing parameters for the graphics with the smallest granularity in the previous state, the next action is to select the number of sub-graphics of the graphics, and when the previous action is to select the number of sub-graphics of the graphics with the smallest granularity in the previous state, the next action is to select a processing method for each sub-graphic; executing the next action and updating the current state of the graphics reasoning; repeating the above steps until the graphics with the smallest granularity in the current state is a preset basic graphics and the processing parameters of the preset basic graphics have been selected.

[0008] In some embodiments, based on each selected step of the action, generating a graphic includes: generating graphics of different granularities in sequence according to the order of the graphic granularity from small to large; for each graphic of the same granularity, combining each sub-graphics to generate the graphic based on the sub-graphics of the graphic, the processing method of the graphic and the processing parameters of the graphic.

[0009] In some embodiments, the following method is used to determine the similarity between the generated graphic and the target graphic: the generated graphic is input into a feature extraction network to obtain features extracted by multiple convolutional layers in the feature extraction network as multiple first features; multiple first Gram matrices are determined based on the multiple first features; the target graphic is input into a feature extraction network to obtain features extracted by multiple convolutional layers in the feature extraction network as multiple second features; multiple second Gram matrices are determined based on the multiple second features; a similarity is determined for the first Gram matrix and the second Gram matrix corresponding to each convolutional layer; and the similarity between the generated graphic and the target graphic is determined based on the similarities corresponding to each convolutional layer.

[0010] In some embodiments, updating the quality values ​​of various actions in various states based on the similarity between the generated graphics and the target graphics includes: when there are multiple target graphics, selecting a preset number of target graphics in descending order of similarity with the generated graphics; determining the evaluation value of the generated graphics based on the similarity between the preset number of target graphics and the generated graphics; and using the evaluation value as a reward value to update the quality values ​​of various actions in various states.

[0011] In some embodiments, the evaluation value of the generated graphics is determined using the following formula:

[0012]

[0013] Among them, k is the preset number, 1≤i≤k, d i is the similarity between the target graph i and the generated graph, w i is the weight corresponding to the target graph i.

[0014] In some embodiments, based on the current state of graphical reasoning and the quality values ​​of various actions performed in the current state, selecting the next action includes: for each action among the various actions executable in the current state, determining the sum of the quality values ​​of selecting the action in various states as a first value; determining the sum of the quality values ​​of various actions selected for execution in the current state as a second value; determining the selection probability of the action based on the ratio of the first value to the second value; and selecting an action as the next action based on the selection probability of various actions executable in the current state.

[0015] In some embodiments, when the processing method of the graphic includes the orientation of the direction of the graphic, the direction of the graphic is determined by the following method: according to the vertical distance r from the coordinate origin to the straight line representing the direction of the graphic, the angle θ between the vertical line from the coordinate origin to the straight line representing the direction of the graphic and the coordinate x-axis, the following trigonometric function is constructed:

[0016] r=xcos(θ)+ysin(θ)

[0017] Substitute the horizontal and vertical coordinate values ​​of each pixel point in the graphic into the x and y in the trigonometric function to obtain multiple trigonometric functions; represent the curve graphs of each trigonometric function in the coordinate system divided into grids, and vote for each pixel point in the image in the grid; select the θ value corresponding to the grid with the most votes as the direction of the graphic.

[0018] In some embodiments, for each graphics of the same granularity, based on the sub-graphics of the graphic, the processing method of the graphic and the processing parameters of the graphic, each sub-graphic is combined to generate the graphic, including: when the processing method of the graphic includes arranging or superimposing in the form of a blank field, the graphic generation area is divided into a grid in a preset manner; the grids occupied by the graphic in each grid are set to 0, and the grids not occupied by the graphic are set to 1; for each grid, the Gaussian kernel function value of the grid and each grid set to 1 is calculated, and all the Gaussian kernel function values ​​corresponding to the grid are accumulated to obtain the weight corresponding to the grid; for each sub-graphic, the sub-graphic is scanned in the grid to determine the cumulative value of the weights of the grids covered by the sub-graphic at different positions; and the position with the largest cumulative value is selected as the position of the sub-graphic.

[0019] In some embodiments, for each graphic of the same granularity, based on the sub-graphics of the graphic, the processing method of the graphic and the processing parameters of the graphic, each sub-graphic is combined to generate the graphic, including: when the processing method of the graphic includes arranging or superimposing in the form of a curve blank field, the graphic generation area is divided into a grid according to a preset method; the grids occupied by the graphic in each grid are set to 0, and the grids not occupied by the graphic are set to 1; for each grid passing through the preset curve, the Gaussian kernel function value of the grid and each grid set to 1 on the preset curve is calculated, and all Gaussian kernel function values ​​corresponding to the grid are accumulated to obtain the weight corresponding to each grid passing through the preset curve; for each sub-graphic, the sub-graphic is scanned in the grid to determine the cumulative value of the weights of the grids covered by the sub-graphic at different positions, wherein the weights of the grids occupied by the graphic in each grid that does not pass through the preset curve are 0; the position with the largest cumulative value is selected as the position of the sub-graphic.

[0020] In some embodiments, when the processing method of the graphics includes arranging or superimposing in the form of a central radiation field, the field strength at any position point is determined using the following formula:

[0021]

[0022] in, is the distance from the center O of the preset field graph to the position point B, is the distance from the intersection point A to O of the line between OB and the preset field graph, q A is the field strength at point A; for each sub-graph, the position of the sub-graph is determined according to the field strength at each position point.

[0023] In some embodiments, when the processing method of the graphics includes arranging or superimposing in the form of a nine-square grid, four position points with the largest field strength are preset in the graphic generation area, wherein, when the graphic generation area is a rectangle, straight lines parallel to the width and length are drawn through the three equal division points of the length and width of the graphic generation area, and the four intersection points of the four straight lines are taken as four position points; the field strength at any position point is determined by the following formula:

[0024] q(x,y)=G(x A )+G(xx B )+G(yy A )+G(yy c )

[0025] Among them, x and y represent the horizontal and vertical coordinates of any position point, A, B, C, and D are four position points, and x A ,y A Respectively represent the horizontal and vertical coordinates of point A, x B ,yB represent the horizontal and vertical coordinates of point B, respectively, C ,y C They represent the horizontal and vertical coordinates of point C respectively, and G(·) is a Gaussian kernel function. For each sub-graph, the position of the sub-graph is determined according to the field strength at each position point.

[0026] In some embodiments, when the processing method of the graphics includes arranging or superimposing in the form of a balanced field, the graphics generation area is divided into a grid in a preset manner; the grids occupied by the graphics in each grid are set to 0, and the grids not occupied by the graphics are set to 1; the values ​​of two grids that are symmetrical with respect to a preset symmetry axis are subtracted, and if the absolute value of the difference is 1, the values ​​of the two grids are retained, and if the difference is 0, the values ​​of the two grids are set to 0; for each grid, the Gaussian kernel function value of the grid and each grid set to 1 is calculated, and all Gaussian kernel function values ​​corresponding to the grid are accumulated to obtain the weight corresponding to the grid; for each sub-graphic, the sub-graphic is scanned in the grid to determine the cumulative value of the weights of the grids covered by the sub-graphic at different positions; the position with the largest cumulative value is selected as the position of the sub-graphic.

[0027] In some embodiments, when the preset basic graphics include fractal graphics, the fractal graphics are generated using the following method: copy the preset graphics, shrink, translate, and rotate the copied graphics to combine them with the original preset graphics, wherein the parameters of each shrinkage, translation, and rotation are preset parameters; repeat the above process until the fractal graphics are generated.

[0028] In some embodiments, when the preset basic graph includes a curve, the curve is generated using the following formula:

[0029] x c (t)=r+r1cos(t)+r2cos(2t)+…+r k cos(kt)+…

[0030] y c (t)=r+r1sin(t)+r2sin(2t)+…+r k sin(kt)+…

[0031] Among them, x c (t), y c (t) is the horizontal and vertical coordinates of the point on the curve, r, r1...r k ...respectively preset the radii of multiple circles, t∈(0, 2π).

[0032] In some embodiments, selecting each action according to the quality values ​​of performing various actions under various states during the graphic reasoning process includes: selecting each action according to the quality values ​​of performing various actions under various states during the graphic reasoning process, and preset path knowledge, wherein the preset path knowledge includes: the range of actions that can be selected in the next step when the previous action is determined.

[0033] According to some other embodiments of the present disclosure, a graphics generation device is provided, including: an action selection module, used to select each step of action according to the quality values ​​of performing various actions in various states during the graphics reasoning process, wherein the state is an initial state or a state after executing an action, and the action includes: for the graphics with the smallest granularity in the current state, selecting the processing method of the graphics, the number of sub-graphics of the graphics, or the processing parameters of the graphics; a graphics generation module, used to generate graphics according to each selected step of action; an update module, used to update the quality values ​​of various actions in various states according to the similarity between the generated graphics and the target graphics; an iteration module, used to repeat the above steps until the similarity between the generated graphics and the target graphics meets the preset conditions.

[0034] According to some further embodiments of the present disclosure, a graphics generation device is provided, comprising: a processor; and a memory coupled to the processor, for storing instructions, wherein when the instructions are executed by the processor, the processor executes the graphics generation method as described in any of the aforementioned embodiments.

[0035] According to some further embodiments of the present disclosure, a non-transitory computer-readable storage medium is provided, on which a computer program is stored, wherein when the program is executed by a processor, the graphics generation method of any of the aforementioned embodiments is implemented.

[0036] The present disclosure adopts a machine learning method, and the machine automatically selects the action of each step according to the quality value of performing various actions in various states to generate a graph. Then, according to the similarity between the generated graph and the target graph, the quality value of various actions in various states is updated, and the above process is repeated until the similarity between the generated graph and the target graph meets the preset conditions. Through the above process, the machine can automatically learn and adjust to generate a graph that meets the preset conditions, without the need for manual editing of scripts, thereby improving the generation efficiency of geometric materials and reducing labor costs.

[0037] Other features and advantages of the present disclosure will become apparent from the following detailed description of exemplary embodiments of the present disclosure with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the embodiments of the present disclosure 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 disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0039] Figure 1 A schematic flowchart of a method for generating graphics according to some embodiments of the present disclosure is shown.

[0040] Figure 2A A schematic diagram showing the manner of processing graphics according to some embodiments of the present disclosure.

[0041] Figure 2B Schematic diagrams showing the processing methods of graphics according to other embodiments of the present disclosure.

[0042] Figure 2C A schematic diagram illustrating the graphical reasoning process of some embodiments of the present disclosure.

[0043] Figure 3A A schematic diagram showing the manner of determining the direction of a graphic according to some embodiments of the present disclosure.

[0044] Figure 3B A schematic diagram showing processing in a blank field format according to some embodiments of the present disclosure.

[0045] Figure 3C A schematic diagram showing some embodiments of the present disclosure being processed in a curved blank field format.

[0046] Figure 3D A schematic diagram showing processing in a central radiation field format according to some embodiments of the present disclosure.

[0047] Figure 3E A schematic diagram showing processing in a nine-square grid format in some embodiments of the present disclosure.

[0048] Figure 3F A schematic diagram illustrating processing in a balanced field format according to some embodiments of the present disclosure.

[0049] Figure 4A A schematic diagram showing a fractal graphics generation method according to some embodiments of the present disclosure.

[0050] Figure 4B Schematic diagrams showing fractal graphics generation methods according to other embodiments of the present disclosure.

[0051] Figure 4C A schematic diagram showing a fractal graphics generation method according to some further embodiments of the present disclosure.

[0052] Figure 4D A schematic diagram showing a fractal graphics generation method according to some further embodiments of the present disclosure.

[0053] Figure 5 A schematic diagram showing a curve generating method according to some embodiments of the present disclosure.

[0054] Figure 6 A schematic diagram showing the structure of a graphics generating device according to some embodiments of the present disclosure.

[0055] Figure 7 A schematic diagram showing the structure of a graphics generating device according to some other embodiments of the present disclosure.

[0056] Figure 8 A schematic diagram showing the structure of a graphics generating device according to some further embodiments of the present disclosure. DETAILED DESCRIPTION

[0057] The technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The following description of at least one exemplary embodiment is actually only illustrative and is by no means intended to limit the present disclosure and its application or use. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0058] Combine the following Figure 1 Some embodiments of the disclosed graph generation method are described.

[0059] Figure 1 Flowcharts of some embodiments of the graphic generation method disclosed herein. Figure 1 As shown, the method of this embodiment includes: steps S102 to S108.

[0060] In step S102, each action is selected according to the quality values ​​of executing various actions in various states during the graphic reasoning process.

[0061] The state includes, for example, an initial state or a state after executing each action, and the action includes: for a graphic with the smallest granularity in the current state, selecting a processing method for the graphic, the number of sub-graphics of the graphic, or a processing parameter of the graphic.

[0062] A processing method is a processing unit for graphics. A processing method can include multiple processing knowledge, and each processing knowledge can include multiple processing parameters. Processing parameters refer to the parameters that specifically implement this processing method. Processing parameters can be inherited to reduce the amount of editing. A processing method can be targeted at one or more graphics. Processing methods include, for example, arrangement, overlay, and, difference, splicing, deformation, and slicing. These types can be nested and recursive. Figure 2A As shown, one type of processing can be further divided into multiple fine-grained processing methods. Figure 2A In the design process, graphic guidance is to arrange some graphics in certain shapes (such as curves), which can make the arranged graphics more beautiful. Composition refers to arranging graphics in triangles, trapezoids, S shapes, etc. Figure 2B As shown, other processing methods may also include: superposition, splicing, deformation, fragmentation, amplification, addition, difference, special effects, etc. The specific processing methods may be set according to actual needs.

[0063] The processing parameters of the graphic include, for example, the position and size of the graphic in the graphic generation area. The size of the graphic may include the absolute size or relative size of the graphic.

[0064] The reinforcement learning method can be used to implement the graph reasoning process. Specifically, a Q-table can be used in the graph reasoning process, and the Q-table includes the quality (Quantity) value of performing various actions (Action) in various states (State), that is, the Q value.

[0065] In some embodiments, each step of the action is selected based on the quality values ​​of executing various actions under various states during the graphic reasoning process, as well as the preset path knowledge. The preset path knowledge includes, for example, the range of actions that can be selected in the next step when the previous step of the action is determined. The action can be nested in the lower layer, and the nesting process of the action is the process of selecting the path, and the path knowledge constrains the selection space range of all paths. The selection of the path (i.e., a sequence composed of various actions) first parses the path knowledge in the knowledge base, and prunes multiple path selections under the current action node based on the path knowledge. Some actions will constrain each other before and after, so a temporary variable area and a global variable area can be established to record the selection of each step of the action. In the set of optional paths or actions after path pruning, the next action is selected based on the quality values ​​of various actions.

[0066] In some embodiments, the next action is selected based on the current state of graphics reasoning and the quality values ​​of various actions performed in the current state, wherein, when the previous action is to select a processing method for the graphics with the smallest granularity in the previous state, the next action is to select processing parameters for the graphics, and when the previous action is to select processing parameters for the graphics with the smallest granularity in the previous state, the next action is to select the number of sub-graphics of the graphics, and when the previous action is to select the number of sub-graphics of the graphics with the smallest granularity in the previous state, the next action is to select a processing method for each sub-graphic; execute the next action and update the current state of graphics reasoning; repeat the above steps until the graphics with the smallest granularity in the current state is a preset basic graphics and the processing parameters of the preset basic graphics have been selected.

[0067] The processing methods, processing parameters or the number of sub-graphs of multiple sub-graphs can be equated to one action using an equator, and then the largest Q value is selected according to the Q-table and the next action is selected according to a certain probability, and finally an action sequence is determined.

[0068] Further, for each of the various actions that can be executed in the current state, determine the sum of the quality values ​​of the action selected in various states as the first value; determine the sum of the quality values ​​of the various actions that can be executed in the current state as the second value; determine the selection probability of the action according to the ratio of the first value to the second value; select an action as the next action according to the selection probability of the various actions that can be executed in the current state. For example, the current state is S1, and the actions that can be executed in S1 include A1, A2...A n , the corresponding Q values ​​are Q(S1, A1), Q(S1, A2)...Q(S1, A n ), these Q values ​​are summed to get the second value. For action A2, in many states, the next action can choose A2. For example, in state S1, the next action can choose A2. In state S3, the next action can choose A2…, the Q values ​​of choosing A2 in various states can be summed to get the first value, and the ratio of the first value to the second value is used as the selection probability of A2.

[0069] In step S104, a graph is generated according to each selected action.

[0070] In some embodiments, graphics of different granularities are generated in sequence according to the order of the granularity of the graphics from small to large; for each graphic of the same granularity, the sub-graphics are combined to generate the graphic according to the sub-graphics of the graphic, the processing method of the graphic and the processing parameters of the graphic. Figure 2C Describe some application examples.

[0071] like Figure 2C As shown, a nested action sequence is determined to realize the synthesis of graphics. The nested recursive process of the entire graphics is as follows: Figure 2C As shown, first determine an action for the entire graphic to be generated, the action is to select the processing method of the graphic as arrangement, and the next action after arrangement can be to determine the processing parameters of the graphic to be generated, for example, to determine the absolute size and absolute position of the graphic. Then the next action is to determine the number of sub-graphics of the graphic to be generated. For a graphic, the two steps of determining the processing parameters of the graphic and the number of sub-graphics can be interchanged in order. Then the next action is to determine the processing method of each sub-graphic, for example, the processing method of graphic 2 is slicing, and then the next action is to determine the processing parameters of each sub-graphic, and then the next action is to determine the number of sub-graphics corresponding to each sub-graphic, repeat the above process, and use the depth-first method to traverse downward in sequence until the graphic with the smallest granularity in the current state is the preset basic graphic. When reaching the bottom, start to determine the special effect type (processing method) and creation type for each graphic.

[0072] Then, starting from the preset basic graphics, backtracking is started from small to large graphics granularity. In the process of backtracking, the graphics are processed according to the determined actions of each step. This process includes, for example, determining the relative positions of all graphics and the sizes of the graphics. If an area limitation is encountered, the absolute size and absolute position of the graphics are determined. When the deep traversal is completed, the shapes and layout composition of all graphics in the entire image are determined.

[0073] In step S106, according to the similarity between the generated graphic and the target graphic, it is determined whether the similarity between the generated graphic and the target graphic meets a preset condition. If yes, step S108 is executed, otherwise step S110 is executed.

[0074] In some embodiments, the generated graphic is input into a feature extraction network to obtain features extracted by multiple convolutional layers in the feature extraction network as multiple first features; multiple first Gram matrices are determined based on the multiple first features; the target graphic is input into a feature extraction network to obtain features extracted by multiple convolutional layers in the feature extraction network as multiple second features; multiple second Gram matrices are determined based on the multiple second features; a similarity is determined for the first Gram matrix and the second Gram matrix corresponding to each convolutional layer; and the similarity between the generated graphic and the target graphic is determined based on the similarities corresponding to each convolutional layer.

[0075] The feature extraction network is, for example, a VGG network. The generated graphics and the target graphics are respectively input into the VGG network for feature extraction. The VGG network includes multiple convolutional layers, and each convolutional layer can perform feature extraction. The Gram feature is calculated for each convolutional layer, that is, the Gram matrix is ​​determined. The generated graphics correspond to multiple first Gram matrices, and the target graphics correspond to multiple second Gram matrices. Gram features can measure the style characteristics of the image. In order to take into account multiple feature levels, Gram features are calculated for each convolutional layer. For each convolutional layer, the corresponding first Gram matrix and the second Gram matrix are similarly normalized to obtain a similarity coefficient, that is, similarity. Then, the similarities corresponding to each convolutional layer are weighted and summed to obtain the similarity between the generated graphics and the target graphics.

[0076] In some embodiments, when there are multiple target graphics, a preset number of target graphics are selected in descending order of similarity with the generated graphics; and the evaluation value of the generated graphics is determined according to the similarity between the preset number of target graphics and the generated graphics. For example, the evaluation value of the generated graphics is determined using the following formula:

[0077]

[0078] k is the preset number, 1≤i≤k, d i is the similarity between the target graph i and the generated graph, and wi is the weight corresponding to the target graph i.

[0079] The preset condition is, for example, that the similarity between the generated graphic and a target graphic exceeds a threshold, or the evaluation value exceeds a preset evaluation value.

[0080] In step S108, each selected step is stored as a path.

[0081] The stored paths can be used to generate similar graphics later.

[0082] In step S110, the quality values ​​of various actions in various states are updated, and the process returns to step S102 and starts again.

[0083] In some embodiments, the evaluation value is used as a reward value to update the quality value of various actions in various states. The evaluation value is used as a reward value (Reword) to update each Q value in the Q-table, which can refer to the prior art. For example, according to the Bellman equation, the Q-table is updated.

[0084] In some embodiments, for the last step action of the generated graph and the state where the action is selected, the Q value corresponding to the action and state is updated to the evaluation value, and then the Q values ​​corresponding to each state and action of the generated graph are updated in sequence from back to front. For each state, the maximum value is selected from the updated Q values ​​of each action in the state, and the maximum value is multiplied by the preset ratio, and the product obtained is used as the Q value corresponding to the previous state and action of the state. For example, the initial state is S1, and states S2 and S3 can be obtained after executing actions A1 and A2 respectively. In state S2, states S4, S5 and S6 are obtained after executing actions A3, A4 and A5 respectively. Assuming that the actions executed by the generated graph are A1 and A5 respectively, the value of Q(S2, A5) is updated to the evaluation value, and then Q(S1, A1) is updated. Assuming that the value of Q(S2, A5) is the largest, the product of Q(S2, A5) and the preset ratio is used as the updated Q(S1, A1).

[0085] The method of the above embodiment proposes a complete material creation scheme. First, graphic reasoning is performed. Reinforcement learning reasoning can be performed under the established knowledge base (such as path knowledge) to generate various actions of the graphic. Then, various actions are parsed. After the action sequence is executed, the material graphic is generated. Then, the generated graphic and the excellent target graphic set are abstracted by the VGG network feature to establish a Gram matrix. The evaluation value of the generated graphic is calculated by similarity of the Gram matrix, and the evaluation value of the graphic is used as the reward value, so that the reward value is continuously fed back to update the Q-table of reinforcement learning. Finally, when the generated graphic meets the preset conditions, the created path type is added to the excellent creation path library as the final generated image result.

[0086] In the above embodiment, a machine learning method is adopted, and the machine automatically selects the action of each step according to the quality value of performing various actions in various states to generate a graph. Then, according to the similarity between the generated graph and the target graph, the quality value of various actions in various states is updated, and the above process is repeated until the similarity between the generated graph and the target graph meets the preset conditions. Through the above process, the machine can generate a graph that meets the preset conditions through automatic learning and adjustment, without the need for manual editing of scripts, thereby improving the generation efficiency of geometric materials and reducing labor costs.

[0087] There are many processing details involved in the graphics processing, and some embodiments are described below.

[0088] like Figure 3A As shown, in some embodiments, when the processing method of the graphic includes the orientation of the direction of the graphic, the direction of the graphic is determined by the following method: according to the vertical distance r from the coordinate origin to the straight line representing the direction of the graphic, the angle θ between the vertical line from the coordinate origin to the straight line representing the direction of the graphic and the coordinate x-axis, the following trigonometric function is constructed:

[0089] r=xcos(θ)+ysin(θ) (3)

[0090] Substitute the horizontal and vertical coordinate values ​​of each pixel point in the graphic into the x and y in the trigonometric function to obtain multiple trigonometric functions; represent the curve graphs of each trigonometric function in the coordinate system divided into grids, and vote for each pixel point in the image in the grid; select the θ value corresponding to the grid with the most votes as the direction of the graphic.

[0091] For example, when arranging graphics, you can require the graphics to be oriented toward a certain preset point. In this case, you need to determine the direction of the graphics. The direction of the graphics is to find the direction in which the graphics pixels are most concentrated, such as Figure 3A As shown in the left figure, assuming that the direction of the graph is a straight line in the coordinate graph, the vertical distance from the origin to the straight line is r, and the angle between r and the x-axis is θ. The equation of r and θ can be determined for any pixel point (x, y) in the graph, that is, formula (3). Figure 3A In the coordinate system of r and θ in the right figure, the trigonometric function curves of r and θ can be determined according to the (x, y) point. The right figure is gridded, and then all the pixels of the figure are voted in the grid. The θ value with the largest number of votes (such as the intersection of the three curves in the figure) is taken as the direction of the figure. The calculation of the direction of the figure is completed through offline calculation and directly referenced in the real-time combined image.

[0092] In the process of arrangement and superposition, some field models need to be established to allow the graphic scan to intelligently select a position. The following describes some implementation examples of field models, including blank field, curved field, central radiation field, nine-square grid field, balanced field and other methods to allow the graphic scan to arrange the appropriate position.

[0093] (1) Blank field

[0094] In some embodiments, when the processing method of the graphics includes arranging or superimposing in the form of a blank field, the graphics generation area is divided into a grid in a preset manner; the grids occupied by the graphics in each grid are set to 0, and the grids not occupied by the graphics are set to 1; for each grid, the Gaussian kernel function value of the grid and each grid set to 1 is calculated, and all the Gaussian kernel function values ​​corresponding to the grid are accumulated to obtain the weight corresponding to the grid; for each sub-graphic, the sub-graphic is scanned in the grid to determine the cumulative value of the weights of the grids covered by the sub-graphic at different positions; and the position with the largest cumulative value is selected as the position of the sub-graphic.

[0095] For example, in the process of arrangement, the interpolation algorithm is used to arrange the graphics so that all graphics are dispersed as much as possible in the area, such as Figure 3BIn the upper left figure, the black part is the area of ​​the graphic generation area that has been occupied by the graphic, and the blank space is the unoccupied area. The grid in the upper right figure is obtained by inverting this structure. The blank space in the grid is set to 1 and the occupied space is set to 0. Then a kernel function is established with each space as the center, and all kernel functions are accumulated to obtain a weighted grid; then the weight of each grid is obtained, which measures the density of the blank space in the graphic. The lower left figure is a graphic to be arranged. The graphic is scanned in the above grid to determine the cumulative value of the weights of the grids covered by the graphic at different positions, as shown in the lower right figure. The position corresponding to the largest cumulative value is found as the position of the graphic and occupied, and then the previous steps are repeated to scan and occupy the next graphic. The formula of the Gaussian kernel function is as follows.

[0096]

[0097] For each grid, the weight of the grid, that is, the field strength, is expressed using the following formula.

[0098]

[0099] (x, y) represents the coordinates of the grid, (x c ,y c ) is the coordinate of each space, that is, the grid that is set to 1, and m·n represents the total number of grids.

[0100] (2) Curve blank field

[0101] In some embodiments, when the processing method of the graphics includes arranging or superimposing in the form of a curve blank field, the graphics generation area is divided into a grid in a preset manner; the grids occupied by the graphics in each grid are set to 0, and the grids not occupied by the graphics are set to 1; for each grid passing through the preset curve, the Gaussian kernel function value of the grid and each grid set to 1 on the preset curve is calculated, and all Gaussian kernel function values ​​corresponding to the grid are accumulated to obtain the weight corresponding to each grid passing through the preset curve; for each sub-graphic, the sub-graphic is scanned in the grid to determine the cumulative value of the weights of the grids covered by the sub-graphic at different positions, wherein the weights of the grids occupied by the graphics in each grid that does not pass through the preset curve are 0; and the position with the largest cumulative value is selected as the position of the sub-graphic.

[0102] For example, the aforementioned blank field method is applicable to the guided arrangement method of a certain straight line or curve, except that the Gaussian kernel function only needs to be calculated for the grids passing through the preset curve, and the Gaussian kernel function does not need to be calculated for other grids. Figure 3C As shown in the left figure, a Gaussian field function is accumulated on a preset curve as the field strength. If the curve is straightened, the field strength distribution shown in the right figure can be obtained.

[0103] (3) Central radiation field

[0104] In some embodiments, when the processing method of the graphics includes arranging or superimposing in the form of a central radiation field, the field strength at any position point is determined using the following formula.

[0105]

[0106] in, is the distance from the center O of the preset field graph to the position point B, is the distance from the intersection point A to O of the line between OB and the preset field graph, q A is the field strength at point A; for each sub-graph, the position of the sub-graph is determined according to the field strength at each position point.

[0107] For example, the graphics are arranged in the form of ellipses, circles, triangles, etc. (preset field graphics). For any preset field graphics, the field strength increases from the center to the surrounding areas, such as Figure 3D As shown, curve A is a closed ellipse, and the contour lines of the field are all ellipses. The field strength at any point B can be obtained according to formula (6). The graphic generation area can be divided into a grid with reference to the blank field, and the field strength or weight of each grid can be obtained according to formula (6). For each sub-graphic, the sub-graphic is scanned in the grid to determine the cumulative value of the weights of the grids covered by the sub-graphic at different positions; the position with the largest cumulative value is selected as the position of the sub-graphic.

[0108] (4) Nine-grid field

[0109] In some embodiments, when the graphics processing method includes arranging or superimposing in the form of a nine-square grid, four position points with the largest field strength are preset in the graphics generation area. When the graphics generation area is a rectangle, straight lines parallel to the width and length are drawn through the points that divide the length and width of the graphics generation area into three equal parts, and the four intersection points of the four straight lines are used as four position points. The field strength at any position point is determined using the following formula.

[0110] q(x,y)=G(x A )+G(xx B )+G(yy A )+G(yy c ) (7)

[0111] Among them, x and y represent the horizontal and vertical coordinates of any position point, A, B, C, and D are four position points, and x A ,y A Respectively represent the horizontal and vertical coordinates of point A, x B , yB represent the horizontal and vertical coordinates of point B, x C ,y CThey represent the horizontal and vertical coordinates of point C respectively, and G(·) is a Gaussian kernel function. For each sub-graph, the position of the sub-graph is determined according to the field strength at each position point.

[0112] In many cases, the layout of graphics follows the nine-square grid method. Figure 3E As shown, the field strength in the nine-square grid field is shown in the following figure on the four straight lines. A, B, C, and D are the four positions with the largest field strength. The closer to the four straight lines and the four positions, the stronger the field strength. The blank field can be referred to, and the graphic generation area can be divided into a grid. The field strength or weight of each grid is obtained according to formula (7). For each sub-graphic, the sub-graphic is scanned in the grid to determine the cumulative value of the weights of the grids covered by the sub-graphic at different positions; the position with the largest cumulative value is selected as the position of the sub-graphic.

[0113] (5) Balance field

[0114] In some embodiments, when the processing method of the graphics includes arranging or superimposing in the form of a balanced field, the graphics generation area is divided into a grid in a preset manner; the grids occupied by the graphics in each grid are set to 0, and the grids not occupied by the graphics are set to 1; the values ​​of two grids that are symmetrical with respect to a preset symmetry axis are subtracted, and if the absolute value of the difference is 1, the values ​​of the two grids are retained, and if the difference is 0, the values ​​of the two grids are set to 0; for each grid, the Gaussian kernel function value of the grid and each grid set to 1 is calculated, and all Gaussian kernel function values ​​corresponding to the grid are accumulated to obtain the weight corresponding to the grid; for each sub-graphic, the sub-graphic is scanned in the grid to determine the cumulative value of the weights of the grids covered by the sub-graphic at different positions; the position with the largest cumulative value is selected as the position of the sub-graphic.

[0115] In order to make the arrangement of graphics have a sense of balance, a method of balancing the field can be established. Figure 3F As shown in the figure, for the left-right symmetric situation, the upper left square filled with black and the corresponding upper right square filled with diagonal lines should add the central kernel function to increase the field strength, so that the graphics are arranged in this position with a greater probability. Similarly, the lower left square filled with diagonal lines corresponds to the lower right square filled with black, and the central kernel function should be added to increase the field strength.

[0116] During the graphic synthesis process, the aforementioned field intensities can be weighted and superimposed to ensure that the image position meets various layout requirements.

[0117] The preset basic graphics may include fractal graphics. In some embodiments, the fractal graphics are generated using the following method: copy the preset graphics, shrink, translate, and rotate the copied graphics, and combine them with the original preset graphics, wherein the parameters of each shrinkage, translation, and rotation are preset parameters; repeat the above process until the fractal graphics are generated.

[0118] Some graphics have internal self-similarity, such as the creation of tree branches. The entire creation process is as follows: Figure 4A As shown in Figure 1, after multiple iterations, the tree branch shape is generated. The first sub-slice is reduced, translated, and rotated left as shown in Figure 1. Figure 4B As shown, the second sub-sheet is reduced, translated, and rotated right as shown in Figure 4C As shown, the reduction and translation operations of the third and fourth sub-sheets are as follows: Figure 4D shown.

[0119] The preset basic graph may include a curve graph. In some embodiments, the curve is generated using the following formula.

[0120] x c (t)=r+r1cos(t)+r2cos(2t)+…+r k cos(kt)+… (8)

[0121] y c (t)=r+r1sin(t)+r2sin(2t)+…+r k sin(kt)+… (9)

[0122] Among them, x c (t), y c (t) is the horizontal and vertical coordinates of the point on the curve, r, r1...r k ...respectively preset the radii of multiple circles, t∈(0, 2π).

[0123] Many graphics contain curves or surfaces, and Fourier series can be used to fit curves of arbitrary shapes, such as Figure 5 Any arbitrary curve can be represented by the superposition of the rotation trajectories of multiple circles. The series expression of an arbitrary curve is shown in formulas (8) and (9). Given any set of points on a plane, the coefficients in the following formula can be calculated by the least squares method to obtain the curve. If it is a closed curve, the range of t must be (0, 2π).

[0124] The present disclosure also provides a graphics generation device, Figure 6 Give a description.

[0125] Figure 6 FIG. 1 is a structural diagram of some embodiments of the graphic generation device disclosed in the present invention. Figure 6 As shown, the device 60 of this embodiment includes: an action selection module 610, a graphic generation module 620, an update module 630, and an iteration module 640.

[0126] The action selection module 610 is used to select each action according to the quality values ​​of executing various actions in various states during the graphic reasoning process, where the state is the initial state or the state after executing an action, and the actions include: for the graphic with the smallest granularity in the current state, selecting the processing method of the graphic, the number of sub-graphics of the graphic, or the processing parameters of the graphic.

[0127] In some embodiments, the action selection module 610 is used to select the next action based on the current state of graphics reasoning and the quality values ​​of performing various actions in the current state, wherein, when the previous action is to select a processing method for the graphics with the smallest granularity in the previous state, the next action is to select the processing parameters of the graphics, and when the previous action is to select the processing parameters of the graphics with the smallest granularity in the previous state, the next action is to select the number of sub-graphics of the graphics, and when the previous action is to select the number of sub-graphics of the graphics with the smallest granularity in the previous state, the next action is to select the processing method for each sub-graphic; execute the next action and update the current state of graphics reasoning; repeat the above steps until the graphics with the smallest granularity in the current state is a preset basic graphics and the processing parameters of the preset basic graphics have been selected.

[0128] In some embodiments, the action selection module 610 is used to determine, for each action among the various actions that can be executed in the current state, the sum of the quality values ​​of the action selected in various states as the first value; determine the sum of the quality values ​​of the various actions that can be executed in the current state as the second value; determine the selection probability of the action based on the ratio of the first value to the second value; and select an action as the next action based on the selection probability of the various actions that can be executed in the current state.

[0129] In some embodiments, the action selection module 610 is used to select each action step based on the quality values ​​of performing various actions in various states during the graphic reasoning process, and preset path knowledge, wherein the preset path knowledge includes: when the previous action step is determined, the range of actions that can be selected in the next step.

[0130] The graphic generation module 620 is used to generate a graphic according to each selected action.

[0131] In some embodiments, the graphics generation module 620 is used to generate graphics of various granularities in sequence in order of graphics granularity from small to large; for each graphics of the same granularity, the sub-graphics are combined to generate the graphic according to the sub-graphics of the graphic, the processing method of the graphic and the processing parameters of the graphic.

[0132] The updating module 630 is used to update the quality values ​​of various actions in various states according to the similarity between the generated graph and the target graph.

[0133] In some embodiments, the update module 630 is used to input the generated graphics into a feature extraction network, obtain features extracted by multiple convolutional layers in the feature extraction network as multiple first features; determine multiple first Gram matrices based on the multiple first features; input the target graphics into the feature extraction network, obtain features extracted by multiple convolutional layers in the feature extraction network as multiple second features; determine multiple second Gram matrices based on the multiple second features; determine a similarity for the first Gram matrix and the second Gram matrix corresponding to each convolutional layer; and determine the similarity between the generated graphics and the target graphics based on the similarities corresponding to each convolutional layer.

[0134] In some embodiments, the update module 630 is used to select a preset number of target graphics in descending order of similarity with the generated graphics when there are multiple target graphics; determine the evaluation value of the generated graphics based on the similarity between the preset number of target graphics and the generated graphics; and use the evaluation value as a reward value to update the quality value of various actions in various states.

[0135] The iteration module 640 is used to repeat the above steps until the similarity between the generated graph and the target graph meets a preset condition.

[0136] In some embodiments, when the processing method of the graphic includes the orientation of the direction of the graphic, the direction of the graphic is determined by the following method: according to the vertical distance r from the coordinate origin to the straight line representing the direction of the graphic, the angle θ between the vertical line from the coordinate origin to the straight line representing the direction of the graphic and the coordinate x-axis, the following trigonometric function is constructed:

[0137] r=xcos(θ)+ysin(θ)

[0138] Substitute the horizontal and vertical coordinate values ​​of each pixel point in the graphic into the x and y in the trigonometric function to obtain multiple trigonometric functions; represent the curve graphs of each trigonometric function in the coordinate system divided into grids, and vote for each pixel point in the image in the grid; select the θ value corresponding to the grid with the most votes as the direction of the graphic.

[0139] In some embodiments, when the processing method of the graphics includes arranging or superimposing in the form of a blank field, the graphics generation area is divided into a grid in a preset manner; the grids occupied by the graphics in each grid are set to 0, and the grids not occupied by the graphics are set to 1; for each grid, the Gaussian kernel function value of the grid and each grid set to 1 is calculated, and all the Gaussian kernel function values ​​corresponding to the grid are accumulated to obtain the weight corresponding to the grid; for each sub-graphic, the sub-graphic is scanned in the grid to determine the cumulative value of the weights of the grids covered by the sub-graphic at different positions; and the position with the largest cumulative value is selected as the position of the sub-graphic.

[0140] In some embodiments, when the processing method of the graphics includes arranging or superimposing in the form of a curve blank field, the graphics generation area is divided into a grid in a preset manner; the grids occupied by the graphics in each grid are set to 0, and the grids not occupied by the graphics are set to 1; for each grid passing through the preset curve, the Gaussian kernel function value of the grid and each grid set to 1 on the preset curve is calculated, and all Gaussian kernel function values ​​corresponding to the grid are accumulated to obtain the weight corresponding to each grid passing through the preset curve; for each sub-graphic, the sub-graphic is scanned in the grid to determine the cumulative value of the weights of the grids covered by the sub-graphic at different positions, wherein the weights of the grids occupied by the graphics in each grid that does not pass through the preset curve are 0; and the position with the largest cumulative value is selected as the position of the sub-graphic.

[0141] In some embodiments, when the processing method of the graphics includes arranging or superimposing in the form of a central radiation field, the field strength at any position point is determined using the following formula:

[0142]

[0143] in, is the distance from the center O of the preset field graph to the position point B, is the distance from the intersection point A to O of the line between OB and the preset field graph, q A is the field strength at point A; for each sub-graph, the position of the sub-graph is determined according to the field strength at each position point.

[0144] In some embodiments, when the processing method of the graphics includes arranging or superimposing in the form of a nine-square grid, four position points with the largest field strength are preset in the graphic generation area, wherein, when the graphic generation area is a rectangle, straight lines parallel to the width and length are drawn through the three equal division points of the length and width of the graphic generation area, and the four intersection points of the four straight lines are taken as four position points; the field strength at any position point is determined by the following formula:

[0145] q(x,y)=G(x A )+G(xx B )+G(yy A )+G(yy c )

[0146] Among them, x and y represent the horizontal and vertical coordinates of any position point, A, B, C, and D are four position points, and x A ,y A Respectively represent the horizontal and vertical coordinates of point A, x B ,y B represent the horizontal and vertical coordinates of point B, respectively,C ,y C They represent the horizontal and vertical coordinates of point C respectively, and G(·) is a Gaussian kernel function. For each sub-graph, the position of the sub-graph is determined according to the field strength at each position point.

[0147] In some embodiments, when the processing method of the graphics includes arranging or superimposing in the form of a balanced field, the graphics generation area is divided into a grid in a preset manner; the grids occupied by the graphics in each grid are set to 0, and the grids not occupied by the graphics are set to 1; the values ​​of two grids that are symmetrical with respect to a preset symmetry axis are subtracted, and if the absolute value of the difference is 1, the values ​​of the two grids are retained, and if the difference is 0, the values ​​of the two grids are set to 0; for each grid, the Gaussian kernel function value of the grid and each grid set to 1 is calculated, and all Gaussian kernel function values ​​corresponding to the grid are accumulated to obtain the weight corresponding to the grid; for each sub-graphic, the sub-graphic is scanned in the grid to determine the cumulative value of the weights of the grids covered by the sub-graphic at different positions; the position with the largest cumulative value is selected as the position of the sub-graphic.

[0148] In some embodiments, when the preset basic graphics include fractal graphics, the fractal graphics are generated using the following method: copy the preset graphics, shrink, translate, and rotate the copied graphics to combine them with the original preset graphics, wherein the parameters of each shrinkage, translation, and rotation are preset parameters; repeat the above process until the fractal graphics are generated.

[0149] In some embodiments, when the preset basic graph includes a curve, the curve is generated using the following formula:

[0150] x c (t)=r+r1cos(t)+r2cos(2t)+…+r k cos(kt)+…

[0151] y c (t)=r+r1sin(t)+r2sin(2t)+…+r k sin(kt)+…

[0152] Among them, x c (t), y c (t) is the horizontal and vertical coordinates of the point on the curve, r, r1...r k ...respectively preset the radii of multiple circles, t∈(0, 2π).

[0153] The graphics generating device in the embodiments of the present disclosure can be implemented by various computing devices or computer systems. Figure 7 as well as Figure 8 Give a description.

[0154] Figure 7 FIG. 1 is a structural diagram of some embodiments of the graphic generation device disclosed in the present invention. Figure 7 As shown, the device 70 of this embodiment includes: a memory 710 and a processor 720 coupled to the memory 710 , and the processor 720 is configured to execute the graphics generation method in any of some embodiments of the present disclosure based on instructions stored in the memory 710 .

[0155] The memory 710 may include, for example, a system memory, a fixed non-volatile storage medium, etc. The system memory may store, for example, an operating system, an application program, a boot loader, a database, and other programs.

[0156] Figure 8 FIG. 1 is a structural diagram of some other embodiments of the graphic generation device disclosed in the present invention. Figure 8 As shown, the device 80 of this embodiment includes: a memory 810 and a processor 820, which are similar to the memory 710 and the processor 720 respectively. It can also include an input and output interface 830, a network interface 840, a storage interface 850, etc. These interfaces 830, 840, 850 and the memory 810 and the processor 820 can be connected, for example, through a bus 860. Among them, the input and output interface 830 provides a connection interface for input and output devices such as a display, a mouse, a keyboard, and a touch screen. The network interface 840 provides a connection interface for various networked devices, for example, it can be connected to a database server or a cloud storage server. The storage interface 850 provides a connection interface for external storage devices such as SD cards and USB flash drives.

[0157] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable non-transient storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0158] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0159] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0160] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0161] The above are only preferred embodiments of the present disclosure and are not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure should be included in the protection scope of the present disclosure.

Claims

1. A graph generation method, comprising: According to the quality values ​​of executing various actions in various states during the graphic reasoning process, each step of the action is selected, including: according to the current state of the graphic reasoning and the quality values ​​of executing various actions in the current state, the next action is selected, wherein, when the previous action is to select the processing method of the graphic with the smallest granularity in the previous state, the next action is to select the processing parameters of the graphic, and when the previous action is to select the processing parameters of the graphic with the smallest granularity in the previous state, the next action is to select the number of sub-graphics of the graphic, and when the previous action is to select the number of sub-graphics of the graphic with the smallest granularity in the previous state, the next action is to select the processing method of each sub-graphic, execute the next action, and update the current state of the graphic reasoning, repeat the above steps until the graphic with the smallest granularity in the current state is a preset basic graphic and the processing parameters of the preset basic graphic have been selected, wherein the state is an initial state or a state after executing an action, and the action includes: for the graphic with the smallest granularity in the current state, select the processing method of the graphic, the number of sub-graphics of the graphic, or the processing parameters of the graphic; Generate graphics based on each selected action; According to the similarity between the generated graph and the target graph, the quality values ​​of various actions in various states are updated; Repeat the above steps until the similarity between the generated graph and the target graph meets the preset conditions.

2. The graphics generation method according to claim 1, wherein: The generating of the graph according to each selected step of the action includes: Generate graphics of different granularities in order from small to large granularity; For each graph of the same granularity, the sub-graphs are combined to generate the graph according to the sub-graphs of the graph, the processing method of the graph and the processing parameters of the graph.

3. The graphics generation method according to claim 1, wherein: The similarity between the generated graph and the target graph is determined by the following method: Inputting the generated graph into a feature extraction network to obtain features respectively extracted by a plurality of convolutional layers in the feature extraction network as a plurality of first features; Determine a plurality of first Gram matrices respectively according to the plurality of first features; Inputting the target graph into a feature extraction network, obtaining features respectively extracted by a plurality of convolutional layers in the feature extraction network as a plurality of second features; Determine a plurality of second Gram matrices respectively according to the plurality of second features; Determine a similarity for the first Gram matrix and the second Gram matrix corresponding to each convolutional layer; According to the similarity corresponding to each convolutional layer, the similarity between the generated graph and the target graph is determined.

4. The graphics generation method according to claim 1, wherein: The updating of the quality values ​​of various actions in various states according to the similarity between the generated graph and the target graph includes: When there are multiple target graphics, a preset number of target graphics are selected in descending order of similarity with the generated graphics; Determining the evaluation value of the generated graphic according to the similarity between a preset number of target graphics and the generated graphic; The evaluation value is used as a reward value to update the quality value of various actions in various states.

5. The graphics generation method according to claim 4, wherein: The evaluation value of the generated graph is determined using the following formula: Wherein, k is the preset number, , is the similarity between the target graph i and the generated graph, is the weight corresponding to the target graph i.

6. The method for generating a graph according to claim 1, wherein: According to the current state of the graphical reasoning and the quality values ​​of performing various actions under the current state, the next action is selected including: For each of various actions that can be executed in the current state, determine the sum of the quality values ​​of selecting the action in various states as the first value; determine the sum of the quality values ​​of various actions that can be executed in the current state as the second value; determine the selection probability of the action according to the ratio of the first value to the second value; According to the selection probability of various actions that can be executed in the current state, an action is selected as the next action.

7. The graphics generation method according to claim 1, wherein: When the processing method of the graphic includes the orientation of the graphic, the orientation of the graphic is determined by the following method: According to the perpendicular distance r from the origin of the coordinate system to the straight line representing the direction of the figure, the angle between the perpendicular line from the origin of the coordinate system to the straight line representing the direction of the figure and the coordinate x-axis , construct the following trigonometric functions: Substituting the horizontal coordinate value and the vertical coordinate value of each pixel point in the graphic into the x and y in the trigonometric function to obtain multiple trigonometric functions; The curve graphs of each trigonometric function are represented in a gridded coordinate system, and voting is performed on each pixel of the image in the grid; Select the grid with the most votes. The value serves as the direction of the graph.

8. The graphics generation method according to claim 2, wherein: The step of combining the sub-graphs to generate the graph comprises: In the case where the processing method of the graphics includes arranging or superimposing in the form of blank fields, dividing the graphics generation area into a grid in a preset manner; Set the grids occupied by graphics to 0, and the grids not occupied by graphics to 1; For each grid, calculate the Gaussian kernel function value of the grid and each grid set to 1, and accumulate all the Gaussian kernel function values ​​corresponding to the grid to obtain the weight corresponding to the grid; For each sub-graph, the sub-graph is scanned in the grid to determine the accumulated value of the weights of the grids covered by the sub-graph at different positions; Select the position with the largest accumulated value as the position of the sub-graph.

9. The graphics generation method according to claim 2, wherein: The step of combining the sub-graphs to generate the graph comprises: In the case where the processing method of the graphics includes arranging or superimposing in the form of a curve blank field, dividing the graphics generation area into a grid in a preset manner; Set the grids occupied by graphics to 0, and the grids not occupied by graphics to 1; For each grid passing through the preset curve, the Gaussian kernel function value of the grid and each grid set to 1 on the preset curve is calculated, and all Gaussian kernel function values ​​corresponding to the grid are accumulated to obtain the weight corresponding to each grid passing through the preset curve; For each sub-graph, the sub-graph is scanned in the grid to determine the accumulated value of the weights of the grids covered by the sub-graph at different positions, wherein the weight of the grids occupied by the graph in the grids that do not pass through the preset curve is 0; Select the position with the largest accumulated value as the position of the sub-graph.

10. The graphics generation method according to claim 2, wherein: The step of combining the sub-graphs to generate the graph comprises: When the graphics are processed in the form of arrangement or superposition in the form of central radiation field, the field strength at any position is determined by the following formula: in, is the distance from the center O of the preset field graph to the position point B, is the distance from the intersection point A to O of the line between OB and the preset field graph, is the field strength at point A; For each sub-graph, the position of the sub-graph is determined according to the field strength at each position point.

11. The graphics generation method according to claim 2, wherein: Combining the sub-graphs to generate the graph includes: When the processing method of the graphics includes arranging or superimposing in the form of a nine-square grid, four position points with the largest field strength are preset in the graphic generation area, wherein, when the graphic generation area is a rectangle, straight lines parallel to the width and length are drawn through the points dividing the length and width of the graphic generation area into three equal parts, and the four intersection points of the four straight lines are used as the four position points; The field strength at any point is determined using the following formula: Among them, x and y represent the horizontal and vertical coordinates of any position point respectively, and A, B, C, and D are four position points respectively. , They represent the horizontal and vertical coordinates of point A respectively. , represent the horizontal and vertical coordinates of point B respectively, , They represent the horizontal and vertical coordinates of point C respectively. is the Gaussian kernel function; For each sub-graph, the position of the sub-graph is determined according to the field strength at each position point.

12. The graphics generation method according to claim 2, wherein: Combining the sub-graphs to generate the graph includes: In the case where the processing method of the graphics includes arranging or superimposing in a balanced field form, dividing the graphics generation area into a grid in a preset manner; Set the grids occupied by graphics to 0, and the grids not occupied by graphics to 1; Subtract the values ​​of two grids that are symmetrical with respect to a preset symmetry axis. If the absolute value of the difference is 1, the values ​​of the two grids are retained; if the difference is 0, the values ​​of the two grids are set to 0; For each grid, calculate the Gaussian kernel function value of the grid and each grid set to 1, and accumulate all the Gaussian kernel function values ​​corresponding to the grid to obtain the weight corresponding to the grid; For each sub-graph, the sub-graph is scanned in the grid to determine the accumulated value of the weights of the grids covered by the sub-graph at different positions; Select the position with the largest accumulated value as the position of the sub-graph.

13. The graphics generation method according to claim 1, wherein: In the case where the preset basic graphics include fractal graphics, the fractal graphics are generated by the following method: Copy the preset graphic, reduce, translate, rotate the copied graphic and combine it with the original preset graphic, wherein the parameters of each reduction, translation, and rotation are preset parameters; The above process is repeated until the fractal graph is generated.

14. The graphics generation method according to claim 1, wherein: When the preset basic graph includes a curve, the curve is generated using the following formula: in, , are the horizontal and vertical coordinates of the points on the curve, , … ...to preset the radii of multiple circles, .

15. The graphics generation method according to claim 1, wherein: According to the quality values ​​of executing various actions in various states during the graphic reasoning process, selecting each action step includes: Each action is selected according to the quality values ​​of executing various actions under various states in the graphic reasoning process, and the preset path knowledge, wherein the preset path knowledge includes: the range of actions that can be selected in the next step when the previous action is determined.

16. A graphics generating device, comprising: An action selection module is used to select each step of action according to the quality values ​​of executing various actions in various states during the graphic reasoning process, including: selecting the next action according to the current state of the graphic reasoning and the quality values ​​of executing various actions in the current state, wherein, when the previous action is to select the processing method of the graphic with the smallest granularity in the previous state, the next action is to select the processing parameters of the graphic, and when the previous action is to select the processing parameters of the graphic with the smallest granularity in the previous state, the next action is to select the number of sub-graphics of the graphic, and when the previous action is to select the number of sub-graphics of the graphic with the smallest granularity in the previous state, the next action is to select the processing method of each sub-graphic, execute the next action, and update the current state of the graphic reasoning, repeat the above steps until the graphic with the smallest granularity in the current state is a preset basic graphic and the processing parameters of the preset basic graphic have been selected, wherein the state is an initial state or a state after executing an action, and the action includes: for the graphic with the smallest granularity in the current state, selecting the processing method of the graphic, the number of sub-graphics of the graphic, or the processing parameters of the graphic; A graphics generation module is used to generate graphics according to each selected action; An updating module, used to update the quality values ​​of various actions in various states according to the similarity between the generated graph and the target graph; The iteration module is used to repeat the above steps until the similarity between the generated graph and the target graph meets the preset conditions.

17. A graphics generating device, comprising: processor; as well as A memory coupled to the processor, for storing instructions, wherein when the instructions are executed by the processor, the processor executes the graphics generation method according to any one of claims 1 to 15.

18. A non-transitory computer-readable storage medium having a computer program stored thereon, wherein: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 15 are implemented.

Citation Information

Patent Citations

  • Movement route recommendation method and device and storage medium

    CN107729367A

  • Text detection model training method and apparatus, text region determination method and apparatus, and text content determination method and apparatus

    WO2020221298A1