CN117935291B - Training method, sketch generation method, terminal and medium for sketch generation model - Google Patents
Training method, sketch generation method, terminal and medium for sketch generation model Download PDFInfo
- Publication number
- CN117935291B CN117935291B CN202410331956.3A CN202410331956A CN117935291B CN 117935291 B CN117935291 B CN 117935291B CN 202410331956 A CN202410331956 A CN 202410331956A CN 117935291 B CN117935291 B CN 117935291B
- Authority
- CN
- China
- Prior art keywords
- sketch
- data
- training
- data set
- geometric
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000012549 training Methods 0.000 title claims abstract description 222
- 238000000034 method Methods 0.000 title claims abstract description 58
- 238000000547 structure data Methods 0.000 claims abstract description 169
- 238000003062 neural network model Methods 0.000 claims abstract description 48
- 238000012545 processing Methods 0.000 claims description 56
- 230000006870 function Effects 0.000 claims description 45
- 238000005070 sampling Methods 0.000 claims description 44
- 238000012216 screening Methods 0.000 claims description 43
- 238000010606 normalization Methods 0.000 claims description 13
- 238000009826 distribution Methods 0.000 claims description 10
- 238000003860 storage Methods 0.000 claims description 10
- 239000011159 matrix material Substances 0.000 claims description 8
- 230000007704 transition Effects 0.000 claims description 8
- 230000008569 process Effects 0.000 description 13
- 238000010586 diagram Methods 0.000 description 12
- 238000013461 design Methods 0.000 description 8
- 238000009792 diffusion process Methods 0.000 description 6
- 238000004590 computer program Methods 0.000 description 5
- 230000006872 improvement Effects 0.000 description 4
- 238000013473 artificial intelligence Methods 0.000 description 3
- 238000011960 computer-aided design Methods 0.000 description 2
- 238000013136 deep learning model Methods 0.000 description 2
- 230000007547 defect Effects 0.000 description 2
- 238000012938 design process Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 238000012360 testing method Methods 0.000 description 2
- 206010063385 Intellectualisation Diseases 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000012942 design verification Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 235000019800 disodium phosphate Nutrition 0.000 description 1
- 230000009977 dual effect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/10—Character recognition
- G06V30/19—Recognition using electronic means
- G06V30/191—Design or setup of recognition systems or techniques; Extraction of features in feature space; Clustering techniques; Blind source separation
- G06V30/19147—Obtaining sets of training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0464—Convolutional networks [CNN, ConvNet]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/82—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/40—Document-oriented image-based pattern recognition
- G06V30/42—Document-oriented image-based pattern recognition based on the type of document
- G06V30/422—Technical drawings; Geographical maps
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02E—REDUCTION OF GREENHOUSE GAS [GHG] EMISSIONS, RELATED TO ENERGY GENERATION, TRANSMISSION OR DISTRIBUTION
- Y02E60/00—Enabling technologies; Technologies with a potential or indirect contribution to GHG emissions mitigation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Evolutionary Computation (AREA)
- Computing Systems (AREA)
- Health & Medical Sciences (AREA)
- Multimedia (AREA)
- Software Systems (AREA)
- General Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- General Engineering & Computer Science (AREA)
- Molecular Biology (AREA)
- Mathematical Physics (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- Biophysics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Databases & Information Systems (AREA)
- Medical Informatics (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention discloses a training method of a sketch generation model, a sketch generation method, a terminal and a medium, wherein the method comprises the following steps: constructing a training data set, adding noise in the training data set to obtain a noisy training data set, wherein the training data set comprises discretized graph structure data or SDF data; inputting the noisy training data set into a deep neural network model to obtain predicted sketch structure data, wherein the deep neural network model is a network model taking a transducer architecture as a core or a network model taking a Unet architecture as a core; and determining a loss function based on the training data set and the predicted sketch structure data, and performing iterative training on the deep neural network model based on the loss function to obtain a sketch generation model. The invention plays the characteristic of the data structure, and the sketch generation model obtained by training can effectively solve the problem that the characteristic of the data structure is difficult to capture, thereby improving the rationality of the generated sketch structure data.
Description
Technical Field
The invention relates to the technical field of drawing design, in particular to a training method, a sketch generation method, a terminal and a medium of a sketch generation model.
Background
Computer aided design system (Computer-AIDED DESIGN, CAD) is a widely used Computer technology for aided design, drawing and modeling. CAD systems find wide application in engineering, construction, manufacturing, art, and other fields. And CAD sketches are a key ring therein. CAD sketch is the initial stage of design and drawing, and CAD sketch provides basis for subsequent CAD modeling and refinement. They can be used as references to build 3D models, helping designers to create models more accurately in a digital environment. They are an important component of the design process, helping to transform the design from a concept into an actual digital or physical model. Conventional CAD sketch generation typically requires a designer to manually draw the sketch, which can be a time-consuming process.
With the development of Artificial Intelligence (AI) technology, the improvement of learning, identifying, predicting and reasoning capabilities of the intelligent electronic device greatly improves the level of intellectualization of various industries. Traditional CAD sketch generation typically requires a designer to manually draw the sketch, requires the designer to have a certain drawing skill, is time-consuming and labor-consuming, and has a high threshold. The AI can automatically generate sketches, so that the generation speed is greatly improved, a designer can more quickly try different design schemes, the technical threshold is reduced, and more people can participate in the design process. The AI-generated CAD sketch can be immediately used for rapid prototyping, accelerating the design verification and prototype iteration process. AI systems can provide intelligent advice and design improvements that help designers better optimize their sketches and designs. Therefore, the AI-aided CAD sketch generation introduces automation, intelligence and innovation into the traditional CAD sketch generation, and brings significant improvement to the efficiency and quality in the design and engineering fields.
However, it is difficult to fully develop the data structure characteristics in the current CAD sketch generation process, so that it is difficult to generate more reasonable sketch structure data.
Accordingly, there is a need for improvement and advancement in the art.
Disclosure of Invention
The invention aims to solve the technical problems that the training method, the sketch generating method, the terminal and the medium of the sketch generating model are provided for overcoming the defects in the prior art, and the problems that the data structure characteristics are difficult to fully develop in the current CAD sketch generating process, so that more reasonable sketch structure data are difficult to generate are solved.
In order to solve the technical problems, the technical scheme adopted by the invention is as follows:
in a first aspect, the present invention provides a training method for a sketch generating model, where the method includes:
Constructing a training data set, adding noise in the training data set to obtain a noisy training data set, wherein the training data set comprises discretized graph structure data or SDF data;
Inputting the noisy training data set into a preset deep neural network model to obtain predicted sketch structure data, wherein the deep neural network model is a network model taking a transducer architecture as a core or a network model taking Unet architecture as a core;
and determining a loss function based on the training data set and the predicted sketch structure data, and performing iterative training on the deep neural network model based on the loss function to obtain the sketch generation model.
In one implementation, when the training data set is discretized graph structure data, the constructing the training data set includes:
Acquiring a CAD sketch data set, and carrying out statistics and screening on the CAD sketch data set based on a geometric type, a constraint type and a geometric parameter to obtain preliminary screening sketch data, wherein the geometric type is used for reflecting the basic type of a primitive, the constraint type is used for reflecting the constraint relation between the geometries, and the geometric parameter is used for reflecting the size parameter and the coordinate parameter of the primitive;
Normalizing the graph structure data corresponding to the geometric parameters in the preliminary screening sketch data to obtain graph structure data corresponding to the geometric parameters after normalization;
discretizing the graph structure data corresponding to the geometric parameters after normalization processing to obtain graph structure data corresponding to the geometric parameters after discretization processing;
And carrying out one-hot coding on the map structure data corresponding to the discretized geometric parameters, the map structure data corresponding to the geometric types in the primary screening sketch data and the map structure data corresponding to the constraint types in the primary screening sketch data to obtain the training data set. In one implementation manner, the adding noise in the training data set to obtain a noisy training data set includes:
And multiplying the graph structure data corresponding to the geometric type, the constraint type and the geometric parameter in the training data set by a preset state transition matrix respectively in a state transition mode, and iterating according to a plurality of preset time steps to obtain a noisy training data set of each time step.
In one implementation manner, the inputting the noisy training data set into a preset deep neural network model to obtain predicted sketch structure data includes:
Inputting the noisy training data set into a network model taking a transducer architecture as a core;
and decoding the noisy training data set based on a network model taking the transducer architecture as a core to obtain graph structure data corresponding to the predicted geometric type, constraint type and geometric parameter, and taking the graph structure data corresponding to the predicted geometric type, constraint type and geometric parameter as the predicted sketch structure data.
In one implementation, the determining a loss function based on the training data set and the predicted sketch structure data, and performing iterative training on the deep neural network model based on the loss function, to obtain the sketch generating model includes:
Determining cross entropy loss corresponding to the geometric type, cross entropy loss corresponding to the constraint type and cross entropy loss corresponding to the geometric parameter based on the graph structure data corresponding to the geometric type, constraint type and geometric parameter in the training dataset and the graph structure data corresponding to the geometric type, constraint type and geometric parameter in the prediction sketch structure data;
Weighting the cross entropy loss corresponding to the geometric type, the cross entropy loss corresponding to the constraint type and the cross entropy loss corresponding to the geometric parameter to obtain total loss, and constructing the loss function based on the total loss;
And carrying out iterative training on the deep neural network model by taking the minimized loss function as a training target to obtain the sketch generation model.
In one implementation, when the training data set is SDF data, the constructing the training data set includes:
Acquiring a CAD sketch data set, and carrying out statistics and screening on the CAD sketch data set based on a geometric type, a constraint type and a geometric parameter to obtain preliminary screening sketch data, wherein the geometric type is used for reflecting the basic type of a primitive, the constraint type is used for reflecting the constraint relation between the geometries, and the geometric parameter is used for reflecting the size parameter and the coordinate parameter of the primitive;
acquiring a plurality of line segment structures in the primary screening sketch data, and discretizing each line segment structure into pixels or grid cells;
Determining SDF data corresponding to each line segment structure according to the distance between the center point of each pixel or the center point of each grid unit and the corresponding line segment structure;
and storing all the SDF data into a data structure to obtain the training data set, wherein the SDF data stores primitive information in a matrix form, one row represents one primitive information, and each primitive information comprises a geometric type, a constraint type and a geometric parameter.
In one implementation manner, the adding noise in the training data set to obtain a noisy training data set includes:
Acquiring Gaussian noise of random sampling;
And adding the Gaussian noise to all SDF data in the training data set, and iterating according to a plurality of preset time steps to obtain a noisy training data set of each time step.
In one implementation manner, the inputting the noisy training data set into a preset deep neural network model to obtain predicted sketch structure data includes:
Sampling from the Gaussian noise in advance, and learning a conditional probability distribution of model prediction real noise;
Inputting the noisy training data set into a network model taking Unet architecture as a core, and predicting the noise at the time t by the network model taking Unet architecture as the core based on the conditional probability distribution to obtain prediction noise, wherein the prediction noise reflects recovered SDF data;
and obtaining the predicted sketch structure data based on the predicted noise.
In one implementation, the determining a loss function based on the training data set and the predicted sketch structure data, and performing iterative training on the deep neural network model based on the loss function, to obtain the sketch generating model includes:
calculating a mean square error based on Gaussian noise corresponding to the training data set and prediction noise at a corresponding moment in the prediction sketch structure data, and constructing the loss function based on the mean square error;
And carrying out iterative training on the deep neural network model by taking the minimized loss function as a training target to obtain the sketch generation model.
In a second aspect, an embodiment of the present invention further provides a sketch generating method based on a sketch generating model, where the method is characterized in that the method includes:
Acquiring sampling data, and inputting the sampling data into the sketch generation model, wherein the sampling data comprises discretized graph structure data or SDF data;
and carrying out iterative processing on the sampling data based on the sketch generation model to obtain a sketch sample.
In one implementation, when the sampling data includes discretized graph structure data, the performing iterative processing on the sampling data based on the sketch generating model to obtain a sketch sample includes:
The sketch generation model outputs predicted sketch structure data at the current time step according to the geometrical type, constraint type and geometrical parameter of the sampling data;
Multiplying the predicted sketch structure data of the current time step by the posterior probability of the current time step to obtain the predicted sketch structure data of the next time step, and inputting the predicted sketch structure data of the next time step into the sketch generation model;
And carrying out iterative processing until the sketch generating model outputs predicted sketch structure data of the last time step, and obtaining the sketch sample based on the predicted sketch structure data of all the time steps.
In one implementation, when the sampling data includes SDF data, the performing iterative processing on the sampling data based on the sketch generating model to obtain a sketch sample includes:
the sketch generation model outputs prediction noise according to Gaussian noise corresponding to the sampling data, wherein the prediction noise reflects SDF data recovered by the current time step;
subtracting the prediction noise from the sampling data of the current time step to obtain SDF data recovered by the next time step, and inputting the SDF data recovered by the next time step into the sketch generation model;
and performing iterative processing until the sketch generating model outputs SDF data recovered in the last time step, and obtaining the sketch sample based on the recovered SDF data in all the time steps.
In a third aspect, an embodiment of the present invention further provides a training device for a sketch generating model, where the training device includes:
The data processing module is used for constructing a training data set, adding noise into the training data set to obtain a noisy training data set, wherein the training data set comprises discretized graph structure data or SDF data;
The data prediction module is used for inputting the noisy training data set into a preset deep neural network model to obtain predicted sketch structure data, wherein the deep neural network model is a network model taking a transform architecture as a core or a network model taking a Unet architecture as a core;
and the model training module is used for determining a loss function based on the training data set and the predicted sketch structure data, and carrying out iterative training on the deep neural network model based on the loss function to obtain the sketch generation model.
In a fourth aspect, an embodiment of the present invention further provides a terminal, where the terminal includes a memory, a processor, and a training program of a sketch generation model stored in the memory and capable of running on the processor, and when the processor executes the training program of the sketch generation model, the processor implements the steps of the training method of the sketch generation model in any one of the above schemes.
In a fifth aspect, an embodiment of the present invention further provides a computer readable storage medium, where the computer readable storage medium stores a training program of a sketch generating model, where the training program of the sketch generating model, when executed by a processor, implements the steps of the training method of the sketch generating model according to any one of the above schemes.
The beneficial effects are that: compared with the prior art, the invention provides a training method of a sketch generation model, which comprises the steps of firstly constructing a training data set, adding noise into the training data set to obtain the noisy training data set, wherein the training data set comprises discretized graph structure data or SDF data. And inputting the noisy training data set into a preset deep neural network model to obtain predicted sketch structure data, wherein the deep neural network model is a network model taking a transducer architecture as a core or a network model taking Unet architecture as a core. And finally, determining a loss function based on the training data set and the predicted sketch structure data, and performing iterative training on the deep neural network model based on the loss function to obtain the sketch generation model. Therefore, the invention respectively researches two data structures of the graph structure data and the SDF data and two corresponding deep learning models, fully exerts the characteristics of the data structures, and can effectively solve the problem that the characteristics of the data structures are difficult to capture by training to obtain the graph generation model, thereby improving the rationality of the generated graph structure data.
Drawings
Fig. 1 is a flowchart of a preferred embodiment of a training method for a sketch generating model according to an embodiment of the present invention.
Fig. 2 is a block diagram of a sketch generation model training phase provided in an embodiment of the present invention.
Fig. 3 is a schematic architecture diagram of a training device for sketch generating models according to an embodiment of the present invention.
Fig. 4 is a schematic block diagram of a terminal according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and effects of the present invention clearer and more specific, the present invention will be described in further detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
At present, in the process of generating the CAD sketch, at least the following defects exist:
(1) Multi-step generation of problems: the classical work of the existing CAD sketch generation is based on a gradual generation mode, firstly generates a sketch and then generates constraint for the sketch, and the two-stage generation mode is not used for generating the sketch meeting constraint conditions at one time without linkage, so that the sketch of a proper constraint state is difficult to synchronously generate;
(2) The study of graph diffusion generation in the field of CAD sketch generation is still blank: diffusion models provide a powerful approach to generating high quality, diverse images in image generation tasks and exhibit excellent performance in a variety of applications. But is still blank in the CAD sketch generation field. Therefore, how to combine CAD sketch structure data generation with diffusion model is an important topic;
(3) Problems of difficult capture of data structure properties: how to model CAD sketch structural data into a reasonable data structure aiming at different generated models so as to fully exert the structural characteristics and the maximum advantages of the CAD sketch structural data is a problem to be considered; and how to set the noise adding and denoising processes in the generation model can make the generated sketch structure data more reasonable, and the researches are still blank.
For this reason, the present embodiment provides a training method of a sketch generation model. The training method of the sketch generation model of the embodiment can be applied to a terminal, and the terminal can be a computer, a mobile phone and an intelligent television. As shown in fig. 1, the training method of the sketch generation model includes the following steps:
Step S100, a training data set is constructed, noise is added in the training data set, and the noisy training data set is obtained, wherein the training data set comprises discretized graph structure data or SDF data.
Step S200, inputting the noisy training data set into a preset deep neural network model to obtain predicted sketch structure data, wherein the deep neural network model is a network model taking a transducer architecture as a core or a network model taking a Unet architecture as a core;
And step 300, determining a loss function based on the training data set and the predicted sketch structure data, and performing iterative training on the deep neural network model based on the loss function to obtain the sketch generation model.
Specifically, the training data set of the present embodiment has two cases, which may be discretized diagram structure data or SDF data. The data set is established by analyzing two different types of data, and different deep neural network models are respectively trained for different data structures so as to realize the generation requirements of different sketches. Then, in this embodiment, noise is added to the training data set to obtain a noisy training data set, and then the noisy training data set is input to a preset deep neural network model to obtain predicted sketch structure data. Because the training data set includes two forms of discretized graph structure data or SDF data, in order to realize training of the sketch generation model, the deep neural network model of the embodiment is a network model with a Transformer architecture as a core or a network model with a Unet architecture as a core, so as to meet training requirements of different data forms, and corresponding noise adding and denoising processes are accurately set for different deep neural network models. Further, in this embodiment, a loss function is determined based on the training data set and the predicted sketch structure data, and iterative training is performed on the deep neural network model based on the loss function, so as to obtain the sketch generation model.
The training process of the sketch generation model is described below in connection with fig. 2.
When the training data set is discretized graph structure data, the embodiment firstly acquires a CAD sketch data set and performs statistics and screening on the CAD sketch data set based on geometric types, constraint types and geometric parameters to obtain primary screening sketch data when the training data set is constructed. Wherein the geometry type is used to reflect the basic type of the primitive, such as: points, lines, circles, arcs, etc. Constraint types are used to reflect constraint relationships between geometries, such as: parallel, perpendicular, etc. The geometric parameters are used to reflect the size parameters and coordinate parameters of the primitive, for example, for a point of this geometric type, the geometric parameters are a set of abscissa values. In another implementation manner, the embodiment may also perform statistics and filtering on the CAD sketch dataset according to information such as whether to form a loop, and filter out non-loop data, so as to obtain preliminary screening sketch data. In this embodiment, the preliminary screening sketch data includes a sequence of geometric primitives and a sequence of constraint relationships, which are separate, each as a List or array, and are discrete in nature without stitching. For the graph structure data corresponding to the geometric parameters in the preliminary screening sketch data, the embodiment needs to firstly perform normalization processing on the graph structure data, and then perform discretization processing to obtain the graph structure data corresponding to the discretized geometric parameters. Specifically, in this embodiment, the graph structure data corresponding to the geometric parameters may be normalized to the interval of [ -0.5,0.5 ]; and quantizing the normalized numerical value, discretizing the numerical value between [ -0.5,0.5] into an integer between [0,255], and obtaining the graph structure data corresponding to the discretized geometric parameters. Then, the discretized map structure data corresponding to the geometric parameters, the map structure data corresponding to the geometric types in the preliminary screening sketch data, and the map structure data corresponding to the constraint types in the preliminary screening sketch data are subjected to one-hot (independent heat coding) coding processing to obtain the training data set. The training data set of this embodiment is discretized graph structure data, such as json format or sequence format, and can be converted into graph structure data, where the graph structure data includes geometric types and constraint types, and may also implicitly include geometric parameters.
Further, in the present embodiment, discretized noise adding processing is performed on discretized graph structure data, in the noise adding process, a state transition mode is adopted, graph structure data corresponding to a geometric type, a constraint type and a geometric parameter in the training dataset are multiplied by a preset state transition matrix, and iteration is performed according to a plurality of preset time steps, so as to obtain a noise added training dataset of each time step. The embodiment builds a deep neural network model based on a transducer (comprising a decoder) and used for loading a geometric primitive sequence and a constraint relation sequence of a training data set and carrying out data processing on discretized graph structure data (ensuring that geometric types, constraint types and geometric parameters are in one-to-one correspondence), so that the reconstructed sketch can be output by inputting the discretized graph structure data into the deep neural network model. In the denoising process, the embodiment inputs the denoised training data set into a network model with a transducer architecture as a core. And then decoding the noisy training data set based on a network model taking a transducer architecture as a core, gradually obtaining graph structure data corresponding to the predicted geometric type, constraint type and geometric parameter from noise, and taking the graph structure data corresponding to the predicted geometric type, constraint type and geometric parameter as the predicted sketch structure data.
Further, the present embodiment determines a loss function based on the training data set and the predictive sketch structure data. Specifically, the embodiment determines cross entropy loss corresponding to a geometric type, cross entropy loss corresponding to a constraint type and cross entropy loss corresponding to a geometric parameter based on the graph structure data corresponding to the geometric type, constraint type and geometric parameter in the training dataset and the graph structure data corresponding to the geometric type, constraint type and geometric parameter in the prediction sketch structure data. And then, weighting the cross entropy loss corresponding to the geometric type, the cross entropy loss corresponding to the constraint type and the cross entropy loss corresponding to the geometric parameter to obtain total loss, and constructing the loss function based on the total loss. And finally, carrying out iterative training on the deep neural network model by taking the minimized loss function as a training target until residual errors on a training set and a testing set meet convergence indexes, and obtaining the sketch generation model. According to the embodiment, the training data set is constructed in the mode of the diagram structure data, so that the diagram generation model obtained by training through the training data set can link the geometric type, the geometric parameter and the constraint type when the diagram is generated, the diagram generation model can learn how to directly generate a reasonable diagram according to the constraint type, and the problem of multi-step generation in the prior art method is effectively solved. In addition, the embodiment expands the diffusion generation model on the basis of modeling the CAD data into the graph structure data structure, so that the CAD data is better adapted, and the problem that the study on graph diffusion generation in the CAD sketch generation field is still blank can be effectively solved.
In another embodiment, if the training dataset is SDF (SIGNED DISTANCE FIELD ) data, the embodiment also obtains the CAD sketch dataset first when constructing the training dataset, and performs statistics and screening on the CAD sketch dataset based on the geometry type, constraint type, and geometry parameters, to obtain the preliminary screening sketch data. The preliminary screening sketch data comprises a geometric primitive sequence and a constraint relation sequence which are separated and respectively used as a List or an array, and the two sequences are not spliced. Next, the present embodiment obtains a plurality of line segment structures from the preliminary screening sketch data, and discretizes each line segment structure into a pixel or grid (grid) unit. And then determining SDF data corresponding to each line segment structure according to the distance between the center point of each pixel or the center point of each grid unit and the corresponding line segment structure, wherein the SDF data is the nearest distance between the center point of each pixel or each grid unit and the corresponding line segment structure, and the nearest distance has a symbol, and the nearest distance represents that the point is inside (negative value) or outside (positive value) the line segment. Next, the present embodiment stores all SDF data into a data structure to obtain the training data set, where the SDF data stores primitive information in a matrix form, and a row represents one primitive information, and each primitive information includes a geometry type, a constraint type, and a geometry parameter. The SDF data can be generated according to the above-mentioned modes for the structures of the line, the circle, the arc and the like.
Further, the embodiment performs noise adding processing on the training data set, and in the noise adding process, the embodiment obtains gaussian noise of random sampling. And then adding the Gaussian noise into all SDF data in the training data set, and iterating according to a plurality of preset time steps to obtain a noisy training data set of each time step. The embodiment builds a deep neural network model with a model structure based on Unet (including a decoder). In the denoising process, the embodiment samples from the Gaussian noise in advance and learns a conditional probability distribution of model prediction real noise. And inputting the denoised training data set into a network model taking Unet architecture as a core, predicting the noise of the t time step based on the conditional probability distribution by using the network model taking Unet architecture as the core to obtain prediction noise, wherein the prediction noise reflects recovered SDF data, and finally obtaining the prediction sketch structure data based on the prediction noise. The prediction noise in this embodiment is used to denoise the data after the original SDF data is denoised, and the original SDF data can be recovered by subtracting the prediction noise from the denoised data, so that the noise adding and denoising processes can be accurately set in the sketch generating model by using the structural characteristics of the SDF data, so as to improve the rationality of predicting the sketch structural data.
Further, the present embodiment determines a loss function based on the training data set and the predictive sketch structure data. Specifically, the present embodiment calculates a Mean Square Error (MSE) based on gaussian noise corresponding to the training data set and prediction noise corresponding to a time step in the prediction sketch structure data, and constructs the loss function based on the mean square error. And then, taking the minimized loss function as a training target, and carrying out iterative training on the deep neural network model until residual errors on a training set and a testing set meet convergence indexes, so as to obtain a sketch generation model. According to the embodiment, for different generation models, modeling of data into graph structure data and SDF data is studied respectively, the two data structures correspond to two different deep learning models respectively, so that different diffusion generation modes are guaranteed, the data structure characteristics can be fully exerted, diversified sketches are generated conveniently, and the problem that the data structure characteristics are difficult to capture is solved effectively.
Based on the above embodiment, the present invention may further apply the above sketch generation model to perform sketch generation, and for this purpose, this embodiment provides a sketch generation method based on the sketch generation model. In a specific application, the implementation acquires sampling data, and inputs the sampling data into the sketch generation model, wherein the sampling data comprises discretized graph structure data or SDF data. And then, carrying out iterative processing on the sampling data based on the sketch generation model to obtain a sketch sample.
Specifically, if the sampled data is discretized graph structure data, after the discretized graph structure data is input into a graph generation model, the graph generation model samples noise from prior distributions of the geometric type, the constraint type and the geometric parameter (i.e., data distributions of the three types respectively), and then outputs predicted graph structure data at the current time step (i.e., the state of the current time t, including three data types including: geometric type, constraint type and geometric parameter) according to the graph structure data of the geometric type, the constraint type and the geometric parameter. Next, the present embodiment calculates a posterior probability of the current time step (i.e., estimates a data probability value at time t-1 given a data value at time t); and multiplying the predicted sketch structure data of the current time step by the posterior probability of the current time step to obtain the predicted sketch structure data of the next time step (namely, the time t-1), and inputting the predicted sketch structure data of the next time step into the sketch generation model to output the predicted sketch structure data of the time t-2. And (3) carrying out iterative processing until the sketch generating model outputs the predicted sketch structure data of the last time step (0 th moment) so as to obtain the sketch sample based on the predicted sketch structure data of all the time steps.
And if the sampling data are SDF data, outputting prediction noise by the sketch generation model according to Gaussian noise corresponding to the SDF data (the Gaussian noise is added to the SDF data), wherein the prediction noise reflects the SDF data recovered at the current time t, and the Gaussian noise and the prediction noise have the same data format and are standard of the SDF data. Then, the embodiment subtracts the prediction noise from the sampling data of the current time step to obtain the SDF data recovered in the next time step (at the time of t-1), and inputs the SDF data recovered in the next time step into the sketch generating model, so as to output the recovered SDF data at the time of t-2. And performing iterative processing until the sketch generating model outputs SDF data recovered in the last time step, so as to obtain sketch samples based on the recovered SDF data in all the time steps.
Based on the above embodiment, the present invention further provides a training device for sketch generating a model, as shown in fig. 3, where the training device includes: data processing module 10, data prediction module 20, and model training module 30. Specifically, the data processing module 10 is configured to construct a training data set, add noise in the training data set, and obtain a noisy training data set, where the training data set includes discretized graph structure data or SDF data. The data prediction module 20 is configured to input the denoised training data set into a preset deep neural network model to obtain predicted sketch structure data, where the deep neural network model is a network model with a transducer architecture as a core or a network model with a Unet architecture as a core. The model training module 30 is configured to determine a loss function based on the training data set and the predicted sketch structure data, and perform iterative training on the deep neural network model based on the loss function, so as to obtain the sketch generating model.
In one implementation, when the training data set is discretized graph structure data, the data processing module 10 includes:
The first sketch screening unit is used for acquiring a CAD sketch data set, and carrying out statistics and screening on the CAD sketch data set based on a geometric type, a constraint type and a geometric parameter to obtain preliminary screening sketch data, wherein the geometric type is used for reflecting the basic type of the primitive, the constraint type is used for reflecting the constraint relation between the geometries, and the geometric parameter is used for reflecting the size parameter and the coordinate parameter of the primitive;
The normalization processing unit is used for carrying out normalization processing on the graph structure data corresponding to the geometric parameters in the preliminary screening sketch data to obtain graph structure data corresponding to the geometric parameters after normalization processing;
The discretization processing unit is used for discretizing the graph structure data corresponding to the geometric parameters after normalization processing to obtain the graph structure data corresponding to the geometric parameters after discretization processing;
And the coding processing unit is used for carrying out one-hot coding processing on the map structure data corresponding to the discretized geometric parameters, the map structure data corresponding to the geometric types in the preliminary screening sketch data and the map structure data corresponding to the constraint types in the preliminary screening sketch data to obtain the training data set.
In one implementation, the data processing module 10 further includes:
the first noise adding unit is used for multiplying the graph structure data corresponding to the geometric type, the constraint type and the geometric parameter in the training data set by a preset state transition matrix respectively in a state transition mode, and iterating according to a plurality of preset time steps to obtain a noise added training data set of each time step.
In one implementation, the data prediction module 20 includes:
The training data input unit is used for inputting the denoised training data set into a network model taking a transducer architecture as a core;
the first sketch prediction unit is used for decoding the noisy training data set based on a network model taking a transducer architecture as a core to obtain graph structure data corresponding to the predicted geometric type, constraint type and geometric parameter, and taking the graph structure data corresponding to the predicted geometric type, constraint type and geometric parameter as the predicted sketch structure data.
In one implementation, the model training module 30 includes:
The loss calculation unit is used for determining cross entropy loss corresponding to the geometric type, cross entropy loss corresponding to the constraint type and cross entropy loss corresponding to the geometric parameter based on the graph structure data corresponding to the geometric type, constraint type and geometric parameter in the training dataset and the graph structure data corresponding to the geometric type, constraint type and geometric parameter in the prediction sketch structure data;
The first loss function determining unit is used for weighting the cross entropy loss corresponding to the geometric type, the cross entropy loss corresponding to the constraint type and the cross entropy loss corresponding to the geometric parameter to obtain total loss, and constructing the loss function based on the total loss;
And the first model training unit is used for iteratively training the deep neural network model by taking the minimized loss function as a training target to obtain the sketch generation model.
In one implementation, when the training data set is SDF data, the data processing module 10 includes:
the second sketch screening unit is used for acquiring a CAD sketch data set, and carrying out statistics and screening on the CAD sketch data set based on a geometric type, a constraint type and a geometric parameter to obtain preliminary screening sketch data, wherein the geometric type is used for reflecting the basic type of the primitive, the constraint type is used for reflecting the constraint relation between the geometries, and the geometric parameter is used for reflecting the size parameter and the coordinate parameter of the primitive;
The line segment processing unit is used for acquiring a plurality of line segment structures in the preliminary screening sketch data and discretizing each line segment structure into pixels or grid units;
The SDF data determining unit is used for determining SDF data corresponding to each line segment structure according to the distance between the center point of each pixel or the center point of each grid unit and the corresponding line segment structure;
And the training data determining unit is used for storing all the SDF data into the data structure to obtain the training data set, wherein the SDF data stores primitive information in a matrix form, one row represents one primitive information, and each primitive information comprises a geometric type, a constraint type and a geometric parameter.
In one implementation, the data processing module 10 further includes:
The noise sampling unit is used for acquiring Gaussian noise of random sampling;
and the first noise adding unit is used for adding the Gaussian noise to all SDF data in the training data set, and iterating according to a plurality of preset time steps to obtain a noise added training data set of each time step.
In one implementation, the data prediction module 20 includes:
the noise learning unit is used for sampling from the Gaussian noise in advance and learning a conditional probability distribution of model prediction real noise;
The noise prediction unit is used for inputting the training data set after noise addition into a network model taking Unet architecture as a core, and predicting the noise at the time t based on the conditional probability distribution by the network model taking Unet architecture as the core to obtain prediction noise, wherein the prediction noise reflects recovered SDF data;
and the second sketch prediction unit is used for obtaining the prediction sketch structure data based on the prediction noise.
In one implementation, the model training module 30 includes:
the second loss function determining unit is used for calculating the mean square error based on Gaussian noise corresponding to the training data set and prediction noise at corresponding time in the prediction sketch structure data, and constructing the loss function based on the mean square error;
And the second model training unit is used for iteratively training the deep neural network model by taking the minimized loss function as a training target to obtain the sketch generation model.
Based on the above embodiment, the present embodiment further provides a sketch generating device based on a sketch generating model, where the sketch generating device includes:
the sampling module is used for acquiring sampling data and inputting the sampling data into the sketch generation model, wherein the sampling data comprises discretized graph structure data or SDF data;
and the sketch generation module is used for carrying out iterative processing on the sampling data based on the sketch generation model to obtain a sketch sample.
In one implementation, when the sample data includes discretized graph structure data, the sketch generation module includes:
the first model prediction module is used for outputting predicted sketch structure data at the current time step according to the geometrical type, constraint type and geometrical parameter of the sampling data by the sketch generation model;
the first data re-input module is used for multiplying the predicted sketch structure data at the current moment with the posterior probability of the current time step to obtain the predicted sketch structure data of the next time step, and inputting the predicted sketch structure data of the next time step into the sketch generation model;
and the first iteration processing module is used for carrying out iteration processing until the sketch generating model outputs the predicted sketch structure data of the last time step, and obtaining the sketch sample based on the predicted sketch structure data of all the time steps.
In one implementation, when the sample data includes SDF data, the sketch generation module includes:
The second model prediction module is used for outputting prediction noise according to Gaussian noise corresponding to the sampling data by the sketch generation model, wherein the prediction noise reflects SDF data recovered by the current time step;
the second data re-input module is used for subtracting the prediction noise from the sampling data of the current time step to obtain SDF data recovered by the next time step, and inputting the SDF data recovered by the next time step into the sketch generation model;
and the second iteration processing module is used for carrying out iteration processing until the sketch generating model outputs the SDF data recovered in the last time step, and obtaining the sketch sample based on the recovered SDF data in all the time steps.
The working principle of each module in the sketch generating model training device and the sketch generating device based on the sketch generating model in this embodiment is the same as that of each step in the above corresponding method embodiment, and will not be described here again.
Based on the above embodiment, the present invention also provides a terminal, and a schematic block diagram of the terminal may be shown in fig. 4. The terminal may include one or more processors 100 (only one shown in fig. 4), a memory 101, and a computer program 102 stored in the memory 101 and executable on the one or more processors 100, for example, a training program for a sketch generation model. The one or more processors 100, when executing the computer program 102, may implement the various steps in a training method embodiment of a sketch generation model. Or the one or more processors 100, when executing the computer program 102, may implement the functions of the modules/units in the training method embodiment of the sketch generation model, without limitation.
In one embodiment, the Processor 100 may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL processors, DSPs), application SPECIFIC INTEGRATED Circuits (ASICs), off-the-shelf Programmable gate arrays (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
In one embodiment, the memory 101 may be an internal storage unit of the electronic device, such as a hard disk or a memory of the electronic device. The memory 101 may also be an external storage device of the electronic device, such as a plug-in hard disk provided on the electronic device, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD), or the like. Further, the memory 101 may also include both an internal storage unit and an external storage device of the electronic device. The memory 101 is used to store computer programs and other programs and data required by the terminal. The memory 101 may also be used to temporarily store data that has been output or is to be output.
It will be appreciated by those skilled in the art that the functional block diagram shown in fig. 4 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the terminal to which the present inventive arrangements may be applied, as a specific terminal may include more or less components than those shown, or may be combined with some components, or may have a different arrangement of components.
Those skilled in the art will appreciate that implementing all or part of the above-described methods may be accomplished by way of a computer program, which may be stored on a non-transitory computer readable storage medium, that when executed may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, operational database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual operation data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (SYNCHLINK) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims (14)
1. A method of training a sketch generation model, the method comprising:
Constructing a training data set, adding noise in the training data set to obtain a noisy training data set, wherein the training data set comprises discretized graph structure data or SDF data;
Inputting the noisy training data set into a preset deep neural network model to obtain predicted sketch structure data, wherein the deep neural network model is a network model taking a transducer architecture as a core or a network model taking Unet architecture as a core;
determining a loss function based on the training data set and the predicted sketch structure data, and performing iterative training on the deep neural network model based on the loss function to obtain the sketch generation model;
when the training data set is discretized graph structure data, the constructing the training data set includes:
Acquiring a CAD sketch data set, and carrying out statistics and screening on the CAD sketch data set based on a geometric type, a constraint type and a geometric parameter to obtain preliminary screening sketch data, wherein the geometric type is used for reflecting the basic type of a primitive, the constraint type is used for reflecting the constraint relation between the geometries, and the geometric parameter is used for reflecting the size parameter and the coordinate parameter of the primitive;
Normalizing the graph structure data corresponding to the geometric parameters in the preliminary screening sketch data to obtain graph structure data corresponding to the geometric parameters after normalization;
discretizing the graph structure data corresponding to the geometric parameters after normalization processing to obtain graph structure data corresponding to the geometric parameters after discretization processing;
And carrying out one-hot coding on the map structure data corresponding to the discretized geometric parameters, the map structure data corresponding to the geometric types in the primary screening sketch data and the map structure data corresponding to the constraint types in the primary screening sketch data to obtain the training data set.
2. The method for training a sketch generating model according to claim 1, wherein when the training data set is discretized graph structure data, noise is added to the training data set to obtain a noisy training data set, including:
And multiplying the graph structure data corresponding to the geometric type, the constraint type and the geometric parameter in the training data set by a preset state transition matrix respectively in a state transition mode, and iterating according to a plurality of preset time steps to obtain a noisy training data set of each time step.
3. The method for training a sketch generating model according to claim 2, wherein when the training data set is discretized graph structure data, the step of inputting the noisy training data set into a preset deep neural network model to obtain predicted sketch structure data includes:
Inputting the noisy training data set into a network model taking a transducer architecture as a core;
and decoding the noisy training data set based on a network model taking the transducer architecture as a core to obtain graph structure data corresponding to the predicted geometric type, constraint type and geometric parameter, and taking the graph structure data corresponding to the predicted geometric type, constraint type and geometric parameter as the predicted sketch structure data.
4. A method of training a sketch map generation model according to claim 3, wherein when the training dataset is discretized map structure data, determining a loss function based on the training dataset and the predicted sketch structure data, and performing iterative training on the deep neural network model based on the loss function to obtain the sketch map generation model comprises:
Determining cross entropy loss corresponding to the geometric type, cross entropy loss corresponding to the constraint type and cross entropy loss corresponding to the geometric parameter based on the graph structure data corresponding to the geometric type, constraint type and geometric parameter in the training dataset and the graph structure data corresponding to the geometric type, constraint type and geometric parameter in the prediction sketch structure data;
Weighting the cross entropy loss corresponding to the geometric type, the cross entropy loss corresponding to the constraint type and the cross entropy loss corresponding to the geometric parameter to obtain total loss, and constructing the loss function based on the total loss;
And carrying out iterative training on the deep neural network model by taking the minimized loss function as a training target to obtain the sketch generation model.
5. The method of claim 1, wherein when the training dataset is SDF data, the constructing the training dataset comprises:
Acquiring a CAD sketch data set, and carrying out statistics and screening on the CAD sketch data set based on a geometric type, a constraint type and a geometric parameter to obtain preliminary screening sketch data, wherein the geometric type is used for reflecting the basic type of a primitive, the constraint type is used for reflecting the constraint relation between the geometries, and the geometric parameter is used for reflecting the size parameter and the coordinate parameter of the primitive;
acquiring a plurality of line segment structures in the primary screening sketch data, and discretizing each line segment structure into pixels or grid cells;
Determining SDF data corresponding to each line segment structure according to the distance between the center point of each pixel or the center point of each grid unit and the corresponding line segment structure;
and storing all the SDF data into a data structure to obtain the training data set, wherein the SDF data stores primitive information in a matrix form, one row represents one primitive information, and each primitive information comprises a geometric type, a constraint type and a geometric parameter.
6. The method for training a sketch generating model according to claim 1, wherein when the training data set is SDF data, noise is added to the training data set to obtain a noisy training data set, which includes:
Acquiring Gaussian noise of random sampling;
And adding the Gaussian noise to all SDF data in the training data set, and iterating according to a plurality of preset time steps to obtain a noisy training data set of each time step.
7. The method for training a sketch generation model according to claim 6, wherein when the training data set is SDF data, the step of inputting the noisy training data set into a preset deep neural network model to obtain predicted sketch structure data includes:
Sampling from the Gaussian noise in advance, and learning a conditional probability distribution of model prediction real noise;
Inputting the noisy training data set into a network model taking Unet architecture as a core, and predicting the noise at the time t by the network model taking Unet architecture as the core based on the conditional probability distribution to obtain prediction noise, wherein the prediction noise reflects recovered SDF data;
and obtaining the predicted sketch structure data based on the predicted noise.
8. The method according to claim 7, wherein when the training data set is SDF data, the determining a loss function based on the training data set and the predicted sketch structure data, and performing iterative training on the deep neural network model based on the loss function, to obtain the sketch generation model, includes:
calculating a mean square error based on Gaussian noise corresponding to the training data set and prediction noise at a corresponding moment in the prediction sketch structure data, and constructing the loss function based on the mean square error;
And carrying out iterative training on the deep neural network model by taking the minimized loss function as a training target to obtain the sketch generation model.
9. A sketch generating method based on a sketch generating model according to any one of claims 1-8, characterized in that the method comprises:
Acquiring sampling data, and inputting the sampling data into the sketch generation model, wherein the sampling data comprises discretized graph structure data or SDF data;
and carrying out iterative processing on the sampling data based on the sketch generation model to obtain a sketch sample.
10. The sketch generating method according to claim 9, wherein when the sampling data includes discretized drawing structure data, the performing iterative processing on the sampling data based on the sketch generating model to obtain a sketch sample includes:
The sketch generation model outputs predicted sketch structure data at the current time step according to the geometrical type, constraint type and geometrical parameter of the sampling data;
Multiplying the predicted sketch structure data at the current moment with the posterior probability of the current time step to obtain predicted sketch structure data of the next time step, and inputting the predicted sketch structure data of the next time step into the sketch generation model;
And carrying out iterative processing until the sketch generating model outputs predicted sketch structure data of the last time step, and obtaining the sketch sample based on the predicted sketch structure data of all the time steps.
11. The sketch generating method according to claim 9, wherein when the sampling data includes SDF data, the performing iterative processing on the sampling data based on the sketch generating model to obtain a sketch sample includes:
the sketch generation model outputs prediction noise according to Gaussian noise corresponding to the sampling data, wherein the prediction noise reflects SDF data recovered by the current time step;
subtracting the prediction noise from the sampling data of the current time step to obtain SDF data recovered by the next time step, and inputting the SDF data recovered by the next time step into the sketch generation model;
and performing iterative processing until the sketch generating model outputs SDF data recovered in the last time step, and obtaining the sketch sample based on the recovered SDF data in all the time steps.
12. A training device for a sketch generation model, the training device comprising:
The data processing module is used for constructing a training data set, adding noise into the training data set to obtain a noisy training data set, wherein the training data set comprises discretized graph structure data or SDF data;
The data prediction module is used for inputting the noisy training data set into a preset deep neural network model to obtain predicted sketch structure data, wherein the deep neural network model is a network model taking a transform architecture as a core or a network model taking a Unet architecture as a core;
The model training module is used for determining a loss function based on the training data set and the predicted sketch structure data, and carrying out iterative training on the deep neural network model based on the loss function to obtain the sketch generation model;
When the training data set is discretized graph structure data, the data processing module includes:
The first sketch screening unit is used for acquiring a CAD sketch data set, and carrying out statistics and screening on the CAD sketch data set based on a geometric type, a constraint type and a geometric parameter to obtain preliminary screening sketch data, wherein the geometric type is used for reflecting the basic type of the primitive, the constraint type is used for reflecting the constraint relation between the geometries, and the geometric parameter is used for reflecting the size parameter and the coordinate parameter of the primitive;
The normalization processing unit is used for carrying out normalization processing on the graph structure data corresponding to the geometric parameters in the preliminary screening sketch data to obtain graph structure data corresponding to the geometric parameters after normalization processing;
The discretization processing unit is used for discretizing the graph structure data corresponding to the geometric parameters after normalization processing to obtain the graph structure data corresponding to the geometric parameters after discretization processing;
And the coding processing unit is used for carrying out one-hot coding processing on the map structure data corresponding to the discretized geometric parameters, the map structure data corresponding to the geometric types in the preliminary screening sketch data and the map structure data corresponding to the constraint types in the preliminary screening sketch data to obtain the training data set.
13. A terminal comprising a memory, a processor and a training program for a sketch generation model stored in the memory and executable on the processor, the processor implementing the steps of the training method for a sketch generation model according to any one of claims 1-8 when executing the training program for a sketch generation model.
14. A computer readable storage medium, wherein a training program of a sketch generation model is stored on the computer readable storage medium, which training program of a sketch generation model, when executed by a processor, implements the steps of the training method of a sketch generation model as claimed in any one of claims 1-8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410331956.3A CN117935291B (en) | 2024-03-22 | 2024-03-22 | Training method, sketch generation method, terminal and medium for sketch generation model |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410331956.3A CN117935291B (en) | 2024-03-22 | 2024-03-22 | Training method, sketch generation method, terminal and medium for sketch generation model |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117935291A CN117935291A (en) | 2024-04-26 |
CN117935291B true CN117935291B (en) | 2024-06-11 |
Family
ID=90764967
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410331956.3A Active CN117935291B (en) | 2024-03-22 | 2024-03-22 | Training method, sketch generation method, terminal and medium for sketch generation model |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117935291B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111145338A (en) * | 2019-12-17 | 2020-05-12 | 桂林理工大学 | Chair model reconstruction method and system based on single-view RGB image |
CN113420438A (en) * | 2021-06-22 | 2021-09-21 | 天津大学 | Method for measuring geometric parameters of internal structure of additive device based on X-ray sinogram |
CN115457183A (en) * | 2022-08-17 | 2022-12-09 | 北京邮电大学 | Training method, reconstruction method and device for generating and reconstructing serialized sketch model |
EP4280162A1 (en) * | 2022-05-18 | 2023-11-22 | Autodesk, Inc. | Generating prismatic cad models by machine learning |
CN117314788A (en) * | 2023-11-14 | 2023-12-29 | 北京汉仪创新科技股份有限公司 | Image patching method and device and electronic equipment |
CN117454495A (en) * | 2023-12-25 | 2024-01-26 | 北京飞渡科技股份有限公司 | CAD vector model generation method and device based on building sketch outline sequence |
CN117725966A (en) * | 2024-02-18 | 2024-03-19 | 粤港澳大湾区数字经济研究院(福田) | Training method of sketch sequence reconstruction model, geometric model reconstruction method and equipment |
-
2024
- 2024-03-22 CN CN202410331956.3A patent/CN117935291B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111145338A (en) * | 2019-12-17 | 2020-05-12 | 桂林理工大学 | Chair model reconstruction method and system based on single-view RGB image |
CN113420438A (en) * | 2021-06-22 | 2021-09-21 | 天津大学 | Method for measuring geometric parameters of internal structure of additive device based on X-ray sinogram |
EP4280162A1 (en) * | 2022-05-18 | 2023-11-22 | Autodesk, Inc. | Generating prismatic cad models by machine learning |
CN115457183A (en) * | 2022-08-17 | 2022-12-09 | 北京邮电大学 | Training method, reconstruction method and device for generating and reconstructing serialized sketch model |
CN117314788A (en) * | 2023-11-14 | 2023-12-29 | 北京汉仪创新科技股份有限公司 | Image patching method and device and electronic equipment |
CN117454495A (en) * | 2023-12-25 | 2024-01-26 | 北京飞渡科技股份有限公司 | CAD vector model generation method and device based on building sketch outline sequence |
CN117725966A (en) * | 2024-02-18 | 2024-03-19 | 粤港澳大湾区数字经济研究院(福田) | Training method of sketch sequence reconstruction model, geometric model reconstruction method and equipment |
Non-Patent Citations (1)
Title |
---|
BrepGen: A B-rep Generative Diffusion Model with Structured Latent Geometry;Xiang Xu et al.;arxiv;20240128;第1-17页 * |
Also Published As
Publication number | Publication date |
---|---|
CN117935291A (en) | 2024-04-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113902926A (en) | General image target detection method and device based on self-attention mechanism | |
WO2021103761A1 (en) | Compound property analysis method and apparatus, compound property analysis model training method, and storage medium | |
CN109766557A (en) | A kind of sentiment analysis method, apparatus, storage medium and terminal device | |
CN113674172A (en) | Image processing method, system, device and storage medium | |
WO2022192291A1 (en) | Evolutional deep neural networks | |
CN112733933B (en) | Data classification method and device based on unified optimization target frame graph neural network | |
Sun et al. | Learning structured densities via infinite dimensional exponential families | |
CN111738435A (en) | Online sparse training method and system based on mobile equipment | |
CN115641485A (en) | Generative model training method and device | |
CN114694158A (en) | Extraction method of structured information of bill and electronic equipment | |
CN117876845A (en) | Visual characterization method and device based on bidirectional state space model | |
Cheng et al. | Parallel vertex diffusion for unified visual grounding | |
CN115204171A (en) | Document-level event extraction method and system based on hypergraph neural network | |
CN116912635B (en) | Target tracking method and device | |
CN111062944B (en) | Network model training method and device and image segmentation method and device | |
CN117935291B (en) | Training method, sketch generation method, terminal and medium for sketch generation model | |
CN116992607A (en) | Structural topology optimization method, system and device | |
CN115294343B (en) | Point cloud feature enhancement method based on cross-position and channel attention mechanism | |
CN113127615A (en) | Text processing method and device, electronic equipment and computer readable storage medium | |
Shen et al. | Psrflow: Probabilistic super resolution with flow-based models for scientific data | |
Stypułkowski et al. | Representing point clouds with generative conditional invertible flow networks | |
CN114065913A (en) | Model quantization method and device and terminal equipment | |
Zhang et al. | DAResNet Based on double-layer residual block for restoring industrial blurred images | |
CN117893691B (en) | Structure intelligent three-dimensional reconstruction method based on three-plane feature representation and visual angle conditional diffusion model | |
CN118279913B (en) | Intra-domain modeling replication mobile tampering detection method based on semantic segmentation |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |