A face sketch editing method based on text description
Through the combination of StyleGAN and CLIP, text description manipulation style code is used to edit face sketch portraits, which solves the problems of tedious manual operations and distortion in face sketch synthesis, and achieves high-quality attribute modification and image generation.
Patent Information
- Application Number
- CN202210486263.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-06
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-05-06
AI Technical Summary
Existing face sketch and portrait synthesis methods require a lot of manual operations and cannot effectively maintain the authenticity of the generated images. In particular, they are prone to distortion when modifying face attributes, and the existing methods cannot effectively use text descriptions for attribute operations.
Using a method that combines the StyleGAN generator and the CLIP graphic encoder, the manipulation direction is determined through text description, the style code is generated and least squares back-projection is performed to reduce manual operations, avoid distortion, and operate the face sketch image in the style space.
It realizes the ability to operate attributes outside of predefined attributes, reduces manual adjustments, improves the quality of generated face sketch images, avoids distortion of intermediate generation results, and eliminates the need for additional model training and labeling data.
Smart Images

Figure CN115034957B
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of face sketch and portrait, and relates to a face sketch and portrait editing method based on text description. Background Art
[0002] It is impractical to sketch different attributes of multiple faces of the same person, which brings a lot of inconvenience to the work. At the same time, this is also a major reason why the current facial sketch datasets are very small. For example, the commonly used CUFS face sketch dataset only has 606 pairs of face sketch portraits and real images, which includes the CUHK student dataset, AR dataset, and XM2VTS dataset; the CUFSF face sketch dataset only has 1194 pairs of face sketch portraits and natural images.
[0003] Existing face sketch synthesis methods can be divided into two categories: data-driven methods and model-driven methods. Data-driven methods use linear combinations of similar training sketch patches. Model-driven methods learn offline mathematical functions to map real photos to sketches.
[0004] Data-driven methods can obtain rich textures and facial details, but the search process of adjacent patches is often time-consuming. In addition, most existing data-driven methods use hand-crafted features to measure the similarity between training patches and test patches, relying heavily on human experience. Model-driven methods usually lose facial details and the synthesis results have a blurring effect. In addition, there is currently no research on text-based attribute manipulation for face sketch synthesis. When previous methods for modifying natural images through text guidance are directly applied to face sketches, there are distortions and poor performance.
[0005] Existing research on face sketch synthesis does not consider the modification of face sketches through text descriptions. Although many existing face sketch synthesis methods can synthesize images with new attributes, they cannot guarantee that the irrelevant attribute regions of the generated face sketch are the same, and only the required attributes are modified. Most existing methods manually adjust several predefined attributes of facial images, which is inconvenient and user-unfriendly. In addition, directly applying text-driven editing methods on natural images to face sketches leads to serious distortion of the generated results.
[0006] In summary, how to reduce manual operations while keeping the generated face sketch images from being distorted has become an urgent problem to be solved. Summary of the invention
[0007] In order to solve the above problems existing in the prior art, the present invention provides a method for editing a face sketch based on text description. The technical problem to be solved by the present invention is achieved through the following technical solutions:
[0008] A method for editing a face sketch based on text description, the method comprising:
[0009] Step 1, obtaining the original face sketch image to be processed;
[0010] Step 2: Project the original face sketch image onto the style space through the inverse encoder of the StyleGAN generator to obtain a first style code;
[0011] Step 3: determining the manipulation direction Δi based on the text description and the neutral description of the target attribute of the original face sketch image;
[0012] Step 4: Based on the first style code and vector Δs c Get the second style code, where the vector Δs c is a 512-dimensional vector, except for channel c which is 1, all other channels are 0;
[0013] Step 5: Input the second style code into the encoder of the StyleGAN generator to obtain a first face sketch;
[0014] Step 6: Input the first face sketch image and the second face sketch image into the graphic encoder of CLIP to obtain the operation direction Δi of the face sketch image on the channel c. c , wherein the second face sketch image is obtained by inputting the original face sketch image into an encoder of a StyleGAN generator;
[0015] Step 7: According to the manipulation direction and the manipulation direction Δi of the face sketch image on the channel c c Get the correlation R c ;
[0016] Step 8: Based on the correlation R c The relationship between the disentanglement threshold and the manipulation direction Δs is obtained;
[0017] Step 9: Input the style manipulation Δs into the StyleGAN generator to obtain a third person face sketch;
[0018] Step 10: Use the least square method to back-project the third face sketch to obtain a final face sketch.
[0019] In one embodiment of the present invention, step 3 comprises:
[0020] Step 3.1, input the sentences with the same meaning corresponding to the text description and the sentences with the same meaning corresponding to the neutral description into the text encoder of CILP respectively, and obtain the first embedding and the second embedding respectively;
[0021] Step 3.2, obtaining a target direction Δt according to a normalized difference between the first embedding and the second embedding;
[0022] Step 3.3: Obtain the manipulation direction Δi according to the target direction Δt.
[0023] In one embodiment of the present invention, the second style code is s+αΔs c Where s is the first style code and α is the manipulation intensity.
[0024] In one embodiment of the present invention, the correlation R c for:
[0025] R c =Δi c ·Δi
[0026] Among them, R c Indicates the correlation between channel c and the target attribute.
[0027] In one embodiment of the present invention, the style manipulation Δs is:
[0028]
[0029] Among them, β is the disentanglement threshold.
[0030] In one embodiment of the present invention, step 10 comprises:
[0031] Step 10.1, dividing the face sketch training image and the third face sketch image into a plurality of image blocks, and there are overlapping parts between adjacent image blocks;
[0032] Step 10.2, expanding the image block used for searching in the face sketch training image to obtain an image block area to be searched;
[0033] Step 10.3: Find the k image blocks that are most similar to the image blocks in the i-th row and j-th column in the third face sketch image from the image block area to be searched in the face sketch training image, wherein the k image blocks constitute a matrix X i,j ;
[0034] Step 10.4: Process the matrix X using the least squares method i,j Obtain a reconstruction error, and obtain a face sketch segment according to the reconstruction error
[0035] Step 10.5: Slice all the face sketches Combine them in order to get the final face sketch portrait.
[0036] In one embodiment of the present invention, step 10.2 comprises:
[0037] The image block in the ith row and jth column of the face sketch training image is taken as the center point, and is expanded upward, downward, leftward and rightward by b pixels respectively to obtain an expanded image block area to be searched.
[0038] In one embodiment of the present invention, step 10.3 comprises:
[0039] According to the Euclidean distance, the first k image blocks closest to the image block in the i-th row and j-th column in the third face sketch image are found from the image block area to be searched in all the face sketch training images.
[0040] In one embodiment of the present invention, the reconstruction error is:
[0041]
[0042]
[0043]
[0044] W i,j =W′ i,j / (1 T W′ i,j )
[0045] Among them, g i,j is the image block at the i-th row and j-th column in the third facial sketch portrait, T is the transpose, and 1 is a vector of all 1s.
[0046] In one embodiment of the present invention, the face sketch segment for:
[0047]
[0048] Compared with the prior art, the present invention has the following beneficial effects:
[0049] The present invention proposes a face sketch editing method based on text description, which is consistent with the process of drawing face sketches and reduces the inconvenience of manual operation. The present invention can also operate attributes outside predefined attributes without the need for additional model training and labeled data. The present invention adopts multimodal interaction to avoid cumbersome manual adjustments. In addition, the present invention designs a modality fine-tuning method to eliminate the distortion of the face sketch generated in the middle.
[0050] Other aspects and features of the present invention will become apparent from the following detailed description with reference to the accompanying drawings. It should be understood, however, that the drawings are designed for illustrative purposes only and are not intended to limit the scope of the present invention, as reference should be made to the appended claims. It should also be understood that, unless otherwise indicated, the drawings are not necessarily drawn to scale and are intended merely to conceptually illustrate the structures and processes described herein. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 A flowchart of a method for editing a face sketch based on text description provided by an embodiment of the present invention;
[0052] Figure 2 A schematic diagram of the architecture of a method for editing a face sketch based on text description provided by an embodiment of the present invention;
[0053] Figure 3 A schematic diagram of an overlapping portion provided by an embodiment of the present invention;
[0054] Figure 4 A schematic diagram of visual comparison between StyleCLIP and TediGAN provided in an embodiment of the present invention;
[0055] Figure 5 A visual result diagram of different operations provided by an embodiment of the present invention;
[0056] Figure 6 A visual result diagram of different expression modification operations provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0057] The present invention is further described in detail below with reference to specific embodiments, but the embodiments of the present invention are not limited thereto.
[0058] Embodiment 1
[0059] See also Figure 1 and Figure 2 , Figure 1 A flowchart of a method for editing a face sketch based on text description provided by an embodiment of the present invention is provided. Figure 2 The present invention provides a method for editing a face sketch based on text description, and the method for editing a face sketch based on text description includes steps 1 to 10, wherein:
[0060] Step 1: Get the original face sketch image to be processed.
[0061] The original face sketch image is the face sketch image that needs to be synthesized.
[0062] Step 2: Project the original face sketch image onto the style space through the inverse encoder of the StyleGAN generator to obtain the first style code.
[0063] The style space is denoted as S. Compared with the latent space W and W+, the style space S is more disentangled. The inverse encoder "e4e" of the StyleGAN generator is used to generate the style space S. s∈S represents the style code of the original face sketch. s′∈S represents the style code of the final generated face sketch. G(s) and G(s′) are the corresponding face sketch images generated by s and s′ through the StyleGAN generator encoder.
[0064] s′=s+Δs
[0065] Among them, Δs is the manipulation direction in the style space.
[0066] Step 3: Determine the manipulation direction based on the text description and neutral description of the target attributes of the original face sketch image.
[0067] Among them, the target attribute is the attribute characteristic of a target in the original face sketch image, which is the attribute that needs to be modified. The neutral description is a neutral description that does not limit the characteristics of the face image attribute. For example, if the target attribute is a face with bangs, the text description can be "a face sketch image with bangs". The neutral description can be set to a default value, such as "a face sketch image". For example, if the user wants to make the hair curly, the text description can be "a face with curly hair", and the corresponding neutral text expression can be "a face with hair".
[0068] In a specific embodiment, step 3 includes:
[0069] Step 3.1: Input the text description and neutral description into the CILP (Contrastive Language-Image Pre-training) text encoder respectively to obtain the first embedding and the second embedding respectively.
[0070] Specifically, this embodiment uses the prompt engineering algorithm to improve the robustness of the result. The prompt engineering technology has a sentence database with similar semantics. It will search the sentence database for sentences with the same meaning as the target text, so the text description is searched in the sentence database, and sentences with the same meaning as the text description can be searched, and all these sentences are input into the text encoder of CILP, and the average embedding output by the text encoder of CILP is used as the first embedding of the text description. Similarly, the neutral description is searched in the sentence database, and sentences with the same meaning as the neutral description can be searched, and all these sentences are input into the text encoder of CILP, and the average embedding output by the text encoder of CILP is used as the second embedding of the neutral description.
[0071] Step 3.2: Get the target direction based on the normalized difference between the first embedding and the second embedding.
[0072] Specifically, after normalizing the first embedding and the second embedding respectively, the difference between the normalized first embedding and the second embedding (ie, the normalized difference) is obtained, and the difference result is the target direction Δt.
[0073] Step 3.3: Get the control direction according to the target direction.
[0074] Specifically, since the text and the image are collinear, i.e., the target direction Δt is in the same direction as the manipulation direction Δi, the manipulation direction Δi jointly embedded by CLIP can be obtained.
[0075] Step 4: Based on the first style code and vector Δs c Get the second style code, where the vector Δs c is a 512-dimensional vector. Except for channel c, which is 1, all other channels are 0. Channel c can be any channel. The second style code is s+αΔs c , where s is the first style code, α is the manipulation strength, and the higher the value of the manipulation strength α, the farther it goes in the target direction.
[0076] Preferably, the value range of the manipulation strength α is [-10, 10].
[0077] Step 5: Input the second style code into the encoder of the StyleGAN generator to obtain the first face sketch.
[0078] Specifically, the style code s+αΔs c Input into the encoder of StyleGAN generator to get the first face sketch G(s+αΔsc ).
[0079] Step 6: Input the first face sketch image and the second face sketch image into the graphic encoder of CLIP to obtain the operation direction Δi of the face sketch image on channel c c , where the second face sketch portrait is obtained by inputting the original face sketch image into the encoder of the StyleGAN generator.
[0080] Step 7: According to the manipulation direction and the manipulation direction Δi of the face sketch image on the channel c c Get the correlation R c , correlation R c for:
[0081] R c =Δi c ·Δi
[0082] Among them, R c Indicates the correlation between channel c and the target attribute.
[0083] Step 8: Based on the correlation R c The relationship between the style manipulation Δs and the disentanglement threshold is obtained, and the style manipulation Δs is:
[0084]
[0085] Among them, β is the disentanglement threshold.
[0086] When R c When it is greater than the disentanglement threshold β, it means that channel c is related to the target text operation. For the disentanglement threshold, a larger value means more separation edits and fewer attributes will change. A smaller value means that a large number of channels will be manipulated and related attributes will also change (such as wrinkles, skin color, glasses). Experimental results show that the larger the threshold, the higher the attribute separation, but the visual effect will be worse.
[0087] Preferably, the value range of the disentanglement threshold β is [0.08, 0.3].
[0088] Step 9: Input the style manipulation Δs into the StyleGAN generator to obtain a third-person face sketch.
[0089] Specifically, in the above manner, when traversing all vectors Δs c After the channel, all operation directions associated with the text of the target attribute are obtained. Then all Δs are input into the StyleGAN generator to obtain the modified third-person face sketch portrait.
[0090] Step 10: Use the least squares method to back-project the intermediate synthesized face sketch image to obtain the final face sketch image.
[0091] Specifically, the intermediate synthesized face sketch is back-projected using the least squares method and trained on the CUFS sketch dataset, ultimately obtaining a face sketch with good facial details and a clean background.
[0092] In a specific embodiment, step 10 may specifically include:
[0093] Step 10.1, dividing the face sketch training image and the third face sketch image into multiple image blocks, and there are overlapping parts between adjacent image blocks.
[0094] For example, all face sketch training images are recorded as X1, X2…, X m , the face sketch training portrait and the third face sketch portrait are divided into p image blocks, each image block is 20*20, and the overlapping part between two adjacent image blocks is as follows Figure 3 As shown, its size is, for example, 14*14.
[0095] Step 10.2: Expand the image block used for searching in the face sketch training image to obtain the image block area to be searched.
[0096] Specifically, for each face sketch training image in the training set, the image block at the i-th row and j-th column of the face sketch training image is taken as the center point, and is expanded upward, downward, leftward and rightward by b pixels respectively, that is, the expanded search range is (2b+1)*(2b+1) image blocks.
[0097] That is to say, if it is currently necessary to search the image block in the i-th row and j-th column of the third facial sketch portrait, the image block in the i-th row and j-th column of the facial sketch training portrait can be used as the image block to be searched, and the image block in the i-th row and j-th column of the facial sketch training portrait can be used as the center point, and b pixels upward, b pixels downward, b pixels to the left, and b pixels to the right can also be used as areas to be searched, thereby obtaining an expanded search range.
[0098] Step 10.3: Find the k image blocks that are most similar to the image block in the i-th row and j-th column of the third face sketch image from the image block area to be searched in the face sketch training image, where the k image blocks constitute the matrix X i,j .
[0099] Specifically, the first k image blocks closest to the image block in the ith row and jth column of the third face sketch are found from the image block area to be searched in all face sketch training portraits according to the Euclidean distance. That is, the distance between the image block in the ith row and jth column of the third face sketch portrait and the image blocks to be searched in all face sketch training portraits is calculated, and the k image blocks with the closest distance are found as the k candidate blocks.
[0100] Step 10.4: Use the least squares method to process the matrix X i,j Get the reconstruction error to get the face sketch segmentation according to the reconstruction error
[0101] Specifically, the k candidate blocks are recorded as This process can be written in the form of standard linear least squares, namely:
[0102]
[0103]
[0104]
[0105] W i,j =W′ i,j / (1 T W′ i,j )
[0106] in, Represents the reconstruction error, T is the transpose, and the reconstruction error can be calculated by the above formula. The k image blocks constitute the matrix X i,j , 1 is a vector of all 1s, g i,j It is the image block in the i-th row and j-th column in the third facial sketch portrait.
[0107] Specifically, face sketch segmentation for:
[0108]
[0109] Step 10.5: Slice all face sketches Combine them in order to get the final face sketch portrait.
[0110] Specifically, repeat the above process to obtain the face sketch slices of the image block of the third face sketch portrait. Then, the slices are combined in row and column order to obtain the final face sketch.
[0111] In this embodiment, step 10 can achieve fine-tuning of the modality to eliminate distortion of the face sketch image generated in the middle.
[0112] The present invention proposes a face sketch editing method based on text description, which is consistent with the process of drawing face sketches and reduces the inconvenience of manual operation. The present invention can also operate attributes outside predefined attributes without the need for additional model training and labeled data. The present invention adopts multimodal interaction to avoid cumbersome manual adjustments. In addition, the present invention designs a modality fine-tuning method to eliminate the distortion of the face sketch generated in the middle.
[0113] The present invention has carried out the following experiment to illustrate intuitively:
[0114] (1) Compare the method of the present invention with the currently popular text-guided operation method.
[0115] The present invention conducted experiments on the CUFS dataset. The method of the present invention, StyleCLIP and TediGAN were used to operate the facial sketch image in terms of the description and expression of the hairstyle. The parameters of StyleCLIP and TediGAN were set according to their official documents. The visual results are compared as follows: Figure 4 shown.
[0116] When the target text description is about facial expressions, the face sketch modified by TediGAN will change accordingly, but the facial details and hair details are very blurred, even the facial contour is blurred, the background will be disturbed, and the clarity is low. As for the modification of the hairstyle, TediGAN did not even complete the editing of the hairstyle. The present invention attributes its poor performance to the fact that the style mixing operation of TediGAN-A is less decoupled and TediGAN-B lacks the learning process from a large data set. Although StyleCLIP can make corresponding changes based on the target text description, the generated image neither matches the features of the face sketch nor resembles the real person image. Figure 4 It can be seen that the sketch image generated by the method of the present invention not only matches the visual features of the face sketch, but also has good modification performance.
[0117] (2) The present invention adopts an objective quality evaluation method to compare with the existing face sketch synthesis method.
[0118] The three indicators SSIM, FSIM and VIF are all objective quality evaluation methods. The higher the value, the better the quality of the face sketch image synthesized by the algorithm. Table 1 gives the scores of SSIM, FSIM and VIF of face sketch images synthesized by different algorithms. "Ours-CUHK" represents the experiment conducted on the CUHK student data set using the method of the present invention, and "Ours-MWF" represents the experiment conducted on the face sketch image synthesized by the experimental MWF algorithm. The rest are the experimental results of the corresponding methods on the CUHK student data set. As can be seen from Table 1, the SSIM value and FSIM value of the method of the present invention (Ours-CUHK) are the highest. Since the quality of the face sketch synthesized by the MWF algorithm is not as good as the CUHK data set, the score of "Ours-MWF" is lower than that of "Ours-CUHK". The quality of the face sketch image modified by the method of the present invention on the CUHK student data set is comparable to that of the SCAGAN algorithm, and is better than the MWF, Pix2Pix, and CycleGAN methods. Considering that the original input real image is clearer than the face sketch image, the face sketch image synthesis method of the present invention is very effective and has lower requirements on the quality of the input face sketch image.
[0119] Table 1. Comparison of the quality of face sketches synthesized by different algorithms
[0120]
[0121] Considering that people often manipulate their hairstyles, the present invention performs a series of hairstyle modifications on the CUHK student dataset. In order to verify the versatility of the present invention's method, the present invention also conducts experiments on the AR dataset and the XM2VTS dataset with adult sketch portraits, and the results are shown on the right side of FIG5 .
[0122] from Figure 5 It can be seen that the method of the present invention can modify the relevant attributes of each input initial face sketch according to the corresponding text description, and has a good visual effect, thanks to the use of CLIP and StyleGAN in the present invention to obtain all relevant operation directions in the style space. In terms of the retention of irrelevant attributes and the quality of face sketch synthesis, the method of the present invention can well retain local face details and clean background without distortion and noise.
[0123] Considering the difficulty of modifying facial expressions, the present invention also performs many facial expression operations on the face sketch. The visual effect of this experiment on the CUHK student dataset is shown in Figure 6 In order to prove the robustness of the method of the present invention, the method of the present invention is also used to operate the face sketch portrait generated by the MWF algorithm, and the result is Figure 6By modifying the original neutral expression with expressions such as "anger" and "sadness", the present invention can see that the features of the face sketch image have changed accordingly. For example, for an angry expression, the modified face sketch image will raise eyebrows and open eyes, which is also consistent with people's daily expression of anger.
[0124] In the description of the invention, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the invention, "plurality" means two or more, unless otherwise clearly and specifically defined.
[0125] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristic data points described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristic data points described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification.
[0126] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.
Claims
1. A face sketch image editing method based on text description, characterized in that: The face sketch image editing method comprises: Step 1, obtaining the original face sketch image to be processed; Step 2: Project the original face sketch image onto the style space through the inverse encoder of the StyleGAN generator to obtain a first style code; Step 3: determining the manipulation direction Δi based on the text description and the neutral description of the target attribute of the original face sketch image; Step 4: Based on the first style code and vector Δs c Get the second style code, where the vector Δs c is a 512-dimensional vector, except for channel c which is 1, all other channels are 0; Step 5: Input the second style code into the encoder of the StyleGAN generator to obtain a first face sketch; Step 6: Input the first face sketch image and the second face sketch image into the graphic encoder of CLIP to obtain the operation direction Δi of the face sketch image on the channel c. c , wherein the second face sketch image is obtained by inputting the original face sketch image into an encoder of a StyleGAN generator; Step 7: According to the manipulation direction and the manipulation direction Δi of the face sketch image on the channel c c Get the correlation R c ; Step 8: Based on the correlation R c The relationship between the disentanglement threshold and the manipulation direction Δs is obtained; Step 9: Input the style manipulation Δs into the StyleGAN generator to obtain a third person face sketch; Step 10: Use the least square method to back-project the third face sketch to obtain a final face sketch.
2. The face sketch image editing method based on text description according to claim 1 is characterized in that: The step 3 comprises: Step 3.1, input the sentences with the same meaning corresponding to the text description and the sentences with the same meaning corresponding to the neutral description into the text encoder of CILP respectively, and obtain the first embedding and the second embedding respectively; Step 3.2, obtaining a target direction Δt according to a normalized difference between the first embedding and the second embedding; Step 3.3: Obtain the manipulation direction Δi according to the target direction Δt.
3. The face sketch image editing method based on text description according to claim 1 is characterized in that: The second style code is s+αΔs c Where s is the first style code and α is the manipulation intensity.
4. The method for editing a face sketch image based on text description according to claim 1, characterized in that: The correlation R c for: R c =Δi c ·Δi Among them, R c Indicates the correlation between channel c and the target attribute.
5. The method for editing a face sketch image based on text description according to claim 1, characterized in that: The style manipulation Δs is: Among them, β is the disentanglement threshold.
6. The method for editing a face sketch image based on text description according to claim 1, characterized in that: The step 10 comprises: Step 10.1, dividing the face sketch training image and the third face sketch image into a plurality of image blocks, and there are overlapping parts between adjacent image blocks; Step 10.2, expanding the image block used for searching in the face sketch training image to obtain an image block area to be searched; Step 10.3: Find the k image blocks that are most similar to the image blocks in the i-th row and j-th column in the third face sketch image from the image block area to be searched in the face sketch training image, wherein the k image blocks constitute a matrix X i,j ; Step 10.4: Process the matrix X using the least squares method i,j Obtain a reconstruction error, and obtain a face sketch segment according to the reconstruction error Step 10.5: Slice all the face sketches Combine them in order to get the final face sketch portrait.
7. The method for editing a face sketch based on text description according to claim 6, characterized in that: The step 10.2 comprises: The image block in the ith row and jth column of the face sketch training image is taken as the center point, and is expanded upward, downward, leftward and rightward by b pixels respectively to obtain an expanded image block area to be searched.
8. The method for editing a face sketch image based on text description according to claim 6, characterized in that: The step 10.3 comprises: According to the Euclidean distance, the first k image blocks closest to the image block in the i-th row and j-th column in the third face sketch image are found from the image block area to be searched in all the face sketch training images.
9. The method for editing a face sketch image based on text description according to claim 8, characterized in that: The reconstruction error is: IN i,j =W′ i,j / (1 T IN' i,j ) Among them, g i,j is the image block at the i-th row and j-th column in the third facial sketch portrait, T is the transpose, and 1 is a vector of all 1s.
10. The method for editing a face sketch based on text description according to claim 9, characterized in that: The face sketch segmentation for:
