Image processing method and device, equipment and storage medium

By obtaining the original image and target logo on the client and inputting them into the pre-trained image stylization model, the problem of single stylized features in the existing technology is solved, and the diversity and distinction of stylized images are improved. Improved user experience.

CN118537207APending Publication Date: 2024-08-23BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310263887.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-02-17
Filing Date
2023-03-17
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

The stylization features of existing clients are relatively single, resulting in small differences in style experience between users and similar stylization results, affecting the user experience.

Method used

By obtaining the original image and target identifier, input them into the pre-trained image stylization model to generate diversified stylized images, and use sample data of different styles to train the model to improve the diversity and distinction of the stylized images generated by the model.

Benefits of technology

It improves the diversity and distinction of generated stylized images, improves user experience, and allows users to obtain more personalized stylized image results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118537207A
    Figure CN118537207A
Patent Text Reader

Abstract

The invention discloses an image processing method and device, equipment and a storage medium, and the method comprises the steps: when a user obtains a stylized image through the method, a target identifier can be obtained at the same time, the target identifier can be used for indicating the stylization type of an original image, and therefore after the original image and the target identifier are input into an image stylization model, the stylization type of the original image is obtained. Therefore, the target stylized image corresponding to the target identifier can be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an image processing method, apparatus, device and storage medium. Background Art

[0002] Currently, users can achieve image stylization through the client's stylization function, that is, through the client's stylization software, using the images taken by the camera, they can achieve stylized effects such as anime style, film and television drama style, etc.

[0003] However, the current client's stylization features are relatively simple, resulting in little difference in style experience between users. The stylization results are relatively similar and have little distinction, which affects the user experience. Summary of the invention

[0004] In view of this, the present application provides an image processing method, apparatus, device and storage medium to increase the diversity of stylized images generated by the model, thereby improving the user experience.

[0005] To achieve the above objectives, the technical solutions provided by this application are as follows:

[0006] In a first aspect of the present application, an image processing method is provided, the method comprising:

[0007] Get the original image;

[0008] Acquire a target identifier, where the target identifier is used to indicate a stylized type of the original image;

[0009] The original image and the target identifier are input into an image stylization model to obtain a target stylized image.

[0010] In a second aspect of the present application, an image processing device is provided, the device comprising:

[0011] A first acquisition unit, used for acquiring an original image;

[0012] A second acquisition unit, used to acquire a target identifier, where the target identifier is used to indicate a stylized type of the original image;

[0013] The third acquisition unit is used to input the original image and the target identifier into the image stylization model to acquire a target stylized image.

[0014] In a third aspect of the present application, an electronic device is provided, the device comprising: a processor and a memory;

[0015] The memory is used to store instructions or computer programs;

[0016] The processor is used to execute the instructions or computer programs in the memory so that the electronic device executes the method described in the first aspect above.

[0017] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium. When the instructions are executed on a device, the device executes the method described in the first aspect above.

[0018] In a fifth aspect of the present application, a computer program product is provided, wherein the computer program product comprises a computer program / instructions, and when the computer program / instructions are executed by a processor, the method described in the first aspect is implemented.

[0019] It can be seen that this application has the following beneficial effects:

[0020] In the above implementation of the present application, in order to improve the diversity of generated stylized images, the model can be pre-trained using sample data with more features to obtain a trained image stylization model. When the user obtains a stylized image using the image stylization model, a target identifier can be obtained, which can be used to indicate the stylization type of the original image, so that after the original image and the target identifier are input into the image stylization model, the target stylized image corresponding to the target identifier can be obtained. Through the method provided by the present application, the model can be trained with sample data of different styles to improve the diversity of stylized images generated by the model, and the difference between different styles can also be increased to improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0022] Figure 1 A flowchart of an image processing method provided in an embodiment of the present application;

[0023] Figure 2 A flowchart of a method for training an image generation model provided in an embodiment of the present application;

[0024] Figure 3 A schematic diagram of a stylized image provided in an embodiment of the present application;

[0025] Figure 4 A schematic diagram of an image processing device provided in an embodiment of the present application;

[0026] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0028] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the type, scope of use, and usage scenarios of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations. For example, in response to receiving an active request from the user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information, so that the user can autonomously choose whether to provide personal information to the electronic device, application, server, storage medium, or other software or hardware that performs the operation of the technical solution of the present disclosure according to the prompt message.

[0029] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information is sent to the user in a manner such as a pop-up window, in which the prompt information can be presented in text form. In addition, the pop-up window can also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0030] It is understandable that the images generated by the methods provided in the embodiments of the present disclosure should be processed in accordance with the provisions of relevant laws and regulations. For example, technical measures should be taken in accordance with regulations to add a logo that does not affect user use, or a prominent logo should be placed in a reasonable location or area in accordance with regulations to inform the public of the depth synthesis situation.

[0031] It is understandable that the above-mentioned notification and process of obtaining user authorization, as well as the processing of images, are merely illustrative and do not constitute a limitation on the implementation method of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation method of the present disclosure.

[0032] Currently, users can use the stylization function of the client to stylize images, such as animation style, film and television style, etc. However, the current client's stylization features are relatively simple, resulting in little difference in style experience between users, and the stylization results are relatively similar, which affects the user experience.

[0033] Based on this, an embodiment of the present application provides an image processing method to improve the diversity of generated stylized images and improve user experience. In specific implementation, in order to improve the diversity of generated stylized images, a model can be pre-trained using sample data with more features to obtain a trained image stylization model. When a user uses the image stylization model to obtain a stylized image, a target identifier can be obtained, which can be used to indicate the stylization type of the original image, so that after the original image and the target identifier are input into the image stylization model, a target stylized image corresponding to the target identifier can be obtained. Through the method provided in the embodiment of the present application, the model can be trained with samples of different styles to improve the diversity of stylized images generated by the model, and the difference between different styles can also be increased to improve user experience.

[0034] In order to facilitate understanding of the technical method provided by the embodiments of the present application, the technical solution provided by the embodiments of the present application will be introduced below in conjunction with the accompanying drawings.

[0035] See also Figure 1 , Figure 1 A flowchart of an image generation method provided in an embodiment of the present application.

[0036] The method can be applied to a client, and the method comprises the following steps:

[0037] S101: Acquire an original image.

[0038] In order to obtain a stylized image of the original image, the client can collect the original image based on the camera. Optionally, the original image can be a real facial image captured in real time, or a captured picture of the facial image.

[0039] S102: Obtain a target identifier, where the target identifier is used to indicate a stylized type of the original image.

[0040] In this embodiment, different stylized images generated by the client have different identifiers, and different target identifiers can be input at the client to obtain images of corresponding stylized types.

[0041] Optionally, the target identifier can be obtained in the following manner: the client can pre-set certain preset conditions, and the corresponding target identifier can be determined when different preset conditions are met. That is, after the client obtains the original image, it can parse the target object in the original image to determine the preset conditions met by the target object, thereby determining the target identifier corresponding to the preset conditions. The preset conditions may include: face shapes with different characteristics, different key point data, etc.

[0042] In addition, the client can pre-set various identifiers in the display interface of the stylized image software, each identifier corresponds to a type of stylized image, and in response to the user's operation of selecting an identifier, the target identifier is obtained. That is, the user can select an identifier in the display interface and enter the corresponding stylized image interface to obtain the stylized image corresponding to the selected identifier. Alternatively, after the user obtains the target stylized image in the stylized image interface, the user can switch different identifiers by switching the stylized image interface to obtain different target stylized images.

[0043] S103: Input the original image and the target identifier into the image stylization model to obtain a target stylized image.

[0044] After the client obtains the original image and the target identifier, the original image and the target identifier can be input into the image stylization model to obtain the corresponding target stylized image. The image stylization model is pre-trained. In order to facilitate understanding of the principle of generating stylized images, the training process of the image stylization model is introduced below.

[0045] See also Figure 2 , Figure 2 A flowchart of a method for training an image generation model provided in an embodiment of the present application.

[0046] The method may be executed by a server, for example, by a processing device of the server. The method may include the following steps:

[0047] S201: Acquire multiple groups of image pairs, where the image pairs include reference images and stylized images.

[0048] In order to enable the image stylization model to generate more types of stylized images, more types of sample data can be obtained, and the initial image generation model can be trained using different types of sample data. The sample data is a plurality of groups of image pairs, each group of image pairs includes a reference image and a stylized image, and each group of image pairs has a corresponding identifier for distinguishing the style types of different image pairs.

[0049] Optionally, multiple groups of image pairs can be obtained in the following manner: first, a stylized image set is obtained, wherein the stylized image set includes multiple stylized images. For example, the stylized image can be an animation stylized image, such as a character image in an animation such as "Detective Conan", "Slam Dunk", "Naruto", etc., or a stylized image in a film and television drama, such as "The Return of the Condor Heroes", "Journey to the West", etc. In this embodiment, the type of stylized image that meets the effect definition can be pre-set to obtain a stylized image set. For example, it can be set to only obtain stylized images that meet the animation style as samples. Then the stylized image set is clustered to obtain multiple sub-category image sets. By classifying the first stylized image set, the distinction and difference between stylized images of different categories can be improved, and the quality of the stylized image of each sub-category can be improved.

[0050] After obtaining multiple subcategory image sets through clustering, multiple identifiers corresponding to the multiple subcategory image sets can be determined, wherein the multiple subcategory image sets correspond one-to-one to the multiple identifiers. That is, each subcategory image set uniquely corresponds to an identifier, and the identifier can be used to distinguish different types of stylized images. It should be noted that the specific method of setting the identifier is not limited in this embodiment. For example, numbers "a, b, c" and the like can be used to distinguish image pairs of different categories. Alternatively, for any category of image pairs, the pixel values ​​of each stylized image included in the category can be normalized, and the value obtained after normalization is used as the identifier corresponding to the category image pair, and the value range of the identifier is [0,1].

[0051] Using the multiple subcategory image sets, obtain the subcategory stylized images corresponding to the reference image, so that the reference image and the corresponding subcategory stylized images are used as a set of image pairs. Specifically, it can be implemented in the following way: for any subcategory image set in the multiple subcategory image sets, use the subcategory image set to train the initial generator to obtain the trained first generator. Among them, the subcategory image set corresponds to the first generator one by one. That is, each subcategory image set trains a generator, so as to obtain multiple generators corresponding to the multiple subcategory image sets respectively. For any first generator, multiple reference images are input into the first generator to obtain the corresponding multiple stylized images, that is, the multiple reference images correspond to the multiple stylized images one by one. For any reference image in the multiple reference images, the reference image and the stylized image corresponding to the reference image form an image pair. For the first generator trained for each subcategory image set, the same steps as above are performed, so as to obtain multiple image pairs of different categories as sample data. Among them, the identifier corresponding to each image pair is the identifier corresponding to the subcategory image set, and the type of image pairs is the same as the type of subcategory image set obtained by clustering the stylized image set, and is also the same as the number of the first generator.

[0052] In a possible implementation, the stylized image set may be a collected initial stylized image set, for example, directly captured character images from an animation. To ensure sample diversity, character images with different features may be obtained, for example, facial images from various angles may be selected.

[0053] Optionally, in order to further improve the adequacy and diversity of samples, the stylized image set can be obtained by expanding the initial stylized image. For example, after obtaining the initial stylized image set, the initial stylized image set can be used to train the second generator, so that the discriminant model of the second generator cannot distinguish whether the stylized image generated by the generation model is a real sample, thereby obtaining a trained third generator. Then, the random variable set is input into the third generator to obtain the first stylized image set. Among them, the random variable set includes multiple random variables. By inputting any random variable set into the third generator, a corresponding stylized image can be obtained, thereby obtaining multiple stylized images as the first stylized image set. Then, the initial stylized image set and the first stylized image set can be combined into a stylized image set.

[0054] When the original image is a facial image, the collected original stylized image may include different facial angles, so the diversity and sufficiency of the sample can be improved by obtaining stylized images of multiple facial angles. The original stylized image set is classified based on the preset angle range set to obtain multiple angle stylized image sets. When the number of original stylized images in a certain angle stylized image set is less than a threshold, a supplementary angle stylized image set matching the facial angle of the angle stylized image set is generated to form a stylized image set.

[0055] In a possible implementation, the random variable set can also be input into the third generator. After obtaining the second stylized image set, the server can also perform facial attribute recognition on the second stylized image set to obtain the facial angle of each stylized image. After determining the facial angle of each stylized image, the server can classify the second stylized image set according to the preset angle range set, so as to determine the angle stylized image set corresponding to each angle range. Among them, this embodiment does not limit the specific method of dividing the preset angle range set of facial images. For example, the preset angle range set can be set to include -90°-30°, -30°-0°, 0°-30° and 30°-90°, etc., wherein 0° can indicate that the facial image is a frontal face, when the angle of the facial image is biased to the left, the angle is negative, and when the angle of the facial image is biased to the right, the angle is positive.

[0056] When the number of stylized images in a certain angle stylized image set is less than a threshold, it indicates that the sample data in the angle range is insufficient, and the target random variable set corresponding to the angle stylized images in the angle range can be obtained to achieve sample supplementation. That is, the target random variable set is input into the third generator again to obtain a supplementary angle stylized image set that satisfies the angle range, and the second stylized image set and the regenerated supplementary angle stylized image set are combined into a second stylized image set to improve the adequacy of sample features.

[0057] In a possible implementation, clustering of a set of stylized images can be achieved in the following manner: for any stylized image in the set of stylized images, feature extraction is performed on the stylized image to obtain a feature vector. Optionally, a convolutional neural network can be used to extract features from images. That is, by performing feature extraction on each image in the set of stylized images using a convolutional neural network, a corresponding plurality of feature vectors can be obtained, and the feature vectors can be used to represent feature information of the image. After obtaining the feature vector corresponding to each image in the set of style images, the plurality of feature vectors are clustered to obtain a plurality of feature vector sets, and the plurality of feature vector sets correspond to a plurality of subcategory image sets. Based on the feature vectors included in each feature vector set, the set of images belonging to the category can be determined.

[0058] Optionally, the K-means clustering algorithm can be used to achieve clustering of multiple feature vectors. The basic principle of the K-means clustering algorithm is: first randomly select k feature vectors from multiple feature vectors as initial cluster centers, then calculate the distance between each feature vector and each seed cluster center, such as the Euclidean distance, and assign each feature vector to the cluster center closest to it. When the clustering is completed, the cluster center and the feature vectors assigned to them represent a cluster, and then the cluster center of the cluster is recalculated based on the feature vectors included in each cluster. For example, the cluster center can be the one with the smallest sum of distances to each feature vector in the cluster. According to the newly calculated cluster center, each feature vector is redistributed, and the clustering process is repeated until a certain termination condition is met. For example, the termination condition can be that no feature vector is redistributed to a different cluster, or no cluster center changes.

[0059] S202: Inputting a reference image and a logo corresponding to the reference image into an initial image generation model to obtain an output stylized image.

[0060] After determining the identifier corresponding to each image pair, the initial image generation model can be trained based on the image pair and the corresponding identifier. In specific implementation, multiple reference images and the identifiers corresponding to the multiple reference images can be input into the initial image generation model to obtain multiple output stylized images, wherein the multiple facial images correspond to the multiple output stylized images one by one.

[0061] S203: Adjusting the initial image generation model based on the stylized image and the output stylized image.

[0062] Since the sample data includes multiple image pairs, that is, each reference image corresponds to a stylized image, a loss function can be determined based on multiple stylized images corresponding to multiple reference images and multiple output stylized images. Among them, the loss function can be used to represent the difference between the stylized image in the image pair and the output stylized image, that is, the accuracy of the initial image generation model. The larger the loss function, the greater the difference between the stylized image and the output stylized image, that is, the less accurate the initial image generation model. For example, the first eigenvector of any stylized image in the image pair and the second eigenvector of the output stylized image corresponding to the stylized image can be obtained. The eigenvector can be used to represent the characteristics of the image, and then the similarity between the first eigenvector and the second eigenvector is calculated as the loss function.

[0063] When the loss function is greater than or equal to a preset value, the parameters of the initial image generation model are adjusted, and the multiple images in the sample data and the identifiers corresponding to the multiple images are input into the initial image generation model and the subsequent training process is re-executed until the loss function is less than the preset value to obtain the image stylization model.

[0064] When the loss function is greater than or equal to a preset value, it indicates that the accuracy of the initial image generation model does not meet the requirements. The parameters of the initial image generation model can be adjusted, and the multiple reference images and the identifiers corresponding to the multiple reference images can be input into the initial image generation model and the subsequent training process can be re-executed until the determined loss function is less than the preset value, thereby obtaining a trained image stylization model.

[0065] Through the training method of the image generation model provided in the above embodiment, the image generation model can be trained based on more types of samples to improve the diversity of generated stylized images. In addition, when training the model, the identifiers of different types of stylized images can be determined by clustering, thereby increasing the distinction between different types of stylized images and improving user experience. Figure 3 , Figure 3 A schematic diagram of a stylized image provided by an embodiment of the present application. When multiple image pairs include four types of identifiers, the four stylized images obtained by inputting a facial image are as follows: Figure 3 shown.

[0066] When the server obtains the image stylization model through training, it can be provided to the client, and the client can generate a stylized image using the image stylization model. The client can generate a stylized image by using the stylized image generation software. That is, the user can obtain a stylized image based on the image by using the client's stylized image generation function. The client can be a mobile phone, tablet or other device.

[0067] Based on the above method embodiment, the present application embodiment also provides an image processing device. Figure 4 , Figure 4 A schematic diagram of an image processing device provided in an embodiment of the present application.

[0068] The device 400 comprises:

[0069] A first acquisition unit 401 is used to acquire an original image;

[0070] A second acquisition unit 402 is used to acquire a target identifier, where the target identifier is used to indicate a stylized type of the original image;

[0071] The third acquisition unit 403 is used to input the original image and the target identifier into an image stylization model to acquire a target stylized image.

[0072] In a possible implementation, the second acquisition unit 402 is specifically used to parse the target object in the original image, and when the target object meets a preset condition, obtain a target identifier corresponding to the preset condition; or, in response to a user selecting an identifier, obtain the target identifier.

[0073] In a possible implementation, the apparatus 400 further includes: a fourth acquiring unit;

[0074] The fourth acquisition unit is used to acquire multiple groups of image pairs, where the image pairs include reference images and stylized images, and the image pairs have corresponding identifiers, which are used to distinguish the style types of different image pairs; input the reference images and the identifiers corresponding to the reference images into the initial image generation model to obtain output stylized images; and adjust the initial image generation model based on the stylized images and the output stylized images.

[0075] In a possible implementation, the fourth acquisition unit is specifically used to acquire a set of stylized images; cluster the set of stylized images to acquire multiple subcategory image sets; determine multiple identifiers corresponding to the multiple subcategory image sets, and the multiple subcategory image sets correspond to the multiple identifiers one-to-one; use the multiple subcategory image sets to acquire a subcategory stylized image corresponding to the reference image; and use the reference image and the corresponding subcategory stylized image as the image pair, and the identifier corresponding to the image pair is the same as the identifier corresponding to the subcategory image set.

[0076] In a possible implementation, the fourth acquisition unit is specifically used to acquire a set of original stylized images; perform attribute recognition on the set of original stylized images to determine the angles of the original stylized images in the set of original stylized images; classify the set of original stylized images based on a preset angle range set to acquire multiple angle stylized image sets; when the number of original stylized images in the angle stylized image set is less than a threshold, generate a set of supplementary angle stylized images that match the angle of the angle stylized image set to form the stylized image set.

[0077] In a possible implementation, the fourth acquisition unit is specifically configured to perform feature extraction on the stylized image to obtain a feature vector; cluster a plurality of the feature vectors to obtain a plurality of feature vector sets; and determine the plurality of subcategory image sets based on the plurality of feature vector sets.

[0078] The beneficial effects of the image processing device provided in the embodiment of the present application can be found in the above method embodiment and will not be described in detail here.

[0079] It should be noted that the specific implementation of each unit in this embodiment can refer to the relevant description in the above method embodiment. The division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. The functional units in the embodiment of the present application can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. For example, in the above embodiment, the processing unit and the sending unit can be the same unit or different units. The above integrated units can be implemented in the form of hardware or in the form of software functional units.

[0080] See also Figure 5 , which shows a schematic diagram of the structure of an electronic device 500 suitable for implementing the embodiment of the present application. The terminal device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0081] like Figure 5 As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0082] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0083] In particular, 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, an embodiment of the present application includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 509, or installed from the storage device 508, or installed from the ROM502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present application are executed.

[0084] The electronic device provided in the embodiment of the present application and the method provided in the above embodiment belong to the same inventive concept. The technical details not fully described in this embodiment can be referred to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.

[0085] An embodiment of the present application provides a computer storage medium on which a computer program is stored. When the program is executed by a processor, the method provided by the above embodiment is implemented.

[0086] It should be noted that the computer-readable medium mentioned above in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0087] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (Hyper Text Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0088] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0089] The computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device can execute the method.

[0090] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0091] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0092] The units involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the unit / module does not, in some cases, constitute a limitation on the unit itself.

[0093] The functions described above herein 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 may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0094] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0095] According to one or more embodiments of the present application, an image processing method is provided, which may include:

[0096] Get the original image;

[0097] Acquire a target identifier, where the target identifier is used to indicate a stylized type of the original image;

[0098] The original image and the target identifier are input into an image stylization model to obtain a target stylized image.

[0099] According to one or more embodiments of the present application, obtaining the target identifier includes:

[0100] The target object in the original image is parsed, and when the target object meets a preset condition, a target identifier corresponding to the preset condition is obtained; or, in response to a user selecting an identifier, the target identifier is obtained.

[0101] According to one or more embodiments of the present application, the image stylization model is obtained based on the following steps:

[0102] Acquire multiple groups of image pairs, the image pairs including reference images and stylized images, the image pairs having corresponding identifiers, and the identifiers are used to distinguish style types of different image pairs;

[0103] Inputting the reference image and the identifier corresponding to the reference image into an initial image generation model to obtain an output stylized image;

[0104] The initial image generation model is adjusted based on the stylized image and the output stylized image.

[0105] According to one or more embodiments of the present application, acquiring multiple groups of image pairs includes:

[0106] Get a collection of stylized images;

[0107] Clustering the stylized image set to obtain multiple subcategory image sets;

[0108] Determine a plurality of identifiers corresponding to the plurality of subcategory image sets, wherein the plurality of subcategory image sets correspond to the plurality of identifiers one-to-one;

[0109] Acquire a subcategory stylized image corresponding to the reference image using the plurality of subcategory image sets;

[0110] The reference image and the corresponding subcategory stylized image are taken as the image pair, and the identifier corresponding to the image pair is the same as the identifier corresponding to the subcategory image set.

[0111] According to one or more embodiments of the present application, obtaining a set of stylized images includes:

[0112] Get the original stylized image set;

[0113] Performing attribute recognition on the original stylized image set to determine angles of original stylized images in the original stylized image set;

[0114] Classifying the original stylized image set based on a preset angle range set to obtain a plurality of angle stylized image sets;

[0115] When the number of original stylized images in the angular stylized image set is less than a threshold, a set of supplementary angular stylized images matching the angle of the angular stylized image set is generated to form the stylized image set.

[0116] According to one or more embodiments of the present application, clustering the stylized image set to obtain multiple subcategory image sets includes:

[0117] Performing feature extraction on the stylized image to obtain a feature vector;

[0118] Clustering the plurality of feature vectors to obtain a plurality of feature vector sets;

[0119] The plurality of subcategory image sets are determined based on the plurality of feature vector sets.

[0120] According to one or more embodiments of the present application, an image processing device is provided, which may include:

[0121] A first acquisition unit, used for acquiring an original image;

[0122] A second acquisition unit, used to acquire a target identifier, where the target identifier is used to indicate a stylized type of the original image;

[0123] The third acquisition unit is used to input the original image and the target identifier into an image stylization model to acquire a target stylized image.

[0124] In one or more embodiments of the present application, the second acquisition unit is specifically used to parse the target object in the original image, and when the target object meets a preset condition, obtain a target identifier corresponding to the preset condition; or, in response to a user selecting an identifier, obtain the target identifier.

[0125] In one or more embodiments of the present application, the apparatus further includes: a fourth acquisition unit;

[0126] The fourth acquisition unit is used to acquire multiple groups of image pairs, where the image pairs include reference images and stylized images, and the image pairs have corresponding identifiers, which are used to distinguish the style types of different image pairs; input the reference images and the identifiers corresponding to the reference images into the initial image generation model to obtain output stylized images; and adjust the initial image generation model based on the stylized images and the output stylized images.

[0127] In one or more embodiments of the present application, the fourth acquisition unit is specifically used to acquire a set of stylized images; cluster the set of stylized images to acquire multiple subcategory image sets; determine multiple identifiers corresponding to the multiple subcategory image sets, and the multiple subcategory image sets correspond to the multiple identifiers one by one; use the multiple subcategory image sets to acquire a subcategory stylized image corresponding to the reference image; use the reference image and the corresponding subcategory stylized image as the image pair, and the identifier corresponding to the image pair is the same as the identifier corresponding to the subcategory image set.

[0128] In one or more embodiments of the present application, the fourth acquisition unit is specifically used to acquire a set of original stylized images; perform attribute recognition on the set of original stylized images to determine the angles of the original stylized images in the set of original stylized images; classify the set of original stylized images based on a preset angle range set to acquire multiple angle stylized image sets; when the number of original stylized images in the angle stylized image set is less than a threshold, generate a set of supplementary angle stylized images that match the angle of the angle stylized image set to form the stylized image set.

[0129] In one or more embodiments of the present application, the fourth acquisition unit is specifically used to perform feature extraction on the stylized image to obtain a feature vector; cluster multiple feature vectors to obtain multiple feature vector sets; and determine the multiple subcategory image sets based on the multiple feature vector sets.

[0130] According to one or more embodiments of the present application, an electronic device is provided, the device comprising: a processor and a memory;

[0131] The memory is used to store instructions or computer programs;

[0132] The processor is used to execute the instructions or computer programs in the memory so that the electronic device performs the image processing method.

[0133] According to one or more embodiments of the present application, a computer-readable storage medium is provided, in which instructions are stored. When the instructions are executed on a device, the device executes the image processing method.

[0134] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the system or device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0135] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0136] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0137] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0138] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An image processing method, It is characterized in that The method comprises: Get the original image; Acquire a target identifier, where the target identifier is used to indicate a stylized type of the original image; The original image and the target identifier are input into an image stylization model to obtain a target stylized image.

2. The method according to claim 1, It is characterized in that The obtaining of the target identifier includes: The target object in the original image is parsed, and when the target object meets a preset condition, a target identifier corresponding to the preset condition is obtained; or, in response to a user selecting an identifier, the target identifier is obtained.

3. The method according to claim 1, It is characterized in that The image stylization model is obtained based on the following steps: Acquire multiple groups of image pairs, the image pairs including reference images and stylized images, the image pairs having corresponding identifiers, and the identifiers are used to distinguish style types of different image pairs; Inputting the reference image and the identifier corresponding to the reference image into an initial image generation model to obtain an output stylized image; The initial image generation model is adjusted based on the stylized image and the output stylized image.

4. The method according to claim 3, It is characterized in that The obtaining of multiple sets of image pairs comprises: Get a collection of stylized images; Clustering the stylized image set to obtain multiple subcategory image sets; Determine a plurality of identifiers corresponding to the plurality of subcategory image sets, wherein the plurality of subcategory image sets correspond to the plurality of identifiers one-to-one; Acquire a subcategory stylized image corresponding to the reference image using the plurality of subcategory image sets; The reference image and the corresponding subcategory stylized image are taken as the image pair, and the identifier corresponding to the image pair is the same as the identifier corresponding to the subcategory image set.

5. The method according to claim 4, It is characterized in that The step of obtaining a set of stylized images comprises: Get the original stylized image set; Performing attribute recognition on the original stylized image set to determine angles of original stylized images in the original stylized image set; Classifying the original stylized image set based on a preset angle range set to obtain a plurality of angle stylized image sets; When the number of original stylized images in the angular stylized image set is less than a threshold, a set of supplementary angular stylized images matching the angle of the angular stylized image set is generated to form the stylized image set.

6. The method according to claim 4, It is characterized in that The step of clustering the stylized image set to obtain a plurality of subcategory image sets includes: Performing feature extraction on the stylized image to obtain a feature vector; Clustering the plurality of feature vectors to obtain a plurality of feature vector sets; The plurality of subcategory image sets are determined based on the plurality of feature vector sets.

7. An image processing device, It is characterized in that The device comprises: A first acquisition unit, used for acquiring an original image; A second acquisition unit, used to acquire a target identifier, where the target identifier is used to indicate a stylized type of the original image; The third acquisition unit is used to input the original image and the target identifier into an image stylization model to acquire a target stylized image.

8. An electronic device, It is characterized in that The device comprises: a processor and a memory; The memory is used to store instructions or computer programs; The processor is used to execute the instructions or computer programs in the memory so that the electronic device executes the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on a device, the device executes the method according to any one of claims 1 to 6.