A Sketch Semantic Segmentation Method Based on Class Encoder-Decoder Structure
Through the codec-like structure and the line segment level self-attention module, the problem of stroke continuity and unencoded internal structure in sketch semantic segmentation is solved, the information richness and global attention are improved, and more accurate sketch semantic segmentation is achieved, which is suitable for Portable devices run.
Patent Information
- Application Number
- CN202210655278.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-10
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2042-06-10
AI Technical Summary
Existing sketch semantic segmentation methods fail to effectively encode the continuity and internal structure of strokes. The information content is insufficient, the global attention mechanism is not implemented, and key point features and internal line segment relationships of the sketch are lost.
It adopts a codec-like structure, including a novel local feature aggregation module and a line segment level self-attention module, to encode absolute position information, relative position information, intermediate stage features and stroke information, and establish the relationship between line segments through a multi-head self-attention mechanism. , to achieve a global multi-scale mechanism.
It improves the semantic distinction ability of sketch features, focuses on stroke structure and line segment relationships, has a small number of parameters, low computational complexity, and is suitable for portable device operation. The generated semantic segmentation results are more accurate, focusing on point-level and line-segment level semantics.
Smart Images

Figure CN114998904B
Abstract
Description
Technical Field
[0001] The invention relates to a sketch semantic segmentation method based on a class encoding and decoding structure, and belongs to the technical field of computer vision. Background Art
[0002] Sketches are one of the most intuitive and primitive ways of communication, and have been popular with humans since ancient times. In recent years, with the popularity of touch-screen devices and the emergence of painting programs, people have created many works through sketching. Obviously different from images, sketches are sparse and have multiple levels of abstraction. At present, relevant research on sketches includes: sketch recognition, sketch-based image retrieval, sketch-based 3D model retrieval, sketch semantic segmentation and sketch annotation. Among them, sketch semantic segmentation plays an important role in understanding the content of sketches. Therefore, sketch semantic segmentation plays an important role in realizing other sketch-related visual tasks. Current sketch semantic segmentation methods are mainly based on deep learning methods. According to the specific form and format of sketch input, related methods are roughly divided into three categories: sequence-based methods, image-based methods and point-based methods. Sequence-based methods treat sketches as stroke sequences and encode sketch features based on sequence models, such as RNN. Image-based methods directly transform the sketch semantic segmentation problem into an image semantic segmentation problem and solve it by establishing a convolutional neural network that combines sketch characteristics. This method only regards the sketch as a static image, so the stroke information is lost. The point-based method regards the sketch as a set of points, continuously aggregates local features, and uses these features to establish a codec structure to generate a point-based semantic segmentation map. For convenience, the present invention refers to the module that continuously aggregates local features as a local feature aggregation module. When perceiving the surrounding area of the sampling point, the traditional local feature aggregation module ignores the internal structure of the stroke and the continuity of the stroke. Therefore, the present invention defines the stroke distance and randomly uses the Euclidean distance and the stroke distance to perceive the surrounding area of the sampling point, which makes the novel local feature aggregation module conform to the two-dimensional spatial distribution and stroke structure of the sketch. At the same time, the traditional local feature aggregation module usually only encodes absolute position information and intermediate stage features. The present invention proposes a novel local module that encodes rich information, including: absolute position information, relative position information, intermediate stage features and stroke information, etc., and this rich information plays an important role in the semantic understanding of the sketch. Compared with the traditional sketch semantic segmentation method, the proposed method pays more attention to the relationship between the line segments inside the sketch. Based on the multi-head self-attention idea, a segment-level self-attention module is proposed to establish and strengthen the relationship between the line segments. Furthermore, the present invention proposes a quasi-encoder-decoder structure, which consists of an encoding stage and a decoding stage. The encoding stage uses a novel local feature aggregation module to encode the sketch features, and the decoding stage generates a semantic segmentation map based on these sketch features. The quasi-encoder-decoder structure is different from the traditional encoding and decoding structure in two aspects. First, in the encoding and decoding process, the sampling points are not downsampled or upsampled. Second, by collecting features from several key stages, a global multi-scale mechanism is realized. Compared with the traditional method, the proposed method focuses on both point-level semantics and segment-level semantics.In summary, the method of the present invention solves several key problems that traditional methods have not solved, including: (1) the encoding process does not pay attention to the continuity and internal structure of the strokes; (2) the encoded information content is insufficient, especially the semantically important information; (3) the global attention mechanism is not implemented, and the key point features are lost during the encoding and decoding process; (4) the internal structure of the sketch is not emphasized, especially the relationship between line segments. Summary of the invention
[0003] The purpose of the present invention is to provide a sketch semantic segmentation method based on a class codec structure. The input of the method is a point set, the training method is simple, and it is a method based on an end-to-end network. The present invention jointly annotates the semantics of any point on the sketch from the perspective of "point" and "line segment". Compared with traditional methods, this method pays more attention to the stroke structure and the relationship between line segments in the sketch. In addition, the method also encodes a large amount of useful information and significantly improves the semantic distinction ability of sketch features.
[0004] To achieve the above object, the technical solution adopted by the present invention is:
[0005] A sketch semantic segmentation method based on a class encoding and decoding structure comprises the following steps:
[0006] (1) Acquisition of point format data: The sketch samples are sampled using the farthest point sampling method and converted into a point set with N points;
[0007] (2) Constructing a sketch semantic segmentation model: Constructing a coding-decoding structure; the coding stage of the coding-like structure includes several local feature aggregation modules, and the decoding stage includes several multi-layer perceptrons and two sub-branches at the end, including a point-level sub-branch and a line-level sub-branch. In the line-level sub-branch, a line-level self-attention module is designed based on a multi-head attention mechanism to establish and enhance the relationship between line segments in the sketch.
[0008] (3) Training the sketch semantic segmentation model: The point level sub-branch and the line segment level sub-branch are connected to two cross entropy losses respectively, and the two cross entropy losses are jointly used to guide the training of the sketch semantic segmentation model. The relevant loss is expressed as:
[0009] L=L point-level +L segment-level
[0010]
[0011]
[0012] Among them, L point-level is the point level loss, L segment-level is the line segment level loss. i,jis a one-hot vector, that is, when y i,j When the semantics of y is k, i,j,k is 1, and y i,j All other elements of the vector are 0.
[0013] (4) Obtaining semantic segmentation results: The test sample, i.e., a point set containing N points, is input into the trained semantic segmentation model. The point-level sub-branch will generate a point-level semantic segmentation map, and the line-level sub-branch will generate a line-level semantic segmentation map. The point-level semantic segmentation map and the line-level semantic segmentation map are fused to obtain the final segmentation result.
[0014] Furthermore, the novel local feature aggregation module contains two basic processing steps, including: obtaining the surrounding area of the sampling point using a region perception process P. Encoding the features of the sampling point using a feature calculation process C based on the sampling point and the obtained surrounding area.
[0015] Furthermore, the region perception process P is characterized in that the region perception process P randomly uses Euclidean distance or stroke distance in combination with K nearest neighbor algorithm to obtain the surrounding area of the sampling point. Specifically, the stroke distance is defined as follows:
[0016]
[0017] Among them, (x i ,y i ) is the sampling point p i The coordinates of (x ij ,y ij ) is p i Any point around p ij The coordinates of i and ij For p i and p ij The stroke ID of , m is the scaling factor, and m satisfies the following formula:
[0018]
[0019] Wherein, w is the width of the sketch, and h is the height of the sketch. Further, the feature calculation process C is characterized in that, for p i The surrounding area of the image is encoded. The encoding process captures rich sketch information, including: absolute position information, relative position information, intermediate stage features, distance information, and stroke information, which are specifically expressed as follows:
[0020]
[0021] Among them, f i and f ij They are pi and p ij The intermediate stage characteristics, dist ij For p i With p ij The distance between ij For p i With p ij The angle between ij For p ij The stroke ID, M is the multi-layer perceptron, and δ is the ReLU function.
[0022] Furthermore, the segment-level self-attention module constructs and enhances the relationship between segments in the sketch. s The specific steps of constructing and enhancing the relationship between line segments are as follows: (1) Obtain the relevant query vector v through multi-layer perceptron and matrix deformation q and key vector v k , the specific process is as follows:
[0023] v q =T(M(f s ))
[0024] v k =T(M(f s ))
[0025] Where M is a multi-layer perceptron and T is a matrix deformation. stroke , the position of the line segment in the sketch p sketch And query the embedding dictionary to get the position embedding of the line segment in the stroke and the position embedding of the line segment in the sketch. The specific process is as follows:
[0026] e stroke =T(S(p stroke ,d stroke ))
[0027] e sketch =T(S(p sketch ,d sketch ))
[0028] Where S is the query process of the relevant dictionary. stroke and e sketch Add them together and add the result to the query vector v q Multiply them to get the position features of the line segment. The specific process is as follows:
[0029]
[0030] Among them, + represents element-by-element addition, represents matrix multiplication. Further, the query vector vq Transform the key vector v k The content characteristics of the line segment are obtained by multiplication. The detailed process is as follows:
[0031]
[0032] Finally, the calculation method of the line segment features that establish and enhance the relationship between line segments is as follows:
[0033]
[0034] Among them, v v represents the value vector, and softmax is the activation function. s ' is the line segment feature processed by the line segment level self-attention module.
[0035] Furthermore, the codec-like structure performs one same operation and two different operations with the traditional codec structure. One same operation is: using a multi-layer perceptron to increase and then decrease the feature dimension of the sampling points. The two different operations are: the codec-like structure does not perform downsampling and upsampling operations on the sampling points, that is, the number of sampling points remains unchanged during the encoding and decoding process; the codec-like structure realizes a global multi-scale mechanism by collecting and connecting sketch features of several intermediate stages.
[0036] Compared with the prior art, the method of the present invention has the following advantages:
[0037] 1. The present invention is a sketch semantic segmentation method that uses a point set as input. Compared with most methods, the present invention has the characteristics of small number of parameters and low computational complexity, and is convenient for the method to be transplanted to a portable device for operation.
[0038] 2. The local feature aggregation module of the present invention encodes rich semantics-related information, including: absolute position information, relative position information, intermediate stage features, stroke information, etc. The information considered by the traditional local feature aggregation module is more comprehensive, and the calculation process of the local feature aggregation module of the present invention conforms to the stroke structure.
[0039] 3. The present invention proposes a segment-level self-attention module, which is set in the segment-level sub-branch at the end of the class codec structure to establish and enhance the relationship between the segments in the sketch, and more accurately describe the internal structure of the sketch.
[0040] 4. The present invention proposes a quasi-encoding structure. Compared with the traditional encoding and decoding structure, the structure does not lose the feature information of key points, and implements global multi-scale technology, so that the final generated semantic segmentation results can focus on the sketch features at different key stages. The present invention divides the semantics of the sketch from two perspectives: the "point" level and the "line segment" level, and the model it relies on is an end-to-end network. The method is simple and efficient. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 is a flow chart of the method of the present invention;
[0042] Figure 2 It is the framework diagram of the proposed model;
[0043] Figure 3 This is a diagram of the inner working principle of the novel local feature aggregation module;
[0044] FIG4 is a diagram of a traditional region sensing process and a proposed region sensing process;
[0045] Figure 5 It is the implicit encoding content map of the traditional convolution kernel;
[0046] Figure 6 This is the internal schematic diagram of segment-level self-attention; DETAILED DESCRIPTION
[0047] The present invention will be further described below in conjunction with the accompanying drawings:
[0048] Figure 1 : is a flow chart of the method of the present invention, wherein the sketch semantic segmentation method based on the class codec structure comprises the following contents:
[0049] Content 1. The present invention uses SPG and SketchSeg-150K datasets for training and testing. The farthest point sampling method is implemented in SPG and SketchSeg-150K so that each sample can be represented by a fixed number of points, that is, the input sample is converted into a fixed number of point sets.
[0050] Content 2, constructing the sketch semantic segmentation model of the present invention. The semantic segmentation model proposed in the present invention is as follows Figure 2 As shown in the figure, NLFA represents novel local feature aggregation, SLSA represents segment-level self-attention, MLP represents multi-layer perceptron, PL and SL represent point level and segment level respectively. Figure 2The sketch semantic segmentation model includes a class encoding and decoding structure, which includes 4 encoding stages and 5 decoding stages. The encoding stage is mainly implemented by a local feature aggregation module. The decoding stage includes 4 multi-layer perceptrons and a point-level sub-branch and a line-level sub-branch at the end. The point-level sub-branch in the decoding stage only performs a dimensionality reduction operation, which is implemented by a multi-layer perceptron. On the line-level sub-branch, a line-level self-attention module is designed to establish and enhance the relationship between line segments in the sketch, which is convenient for describing the content structure of the sketch. By discussing the structure of the sketch semantic segmentation model, it can be seen that the novel local feature aggregation module, the line-level self-attention module and the class encoding and decoding structure are important components of the proposed method. The following focuses on these three parts.
[0051] Content 2-1, the local feature aggregation module is an important module of the sketch semantic segmentation method. Its internal working principle is as follows Figure 3 For the sake of simplicity, the present invention ignores the hyperparameter batch size B. Figure 3 , input point p i Based on different dilation rates r, a region-aware process P is used to obtain p i The points nearby. Based on p i and is perceived at all points, p i The feature calculation process C is used to encode the rich sketch information. The encoding of this module is further completed through the multi-layer perceptron and the maximum pooling operation. It can be seen that this module includes two parts: the region perception process P and the feature calculation process C.
[0052] Content 2-1-1, when the sampling point perceives the surrounding area, the regional perception process plays a key role. The traditional local perception process is based on Euclidean distance and combined with the K nearest neighbor algorithm. Figure 4(a) shows the perception area obtained using the traditional method. In Figure 4(a), p i (x i ,y i ) is the sampling point, p ij (x ij ,y ij ) is any point around the sampling point. Then the surrounding area P ik {p i1 ,p i2 ,...,p ik} is obtained by the following formula:
[0053]
[0054] Wherein, argmin represents obtaining k points corresponding to the nearest k distances. Although the area obtained by the above perception process conforms to the distribution of the sketch in two-dimensional space, the process ignores the continuity of the strokes of the sketch and the internal structure of the strokes. Therefore, the present invention proposes to define the stroke distance and combine it with the K nearest neighbor algorithm to obtain the surrounding area. The specific process is expressed as the following formula:
[0055]
[0056] Among them, (x i ,y i ) is the sampling point p i The coordinates of (x ij ,y ij ) is p i Any point around p ij The coordinates of i ,s ij For p i and p ij The stroke ID of , m is the scaling factor, and m satisfies the following formula:
[0057]
[0058] Where w is the width of the sketch and h is the height of the sketch. The above formula for obtaining the surrounding area shows that at p i and p ij In the case of the same stroke, the stroke distance is equal to the traditional Euclidean distance. Otherwise, the stroke distance between two points will increase several times. In other words, the region perception process P perceives the surrounding area along the sketch strokes, which makes the proposed method consider the continuity of the strokes and is conducive to perceiving the stroke structure. The perception area of the proposed method is shown in Figure 4(b). During actual training, the perception process P randomly selects the Euclidean distance or the stroke distance to complete the perception process, which causes the proposed method to consider the two-dimensional spatial distribution and stroke structure of the sketch at the same time. It is worth noting that the region perception process P also uses the idea of dilated convolution to expand the perception area. Figure 3 In this paper, different expansion rates r are used to achieve this process.
[0059] Content 2-1-2, the feature calculation process C is used to encode various sketch information. The traditional feature calculation process only encodes absolute position information and intermediate stage features. These encoded sketch information is not sufficient to represent the sketch, which seriously hinders the performance of sketch semantic segmentation. Obviously, the feature calculation process and the convolution kernel of CNN have similar functions. However, the convolution kernel of CNN implicitly encodes distance information and relative position information. Figure 5 As shown, p i With {p i1 ,p i2 ,...,pi8} is 1 Manhattan distance, and the angle between them is {0°, 45°, ..., 135°}. However, the traditional feature calculation process ignores these key information, which seriously reduces the integrity of the sketch content. To this end, the present invention encodes distance information, relative position information and stroke information. The details are as follows:
[0060]
[0061]
[0062] Among them, dist ij is the distance information, θ ij is the relative position information, i.e. p i and p ij Furthermore, the novel local feature aggregation module encodes the following:
[0063]
[0064] Among them, f i and f ij For p i and p ij The intermediate stage characteristics, s ij For p ij Stroke information, is the connection operation, M is the linear transformation using a multi-layer perceptron, and δ is the ReLu activation function. According to the above discussion, the novel local feature aggregation module encodes rich sketch information and context information. Compared with the previous local feature aggregation module, it considers the stroke structure and continuity of the strokes.
[0065] Content 2-2, the present invention designs a segment-level self-attention module for establishing and enhancing the relationship between line segments within the sketch. Assume that the input of the module is a sketch feature of [B, N, D] dimensions, where B is the batch size, N represents the number of sampling points, and D represents the feature dimension. The present invention divides several points on the same stroke into a segment, assuming that each sketch is divided into S segments. New segment features with [B, S, D'] dimensions can be obtained by feeding the initial segment features with [B, S, D×N / S] dimensions into a multi-layer perceptron. The purpose of the present invention is to learn the relationship between line segments for describing the internal structure of the sketch. As is known to all, the multi-head self-attention mechanism is used to calculate the relationship between any two targets and is widely used in fields such as natural language processing and computer vision. The success of multi-head attention mainly stems from the association between any two targets and the long-term dependency between them. The multi-head attention mechanism enables the neural network to pay attention to the features of multiple subspaces at the same time. Based on the idea of multi-head attention, the present invention designs a segment-level self-attention module for learning and enhancing the internal structure of the sketch for the first time by considering the line segment features and sketch characteristics. The detailed calculation method is shown in Figure 6 Given a line segment feature f s [S,D'], query vector v q [H,D" / H,S] and key vector v k [H,D” / H,S] can be obtained by the following formula:
[0066] v q =T(M(f s ))
[0067] v k =T(M(f s ))
[0068] Among them, M represents a multi-layer perceptron, its output dimension is: D", T represents matrix deformation, and the query vector v q and key vector v k There are H subspaces. At the same time, the position information of the line segment is processed by the following formula:
[0069] e stroke =T(S(p stroke ,d stroke ))
[0070] e sketch =T(S(p sketch ,d sketch ))
[0071] Among them, S is the query process of the relevant dictionary. stroke and p sketchare two one-hot vectors, representing the position information of the line segment in the stroke and the position information of the line segment in the sketch. stroke and p sketch Look up the embedding dictionary d stroke and d sketch , and then perform matrix transformation on the query result to obtain the corresponding position embedding e stroke and e sketch Obviously, p stroke and p sketch The existence of enables the relationship between line segments to capture the local position of the line segment in the stroke to which it belongs and the global position of the line segment in the sketch to which it belongs, which makes the relationship between the line segments more accurate. Furthermore, the present invention encodes the position features and content features of the line segments. The relevant formula is as follows:
[0072]
[0073]
[0074] in, represents matrix multiplication, and + represents element-by-element addition. Finally, the calculation process of the line segment level self-attention module is as follows:
[0075]
[0076] Among them, v v represents the value vector, and softmax is the activation function. s ' is the line segment feature processed by the line segment level self-attention module.
[0077] Content 2-3, the quasi-encoder-decoder structure is the framework of the proposed method, which has two important features. The framework of the proposed method is based on the quasi-encoder-decoder structure rather than the real encoder-decoder structure. Based on the global attention mechanism, the quasi-encoder-decoder structure aggregates sketch features of several stages to generate the final sketch segmentation result.
[0078] Content 2-3-1, Figure 2 The class coding structure consisting of eight stages and two sub-branches is presented in detail. The first four stages are encoding stages using a novel local feature aggregation module, and the last four stages are decoding stages using only nonlinear transformations. Compared with conventional coding and decoding structures, the class coding and decoding structure does not perform downsampling and upsampling operations on the sampling points. This approach keeps the number of sampling points unchanged, retains the features of important points, and further ensures the performance of the proposed method. Similar to conventional coding and decoding structures, the number of feature channels in all stages first increases and then decreases, which means that in the first four stages the present invention gradually enriches the deep features, and then marks the semantics of each point based on these deep features.
[0079] Content 2-3-2, the novel local feature aggregation module in the encoding stage implements a multi-scale mechanism based on the idea of dilated convolution. However, this mechanism is limited to the local area, and the global context of different stages is ignored during the encoding and decoding process. From a global perspective, the lack of long-term dependencies will lead to feature differences in the same class of points. Therefore, the present invention uses skip links to aggregate features of several intermediate stages to establish a global multi-scale mechanism. For details, please refer to Figure 2 .in accordance with Figure 2 It can be seen that the features used to generate the final semantic segmentation map mainly come from the outputs of the four intermediate stages. These outputs describe different global semantic information and improve the ability of semantic analysis.
[0080] Content 3, training the sketch semantic segmentation model of the present invention. The point-level cross entropy loss L point-level Connected to the point-level branch, segment-level cross entropy loss L segment-level Connect to the segment hierarchy branch. point-level and L segment-level The two cross entropy losses are jointly used to train the sketch semantic segmentation model. The relevant formula is as follows:
[0081] L=L point-level +L segment-level
[0082]
[0083]
[0084] Among them, L point-level is the point-level cross entropy loss, L segment-level is the segment-level cross entropy loss. i,j is a one-hot vector representing a semantic annotation, that is, when y i,j When the semantics of y is k, i,j,k is 1, and y i,j All other elements of the vector are 0. The training samples in the SPG and SketchSeg-150K datasets are input into the proposed sketch semantic segmentation model, and the Adam algorithm is used to perform 100 rounds of optimization to obtain the trained sketch semantic segmentation model.
[0085] Content 4, the test samples in the SPG and SketchSeg-150K datasets are input into the trained sketch semantic segmentation model. The two sub-branches of the model will output a semantic segmentation map at the point level and a semantic segmentation map at the line segment level. The line segment level semantic segmentation map is repeated to make the dimension of the segmentation map consistent with the dimension of the point level semantic segmentation map. Then, the two semantic segmentation maps are element-wise added to obtain the final sketch semantic segmentation result.
[0086] The above-described embodiment is only one implementation of the present invention, which is used to understand the method and its core concept, but not to limit the scope of the present invention. Without departing from the design concept of the present invention, the deformation and improvement made by researchers in this field to the technical solution of the present invention should fall within the scope of protection determined by the claims of the present invention.
Claims
1. A sketch semantic segmentation method based on a class encoder-decoder structure, characterized in that: The steps include: (1) Acquisition of point format data: The sketch samples are sampled using the farthest point sampling method and converted into a point set with N points; (2) constructing a sketch semantic segmentation model: the sketch semantic segmentation model includes a coding-decoding structure, which includes a coding stage and a decoding stage. The coding stage includes a plurality of local feature aggregation modules. The decoding stage includes a plurality of multi-layer perceptrons and two sub-branches at the end. The two sub-branches at the end include a point-level sub-branch and a line-level sub-branch. The line-level sub-branch includes a line-level self-attention module based on a multi-head attention mechanism. (3) Training the sketch semantic segmentation model: The point level sub-branch and the line segment level sub-branch are respectively connected to two cross entropy losses, and the two cross entropy losses are jointly used to guide the training of the sketch semantic segmentation model; the cross entropy loss is expressed as: L=L point-level +L segment-level Among them, L point-level is the point-level cross entropy loss, L segment-level is the segment-level cross entropy loss; y i,j is a one-hot vector, that is: when y i,j When the semantics of y is k, i,j,k is 1, and y i,j All other elements of the vector are 0; (4) Obtaining sketch semantic segmentation results: Input the test sample into the sketch semantic segmentation model trained in step (3), the point-level sub-branch generates a point-level semantic segmentation map, and the line-level sub-branch generates a line-level semantic segmentation map. The point-level semantic segmentation map and the line-level semantic segmentation map are fused to obtain the final segmentation result. The local feature aggregation module of step (2) includes two basic processing steps, including: using a region perception process P to obtain the surrounding area of the sampling point; using a feature calculation process C to encode the features of the sampling point based on the sampling point and the obtained surrounding area; The region perception process P randomly uses Euclidean distance or stroke distance in combination with K nearest neighbor algorithm to obtain the surrounding area of the sampling point; the stroke distance is defined as follows: Among them, (x i ,y i ) is the sampling point p i The coordinates of (x ij ,y ij ) is p i Any point around p ij The coordinates of i and ij For p i and p ij The stroke ID of , m is a scaling factor, and m satisfies the following formula: Where w is the width of the sketch and h is the height of the sketch; The characteristic calculation process C is used to calculate p i The surrounding area of the image is encoded, and the encoding process captures the sketch information, which includes: absolute position information, relative position information, intermediate stage features, distance information and stroke information, which are specifically expressed as follows: Among them, f i and f ij They are p i and p ij The intermediate stage characteristics, dist ij For p i With p ij The distance between ij For p i With p ij The angle between ij For p ij The stroke ID of is a multi-layer perceptron, δ is a ReLU function; The segment-level self-attention module in step (2) constructs and enhances the relationship between the segments in the sketch. Given a segment feature f s , the specific steps to build and enhance the relationship between line segments are: First, the relevant query vector v is obtained through multi-layer perceptron and matrix deformation q and key vector v k , the specific process is as follows: in, is a multi-layer perceptron, is a matrix deformation; according to the position p of the line segment in the stroke stroke , the position of the line segment in the sketch p sketch And query the embedding dictionary to get the position embedding of the line segment in the stroke and the position embedding of the line segment in the sketch. The specific process is as follows: in, It is the query process of the relevant dictionary; Furthermore, the position is embedded in e stroke and e sketch Add the result and the query vector v q Multiply them to get the position features of the line segment. The specific process is as follows: Among them, + represents element-by-element addition, Represents matrix multiplication; Further, the query vector v q Transform the key vector v k The content characteristics of the line segment are obtained by multiplication. The detailed process is as follows: Finally, the calculation method of the line segment features that establish and enhance the relationship between line segments is as follows: Among them, v v represents the value vector, softmax is the activation function, f s ' is the line segment feature processed by the line segment level self-attention module; The operations performed by the encoding-decoding-like structure are: using a multi-layer perceptron to first increase and then reduce the feature dimensions of the sampling points; the encoding-decoding-like structure does not perform downsampling and upsampling operations on the sampling points, and the number of sampling points remains unchanged during the encoding and decoding process; the encoding-decoding-like structure realizes a global multi-scale mechanism by collecting and connecting sketch features of several intermediate stages.
