Self-supervised pre-training and transfer learning-based primitive recognition method and related device
By adopting self-supervised pre-training and transfer learning methods in the element recognition model, a binary autoencoder network is built and adaptive mask generation is performed, which solves the problem that existing models cannot effectively understand the element correlation, and achieves a more accurate and efficient element recognition effect.
Patent Information
- Application Number
- CN202411675204.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-04-15
AI Technical Summary
During the training process, existing element recognition models focus on the characteristics of the element itself and cannot effectively understand the correlation between different elements in the drawing, resulting in the limitation of the accuracy and generalization of the model, and it is impossible to achieve more accurate and efficient element recognition.
Using a method based on self-supervised pre-training and transfer learning, a binarized autoencoder network is constructed, and CAD image data is binarized and adaptive mask generation is generated, and a self-supervised pre-training is performed to obtain the initial element recognition model. Through transfer learning and adjustment processing, a more accurate target element recognition model is obtained.
It improves the accuracy and generalization of the element recognition model, reduces the development and iteration costs, and achieves a more accurate and efficient element recognition effect.
Smart Images

Figure CN119832585A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a primitive recognition method based on self-supervised pre-training and transfer learning and a related device. Background Art
[0002] The current primitive recognition model is mainly based on target detection technology to extract primitive targets in Computer-Aided Design (CAD) drawings. Usually, primitives can be annotated on a primitive recognition dataset consisting of a large number of CAD drawings, such as annotating the location, size, and category of all primitives, so that a primitive recognition model can be trained and obtained based on the annotated primitive dataset using supervised training. However, the primitive recognition model trained by this method mainly focuses on the characteristics of each primitive itself, and has little understanding of the correlation between different primitives in the drawings, resulting in the accuracy and generalization of the trained model being limited, and the purpose of more accurate and efficient primitive recognition cannot be achieved. Summary of the invention
[0003] The present invention provides a method and related device for primitive recognition based on self-supervised pre-training and transfer learning to solve the technical problem that more accurate and efficient primitive recognition cannot be achieved.
[0004] In the first aspect, a primitive recognition method based on self-supervised pre-training and transfer learning is provided, comprising:
[0005] Acquire CAD image data;
[0006] Based on the encoder network and the decoder network, a binary autoencoder network is constructed;
[0007] Binarization processing is performed on the CAD image data to obtain binary image data;
[0008] Performing adaptive mask generation on the binary image data to obtain adaptive mask image data;
[0009] According to the adaptive mask image data, the binary autoencoder network is pre-trained by self-supervision to obtain the initial primitive recognition model;
[0010] The initial primitive recognition model is subjected to transfer learning and adjustment processing to obtain the target primitive recognition model.
[0011] In a second aspect, a primitive recognition device based on self-supervised pre-training and transfer learning is provided, comprising:
[0012] An acquisition module, used for acquiring CAD image data;
[0013] A first processing module is used to construct a binary autoencoder network based on the encoder network and the decoder network;
[0014] The second processing module is used to perform binarization processing on the CAD image data to obtain binarized image data;
[0015] A third processing module is used to perform adaptive mask generation on the binary image data to obtain adaptive mask image data;
[0016] The fourth processing module is used to perform self-supervisory pre-training on the binary autoencoder network according to the adaptive mask image data to obtain an initial primitive recognition model;
[0017] The fifth processing module is used to perform transfer learning and adjustment processing on the initial primitive recognition model to obtain a target primitive recognition model.
[0018] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the above-mentioned method for primitive recognition based on self-supervised pre-training and transfer learning are implemented.
[0019] In a fourth aspect, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the steps of the above-mentioned primitive recognition method based on self-supervised pre-training and transfer learning are implemented.
[0020] In the scheme implemented by the above-mentioned primitive recognition method and related devices based on self-supervised pre-training and transfer learning, by acquiring CAD image data, and constructing a binarized autoencoder network based on the encoder network and the decoder network, the CAD image data is further binarized to obtain binarized image data, so that adaptive mask generation can be performed on the binarized image data to obtain adaptive mask image data, and the binarized autoencoder network is self-supervised pre-trained according to the adaptive mask image data to obtain an initial primitive recognition model, and then the initial primitive recognition model can be transfer learned and adjusted to obtain a more accurate target primitive recognition model, which is conducive to achieving more accurate and more efficient primitive recognition based on the target primitive recognition model. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0022] Figure 1 is a schematic diagram of an application environment of a primitive recognition method based on self-supervised pre-training and transfer learning in one embodiment of the present invention;
[0023] Figure 2 is a flow chart of a method for primitive recognition based on self-supervised pre-training and transfer learning in one embodiment of the present invention;
[0024] Figure 3 is a schematic diagram of a process of generating an adaptive mask in one embodiment of the present invention;
[0025] Figure 4 It is a flow chart of the pre-training and training process of the primitive recognition network in one embodiment of the present invention;
[0026] Figure 5 is a structural schematic diagram of a primitive recognition device based on self-supervised pre-training and transfer learning in one embodiment of the present invention;
[0027] Figure 6 is a schematic diagram of a structure of a computer device in one embodiment of the present invention;
[0028] Figure 7 It is another structural schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0029] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0030] The current primitive recognition model mainly extracts primitive targets from CAD drawings based on target detection technology. The training of primitive recognition models at this stage is usually divided into three steps:
[0031] (1) Constructing a primitive recognition dataset, which consists of a large number of CAD drawings;
[0032] (2) Label all the graphics elements in the data set, and mark their locations, sizes, and categories;
[0033] (3) Based on the labeled primitive dataset, the primitive recognition model is trained using supervised training.
[0034] This method has the following major drawbacks:
[0035] (1) CAD drawings contain a large number of primitive targets, which requires a lot of annotation work and is not conducive to the development and iteration of primitive recognition models;
[0036] (2) This type of method requires the use of all training data to supervise the primitive recognition model, which consumes a lot of training resources, resulting in a long model development cycle and high iteration difficulty;
[0037] (3) The primitive recognition model trained by this type of method mainly focuses on the characteristics of each primitive itself, and has little understanding of the relationship between different primitives in the drawing, which limits the accuracy and generalization of the trained model.
[0038] In order to solve the above problems, the present application designs an adaptive mask autoencoder, and obtains a feature extraction network through a novel self-supervised pre-training method. Subsequently, the pre-trained model is fine-tuned to obtain a primitive recognition model. The autoencoder network pre-trained on unlabeled training data in the present application can accurately complete the missing primitives at the mask; using the pre-trained model, fine-tuning on the basis of a small amount of labeled data can quickly and efficiently obtain an accurate primitive recognition model; using the method proposed in the present application to train the primitive recognition model, the development iteration cost is lower, and the accuracy and generalization are stronger.
[0039] The method for primitive recognition based on self-supervised pre-training and transfer learning provided by the embodiment of the present invention can be applied in the following aspects: Figure 1 In an application environment, the client communicates with the server through a network. Exemplarily, taking the scene of primitive recognition of CAD images as an example, the target user can upload CAD image data through the client. Accordingly, the server can obtain the CAD image data through the client, and construct a binarized autoencoder network based on the encoder network and the decoder network to further binarize the CAD image data to obtain binarized image data, so that the binarized image data can be adaptively masked to generate adaptive mask image data, and the binarized autoencoder network can be self-supervised pre-trained according to the adaptive mask image data to obtain an initial primitive recognition model, and then the initial primitive recognition model can be transferred and adjusted to obtain a more accurate target primitive recognition model, so as to obtain a more accurate primitive recognition result based on the target primitive recognition model, and the primitive recognition result is fed back to the client. Accordingly, the client can receive the primitive recognition result from the server, and can display the primitive recognition result on the client for the target user to query or browse. By adopting the primitive recognition method based on self-supervised pre-training and transfer learning provided in this application, a more accurate target primitive recognition model can be obtained, which is conducive to achieving more accurate and more efficient primitive recognition based on the target primitive recognition model.
[0040] The client may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices. The server may be implemented by an independent server or a server cluster consisting of multiple servers. The present invention is described in detail below through specific embodiments.
[0041] See also Figure 2 As shown, Figure 2 A schematic flow chart of a method for primitive recognition based on self-supervised pre-training and transfer learning provided in an embodiment of the present invention includes the following steps:
[0042] S10: Acquire CAD image data.
[0043] The CAD image data may be image data containing various types of primitives to be subsequently used for primitive recognition tasks, which is not limited in this application. The CAD image data may provide original data material for subsequent operations such as model building and training.
[0044] S20: Based on the encoder network and decoder network, a binary autoencoder network is constructed.
[0045] This application can build a binary autoencoder network based on an encoder network and a decoder network. Among them, the encoder network can be used as the backbone network of the subsequent primitive recognition model, assuming the main feature extraction function; the decoder network can be used for the subsequent autoregressive training link. In some layers of the network, a variant activation function (such as a variant Sigmod activation function) can be added to approximate binary processing of the features, so as to improve the sparsity of the features, thereby preparing for subsequent processing.
[0046] It should be understood that constructing a binary autoencoder network based on an encoder network and a decoder network refers to the process of how to construct and obtain a binary autoencoder network. Among them, in step S20, that is, constructing a binary autoencoder network based on an encoder network and a decoder network, includes the following steps:
[0047] S21: Based on the encoder network and the decoder network, an initial architecture of the autoencoder network is determined to obtain an initial architecture of the autoencoder network;
[0048] S22: Standardizing the binarized network layer of the initial architecture of the autoencoder network to obtain a standard architecture of the autoencoder network;
[0049] S23: Initializing the parameters of the encoder network and the decoder network to obtain autoencoder network parameters;
[0050] S24: Determine the propagation process of the autoencoder network according to the autoencoder network standard architecture to obtain the autoencoder network propagation process;
[0051] S25: Determine a binarized autoencoder network according to the autoencoder network parameters, the autoencoder network propagation process and the autoencoder network standard architecture.
[0052] The server can determine the initial architecture of the autoencoder network based on the basic principles of the encoder network and the decoder network according to the task requirements (such as CAD image primitive recognition) and data characteristics, such as but not limited to determining the number of network layers, the number of neurons in each layer, the size of the convolution kernel (if it is a convolutional neural network), and other parameters. For example, for CAD images, the encoder may have multiple convolutional layers for extracting image features at different levels, and the decoder has corresponding deconvolution layers for reconstructing the image.
[0053] In the binarization network layer of the initial architecture of the autoencoder network (usually some layers of the encoder network), a variant Sigmod activation function, namely the standardization function mentioned below, can be added. After the feature value (such as x) of the aforementioned layer is output, it can be sent as input to the standardization function. By adjusting the learnable parameters, the features can be approximately binarized, so that the output value can be close to 0 or 1, and then the original feature value can be transformed to the vicinity of 0 or 1, thereby improving the sparsity of the features.
[0054] Optionally, the server may use the following standardization function to implement the step of standardizing the binarized network layer of the initial architecture of the autoencoder network to obtain the standard architecture of the autoencoder network:
[0055]
[0056] Among them, y is the normalization function; e is the natural logarithm; α is the learnable parameter; x is the input feature value.
[0057] That is to say, when constructing a binary autoencoder network, the feature values that need to be standardized (approximately binarized) after being processed by each layer in the network will be input into this function as x. The input feature value x is transformed through this function, and the output y value can be transformed to a range close to 0 or 1 by adjusting the learnable parameter α, thereby achieving the purpose of improving feature sparsity and making the features appear approximately binarized, so as to better adapt to subsequent model training and processing steps, such as playing a better role in pre-training and primitive recognition and other related links.
[0058] After obtaining the standard architecture, the parameters of the encoder network and the decoder network (such as weights and biases) are initialized. Reasonable initialization methods (such as weight initialization method (Xavier)) can help avoid problems such as gradient vanishing or exploding in the early stages of training. The initialized parameters constitute the autoencoder network parameters, laying the foundation for subsequent network training and propagation processes.
[0059] According to the standard architecture of the autoencoder network, the propagation process of the network can be clearly defined, such as forward propagation and back propagation. In the forward propagation process, data can be processed from the input layer through each layer and finally reach the output layer, and will be standardized when passing through the binary network layer; the back propagation process can be used to calculate the gradient according to the loss function during the training process to update the parameters of the network.
[0060] By comprehensively considering the three elements of autoencoder network parameters, propagation process and standard architecture, the binarization autoencoder network is completely determined. The network can be used for subsequent image binarization processing, pre-training after adaptive mask generation and other operations, and this application does not impose any restrictions on this.
[0061] S30: Binarizing the CAD image data to obtain binary image data.
[0062] Binarization of the acquired original CAD image data can obtain binary image data. This binarization process can simplify the representation of image data, highlight certain key features, and make it more suitable for subsequent processing steps related to the binary autoencoder network, such as adaptive mask generation and pre-training based on this.
[0063] When binarizing CAD image data, the key lies in the selection of thresholds. A global threshold method can be used, such as an automatic threshold selection method for image segmentation, such as Otsu's thresholding method (Otsu's), which automatically calculates an optimal threshold so that the image is segmented into foreground (such as the primitive part) and background, and sets pixel values greater than the threshold to 1 and less than the threshold to 0, thereby obtaining a binary image.
[0064] Binarization can simplify the originally complex image information into only two states, 0 and 1, which helps to highlight key features such as the outline and shape of the primitives. In the subsequent adaptive mask generation process, these prominent features are easier to process and identify. For example, in image erosion and expansion operations, the binarized image can more clearly show the connection relationship and structure between primitives, which is conducive to generating more reasonable adaptive masks.
[0065] Binarized image data is more efficient in storage and computation. Compared with the original CAD image data, the binarized image data takes up less storage space, and in the subsequent pre-training and model processing, the computation speed may be faster due to the simplicity of the data. For example, in the pre-training process, the binarized image data is used as input. When the model processes this data, the complexity of operations such as calculating cosine similarity may be reduced due to the binarization of the data, thereby improving the efficiency of the entire pre-training process.
[0066] S40: performing adaptive mask generation on the binarized image data to obtain adaptive mask image data.
[0067] The adaptive mask generation operation is performed using the binarized image data. Through a series of image processing steps, such as first corroding the primitives to generate connected domains, then dilating to remove the connecting lines to make the primitives form independent connected domains, and finally randomly selecting connected domains and generating masks based on their positions, adaptive mask image data is obtained. These image data with adaptive masks will be used as input for subsequent pre-training.
[0068] It should be understood that performing adaptive mask generation on the binary image data to obtain adaptive mask image data refers to the process of how to obtain adaptive mask image data. In step S40, that is, performing adaptive mask generation on the binary image data to obtain adaptive mask image data, includes the following steps:
[0069] S41: performing image corrosion processing on the binary image data to obtain corroded image data;
[0070] S42: performing image expansion processing on the eroded image data to obtain expanded image data;
[0071] S43: performing mask generation processing on the dilated image data to obtain mask image data;
[0072] S44: performing random selection processing on the mask image data to obtain adaptive mask image data.
[0073] For example, Figure 3 As shown, Figure 3The figure is a schematic diagram of the adaptive mask generation process. The erosion operation is a morphological operation used to shrink or refine objects in a binary image. It slides on the image using a structural element (usually a small rectangle, circle, or custom shape). When all pixels in the area covered by the structural element are foreground pixels (usually 1 in a binary image), the central pixel is retained as a foreground pixel, otherwise it becomes a background pixel (0). In the adaptive mask generation process, the erosion operation can blur the boundaries of primitives, making it possible for adjacent primitives to be connected together to form a connected domain, which helps subsequent operations better handle the relationship between primitives.
[0074] The dilation operation is the opposite of the erosion operation, which can be used to expand the image. When any pixel in the area covered by the structural element is a foreground pixel, the central pixel becomes a foreground pixel. After the erosion operation, the primitive may become too small or partially connected together, and the dilation operation can restore the primitive to a more appropriate size and remove unnecessary connecting lines between primitives to ensure that each primitive forms a relatively independent connected domain.
[0075] After the erosion and dilation operations, the primitives in the image have formed relatively independent connected domains. Next, a mask is generated according to certain rules. The mask is usually a binary image of the same size as the original image, where the pixels corresponding to the area to be masked are 1, and the pixels corresponding to the area not to be masked are 0. The generation of the mask can allow the model to learn to restore the complete image from the partially visible image (the part covered by the mask is invisible) in the subsequent pre-training process. Through this self-supervised learning method, the model can learn the feature representation of the image.
[0076] After the mask is generated, not all masks will be used. Usually a certain number of mask regions are randomly selected, such as through a random number generator, that is, a random selection is made among all mask regions according to a preset number or ratio of selections. Randomly selecting mask regions can increase the diversity of training data and prevent the model from over-relying on a specific mask pattern during pre-training. By randomly selecting different mask regions, the model can learn more generalized feature representations, which can be better applied to primitive recognition tasks.
[0077] S50: According to the adaptive mask image data, the binarized autoencoder network is self-supervised pre-trained to obtain an initial primitive recognition model.
[0078] The self-supervised pre-training of the binary autoencoder network is carried out according to the generated adaptive mask image data. During the pre-training process, the image data with adaptive mask is used as input, and the corresponding complete image data (which can be understood as autoregressive labels) is used as the expected output. The loss function is established by flattening the network output and the autoregressive label into vectors and calculating the cosine similarity. The network is trained according to the loss function so that it continuously adjusts its parameters to better reconstruct the complete image from the partial mask image, thereby obtaining the initial primitive recognition model. This initial primitive recognition model already has a certain ability to extract and reconstruct image features.
[0079] It should be understood that, according to the adaptive mask image data, the binarized autoencoder network is self-supervised pre-trained to obtain the initial primitive recognition model, which refers to the process of how to obtain the initial primitive recognition model. Among them, in step S50, that is, according to the adaptive mask image data, the binarized autoencoder network is self-supervised pre-trained to obtain the initial primitive recognition model, including the following steps:
[0080] S51: Determine an autoregressive label according to the adaptive mask image data;
[0081] S52: extracting features from the adaptive mask image data through the encoder of the binarized autoencoder network to obtain feature image data;
[0082] S53: reconstructing the feature image data through the decoder of the binarized autoencoder network to obtain a reference primitive recognition result;
[0083] S54: performing loss calculation according to the reference primitive recognition result and the autoregressive label to obtain a target loss value;
[0084] S55: According to the target loss value, update the parameters of the binarized autoencoder network to obtain an initial primitive recognition model.
[0085] The server can use the adaptive mask image data as the input of the binarization autoencoder network. Specifically, for each CAD image block with an adaptive mask, it is fed into the encoder part of the network. The CAD image block with an adaptive mask has undergone the previous binarization processing and adaptive mask generation operation, and contains some primitive information that is obscured by the mask.
[0086] Corresponding to each masked CAD image block, prepare its complete CAD image block as an autoregressive label. That is, during the pre-training process, the goal of the model can be to reconstruct the complete image information from the masked partial image information, and the complete CAD image block can be used as the "correct answer" in supervised learning.
[0087] When the masked CAD image block is input to the encoder of the binary autoencoder network, the encoder will extract features from the image. Since some layers of the network have variant Sigmod activation functions to approximate feature binarization, the encoder will output the feature representation after binarization. This feature representation reflects the key information of the image block to a certain extent, although some primitives are blocked by the mask.
[0088] The features output by the encoder are sent to the decoder, which can try to reconstruct the complete image based on these features. In this process, each layer of the decoder can calculate based on the features sent by the encoder and its own parameters, and gradually restore the information of the image, that is, the prediction of each pixel may depend on the previously predicted pixels.
[0089] Flatten the decoder output (i.e., the reference primitive recognition result) and the corresponding autoregressive label (the complete CAD image block) into vectors respectively. Optionally, assume that the decoder output flattened vector is A and the autoregressive label flattened vector is B. The server can further calculate the cosine similarity between vectors A and B, which can measure the consistency of the two vectors in direction.
[0090] Optionally, the server can establish a loss function by calculating the cosine similarity. The specific formula can be as follows:
[0091]
[0092] Among them, Loss is the loss function; A is the flattened vector of the decoder output (i.e., the reference primitive recognition result); ||A|| is the modulus of vector A; B is the flattened vector of the autoregressive label; ||B|| is the modulus of vector B; A·B is the dot product of vector A and vector B.
[0093] The target loss value can be obtained by subtracting the cosine similarity from 1, and this application does not impose any restrictions on this. The target loss value reflects the deviation between the current prediction result of the model and the target result (autoregressive label). In order for the model to better reconstruct the image, the parameters of the binary autoencoder network need to be adjusted according to the loss value. This is achieved through the back propagation algorithm, which updates the parameters according to the derivatives of the loss function with respect to the network parameters.
[0094] The server can use the back-propagation algorithm to calculate the gradient of the loss function to each parameter in the binary autoencoder network (including the weights and biases of the encoder and decoder). Then, an optimization algorithm (such as Adam, SGD, etc.) is used to update the network parameters according to the calculated gradient. Through multiple iterations of the above forward propagation (feature extraction and image reconstruction), loss calculation and parameter update process, the network gradually converges and finally obtains the initial primitive recognition model.
[0095] S60: performing transfer learning and adjustment processing on the initial primitive recognition model to obtain a target primitive recognition model.
[0096] The obtained initial primitive recognition model is transferred and adjusted. Since the previous self-supervised pre-training is performed on unlabeled data or a large amount of unlabeled data, the labeled data is used here to fine-tune the initial primitive recognition model (such as adding a head network to its backbone network) so that it can better adapt to the specific primitive recognition task requirements, and finally obtain the target primitive recognition model, which can meet the needs of actual application scenarios in terms of accuracy and generalization.
[0097] Transfer learning can use a model trained on one task (such as the source task) and apply it to another related task (the target task). In this application, an autoencoder network is first constructed, and the feature extraction capability of CAD images is learned through self-supervised pre-training.
[0098] After pre-training is completed, the server can add a head network to the backbone network of the primitive recognition model and fine-tune it based on the labeled data to obtain the target primitive recognition model. This process can transfer the general image feature extraction capabilities (i.e., source tasks) learned by the pre-trained model to the specific task of primitive recognition (target task). The server further fine-tunes the model so that it can adapt to the specific requirements of primitive recognition and use the feature representation learned in the pre-training stage to better complete the primitive recognition task, which can reduce the development iteration cost and improve the accuracy and generalization of the model.
[0099] For example, Figure 4 As shown, Figure 4 The schematic diagram of the pre-training and training process of the primitive recognition network is shown as an example. In the pre-training process, the input data first enters the encoder, which processes the input data and outputs a feature vector; the feature vector then enters the decoder, which attempts to reconstruct the original input data based on the feature vector; this process completes the pre-training by continuously adjusting the parameters of the encoder and decoder so that the output of the decoder is as close to the original input data as possible.
[0100] In the fine-tuning process (i.e., the training process), the input data enters the backbone network, which extracts features from the input data to obtain feature vectors; the feature vectors enter the detection head, which performs primitive recognition operations based on these feature vectors and finally outputs the recognition results; in this process, the parameters of the backbone network and the detection head are fine-tuned based on the labeled data to improve the accuracy of primitive recognition.
[0101] The pre-training stage provides a good initial parameter for the primitive recognition model. Through the self-supervised learning of the masked autoencoder, the encoder (the basis of the backbone network) learns effective feature representation. In the training stage (fine-tuning), based on the pre-training, the primitive recognition model is optimized using labeled data so that the model can accurately perform primitive recognition. This combination of pre-training and fine-tuning helps improve the performance and generalization ability of the model.
[0102] It can be seen that in the above scheme, by acquiring CAD image data, and constructing a binarized autoencoder network based on the encoder network and the decoder network, the CAD image data is further binarized to obtain binarized image data, so that the binarized image data can be adaptively masked to generate adaptive mask image data, and the binarized autoencoder network is self-supervised pre-trained according to the adaptive mask image data to obtain an initial primitive recognition model, and then the initial primitive recognition model can be transferred and adjusted to obtain a more accurate target primitive recognition model, which is conducive to achieving more accurate and more efficient primitive recognition based on the target primitive recognition model.
[0103] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean 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 embodiment of the present invention.
[0104] In one embodiment, a primitive recognition device based on self-supervised pre-training and transfer learning is provided, and the primitive recognition device based on self-supervised pre-training and transfer learning corresponds one-to-one to the primitive recognition method based on self-supervised pre-training and transfer learning in the above embodiment. Figure 5 As shown, the primitive recognition device based on self-supervised pre-training and transfer learning includes an acquisition module 101, a first processing module 102, a second processing module 103, a third processing module 104, a fourth processing module 105 and a fifth processing module 106. The functional modules are described in detail as follows:
[0105] An acquisition module 101 is used to acquire CAD image data;
[0106] A first processing module 102 is used to construct a binarized autoencoder network based on the encoder network and the decoder network;
[0107] The second processing module 103 is used to perform binarization processing on the CAD image data to obtain binarized image data;
[0108] The third processing module 104 is used to perform adaptive mask generation on the binary image data to obtain adaptive mask image data;
[0109] The fourth processing module 105 is used to perform self-supervised pre-training on the binarized autoencoder network according to the adaptive mask image data to obtain an initial primitive recognition model;
[0110] The fifth processing module 106 is used to perform transfer learning and adjustment processing on the initial primitive recognition model to obtain a target primitive recognition model.
[0111] In one embodiment, the first processing module 102 is used to construct a binarized autoencoder network based on the encoder network and the decoder network, specifically for:
[0112] Based on the encoder network and the decoder network, the initial architecture of the autoencoder network is determined to obtain the initial architecture of the autoencoder network;
[0113] Standardizing the binarized network layer of the initial architecture of the autoencoder network to obtain a standard architecture of the autoencoder network;
[0114] Initializing the parameters of the encoder network and the decoder network to obtain autoencoder network parameters;
[0115] According to the standard architecture of the autoencoder network, the propagation process of the autoencoder network is determined to obtain the propagation process of the autoencoder network;
[0116] A binarized autoencoder network is determined according to the autoencoder network parameters, the autoencoder network propagation process and the autoencoder network standard architecture.
[0117] In one embodiment, the first processing module 102 is used to perform standardization processing on the binarized network layer of the initial architecture of the autoencoder network to obtain a standard architecture of the autoencoder network, specifically for:
[0118] The following standardization function is used to standardize the binarized network layer of the initial architecture of the autoencoder network to obtain the standard architecture of the autoencoder network:
[0119]
[0120] Among them, y is the normalization function; e is the natural logarithm; α is the learnable parameter; x is the input feature value.
[0121] In one embodiment, the third processing module 104 is used to perform adaptive mask generation on the binary image data to obtain adaptive mask image data, including:
[0122] Performing image corrosion processing on the binary image data to obtain corroded image data;
[0123] Performing image expansion processing on the eroded image data to obtain expanded image data;
[0124] Performing mask generation processing on the dilated image data to obtain mask image data;
[0125] The mask image data is randomly selected to obtain adaptive mask image data.
[0126] In one embodiment, the fourth processing module 105 is used to perform self-supervised pre-training on the binarized autoencoder network according to the adaptive mask image data to obtain an initial primitive recognition model, including:
[0127] Determining an autoregressive label according to the adaptive mask image data;
[0128] Extracting features from the adaptive mask image data through an encoder of the binarized autoencoder network to obtain feature image data;
[0129] Reconstructing the feature image data through the decoder of the binarized autoencoder network to obtain a reference primitive recognition result;
[0130] Perform loss calculation based on the reference primitive recognition result and the autoregressive label to obtain a target loss value;
[0131] According to the target loss value, the parameters of the binarized autoencoder network are updated to obtain an initial primitive recognition model.
[0132] The present invention provides a primitive recognition device based on self-supervised pre-training and transfer learning. The device acquires CAD image data and constructs a binarized self-encoder network based on an encoder network and a decoder network to further binarize the CAD image data to obtain binarized image data, so that adaptive mask generation can be performed on the binarized image data to obtain adaptive mask image data. The binarized self-encoder network is self-supervised pre-trained according to the adaptive mask image data to obtain an initial primitive recognition model. The initial primitive recognition model can then be subjected to transfer learning and adjustment processing to obtain a more accurate target primitive recognition model, which is conducive to achieving a more accurate and efficient primitive recognition based on the target primitive recognition model.
[0133] For the specific limitations of the primitive recognition device based on self-supervised pre-training and transfer learning, please refer to the limitations of the primitive recognition method based on self-supervised pre-training and transfer learning above, which will not be repeated here. The various modules in the above-mentioned primitive recognition device based on self-supervised pre-training and transfer learning can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0134] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client via a network connection. When the computer program is executed by the processor, it implements the functions or steps on the server side of a primitive recognition method based on self-supervised pre-training and transfer learning.
[0135] In one embodiment, a computer device is provided. The computer device may be a client, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external server through a network connection. When the computer program is executed by the processor, it realizes the functions or steps on the client side of a method for primitive recognition based on self-supervised pre-training and transfer learning.
[0136] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0137] Acquire CAD image data;
[0138] Based on the encoder network and the decoder network, a binary autoencoder network is constructed;
[0139] Binarizing the CAD image data to obtain binary image data;
[0140] Performing adaptive mask generation on the binary image data to obtain adaptive mask image data;
[0141] According to the adaptive mask image data, the binary autoencoder network is self-supervised pre-trained to obtain an initial primitive recognition model;
[0142] The initial primitive recognition model is subjected to transfer learning and adjustment processing to obtain a target primitive recognition model.
[0143] The present invention provides a computer device, which acquires CAD image data and constructs a binarization autoencoder network based on an encoder network and a decoder network to further binarize the CAD image data to obtain binarized image data, so that adaptive mask generation can be performed on the binarized image data to obtain adaptive mask image data, and self-supervised pre-training of the binarization autoencoder network is performed based on the adaptive mask image data to obtain an initial primitive recognition model, and then transfer learning and adjustment processing can be performed on the initial primitive recognition model to obtain a more accurate target primitive recognition model, which is conducive to achieving a more accurate and more efficient primitive recognition based on the target primitive recognition model.
[0144] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0145] Acquire CAD image data;
[0146] Based on the encoder network and the decoder network, a binary autoencoder network is constructed;
[0147] Binarizing the CAD image data to obtain binary image data;
[0148] Performing adaptive mask generation on the binarized image data to obtain adaptive mask image data;
[0149] According to the adaptive mask image data, the binary autoencoder network is self-supervised pre-trained to obtain an initial primitive recognition model;
[0150] The initial primitive recognition model is subjected to transfer learning and adjustment processing to obtain a target primitive recognition model.
[0151] The present invention provides a computer-readable storage medium, which acquires CAD image data and constructs a binarization autoencoder network based on an encoder network and a decoder network to further binarize the CAD image data to obtain binarized image data, so that adaptive mask generation can be performed on the binarized image data to obtain adaptive mask image data, and self-supervised pre-training of the binarization autoencoder network is performed based on the adaptive mask image data to obtain an initial primitive recognition model, and then transfer learning and adjustment processing can be performed on the initial primitive recognition model to obtain a more accurate target primitive recognition model, which is conducive to achieving a more accurate and more efficient primitive recognition based on the target primitive recognition model.
[0152] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can refer to the relevant descriptions on the server side and the client side in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.
[0153] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0154] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0155] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A primitive recognition method based on self-supervised pre-training and transfer learning, characterized in that: The primitive recognition method based on self-supervised pre-training and transfer learning includes: Acquire CAD image data; Based on the encoder network and the decoder network, a binary autoencoder network is constructed; Binarizing the CAD image data to obtain binary image data; Performing adaptive mask generation on the binary image data to obtain adaptive mask image data; According to the adaptive mask image data, the binary autoencoder network is self-supervised pre-trained to obtain an initial primitive recognition model; The initial primitive recognition model is subjected to transfer learning and adjustment processing to obtain a target primitive recognition model.
2. The method for primitive recognition based on self-supervised pre-training and transfer learning according to claim 1, characterized in that: The binary autoencoder network is constructed based on the encoder network and the decoder network, including: Based on the encoder network and the decoder network, the initial architecture of the autoencoder network is determined to obtain the initial architecture of the autoencoder network; Standardizing the binarized network layer of the initial architecture of the autoencoder network to obtain a standard architecture of the autoencoder network; Initializing the parameters of the encoder network and the decoder network to obtain autoencoder network parameters; According to the standard architecture of the autoencoder network, the propagation process of the autoencoder network is determined to obtain the propagation process of the autoencoder network; A binarized autoencoder network is determined according to the autoencoder network parameters, the autoencoder network propagation process and the autoencoder network standard architecture.
3. The method for primitive recognition based on self-supervised pre-training and transfer learning according to claim 2, characterized in that: The step of standardizing the binarized network layer of the initial architecture of the autoencoder network to obtain a standard architecture of the autoencoder network includes: The following standardization function is used to standardize the binarized network layer of the initial architecture of the autoencoder network to obtain the standard architecture of the autoencoder network: Among them, y is the normalization function; e is the natural logarithm; α is the learnable parameter; x is the input feature value.
4. The method for primitive recognition based on self-supervised pre-training and transfer learning according to claim 3, characterized in that: The step of performing adaptive mask generation on the binary image data to obtain adaptive mask image data comprises: Performing image corrosion processing on the binary image data to obtain corroded image data; Performing image expansion processing on the eroded image data to obtain expanded image data; Performing mask generation processing on the dilated image data to obtain mask image data; The mask image data is randomly selected to obtain adaptive mask image data.
5. The method for primitive recognition based on self-supervised pre-training and transfer learning according to any one of claims 1 to 4, characterized in that: The method of performing self-supervisory pre-training on the binarized autoencoder network according to the adaptive mask image data to obtain an initial primitive recognition model includes: Determining an autoregressive label according to the adaptive mask image data; Extracting features from the adaptive mask image data through an encoder of the binarized autoencoder network to obtain feature image data; Reconstructing the feature image data through the decoder of the binarized autoencoder network to obtain a reference primitive recognition result; Perform loss calculation based on the reference primitive recognition result and the autoregressive label to obtain a target loss value; According to the target loss value, the parameters of the binarized autoencoder network are updated to obtain an initial primitive recognition model.
6. A primitive recognition device based on self-supervised pre-training and transfer learning, characterized in that: The graphic element recognition device based on self-supervised pre-training and transfer learning includes: An acquisition module, used for acquiring CAD image data; A first processing module is used to construct a binary autoencoder network based on the encoder network and the decoder network; A second processing module is used to perform binarization processing on the CAD image data to obtain binarized image data; A third processing module, used for performing adaptive mask generation on the binary image data to obtain adaptive mask image data; A fourth processing module, configured to perform self-supervised pre-training on the binarized autoencoder network according to the adaptive mask image data to obtain an initial primitive recognition model; The fifth processing module is used to perform transfer learning and adjustment processing on the initial primitive recognition model to obtain a target primitive recognition model.
7. The image element recognition device based on self-supervised pre-training and transfer learning according to claim 6, characterized in that: The first processing module is used to construct a binary autoencoder network based on the encoder network and the decoder network, specifically for: Based on the encoder network and the decoder network, the initial architecture of the autoencoder network is determined to obtain the initial architecture of the autoencoder network; Standardizing the binarized network layer of the initial architecture of the autoencoder network to obtain a standard architecture of the autoencoder network; Initializing the parameters of the encoder network and the decoder network to obtain autoencoder network parameters; According to the standard architecture of the autoencoder network, the propagation process of the autoencoder network is determined to obtain the propagation process of the autoencoder network; A binarized autoencoder network is determined according to the autoencoder network parameters, the autoencoder network propagation process and the autoencoder network standard architecture.
8. The image element recognition device based on self-supervised pre-training and transfer learning according to claim 7, characterized in that: The first processing module is used to perform standardization processing on the binarized network layer of the initial architecture of the autoencoder network to obtain a standard architecture of the autoencoder network, specifically for: The following standardization function is used to standardize the binarized network layer of the initial architecture of the autoencoder network to obtain the standard architecture of the autoencoder network: Among them, y is the normalization function; e is the natural logarithm; α is the learnable parameter; x is the input feature value.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for primitive recognition based on self-supervised pre-training and transfer learning as described in any one of claims 1 to 5 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for primitive recognition based on self-supervised pre-training and transfer learning as described in any one of claims 1 to 5 is implemented.