Method and apparatus for generating ai model of cad model using single view
By adjusting the weights of the loss function and optimizing the normal loss function of the 3D model, and by fine-tuning the training with a CAD dataset, the generated CAD model has sharp edges and clear geometric contours, solving the problem of insufficient accuracy in CAD model generation in existing technologies and achieving efficient CAD model generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HARBIN INSTITUTE OF TECHNOLOGY (SHENZHEN) (INSTITUTE OF SCIENCE AND TECHNOLOGY INNOVATION HARBIN INSTITUTE OF TECHNOLOGY SHENZHEN)
- Filing Date
- 2026-02-26
- Publication Date
- 2026-06-09
AI Technical Summary
In existing technologies, graph-based 3D models trained on datasets with rich textures are difficult to meet the accuracy and performance requirements of CAD model generation tasks, especially when generating CAD models with regular shapes and simple textures. Existing model architectures and training methods cannot meet the accuracy and performance requirements.
By acquiring a CAD dataset, adjusting the weights of the loss function of the pre-trained graph-generated 3D model, optimizing the normal loss function, introducing a weight factor based on the angle between the normal and the observation ray, assigning differentiated weights to the normal prediction results with different confidence levels, and using the CAD dataset for fine-tuning training to generate a CAD model.
The generated CAD model has sharper edges and clearer geometric contours, solving the problem of insufficient accuracy of existing 3D models when applied to the CAD field, and improving the model's adaptability in CAD generation tasks.
Smart Images

Figure CN122174293A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer-aided design technology, and in particular to a method and apparatus for generating artificial intelligence (AI) models from computer-aided design models (CAD) using a single view. Background Technology
[0002] Image-based 3D is a current research hotspot in the fields of computer vision and 3D modeling. This technology can generate corresponding 3D mesh models based on 2D images and has broad application potential in fields such as mechanical design, 3D printing, and game modeling.
[0003] In current technologies, the technical approaches to image-generated 3D are showing a diversified development trend. Early research employed volumetric convolutional networks and generative adversarial networks to generate 3D objects from a probabilistic space. Following the success of diffusion models in the 2D domain, models such as Zero-123, through fine-tuning of the diffusion model, achieved multi-view image generation based on camera perspective and input image. Furthermore, researchers have drawn on experience from the field of natural language processing, proposing large-scale reconstruction models based on the Transformer architecture. Models such as InstantMesh combine the advantages of the diffusion approach with large-scale reconstruction models, achieving excellent results.
[0004] Current training datasets for image-generated 3D technology primarily consist of the Objaverse dataset, which features models with vibrant colors and rich textures, making it more suitable for scenarios such as game modeling. However, CAD models are characterized by regular shapes and simple textures. Existing model architectures and training methods are designed for datasets with rich textures, making it difficult to meet accuracy and performance requirements when directly applied to CAD model generation tasks. Summary of the Invention
[0005] This invention provides a method and apparatus for generating AI models from CAD models using a single view, in order to solve the problem in the prior art where CAD generation tasks cannot meet the accuracy and effect requirements due to different model characteristics.
[0006] In a first aspect, embodiments of the present invention provide a method for generating an AI model from a CAD model using a single view, comprising: Obtain the CAD dataset; The pre-trained graph-based 3D model is used as the baseline model, and the weights of the loss function of the baseline model are adjusted. The normal loss function of the baseline model is optimized, and a weighting factor based on the angle between the normal and the observation ray is introduced into the normal loss function to assign differentiated weights to the normal prediction results with different confidence levels. The adjusted baseline model is fine-tuned using the CAD dataset, and a single view of the CAD model is input into the trained AI model to output the corresponding CAD model.
[0007] In one possible implementation, adjusting the weights of the loss function of the baseline model includes: Increase the coefficient of the geometric loss term and decrease the coefficient of the texture loss term.
[0008] In one possible implementation, the geometry loss term includes depth loss and normal loss, and the texture loss term includes learned perceptual image patch similarity (Lpips) loss and mean squared error loss (MSE). The coefficients of the depth loss, the normal loss, the Lpips loss, and the MSE loss are adjusted to 1:1:1:1.
[0009] In one possible implementation, optimizing the normal loss function of the baseline model includes: Get the The angle between the true normal of the image and the angle of the observing light ray. Represents a positive integer greater than or equal to 1; Based on the included angle, a weighting factor is determined, and the closer the included angle is to 90 degrees, the smaller the value of the weighting factor. Based on the true normal and the predicted normal, calculate the normal map error of the k-th image; Based on the weighting factors and the corresponding normal map errors, the optimized normal loss function is obtained.
[0010] In one possible implementation, determining the weighting factor based on the included angle includes: When the cosine of the included angle is greater than a preset threshold, the corresponding weighting factor is determined to be 0. When the cosine of the included angle is not greater than a preset threshold, then according to Determine the corresponding weighting factors; where, Indicates the first The weighting factors of the chart, Indicates the first Observe the direction of the light in the image. Indicates the first The normal to the image; Based on the true normal and the predicted normal, the normal map error of the k-th image is calculated, including: according to Calculate the normal plot error of the k-th image; In the formula, Indicates the first Error in the normal plot of the image. The model predicts the first The normals of the image.
[0011] In one possible implementation, the optimized normal loss function is obtained based on the weighting factor and the corresponding normal map error, including: according to The optimized normal loss function is obtained; In the formula, This represents the optimized normal loss function.
[0012] In one possible implementation, the CAD dataset includes mechanical component models and corresponding multi-view depth maps, normal maps, RGB maps, and mask maps; The acquisition of the CAD dataset includes: Filter different categories of mechanical component models from a benchmark dataset of mechanical components; All mechanical component models were normalized. A camera viewpoint is set in the scene, and a combination of fixed viewpoint and random sampling is used to render the normalized mechanical parts models from multiple perspectives, resulting in depth maps, normal maps, red, green and blue (RGB) maps, and mask maps for each mechanical part model from multiple perspectives. A CAD dataset is constructed based on the mechanical component model and the multi-view depth map, normal map, RGB map and mask map of each mechanical component model.
[0013] In one possible implementation, the adjusted baseline model is fine-tuned using the CAD dataset, including: The depth map, normal map, RGB map, and mask map of each mechanical component model are used as inputs, and the corresponding mechanical component model is used as output to fine-tune the adjusted baseline model.
[0014] Secondly, embodiments of the present invention provide an apparatus for generating an AI model from a CAD model using a single view, comprising: The acquisition module is used to acquire CAD datasets; The processing module is used to take the pre-trained graph-generated 3D model as a baseline model and adjust the weights of the loss function of the baseline model. The processing module is also used to optimize the normal loss function of the benchmark model. The normal loss function introduces a weight factor based on the angle between the normal and the observation ray, and assigns differentiated weights to the normal prediction results with different confidence levels. The training module is used to fine-tune the adjusted baseline model using the CAD dataset to obtain the AI model; The processing module is also used to input a single view of the CAD model into the AI model and output the corresponding CAD model.
[0015] Thirdly, embodiments of the present invention provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method described in the first aspect or any possible implementation thereof.
[0016] This invention provides a method and apparatus for generating AI models from CAD models using a single view. The method involves acquiring a CAD dataset; using a pre-trained image-generated 3D model as a baseline model; adjusting the weights of the baseline model's loss function; optimizing the baseline model's normal loss function by introducing a weight factor based on the angle between the normal and the observation ray, and assigning differentiated weights to normal prediction results with different confidence levels; fine-tuning the adjusted baseline model using the CAD dataset; and inputting the single view of the CAD model into the trained AI model to output the corresponding CAD model. This invention, by adjusting the weights of the baseline model's loss function, focuses on the core features of the CAD model's regular shape, while optimizing the normal loss function to reduce interference from low-confidence prediction errors. This results in a more distinct CAD model with clearer edges and geometric contours, solving the problem of insufficient accuracy when existing image-generated 3D models are applied to the CAD field. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating the implementation of the method for generating AI models from CAD models using a single view, as provided in an embodiment of the present invention. Figure 2 This is a schematic diagram of the graphical 3D model provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the actual normal and the observed light ray provided in an embodiment of the present invention; Figure 4This is a schematic diagram of the loss value provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the device for generating AI models from CAD models using a single view, provided in an embodiment of the present invention. Figure 6 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0019] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0020] See Figure 1 The document illustrates a flowchart of the method for generating AI models from CAD models using a single view, as provided in an embodiment of the present invention. Details are as follows: Step 101: Obtain the CAD dataset.
[0021] In this step, the acquisition of the CAD dataset requires three core steps: model selection, normalization processing, and multi-view image acquisition. This ensures that the dataset can meet the subsequent model fine-tuning requirements and provide accurate supervision information for CAD model generation.
[0022] In one embodiment, obtaining a CAD dataset includes: Filter mechanical component models from different categories in the Mechanical Components Benchmark (MCB) dataset. The filtered mechanical component models can include at least one category of bearings, bolts, flanges, gears, nuts, and springs. All mechanical component models are normalized to eliminate the impact of model size differences on the rendering results; A camera viewpoint is set in the scene, and a combination of fixed viewpoint and random sampling is used to render the normalized mechanical parts models from multiple perspectives, resulting in depth maps, normal maps, RGB maps and mask maps of each mechanical part model from multiple perspectives. A CAD dataset is constructed based on mechanical component models and multi-view depth maps, normal maps, RGB maps, and mask maps of each mechanical component model.
[0023] Optionally, considering that the CAD model generation task needs to focus on the mechanical field and ensure the professionalism and representativeness of the dataset, this embodiment selects mechanical component models from MCB to form the CAD dataset. The MCB dataset, built by the Purdue University team, is the first large-scale labeled benchmark dataset in the field of mechanical engineering for the task of classifying and retrieving mechanical components. The categories of mechanical parts it covers are highly consistent with actual industrial scenarios, which can effectively avoid the problem of general datasets being out of touch with the needs of the CAD field.
[0024] During the selection process, rigorous sampling was conducted from multiple representative categories in the MCB dataset. The selected mechanical component models needed to cover common core component types in industrial production, specifically including at least one category of bearings, bolts, flanges, gears, nuts, and springs. To balance training effectiveness and data volume, 3 to 4 models were selected as training set samples for each category, and 1 to 2 models were selected as validation set samples. This ensured that the models could learn the geometric feature patterns of different categories of mechanical components during training, while the validation set was used to accurately evaluate the model's generalization ability.
[0025] Because different mechanical component models have significant dimensional differences in actual design (e.g., the size difference between bolts and flanges is substantial), directly using them for image rendering would lead to inconsistencies in the rendering results due to size discrepancies, thus affecting the learning accuracy of geometric features during subsequent model training. Therefore, all selected mechanical component models need to be normalized. Each mechanical component model is uniformly placed within a cube with a side length of 2. By scaling coordinates and adjusting positions, the proportion and relative position of all models in the three-dimensional space are kept consistent, completely eliminating the interference of model size differences on subsequent rendering results. This ensures that the supervision information such as depth maps and normal maps of different models are generated under the same size benchmark, laying the foundation for the model to learn a unified geometric feature scale.
[0026] To enable the subsequently trained model to learn the geometric structure of mechanical parts from multiple dimensions, a strategy combining fixed viewpoint and random sampling is needed to set the camera viewpoint. Depth maps, normal maps, RGB maps, and mask maps from multiple viewpoints are then obtained using professional rendering tools. The specific steps are as follows: Rendering tools and scene setup: Blender software was used to develop a model rendering strategy. Normalized mechanical parts models were imported into the Blender 3D scene to build a rendering environment that matches the actual observed scene, ensuring that the rendered image can realistically reflect the geometry of the mechanical parts. Camera perspective settings: Fixed viewpoint setting: The first viewpoint is set to a fixed frontal viewpoint, with the camera precisely positioned in front of the object in the negative Y-axis direction. This viewpoint serves as the standard observation benchmark, ensuring that all models have a unified "benchmark view" and avoiding feature learning bias caused by differences in the initial viewpoint. Random viewpoint sampling: In addition to the fixed viewpoint, other viewpoints are generated through random spherical sampling. Optionally, camera positions are randomly selected on a virtual sphere with a radius of 1.9-2.6 and a height of -0.75 to 1.6, allowing the camera to surround the object from multiple angles. The height distribution matches the observation habits of mechanical parts in actual industrial scenarios (such as including both horizontal and some top and bottom views), ensuring that the acquired viewpoints can fully cover the surface geometry of the mechanical parts.
[0027] By setting the above perspectives, each mechanical component model is rendered, ultimately yielding depth maps, normal maps, RGB maps, and mask maps from 32 different viewpoints. The depth map reflects the distance between each point on the model surface and the camera, providing depth dimension information for geometric feature learning; the normal map represents the direction of the normal vectors on the model surface, helping the model capture key geometric details such as edges and corners; the RGB map provides appearance information of the model; and the mask map distinguishes the model area from the background area, eliminating the influence of background interference on training. These four types of information together constitute the complete supervised data required for model training.
[0028] Step 102: Use the pre-trained graph-generated 3D model as the baseline model and adjust the weights of the loss function of the baseline model.
[0029] Since the training datasets of existing pre-trained graph-based 3D models are mostly general 3D model datasets with vivid colors and rich textures, the corresponding loss function weights are more focused on texture reproduction. However, this embodiment is used to generate CAD models with regular shapes and simple textures. The core requirement is to ensure the geometric accuracy of the model. Therefore, it is necessary to make targeted adjustments to the loss function weights of the benchmark model.
[0030] See Figure 2 The diagram shown is a schematic of a graph-based 3D model, which can also be called an instantmesh model.
[0031] The instantmesh model first generates multiple views (Mv) using a Multi-view Diffusion Model (MDM). The instantmesh model uses the zero123++ model, which can generate up to six views. These generated images are then directly received by a Sparse-view Large Reconstruction Model (SLRM). The SLRM first encodes the images into image tokens using a VisionTransformer (VIT). Subsequently, a Triplane Decoder decodes the features of the image tokens into a triplane, and then uses Flexi Cubes to quickly extract a high-quality 3D mesh. The model was originally trained using the objaverse dataset. After differentiable rendering of the generated model, supervised training was performed using loss functions such as mean squared error and perceptual similarity loss for texture-related information, as well as geometric-related loss functions such as normal and depth loss.
[0032] This step fine-tunes the weights of the loss function in the baseline model. After loading the original weights into InstantMesh, they are fine-tuned using a subset of CAD data. In one embodiment, adjusting the weights of the baseline model's loss function includes increasing the coefficients of the geometric loss term and decreasing the coefficients of the texture loss term. This weight allocation allows the model to focus more on fitting and optimizing the geometric features of the CAD model during subsequent fine-tuning training, reducing excessive attention to texture features, thereby adapting to the generation requirements of the CAD model.
[0033] Optionally, the geometric loss term includes depth loss and normal loss. The depth loss is used to constrain the consistency between the depth information of the generated CAD model and the depth information of the real CAD model, while the normal loss is used to constrain the consistency between the surface normal direction of the generated CAD model and the surface normal direction of the real CAD model. Together, they ensure the geometric accuracy of the CAD model. Texture loss terms include Lpips loss and MSE loss. Lpips loss measures the perceptual similarity between the generated image and the real image, while MSE loss measures the pixel-level error between the generated image and the real image. Both are used to help constrain the rendering effect of the model.
[0034] To achieve the optimal balance between geometric accuracy and rendering effect, and to adapt to the characteristics of CAD models with simple textures and a focus on geometry, the coefficients of depth loss, normal loss, Lpips loss, and MSE loss are adjusted to 1:1:1:1. This coefficient ratio ensures that the geometric loss terms play a dominant role, guaranteeing the accuracy of the geometric structure of the CAD model, while also avoiding severe distortion in the generated image through appropriate constraints on the texture loss terms, thus taking into account the overall effect of the generated model.
[0035] Table 1 shows a comparison of the changes in the weights of the loss items.
[0036] Table 1
[0037] Step 103: Optimize the normal loss function of the baseline model. Introduce a weighting factor based on the angle between the normal and the observed ray into the normal loss function, and assign differentiated weights to the normal prediction results with different confidence levels.
[0038] The core objective of the normal loss function in existing benchmark models is to measure the difference between the predicted normal map and the true normal map in the direction of the normal vector. The most common form is based on the vector dot product, i.e. In the formula, This represents the normal loss function of the existing benchmark model. Represents the actual mask image. Indicates the predicted normal. Represents the true normal.
[0039] The existing benchmark model's normal loss function does not consider the difference in the reliability of normal prediction results under different viewpoints, and uses equal weights to calculate the normal prediction error. However, CAD models have the characteristics of regular shape and prominent geometric features, and the reliability of normal prediction under different viewpoints varies significantly. If the original loss function is used and calculated with equal weights, the error in the low reliability region will excessively interfere with model training and affect the generation accuracy of the geometric structure of the CAD model. Therefore, it is necessary to optimize the normal loss function of the benchmark model.
[0040] In one embodiment, optimizing the normal loss function of the baseline model includes: Get the The angle between the true normal of the image and the angle of the observing light ray. Represents a positive integer greater than or equal to 1; The weighting factor is determined based on the included angle, and the closer the included angle is to 90 degrees, the smaller the value of the weighting factor. Calculate the normal map error of the k-th image based on the true normal and the predicted normal; Based on the weighting factors and the corresponding normal plot errors, the optimized normal loss function is obtained.
[0041] Optionally, the observation ray is a vector pointing from the camera's optical center to the corresponding pixel on the pixel plane; see [link to relevant documentation]. Figure 3 As shown, the dashed lines represent the observation rays, and the true normals are the actual surface normals corresponding to the mechanical component models in the CAD dataset. These can be calculated by the renderer from the mesh model and generally represent the normal vector of the mesh surface for that pixel. See [link to relevant documentation]. Figure 3 As shown, the solid lines represent the true normals.
[0042] Subsequently, weight factors are determined based on the included angle, and the principle of "the closer the included angle is to 90 degrees, the smaller the value of the weight factor" is followed to achieve differentiated weight allocation for normal prediction results with different confidence levels. Specifically, the closer the included angle between the normal and the observed ray is to 90 degrees, the lower the confidence level of the normal prediction result, and the smaller the weight factor is assigned to reduce its interference with the overall loss. The farther the included angle is from 90 degrees, the higher the confidence level of the normal prediction result, and the larger the weight factor is assigned to strengthen its constraint effect on model training.
[0043] In one embodiment, determining the weighting factor based on the included angle includes: When the cosine of the included angle is greater than a preset threshold, the corresponding weight factor is determined to be 0. When the cosine of the included angle is not greater than a preset threshold, then according to Determine the corresponding weighting factors; where, Indicates the first The weighting factors of the chart, Indicates the first Observe the direction of the light in the image. Indicates the first The normals of the image.
[0044] While determining the weighting factors, the normal map error of the k-th image is calculated based on the true normal and the predicted normal. In one embodiment, according to... Calculate the normal plot error of the k-th image; where, Indicates the first Error in the normal plot of the image. The model predicts the first The normals of an image. This formula can accurately measure the degree of deviation between the predicted and actual normals in a single image.
[0045] Finally, based on the weighting factors and the corresponding normal map errors, the optimized normal loss function is obtained. In one embodiment, based on... The optimized normal loss function is obtained; where, This represents the optimized normal loss function. This optimized normal loss function allows for differentiated weighting of normal prediction errors at different confidence levels, enabling the model training process to focus more on normal optimization in high-confidence regions, effectively reducing interference from errors in low-confidence regions. This, in turn, improves the clarity of the geometric contours and the sharpness of the edges of the CAD model, ensuring the accuracy of the generated CAD model.
[0046] Step 104: Use the CAD dataset to fine-tune the adjusted baseline model, and input a single view of the CAD model into the trained AI model to output the corresponding CAD model.
[0047] After adjusting the weights of the loss function of the baseline model in step 102 and optimizing the normal loss function of the baseline model in step 103, the baseline model has the basic conditions to adapt to the CAD model generation task. However, the model is still in a pre-trained state, and its parameter settings have not been adapted to the CAD dataset in this method. Therefore, it cannot directly meet the accuracy requirements for CAD model generation. Thus, it is necessary to use the CAD dataset to fine-tune the adjusted baseline model, so that the model can gradually learn the mechanical part model features of the CAD dataset, further optimize the model parameters, and improve the model's ability to generate CAD models.
[0048] During fine-tuning, training parameters adapted to the CAD dataset and adjusted model must be used to ensure training efficiency and effectiveness. Optionally, training can be performed on a 40GB A100 graphics card, with a batch size of 2 (meaning two data samples are input to the model for each iteration) and a base learning rate of [missing information]. The learning rate is controlled by a cosine annealing algorithm with a cycle of 10,000 steps. The cosine annealing algorithm can dynamically adjust the learning rate to avoid overfitting or slow convergence during model training. At the same time, the AdamW optimizer is selected, which can effectively alleviate the gradient vanishing problem, improve the stability and convergence speed of model training, and ensure the smooth progress of fine-tuning training.
[0049] During the fine-tuning training process, the model takes multi-view depth maps, normal maps, RGB maps, and mask maps from the CAD dataset as inputs and the corresponding mechanical part models as output targets. By combining the adjusted loss function weights and the optimized normal loss function, the model parameters are continuously iterated and optimized until the model converges, resulting in a trained AI model. At this point, the AI model has fully learned the geometric structural features of the CAD model and can accurately adapt to the CAD model generation task.
[0050] Optionally, to verify the effect of adjusting the loss function weights, this embodiment uses the improved normal loss function, as well as the original loss function weights and the adjusted loss function weights for model training. Table 2 shows the evaluation index diagram of the validation set. It can be seen that the evaluation index of the validation set corresponding to the adjusted loss function weights has decreased, and the effect is better.
[0051] Table 2
[0052] Optionally, to verify the optimization effect of the normal loss function, this embodiment employs three different methods for model training: combining the original loss function weights with the original normal loss function, combining the adjusted loss function weights with the original normal loss function, and combining the adjusted loss function weights with the improved normal loss function. Figure 4 The diagram showing the loss values illustrates that the combination of the adjusted loss function weights and the improved normal loss function results in the smallest loss values for different training steps, and the loss values decrease as the number of training steps increases.
[0053] After the model fine-tuning training is completed, the CAD model generation stage can begin: a single view of the CAD model to be generated is input into the trained AI model. The AI model will parse and reconstruct the input single view based on the CAD model features learned during training, automatically generate a complete CAD model corresponding to the single view, and finally output and export the CAD model, achieving the goal of quickly and accurately generating CAD models based on single views, effectively solving the problem of insufficient accuracy when existing technologies are applied to CAD model generation.
[0054] It should be noted that the AI model is the target model obtained by fine-tuning and training the adjusted baseline model.
[0055] This invention provides a method for generating AI models from CAD models using a single view. The method involves acquiring a CAD dataset; using a pre-trained image-generated 3D model as a baseline model; adjusting the weights of the baseline model's loss function; optimizing the baseline model's normal loss function by introducing a weight factor based on the angle between the normal and the observation ray, and assigning differentiated weights to normal prediction results with different confidence levels; fine-tuning the adjusted baseline model using the CAD dataset; and inputting the single view of the CAD model into the trained AI model to output the corresponding CAD model. This invention, by adjusting the weights of the baseline model's loss function, focuses on the core features of the CAD model's regular shape, while optimizing the normal loss function to reduce interference from low-confidence prediction errors. This results in a more defined CAD model with clearer geometric contours, solving the problem of insufficient accuracy when existing image-generated 3D models are applied to the CAD field.
[0056] This invention employs a CAD dataset to fine-tune a benchmark model, combined with weight adjustments to the loss function. This allows the model to fully learn the characteristics of CAD models, such as their simple textures and clear structures. This overcomes the scene adaptation bias caused by existing models' reliance on general datasets, and significantly improves the model's adaptability in CAD generation tasks.
[0057] This invention realizes the entire process of single-view input—AI automatic generation of CAD models, without the need for professionals to manually model using complex software such as SolidWorks. It not only solves the pain point of missing the original CAD model when replicating old parts, but also lowers the modeling threshold for consumer-grade 3D printing, while improving the work efficiency in mechanical design, 3D printing and other fields, and further expanding the application boundaries of the technology.
[0058] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0059] The following are device embodiments of the present invention. For details not described in detail, please refer to the corresponding method embodiments described above.
[0060] Figure 5 The diagram illustrates a device for generating AI models from CAD models using a single view, according to an embodiment of the present invention. For ease of explanation, only the parts relevant to the embodiment of the present invention are shown, and are described in detail below: like Figure 5 As shown, the device for generating an AI model from a CAD model using a single view includes: an acquisition module 51, a processing module 52, and a training module 53.
[0061] Module 51 is used to acquire CAD datasets; Processing module 52 is used to use the pre-trained graph-generated 3D model as a baseline model and adjust the weights of the loss function of the baseline model. The processing module 52 is also used to optimize the normal loss function of the benchmark model. The normal loss function introduces a weight factor based on the angle between the normal and the observation ray, and assigns differentiated weights to the normal prediction results with different confidence levels. Training module 53 is used to fine-tune the adjusted baseline model using the CAD dataset to obtain the AI model; The processing module 52 is also used to input a single view of the CAD model into the AI model and output the corresponding CAD model.
[0062] In one possible implementation, when processing module 52 adjusts the weights of the loss function of the baseline model, it is used for: Increase the coefficient of the geometric loss term and decrease the coefficient of the texture loss term.
[0063] In one possible implementation, the geometry loss term includes depth loss and normal loss, and the texture loss term includes Lpips loss and MSE loss. The coefficients of depth loss, normal loss, Lpips loss, and MSE loss are adjusted to 1:1:1:1.
[0064] In one possible implementation, when processing module 52 optimizes the normal loss function of the baseline model, it is used for: Get the The angle between the true normal of the image and the angle of the observing light ray. Represents a positive integer greater than or equal to 1; The weighting factor is determined based on the included angle, and the closer the included angle is to 90 degrees, the smaller the value of the weighting factor. Calculate the normal map error of the k-th image based on the true normal and the predicted normal; Based on the weighting factors and the corresponding normal plot errors, the optimized normal loss function is obtained.
[0065] In one possible implementation, when processing module 52 determines the weighting factor based on the included angle, it is used for: When the cosine of the included angle is greater than a preset threshold, the corresponding weight factor is determined to be 0. When the cosine of the included angle is not greater than a preset threshold, then according to Determine the corresponding weighting factors; where, Indicates the first The weighting factors of the chart, Indicates the first Observe the direction of the light in the image. Indicates the first The normal to the image; Based on the true normals and the predicted normals, calculate the normal map error of the k-th image, including: according to Calculate the normal plot error of the k-th image; In the formula, Indicates the first Error in the normal plot of the image. The model predicts the first The normals of the image.
[0066] In one possible implementation, when processing module 52 obtains the optimized normal loss function based on the weighting factors and the corresponding normal map errors, it is used for: according to The optimized normal loss function is obtained; In the formula, This represents the optimized normal loss function.
[0067] In one possible implementation, the CAD dataset includes mechanical component models and corresponding multi-view depth maps, normal maps, RGB maps, and mask maps; When module 51 acquires the CAD dataset, it is used for: Filter different categories of mechanical component models from a benchmark dataset of mechanical components; All mechanical component models were normalized. A camera viewpoint is set in the scene, and a combination of fixed viewpoint and random sampling is used to render the normalized mechanical parts models from multiple perspectives, resulting in depth maps, normal maps, RGB maps and mask maps of each mechanical part model from multiple perspectives. A CAD dataset is constructed based on mechanical component models and multi-view depth maps, normal maps, RGB maps, and mask maps of each mechanical component model.
[0068] In one possible implementation, when training module 53 uses the CAD dataset to fine-tune the adjusted baseline model, it is used for: The depth map, normal map, RGB map, and mask map of each mechanical component model are used as inputs, and the corresponding mechanical component model is used as output to fine-tune the adjusted baseline model.
[0069] The above embodiments provide an apparatus for generating AI models from CAD models using a single view. The apparatus acquires a CAD dataset via an acquisition module; the processing module uses a pre-trained image-generated 3D model as a baseline model, adjusting the weights of the baseline model's loss function and optimizing its normal loss function. The normal loss function incorporates a weight factor based on the angle between the normal and the observation ray, assigning differentiated weights to normal prediction results of different confidence levels; the training module fine-tunes the adjusted baseline model using the CAD dataset; and the processing module inputs the single view of the CAD model into the trained AI model, outputting the corresponding CAD model. This invention, by adjusting the weights of the baseline model's loss function, focuses on the core features of the CAD model's regular shape, while simultaneously optimizing the normal loss function to reduce interference from low-confidence prediction errors. This results in a more distinct CAD model with clearer edges and geometric contours, solving the problem of insufficient accuracy when existing image-generated 3D models are applied to the CAD field.
[0070] This invention employs a CAD dataset to fine-tune a benchmark model, combined with weight adjustments to the loss function. This allows the model to fully learn the characteristics of CAD models, such as their simple textures and clear structures. This overcomes the scene adaptation bias caused by existing models' reliance on general datasets, and significantly improves the model's adaptability in CAD generation tasks.
[0071] This invention realizes the entire process of single-view input—AI automatic generation of CAD models, without the need for professionals to manually model using complex software such as SolidWorks. It not only solves the pain point of missing the original CAD model when replicating old parts, but also lowers the modeling threshold for consumer-grade 3D printing, while improving the work efficiency in mechanical design, 3D printing and other fields, and further expanding the application boundaries of the technology.
[0072] Figure 6 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. For example... Figure 6 As shown, the electronic device 6 of this embodiment includes a processor 60 and a memory 61. The memory 61 stores a computer program 62. When the processor 60 executes the computer program 62, it implements the steps in the various method embodiments described above. Alternatively, when the processor 60 executes the computer program 62, it implements the functions of each module / unit in the various device embodiments described above.
[0073] For example, computer program 62 may be divided into one or more modules / units, which are stored in memory 61 and executed by processor 60 to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of computer program 62 in electronic device 6.
[0074] Electronic device 6 may include, but is not limited to, processor 60 and memory 61. Those skilled in the art will understand that... Figure 6 This is merely an example of electronic device 6 and does not constitute a limitation on electronic device 6. It may include more or fewer components than shown, or combine certain components, or different components. For example, electronic device 6 may also include input / output devices, network access devices, buses, etc.
[0075] The processor 60 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.
[0076] The memory 61 can be an internal storage unit of the electronic device 6, such as a hard disk or RAM. The memory 61 can also be an external storage device of the electronic device 6, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, the memory 61 can include both internal and external storage units of the electronic device 6. The memory 61 is used to store the computer program 62 and other programs and data required by the electronic device 6. The memory 61 can also be used to temporarily store data that has been output or will be output.
[0077] For the sake of simplicity and clarity, only the above-described functional modules / units are used as examples. In practical applications, the functions described above can be assigned to different functional modules / units as needed. These modules / units can be implemented in hardware, software, or a combination of both.
[0078] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the methods described in the above-described method embodiments.
[0079] This invention also provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the methods described in the above-described method embodiments.
[0080] Computer programs include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. Computer-readable media can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0081] In the above embodiments, the descriptions of each embodiment have their own emphasis. Parts not detailed or described in a particular embodiment can be referred to in the relevant descriptions of other embodiments. Unless otherwise specified or in conflict with logic, the terminology and / or descriptions between different embodiments are consistent and can be referenced interchangeably. Technical features in different embodiments can be combined to form new embodiments based on their inherent logical relationships.
[0082] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A method for generating AI models from CAD models using a single view, characterized in that, include: Obtain the CAD dataset of computer-aided design models; The pre-trained graph-based 3D model is used as the baseline model, and the weights of the loss function of the baseline model are adjusted. The normal loss function of the baseline model is optimized, and a weighting factor based on the angle between the normal and the observation ray is introduced into the normal loss function to assign differentiated weights to the normal prediction results with different confidence levels. The adjusted baseline model is fine-tuned using the CAD dataset, and a single view of the CAD model is input into the trained AI model to output the corresponding CAD model.
2. The method for generating AI models from CAD models using a single view according to claim 1, characterized in that, Adjusting the weights of the loss function of the baseline model includes: Increase the coefficient of the geometric loss term and decrease the coefficient of the texture loss term.
3. The method for generating AI models from CAD models using a single view according to claim 2, characterized in that, The geometric loss term includes: depth loss and normal loss; the texture loss term includes: perceptual similarity Lpips loss and mean squared error MSE loss. The coefficients of the depth loss, the normal loss, the Lpips loss, and the MSE loss are adjusted to 1:1:1:
1.
4. The method for generating AI models from CAD models using a single view according to any one of claims 1-3, characterized in that, Optimizing the normal loss function of the baseline model includes: Get the The angle between the true normal of the image and the angle of the observing light ray. Represents a positive integer greater than or equal to 1; Based on the included angle, a weighting factor is determined, and the closer the included angle is to 90 degrees, the smaller the value of the weighting factor. Based on the true normal and the predicted normal, calculate the first... Error in the normal plot of the image; Based on the weighting factors and the corresponding normal map errors, the optimized normal loss function is obtained.
5. The method for generating AI models from CAD models using a single view according to claim 4, characterized in that, Based on the included angle, the weighting factor is determined, including: When the cosine of the included angle is greater than a preset threshold, the corresponding weighting factor is determined to be 0. When the cosine of the included angle is not greater than a preset threshold, then according to Determine the corresponding weighting factors; where, Indicates the first The weighting factors of the chart, Indicates the first Observe the direction of the light in the image. Indicates the first The normal to the image; Based on the true normal and the predicted normal, calculate the first... The normal plot error of the image includes: according to Calculate the first Error in the normal plot of the image; In the formula, Indicates the first Error in the normal plot of the image. The model predicts the first The normals of the image.
6. The method for generating AI models from CAD models using a single view according to claim 5, characterized in that, Based on the weighting factors and the corresponding normal map errors, the optimized normal loss function is obtained, including: according to The optimized normal loss function is obtained; In the formula, This represents the optimized normal loss function.
7. The method for generating AI models from CAD models using a single view according to claim 6, characterized in that, The CAD dataset includes mechanical component models and corresponding multi-view depth maps, normal maps, RGB maps (red, green, and blue), and mask maps; The acquisition of the CAD dataset includes: Filter different categories of mechanical component models from a benchmark dataset of mechanical components; All mechanical component models were normalized. A camera viewpoint is set in the scene, and a combination of fixed viewpoint and random sampling is used to render the normalized mechanical parts models from multiple perspectives, resulting in depth maps, normal maps, RGB maps and mask maps of each mechanical part model from multiple perspectives. A CAD dataset is constructed based on the mechanical component model and the multi-view depth map, normal map, RGB map and mask map of each mechanical component model.
8. The method for generating AI models from CAD models using a single view according to claim 7, characterized in that, Fine-tuning the adjusted baseline model using the aforementioned CAD dataset includes: The depth map, normal map, RGB map, and mask map of each mechanical component model are used as inputs, and the corresponding mechanical component model is used as output to fine-tune the adjusted baseline model.
9. An apparatus for generating AI models from CAD models using a single view, characterized in that, include: The acquisition module is used to acquire CAD datasets; The processing module is used to take the pre-trained graph-generated 3D model as a baseline model and adjust the weights of the loss function of the baseline model. The processing module is also used to optimize the normal loss function of the benchmark model. The normal loss function introduces a weight factor based on the angle between the normal and the observation ray, and assigns differentiated weights to the normal prediction results with different confidence levels. The training module is used to fine-tune the adjusted baseline model using the CAD dataset to obtain the AI model; The processing module is also used to input a single view of the CAD model into the AI model and output the corresponding CAD model.
10. An electronic device, characterized in that, It includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method as described in any one of claims 1 to 8.