Two-way generation type auto-encoder-based secondary circuit graph-to-model conversion method
By introducing a bidirectional generation autoencoder and Wasserstein distance in electrical drawing conversion, the problems of low drawing preprocessing accuracy and insufficient conversion consistency in the prior art are solved, and efficient and accurate bidirectional conversion between CAD and SVG are achieved.
Patent Information
- Application Number
- CN202411878413.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-05-27
AI Technical Summary
The prior art has low accuracy and lacks bidirectional consistency constraints in the preprocessing stage of electrical drawings, resulting in insufficient accuracy and stability of conversion results, and the inability to achieve data sharing and seamless updates.
Using a method based on a bidirectional generative autoencoder, by introducing Wasserstein distance and fusion GAN structure, a bidirectional generative autoencoder is designed and trained, the potential spatial distribution is optimized, and bidirectional conversion between CAD graphs and SVG visual models is performed.
Improve the accuracy and consistency of the automated conversion of electrical drawings, ensure that the generated graphics have high consistency with the original drawings, reduce the misidentification rate, improve work efficiency, and realize data sharing and seamless updates.
Smart Images

Figure CN120047308A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer vision and graphics processing, and specifically to a method for converting secondary circuit diagrams into models based on a bidirectional generative autoencoder. Background Art
[0002] In recent years, with the rapid development of deep learning technology, generative models have been widely applied in fields such as image processing, computer vision, and natural language processing. Among them, generative adversarial networks (GANs) and autoencoders (AEs), as cutting-edge technologies, have become the core solutions for many complex tasks. Especially in graphics generation and data conversion, the proposed bidirectional generative autoencoder (BiGAN) provides a new perspective for data generation and encoding, making it possible to achieve efficient data representation and generation in complex scenarios. This method is particularly important in the power system because electrical drawings usually contain complex and diverse elements. How to perform diagram-model conversion efficiently and accurately is of great significance for improving the intelligence level of the power system. In recent years, some related research has begun to focus on the automated parsing and generation of electrical drawings, but most methods still focus on specific types of drawings and do not have flexible generality or adaptability.
[0003] Although there are many deep learning-based electrical drawing processing technologies currently, the existing technologies still face some significant deficiencies. First, in the preprocessing stage of the drawings, traditional methods often rely on a single object detection algorithm for primitive extraction, which is easily affected by factors such as drawing quality, complexity, and noise, resulting in low recognition accuracy and inability to adapt to various styles of electrical wiring diagrams. In addition, when the existing research deals with the bidirectional conversion between CAD drawings and SVG models, it often lacks effective cycle consistency constraints, resulting in insufficient accuracy and stability of the conversion results and inability to achieve data sharing and seamless update. Second, in the model training process, the current generative adversarial network technology faces the problem of difficultly balancing the relationship between the generator and the discriminator, resulting in problems such as difficult model convergence and poor generation quality. In this context, the present invention aims to solve the above technical defects and improve the automation conversion accuracy and consistency of electrical drawings by introducing the Wasserstein distance, integrating the GAN structure, and constructing a bidirectional generative autoencoder. Summary of the Invention
[0004] In view of the above existing problems, the present invention is proposed.
[0005] Therefore, the technical problems solved by the present invention are: the problems of low accuracy in drawing preprocessing, lack of bidirectional consistency constraints, and insufficient stability of the generation results in the existing technology, and the problem of how to achieve seamless bidirectional conversion between CAD and SVG efficiently and accurately.
[0006] To solve the above technical problems, the present invention provides the following technical solutions: A method for converting a secondary circuit diagram into a model based on a bidirectional generative autoencoder, including data preprocessing and graphic element extraction, and constructing a graphic element library; introducing the Wasserstein distance and integrating the GAN structure, designing and training a bidirectional generative autoencoder, and optimizing the latent space distribution; based on the trained bidirectional generative autoencoder, performing bidirectional conversion between CAD drawings and SVG visualization models.
[0007] As a preferred solution of the method for converting a secondary circuit diagram into a model based on a bidirectional generative autoencoder according to the present invention, wherein: the data preprocessing includes CAD drawing preprocessing and SVG model parsing; the CAD drawing preprocessing includes deleting and hiding irrelevant elements in the CAD drawing, allocating different elements in the drawing to different layers according to types, scaling the drawing according to requirements, aligning the drawing according to a unified coordinate system, adjusting the image contrast, denoising the drawing, extracting geometric features and symbol representations in the CAD drawing by using an image processing algorithm combined with a convolutional neural network, and classifying graphic elements in the CAD drawing by using an automated tool; the SVG model parsing includes extracting hierarchical structures and path information based on XML parsing and encoding by using a tree structure.
[0008] As a preferred solution of the method for converting a secondary circuit diagram into a model based on a bidirectional generative autoencoder according to the present invention, wherein: the construction of the graphic element library includes extracting and classifying electrical components in the CAD drawing by using a template matching technique, defining a matching template through standard legends and data provided by equipment manufacturers, and supervising and optimizing the classification algorithm by using Logistics regression and cross-entropy loss functions; in the template matching judgment stage, when the highest template category score of the predicted graphic element group exceeds a preset threshold, the graphic element group successfully matches the template, otherwise the matching fails.
[0009] As a preferred solution of the method for converting a secondary circuit diagram into a model based on a bidirectional generative autoencoder according to the present invention, wherein: the design and training of the bidirectional generative autoencoder include introducing the Wasserstein distance into the bidirectional generative autoencoder, performing feature extraction in the bidirectional generative autoencoder through the Wasserstein for estimating and matching joint distributions, embedding the GAN structure based on MMD to strengthen the feature learning ability of the bidirectional generative autoencoder, additionally designing two loss terms to optimize the form and respectively generate the generator G, and enabling information expansion constraint cycle consistency during decoding and encoding; calculating an additional loss term T of the decoder G through block SSIM based on SSIM x , embedding the discriminator D in the GAN z , two convolutional blocks F x and F zExtract features from the data space and the latent space respectively to realize the design of the bidirectional generative autoencoder.
[0010] As a preferred solution of the secondary circuit diagram-model conversion method based on the bidirectional generative autoencoder described in the present invention, wherein: the design and training of the bidirectional generative autoencoder further includes making X, Z, and respectively represent the spaces of real data, real latent data, generated data, and encoded latent data, x and z are samples from spaces X and Z, and the generalized data space is expressed as:
[0011]
[0012] The generalized latent space, expressed as:
[0013]
[0014] The training of the bidirectional generative autoencoder includes inputting data samples into the encoder E, inputting latent samples into the generator G, and calculating the output to obtain samples in the generalized data space; the samples in the generalized data space include processing the data samples through the encoder E to obtain the latent representation of the data samples, and processing the latent samples through the generator G to obtain the reconstruction of the data samples; calculating the loss and gradient, estimating the difference in the joint distribution by using the Wasserstein distance, and using the MMD maximum mean difference and the MS-SSIM multi-scale structural similarity index to measure the similarity between the generated samples and the real samples; optimizing the model parameters, updating the encoder E, the generator G, the discriminator D, and the relevant network parameters through the calculated loss and gradient, and gradually improving the performance of the generator and the encoder through iterative optimization.
[0015] As a preferred solution of the secondary circuit diagram-model conversion method based on the bidirectional generative autoencoder described in the present invention, wherein: the design and training of the bidirectional generative autoencoder further includes introducing the Wasserstein distance. Regarding the Wasserstein distance, given and between The loss function L DF is defined as training D, F x , F z , expressed as:
[0016]
[0017] Among them, L DF represents the overall loss function related to the discriminator, n b represents the batch size, represents the Wasserstein distance, and λ represents the weight coefficient for adjusting the gradient penalty term. denotes the gradient of the discriminator D, ||·|| 2 denotes the L2 norm, and the GP term enforces D to obey the 1-Lipschitz constraint; for the encoder E and the generator G, the loss function L EG is defined as:
[0018]
[0019] where L EG denotes the joint loss function of the encoder and the generator, D(·) denotes the discriminator function, and σ denotes the weight coefficient for adjusting the loss function L EG ; Embedding the GAN structure based on MMD to strengthen the feature learning ability of the bidirectional generative autoencoder. Given two distributions, the MMD is defined as:
[0020]
[0021] where f denotes the kernel function; The cyclic consistency optimization objective in the data space, minimizing the loss function, is expressed as:
[0022]
[0023] where x, respectively denote the real image and the reconstructed image, and L MS-SSIM denotes the loss term based on SSIM, and L l1 denotes the element-wise L 1 loss term, and α 2 denotes the weight coefficient of the T x loss function.
[0024] As a preferred solution of the secondary circuit diagram-model conversion method based on the bidirectional generative autoencoder according to the present invention, wherein: the bidirectional conversion between the CAD drawing and the SVG visualization model includes inputting the processed CAD drawing data into the optimized generation model to generate an SVG graphic, and converting the generated SVG model into a CAD digital drawing through the reverse process.
[0025] Another object of the present invention is to provide a secondary circuit diagram-model conversion system based on the bidirectional generative autoencoder, which can solve the technical problems of low conversion accuracy, difficult data sharing, and poor model training convergence in the current power automation drawing conversion technology by combining the Wasserstein distance and the maximum mean discrepancy MMD to optimize the latent space distribution.
[0026] As a preferred solution of the secondary circuit diagram-model conversion system based on the bidirectional generative autoencoder of the present invention, it includes a data preprocessing module, a training module, and a bidirectional conversion module; the data preprocessing module is used for data preprocessing and graphic element extraction, and constructs a graphic element library; the training module is used to introduce the Wasserstein distance and fuse the GAN structure, design and train a bidirectional generative autoencoder, and optimize the latent space distribution; the bidirectional conversion module is used to perform bidirectional conversion between CAD drawings and SVG visualization models based on the trained bidirectional generative autoencoder.
[0027] A computer device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the steps of the secondary circuit diagram-model conversion method based on the bidirectional generative autoencoder are implemented.
[0028] A computer-readable storage medium stores a computer program thereon. When the computer program is executed by a processor, the steps of the secondary circuit diagram-model conversion method based on the bidirectional generative autoencoder are implemented.
[0029] The beneficial effects of the present invention: The secondary circuit diagram-model conversion method based on the bidirectional generative autoencoder provided by the present invention improves the conversion accuracy and stability between CAD drawings and SVG models by optimizing the cycle consistency of the latent space and the data space, ensuring that the generated graphics are highly consistent with the original drawings. Especially when dealing with complex electrical wiring diagrams, it can effectively reduce the misrecognition rate; by combining the generative adversarial network GAN and the autoencoder AE, the joint optimization of the decoder and the encoder is realized in the bidirectional mapping process; by introducing the Wasserstein distance and the maximum mean discrepancy MMD as loss functions, the feature learning ability of the model is effectively enhanced, and the quality of the generated samples is improved; by constructing a graphic element library and preprocessing technology, it can flexibly adapt to electrical drawings of different styles and formats, has strong versatility and flexibility, and improves the clarity and readability of electrical drawings; through the automated graphic element extraction and diagram-model conversion process, not only is the manual intervention reduced, the work efficiency is improved, but also the processing time of electrical drawings is shortened. Description of the Drawings
[0030] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0031] Figure 1The overall flowchart of a secondary circuit diagram-model conversion method based on a bidirectional generative autoencoder provided for the first embodiment of the present invention.
[0032] Figure 2 The schematic diagram of the diagram-model conversion method of a secondary circuit diagram-model conversion method based on a bidirectional generative autoencoder provided for the first embodiment of the present invention.
[0033] Figure 3 The schematic diagram of the diagram-model conversion method of a secondary circuit diagram-model conversion method based on a bidirectional generative autoencoder provided for the first embodiment of the present invention
[0034] Figure 4 The overall flowchart of a secondary circuit diagram-model conversion system based on a bidirectional generative autoencoder provided for the third embodiment of the present invention. Detailed implementation manners
[0035] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following will describe the detailed implementation manners of the present invention in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0036] Embodiment 1, referring to Figures 1 - 2 , which is an embodiment of the present invention, provides a secondary circuit diagram-model conversion method based on a bidirectional generative autoencoder, including:
[0037] S1: Data preprocessing and graphic element extraction, and construction of a graphic element library.
[0038] Furthermore, the data preprocessing includes CAD drawing preprocessing and SVG model parsing; the CAD drawing preprocessing includes deleting and hiding irrelevant elements in the CAD drawing, allocating different elements in the drawing to different layers according to types, scaling the drawing according to requirements, aligning the drawing according to a unified coordinate system, adjusting the image contrast, denoising the drawing, extracting geometric features and symbol representations in the CAD drawing by using image processing algorithms combined with convolutional neural networks, and classifying the graphic elements in the CAD drawing through an automated tool;
[0039] The SVG model parsing includes extracting hierarchical structure and path information based on XML parsing and encoding in a tree structure.
[0040] It should be noted that constructing the primitive library includes extracting and classifying electrical components in CAD drawings using template matching technology, defining matching templates through standard legends and data provided by equipment manufacturers, and supervising and optimizing the classification algorithm using Logistics regression and cross-entropy loss function; in the template matching judgment stage, when the highest template category score of the predicted primitive group exceeds the preset threshold, the primitive group successfully matches the template, otherwise the match fails.
[0041] It should also be noted that the terminal interface display after the primitive library is established is as Figure 3 shown. The method of template matching is used to automatically classify the primitives and symbols in the primitive library. The components include but are not limited to coils, contacts, switches, etc. The specific operation process is as follows: First, receive the CAD drawing as input and perform format standardization processing on it. Then, based on the existing drawings and standard legends provided by equipment component manufacturers, construct predefined templates, design the matching algorithm between primitives and templates, extract the primitive area from the drawing, and retain the electrical primitives therein. During the processing, the text branch constructs learnable text information at different positions in the image such as front, middle, and back using text prompts; the image branch incorporates the learnable vector into the image encoder as visual auxiliary information. Subsequently, feature adapters are added respectively after the encoders of the image and text branches. By calculating the dot product of the text and image features, the similarity between them is obtained as the probability value of category attribution. For the image features, a fully connected layer is added to represent the image category probability, and it is added to the image-text similarity score to obtain the final image classification score. The model uses Logistic regression to determine the probability that the primitive belongs to each template, and uses the cross-entropy loss function for supervision and network optimization. In the matching judgment stage, only when the template category score with the highest score of the primitive group predicted by the model exceeds the preset threshold, it is determined that the primitive group successfully matches the template. For the primitive group without a defined template, the original detected primitive is directly displayed. Finally, the automatic classification of primitives is realized according to the matching result, and the classification result is output.
[0042] S2: Introduce the Wasserstein distance and the fused GAN structure, design and train a bidirectional generative autoencoder, and optimize the latent space distribution.
[0043] Furthermore, designing and training a bidirectional generative autoencoder includes introducing the Wasserstein distance into the bidirectional generative autoencoder, extracting features in the bidirectional generative autoencoder by estimating and coordinating the Wasserstein of the joint distribution, embedding the GAN structure based on MMD to enhance the feature learning ability of the bidirectional generative autoencoder, and additionally designing two loss terms to optimize the form and respectively generate the generator G, and enabling information expansion constraint cycle consistency during decoding and encoding; calculating the additional loss term T of the decoder G through block SSIM based on SSIM x, the discriminator D embedded in the GAN z , two convolutional blocks F x and F z respectively extract features from the data space and the latent space to implement the design of the bidirectional generative autoencoder.
[0044] It should be noted that designing and training the bidirectional generative autoencoder also includes making X, Z, and respectively represent the spaces of real data, real latent data, generated data, and encoded latent data, x and z are samples from spaces X and Z, and the generalized data space is represented as:
[0045]
[0046] The generalized latent space, represented as:
[0047]
[0048] The training of the bidirectional generative autoencoder includes inputting data samples into the encoder E, inputting latent samples into the generator G, and calculating the output to obtain samples in the generalized data space; the samples in the generalized data space include processing the data samples through the encoder E to obtain the latent representation of the data samples, and processing the latent samples through the generator G to obtain the reconstruction of the data samples; calculating the loss and gradient, estimating the joint distribution difference by using the Wasserstein distance, and using the MMD maximum mean difference and the MS-SSIM multi-scale structural similarity index to measure the similarity between the generated samples and the real samples; optimizing the model parameters, updating the encoder E, generator G, discriminator D, and related network parameters through the calculated loss and gradient, and gradually improving the performance of the generator and encoder through iterative optimization.
[0049] It should also be noted that designing and training the bidirectional generative autoencoder also includes introducing the Wasserstein distance. Regarding the Wasserstein distance, given and between The loss function L DF is defined as training D, F x , F z , expressed as:
[0050]
[0051] Among them, L DF represents the overall loss function related to the discriminator, n b represents the batch size, represents the Wasserstein distance, and λ represents the weight coefficient for adjusting the gradient penalty term, Denotes the gradient of the discriminator D, ||·|| 2 Denotes the two-norm, and the GP term denotes forcing D to obey the 1-Lipschitz constraint; for the encoder E and the generator G, the loss function L EG Is defined as:
[0052]
[0053] Where L EG Denotes the joint loss function of the encoder and the generator, D(·) denotes the discriminator function, and σ denotes the weight coefficient for adjusting the loss function L EG Of; embedding the MMD-based GAN structure to strengthen the feature learning ability of the bidirectional generative autoencoder. Given two sub-MMD definitions, it is expressed as:
[0054]
[0055] Where f denotes the kernel function; the cyclic consistency optimization objective in the data space, minimizing the loss function, is expressed as:
[0056]
[0057] Where x, Respectively denote the real image and the reconstructed image, and L MS-SSIM Denotes the loss term based on SSIM, and L l1 Denotes the element-wise L 1 Loss term, and α 2 Denotes T x The weight coefficient of the loss function.
[0058] It should also be noted that the algorithm process of the bidirectional generative autoencoder includes initializing the model parameters. In each training cycle, iteration is performed, and the iterative execution steps include training the discriminator D and the feature extraction block, training the generator G and the encoder E, and training the embedded GAN discriminator D Z , updating the encoder E, considering cyclic consistency.
[0059] Through the above training steps, the bidirectional generative autoencoder can simultaneously optimize the performance of the generator and the encoder during the training process, achieve bidirectional optimization of data generation and feature representation, and further improve the convergence and feature representation ability of the model through the embedded GAN structure and the optimized cyclic consistency loss.
[0060] S3: Based on the trained bidirectional generative autoencoder, perform bidirectional conversion between CAD drawings and SVG visualization models.
[0061] Furthermore, the bidirectional conversion between CAD drawings and SVG visualization models includes inputting the processed CAD drawing data into an optimized generation model to generate SVG graphics, and converting the generated SVG model back into CAD digital drawings through a reverse process.
[0062] Embodiment 2 is an embodiment of the present invention, which provides a secondary circuit diagram-model conversion method based on a bidirectional generative autoencoder. In order to verify the beneficial effects of the present invention, scientific demonstrations are carried out through economic benefit calculations and simulation experiments.
[0063] First of all, in order to verify the effectiveness of the secondary circuit diagram-model conversion method based on a bidirectional generative autoencoder, this embodiment is designed. A set of electrical CAD drawings is selected as the test object, which includes 50 different types of electrical circuit drawings with different degrees of complexity and characteristics, fully covering common elements and symbols in electrical design.
[0064] During the implementation process, data preprocessing of the CAD drawings is first carried out. Through image processing algorithms combined with convolutional neural networks (CNNs), operations such as noise removal and contrast adjustment are performed on the CAD drawings to ensure the clarity and recognizability of the input data. Subsequently, an automated tool is used to classify the graphic elements in the CAD drawings and generate a professional graphic element library covering electrical components such as switches, wiring, and components. Template matching technology is used to ensure the accurate identification and classification of graphic elements.
[0065] Next, a network design is carried out using the bidirectional generative autoencoder (BiGAN) framework. The Wasserstein distance and the GAN structure based on MMD are introduced into the repeated training process to strengthen the feature learning ability. During the training process, the processed CAD drawings are input into an optimized generation model to generate corresponding SVG graphics. The entire training process includes the calculation of the loss function and the optimization of parameters to ensure the bidirectional consistency between the encoder and the generator.
[0066] Finally, a bidirectional conversion between CAD drawings and SVG models is implemented, and the generated results are compared with the original drawings to evaluate their accuracy and effectiveness. At the same time, the experimental data of each step are recorded, including drawing types, conversion times, conversion accuracies, etc., and the test data shown in Table 1 below are obtained.
[0067] Table 1 Test data of each electrical drawing
[0068]
[0069] It can be seen from the experimental data that by comparing the drawing types, conversion time, and conversion accuracy, the overall conversion performance can be observed to be stable, and the conversion time is relatively short, indicating that the method of the present invention has improvement in execution efficiency. From the data in the table, it can be seen that the CAD and SVG conversion accuracies of the power wiring diagram have reached 95.3% and 94.8% respectively. In addition, the primitive recognition accuracy rate is as high as 96.5%, which proves the high efficiency of the technology of the present invention in the process of drawing parsing and conversion.
[0070] The overall loss function value also reflects the effectiveness of the method of the present invention. The total loss function value in the experiment ranges from 0.01 to 0.05, indicating that the loss function standard remains low during the conversion process, reflecting the good convergence of network training, indicating that the system of the present invention can achieve high stability during the training and generation processes, enhancing the consistency and accuracy of the generation results.
[0071] By comparing the method of the present invention with the existing electrical drawing conversion schemes, the existing methods generally can only reach a conversion accuracy rate of 85% - 90%, and often take longer conversion time when dealing with complex structures. The present invention successfully improves the automatic recognition and generation capabilities based on graphic information through the bidirectional generative autoencoder and the introduction of an advanced loss function optimization strategy, further ensuring the synchrony and effectiveness of high-dimensional complex data conversion, and making up for the deficiencies of the existing technology in the processing of electrical circuit drawings.
[0072] Example 3, referring to Figure 4 , is an embodiment of the present invention, which provides a secondary circuit diagram-model conversion system based on a bidirectional generative autoencoder, including a data preprocessing module, a training module, and a bidirectional conversion module.
[0073] Among them, the data preprocessing module is used for data preprocessing and primitive extraction, and constructs a primitive library; the training module is used to introduce the Wasserstein distance and fuse the GAN structure, design and train a bidirectional generative autoencoder, and optimize the latent space distribution; the bidirectional conversion module is used to perform bidirectional conversion between the CAD drawing and the SVG visualization model based on the trained bidirectional generative autoencoder.
[0074] If a function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0075] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a definite sequence list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other systems that can fetch instructions from the instruction execution system, apparatus, or device and execute the instructions), or in combination with these instruction execution systems, apparatuses, or devices. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by or in combination with an instruction execution system, apparatus, or device.
[0076] More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection part with one or more wirings (electronic device), a portable computer disk cartridge (magnetic device), random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber device, and portable compact disc read-only memory (CDROM). Additionally, a computer-readable medium can even be paper or other suitable media on which a program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other media, then editing, interpreting, or otherwise processing it as necessary, and then storing it in a computer memory.
[0077] It should be understood that various parts of the present invention can be implemented by hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, any one or a combination of the following techniques well known in the art can be used: discrete logic circuits having logic gate circuits for implementing logic functions on data signals, application specific integrated circuits having appropriate combinational logic gate circuits, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), and the like. It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention, and they should all be covered by the scope of the claims of the present invention.
[0078] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention, and they should all be covered by the scope of the claims of the present invention.
Claims
1. A secondary loop graph-to-model conversion method based on a bidirectional generative autoencoder, characterized in that: include: Data preprocessing and primitive extraction, and building primitive library; Introducing Wasserstein distance and fusion GAN structure, designing and training bidirectional generative autoencoders, and optimizing the potential space distribution; Based on the trained bidirectional generative autoencoder, bidirectional conversion between CAD drawings and SVG visualization models is performed.
2. The method for converting a secondary loop graph to a model based on a bidirectional generative autoencoder according to claim 1, characterized in that: The data preprocessing includes CAD drawing preprocessing and SVG model analysis; The CAD drawing preprocessing includes deleting and hiding irrelevant elements in the CAD drawing, assigning different elements in the drawing to different layers according to type, scaling the drawing according to requirements, aligning the drawing according to a unified coordinate system, adjusting image contrast, denoising the drawing, extracting geometric features and symbolic representations in the CAD drawing using an image processing algorithm combined with a convolutional neural network, and classifying the graphic elements in the CAD drawing through automated tools; The SVG model parsing includes extracting the hierarchical structure and path information based on XML parsing and encoding in a tree structure.
3. The method for converting a secondary loop graph to a model based on a bidirectional generative autoencoder according to claim 2, characterized in that: The construction of the graphic element library includes extracting and classifying electrical components in CAD drawings using template matching technology, defining matching templates through standard legends and data provided by equipment manufacturers, and using Logistics regression and cross entropy loss function to supervise and optimize the classification algorithm; In the template matching judgment stage, when the highest template category score of the predicted primitive group exceeds the preset threshold, the primitive group is successfully matched with the template, otherwise the matching fails.
4. The method for converting a secondary loop graph to a model based on a bidirectional generative autoencoder according to claim 3, characterized in that: The design and training of the bidirectional generative autoencoder includes introducing Wasserstein distance into the bidirectional generative autoencoder, extracting features in the bidirectional generative autoencoder by estimating and matching the Wasserstein of the joint distribution, embedding the GAN structure based on MMD, strengthening the feature learning ability of the bidirectional generative autoencoder, designing two additional loss terms to optimize the representation form and generate the generator G respectively, and enabling information extension constraints during decoding and encoding to ensure cycle consistency; The additional loss term T of the decoder G is calculated by SSIM-based block SSIM x , the discriminator D embedded in GAN z , two convolutional blocks F x and F z Features are extracted from the data space and the latent space respectively to realize the design of a bidirectional generative autoencoder.
5. The method for converting a secondary loop graph to a model based on a bidirectional generative autoencoder according to claim 4, characterized in that: The design and training of the bidirectional generative autoencoder further includes setting X, Z, as well as Respectively represent the space of real data, real potential data, generated data and encoded potential data, x and z are samples from space X and Z, and the generalized data space is expressed as: The generalized latent space is expressed as: The training of a bidirectional generative autoencoder involves inputting data samples to the encoder E, inputting potential samples to the generator G, and calculating the output to obtain samples in the generalized data space; The generalized data space sample includes processing the data sample through the encoder E to obtain the potential representation of the data sample, and processing the potential sample through the generator G to obtain the reconstruction of the data sample; Calculate the loss and gradient, estimate the joint distribution difference by using Wasserstein distance, measure the similarity between the generated samples and the real samples by using MMD maximum mean difference and MS-SSIM multi-scale structural similarity index; Optimize the model parameters, update the encoder E, generator G, discriminator D and related network parameters through the calculated losses and gradients, and gradually improve the performance of the generator and encoder through iterative optimization.
6. The method for converting a secondary loop graph to a model based on a bidirectional generative autoencoder according to claim 5, characterized in that: The design and training of the bidirectional generative autoencoder also includes introducing Wasserstein distance. Regarding Wasserstein distance, given and Between The loss function L DF Defined as training D, F x 、F z , expressed as: Among them, L DF represents the overall loss function associated with the discriminator, n b represents the batch size, represents the Wasserstein distance, λ represents the weight coefficient for adjusting the gradient penalty term, represents the gradient of the discriminator D, ||·||2 represents the two-norm, and the GP term means forcing D to obey the 1-lipschitz constraint; For encoder E and generator G, the loss function L EG Definition, expressed as: Among them, L EG represents the joint loss function of the encoder and the generator, D(·) represents the discriminator function, and σ represents the adjusted loss function L EG The weight coefficient of Embedding the MMD-based GAN structure strengthens the feature learning ability of the bidirectional generative autoencoder. Given two MMD definitions, it is expressed as: Where f represents the kernel function; The cycle consistency optimization objective in the data space is to minimize the loss function, which is expressed as: Among them, x, Represent the real image and the reconstructed image respectively, L MS-SSIM represents the loss term based on SSIM, L l1 represents the L1 loss term at the element level, and α2 represents T x The weight coefficient of the loss function.
7. The method for converting a secondary loop graph to a model based on a bidirectional generative autoencoder according to claim 6, characterized in that: The bidirectional conversion between the CAD drawing and the SVG visualization model includes inputting the processed CAD drawing data into an optimized generation model to generate SVG graphics, and converting the generated SVG model into a CAD digital drawing through a reverse process.
8. A system using the secondary loop graph-to-model conversion method based on a bidirectional generative autoencoder as claimed in any one of claims 1 to 7, characterized in that: Including data preprocessing module, training module, and bidirectional conversion module; The data preprocessing module is used for data preprocessing and primitive extraction, and constructing a primitive library; The training module is used to introduce Wasserstein distance and fusion GAN structure, design and train bidirectional generative autoencoders, and optimize potential space distribution; The bidirectional conversion module is used to perform bidirectional conversion between CAD drawings and SVG visualization models based on the trained bidirectional generative autoencoder.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the secondary loop graph-to-model conversion method based on a bidirectional generative autoencoder according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the secondary loop graph-to-model conversion method based on a bidirectional generative autoencoder according to any one of claims 1 to 7 are implemented.