WO2021057463A1 - Image stylization processing method and apparatus, and electronic device and readable medium - Google Patents

Image stylization processing method and apparatus, and electronic device and readable medium Download PDF

Info

Publication number
WO2021057463A1
WO2021057463A1 PCT/CN2020/113974 CN2020113974W WO2021057463A1 WO 2021057463 A1 WO2021057463 A1 WO 2021057463A1 CN 2020113974 W CN2020113974 W CN 2020113974W WO 2021057463 A1 WO2021057463 A1 WO 2021057463A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
background
processed
complexity
stylized
Prior art date
Application number
PCT/CN2020/113974
Other languages
French (fr)
Chinese (zh)
Inventor
贾靖
Original Assignee
北京字节跳动网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京字节跳动网络技术有限公司 filed Critical 北京字节跳动网络技术有限公司
Publication of WO2021057463A1 publication Critical patent/WO2021057463A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the embodiments of the present application relate to the field of Internet technology, for example, to an image stylization processing method, device, electronic device, and readable medium.
  • the photographing function of the terminal device usually has an image processing function to realize stylized processing of images captured by the terminal user.
  • the embodiments of the application provide an image stylization processing method, device, electronic device, and readable medium.
  • stylizing an image the complexity of the image background is taken into consideration, and the fineness and precision of the image stylization processing result are improved. Aesthetics.
  • an image stylization processing method which includes:
  • the background of the preliminary stylized image is replaced with the original background to obtain the stylized image.
  • an image stylization processing device including:
  • the background replacement module is configured to replace the original background of the image to be processed with the template background based on the result of determining that the background complexity of the image to be processed is lower than the complexity threshold to obtain the target image;
  • the stylization processing module is set to input the target image into the stylization processing model to obtain a preliminary stylized processing image
  • the background replacement module is further configured to replace the background of the preliminary stylized image with the original background to obtain the stylized image.
  • an embodiment of the present application also provides an electronic device, which includes:
  • Memory used to store programs
  • the processor realizes the image stylization processing method according to any embodiment of the present application.
  • an embodiment of the present application provides a readable medium with a computer program stored on the readable medium, and when the computer program is executed by a processor, the image stylization process as described in any of the embodiments of the present application is realized. method.
  • Figures 1A-1B are schematic diagrams of the effect of stylizing images to be processed by related technologies
  • FIG. 2A is a flowchart of an image stylization processing method provided in Embodiment 1 of this application;
  • 2B-2E are schematic diagrams of the effect of stylizing an image to be processed according to Embodiment 1 of the application;
  • FIG. 3 is a flowchart of an image stylization processing method provided in Embodiment 2 of the application.
  • FIG. 5 is a schematic structural diagram of an image stylization processing apparatus provided in Embodiment 4 of the application.
  • FIG. 6 is a schematic structural diagram of an electronic device provided in Embodiment 5 of this application.
  • FIG. 1A is an image to be processed with a low background image complexity
  • FIG. 1B is an image to be processed with a low background image complexity
  • FIG. 1B is an effect diagram of the image to be processed shown in FIG. 1A after being processed in a comic style according to a method in the related art, and the overall effect of the effect diagram Poor, seriously affecting the aesthetics of manga style processing. Therefore, there is an urgent need to improve image stylization processing methods in related technologies.
  • 2A is a flowchart of an image stylization processing method provided in Embodiment 1 of this application; for example, 2B-2E are schematic diagrams of effects of stylizing an image to be processed provided in Embodiment 1 of this application.
  • This embodiment is applicable to the case of stylizing the image to be processed, for example, it is applicable to the case of stylizing the image to be processed whose background complexity is lower than the complexity threshold.
  • the method may be executed by an image stylization processing device or an electronic device, and the device may be implemented by software and/or hardware, and the device may be configured in the electronic device.
  • the electronic device may be a terminal device with image processing functions such as a mobile phone, a tablet computer, a wearable device, and a camera.
  • the method in this embodiment may include the following steps:
  • the image to be processed can be the image to be stylized in this embodiment, it can be an image currently shot by the camera on the electronic device, or it can be a saved image selected from the local gallery of the electronic device according to the user's click operation.
  • the original background of the image to be processed may be the original background of the image to be processed.
  • the original background of the image to be processed shown in FIG. 2B is a gray background.
  • the template background is a pre-set high-complexity background image.
  • the number of template backgrounds in this embodiment can be one or more. When there are multiple template backgrounds, it can be set with multiple different complexities.
  • the background image is used as the template background.
  • the complexity threshold may be a pre-set criterion for judging whether to perform background replacement on the image to be processed.
  • the complexity threshold may be a threshold set for the background complexity.
  • the background complexity can be the complexity of the background area in the image to be processed. For example, when the background area of the image to be processed is a simple solid-color background such as a wall, blue sky, sea, etc., the background complexity is low; when the background area of the image to be processed When it is a chaotic background such as a road or a park, the background complexity is high.
  • the first possible implementation manner for determining whether the background complexity of the image to be processed is lower than the complexity threshold is to perform pixel grayscale histogram statistics on the background area of the image to be processed, and the histogram is gray The wider the distribution range of the degree value, the higher the background complexity.
  • the second possible implementation for determining whether the background complexity of the image to be processed is lower than the complexity threshold can be to extract the texture features of the original background of the image to be processed, and determine whether the background complexity of the image to be processed is Below the complexity threshold.
  • the implementation manner for determining whether the background complexity of the image to be processed is lower than the complexity threshold may be to first use a texture feature extraction algorithm to extract texture features from the original background of the image to be processed.
  • Algorithms can include statistical methods, geometric methods, model methods, structural analysis methods, and signal processing methods. After extracting the texture feature of the original background of the image to be processed, the number of pixels corresponding to the texture feature or the ratio of the pixels corresponding to the texture feature to the total pixels of the original background can be used as the background complexity of the image to be processed, and then the Whether the background complexity is lower than the preset complexity threshold.
  • an optional execution method for executing the above-mentioned second implementable manner is: performing edge detection on the original background of the image to be processed to obtain the texture feature of the original background; determining that the texture feature is in the The proportion of pixels in the original background is used as the background complexity of the image to be processed; it is determined whether the background complexity of the image to be processed is lower than the complexity threshold.
  • the method may be to perform edge detection on the original background content of the image to be processed, and use the edge detection result as the texture feature of the original image.
  • the edge detection algorithm may include canny algorithm, Roberts algorithm, Sobel algorithm and so on.
  • the background complexity of the image to be processed is higher than or equal to the complexity threshold, which can indicate that the background complexity of the image to be processed is high complexity.
  • the uniform stylization processing method can accurately complete the image to be processed.
  • the stylization processing operation is to directly input the image to be processed into the stylization processing model, and obtain the output result of the stylization processing model as the stylized image of the image to be processed.
  • the background complexity of the image to be processed is lower than the complexity threshold, which can indicate that the background complexity of the image to be processed is relatively low, and the processing result is prone to be rough.
  • the background of the image to be processed can be replaced, and the original background of the image to be processed can be replaced with The preset template background is used to obtain the target image.
  • FIG. 2B is the image to be processed in this embodiment.
  • the original background of the image to be processed is a pure gray low-complexity background. If the background complexity of the image to be processed is lower than the complexity threshold, the The original gray background of FIG. 2B is replaced with a preset high-complexity template background of Peach Blossom Spring, to obtain the target image as shown in FIG. 2C.
  • the determination method may be to use image recognition or image clustering algorithms to segment the image to be processed to obtain the background area and foreground area of the image to be processed; the determination method may also be to pre-train the background segmentation model, which is divided by the background. The model is used to segment the image to be processed to obtain the background area and foreground area of the image to be processed; the determination method can also be that the user manually selects the background area and foreground area of the image to be processed.
  • S202 Input the target image into the stylization processing model to obtain a preliminary stylization processing image.
  • the stylization processing model can be a pre-trained neural network model that can implement stylization processing on the content in the image.
  • the training process of the stylized processing model will be described in detail in subsequent embodiments.
  • the target image obtained after background replacement of the image to be processed in S201 can be used as the input parameter, and the program code of the pre-trained stylization processing model can be called and run.
  • the stylization processing model will be based on The stylization processing algorithm during training stylizes the content in the input target image, and outputs the stylized image, that is, the preliminary stylized image.
  • the target image shown in FIG. 2C is used as the input data of the stylization processing model, and the program code of the pre-trained stylization processing model is called and run.
  • the stylization processing model can be based on the cartoon style during training.
  • the processing algorithm is to perform comic stylization processing on the target image shown in FIG. 2C to obtain the preliminary stylized processed image shown in FIG. 2D.
  • the stylization processing operation performed on the target image by the stylization processing model in this step may include: comic style processing, pixelized style processing, sketch style processing, oil painting style processing and other stylization processing in the form of multiple filters.
  • S203 Replace the background of the preliminary stylized image with the original background to obtain the final stylized image.
  • the preliminary style may also be changed in this step.
  • the current background of the transformed image is replaced with the original background of the image to be processed.
  • the execution process may be to first perform background area recognition on the preliminary stylized image, and determine the current background of the preliminary stylized image (in an embodiment, the determination method may be the same as determining the original background from the image to be processed). The process is the same, which will not be repeated), and the original background of the image to be processed is replaced with the current background of the preliminary stylized image to obtain the final stylized image after the image to be processed is stylized.
  • the current background of the preliminary stylized image shown in FIG. 2D is determined, and the original background of the image to be processed shown in FIG. 2B is replaced with the current background in FIG. 2D to obtain the stylized image shown in FIG. 2E (That is, the final stylized processed image).
  • the background processing model is a pre-trained neural network model that specializes in stylizing the original background of the image to be processed.
  • the type of stylization processing performed by the background processing model can be the same as the type of stylization processing performed by the stylization processing model in S202.
  • the training process of the two models is also similar.
  • the algorithm parameters of each model after training can be used when performing stylization processing. different.
  • the execution process may be to use the original background replaced by S201 as the input data of the background processing model, and call and run the program code of the background processing model.
  • the background processing model will be based on the stylized processing algorithm during training. , Stylize the input original background to obtain the original stylized background, and then replace the background of the preliminarily stylized image with the original stylized background to obtain the final stylized image.
  • the embodiment of the application provides an image stylization processing method to determine whether the background complexity of the image to be processed is lower than the complexity threshold, and if so, replace the original background of the image to be processed with a preset template background to obtain the target Image: After the target image is stylized by the stylized processing model, the background of the processed preliminary stylized image is replaced with the original background to obtain the final stylized image.
  • the solution of the embodiment of the application takes into account the complexity of the image background when stylizing the image. When the background complexity of the image to be processed is low, the method of replacing the template background for the image to be processed is used to perform stylization. This avoids the use of stylized processing methods in related technologies for images to be processed with low background complexity, and the processing results are rough, and the fineness and aesthetics of the image stylized processing results are improved.
  • Fig. 3 is a flowchart of the method for providing video learning materials provided in the second embodiment of the application; this embodiment has been modified on the basis of the optional solutions provided in the above-mentioned embodiments, and shows how to train the stylized processing model Detailed introduction.
  • the method in this embodiment may include the following steps:
  • a convolutional neural network with a preset number of layers can be constructed in advance according to actual stylization processing requirements, and corresponding initial parameters can be set for each layer.
  • the initial parameters can be the initial number of channels and loss weights. Values, channel parameters, stylization processing algorithm and its algorithm parameters, etc., to complete the construction of the initial network model.
  • the initial network model constructed in this step cannot be directly used to stylize the image to be processed. You can first construct the initial network The model is trained.
  • the sample image data may be training data required for training the initial network model, and it may be composed of multiple sets of original images and stylized processed images of each original image.
  • the stylized training of the initial network model constructed in S301 may be to sequentially use each set of original images in the sample image data and the stylized processed images of the original images as a set of input data, and input them to the initial network model.
  • the relevant initial parameters set in the initial network model are trained.
  • the training process may be similar to the training method of the neural network model that performs image stylization processing by the related technology.
  • the verification image data may be verification data used to verify whether the trained initial network model can perform stylized processing operations with high quality.
  • the verification image data can be obtained by using a certain proportion (such as 80%) of the image data in the acquired image as the sample image data, and the remaining proportion (such as 20%) of the image data as the verification image. Data; the verification image data can also be specially selected image data under various shooting scenes.
  • the attribute parameter of the output image may be a judgment parameter used to verify the stylization processing effect of the output image, where the attribute parameter may include at least one of a saturation parameter, an edge smoothness parameter, and a shadow parameter, for each dimension of the attribute.
  • the parameters can be determined by fixed formulas or algorithms.
  • this step may be to use one or more sets of sample image data to stylize the initial network model, and then use the verification image data to verify whether the initial network model trained in S302 can perform stylization with high quality
  • the processing operation is verified, that is, it is verified whether the initial network model trained in S302 can be used as a stylized processing model that can be actually used.
  • the verification process may be to use the verification image as the input data, call and run the program code of the trained initial network model. At this time, the trained initial network model will compare the input verification image according to the training algorithm. Perform stylization processing operations and output the stylized processing results, that is, verify the stylized processed image.
  • the saturation of the image can be calculated as the saturation parameter; the smoothness of the edge contour in the image is calculated as the edge smoothness parameter; and the contours other than the edge contour of the image can be calculated.
  • the smoothness of other areas is used as a shadow parameter.
  • each parameter value in the attribute parameter of the output image of the initial network model after training is greater than its corresponding parameter threshold, it means that the initial network model has been trained at this time, and S305 can be executed to use the trained initial network model as the Stylize the model; otherwise, it means that the effect of stylizing the initial network model at this time is not very good and can be further optimized. At this time, perform S304 to adjust and optimize the model parameters of the initial network model.
  • At least two sets of verification image data may be selected to perform this step on the trained initial network model.
  • S305 may be executed to use the trained initial network model as the stylization processing model.
  • At least one dimension of the number of layers for performing data processing operations within the model, the number of channels of each layer, and the loss weight value may be adjusted.
  • the initial network model may be adjusted first.
  • the preset modification range can be the first modification range set in advance, or at least two optional modification values set in advance.
  • one modification can be set Range: For the number of channels, you can set multiple optional modification values such as an increase of 1.2 times, 1.5 times, and 1.6 times.
  • At least two model parameters can also be adjusted at a time.
  • S307 Input the target image into the stylization processing model to obtain a preliminary stylized image.
  • the embodiment of the application provides an image stylization processing method. After training the constructed initial network model using sample image data, if the verification image data is used to verify the multi-dimensionality of the stylized processed image output by the trained initial network model If the attribute parameter is not greater than the parameter threshold, the multi-dimensional model parameters of the initial network model are adjusted and retrained; otherwise, the training of the initial network model is completed, and the stylized processing model is obtained.
  • the process of training the initial network model in this embodiment through the verification of the multi-dimensional attribute parameters and the adjustment of the multi-dimensional model parameters, the quality of the processing effect of the stylization processing model is greatly improved, and the stylization of the subsequent processing image The processing operation lays the foundation.
  • the background complexity of the image to be processed is lower than the complexity threshold, replace the original background of the image to be processed with the preset template background, and then use the stylized processing model to style
  • the final stylized image is obtained after the background of the obtained preliminary stylized image is replaced with the original background.
  • the background complexity of the image to be processed is considered, and the fineness and precision of the image stylized processing result are further improved. Aesthetics.
  • FIG. 4 is a flowchart of a method for providing video learning materials provided in Embodiment 3 of the application; this embodiment has been modified on the basis of the optional solutions provided in the foregoing embodiments, and the input style of the target image is given In the stylized processing model, a detailed introduction to the preliminary stylized image is obtained.
  • the method in this embodiment may include the following steps:
  • S402 Determine an area to be processed according to the received area selection instruction.
  • a sliding operation on the image to be processed triggers an area selection instruction, where the area selection instruction includes the area to be processed selected by the user.
  • the region corresponding to the user's sliding operation may be used as the region to be processed, and the position coordinates corresponding to the region to be processed Is added to the area selection instruction and transmitted to the electronic device;
  • the area selection instruction is triggered by the user's closed sliding operation on the image to be processed, the closed frame selection area corresponding to the user's sliding operation can be used as the area to be processed, and The position coordinates corresponding to the area to be processed are added to the area selection instruction and transmitted to the electronic device.
  • the electronic device After receiving the area selection instruction triggered by the user, the electronic device obtains the coordinate position of the area to be processed from the area selection instruction.
  • S403 Input the target image and the region to be processed into a stylization processing model, and control the stylization processing model to perform stylization processing on the content of the region to be processed in the target image to obtain a preliminary stylized image.
  • the target image obtained in S401 and the region to be processed determined in S402 can be used as input data, and the program code of the stylized processing model is called and executed.
  • the stylized processing model is based on the input target image and For the area to be processed, according to the training algorithm, only the content of the area to be processed in the target image is stylized. In the preliminary stylized image obtained, only the area to be processed is displayed with the effect of stylization, and the rest of the area Still not stylized.
  • this step may be to replace the background of the initial stylized image obtained in S403 with the original background of the image to be processed to obtain the final stylized image.
  • this step may be to determine the position coordinates of the area to be processed in the background area, and then use the original background and the position coordinates of the area to be processed in the background area as the input data.
  • the background processing model is controlled to only stylize the content of the position coordinate area in the original background to obtain the processed original background; finally, the background of the initial stylized image obtained in S403 is replaced with the processed original Background, get the final stylized image.
  • the embodiment of the application provides an image stylization processing method. If a user triggers a region selection instruction when selecting an image to be processed, when the background complexity of the image to be processed is lower than the complexity threshold, the The original background is replaced with the preset template background. After the target image is obtained, the area to be processed is determined according to the area selection instruction triggered by the user, and the stylization processing model is controlled to only stylize the area to be processed in the target image. The background of the preliminary stylized image is replaced with the original background to obtain the final stylized image.
  • the solution of the embodiment of the present application not only considers the complexity of the image background, but also improves the fineness and beauty of the image stylization processing result; it can also generate the user's region selection instructions for the user
  • the personalized stylized processing effect improves the fun of image stylized processing.
  • FIG. 5 is a schematic structural diagram of an image stylization processing device provided in Embodiment 4 of the application.
  • the embodiment of this application can be applied to a situation where an image to be processed is stylized, for example, when the background complexity is lower than the complexity threshold. Deal with the situation where the image is stylized.
  • the device can be implemented by software and/or hardware, and integrated in the electronic device that executes the method. As shown in Fig. 5, the device can include:
  • the background replacement module 501 is configured to, if it is determined that the background complexity of the image to be processed is lower than the complexity threshold, replace the original background of the image to be processed with the template background to obtain the target image;
  • the stylization processing module 502 is configured to input the target image into the stylization processing model to obtain a preliminary stylized processing image
  • the background replacement module 501 is further configured to replace the background of the preliminary stylized image with the original background to obtain the final stylized image.
  • the embodiment of the application provides an image stylization processing device to determine whether the background complexity of the image to be processed is lower than the complexity threshold, and if so, replace the original background of the image to be processed with a preset template background to obtain the target Image: After the target image is stylized by the stylized processing model, the background of the processed preliminary stylized image is replaced with the original background to obtain the final stylized image.
  • the solution of the embodiment of the application takes into account the complexity of the image background when stylizing the image. When the background complexity of the image to be processed is low, the method of replacing the template background for the image to be processed is used to perform stylization. This avoids the use of stylized processing methods in related technologies for images to be processed with low background complexity, and the processing results are rough, and the fineness and aesthetics of the image stylized processing results are improved.
  • the device further includes a complexity judgment model, and the complexity judgment model is set as follows when the background complexity of the image to be processed is determined to be lower than the complexity threshold value:
  • the texture feature of the original background of the image to be processed is extracted, and according to the texture feature, it is determined whether the background complexity of the image to be processed is lower than the complexity threshold.
  • the complexity judgment model may be set as:
  • the device further includes: a model training module, and the model training module includes:
  • the training unit is set to use sample image data to stylize the constructed initial network model
  • the verification unit is configured to use the verification image data to verify whether the attribute parameter of the output image of the initial network model after training is greater than the parameter threshold; wherein the attribute parameter includes: at least one of a saturation parameter, an edge smoothness parameter, and a shadow parameter ;
  • the model determining unit is configured to use the trained initial network model as the stylization processing model if the attribute parameter of the output image of the initial network model after training is greater than the parameter threshold.
  • model training module further includes:
  • the parameter adjustment unit is configured to adjust the model parameters of the initial network model within a preset modification range if the attribute parameters of the output image of the initial network model after training are less than or equal to the parameter threshold; wherein, the model parameters include the initial At least one of the number of layers, the number of channels, and the loss weight value of the network model;
  • the training unit is also configured to use sample image data to re-train the initial network model after adjusting the model parameters.
  • the stylization processing module 502 may be configured as:
  • the target image and the region to be processed are input into a stylization processing model, and the stylization processing model is controlled to perform stylization processing on the content of the region to be processed of the target image to obtain a preliminary stylized image.
  • the background replacement module 501 when the background replacement module 501 executes to replace the background of the preliminary stylized image with the original background, it may be set to:
  • the background of the preliminary stylized processed image is replaced with the processed original background.
  • the image stylization processing device provided in the embodiments of this application belongs to the same inventive concept as the image stylization processing methods provided in the above embodiments.
  • the application embodiments have the same beneficial effects as the foregoing embodiments.
  • FIG. 6 is a schematic structural diagram of an electronic device 600 suitable for implementing an embodiment of the present application.
  • the electronic device may include mobile phones such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablets), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), etc. Terminals and fixed terminals such as digital TVs, desktop computers, etc.
  • the electronic device 600 shown in FIG. 6 is only an example.
  • the electronic device 600 may include a processing device (such as a central processing unit, a graphics processor, etc.) 601, which may be loaded into a random access device according to a program stored in a read-only memory (ROM) 602 or from a storage device 608.
  • the program in the memory (RAM) 603 executes various appropriate actions and processing.
  • various programs and data required for the operation of the electronic device 600 are also stored.
  • the processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604.
  • An input/output (I/O) interface 605 is also connected to the bus 604.
  • the following devices can be connected to the I/O interface 605: including input devices 606 such as touch screens, touch pads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; including, for example, liquid crystal displays (LCD), speakers, vibration An output device 607 such as a device; a storage device 608 such as a magnetic tape and a hard disk; and a communication device 609.
  • the communication device 609 may allow the electronic device 600 to perform wireless or wired communication with other devices to exchange data.
  • FIG. 6 shows an electronic device 600 having various devices, it should be understood that it is not required to implement or have all the illustrated devices. It may alternatively be implemented or provided with more or fewer devices.
  • the process described above with reference to the flowchart can be implemented as a computer software program.
  • the embodiments of the present application include a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart.
  • the computer program may be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602.
  • the processing device 601 the above-mentioned functions in the method of the embodiment of the present application are executed.
  • the above-mentioned computer-readable medium in this application may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two.
  • the computer-readable storage medium may be, for example, an electric, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the above.
  • Examples of computer-readable storage media may include: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) Or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program, and the program may be used by or in combination with an instruction execution system, apparatus, or device.
  • the computer-readable signal medium may include a data signal propagated in a baseband or as a part of a carrier wave, and a computer-readable program code is carried therein. This propagated data signal can take many forms, and can include electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium.
  • the computer-readable signal medium may send, propagate, or transmit the program for use by or in combination with the instruction execution system, apparatus, or device .
  • the program code contained on the computer-readable medium can be transmitted by any suitable medium, which may include: wire, optical cable, RF (Radio Frequency), etc., or any suitable combination of the above.
  • the electronic device can communicate with any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and can communicate with any form or medium of digital data (
  • communication networks are interconnected.
  • Examples of communication networks include local area networks (“LAN”), wide area networks (“WAN”), the Internet (for example, the Internet), and end-to-end networks (for example, ad hoc end-to-end networks), as well as any currently known or future research and development network of.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or it may exist alone without being assembled into the electronic device.
  • the aforementioned computer-readable medium carries one or more programs.
  • the internal processes of the electronic device are executed: if it is determined that the background complexity of the image to be processed is lower than the complexity threshold, Then replace the original background of the image to be processed with the template background to obtain the target image; input the target image into the stylization processing model to obtain the preliminary stylized image; replace the background of the preliminary stylized image with The original background obtains the final stylized processed image.
  • the computer program code used to perform the operations of the present application can be written in one or more programming languages or a combination thereof.
  • the aforementioned programming languages can include object-oriented programming languages—such as Java, Smalltalk, C++, and also conventional The procedural programming language-such as "C" language or similar programming language.
  • the program code can be executed entirely on the user's computer, partly on the user's computer, executed as an independent software package, partly on the user's computer and partly executed on a remote computer, or entirely executed on the remote computer or server.
  • the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, using an Internet service provider to pass Internet connection).
  • LAN local area network
  • WAN wide area network
  • each block in the flowchart or block diagram may represent a module, program segment, or part of code, and the module, program segment, or part of code contains one or more for realizing the specified logical function Executable instructions.
  • the functions marked in the block may also occur in a different order from the order marked in the drawings. For example, two blocks shown in succession can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved.
  • each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart can be implemented by a dedicated hardware-based system that performs the specified functions or operations Or it can be realized by a combination of dedicated hardware and computer instructions.
  • the units involved in the embodiments described in the present application can be implemented in software or hardware. Among them, the name of the unit does not constitute a limitation on the unit itself.
  • exemplary types of hardware logic components include: Field Programmable Gate Array (FPGA), Application Specific Integrated Circuit (ASIC), Application Specific Standard Product (ASSP), System on Chip (SOC), Complex Programmable Logical device (CPLD) and so on.
  • FPGA Field Programmable Gate Array
  • ASIC Application Specific Integrated Circuit
  • ASSP Application Specific Standard Product
  • SOC System on Chip
  • CPLD Complex Programmable Logical device
  • a machine-readable medium may be a tangible medium, which may contain or store a program for use by the instruction execution system, apparatus, or device or in combination with the instruction execution system, apparatus, or device.
  • the machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • the machine-readable medium may include an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing.
  • machine-readable storage media may include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) Or flash memory), optical fiber, compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read-only memory
  • EPROM erasable programmable read-only memory
  • flash memory flash memory
  • optical fiber compact disk read-only memory
  • CD-ROM compact disk read-only memory
  • magnetic storage device or any suitable combination of the foregoing.
  • the method includes:
  • the background of the preliminary stylized image is replaced with the original background to obtain the final stylized image.
  • determining that the background complexity of the image to be processed is lower than the complexity threshold includes:
  • the texture feature of the original background of the image to be processed is extracted, and according to the texture feature, it is determined whether the background complexity of the image to be processed is lower than the complexity threshold.
  • extracting the texture feature of the original background of the image to be processed, and determining whether the background complexity of the image to be processed is lower than the complexity threshold according to the texture feature includes:
  • the method before inputting the target image into the stylization processing model, the method further includes:
  • the verification image data is used to verify whether the attribute parameters of the output image of the initial network model after the training are greater than the parameter threshold; wherein, the attribute parameters include at least one of a saturation parameter, an edge smoothness parameter, and a shadow parameter;
  • the initial network model after training is used as the stylized processing model.
  • the method after verifying whether the attribute parameter of the output image of the initial network model after training is greater than the parameter threshold, the method further includes:
  • model parameters of the initial network model include at least one of the number of layers, the number of channels, and the loss weight value of the initial network model;
  • the sample image data is used to re-train the initial network model after adjusting the model parameters.
  • inputting the target image into a stylization processing model to obtain a preliminary stylization processing image includes:
  • the target image and the region to be processed are input into a stylization processing model, and the stylization processing model is controlled to perform stylization processing on the content of the region to be processed of the target image to obtain a preliminary stylized image.
  • replacing the background of the preliminary stylized image with the original background includes:
  • the background of the preliminary stylized processed image is replaced with the processed original background.
  • the background replacement module is configured to, if it is determined that the background complexity of the image to be processed is lower than the complexity threshold, replace the original background of the image to be processed with the template background to obtain the target image;
  • the stylization processing module is set to input the target image into the stylization processing model to obtain a preliminary stylized processing image
  • the background replacement module is further configured to replace the background of the preliminary stylized image with the original background to obtain the final stylized image.
  • the above-mentioned apparatus further includes a complexity judgment model, which is set as follows when the background complexity of the image to be processed is determined to be lower than the complexity threshold value:
  • the texture feature of the original background of the image to be processed is extracted, and according to the texture feature, it is determined whether the background complexity of the image to be processed is lower than the complexity threshold.
  • the complexity judgment model in the above-mentioned device may be set as:
  • the above-mentioned device further includes: a model training module, and the model training module includes:
  • the training unit is set to use sample image data to stylize the constructed initial network model
  • the verification unit is configured to use the verification image data to verify whether the attribute parameter of the output image of the initial network model after training is greater than the parameter threshold; wherein the attribute parameter includes: at least one of a saturation parameter, an edge smoothness parameter, and a shadow parameter ;
  • the model determining unit is configured to use the trained initial network model as the stylization processing model if the attribute parameter of the output image of the initial network model after training is greater than the parameter threshold.
  • the model training module in the above-mentioned device further includes:
  • the parameter adjustment unit is configured to adjust the model parameters of the initial network model within a preset modification range if the attribute parameters of the output image of the initial network model after training are less than or equal to the parameter threshold; wherein, the model parameters include the initial At least one of the number of layers, the number of channels, and the loss weight value of the network model;
  • the training unit is also configured to use sample image data to re-train the initial network model after adjusting the model parameters.
  • the stylization processing module in the above-mentioned device may be set to:
  • the target image and the region to be processed are input into a stylization processing model, and the stylization processing model is controlled to perform stylization processing on the content of the region to be processed of the target image to obtain a preliminary stylized image.
  • the background replacement module in the above-mentioned device executes the replacement of the background of the preliminary stylized image with the original background, it may be set to:
  • the background of the preliminary stylized processed image is replaced with the processed original background.
  • the electronic device includes:
  • One or more processors are One or more processors;
  • the memory is set to store one or more programs
  • the one or more processors When the one or more programs are executed by the one or more processors, the one or more processors implement the image stylization processing method according to any embodiment of the present application.
  • a readable medium provided according to one or more embodiments of the present application has a computer program stored thereon, and when the program is executed by a processor, the image stylization processing method as described in any of the embodiments of the present application is implemented.

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

An image stylization processing method and apparatus, and an electronic device and a readable medium. The method comprises: on the basis of a result of determining that the background complexity of an image to be processed is lower than a complexity threshold value, replacing an original background of the image to be processed with a template background to obtain a target image (S201); inputting the target image into a stylization processing model to obtain a preliminary stylization processed image (S202); and replacing the background of the preliminary stylization processed image with the original background to obtain a stylization processed image (S203).

Description

图像风格化处理方法、装置、电子设备及可读介质Image stylization processing method, device, electronic equipment and readable medium
本公开要求在2019年09月25日提交中国专利局、申请号为201910910696.4的中国专利申请的优先权,以上申请的全部内容通过引用结合在本公开中。This disclosure claims the priority of a Chinese patent application filed with the Chinese Patent Office with an application number of 201910910696.4 on September 25, 2019, and the entire content of the above application is incorporated into this disclosure by reference.
技术领域Technical field
本申请实施例涉及互联网技术领域,例如涉及一种图像风格化处理方法、装置、电子设备及可读介质。The embodiments of the present application relate to the field of Internet technology, for example, to an image stylization processing method, device, electronic device, and readable medium.
背景技术Background technique
相关技术中的终端设备大都配置有拍照功能,为了满足终端用户个性化的需求,终端设备的拍照功能下通常都具备图像处理功能,实现对终端用户拍摄到的图像进行风格化处理。Most terminal devices in the related art are equipped with a photographing function. In order to meet the individual needs of terminal users, the photographing function of the terminal device usually has an image processing function to realize stylized processing of images captured by the terminal user.
相关技术中,终端设备在对图像进行风格化处理时,通常采用的方法是通过神经网络模型采用风格化处理算法直接对整张图像进行风格化处理。但是由于不同图像的内容复杂度是不一样的,相关技术中的方法在实际执行风格化处理时,很难满足不同复杂度的图像的风格化处理需求,容易出现风格化处理结果粗糙,影响美观度的情况,亟需改进。In related technologies, when a terminal device performs stylization processing on an image, a method usually adopted is to directly perform stylization processing on the entire image through a neural network model and a stylization processing algorithm. However, because the content complexity of different images is different, it is difficult for the methods in related technologies to meet the stylization processing requirements of images of different complexity when actually performing stylization processing, and the stylization processing results are likely to be rough and affect the aesthetics. The situation of high degrees needs to be improved urgently.
发明内容Summary of the invention
本申请实施例提供一种图像风格化处理方法、装置、电子设备及可读介质,在对图像进行风格化处理时,考虑了图像背景的复杂程度,提高了图像风格化处理结果的精细度和美观度。The embodiments of the application provide an image stylization processing method, device, electronic device, and readable medium. When stylizing an image, the complexity of the image background is taken into consideration, and the fineness and precision of the image stylization processing result are improved. Aesthetics.
第一方面,本申请实施例提供了一种图像风格化处理方法,该方法包括:In the first aspect, an embodiment of the present application provides an image stylization processing method, which includes:
基于确定待处理图像的背景复杂度低于复杂度阈值的结果,将所述待处理图像的原始背景替换为模板背景,得到目标图像;Based on the result of determining that the background complexity of the image to be processed is lower than the complexity threshold, replacing the original background of the image to be processed with the template background to obtain the target image;
将所述目标图像输入风格化处理模型中,得到初步风格化处理图像;Input the target image into a stylized processing model to obtain a preliminary stylized processed image;
将所述初步风格化处理图像的背景替换为所述原始背景,得到风格化处理图像。The background of the preliminary stylized image is replaced with the original background to obtain the stylized image.
第二方面,本申请实施例还提供了一种图像风格化处理装置,包括:In the second aspect, an embodiment of the present application also provides an image stylization processing device, including:
背景替换模块,被设置为基于确定待处理图像的背景复杂度低于复杂度阈值的结果,将所述待处理图像的原始背景替换为模板背景,得到目标图像;The background replacement module is configured to replace the original background of the image to be processed with the template background based on the result of determining that the background complexity of the image to be processed is lower than the complexity threshold to obtain the target image;
风格化处理模块,被设置为将所述目标图像输入风格化处理模型中,得到初步风格化处理图像;The stylization processing module is set to input the target image into the stylization processing model to obtain a preliminary stylized processing image;
所述背景替换模块,还被设置为将所述初步风格化处理图像的背景替换为所述原始背景,得到风格化处理图像。The background replacement module is further configured to replace the background of the preliminary stylized image with the original background to obtain the stylized image.
第三方面,本申请实施例还提供了一种电子设备,该电子设备包括:In a third aspect, an embodiment of the present application also provides an electronic device, which includes:
处理器;processor;
存储器,用于存储程序;Memory, used to store programs;
当所述程序被所述处理器执行,使得所述处理器实现如本申请任意实施例所述的图像风格化处理方法。When the program is executed by the processor, the processor realizes the image stylization processing method according to any embodiment of the present application.
第四方面,本申请实施例提供了一种可读介质,所述可读介质上存储有计算机程序,所述计算机程序被处理器执行时实现如本申请任意实施例所述的图像风格化处理方法。In a fourth aspect, an embodiment of the present application provides a readable medium with a computer program stored on the readable medium, and when the computer program is executed by a processor, the image stylization process as described in any of the embodiments of the present application is realized. method.
附图说明Description of the drawings
结合附图并参考以下具体实施方式,本申请各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。With reference to the drawings and the following specific implementations, the above and other features, advantages, and aspects of the embodiments of the present application will become more apparent. Throughout the drawings, the same or similar reference signs indicate the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
图1A-1B为相关技术对待处理图像进行风格化处理的效果示意图;Figures 1A-1B are schematic diagrams of the effect of stylizing images to be processed by related technologies;
图2A为本申请实施例一提供的图像风格化处理方法的流程图;2A is a flowchart of an image stylization processing method provided in Embodiment 1 of this application;
图2B-2E为本申请实施例一提供的对待处理图像进行风格化处理的效果示意图;2B-2E are schematic diagrams of the effect of stylizing an image to be processed according to Embodiment 1 of the application;
图3为本申请实施例二提供的图像风格化处理方法的流程图;FIG. 3 is a flowchart of an image stylization processing method provided in Embodiment 2 of the application;
图4为本申请实施例三提供的图像风格化处理方法的流程图;4 is a flowchart of an image stylization processing method provided in Embodiment 3 of this application;
图5为本申请实施例四提供的图像风格化处理装置的结构示意图;FIG. 5 is a schematic structural diagram of an image stylization processing apparatus provided in Embodiment 4 of the application;
图6为本申请实施例五提供的电子设备的结构示意图。FIG. 6 is a schematic structural diagram of an electronic device provided in Embodiment 5 of this application.
具体实施方式detailed description
下面将参照附图更详细地描述本申请的实施例。虽然附图中显示了本申请的一些实施例,然而应当理解的是,本申请可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例。提供这些实施例是为了更加透彻和完整地理解本申请。应当理解的是,本申请的附图及实施例仅用于示例性作用,并 非用于限制本申请的保护范围。Hereinafter, embodiments of the present application will be described in more detail with reference to the accompanying drawings. Although some embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms, and should not be construed as being limited to the embodiments set forth herein. These examples are provided for a more thorough and complete understanding of this application. It should be understood that the drawings and embodiments of the present application are only used for exemplary purposes, and are not used to limit the protection scope of the present application.
应当理解,本申请的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本申请的范围在此方面不受限制。It should be understood that the steps described in the method embodiments of the present application may be executed in a different order, and/or executed in parallel. In addition, method implementations may include additional steps and/or omit to perform the illustrated steps. The scope of this application is not limited in this respect.
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。The term "including" and its variations as used herein are open-ended includes, that is, "including but not limited to". The term "based on" is "based at least in part on." The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments." Related definitions of other terms will be given in the following description.
需要注意,本申请中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。It should be noted that the concepts of "first" and "second" mentioned in this application are only used to distinguish different devices, modules, or units, and are not used to limit the order of functions performed by these devices, modules or units. Or interdependence.
需要注意,本申请中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。本申请实施方式中的多方之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。It should be noted that the modification of “a” and “a plurality of” mentioned in this application is illustrative and not restrictive, and those skilled in the art should understand that unless the context clearly indicates otherwise, it should be understood as “one or Multiple". The names of messages or information exchanged between multiple parties in the embodiments of the present application are only used for illustrative purposes, and are not used to limit the scope of these messages or information.
需要说明的是,在介绍本申请实施例之前,先对本申请实施例的图像风格化处理方法、装置、电子设备及可读介质的适用场景进行说明。本申请实施例适可用于对用户通过电子设备(如手机、平板电脑、可穿戴设备以及照相机等)拍摄的图像、电子设备图库中已存的图像进行风格化处理的过程,以为用户生成个性化的图像。在对待处理图像进行风格化处理时,通常采用预先训练好的神经网络模型对整张图像进行风格化处理,此时当待处理图像的背景部分复杂度比较低时,容易出现风格化处理结果粗糙的情况。示例性的,图1A为背景图像复杂度较低的待处理图像,图1B为对图1A所示的待处理图像按照相关技术中的方法进行漫画风格处理后的效果图,该效果图整体效果较差,严重影响漫画风格处理的美观度。因此,亟需改进相关技术中的图像风格化处理方法。It should be noted that, before introducing the embodiments of the present application, the applicable scenarios of the image stylization processing method, apparatus, electronic equipment, and readable medium of the embodiments of the present application are described first. The embodiments of this application are suitable for the process of stylizing images taken by users through electronic devices (such as mobile phones, tablets, wearable devices, cameras, etc.), and images stored in electronic device galleries, so as to generate personalization for users Image. When stylizing the image to be processed, a pre-trained neural network model is usually used to stylize the entire image. At this time, when the complexity of the background part of the image to be processed is relatively low, the stylization result is likely to be rough Case. Exemplarily, FIG. 1A is an image to be processed with a low background image complexity, and FIG. 1B is an effect diagram of the image to be processed shown in FIG. 1A after being processed in a comic style according to a method in the related art, and the overall effect of the effect diagram Poor, seriously affecting the aesthetics of manga style processing. Therefore, there is an urgent need to improve image stylization processing methods in related technologies.
下面针对本申请下述实施例提供的一种图像风格化处理方法、装置、电子设备及可读介质进行详细阐述。The following describes in detail an image stylization processing method, device, electronic device, and readable medium provided in the following embodiments of the present application.
实施例一Example one
图2A为本申请实施例一提供的图像风格化处理方法的流程图;如2B-2E为 本申请实施例一提供的对待处理图像进行风格化处理的效果示意图。本实施例可适用于对待处理图像进行风格化处理的情况,例如适用于对背景复杂度低于复杂度阈值的待处理图像进行风格化处理的情况。该方法可以由图像风格化处理装置或电子设备来执行,该装置可以通过软件和/或硬件的方式来实现,该装置可以配置在电子设备中。可选的,该电子设备可以是手机、平板电脑、可穿戴设备以及照相机等具有图像处理功能的终端设备。2A is a flowchart of an image stylization processing method provided in Embodiment 1 of this application; for example, 2B-2E are schematic diagrams of effects of stylizing an image to be processed provided in Embodiment 1 of this application. This embodiment is applicable to the case of stylizing the image to be processed, for example, it is applicable to the case of stylizing the image to be processed whose background complexity is lower than the complexity threshold. The method may be executed by an image stylization processing device or an electronic device, and the device may be implemented by software and/or hardware, and the device may be configured in the electronic device. Optionally, the electronic device may be a terminal device with image processing functions such as a mobile phone, a tablet computer, a wearable device, and a camera.
可选的,如图2A所示,本实施例中的方法可以包括如下步骤:Optionally, as shown in FIG. 2A, the method in this embodiment may include the following steps:
S201,若确定待处理图像的背景复杂度低于复杂度阈值,则将待处理图像的原始背景替换为模板背景,得到目标图像。S201: If it is determined that the background complexity of the image to be processed is lower than the complexity threshold, replace the original background of the image to be processed with a template background to obtain a target image.
其中,待处理图像可以是本实施例中待进行风格化处理的图像,可以是电子设备上的摄像头当前拍摄的图像,也可以是从电子设备本地图库中根据用户的点击操作选择的已存图像。待处理图像的原始背景可以是待处理图像自身原有的背景,例如,图2B所示的待处理图像,其原始背景为灰色背景。模板背景是预先设置的高复杂度的背景图像,可选的,本实施例中的模板背景的个数可以有一个或多个,当模板背景有多个时,可以是设置多个不同复杂度的背景图像作为模板背景。复杂度阈值可以是预先设置的用于判断是否对待处理图像进行背景替换的评判标准。该复杂度阈值可以是针对背景复杂度设置的阈值。背景复杂度可以是待处理图像中背景区域的复杂程度,例如,当待处理图像的背景区域为墙壁、蓝天、大海等简单的纯色背景时,则背景复杂度低;当待处理图像的背景区域为马路、公园等杂乱背景时,则背景复杂度高。Among them, the image to be processed can be the image to be stylized in this embodiment, it can be an image currently shot by the camera on the electronic device, or it can be a saved image selected from the local gallery of the electronic device according to the user's click operation. . The original background of the image to be processed may be the original background of the image to be processed. For example, the original background of the image to be processed shown in FIG. 2B is a gray background. The template background is a pre-set high-complexity background image. Optionally, the number of template backgrounds in this embodiment can be one or more. When there are multiple template backgrounds, it can be set with multiple different complexities. The background image is used as the template background. The complexity threshold may be a pre-set criterion for judging whether to perform background replacement on the image to be processed. The complexity threshold may be a threshold set for the background complexity. The background complexity can be the complexity of the background area in the image to be processed. For example, when the background area of the image to be processed is a simple solid-color background such as a wall, blue sky, sea, etc., the background complexity is low; when the background area of the image to be processed When it is a chaotic background such as a road or a park, the background complexity is high.
可选的,本步骤中,确定待处理图像的背景复杂度是否低于复杂度阈值的第一种可实施方式是,对待处理图像的背景区域进行像素点灰度直方图统计,直方图中灰度值分布范围越广,则说明背景复杂度越高。确定待处理图像的背景复杂度是否低于复杂度阈值的第二种可实施方式可以是提取待处理图像的原始背景的纹理特征,并根据所述纹理特征,确定待处理图像的背景复杂度是否低于复杂度阈值。在一实施例中,确定待处理图像的背景复杂度是否低于复杂度阈值的实施方式可以是,先采用纹理特征提取算法从待处理图像的原始背景中提取纹理特征,其中,提取纹理特征的算法可以包括统计法、几何法、模型法、结构分析法以及信号处理法等。在提取到待处理图像的原始背景的纹理特征后,可以将纹理特征对应像素点的数量或纹理特征对应的像素点占原始背景总像素点的比值作为待处理图像的背景复杂度,然后判断该背景复杂度是否低 于预先设置的复杂度阈值。Optionally, in this step, the first possible implementation manner for determining whether the background complexity of the image to be processed is lower than the complexity threshold is to perform pixel grayscale histogram statistics on the background area of the image to be processed, and the histogram is gray The wider the distribution range of the degree value, the higher the background complexity. The second possible implementation for determining whether the background complexity of the image to be processed is lower than the complexity threshold can be to extract the texture features of the original background of the image to be processed, and determine whether the background complexity of the image to be processed is Below the complexity threshold. In one embodiment, the implementation manner for determining whether the background complexity of the image to be processed is lower than the complexity threshold may be to first use a texture feature extraction algorithm to extract texture features from the original background of the image to be processed. Algorithms can include statistical methods, geometric methods, model methods, structural analysis methods, and signal processing methods. After extracting the texture feature of the original background of the image to be processed, the number of pixels corresponding to the texture feature or the ratio of the pixels corresponding to the texture feature to the total pixels of the original background can be used as the background complexity of the image to be processed, and then the Whether the background complexity is lower than the preset complexity threshold.
本步骤中,执行上述第二种可实施方式的一种可选执行方法是:对所述待处理图像的原始背景进行边缘检测,得到所述原始背景的纹理特征;确定所述纹理特征在所述原始背景中的像素占比,作为待处理图像的背景复杂度;确定待处理图像的背景复杂度是否低于复杂度阈值。在一实施例中,该方法可以是通过对待处理图像的原始背景内容进行边缘检测,将边缘检测结果作为原始图像的纹理特征。其中,边缘检测算法可以包括canny算法、Roberts算法以及Sobel算法等。然后确定边缘结果对应的像素点数量在原始背景的总像素点数量的像素占比,作为待处理图像的背景复杂度,将待处理图像的背景复杂度与预先设置的复杂度阈值进行比较,判断待处理图像的背景复杂度是否低于复杂度阈值。In this step, an optional execution method for executing the above-mentioned second implementable manner is: performing edge detection on the original background of the image to be processed to obtain the texture feature of the original background; determining that the texture feature is in the The proportion of pixels in the original background is used as the background complexity of the image to be processed; it is determined whether the background complexity of the image to be processed is lower than the complexity threshold. In an embodiment, the method may be to perform edge detection on the original background content of the image to be processed, and use the edge detection result as the texture feature of the original image. Among them, the edge detection algorithm may include canny algorithm, Roberts algorithm, Sobel algorithm and so on. Then determine the percentage of pixels corresponding to the edge result to the total number of pixels in the original background, as the background complexity of the image to be processed, compare the background complexity of the image to be processed with the preset complexity threshold, and determine Whether the background complexity of the image to be processed is lower than the complexity threshold.
可选的,通常情况下,在对待处理图像进行风格化处理时,若背景复杂度较低,则会出现处理结果粗糙的情况。本步骤中,待处理图像的背景复杂度高于或等于复杂度阈值,可以说明待处理图像的背景复杂度为高复杂度,此时采用统一的风格化处理方法就可以准确完成对待处理图像的风格化处理操作,即可以直接将待处理图像输入风格化处理模型中,获取风格化处理模型输出的结果作为该待处理图像的风格化处理图像。待处理图像的背景复杂度低于复杂度阈值,可以说明待处理图像的背景复杂度比较低,容易出现处理结果粗糙的情况,可以对待处理图像进行背景更换,将待处理图像的原始背景替换为预先设置好的模板背景,得到目标图像。示例性的,图2B为本实施例的待处理图像,该待处理图像的原始背景为纯灰色的低复杂度的背景,若该待处理图像的背景复杂度低于复杂度阈值,则可以将该图2B的灰色原始背景替换为预先设置的高复杂度的桃花源模板背景,得到如图2C所示的目标图像。Optionally, under normal circumstances, when stylizing the image to be processed, if the background complexity is low, the processing result will be rough. In this step, the background complexity of the image to be processed is higher than or equal to the complexity threshold, which can indicate that the background complexity of the image to be processed is high complexity. In this case, the uniform stylization processing method can accurately complete the image to be processed. The stylization processing operation is to directly input the image to be processed into the stylization processing model, and obtain the output result of the stylization processing model as the stylized image of the image to be processed. The background complexity of the image to be processed is lower than the complexity threshold, which can indicate that the background complexity of the image to be processed is relatively low, and the processing result is prone to be rough. The background of the image to be processed can be replaced, and the original background of the image to be processed can be replaced with The preset template background is used to obtain the target image. Exemplarily, FIG. 2B is the image to be processed in this embodiment. The original background of the image to be processed is a pure gray low-complexity background. If the background complexity of the image to be processed is lower than the complexity threshold, the The original gray background of FIG. 2B is replaced with a preset high-complexity template background of Peach Blossom Spring, to obtain the target image as shown in FIG. 2C.
可选的,本步骤无论是判断待处理图像的背景复杂度,还是执行背景替换操作,都可以先确定待处理图像的背景区域和前景区域。在一实施例中,确定方法可以是采用图像识别或图像聚类算法对待处理图像进行区域分割,得到待处理图像的背景区域和前景区域;确定方法还可以是预先训练背景分割模型,由背景分割模型来对待处理图像进行区域分割,得到待处理图像的背景区域和前景区域;确定方法还可以是由用户手动选择待处理图像的背景区域和前景区域。Optionally, in this step, whether to determine the background complexity of the image to be processed or to perform a background replacement operation, the background area and the foreground area of the image to be processed may be determined first. In one embodiment, the determination method may be to use image recognition or image clustering algorithms to segment the image to be processed to obtain the background area and foreground area of the image to be processed; the determination method may also be to pre-train the background segmentation model, which is divided by the background. The model is used to segment the image to be processed to obtain the background area and foreground area of the image to be processed; the determination method can also be that the user manually selects the background area and foreground area of the image to be processed.
S202,将目标图像输入风格化处理模型中,得到初步风格化处理图像。S202: Input the target image into the stylization processing model to obtain a preliminary stylization processing image.
其中,风格化处理模型可以是预先训练好的,可以实现对图像中的内容进 行风格化处理的神经网络模型。该风格化处理模型的训练过程将在后续实施例进行详细介绍。Among them, the stylization processing model can be a pre-trained neural network model that can implement stylization processing on the content in the image. The training process of the stylized processing model will be described in detail in subsequent embodiments.
可选的,本步骤中,可以将S201对待处理图像进行背景替换后得到的目标图像作为输入参数,调用并运行预先训练好的风格化处理模型的程序代码,此时该风格化处理模型会基于训练时的风格化处理算法,对输入的目标图像中的内容进行风格化处理,输出风格化处理后的图像,即初步风格化处理图像。Optionally, in this step, the target image obtained after background replacement of the image to be processed in S201 can be used as the input parameter, and the program code of the pre-trained stylization processing model can be called and run. At this time, the stylization processing model will be based on The stylization processing algorithm during training stylizes the content in the input target image, and outputs the stylized image, that is, the preliminary stylized image.
示例性的,将图2C所示的目标图像作为风格化处理模型的输入数据,调用并运行预先训练好的风格化处理模型的程序代码,此时该风格化处理模型可以基于训练时的漫画风格处理算法,对图2C所示的目标图像进行漫画风格化处理,得到图2D所示的初步风格化处理图像。Exemplarily, the target image shown in FIG. 2C is used as the input data of the stylization processing model, and the program code of the pre-trained stylization processing model is called and run. At this time, the stylization processing model can be based on the cartoon style during training. The processing algorithm is to perform comic stylization processing on the target image shown in FIG. 2C to obtain the preliminary stylized processed image shown in FIG. 2D.
可选的,本步骤的风格化处理模型对目标图像进行的风格化处理操作可以包括:漫画风格处理、像素化风格处理、素描风格处理或油画风格处理等多种滤镜形式的风格化处理。Optionally, the stylization processing operation performed on the target image by the stylization processing model in this step may include: comic style processing, pixelized style processing, sketch style processing, oil painting style processing and other stylization processing in the form of multiple filters.
S203,将初步风格化处理图像的背景替换为原始背景,得到最终的风格化处理图像。S203: Replace the background of the preliminary stylized image with the original background to obtain the final stylized image.
可选的,在得到初步风格化处理图像后,由于该初步风格化处理图像的背景不是待处理图像的原始图像,为了保证处理后的图像与原图像的一致性,本步骤还可以将初步风格化图像的当前背景替换为待处理图像的原始背景。在一实施例中,执行过程可以是先对初步风格化处理图像进行背景区域识别,确定初步风格化处理图像的当前背景(在一实施例中,确定方法可以与从待处理图像中确定原始背景的过程一样,对此不进行赘述),并将待处理图像的原始背景替换初步风格化处理图像的当前背景,得到最终的对待处理图像进行风格化处理后的风格化处理图像。示例性的,确定图2D所示的初步风格化处理图像的当前背景,并将图2B所示的待处理图像的原始背景替换图2D中的当前背景,得到图2E所示的风格化处理图像(即,最终的风格化处理图像)。Optionally, after the preliminary stylized image is obtained, since the background of the preliminary stylized image is not the original image of the image to be processed, in order to ensure the consistency between the processed image and the original image, the preliminary style may also be changed in this step. The current background of the transformed image is replaced with the original background of the image to be processed. In an embodiment, the execution process may be to first perform background area recognition on the preliminary stylized image, and determine the current background of the preliminary stylized image (in an embodiment, the determination method may be the same as determining the original background from the image to be processed). The process is the same, which will not be repeated), and the original background of the image to be processed is replaced with the current background of the preliminary stylized image to obtain the final stylized image after the image to be processed is stylized. Exemplarily, the current background of the preliminary stylized image shown in FIG. 2D is determined, and the original background of the image to be processed shown in FIG. 2B is replaced with the current background in FIG. 2D to obtain the stylized image shown in FIG. 2E (That is, the final stylized processed image).
可选的,本步骤若直接采用待处理图像的原始背景替换初步风格化处理图像的背景,生成最终的风格化处理图像,最终得到的图像的背景部分并没有执行风格化处理操作。为了提高待处理图像风格化处理的一致性和美观性,本步骤在执行将所述初步风格化处理图像的背景替换为所述原始背景时,还可以是将原始背景输入背景处理模型中,得到处理后原始背景;将所述初步风格化处理图像的背景替换为处理后的原始背景。其中,背景处理模型是预先训练的专 门对待处理图像的原始背景进行风格化处理的神经网络模型。该背景处理模型进行的风格化处理类型与S202中的风格化处理模型进行的风格化处理类型可以相同,两模型的训练过程也类似,训练后的各模型在执行风格化处理时的算法参数可以不同。在一实施例中,执行过程可以是将S201替换掉的原始背景作为背景处理模型的输入数据,调用并运行背景处理模型的程序代码,此时该背景处理模型会基于训练时的风格化处理算法,对输入的原始背景进行风格化处理操作,得到风格化处理后的原始背景,然后再将初步风格化处理图像的背景替换为风格化处理后的原始背景,得到最终的风格化处理图像。Optionally, in this step, if the original background of the image to be processed is directly used to replace the background of the preliminary stylized image to generate the final stylized image, the background part of the finally obtained image does not perform the stylization operation. In order to improve the consistency and aesthetics of the stylization process of the image to be processed, in this step, when the background of the preliminary stylized image is replaced with the original background, the original background may also be input into the background processing model to obtain The processed original background; replacing the background of the preliminary stylized processed image with the processed original background. Among them, the background processing model is a pre-trained neural network model that specializes in stylizing the original background of the image to be processed. The type of stylization processing performed by the background processing model can be the same as the type of stylization processing performed by the stylization processing model in S202. The training process of the two models is also similar. The algorithm parameters of each model after training can be used when performing stylization processing. different. In an embodiment, the execution process may be to use the original background replaced by S201 as the input data of the background processing model, and call and run the program code of the background processing model. At this time, the background processing model will be based on the stylized processing algorithm during training. , Stylize the input original background to obtain the original stylized background, and then replace the background of the preliminarily stylized image with the original stylized background to obtain the final stylized image.
本申请实施例提供了一种图像风格化处理方法,判断待处理图像的背景复杂度是否低于复杂度阈值,若是,则将该待处理图像的原始背景替换为预设的模板背景,得到目标图像;由风格化处理模型对目标图像进行风格化处理后,将处理得到的初步风格化处理图像的背景替换为原始背景,得到最终的风格化处理图像。本申请实施例的方案在对图像进行风格化处理时,考虑了图像背景的复杂程度,当待处理图像背景复杂度较低时,采用为待处理图像更换模板背景后再进行风格化处理的方法,避免了对背景复杂度较低的待处理图像采用相关技术中风格化处理方法,出现处理结果粗糙的情况,提高了图像风格化处理结果的精细度和美观度。The embodiment of the application provides an image stylization processing method to determine whether the background complexity of the image to be processed is lower than the complexity threshold, and if so, replace the original background of the image to be processed with a preset template background to obtain the target Image: After the target image is stylized by the stylized processing model, the background of the processed preliminary stylized image is replaced with the original background to obtain the final stylized image. The solution of the embodiment of the application takes into account the complexity of the image background when stylizing the image. When the background complexity of the image to be processed is low, the method of replacing the template background for the image to be processed is used to perform stylization. This avoids the use of stylized processing methods in related technologies for images to be processed with low background complexity, and the processing results are rough, and the fineness and aesthetics of the image stylized processing results are improved.
实施例二Example two
图3为本申请实施例二提供的视频学习素材的提供方法的流程图;本实施例在上述实施例提供的各可选方案的基础上进行了改动,给出了如何训练风格化处理模型的详细介绍。Fig. 3 is a flowchart of the method for providing video learning materials provided in the second embodiment of the application; this embodiment has been modified on the basis of the optional solutions provided in the above-mentioned embodiments, and shows how to train the stylized processing model Detailed introduction.
可选的,如图3所示,本实施例中的方法可以包括如下步骤:Optionally, as shown in FIG. 3, the method in this embodiment may include the following steps:
S301,构建初始网络模型。S301, construct an initial network model.
可选的,本步骤可以根据实际风格化处理的需求,预先构建一个预设层数的卷积神经网络,并为各层设置对应初始参数,其中,初始参数可以是初始的通道数、损失权重值、通道参数、风格化处理算法及其算法参数等,从而完成初始网络模型的构建,本步骤构建的初始网络模型不能直接用于对待处理图像进行风格化处理操作,可以先对构建的初始网络模型进行训练。Optionally, in this step, a convolutional neural network with a preset number of layers can be constructed in advance according to actual stylization processing requirements, and corresponding initial parameters can be set for each layer. The initial parameters can be the initial number of channels and loss weights. Values, channel parameters, stylization processing algorithm and its algorithm parameters, etc., to complete the construction of the initial network model. The initial network model constructed in this step cannot be directly used to stylize the image to be processed. You can first construct the initial network The model is trained.
S302,采用样本图像数据对初始网络模型进行风格化处理训练。S302, using the sample image data to perform stylization processing training on the initial network model.
其中,样本图像数据可以是训练初始网络模型所需要的训练数据,其可以 是由多组原图和各原图的风格化处理图像构成。Among them, the sample image data may be training data required for training the initial network model, and it may be composed of multiple sets of original images and stylized processed images of each original image.
可选的,本步骤中,对S301构建的初始网络模型进行风格化训练可以是依次将样本图像数据中的每一组原图和原图的风格化处理图像作为一组输入数据,输入到初始网络模型中,对初始网络模型中设置的相关初始参数进行训练。在一实施例中,训练过程可以与相关技术对执行图像风格化处理的神经网络模型的训练方式类似。Optionally, in this step, the stylized training of the initial network model constructed in S301 may be to sequentially use each set of original images in the sample image data and the stylized processed images of the original images as a set of input data, and input them to the initial network model. In the network model, the relevant initial parameters set in the initial network model are trained. In an embodiment, the training process may be similar to the training method of the neural network model that performs image stylization processing by the related technology.
S303,采用验证图像数据验证训练后的初始网络模型输出图像的属性参数是否大于参数阈值,若否,则执行S304,若是,则执行S305。S303: Use the verification image data to verify whether the attribute parameter of the output image of the initial network model after the training is greater than the parameter threshold, if not, execute S304, and if yes, execute S305.
其中,验证图像数据可以是用于验证训练后的初始网络模型是否能够高质量的执行风格化处理操作的验证数据。可选的,验证图像数据可以是在获取样本图像的过程中,将获取的图像中一定比例(如80%)的图像数据作为样本图像数据,剩余比例(如20%)的图像数据作为验证图像数据;验证图像数据还可以是专门选择出的各种拍摄场景下的图像数据。输出图像的属性参数可以是用于验证输出图像风格化处理效果的评判参数,其中,属性参数可以包括饱和度参数、边缘平滑度参数和阴影参数中的至少一个,针对其中的每一维度的属性参数可以通过固定的公式或算法来确定。The verification image data may be verification data used to verify whether the trained initial network model can perform stylized processing operations with high quality. Optionally, the verification image data can be obtained by using a certain proportion (such as 80%) of the image data in the acquired image as the sample image data, and the remaining proportion (such as 20%) of the image data as the verification image. Data; the verification image data can also be specially selected image data under various shooting scenes. The attribute parameter of the output image may be a judgment parameter used to verify the stylization processing effect of the output image, where the attribute parameter may include at least one of a saturation parameter, an edge smoothness parameter, and a shadow parameter, for each dimension of the attribute. The parameters can be determined by fixed formulas or algorithms.
可选的,本步骤可以是在采用一组或多组的样本图像数据对初始网络模型进行风格化处理训练后,采用验证图像数据对S302训练得到的初始网络模型是否能够高质量的执行风格化处理操作进行验证,也就是说验证S302训练得到的初始网络模型是否可以作为可实际使用的风格化处理模型。在一实施例中,验证过程可以是将验证图像作为输入数据,调用并运行训练后的初始网络模型的程序代码,此时训练后的初始网络模型会根据训练时的算法,对输入的验证图像进行风格化处理操作,输出风格化处理结果,即验证风格化处理图像。可选的,针对该验证风格化图像确定属性参数时,可以是计算该图像的饱和度作为饱和度参数;计算该图像中边缘轮廓的平滑程度作为边缘平滑度参数;计算该图像边缘轮廓以外的其他区域的平滑程度作为阴影参数。在判断计算出的属性参数是否大于参数阈值时,可以针对属性参数中的每一种参数都设置其对应的参数阈值,判断各种属性参数是否都大于其对应的参数阈值。若训练后的初始网络模型输出图像的属性参数中的各参数值都大于其对应的参数阈值,则说明此时初始网络模型已经训练好,可以执行S305,将训练后的初始网络模型作为所述风格化处理模型;否则,说明此时的初始网络模型进行风格化处理的效果 不是很好,可以进一步的优化,此时执行S304对初始网络模型的模型参数进行调整优化。Optionally, this step may be to use one or more sets of sample image data to stylize the initial network model, and then use the verification image data to verify whether the initial network model trained in S302 can perform stylization with high quality The processing operation is verified, that is, it is verified whether the initial network model trained in S302 can be used as a stylized processing model that can be actually used. In one embodiment, the verification process may be to use the verification image as the input data, call and run the program code of the trained initial network model. At this time, the trained initial network model will compare the input verification image according to the training algorithm. Perform stylization processing operations and output the stylized processing results, that is, verify the stylized processed image. Optionally, when determining the attribute parameters for the verified stylized image, the saturation of the image can be calculated as the saturation parameter; the smoothness of the edge contour in the image is calculated as the edge smoothness parameter; and the contours other than the edge contour of the image can be calculated. The smoothness of other areas is used as a shadow parameter. When judging whether the calculated attribute parameter is greater than the parameter threshold, the corresponding parameter threshold can be set for each parameter in the attribute parameter, and it is judged whether the various attribute parameters are greater than the corresponding parameter threshold. If each parameter value in the attribute parameter of the output image of the initial network model after training is greater than its corresponding parameter threshold, it means that the initial network model has been trained at this time, and S305 can be executed to use the trained initial network model as the Stylize the model; otherwise, it means that the effect of stylizing the initial network model at this time is not very good and can be further optimized. At this time, perform S304 to adjust and optimize the model parameters of the initial network model.
可选的,本实施例为了保证准确的对训练后的初始网络模型进行验证,可以是选择至少两组验证图像数据对训练后的初始网络模型进行本步骤的操作。当至少两组验证图像数据验证的结果都是输出图像的属性参数大于参数阈值时,可以执行S305,将训练后的初始网络模型作为所述风格化处理模型。Optionally, in this embodiment, in order to ensure accurate verification of the trained initial network model, at least two sets of verification image data may be selected to perform this step on the trained initial network model. When the result of the verification of at least two sets of verification image data is that the attribute parameter of the output image is greater than the parameter threshold, S305 may be executed to use the trained initial network model as the stylization processing model.
S304,若否,则在预设修改范围内调整初始网络模型的模型参数,并对调整模型参数后的初始网络模型返回执行S302的操作。S304: If not, adjust the model parameters of the initial network model within the preset modification range, and return to the initial network model after adjusting the model parameters to perform the operation of S302.
可选的,本步骤在调整S302训练后的初始网络模型的模型参数时,可以是从模型内部执行数据处理操作的层数、各层的通道数以及损失权重值中的至少一个维度进行调整。可选的,在对初始网络模型的模型参数进行调整时,可以是为层数、通道数和损失权重值设置优先级,按照优先级每次针对一个维度的模型参数,在该模型参数对应的预设修改范围内对该模型参数进行调整,修改完一个维度的模型参数后就返回执行S302-S303,即采用样本图像数据对调整模型参数后的初始网络模型重新进行风格化处理训练,以及采用验证图像数据验证训练后的初始网络模型输出图像的属性参数是否大于参数阈值的操作。可选的,若各模型参数的优先级为层数高于通道数,通道数高于损失权重值,则可以是先调整通道数,将通道数增加1后返回执行S302-S303,采用样本图像数据对增加层数后的初始网络模型重新进行风格化处理训练,并验证训练后的输出初始网络模型的输出图像的属性参数是否大于参数阈值,如果还是未大于参数阈值,则再调整初始网络模型的通道数,将通道数增加1.2倍后返回执行S302-S303的操作。可选的,本步骤在对初始网络模型的通道数进行调整时,可以优先选择对初始网络模型的组卷积层的通道数进行调整。Optionally, when adjusting the model parameters of the initial network model trained in S302 in this step, at least one dimension of the number of layers for performing data processing operations within the model, the number of channels of each layer, and the loss weight value may be adjusted. Optionally, when adjusting the model parameters of the initial network model, you can set the priority for the number of layers, the number of channels, and the loss weight value. According to the priority, the model parameters of one dimension at a time are set in the corresponding model parameters. Adjust the model parameters within the preset modification range. After modifying the model parameters of one dimension, return to execute S302-S303, that is, use sample image data to re-stylize the initial network model after adjusting the model parameters, and use Verify the image data to verify whether the attribute parameters of the output image of the initial network model after training are greater than the parameter threshold. Optionally, if the priority of each model parameter is that the number of layers is higher than the number of channels, and the number of channels is higher than the loss weight value, you can adjust the number of channels first, increase the number of channels by 1, and then return to S302-S303, using sample images The data re-trains the initial network model after increasing the number of layers, and verifies whether the attribute parameters of the output image of the output initial network model after training are greater than the parameter threshold. If it is still not greater than the parameter threshold, then adjust the initial network model. After increasing the number of channels by 1.2 times, return to the operation of S302-S303. Optionally, when adjusting the number of channels of the initial network model in this step, the number of channels of the group convolutional layer of the initial network model may be adjusted first.
需要说明的是,预设修改范围可以是预先设置第一个修改范围,也可以是预先设置的至少两个可选修改数值,可选的,对于损失权重值和层数,可以是设置一个修改范围;对于通道数可以设置增加1.2倍、1.5倍和1.6倍等多个可选修改数值。It should be noted that the preset modification range can be the first modification range set in advance, or at least two optional modification values set in advance. Optionally, for the loss weight value and the number of layers, one modification can be set Range: For the number of channels, you can set multiple optional modification values such as an increase of 1.2 times, 1.5 times, and 1.6 times.
可选的,本步骤在对初始网络模型的模型参数进行调整时,除了可以一次调整一个模型参数外,还可以是一次同时调整至少两个模型参数。Optionally, when adjusting the model parameters of the initial network model in this step, in addition to adjusting one model parameter at a time, at least two model parameters can also be adjusted at a time.
S305,若是,则将训练后的初始网络模型作为风格化处理模型。S305: If yes, use the trained initial network model as a stylized processing model.
可选的,采用验证图像数据验证训练后的初始网络模型输出图像的属性参 数大于参数阈值,可以说明此时初始网络模型训练完成,将此时的初始网络模型的程序代码封装后,作为风格化处理模型的程序代码。Optionally, using verification image data to verify that the attribute parameters of the output image of the initial network model after training are greater than the parameter threshold, which can indicate that the initial network model training is completed at this time, and the program code of the initial network model at this time is encapsulated as stylized The program code to process the model.
S306,若确定待处理图像的背景复杂度低于复杂度阈值,则将待处理图像的原始背景替换为模板背景,得到目标图像。S306: If it is determined that the background complexity of the image to be processed is lower than the complexity threshold, replace the original background of the image to be processed with the template background to obtain the target image.
S307,将目标图像输入风格化处理模型中,得到初步风格化处理图像。S307: Input the target image into the stylization processing model to obtain a preliminary stylized image.
S308,将初步风格化处理图像的背景替换为原始背景,得到最终的风格化处理图像。S308: Replace the background of the preliminary stylized image with the original background to obtain the final stylized image.
本申请实施例提供了一种图像风格化处理方法,采用样本图像数据对构建的初始网络模型进行训练后,若通过采用验证图像数据验证训练后的初始网络模型输出的风格化处理图像的多维度属性参数未大于参数阈值,则对初始网络模型的多维度模型参数进行调整后重新训练,否则完成初始网络模型的训练,得到风格化处理模型。本实施例在训练初始网络模型的过程中,通过多维度属性参数的验证以及多维度模型参数的调整,极大的提高了风格化处理模型的处理效果的质量,为后续对待处理图像的风格化处理操作奠定了基础。在对待处理图像进行风格化处理时,若待处理图像的背景复杂度低于复杂度阈值,则将该待处理图像的原始背景替换为预设的模板背景后,再采用风格化处理模型进行风格化处理操作,并对得到的初步风格化处理图像的背景替换为原始背景后得到最终的风格化处理图像,考虑了待处理图像的背景复杂程度,进一步提高了图像风格化处理结果的精细度和美观度。The embodiment of the application provides an image stylization processing method. After training the constructed initial network model using sample image data, if the verification image data is used to verify the multi-dimensionality of the stylized processed image output by the trained initial network model If the attribute parameter is not greater than the parameter threshold, the multi-dimensional model parameters of the initial network model are adjusted and retrained; otherwise, the training of the initial network model is completed, and the stylized processing model is obtained. In the process of training the initial network model in this embodiment, through the verification of the multi-dimensional attribute parameters and the adjustment of the multi-dimensional model parameters, the quality of the processing effect of the stylization processing model is greatly improved, and the stylization of the subsequent processing image The processing operation lays the foundation. When stylizing the image to be processed, if the background complexity of the image to be processed is lower than the complexity threshold, replace the original background of the image to be processed with the preset template background, and then use the stylized processing model to style The final stylized image is obtained after the background of the obtained preliminary stylized image is replaced with the original background. The background complexity of the image to be processed is considered, and the fineness and precision of the image stylized processing result are further improved. Aesthetics.
实施例三Example three
图4为本申请实施例三提供的视频学习素材的提供方法的流程图;本实施例在上述实施例提供的各可选方案的基础上进行了改动,给出了将所述目标图像输入风格化处理模型中,得到初步风格化处理图像的详细介绍。4 is a flowchart of a method for providing video learning materials provided in Embodiment 3 of the application; this embodiment has been modified on the basis of the optional solutions provided in the foregoing embodiments, and the input style of the target image is given In the stylized processing model, a detailed introduction to the preliminary stylized image is obtained.
可选的,如图4所示,本实施例中的方法可以包括如下步骤:Optionally, as shown in FIG. 4, the method in this embodiment may include the following steps:
S401,若确定待处理图像的背景复杂度低于复杂度阈值,则将待处理图像的原始背景替换为模板背景,得到目标图像。S401: If it is determined that the background complexity of the image to be processed is lower than the complexity threshold, replace the original background of the image to be processed with a template background to obtain a target image.
S402,根据接收到的区域选择指令,确定待处理区域。S402: Determine an area to be processed according to the received area selection instruction.
可选的,本实施例为了提高用户对待处理图像进行风格化处理的个性化需求,可以是根据用户的选择,只对用户选择区域进行风格化处理。在一实施例中,用户在选择待处理图像后,通过在待处理图像上的滑动操作,触发区域选 择指令,其中,该区域选择指令中包含用户选择的待处理区域。可选的,若该区域选择指令是用户在待处理图像上的非闭合滑动操作触发的,则可以是将用户滑动操作所对应的区域作为待处理区域,并将该待处理区域对应的位置坐标添加到区域选择指令中传输给电子设备;若该区域选择指令是用户在待处理图像上的闭合滑动操作触发的,则可以是将用户滑动操作对应的闭合框选区域作为待处理区域,并将该待处理区域对应的位置坐标添加到区域选择指令中传输给电子设备。电子设备在接收到用户触发的区域选择指令后,从区域选择指令中获取待处理区域的坐标位置。Optionally, in this embodiment, in order to improve the user's individual requirements for stylizing the image to be processed, it may be based on the user's selection to perform stylization only on the user's selection area. In one embodiment, after the user selects the image to be processed, a sliding operation on the image to be processed triggers an area selection instruction, where the area selection instruction includes the area to be processed selected by the user. Optionally, if the region selection instruction is triggered by the user's non-closed sliding operation on the image to be processed, the region corresponding to the user's sliding operation may be used as the region to be processed, and the position coordinates corresponding to the region to be processed Is added to the area selection instruction and transmitted to the electronic device; if the area selection instruction is triggered by the user's closed sliding operation on the image to be processed, the closed frame selection area corresponding to the user's sliding operation can be used as the area to be processed, and The position coordinates corresponding to the area to be processed are added to the area selection instruction and transmitted to the electronic device. After receiving the area selection instruction triggered by the user, the electronic device obtains the coordinate position of the area to be processed from the area selection instruction.
S403,将目标图像和待处理区域输入风格化处理模型中,并控制风格化处理模型对目标图像的待处理区域的内容进行风格化处理,得到初步风格化处理图像。S403: Input the target image and the region to be processed into a stylization processing model, and control the stylization processing model to perform stylization processing on the content of the region to be processed in the target image to obtain a preliminary stylized image.
可选的,本步骤可以是将S401得到的目标图像和S402确定的待处理区域一并作为输入数据,调用并运行风格化处理模型的程序代码,此时风格化处理模型基于输入的目标图像和待处理区域,按照训练时的算法,只对目标图像的待处理区域的内容进行风格化处理操作,得到的初步风格化处理图像中只有待处理区域内显示的是风格化处理的效果,其余区域还是未进行风格化处理的效果。Optionally, in this step, the target image obtained in S401 and the region to be processed determined in S402 can be used as input data, and the program code of the stylized processing model is called and executed. At this time, the stylized processing model is based on the input target image and For the area to be processed, according to the training algorithm, only the content of the area to be processed in the target image is stylized. In the preliminary stylized image obtained, only the area to be processed is displayed with the effect of stylization, and the rest of the area Still not stylized.
S404,将初步风格化处理图像的背景替换为原始背景,得到最终的风格化处理图像。S404: Replace the background of the preliminary stylized image with the original background to obtain the final stylized image.
可选的,若S402确定的待处理区域不包含背景区域,则本步骤可以是将S403得到的初始风格化处理图像的背景替换为待处理图像的原始背景即可得到最终的风格化处理图像。若S402确定的待处理区域包含背景区域,则本步骤可以是确定待处理区域在背景区域对应的位置坐标,然后将原始背景和待处理区域在背景区域对应的位置坐标一并作为输入数据,输入背景处理模型中,控制背景处理模型只对原始背景中该位置坐标区域的内容进行风格化处理操作,得到处理后原始背景;最后将S403得到的初始风格化处理图像的背景替换为处理后的原始背景,得到最终的风格化处理图像。Optionally, if the area to be processed determined in S402 does not include a background area, this step may be to replace the background of the initial stylized image obtained in S403 with the original background of the image to be processed to obtain the final stylized image. If the area to be processed determined in S402 contains the background area, this step may be to determine the position coordinates of the area to be processed in the background area, and then use the original background and the position coordinates of the area to be processed in the background area as the input data. In the background processing model, the background processing model is controlled to only stylize the content of the position coordinate area in the original background to obtain the processed original background; finally, the background of the initial stylized image obtained in S403 is replaced with the processed original Background, get the final stylized image.
本申请实施例提供了一种图像风格化处理方法,若用户在选择待处理图像时触发了区域选择指令,则在待处理图像的背景复杂度低于复杂度阈值时,将该待处理图像的原始背景替换为预设的模板背景,得到目标图像后,根据用户触发的区域选择指令确定待处理区域,控制风格化处理模型只对目标图像的待 处理区域进行风格化处理后,将处理得到的初步风格化处理图像的背景替换为原始背景,得到最终的风格化处理图像。本申请实施例的方案在对待处理图像进行风格化处理时,不但考虑了图像背景的复杂程度,提高图像风格化处理结果的精细度和美观度;还可以针对用户的区域选择指令,为用户生成个性化的风格化处理效果,提高了图像风格化处理的趣味性。The embodiment of the application provides an image stylization processing method. If a user triggers a region selection instruction when selecting an image to be processed, when the background complexity of the image to be processed is lower than the complexity threshold, the The original background is replaced with the preset template background. After the target image is obtained, the area to be processed is determined according to the area selection instruction triggered by the user, and the stylization processing model is controlled to only stylize the area to be processed in the target image. The background of the preliminary stylized image is replaced with the original background to obtain the final stylized image. When stylizing the image to be processed, the solution of the embodiment of the present application not only considers the complexity of the image background, but also improves the fineness and beauty of the image stylization processing result; it can also generate the user's region selection instructions for the user The personalized stylized processing effect improves the fun of image stylized processing.
实施例四Example four
图5为本申请实施例四提供的图像风格化处理装置的结构示意图,本申请实施例可适用于对待处理图像进行风格化处理的情况,例如适用于对背景复杂度低于复杂度阈值的待处理图像进行风格化处理的情况。该装置可以通过软件和/或硬件来实现,并集成在执行本方法的电子设备中,如图5所示,该装置可以包括:FIG. 5 is a schematic structural diagram of an image stylization processing device provided in Embodiment 4 of the application. The embodiment of this application can be applied to a situation where an image to be processed is stylized, for example, when the background complexity is lower than the complexity threshold. Deal with the situation where the image is stylized. The device can be implemented by software and/or hardware, and integrated in the electronic device that executes the method. As shown in Fig. 5, the device can include:
背景替换模块501,被设置为若确定待处理图像的背景复杂度低于复杂度阈值,则将所述待处理图像的原始背景替换为模板背景,得到目标图像;The background replacement module 501 is configured to, if it is determined that the background complexity of the image to be processed is lower than the complexity threshold, replace the original background of the image to be processed with the template background to obtain the target image;
风格化处理模块502,被设置为将所述目标图像输入风格化处理模型中,得到初步风格化处理图像;The stylization processing module 502 is configured to input the target image into the stylization processing model to obtain a preliminary stylized processing image;
所述背景替换模块501,还被设置为将所述初步风格化处理图像的背景替换为所述原始背景,得到最终的风格化处理图像。The background replacement module 501 is further configured to replace the background of the preliminary stylized image with the original background to obtain the final stylized image.
本申请实施例提供了一种图像风格化处理装置,判断待处理图像的背景复杂度是否低于复杂度阈值,若是,则将该待处理图像的原始背景替换为预设的模板背景,得到目标图像;由风格化处理模型对目标图像进行风格化处理后,将处理得到的初步风格化处理图像的背景替换为原始背景,得到最终的风格化处理图像。本申请实施例的方案在对图像进行风格化处理时,考虑了图像背景的复杂程度,当待处理图像背景复杂度较低时,采用为待处理图像更换模板背景后再进行风格化处理的方法,避免了对背景复杂度较低的待处理图像采用相关技术中的风格化处理方法,出现处理结果粗糙的情况,提高了图像风格化处理结果的精细度和美观度。The embodiment of the application provides an image stylization processing device to determine whether the background complexity of the image to be processed is lower than the complexity threshold, and if so, replace the original background of the image to be processed with a preset template background to obtain the target Image: After the target image is stylized by the stylized processing model, the background of the processed preliminary stylized image is replaced with the original background to obtain the final stylized image. The solution of the embodiment of the application takes into account the complexity of the image background when stylizing the image. When the background complexity of the image to be processed is low, the method of replacing the template background for the image to be processed is used to perform stylization. This avoids the use of stylized processing methods in related technologies for images to be processed with low background complexity, and the processing results are rough, and the fineness and aesthetics of the image stylized processing results are improved.
在一实施例中,所述装置还包括复杂度判断模型,所述复杂度判断模型在执行确定待处理图像的背景复杂度低于复杂度阈值时被设置为:In an embodiment, the device further includes a complexity judgment model, and the complexity judgment model is set as follows when the background complexity of the image to be processed is determined to be lower than the complexity threshold value:
提取待处理图像的原始背景的纹理特征,并根据所述纹理特征,确定待处理图像的背景复杂度是否低于复杂度阈值。The texture feature of the original background of the image to be processed is extracted, and according to the texture feature, it is determined whether the background complexity of the image to be processed is lower than the complexity threshold.
在一实施例中,所述复杂度判断模型可以被设置为:In an embodiment, the complexity judgment model may be set as:
对所述待处理图像的原始背景进行边缘检测,得到所述原始背景的纹理特征;Performing edge detection on the original background of the image to be processed to obtain the texture feature of the original background;
确定所述纹理特征在所述原始背景中的像素占比,作为待处理图像的背景复杂度;Determining the proportion of pixels of the texture feature in the original background as the background complexity of the image to be processed;
确定所述待处理图像的背景复杂度是否低于复杂度阈值。It is determined whether the background complexity of the image to be processed is lower than the complexity threshold.
在一实施例中,所述装置还包括:模型训练模块,所述模型训练模块包括:In an embodiment, the device further includes: a model training module, and the model training module includes:
训练单元,被设置为采用样本图像数据对构建的初始网络模型进行风格化处理训练;The training unit is set to use sample image data to stylize the constructed initial network model;
验证单元,被设置为采用验证图像数据验证训练后的初始网络模型输出图像的属性参数是否大于参数阈值;其中,所述属性参数包括:饱和度参数、边缘平滑度参数和阴影参数中的至少一个;The verification unit is configured to use the verification image data to verify whether the attribute parameter of the output image of the initial network model after training is greater than the parameter threshold; wherein the attribute parameter includes: at least one of a saturation parameter, an edge smoothness parameter, and a shadow parameter ;
模型确定单元,被设置为若训练后的初始网络模型输出图像的属性参数大于参数阈值,则将训练后的初始网络模型作为所述风格化处理模型。The model determining unit is configured to use the trained initial network model as the stylization processing model if the attribute parameter of the output image of the initial network model after training is greater than the parameter threshold.
在一实施例中,所述模型训练模块还包括:In an embodiment, the model training module further includes:
参数调整单元,被设置为若训练后的初始网络模型输出图像的属性参数小于或等于参数阈值,则在预设修改范围内调整所述初始网络模型的模型参数;其中,所述模型参数包括初始网络模型的层数、通道数、损失权重值中的至少一个;The parameter adjustment unit is configured to adjust the model parameters of the initial network model within a preset modification range if the attribute parameters of the output image of the initial network model after training are less than or equal to the parameter threshold; wherein, the model parameters include the initial At least one of the number of layers, the number of channels, and the loss weight value of the network model;
所述训练单元,还被设置为采用样本图像数据对调整模型参数后的初始网络模型重新进行风格化处理训练。The training unit is also configured to use sample image data to re-train the initial network model after adjusting the model parameters.
在一实施例中,所述风格化处理模块502可以被设置为:In an embodiment, the stylization processing module 502 may be configured as:
根据接收到的区域选择指令,确定待处理区域;Determine the area to be processed according to the received area selection instruction;
将所述目标图像和所述待处理区域输入风格化处理模型中,并控制所述风格化处理模型对所述目标图像的待处理区域的内容进行风格化处理,得到初步风格化处理图像。The target image and the region to be processed are input into a stylization processing model, and the stylization processing model is controlled to perform stylization processing on the content of the region to be processed of the target image to obtain a preliminary stylized image.
在一实施例中,所述背景替换模块501在执行将所述初步风格化处理图像的背景替换为所述原始背景时,可以被设置为:In an embodiment, when the background replacement module 501 executes to replace the background of the preliminary stylized image with the original background, it may be set to:
将原始背景输入背景处理模型中,得到处理后原始背景;Input the original background into the background processing model to obtain the processed original background;
将所述初步风格化处理图像的背景替换为处理后的原始背景。The background of the preliminary stylized processed image is replaced with the processed original background.
本申请实施例提供的图像风格化处理装置,与上述各实施例提供的图像风 格化处理方法属于同一发明构思,未在本申请实施例中详尽描述的技术细节可参见上述各实施例,并且本申请实施例与上述各实施例具有相同的有益效果。The image stylization processing device provided in the embodiments of this application belongs to the same inventive concept as the image stylization processing methods provided in the above embodiments. For technical details not described in the embodiments of this application in detail, please refer to the above embodiments. The application embodiments have the same beneficial effects as the foregoing embodiments.
实施例五Example five
下面参考图6,图6为适于用来实现本申请实施例的电子设备600的结构示意图。该电子设备可以包括诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图6示出的电子设备600仅仅是一个示例。Next, referring to FIG. 6, FIG. 6 is a schematic structural diagram of an electronic device 600 suitable for implementing an embodiment of the present application. The electronic device may include mobile phones such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablets), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), etc. Terminals and fixed terminals such as digital TVs, desktop computers, etc. The electronic device 600 shown in FIG. 6 is only an example.
如图6所示,电子设备600可以包括处理装置(例如中央处理器、图形处理器等)601,其可以根据存储在只读存储器(ROM)602中的程序或者从存储装置608加载到随机访问存储器(RAM)603中的程序而执行各种适当的动作和处理。在RAM 603中,还存储有电子设备600操作所需的各种程序和数据。处理装置601、ROM 602以及RAM 603通过总线604彼此相连。输入/输出(I/O)接口605也连接至总线604。As shown in FIG. 6, the electronic device 600 may include a processing device (such as a central processing unit, a graphics processor, etc.) 601, which may be loaded into a random access device according to a program stored in a read-only memory (ROM) 602 or from a storage device 608. The program in the memory (RAM) 603 executes various appropriate actions and processing. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to the bus 604.
通常,以下装置可以连接至I/O接口605:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置606;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置607;包括例如磁带、硬盘等的存储装置608;以及通信装置609。通信装置609可以允许电子设备600与其他设备进行无线或有线通信以交换数据。虽然图6示出了具有各种装置的电子设备600,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。Generally, the following devices can be connected to the I/O interface 605: including input devices 606 such as touch screens, touch pads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; including, for example, liquid crystal displays (LCD), speakers, vibration An output device 607 such as a device; a storage device 608 such as a magnetic tape and a hard disk; and a communication device 609. The communication device 609 may allow the electronic device 600 to perform wireless or wired communication with other devices to exchange data. Although FIG. 6 shows an electronic device 600 having various devices, it should be understood that it is not required to implement or have all the illustrated devices. It may alternatively be implemented or provided with more or fewer devices.
根据本申请的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本申请的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置609从网络上被下载和安装,或者从存储装置608被安装,或者从ROM 602被安装。在该计算机程序被处理装置601执行时,执行本申请实施例的方法中的上述功能。According to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments of the present application include a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program may be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions in the method of the embodiment of the present application are executed.
需要说明的是,本申请上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例 如可以是电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的例子可以包括:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本申请中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本申请中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,可以包括电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,可以包括:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。It should be noted that the above-mentioned computer-readable medium in this application may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. The computer-readable storage medium may be, for example, an electric, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the above. Examples of computer-readable storage media may include: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) Or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above. In this application, a computer-readable storage medium may be any tangible medium that contains or stores a program, and the program may be used by or in combination with an instruction execution system, apparatus, or device. In this application, the computer-readable signal medium may include a data signal propagated in a baseband or as a part of a carrier wave, and a computer-readable program code is carried therein. This propagated data signal can take many forms, and can include electromagnetic signals, optical signals, or any suitable combination of the foregoing. The computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium. The computer-readable signal medium may send, propagate, or transmit the program for use by or in combination with the instruction execution system, apparatus, or device . The program code contained on the computer-readable medium can be transmitted by any suitable medium, which may include: wire, optical cable, RF (Radio Frequency), etc., or any suitable combination of the above.
在一些实施方式中,电子设备可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。In some embodiments, the electronic device can communicate with any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and can communicate with any form or medium of digital data ( For example, communication networks) are interconnected. Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet (for example, the Internet), and end-to-end networks (for example, ad hoc end-to-end networks), as well as any currently known or future research and development network of.
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。The above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or it may exist alone without being assembled into the electronic device.
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备内部进程执行:若确定待处理图像的背景复杂度低于复杂度阈值,则将所述待处理图像的原始背景替换为模板背景,得到目标图像;将所述目标图像输入风格化处理模型中,得到初步风格化处理图像;将所述初步风格化处理图像的背景替换为所述原始背景,得到最终的风格化处理图像。The aforementioned computer-readable medium carries one or more programs. When the aforementioned one or more programs are executed by the electronic device, the internal processes of the electronic device are executed: if it is determined that the background complexity of the image to be processed is lower than the complexity threshold, Then replace the original background of the image to be processed with the template background to obtain the target image; input the target image into the stylization processing model to obtain the preliminary stylized image; replace the background of the preliminary stylized image with The original background obtains the final stylized processed image.
可以以一种或多种程序设计语言或其组合来编写用于执行本申请的操作的计算机程序代码,上述程序设计语言可以包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类 似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。The computer program code used to perform the operations of the present application can be written in one or more programming languages or a combination thereof. The aforementioned programming languages can include object-oriented programming languages—such as Java, Smalltalk, C++, and also conventional The procedural programming language-such as "C" language or similar programming language. The program code can be executed entirely on the user's computer, partly on the user's computer, executed as an independent software package, partly on the user's computer and partly executed on a remote computer, or entirely executed on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, using an Internet service provider to pass Internet connection).
附图中的流程图和框图,图示了按照本申请各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation of the system architecture, functions, and operations of the system, method, and computer program product according to various embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, program segment, or part of code, and the module, program segment, or part of code contains one or more for realizing the specified logical function Executable instructions. It should also be noted that, in some alternative implementations, the functions marked in the block may also occur in a different order from the order marked in the drawings. For example, two blocks shown in succession can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or operations Or it can be realized by a combination of dedicated hardware and computer instructions.
描述于本申请实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称并不构成对该单元本身的限定。The units involved in the embodiments described in the present application can be implemented in software or hardware. Among them, the name of the unit does not constitute a limitation on the unit itself.
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。The functions described hereinabove may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that can be used include: Field Programmable Gate Array (FPGA), Application Specific Integrated Circuit (ASIC), Application Specific Standard Product (ASSP), System on Chip (SOC), Complex Programmable Logical device (CPLD) and so on.
在本申请的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的示例可以包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储 存设备、或上述内容的任何合适组合。In the context of the present application, a machine-readable medium may be a tangible medium, which may contain or store a program for use by the instruction execution system, apparatus, or device or in combination with the instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. Examples of machine-readable storage media may include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) Or flash memory), optical fiber, compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
根据本申请的一个或多个实施例提供的一种图像风格化处理方法,该方法包括:According to an image stylization processing method provided by one or more embodiments of the present application, the method includes:
若确定待处理图像的背景复杂度低于复杂度阈值,则将所述待处理图像的原始背景替换为模板背景,得到目标图像;If it is determined that the background complexity of the image to be processed is lower than the complexity threshold, replace the original background of the image to be processed with the template background to obtain the target image;
将所述目标图像输入风格化处理模型中,得到初步风格化处理图像;Input the target image into a stylized processing model to obtain a preliminary stylized processed image;
将所述初步风格化处理图像的背景替换为所述原始背景,得到最终的风格化处理图像。The background of the preliminary stylized image is replaced with the original background to obtain the final stylized image.
根据本申请的一个或多个实施例,上述方法中,确定待处理图像的背景复杂度低于复杂度阈值,包括:According to one or more embodiments of the present application, in the foregoing method, determining that the background complexity of the image to be processed is lower than the complexity threshold includes:
提取待处理图像的原始背景的纹理特征,并根据所述纹理特征,确定待处理图像的背景复杂度是否低于复杂度阈值。The texture feature of the original background of the image to be processed is extracted, and according to the texture feature, it is determined whether the background complexity of the image to be processed is lower than the complexity threshold.
根据本申请的一个或多个实施例,上述方法中,提取待处理图像的原始背景的纹理特征,并根据所述纹理特征,确定待处理图像的背景复杂度是否低于复杂度阈值,包括:According to one or more embodiments of the present application, in the above method, extracting the texture feature of the original background of the image to be processed, and determining whether the background complexity of the image to be processed is lower than the complexity threshold according to the texture feature includes:
对所述待处理图像的原始背景进行边缘检测,得到所述原始背景的纹理特征;Performing edge detection on the original background of the image to be processed to obtain the texture feature of the original background;
确定所述纹理特征在所述原始背景中的像素占比,作为待处理图像的背景复杂度;Determining the proportion of pixels of the texture feature in the original background as the background complexity of the image to be processed;
确定所述待处理图像的背景复杂度是否低于复杂度阈值。It is determined whether the background complexity of the image to be processed is lower than the complexity threshold.
根据本申请的一个或多个实施例,上述方法中,在将所述目标图像输入风格化处理模型中之前,还包括:According to one or more embodiments of the present application, in the above method, before inputting the target image into the stylization processing model, the method further includes:
采用样本图像数据对构建的初始网络模型进行风格化处理训练;Use sample image data to stylize the constructed initial network model;
采用验证图像数据验证训练后的初始网络模型输出图像的属性参数是否大于参数阈值;其中,所述属性参数包括:饱和度参数、边缘平滑度参数和阴影参数中的至少一个;The verification image data is used to verify whether the attribute parameters of the output image of the initial network model after the training are greater than the parameter threshold; wherein, the attribute parameters include at least one of a saturation parameter, an edge smoothness parameter, and a shadow parameter;
若是,则将训练后的初始网络模型作为所述风格化处理模型。If so, the initial network model after training is used as the stylized processing model.
根据本申请的一个或多个实施例,上述方法中,在采用验证图像数据验证训练后的初始网络模型输出图像的属性参数是否大于参数阈值之后,还包括:According to one or more embodiments of the present application, in the above method, after verifying whether the attribute parameter of the output image of the initial network model after training is greater than the parameter threshold, the method further includes:
若否,则在预设修改范围内调整所述初始网络模型的模型参数;其中,所 述模型参数包括初始网络模型的层数、通道数、损失权重值中的至少一个;If not, adjust the model parameters of the initial network model within a preset modification range; wherein, the model parameters include at least one of the number of layers, the number of channels, and the loss weight value of the initial network model;
采用样本图像数据对调整模型参数后的初始网络模型重新进行风格化处理训练。The sample image data is used to re-train the initial network model after adjusting the model parameters.
根据本申请的一个或多个实施例,上述方法中,将所述目标图像输入风格化处理模型中,得到初步风格化处理图像,包括:According to one or more embodiments of the present application, in the above method, inputting the target image into a stylization processing model to obtain a preliminary stylization processing image includes:
根据接收到的区域选择指令,确定待处理区域;Determine the area to be processed according to the received area selection instruction;
将所述目标图像和所述待处理区域输入风格化处理模型中,并控制所述风格化处理模型对所述目标图像的待处理区域的内容进行风格化处理,得到初步风格化处理图像。The target image and the region to be processed are input into a stylization processing model, and the stylization processing model is controlled to perform stylization processing on the content of the region to be processed of the target image to obtain a preliminary stylized image.
根据本申请的一个或多个实施例,上述方法中,将所述初步风格化处理图像的背景替换为所述原始背景,包括:According to one or more embodiments of the present application, in the foregoing method, replacing the background of the preliminary stylized image with the original background includes:
将原始背景输入背景处理模型中,得到处理后原始背景;Input the original background into the background processing model to obtain the processed original background;
将所述初步风格化处理图像的背景替换为处理后的原始背景。The background of the preliminary stylized processed image is replaced with the processed original background.
根据本申请的一个或多个实施例提供的一种图像风格化处理装置,该装置包括:An image stylization processing device provided according to one or more embodiments of the present application includes:
背景替换模块,被设置为若确定待处理图像的背景复杂度低于复杂度阈值,则将所述待处理图像的原始背景替换为模板背景,得到目标图像;The background replacement module is configured to, if it is determined that the background complexity of the image to be processed is lower than the complexity threshold, replace the original background of the image to be processed with the template background to obtain the target image;
风格化处理模块,被设置为将所述目标图像输入风格化处理模型中,得到初步风格化处理图像;The stylization processing module is set to input the target image into the stylization processing model to obtain a preliminary stylized processing image;
所述背景替换模块,还被设置为将所述初步风格化处理图像的背景替换为所述原始背景,得到最终的风格化处理图像。The background replacement module is further configured to replace the background of the preliminary stylized image with the original background to obtain the final stylized image.
根据本申请的一个或多个实施例,上述装置还包括复杂度判断模型,所述复杂度判断模型在执行确定待处理图像的背景复杂度低于复杂度阈值时被设置为:According to one or more embodiments of the present application, the above-mentioned apparatus further includes a complexity judgment model, which is set as follows when the background complexity of the image to be processed is determined to be lower than the complexity threshold value:
提取待处理图像的原始背景的纹理特征,并根据所述纹理特征,确定待处理图像的背景复杂度是否低于复杂度阈值。The texture feature of the original background of the image to be processed is extracted, and according to the texture feature, it is determined whether the background complexity of the image to be processed is lower than the complexity threshold.
根据本申请的一个或多个实施例,上述装置中的所述复杂度判断模型可被设置为:According to one or more embodiments of the present application, the complexity judgment model in the above-mentioned device may be set as:
对所述待处理图像的原始背景进行边缘检测,得到所述原始背景的纹理特征;Performing edge detection on the original background of the image to be processed to obtain the texture feature of the original background;
确定所述纹理特征在所述原始背景中的像素占比,作为待处理图像的背景复杂度;Determining the proportion of pixels of the texture feature in the original background as the background complexity of the image to be processed;
确定所述待处理图像的背景复杂度是否低于复杂度阈值。It is determined whether the background complexity of the image to be processed is lower than the complexity threshold.
根据本申请的一个或多个实施例,上述装置还包括:模型训练模块,所述模型训练模块包括:According to one or more embodiments of the present application, the above-mentioned device further includes: a model training module, and the model training module includes:
训练单元,被设置为采用样本图像数据对构建的初始网络模型进行风格化处理训练;The training unit is set to use sample image data to stylize the constructed initial network model;
验证单元,被设置为采用验证图像数据验证训练后的初始网络模型输出图像的属性参数是否大于参数阈值;其中,所述属性参数包括:饱和度参数、边缘平滑度参数和阴影参数中的至少一个;The verification unit is configured to use the verification image data to verify whether the attribute parameter of the output image of the initial network model after training is greater than the parameter threshold; wherein the attribute parameter includes: at least one of a saturation parameter, an edge smoothness parameter, and a shadow parameter ;
模型确定单元,被设置为若训练后的初始网络模型输出图像的属性参数大于参数阈值,则将训练后的初始网络模型作为所述风格化处理模型。The model determining unit is configured to use the trained initial network model as the stylization processing model if the attribute parameter of the output image of the initial network model after training is greater than the parameter threshold.
根据本申请的一个或多个实施例,上述装置中的所述模型训练模块还包括:According to one or more embodiments of the present application, the model training module in the above-mentioned device further includes:
参数调整单元,被设置为若训练后的初始网络模型输出图像的属性参数小于或等于参数阈值,则在预设修改范围内调整所述初始网络模型的模型参数;其中,所述模型参数包括初始网络模型的层数、通道数、损失权重值中的至少一个;The parameter adjustment unit is configured to adjust the model parameters of the initial network model within a preset modification range if the attribute parameters of the output image of the initial network model after training are less than or equal to the parameter threshold; wherein, the model parameters include the initial At least one of the number of layers, the number of channels, and the loss weight value of the network model;
所述训练单元,还被设置为采用样本图像数据对调整模型参数后的初始网络模型重新进行风格化处理训练。The training unit is also configured to use sample image data to re-train the initial network model after adjusting the model parameters.
根据本申请的一个或多个实施例,上述装置中的所述风格化处理模块可被设置为:According to one or more embodiments of the present application, the stylization processing module in the above-mentioned device may be set to:
根据接收到的区域选择指令,确定待处理区域;Determine the area to be processed according to the received area selection instruction;
将所述目标图像和所述待处理区域输入风格化处理模型中,并控制所述风格化处理模型对所述目标图像的待处理区域的内容进行风格化处理,得到初步风格化处理图像。The target image and the region to be processed are input into a stylization processing model, and the stylization processing model is controlled to perform stylization processing on the content of the region to be processed of the target image to obtain a preliminary stylized image.
根据本申请的一个或多个实施例,上述装置中的所述背景替换模块在执行将所述初步风格化处理图像的背景替换为所述原始背景时,可被设置为:According to one or more embodiments of the present application, when the background replacement module in the above-mentioned device executes the replacement of the background of the preliminary stylized image with the original background, it may be set to:
将原始背景输入背景处理模型中,得到处理后原始背景;Input the original background into the background processing model to obtain the processed original background;
将所述初步风格化处理图像的背景替换为处理后的原始背景。The background of the preliminary stylized processed image is replaced with the processed original background.
根据本申请的一个或多个实施例提供的一种电子设备,该电子设备包括:According to an electronic device provided by one or more embodiments of the present application, the electronic device includes:
一个或多个处理器;One or more processors;
存储器,被设置为存储一个或多个程序;The memory is set to store one or more programs;
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如本申请任意实施例所述的图像风格化处理方法。When the one or more programs are executed by the one or more processors, the one or more processors implement the image stylization processing method according to any embodiment of the present application.
根据本申请的一个或多个实施例提供的一种可读介质,其上存储有计算机程序,该程序被处理器执行时实现如本申请任意实施例所述的图像风格化处理方法。A readable medium provided according to one or more embodiments of the present application has a computer program stored thereon, and when the program is executed by a processor, the image stylization processing method as described in any of the embodiments of the present application is implemented.
虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了实现细节,但是这些不应当被解释为对本申请的范围的限制。在单独的实施例的上下文中描述的一些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。Although the operations are depicted in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or performed in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, although implementation details are included in the above discussion, these should not be construed as limiting the scope of this application. Some features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable subcombination.
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。Although the subject matter has been described in language specific to structural features and/or logical actions of the method, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely exemplary forms of implementing the claims.

Claims (10)

  1. 一种图像风格化处理方法,包括:An image stylization processing method, including:
    基于确定待处理图像的背景复杂度低于复杂度阈值的结果,将所述待处理图像的原始背景替换为模板背景,得到目标图像;Based on the result of determining that the background complexity of the image to be processed is lower than the complexity threshold, replacing the original background of the image to be processed with the template background to obtain the target image;
    将所述目标图像输入风格化处理模型中,得到初步风格化处理图像;Input the target image into a stylized processing model to obtain a preliminary stylized processed image;
    将所述初步风格化处理图像的背景替换为所述原始背景,得到风格化处理图像。The background of the preliminary stylized image is replaced with the original background to obtain the stylized image.
  2. 根据权利要求1所述的方法,所述方法还包括:The method according to claim 1, further comprising:
    确定待处理图像的背景复杂度是否低于复杂度阈值;Determine whether the background complexity of the image to be processed is lower than the complexity threshold;
    其中,确定待处理图像的背景复杂度是否低于复杂度阈值,包括:Among them, determining whether the background complexity of the image to be processed is lower than the complexity threshold includes:
    提取待处理图像的原始背景的纹理特征,并根据所述纹理特征,确定待处理图像的背景复杂度是否低于复杂度阈值。The texture feature of the original background of the image to be processed is extracted, and according to the texture feature, it is determined whether the background complexity of the image to be processed is lower than the complexity threshold.
  3. 根据权利要求2所述的方法,其中,提取待处理图像的原始背景的纹理特征,并根据所述纹理特征,确定待处理图像的背景复杂度是否低于复杂度阈值,包括:The method according to claim 2, wherein extracting the texture feature of the original background of the image to be processed, and determining whether the background complexity of the image to be processed is lower than the complexity threshold according to the texture feature, comprises:
    对待处理图像的原始背景进行边缘检测,得到所述原始背景的纹理特征;Performing edge detection on the original background of the image to be processed to obtain the texture feature of the original background;
    确定所述纹理特征在所述原始背景中的像素占比,作为所述待处理图像的背景复杂度;Determining the proportion of pixels of the texture feature in the original background as the background complexity of the image to be processed;
    确定所述待处理图像的背景复杂度是否低于复杂度阈值。It is determined whether the background complexity of the image to be processed is lower than the complexity threshold.
  4. 根据权利要求1所述的方法,在将所述目标图像输入风格化处理模型中之前,所述方法还包括:The method according to claim 1, before inputting the target image into the stylization processing model, the method further comprises:
    采用样本图像数据对构建的初始网络模型进行风格化处理训练;Use sample image data to stylize the constructed initial network model;
    采用验证图像数据验证训练后的初始网络模型输出图像的属性参数是否大于参数阈值;其中,所述属性参数包括:饱和度参数、边缘平滑度参数和阴影参数中的至少一个;The verification image data is used to verify whether the attribute parameters of the output image of the initial network model after the training are greater than the parameter threshold; wherein, the attribute parameters include at least one of a saturation parameter, an edge smoothness parameter, and a shadow parameter;
    基于训练后的初始网络模型输出图像的属性参数大于参数阈值的验证结果,将所述训练后的初始网络模型作为所述风格化处理模型。Based on the verification result that the attribute parameter of the output image of the initial network model after training is greater than the parameter threshold, the initial network model after training is used as the stylization processing model.
  5. 根据权利要求4所述的方法,其中,在采用验证图像数据验证训练后的初始网络模型输出图像的属性参数是否大于参数阈值之后,所述方法还包括:The method according to claim 4, wherein, after verifying whether the attribute parameters of the output image of the initial network model after the training are greater than the parameter threshold using the verification image data, the method further comprises:
    基于训练后的初始网络模型输出图像的属性参数不大于参数阈值的验证结果,在预设修改范围内调整所述初始网络模型的模型参数;其中,所述模型参数包括初始网络模型的层数、通道数、损失权重值中的至少一个;Based on the verification result that the attribute parameters of the output image of the initial network model after training are not greater than the parameter threshold, the model parameters of the initial network model are adjusted within a preset modification range; wherein, the model parameters include the number of layers of the initial network model, At least one of the number of channels and loss weight value;
    采用所述样本图像数据对调整模型参数后的初始网络模型重新进行风格化处理训练。Using the sample image data to re-train the initial network model after adjusting the model parameters for stylization processing.
  6. 根据权利要求1所述的方法,其中,将所述目标图像输入风格化处理模型中,得到初步风格化处理图像,包括:The method according to claim 1, wherein inputting the target image into a stylization processing model to obtain a preliminary stylization processing image comprises:
    根据接收到的区域选择指令,确定待处理区域;Determine the area to be processed according to the received area selection instruction;
    将所述目标图像和所述待处理区域输入风格化处理模型中,并控制所述风格化处理模型对所述目标图像的待处理区域的内容进行风格化处理,得到初步风格化处理图像。The target image and the region to be processed are input into a stylization processing model, and the stylization processing model is controlled to perform stylization processing on the content of the region to be processed of the target image to obtain a preliminary stylized image.
  7. 根据权利要求1所述的方法,其中,将所述初步风格化处理图像的背景替换为所述原始背景,包括:The method according to claim 1, wherein replacing the background of the preliminary stylized image with the original background comprises:
    将所述原始背景输入背景处理模型中,得到处理后的原始背景;Input the original background into a background processing model to obtain a processed original background;
    将所述初步风格化处理图像的背景替换为所述处理后的原始背景。The background of the preliminary stylized processed image is replaced with the processed original background.
  8. 一种图像风格化处理装置,包括:An image stylization processing device, including:
    背景替换模块,被设置为基于确定待处理图像的背景复杂度低于复杂度阈值的结果,将所述待处理图像的原始背景替换为模板背景,得到目标图像;The background replacement module is configured to replace the original background of the image to be processed with the template background based on the result of determining that the background complexity of the image to be processed is lower than the complexity threshold to obtain the target image;
    风格化处理模块,被设置为将所述目标图像输入风格化处理模型中,得到初步风格化处理图像;The stylization processing module is set to input the target image into the stylization processing model to obtain a preliminary stylized processing image;
    所述背景替换模块,还被设置为将所述初步风格化处理图像的背景替换为所述原始背景,得到风格化处理图像。The background replacement module is further configured to replace the background of the preliminary stylized image with the original background to obtain the stylized image.
  9. 一种电子设备,包括:An electronic device including:
    处理器;processor;
    存储器,用于存储程序;Memory, used to store programs;
    当所述程序被所述处理器执行,使得所述处理器实现如权利要求1-7中任一所述的图像风格化处理方法。When the program is executed by the processor, the processor realizes the image stylization processing method according to any one of claims 1-7.
  10. 一种可读介质,所述可读介质上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1-7中任一所述的图像风格化处理方法。A readable medium on which a computer program is stored, and when the computer program is executed by a processor, the image stylization processing method according to any one of claims 1-7 is realized.
PCT/CN2020/113974 2019-09-25 2020-09-08 Image stylization processing method and apparatus, and electronic device and readable medium WO2021057463A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910910696.4A CN110689478B (en) 2019-09-25 2019-09-25 Image stylization processing method and device, electronic equipment and readable medium
CN201910910696.4 2019-09-25

Publications (1)

Publication Number Publication Date
WO2021057463A1 true WO2021057463A1 (en) 2021-04-01

Family

ID=69110569

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/113974 WO2021057463A1 (en) 2019-09-25 2020-09-08 Image stylization processing method and apparatus, and electronic device and readable medium

Country Status (2)

Country Link
CN (1) CN110689478B (en)
WO (1) WO2021057463A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110689478B (en) * 2019-09-25 2023-12-01 北京字节跳动网络技术有限公司 Image stylization processing method and device, electronic equipment and readable medium
CN111445383B (en) * 2020-03-20 2024-02-13 北京迈格威科技有限公司 Image parameter adjusting method, device and system
CN113012082A (en) * 2021-02-09 2021-06-22 北京字跳网络技术有限公司 Image display method, apparatus, device and medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101794454A (en) * 2010-04-08 2010-08-04 西安交通大学 Oil painting stylizing method based on image
CN104869346A (en) * 2014-02-26 2015-08-26 中国移动通信集团公司 Method and electronic equipment for processing image in video call
CN105989594A (en) * 2015-02-12 2016-10-05 阿里巴巴集团控股有限公司 Image region detection method and device
CN106327448A (en) * 2016-08-31 2017-01-11 上海交通大学 Picture stylization processing method based on deep learning
CN106920212A (en) * 2015-12-24 2017-07-04 掌赢信息科技(上海)有限公司 A kind of method and electronic equipment for sending stylized video
CN107507173A (en) * 2017-08-15 2017-12-22 上海交通大学 A kind of full slice image without refer to intelligibility evaluation method and system
US20190124322A1 (en) * 2017-02-15 2019-04-25 Adobe Systems Incorporated Generating novel views of a three-dimensional object based on a single two-dimensional image
CN110211017A (en) * 2019-05-15 2019-09-06 北京字节跳动网络技术有限公司 Image processing method, device and electronic equipment
CN110689478A (en) * 2019-09-25 2020-01-14 北京字节跳动网络技术有限公司 Image stylization processing method and device, electronic equipment and readable medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9672414B2 (en) * 2015-11-11 2017-06-06 Adobe Systems Incorporated Enhancement of skin, including faces, in photographs
US10318889B2 (en) * 2017-06-26 2019-06-11 Konica Minolta Laboratory U.S.A., Inc. Targeted data augmentation using neural style transfer
CN108154518B (en) * 2017-12-11 2020-09-08 广州华多网络科技有限公司 Image processing method and device, storage medium and electronic equipment
CN108961349A (en) * 2018-06-29 2018-12-07 广东工业大学 A kind of generation method, device, equipment and the storage medium of stylization image
CN109344724B (en) * 2018-09-05 2020-09-25 深圳伯奇科技有限公司 Automatic background replacement method, system and server for certificate photo
CN109523460A (en) * 2018-10-29 2019-03-26 北京达佳互联信息技术有限公司 Moving method, moving apparatus and the computer readable storage medium of image style
CN110222722A (en) * 2019-05-14 2019-09-10 华南理工大学 Interactive image stylization processing method, calculates equipment and storage medium at system

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101794454A (en) * 2010-04-08 2010-08-04 西安交通大学 Oil painting stylizing method based on image
CN104869346A (en) * 2014-02-26 2015-08-26 中国移动通信集团公司 Method and electronic equipment for processing image in video call
CN105989594A (en) * 2015-02-12 2016-10-05 阿里巴巴集团控股有限公司 Image region detection method and device
CN106920212A (en) * 2015-12-24 2017-07-04 掌赢信息科技(上海)有限公司 A kind of method and electronic equipment for sending stylized video
CN106327448A (en) * 2016-08-31 2017-01-11 上海交通大学 Picture stylization processing method based on deep learning
US20190124322A1 (en) * 2017-02-15 2019-04-25 Adobe Systems Incorporated Generating novel views of a three-dimensional object based on a single two-dimensional image
CN107507173A (en) * 2017-08-15 2017-12-22 上海交通大学 A kind of full slice image without refer to intelligibility evaluation method and system
CN110211017A (en) * 2019-05-15 2019-09-06 北京字节跳动网络技术有限公司 Image processing method, device and electronic equipment
CN110689478A (en) * 2019-09-25 2020-01-14 北京字节跳动网络技术有限公司 Image stylization processing method and device, electronic equipment and readable medium

Also Published As

Publication number Publication date
CN110689478B (en) 2023-12-01
CN110689478A (en) 2020-01-14

Similar Documents

Publication Publication Date Title
CN110163080B (en) Face key point detection method and device, storage medium and electronic equipment
WO2021057463A1 (en) Image stylization processing method and apparatus, and electronic device and readable medium
CN110827378B (en) Virtual image generation method, device, terminal and storage medium
WO2020155907A1 (en) Method and apparatus for generating cartoon style conversion model
WO2020228406A1 (en) Image stylization generation method and apparatus, and electronic device
CN111368685A (en) Key point identification method and device, readable medium and electronic equipment
CN111369427A (en) Image processing method, image processing device, readable medium and electronic equipment
CN111414879A (en) Face shielding degree identification method and device, electronic equipment and readable storage medium
CN110211195B (en) Method, device, electronic equipment and computer-readable storage medium for generating image set
CN110211017B (en) Image processing method and device and electronic equipment
CN112839223B (en) Image compression method, image compression device, storage medium and electronic equipment
CN110689546A (en) Method, device and equipment for generating personalized head portrait and storage medium
CN113689372A (en) Image processing method, apparatus, storage medium, and program product
CN113449851A (en) Data processing method and device
CN112800276A (en) Video cover determination method, device, medium and equipment
CN114419322B (en) Image instance segmentation method and device, electronic equipment and storage medium
US20230036366A1 (en) Image attribute classification method, apparatus, electronic device, medium and program product
CN113902636A (en) Image deblurring method and device, computer readable medium and electronic equipment
CN110619602B (en) Image generation method and device, electronic equipment and storage medium
CN115731341A (en) Three-dimensional human head reconstruction method, device, equipment and medium
CN110059739B (en) Image synthesis method, image synthesis device, electronic equipment and computer-readable storage medium
WO2023040813A1 (en) Facial image processing method and apparatus, and device and medium
CN111402133A (en) Image processing method, image processing device, electronic equipment and computer readable medium
CN110197459A (en) Image stylization generation method, device and electronic equipment
CN110264431A (en) Video beautification method, device and electronic equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20869922

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 28.07.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20869922

Country of ref document: EP

Kind code of ref document: A1