A method, device, computer equipment and storage medium for generating traditional Chinese paintings

By performing the mountain landscape structure and style conversion processing of machine learning models on the mountain outline images manually drawn by users, the problems of complex and low efficiency of the Chinese painting generation process are solved, and high-quality and highly applicable Chinese painting generation is achieved.

CN113822959BActive Publication Date: 2024-12-20TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110674971.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-17
Publication Date
2024-12-20
Estimated Expiration
2041-06-17

AI Technical Summary

Technical Problem

It is difficult for the existing technology to effectively generate high-quality Chinese paintings, especially due to the abstractness and unique expression techniques of Chinese paintings, which makes the automatic generation process complicated and requires a large amount of materials or complete automation, resulting in low applicability and efficiency.

Method used

By obtaining the mountain contour images manually drawn by users, using machine learning models to perform mountain landscape structure processing and style conversion, high-quality Chinese painting images are gradually generated, reducing manual participation and improving efficiency.

Benefits of technology

It realizes a Chinese painting with strong applicability and high quality generation of Chinese paintings, reduces the input data requirements, improves the generation efficiency, and is suitable for most people without manual participation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113822959B_ABST
    Figure CN113822959B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, computer equipment and storage medium for generating a traditional Chinese painting, which relates to artificial intelligence technology, wherein the method comprises: obtaining a mountain contour image to be processed, performing mountain scene construction processing on the mountain contour image to be processed, obtaining a corresponding constructed mountain scene image, and then performing style conversion processing on the constructed mountain scene image to obtain a target traditional Chinese painting image corresponding to the mountain contour image to be processed. The target traditional Chinese painting image is generated by the method, so that the generated traditional Chinese painting has high quality and the method has strong applicability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence, and in particular to a method, device, computer equipment and storage medium for generating traditional Chinese paintings. Background Art

[0002] With the rapid development of artificial intelligence technology, using artificial intelligence technology to generate images of various art styles has become one of the research hotspots in the field of computer graphics. The automatic generation technology of images has a wide range of applications in animation production, game development, digital art creation, and film and television special effects. It can greatly reduce the intensity of manual drawing and improve the efficiency of animation production.

[0003] Chinese painting is a form of traditional Chinese painting. Due to its abstract nature, unique expression techniques and special painting materials, the generation process becomes more complicated. At present, the use of animation software to produce Chinese paintings is either fully automatic, with small task control space, or requires a large amount of materials, with high generation conditions. Summary of the invention

[0004] The embodiments of the present application provide a method, apparatus, computer device and storage medium for generating a traditional Chinese painting, by which a user can generate a traditional Chinese painting according to needs, which has strong applicability and generates a high-quality traditional Chinese painting.

[0005] On the one hand, an embodiment of the present application discloses a method for generating a traditional Chinese painting, the method comprising:

[0006] Obtain the mountain contour image to be processed;

[0007] Performing mountain scene construction processing on the mountain contour image to be processed to obtain a constructed mountain scene image corresponding to the mountain contour image to be processed;

[0008] The constructed mountain scene image is subjected to style conversion processing to obtain a target traditional Chinese painting image corresponding to the mountain contour image to be processed.

[0009] The present application discloses a Chinese painting generation device, which includes:

[0010] An acquisition unit, used for acquiring a mountain contour image to be processed;

[0011] A processing unit, configured to perform mountain scene construction processing on the mountain contour image to be processed to obtain a constructed mountain scene image corresponding to the mountain contour image to be processed;

[0012] The processing unit is further used to perform style conversion processing on the constructed mountain scene image to obtain a target traditional Chinese painting image corresponding to the mountain contour image to be processed.

[0013] On the one hand, an embodiment of the present application discloses a computer device, including an input interface and an output interface. The computer device also includes a processor suitable for implementing one or more computer programs; and a computer storage medium, wherein the computer storage medium stores one or more computer programs, and the one or more computer programs are suitable for being loaded by the processor and executed in accordance with the above-mentioned Chinese painting generation method.

[0014] In one aspect, the present application discloses a computer-readable storage medium storing one or more computer programs, wherein the one or more computer programs are suitable for being loaded by a processor and executing the above-mentioned method for generating traditional Chinese paintings.

[0015] The present application discloses a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned Chinese painting generation method.

[0016] In the embodiment of the present application, in order to obtain the target traditional Chinese painting image, the image of the mountain contour to be processed is first obtained. The image is manually drawn by the user and does not require high user requirements. Therefore, it is highly applicable and applicable to most people. Then, the mountain contour image to be processed is subjected to mountain view construction processing to obtain the corresponding constructed mountain view image, thereby adding more real details to the contour image and enriching the image information. Then, the constructed mountain view image is subjected to style conversion processing to obtain the target traditional Chinese painting image corresponding to the mountain contour image to be processed. By using this method to generate the target traditional Chinese painting image, the input data requirements are not high and the applicability is strong. Then, the final target traditional Chinese painting image is obtained based on the contour, without the need for manual participation, and the efficiency is also higher. After two layers of progressive processing, the quality of the target traditional Chinese painting is higher. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0018] Figure 1 It is a schematic diagram of the architecture of a Chinese painting generation system disclosed in an embodiment of the present application;

[0019] Figure 2 It is a flow chart of a method for generating a traditional Chinese painting disclosed in an embodiment of the present application;

[0020] Figure 3is a schematic diagram of an image drawing interface disclosed in an embodiment of the present application;

[0021] Figure 4 It is a flow chart of another method for generating a traditional Chinese painting disclosed in an embodiment of the present application;

[0022] Figure 5 is a schematic diagram of a convolution factor disclosed in an embodiment of the present application;

[0023] Figure 6 It is a network design diagram of an original mountain view structure model disclosed in an embodiment of the present application;

[0024] Figure 7 is a schematic diagram of a residual block structure disclosed in an embodiment of the present application;

[0025] Figure 8 It is a flow chart of a method for generating a traditional Chinese painting disclosed in an embodiment of the present application;

[0026] Fig. 9 It is a structural schematic diagram of a Chinese painting generation device disclosed in an embodiment of the present application;

[0027] Fig.10 It is a structural schematic diagram of a computer device disclosed in an embodiment of the present application. DETAILED DESCRIPTION

[0028] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0029] The Chinese painting generation method provided in this application involves artificial intelligence technology and machine learning in artificial intelligence technology, wherein artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology of computer science, which attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making.

[0030] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. Basic artificial intelligence technologies generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operating / interactive systems, mechatronics and other technologies. Artificial intelligence software technologies mainly include computer vision technology, speech processing technology, natural language processing technology, as well as machine learning / deep learning, autonomous driving, smart transportation and other major directions.

[0031] Machine Learning (ML) is a multi-disciplinary interdisciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithmic complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning generally include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and style-based learning. In the Chinese painting generation method provided in the embodiment of the present application, the model for processing the mountain contour image to be processed, the target mountain scenery construction model, and the target style conversion model are all obtained by machine learning means.

[0032] In addition to artificial intelligence technology, the Chinese painting generation method provided in this application also involves cloud technology and big data technology in cloud technology, specifically: Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network in a wide area network or a local area network to realize the calculation, storage, processing, and sharing of data. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the application of cloud computing business model, which can form a resource pool, which is used on demand and flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites, and more portal websites. With the high development and application of the Internet industry, each item may have its own identification mark in the future, and all need to be transmitted to the background system for logical processing. Data of different levels will be processed separately, and all kinds of industry data require strong system backing support, which can only be achieved through cloud computing.

[0033] Big data refers to a collection of data that cannot be captured, managed, and processed by conventional software tools within a certain time frame. It is a massive, high-growth, and diversified information asset that requires new processing modes to have stronger decision-making power, insight discovery, and process optimization capabilities. With the advent of the cloud era, big data has also attracted more and more attention. Big data requires special technologies to effectively process large amounts of data within a tolerable elapsed time. Technologies applicable to big data include large-scale parallel processing databases, data mining, distributed file systems, distributed databases, cloud computing platforms, the Internet, and scalable storage systems. The Chinese painting generation method provided in the embodiment of the present application specifically involves accurate recommendation, that is, recommending accurate target Chinese painting images to users based on the image of the mountain contour to be processed.

[0034] See also Figure 1 , is a schematic diagram of the architecture of a traditional Chinese painting generation system disclosed in an embodiment of the present application, wherein the traditional Chinese painting generation system 100 may at least include: one or more clients 101 and a computer device 102, wherein the client 101 may be mainly used to display an image drawing interface and receive a generated target traditional Chinese painting image on the image drawing interface; the computer device 102 may be mainly used to process the image of the mountain contour to be processed to obtain a target traditional Chinese painting image. In some feasible embodiments, the client 101 may also process the image of the mountain contour to be processed to generate a target traditional Chinese painting image. The client 101 and the computer device 102 may be directly or indirectly connected and communicated via wired or wireless communication, which is not limited in the present application.

[0035] It should be noted that the client 101 mentioned above can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, car terminal, smart TV, etc., but is not limited to this. Any computer device 102 mentioned above can be a server, which can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Figure 1 This is just an example of the system architecture of the Chinese painting generation system, and is not intended to be limiting. Figure 1 The computer device 102 can be deployed as a node in the blockchain network, or the computer device 102 can be connected to the blockchain network, so that the computer device 102 can upload internal data to the blockchain network for storage to prevent the internal data from being tampered with, thereby ensuring data security.

[0036] In a specific implementation, when the computer device 102 and the client 101 jointly complete the Chinese painting generation method, the corresponding general process is as follows: the computer device 102 obtains the mountain contour image to be processed from the client 101, and then the computer device processes the mountain contour image to be processed based on the trained target mountain view construction model and the target style conversion model, first inputs the mountain contour image to be processed into the target mountain view construction model to generate a constructed mountain view image, and then inputs the constructed mountain view image into the target style conversion model to generate a target Chinese painting image. In the embodiment of the present application, a constructed mountain view image is first generated, and then the constructed mountain view image is style converted to obtain a target Chinese painting image, so that the texture details of the Chinese painting image can be enriched, so that the generated Chinese painting image has a higher quality; at the same time, the present application generates a target Chinese painting image based on the mountain contour image to be processed, and the mountain contour image to be processed (such as a mountain contour or a simple line) is drawn by the user, so it is simple to operate and has strong autonomy. It relies on the model during the generation process and does not require manual processing, so the efficiency of generating Chinese painting images is improved. It should be noted that the client 101 can also independently execute the Chinese painting generation method provided in the embodiment of the present application.

[0037] Based on the above description, this application can be simply described with an example. User A wants to generate a Chinese painting. User A only needs to simply draw a few mountain outlines according to his own ideas on the image drawing interface of the client and click Submit. After receiving the Chinese painting generation request carrying the mountain outline, the computer device, such as the server, directly processes the mountain outline to obtain the target Chinese painting image that user A wants. In this way, the user-oriented implementation process becomes simple and easy to operate. In some feasible embodiments, multiple different clients can also draw at the same time, and obtain the target Chinese painting image corresponding to the mountain outline image to be processed displayed by each client.

[0038] Based on the above description of the Chinese painting generation system, this application embodiment discloses a Chinese painting generation method, see Figure 2 , is a flow chart of a method for generating a traditional Chinese painting disclosed in an embodiment of the present application, wherein the method for generating a traditional Chinese painting can be Figure 1 The computer device 102 shown in the figure may also be executed by Figure 1 The client 101 shown executes, Figure 2 Taking the computer device 102 as an example, the Chinese painting generation method may specifically include steps S201-S203:

[0039] S201, obtaining a mountain contour image to be processed.

[0040] In a possible implementation, a computer device obtains a to-be-processed mountain contour image, which may be sent by a client. When a user wants to obtain a target Chinese painting image, the to-be-processed mountain contour is drawn on an image drawing interface of the client in a targeted manner. The image drawing interface may be opened through a certain software or a web page, wherein the drawn to-be-processed mountain contour image may be a simple line, such as Figure 3 As shown, Figure 3 It is a schematic diagram of an exemplary image drawing interface disclosed in an embodiment of the present application. The interface includes a drawn mountain contour image to be processed. It can be seen that the mountain contour image to be processed is relatively simple and can be drawn by people without artistic skills. Therefore, for users, the preliminary preparation work (that is, input) of the traditional Chinese painting generation method provided by the present application is relatively convenient and suitable for a wide range of people.

[0041] In a specific implementation process, for a computer device or a client, obtaining a mountain contour image to be processed may specifically include: displaying an image drawing interface on a corresponding device, the image drawing interface may be actively triggered by a user, receiving a mountain contour drawing operation for the image drawing interface, and when a drawing completion instruction is detected, the instruction is detected after the user clicks a control such as "confirm" or "submit" on the image drawing interface, for example Figure 3 301 in the image drawing interface shown is a “confirm” control, which further determines the mountain contour image generated by the mountain contour drawing operation as the mountain contour image to be processed.

[0042] S202 , performing mountain scene construction processing on the mountain contour image to be processed to obtain a constructed mountain scene image corresponding to the mountain contour image to be processed.

[0043] In the specific implementation process, the target mountain view construction model can be used to perform mountain view construction processing on the mountain contour image to be processed, and obtain a constructed mountain view image corresponding to the mountain contour image to be processed. Among them, the target mountain view construction model can be obtained by training the original mountain view construction model. Therefore, the mountain contour image to be processed can be directly input into the target mountain view construction model to obtain a target output, which is the mountain view construction image. By processing the mountain contour image to be processed through the mountain view construction model, more real image texture details can be added to the mountain contour image to be processed. Since one of the goals of intelligent painting is to generate richer image information from simple contours, after the target mountain view construction model is used, when the final target Chinese painting image is generated, the more line textures of the image, the richer the information for Chinese painting style conversion, the more vivid the generated final target Chinese painting image, and the higher its quality.

[0044] In a possible implementation, before the mountain contour image to be processed is subjected to the mountain view construction processing, the mountain contour image to be processed may also be judged to determine whether the mountain contour image to be processed meets the mountain view image generation condition. If the mountain contour image to be processed meets the mountain view image generation condition, the mountain contour image to be processed is directly subjected to the mountain view construction processing to obtain the constructed mountain view image corresponding to the mountain contour image to be processed; if the mountain contour image to be processed does not meet the mountain view image generation condition, two corresponding processing means may be included at this time:

[0045] 1. The computer device directly performs mountain contour optimization processing on the mountain contour image to be processed. Specifically, it can be to optimize the lines of the mountain contour image to be processed, or automatically filter out the lines in the mountain contour image to be processed that do not meet the mountain view image generation conditions, and then make a judgment again, and then perform mountain view construction processing on the mountain contour image to be processed if the mountain view image generation conditions are met, so as to obtain the constructed mountain view image corresponding to the mountain contour image to be processed;

[0046] 2. The computer device outputs optimization prompt information, which is used to prompt the optimization processing of the mountain contour image to be processed. It can be understood as displaying a prompt message in the image drawing interface to inform the user that the current mountain contour image to be processed cannot generate a complete landscape painting, and then re-acquire a new mountain contour image to be processed, and make a judgment again. If the mountain scene image generation condition is met, the mountain scene construction processing is performed on the mountain contour image to be processed to obtain a constructed mountain scene image corresponding to the mountain contour image to be processed.

[0047] In some feasible embodiments, the above-mentioned mountain view image generation condition can be a judgment on the number of protrusions of the mountain contour image to be processed. Generally, the number of protrusions is set to be greater than or equal to 2. When the protrusion of the mountain contour image to be processed is 1, it is determined that the mountain view image generation condition is not met; further, the mountain view image generation condition can also include the height of the protrusion in the mountain contour image. A height threshold can be assumed. If it is lower than the height threshold, it is determined that the mountain view image generation condition is not met. For the height of the protrusion of the mountain contour image, the computer device can optimize it by increasing the height of the protrusion. Among them, the mountain view image generation condition is not limited to this, and it will not be listed one by one here.

[0048] S203, performing style conversion processing on the constructed mountain scene image to obtain a target traditional Chinese painting image corresponding to the mountain contour image to be processed.

[0049] In the specific implementation process, the target style transfer model can be used to perform style transfer processing on the mountain view structure image to obtain the target traditional Chinese painting image corresponding to the mountain contour image to be processed. Among them, the target style transfer model can be obtained by training the original style transfer model. Therefore, the mountain view structure image can be directly input into the target style transfer model to obtain a target output, which is the target traditional Chinese painting image. Since the mountain view structure image has obtained more image texture lines after the target mountain view structure model, the mountain view structure image is directly input into the target style transfer model to generate the target traditional Chinese painting image, which can make the generated target traditional Chinese painting image higher in quality, and its effect is better than the traditional Chinese painting image obtained by directly inputting the mountain contour image to be processed into the target style transfer model.

[0050] In the embodiment of the present application, a mountain contour image to be processed is obtained. The image is manually drawn by the user and does not require the user to be high. Therefore, it is highly applicable and applicable to most people. Then, the mountain contour image to be processed is subjected to mountain view construction processing to obtain a corresponding constructed mountain view image, thereby adding more real details to the contour image and enriching the image information. Then, the constructed mountain view image is subjected to style conversion processing to obtain a target Chinese painting image corresponding to the mountain contour image to be processed. By using this method to generate the target Chinese painting image, the input data requirements are not high and the applicability is strong. Then, the final target Chinese painting image is obtained based on the contour. This process is executed by the model without manual participation and is more efficient. After two layers of progressive processing, the quality of the target Chinese painting is higher.

[0051] Based on the above-mentioned Chinese painting generation system and Chinese painting generation method, the present application embodiment discloses another Chinese painting generation method, see Figure 4 , is a flow chart of another method for generating a traditional Chinese painting disclosed in an embodiment of the present application, wherein the method for generating a traditional Chinese painting can be Figure 1 The computer device 102 shown in the figure may also be executed by Figure 1 The client 101 shown executes, Figure 4 Taking the computer device 102 as an example, the Chinese painting generation method may specifically include steps S401-406:

[0052] S401, obtaining a mountain scene image sample set and a traditional Chinese painting image sample set.

[0053] In an embodiment of the present application, the mountain view image sample set includes multiple mountain view images, and the traditional Chinese painting image sample set includes multiple traditional Chinese painting images. Since the mountain view image sample set and the traditional Chinese painting image sample set are used to train the model, the number is relatively large, ranging from a few hundred to tens of thousands. The mountain view image sample set and the traditional Chinese painting image sample set can be obtained by searching on the Internet or directly obtained from a database.

[0054] It should be noted that the mountain scene image sample set is for images of mountain scenes, and the traditional Chinese painting image sample set is for images of traditional Chinese paintings.

[0055] S402, extracting mountain contours from the plurality of mountain scene images included in the mountain scene image sample set to obtain a mountain contour image sample set, and extracting Chinese painting contours from the plurality of Chinese painting images included in the Chinese painting image sample set to obtain a Chinese painting contour image sample set.

[0056] In the embodiment of the present application, the mountain contour extraction is performed on the multiple mountain images included in the mountain image sample set, and the traditional Chinese painting contour extraction is performed on the multiple traditional Chinese painting images included in the traditional Chinese painting image sample set. The corresponding extraction steps are the same. Therefore, the mountain contour extraction of the multiple mountain images included in the mountain image sample set is described in detail below:

[0057] For any mountain view image in the mountain view image sample set, convolution processing is performed on any mountain view image using the convolution factor to obtain an edge detection image corresponding to any mountain view image; taking the Sobel operator as an example, the Sobel convolution factor includes G_x and G_y, such as Figure 5 As shown, it is a schematic diagram of a convolution factor disclosed in an embodiment of the present application, wherein 501 represents G_x, 502 represents G_y, and assuming that any mountain view image is A, G_x and G_y are convolved with the convolution factor respectively to obtain the image grayscale value Gx for horizontal edge detection and the image grayscale value Gy for vertical edge detection. Formula (1) is used to calculate Gx, and formula (2) is used to calculate Gy.

[0058] Gx=G_x*A (1)

[0059] Gy=G_y*A (2)

[0060] Then, the image grayscale value Gx of the horizontal edge detection and the image grayscale value Gy of the vertical edge detection are added to obtain the edge detection map of the mountain scene image A, as shown in formula (3).

[0061] |G|=|Gx|+|Gy| (3)

[0062] After obtaining the edge detection image of the mountain view image, the edge detection image is binarized to obtain the mountain contour image corresponding to any mountain view image. Taking mountain view image A as an example, if the pixel value of the edge detection image of any pixel is greater than or equal to 220, then the point is an edge point, and the value of the corresponding pixel point in the binary image is 0. When the pixel value of the edge detection image of any pixel point is less than 220, the value of the corresponding pixel point in the binary image is 255. Finally, an input image with a white background and a black edge contour is obtained, where the black contour is the mountain contour image of the mountain view image.

[0063] Since the steps of extracting the contour of Chinese paintings from the multiple Chinese painting images included in the Chinese painting image sample set are the same as those described above, they will not be repeated here. There are many methods for image edge extraction. This application uses the Sobel operator as an example. Other methods such as Canny operator detection or deep learning methods can also be used for edge extraction. The Sobel operator and the Canny operator are both commonly used edge detection algorithms.

[0064] S403, using the mountain view image sample set and the mountain contour image sample set to train the initial mountain view construction model to obtain the target mountain view construction model; using the traditional Chinese painting image sample set and the traditional Chinese painting contour image sample set to train the initial style transfer model to obtain the target style transfer model.

[0065] In the embodiment of the present application, a target mountain view construction model is obtained by training with a mountain view image sample set and a mountain contour image sample set, and a target style transfer model is obtained by training with a traditional Chinese painting image sample set and a traditional Chinese painting contour image sample set. The corresponding training processes are the same, and the network designs used are also the same. Therefore, the following takes the training to generate the target mountain view construction model as an example to explain:

[0066] The network design of the original mountain view structure model of the target mountain view structure model is as follows Figure 6 As shown in Figure 1, it includes six cascaded residual block structures. The specific training process is to take the mountain view image sample set and the mountain contour image sample set as input and input them into Figure 6 In the network design diagram shown in FIG. 1 , after repeated parameter adjustment, when the parameters reach the convergence condition, the training is stopped to obtain the corresponding target mountain view structure model. In the embodiment of the present application, the residual block structure used is as follows: Figure 7 As shown, the input x enters the residual block with two branches, and the straight branch passes through multiple convolutional layers to generate the output F(x). In the straight residual block, after passing through the last convolutional layer, it is not immediately activated by the Relu activation function, but is activated after adding the feature X passed from the identity mapping branch. The weight layer in the residual block structure adopts the operation of the convolutional layer. The loss function for the network design used in this application is L, as shown in formula (4):

[0067] L=L1*k1+L GAN *k2 (4)

[0068] Where k1 and k2 are coefficients, and L1 is as shown in formula (5):

[0069] L1=||I t -G(I s )|| (5)

[0070] Among them, I tRepresents the image input to the network, G() represents the network, G(I s ) represents the output image of the network. GAN To generate the adversarial network loss, as shown in formula (6):

[0071] L GAN =-∑logD(I t ,G(I s )) (6)

[0072] Where D represents a pre-trained decision network, the purpose of which is to determine whether the image is real. After repeated experiments, the application uses k1=1 and k2=2 for better results.

[0073] Since the steps of training the target style transfer model using the Chinese painting image sample set and the Chinese painting outline image sample set are the same as above, they will not be repeated here. Figure 6 There is no limit on the number of residual block structures. This application adopts six. In some feasible embodiments, the number of residual block structures can be more while meeting the training speed.

[0074] S404: Obtain a mountain contour image to be processed.

[0075] S405 , performing mountain scene construction processing on the mountain contour image to be processed using the target mountain scene construction model to obtain a constructed mountain scene image corresponding to the mountain contour image to be processed.

[0076] S406 , using the target style transfer model to perform style transfer processing on the constructed mountain scene image, to obtain a target traditional Chinese painting image corresponding to the mountain contour image to be processed.

[0077] Among them, steps S404-S406 have been Figure 2 The details have been explained in the related embodiments shown and will not be repeated here.

[0078] Furthermore, the process architecture diagram of the Chinese painting generation method disclosed in the embodiment of the present application can be as follows: Figure 8 As shown, M1 represents the target mountain scene construction model, M2 represents the target style transfer model, I1 is the input image, that is, the mountain contour image to be processed, which is input into M1. After being processed by M1, image I2, that is, the mountain scene construction image, is obtained. Then, the mountain scene construction image is input into M2. After being processed by M2, image I3, that is, the target traditional Chinese painting image in the embodiment of the present application, is obtained.

[0079] In the embodiment of the present application, the training and use of the target mountain scene construction model and the target style conversion model are mainly described. The two models are used to process the mountain contour image to be processed layer by layer, enriching the image information, so that the quality of the generated target Chinese painting image is higher. At the same time, the mountain contour image to be processed input in the embodiment of the present application is relatively simple and applicable to most users. Therefore, the applicability of this method is relatively strong.

[0080] Based on the above method embodiment, the present application embodiment also provides a structural schematic diagram of a Chinese painting generation device. Fig. 9 , is a structural schematic diagram of a traditional Chinese painting generation device provided in an embodiment of the present application. Fig. 9 The Chinese painting generation device 900 shown can run the following units:

[0081] An acquisition unit 901 is used to acquire a mountain contour image to be processed;

[0082] The processing unit 902 is used to perform mountain scene construction processing on the mountain contour image to be processed to obtain a constructed mountain scene image corresponding to the mountain contour image to be processed;

[0083] The processing unit 902 is further used to perform style conversion processing on the constructed mountain scene image to obtain a target traditional Chinese painting image corresponding to the mountain contour image to be processed.

[0084] In a possible implementation, the acquisition unit 901 acquires the mountain contour image to be processed, which can be specifically used for:

[0085] Displaying an image drawing interface, and receiving a mountain contour drawing operation for the image drawing interface;

[0086] When the drawing completion instruction is detected, the mountain contour image generated by the mountain contour drawing operation is determined as the mountain contour image to be processed.

[0087] In a possible implementation, the processing unit 902 is further configured to:

[0088] If the mountain contour image to be processed does not meet the mountain scene image generation condition, performing mountain contour optimization processing on the mountain contour image to be processed;

[0089] Alternatively, if the to-be-processed mountain contour image does not meet the mountain scene image generation condition, optimization prompt information is output, where the optimization prompt information is used to prompt the to-be-processed mountain contour image to be optimized.

[0090] In a possible implementation, the processing unit 902 performs mountain scene construction processing on the mountain contour image to be processed to obtain a constructed mountain scene image corresponding to the mountain contour image to be processed, including:

[0091] Performing mountain scene construction processing on the mountain contour image to be processed by using the target mountain scene construction model to obtain a construction mountain scene image corresponding to the mountain contour image to be processed;

[0092] The processing unit 902 performs style conversion processing on the constructed mountain scene image to obtain a target traditional Chinese painting image corresponding to the mountain contour image to be processed, including:

[0093] The target style conversion model is used to perform style conversion processing on the constructed mountain scene image to obtain a target traditional Chinese painting image corresponding to the mountain contour image to be processed.

[0094] In a possible implementation, the acquisition unit 901 is further configured to acquire a mountain view image sample set, where the mountain view image sample set includes a plurality of mountain view images;

[0095] The processing unit 902 is further configured to:

[0096] Extracting mountain contours from the plurality of mountain view images to obtain a mountain contour image sample set, wherein the mountain contour image sample set includes a mountain contour image corresponding to each mountain view image;

[0097] The initial mountain view structure model is trained using the mountain view image sample set and the mountain contour image sample set to obtain the target mountain view structure model.

[0098] In a possible implementation, the processing unit 902 is further configured to:

[0099] For any mountain view image in the mountain view image sample set, convolution processing is performed on the any mountain view image using a convolution factor to obtain an edge detection image corresponding to the any mountain view image;

[0100] The edge detection image is binarized to obtain a mountain contour image corresponding to any one of the mountain scene images.

[0101] In a possible implementation, the acquisition unit 901 is further used to acquire a sample set of traditional Chinese painting images, wherein the sample set of traditional Chinese painting images includes a plurality of traditional Chinese painting images;

[0102] The processing unit 902 is further configured to:

[0103] Extracting the contours of Chinese paintings from the plurality of Chinese painting images to obtain a sample set of Chinese painting contour images, wherein the sample set of Chinese painting contour images includes a Chinese painting contour image corresponding to each Chinese painting image;

[0104] The initial style transfer model is trained using the traditional Chinese painting image sample set and the traditional Chinese painting outline image sample set to obtain the target style transfer model.

[0105] According to one embodiment of the present application, Figure 2 as well as Figure 4 The various steps involved in the Chinese painting generation method shown can be Fig. 9 The various units in the Chinese painting generation device shown are executed. For example, Figure 2 In the method for generating a traditional Chinese painting, step S201 can be performed by Fig. 9 The acquisition unit 901 in the Chinese painting generation device shown in FIG. 1 is executed, and step S202 and step S203 can be performed by Fig. 9 The processing unit 902 in the Chinese painting generation device shown in the figure is executed; for example, Figure 4 Step S401 and step S404 in the traditional Chinese painting generation method shown in FIG. Fig. 9 The acquisition unit 901 in the Chinese painting generation device shown in FIG. 1 is executed, and steps S402-S403 and steps S405-S406 can be performed by Fig. 9 The process is executed by the processing unit 902 in the Chinese painting generation device shown.

[0106] According to another embodiment of the present application, Fig. 9 The various units in the traditional Chinese painting generation device shown can be separately or completely combined into one or several other units to form, or one (some) of the units can be further divided into multiple smaller units in function to form, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the functions of one unit can also be realized by multiple units, or the functions of multiple units can be realized by one unit. In other embodiments of the present application, other units can also be included based on the traditional Chinese painting generation device. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.

[0107] According to another embodiment of the present application, the program can be executed by running on a general computing device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 2 as well as Figure 4 A computer program (including program code) for each step involved in the corresponding method shown in FIG. Fig. 9 The Chinese painting generation device shown in the embodiment of the present application is used to implement the Chinese painting generation method of the embodiment of the present application. The computer program can be recorded on a computer-readable storage medium, for example, and loaded into the above-mentioned computing device through the computer-readable storage medium and run therein.

[0108] In the embodiment of the present application, the acquisition unit 901 acquires the image of the mountain contour to be processed, and then the processing unit 902 performs mountain scene construction processing on the image of the mountain contour to be processed to obtain the corresponding constructed mountain scene image, and then performs style conversion processing on the constructed mountain scene image to obtain the target Chinese painting image corresponding to the image of the mountain contour to be processed. By using this method to generate the target Chinese painting image, the input data requirements are not high and the applicability is strong. Then, the final target Chinese painting image is obtained based on the contour. This process is executed by the model without manual participation and is more efficient. After two layers of progressive processing, the quality of the target Chinese painting is higher.

[0109] Based on the above method and device embodiments, the present application embodiment provides a computer device. Fig.10 , is a structural diagram of a computer device provided in an embodiment of the present application. Fig.10 The computer device 1000 shown includes at least a processor 1001, an input interface 1002, an output interface 1003, a computer storage medium 1004, and a memory 1005. The processor 1001, the input interface 1002, the output interface 1003, the computer storage medium 1004, and the memory 1005 may be connected via a bus or other means.

[0110] The computer storage medium 1004 may be stored in the memory 1005 of the computer device 1000, the computer storage medium 1004 is used to store a computer program, the computer program includes program instructions, and the processor 1001 is used to execute the program instructions stored in the computer storage medium 1004. The processor 1001 (or CPU (Central Processing Unit)) is the computing core and control core of the computer device 1000, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more computer instructions to implement the corresponding method flow or corresponding function.

[0111] The embodiment of the present application also provides a computer storage medium (Memory), which is a memory device in the computer device 1000 for storing programs and data. It is understandable that the computer storage medium here can include both the built-in storage medium in the computer device 1000 and the extended storage medium supported by the computer device 1000. The computer storage medium provides a storage space, which stores the operating system of the computer device 1000. In addition, one or more instructions suitable for being loaded and executed by the processor 1001 are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer storage medium here can be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage; optionally, it can also be at least one computer storage medium located away from the aforementioned processor.

[0112] In one embodiment, the computer storage medium can be loaded by the processor 1001 and execute one or more instructions stored in the computer storage medium to implement the above-mentioned Figure 2 as well as Figure 4 In the specific implementation, one or more instructions in the computer storage medium are loaded by the processor 1001 and execute the following steps:

[0113] Obtain the mountain contour image to be processed;

[0114] Performing mountain scene construction processing on the mountain contour image to be processed to obtain a constructed mountain scene image corresponding to the mountain contour image to be processed;

[0115] The constructed mountain scene image is subjected to style conversion processing to obtain a target traditional Chinese painting image corresponding to the mountain contour image to be processed.

[0116] In a possible implementation, the processor 1001 obtains the mountain contour image to be processed, which can be specifically used to:

[0117] Displaying an image drawing interface, and receiving a mountain contour drawing operation for the image drawing interface;

[0118] When the drawing completion instruction is detected, the mountain contour image generated by the mountain contour drawing operation is determined as the mountain contour image to be processed.

[0119] In a possible implementation manner, the processor 1001 is further configured to:

[0120] If the mountain contour image to be processed does not meet the mountain scene image generation condition, performing mountain contour optimization processing on the mountain contour image to be processed;

[0121] Alternatively, if the to-be-processed mountain contour image does not meet the mountain scene image generation condition, optimization prompt information is output, where the optimization prompt information is used to prompt the to-be-processed mountain contour image to be optimized.

[0122] In a possible implementation, the processor 1001 performs mountain scene construction processing on the mountain contour image to be processed to obtain a constructed mountain scene image corresponding to the mountain contour image to be processed, including:

[0123] Performing mountain scene construction processing on the mountain contour image to be processed by using the target mountain scene construction model to obtain a construction mountain scene image corresponding to the mountain contour image to be processed;

[0124] The processor 1001 performs style conversion processing on the constructed mountain scene image to obtain a target traditional Chinese painting image corresponding to the mountain contour image to be processed, including:

[0125] The target style conversion model is used to perform style conversion processing on the constructed mountain scene image to obtain a target traditional Chinese painting image corresponding to the mountain contour image to be processed.

[0126] In a possible implementation manner, the processor 1001 is further configured to:

[0127] Acquire a mountain view image sample set, where the mountain view image sample set includes a plurality of mountain view images;

[0128] Extracting mountain contours from the plurality of mountain view images to obtain a mountain contour image sample set, wherein the mountain contour image sample set includes a mountain contour image corresponding to each mountain view image;

[0129] The initial mountain view structure model is trained using the mountain view image sample set and the mountain contour image sample set to obtain the target mountain view structure model.

[0130] In a possible implementation manner, the processor 1001 is further configured to:

[0131] For any mountain view image in the mountain view image sample set, convolution processing is performed on the any mountain view image using a convolution factor to obtain an edge detection image corresponding to the any mountain view image;

[0132] The edge detection image is binarized to obtain a mountain contour image corresponding to any one of the mountain scene images.

[0133] In a possible implementation manner, the processor 1001 is further configured to:

[0134] Acquire a traditional Chinese painting image sample set, wherein the traditional Chinese painting image sample set includes a plurality of traditional Chinese painting images;

[0135] Extracting the contours of Chinese paintings from the plurality of Chinese painting images to obtain a sample set of Chinese painting contour images, wherein the sample set of Chinese painting contour images includes a Chinese painting contour image corresponding to each Chinese painting image;

[0136] The initial style transfer model is trained using the traditional Chinese painting image sample set and the traditional Chinese painting outline image sample set to obtain the target style transfer model.

[0137] In the embodiment of the present application, the processor 1001 obtains the image of the mountain contour to be processed, and then performs mountain scene construction processing on the image of the mountain contour to be processed to obtain the corresponding constructed mountain scene image, and then performs style conversion processing on the constructed mountain scene image to obtain the target Chinese painting image corresponding to the image of the mountain contour to be processed. By using this method to generate the target Chinese painting image, the input data requirements are not high and the applicability is strong. Then, the final target Chinese painting image is obtained based on the contour. This process is executed by the model without manual participation and is more efficient. After two layers of progressive processing, the quality of the target Chinese painting is higher.

[0138] According to one aspect of the present application, the embodiment of the present application further provides a computer product or a computer program, the computer product or the computer program includes a computer instruction, the computer instruction is stored in a computer-readable storage medium. The processor 1001 reads the computer instruction from the computer-readable storage medium, and the processor 1001 executes the computer instruction, so that the computer device 1000 executes Figure 2 as well as Figure 4 The method of generating Chinese paintings shown.

[0139] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0140] In the several embodiments provided in this application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, and the division of the modules described above is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0141] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for generating a traditional Chinese painting, characterized in that: The method comprises: Acquire a mountain view image sample set, the mountain view image sample set including a plurality of mountain view images; extract mountain contours for the plurality of mountain view images to obtain a mountain contour image sample set, the mountain contour image sample set including a mountain contour image corresponding to each mountain view image; train an initial mountain view construction model using the mountain view image sample set and the mountain contour image sample set to obtain a target mountain view construction model; Acquire a sample set of traditional Chinese painting images, the sample set comprising a plurality of traditional Chinese painting images; extract traditional Chinese painting contours from the plurality of traditional Chinese painting images to obtain a sample set of traditional Chinese painting contour images, the sample set comprising a traditional Chinese painting contour image corresponding to each traditional Chinese painting image; train an initial style transfer model using the sample set of traditional Chinese painting images and the sample set of traditional Chinese painting contour images to obtain a target style transfer model; Acquire a mountain contour image to be processed, where the mountain contour image to be processed is manually drawn by a user; Using the target mountain scene construction model, the mountain contour image to be processed is subjected to mountain scene construction processing to obtain a construction mountain scene image corresponding to the mountain contour image to be processed; The target style conversion model is used to perform style conversion processing on the constructed mountain scene image to obtain a target traditional Chinese painting image corresponding to the mountain contour image to be processed.

2. The method according to claim 1, characterized in that The step of obtaining the mountain contour image to be processed comprises: Displaying an image drawing interface, and receiving a mountain contour drawing operation for the image drawing interface; When the drawing completion instruction is detected, the mountain contour image generated by the mountain contour drawing operation is determined as the mountain contour image to be processed.

3. The method according to claim 1, characterized in that The method further comprises: If the mountain contour image to be processed does not meet the mountain scene image generation condition, performing mountain contour optimization processing on the mountain contour image to be processed; Alternatively, if the to-be-processed mountain contour image does not meet the mountain scene image generation condition, optimization prompt information is output, where the optimization prompt information is used to prompt the to-be-processed mountain contour image to be optimized.

4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: For any mountain view image in the mountain view image sample set, convolution processing is performed on the any mountain view image using a convolution factor to obtain an edge detection image corresponding to the any mountain view image; The edge detection image is binarized to obtain a mountain contour image corresponding to any one of the mountain scene images.

5. A Chinese painting generation device, characterized in that: The device comprises: An acquisition unit, configured to acquire a mountain view image sample set, wherein the mountain view image sample set includes a plurality of mountain view images; The processing unit is used to: extract mountain contours from the plurality of mountain view images to obtain a mountain contour image sample set, wherein the mountain contour image sample set includes a mountain contour image corresponding to each mountain view image; train an initial mountain view construction model using the mountain view image sample set and the mountain contour image sample set to obtain a target mountain view construction model; The acquisition unit is further used to acquire a sample set of traditional Chinese painting images, wherein the sample set of traditional Chinese painting images includes a plurality of traditional Chinese painting images; The processing unit is further used to: extract the contours of traditional Chinese paintings from the plurality of traditional Chinese painting images to obtain a sample set of traditional Chinese painting contour images, wherein the sample set of traditional Chinese painting contour images includes a traditional Chinese painting contour image corresponding to each traditional Chinese painting image; train an initial style transfer model using the sample set of traditional Chinese painting images and the sample set of traditional Chinese painting contour images to obtain a target style transfer model; The acquisition unit is used to acquire a mountain contour image to be processed, where the mountain contour image to be processed is manually drawn by a user; The processing unit is further used to perform mountain scene construction processing on the mountain contour image to be processed by using the target mountain scene construction model to obtain a constructed mountain scene image corresponding to the mountain contour image to be processed; The processing unit is further used to perform style conversion processing on the constructed mountain scene image using the target style conversion model to obtain a target traditional Chinese painting image corresponding to the mountain contour image to be processed.

6. A computer device, characterized in that: Including an input interface and an output interface, the computer device also includes: a processor adapted to implement one or more computer programs; and, A computer storage medium storing one or more computer programs, wherein the one or more computer programs are suitable for being loaded by the processor and executing the method for generating a traditional Chinese painting as described in any one of claims 1 to 4.

7. A computer storage medium, characterized in that: The computer storage medium stores one or more computer programs, and the one or more computer programs are suitable for being loaded by a processor and executing the traditional Chinese painting generation method as described in any one of claims 1-4.

8. A computer program product, characterized in that The computer program product includes a computer program, which is stored in a computer-readable storage medium. A processor reads the computer program from the computer-readable storage medium, and the processor executes the computer program to execute the traditional Chinese painting generation method according to any one of claims 1 to 4.