Icon generation method and device, storage medium, and electronic device
Patent Information
- Application Number
- CN202310773565.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-27
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2043-06-27
Smart Images

Figure CN116824004B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and more specifically, to an icon generation method and apparatus, a computer-readable storage medium, and an electronic device. Background Technology
[0002] An icon can refer to a small graphic symbol or sign in computer interface design, which has a certain degree of visibility and recognizability in various sizes and backgrounds.
[0003] In some related technologies, manually designing icons is not only labor-intensive but also costly. In other related technologies, artificial intelligence is used to generate icons, but the resulting icons are non-transparent three-channel images that are relatively coarse and of poor quality. Summary of the Invention
[0004] The purpose of this disclosure is to provide an icon generation method, apparatus, storage medium, and electronic device, thereby at least to a certain extent achieving the automatic generation of icons with consistent and transparent backgrounds, and improving the icon generation effect.
[0005] According to a first aspect of this disclosure, an icon generation method is provided, comprising: acquiring a prompt, generating an image of the prompt based on an icon generation model to obtain a three-channel composite image; performing image matting on the composite image to obtain a foreground mask image; and fusing the composite image and the foreground mask image to generate an icon corresponding to the prompt.
[0006] According to a second aspect of this disclosure, an icon generation apparatus is provided, comprising: a composite image generation module for acquiring a prompt and generating an image of the prompt based on an icon generation model to obtain a three-channel composite image; a mask image generation module for performing image matting processing on the composite image to obtain a foreground mask image; and an icon generation module for fusing the composite image and the foreground mask image to generate an icon corresponding to the prompt.
[0007] According to a third aspect of this disclosure, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the icon generation method of the first aspect described above and its possible implementations.
[0008] According to a fourth aspect of this disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the icon generation method of the first aspect and possible implementations thereof by executing the executable instructions.
[0009] In the technical solution provided in this embodiment, an image is generated for the prompt based on an icon generation model to obtain a three-channel composite image. Then, the composite image is processed by image matting to obtain a foreground mask image. Finally, the composite image and the foreground mask image are fused to generate an icon corresponding to the prompt. On the one hand, the extraction of the composite image and the foreground mask image, as well as the generation of the icon, can be completed automatically without additional manual operation. On the other hand, by fusing the composite image and the foreground mask image to obtain an icon corresponding to the prompt, the generated icon has a consistent background and is a four-channel image, thus obtaining a high-quality icon and improving the icon generation effect.
[0010] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0011] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0012] Figure 1 A schematic diagram illustrates an application scenario where the icon generation method of the present disclosure embodiments can be applied.
[0013] Figure 2 The illustration shows a flowchart of an icon generation method according to an embodiment of the present disclosure.
[0014] Figure 3 The illustration shows a flowchart of generating a three-channel composite image based on prompts in an embodiment of the present disclosure.
[0015] Figure 4 A schematic diagram illustrating sample icons in an embodiment of this disclosure is shown.
[0016] Figure 5 The illustration shows a schematic diagram of the icons in the embodiments of this disclosure.
[0017] Figure 6 The illustration shows a flowchart of an icon generation method according to an embodiment of the present disclosure.
[0018] Figure 7 A block diagram of an icon generation apparatus according to an embodiment of the present disclosure is shown schematically.
[0019] Figure 8 A block diagram of an electronic device according to an embodiment of the present disclosure is shown schematically. Detailed Implementation
[0020] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this disclosure more comprehensive and complete, and to fully convey the concept of the example embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced with one or more specific details omitted, or other methods, components, apparatus, steps, etc., can be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of this disclosure.
[0021] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0022] In some embodiments of this disclosure, icons can be designed manually. However, obtaining icons manually is not only labor-intensive but also costly. Alternatively, icons can be generated using Artificial Intelligence Generated Content (AIGC). For example, target images can be generated based on methods such as stable diffusion and dreambooth diffusion. Although the aforementioned AIGC-based methods can automatically generate target icon images, the resulting icons are relatively coarse, with inconsistent and non-transparent backgrounds.
[0023] To address the aforementioned technical issues, this disclosure provides an icon generation method that can be applied to application scenarios where target icons are generated based on prompts. Figure 1 A schematic diagram of the system architecture of the icon generation method and apparatus applicable to embodiments of the present disclosure is shown.
[0024] like Figure 1As shown, the system architecture 100 may include terminal devices 101, a network, and a server 102. The network serves as the transmission medium for providing a communication link between the terminal devices and the server, primarily used to transmit the image to be processed and the binary mask image to the server. The network may include various connection types, such as wired, wireless communication links, or fiber optic cables. The terminal device 101 may be various electronic devices, including but not limited to desktop computers, laptops, smartphones, and tablets. It should be understood that... Figure 1 The number of terminal devices 101 and servers 102 shown is merely illustrative; any number of terminal devices and servers can be used depending on the implementation requirements. For example, the servers can be a server cluster composed of multiple servers.
[0025] For example, in this embodiment of the disclosure, terminal device 101 may acquire a prompt and then send the prompt to server 102 via the network. After receiving the prompt, server 102 generates an image of the prompt based on an icon generation model, obtaining a three-channel composite image. Then, it performs image matting on the composite image to obtain a foreground mask image, and merges the composite image and the foreground mask image to generate an icon corresponding to the prompt. Finally, the generated icon is sent to terminal device 101 via the network for display, allowing for subsequent processing based on the icon.
[0026] Alternatively, the prompt can be obtained by the terminal device without sending it to the server. Image generation and background removal can be performed on the terminal device to obtain a composite image and a foreground mask image. The composite image and the foreground mask image are then merged to generate an icon corresponding to the prompt, which is then displayed. There are no restrictions on the executing entity here.
[0027] However, those skilled in the art will readily understand that the above application scenarios are merely illustrative and are not intended to limit the scope of this exemplary embodiment. Based on this, this disclosure provides an icon generation method, specifically including the following steps:
[0028] Step S210: Obtain the prompt and generate an image of the prompt based on the icon generation model to obtain a three-channel composite image;
[0029] Step S220: Perform image matting on the synthesized image to obtain a foreground mask image;
[0030] Step S230: The synthesized image and the foreground mask image are fused to generate an icon corresponding to the prompt.
[0031] The technical solution in this embodiment can automatically extract the synthesized image and the foreground mask image, as well as generate the icon, without additional manual operation. On the other hand, by fusing the synthesized image and the foreground mask image to obtain the icon corresponding to the prompt, the generated icon can have a consistent background and be a four-channel image, thereby obtaining a high-quality icon and improving the icon generation effect.
[0032] Next, refer to Figure 2 The steps of the icon generation method in the embodiments of this disclosure are described in detail below.
[0033] In step S210, the prompt is obtained, and an image is generated from the prompt based on the icon generation model to obtain a three-channel composite image.
[0034] In this embodiment of the disclosure, prompts can be a text description or instruction used to guide the model in generating specific image content. Prompts can be used to characterize features of the image to be generated, such as the type, action, scene, color, or any image-related attributes. Description via prompts facilitates the generation of the corresponding image.
[0035] The prompt can be any suitable word or phrase, and can consist of a single word or a combination of words. For example, the prompt can consist of multiple words, phrases, or short sentences, and can include both positive and negative prompts. Positive prompts help the user determine the direction of image generation, while negative prompts are used to exclude certain image generation directions.
[0036] When multiple prompts exist, each prompt can be assigned a corresponding weight to determine its importance. Furthermore, the order of prompts can be determined according to their weights; for example, the first prompt has the highest weight, and the last prompt has the lowest weight. Duplicate prompts can be merged.
[0037] Given a prompt, the model can learn and generate a corresponding image based on the text prompt. For example, given the prompt "cookie," the model can generate an image that matches the description "cookie."
[0038] In this embodiment of the disclosure, the icon generation model can be used to generate a three-channel composite image based on the prompt, which can be obtained according to the AIGC model. The three-channel composite image can be an icon image with an inconsistent and non-transparent background, because icons usually require transparency and a consistent background, thus requiring further processing of the composite image. For example, the three-channel composite image can be an RGB image, or an HSV image, etc.
[0039] Figure 3 This schematically illustrates a process for generating a three-channel composite image based on prompts. (Reference) Figure 3 As shown, in step S310, a prompt is obtained, and the prompt "sword, pizza" is input into the icon generation model. In step S320, the icon generation model generates a three-channel composite image representing "sword" and "pizza" based on the content of the prompt. In step S330, the composite image is output.
[0040] In some embodiments, obtaining an icon generation model specifically includes the following steps: acquiring sample icons of at least one style; generating sample data of multiple styles based on the sample icons of at least one style and the corresponding keywords of the sample icons; and training a low-rank adaptation model based on the sample data of multiple styles to obtain an icon generation model.
[0041] For example, Figure 4 A schematic diagram of the sample icon is shown. (Reference) Figure 4 As shown, the three sample icons from left to right correspond to the following titles: honey pot, blueberry, and cookie, and these three sample icons are of the same style. In this embodiment of the disclosure, for example, object icons, person icons, or landscape icons can all be used as sample icons of the same style, etc. The specific content of sample icons of the same style is not limited here.
[0042] In this embodiment, the quality of the sample icons is more important than the quantity. Preferably, the number of sample icons of the same style in the sample data is 5-30. Sample icons can be obtained by web scraping, from publicly available datasets, or by creating them themselves; no specific limitation is made here.
[0043] Sample data consisting of sample icons of the same style and their corresponding prompts is used to train a Low-Rank Adaptation (LoRA) model, resulting in an icon generation model. The LoRA model can be viewed as a model that locally fine-tunes a diffusion model, requiring less storage and allowing for customization to learn features specific to a given object. By training the LoRA model using sample data composed of sample icons and prompts, the final icon generation model can be obtained. For example, a LoRA model can be trained based on Stable-diffusionv1.5.
[0044] In some embodiments, a low-rank adaptive model is trained based on sample data of multiple styles to obtain an icon generation model. This includes the following steps: training the low-rank adaptive model separately based on sample data of each style to obtain multiple models; and fusing all models according to the weight parameters corresponding to each model to obtain the icon generation model. Specifically, training a LoRA model using sample data of each style yields multiple LoRA models corresponding to different styles. For example, training a LoRA model using sample data of a person style yields a LoRA model that generates a synthetic image in the style of a person; training a LoRA model using sample data of an object style yields a LoRA model that generates a synthetic image in the style of an object, and so on. Because multiple LoRA models can be used in combination, different weights can be assigned to LoRA models of different styles, and the corresponding LoRA model can be emphasized through weights to train multiple LoRA models to generate synthetic images in a combined manner.
[0045] For example, the weight parameter of the LoRA model corresponding to the human style can be set to 0.8, and the weight parameter of the LoRA model corresponding to the object style can be set to 0.2. The specific values for the weight parameters of different LoRA models are not limited here. Furthermore, the weight parameter is positively correlated with accuracy; that is, the larger the weight parameter, the higher the accuracy of the image generated by the model. For instance, a model 1 can be generated for animals, and a model 2 can be trained for vehicles. If the weight parameter of model 1 is greater than that of model 2, the accuracy of the cat generated by model 1 will be higher, while the accuracy of the car generated by model 2 will be lower. Based on this, all models can be fused according to their weight parameters, specifically by weighted summation, to obtain the image generation model. After obtaining the icon generation model composed of LoRA models corresponding to different styles, for prompts containing multiple styles of content, such as the prompt "child holding a cat", the "child" image can be generated according to the LoRA model corresponding to the person's style, and the "cat" image can be generated according to the LoRA model corresponding to the person's style. Then, the two images are synthesized according to the weight relationship of different LoRA models to obtain a three-channel composite image. Among them, the LoRA model with larger weight parameters generates images with greater similarity and matching degree.
[0046] Continue to refer to Figure 2 As shown, in step S220, the synthesized image is processed by image matting to obtain a foreground mask image.
[0047] In this context, image matting refers to separating a target object from a composite image, finely extracting the main subject. The foreground mask image is a single-channel image that represents the location information of the foreground object of interest in the image. The foreground object area can be black, while the background area can be white. After obtaining the foreground mask image, it can be used as the transparency channel of the icon, resulting in a four-channel icon.
[0048] In this embodiment of the disclosure, before performing matting processing on the synthesized image, a matting model can be trained first. Specifically, the matting model can be trained using a U2-Net network, where U2-Net is a deep learning-based neural network that can be used for pixel-level image segmentation and matting tasks. In other exemplary embodiments of this disclosure, the matting model can also be constructed using a U-Net network, or it can be constructed using other suitable networks such as a global convolutional network (Pyramid Scene Parsing Network, PSPNet).
[0049] In some embodiments, the synthetic image is subjected to matting processing to obtain a foreground mask image, specifically including the following steps: the synthetic image is subjected to matting processing using a matting model to obtain a mask image; the pixel values of the foreground part of the mask image are configured to a first value, and the pixel values of the background part of the mask image are configured to a second value, so as to obtain the foreground mask image.
[0050] In this embodiment of the disclosure, the first value can be 1 and the second value can be 0, then the foreground part of the mask image is black and the background part is white.
[0051] Next, refer to Figure 2 As shown, in step S230, the synthesized image and the foreground mask image are fused to generate an icon corresponding to the prompt.
[0052] The composite image is a three-channel image, while the foreground mask image is a single-channel image. Therefore, the single-channel foreground mask image can be used as the fourth channel of the composite image, namely the transparency channel, so that the background of the final generated icon is consistent and transparent.
[0053] In some embodiments, the composite image and the foreground mask image are fused to generate an icon corresponding to the prompt, specifically including the following steps: channel fusion of the composite image and the foreground mask image to generate a four-channel icon corresponding to the prompt.
[0054] The four-channel icon can contain four channels: red, green, blue, and alpha. The alpha channel stores the alpha value of each pixel and is used to control the visibility of pixels in the image.
[0055] In some embodiments, the synthesized image and the foreground mask image are channel-fused to generate a four-channel icon corresponding to the prompt. Specifically, this includes the following steps: using the foreground mask image as the transparency channel, and channel-compositing the transparency channel and the foreground mask image to generate a four-channel icon corresponding to the prompt.
[0056] Specifically, the foreground mask image and the transparency channel can be fused using the following formula.
[0057] RGBA=Mergehannel(RGB,Seg(RGB))
[0058] A=Seg(RGB),forground=255,background=0
[0059] Wherein, RGBA represents the four-channel composite image, A represents the transparency channel, forground represents the foreground part of the mask image, and background represents the background part of the mask image.
[0060] When fusing the composite image and the foreground mask image to generate an icon, the red channel of the composite image can be copied to the red channel of the icon, the green channel of the composite image can be copied to the green channel of the icon, the blue channel of the composite image can be copied to the blue channel of the icon, the grayscale value of the foreground mask image can be normalized to the range of the alpha channel, and then the normalized alpha channel can be copied to the alpha channel of the icon, finally resulting in an icon with a consistent and transparent background across all four channels.
[0061] In some embodiments, the background of the icon is transparent. Figure 5 The illustration shows an icon with a transparent background. It can be seen that the icon has a consistent and transparent background, providing good visibility and recognizability.
[0062] Figure 6 The flowchart illustrating the icon generation method provided according to an embodiment of the present disclosure is shown in the schematic diagram, which may specifically include the following steps:
[0063] In step S602, the matting model is trained. Specifically, the U2-Net network can be used to train the matting model.
[0064] In step S604, sample icons are collected. Specifically, sample icons of at least one style are acquired, and sample data of multiple styles are generated based on the sample icons of multiple styles and the corresponding keywords of the sample icons.
[0065] In step S606, an icon generation model is trained based on sample icons. Specifically, a low-rank adaptive model is trained on sample data for each style to obtain multiple models, each corresponding to a style. Then, based on the weight parameters corresponding to each model, all models are fused to obtain the icon generation model.
[0066] In step S608, a three-channel composite image is generated based on the icon generation model and combined with word prompting. The three-channel composite image has an inconsistent and non-transparent background. Since icons typically require transparency and a consistent background, further processing of the composite image is necessary.
[0067] In step S610, the synthesized image is processed using a matting model to obtain a foreground mask image. Specifically, the synthesized image is processed using a matting model to obtain a mask image. Then, the pixel values of the foreground portion of the mask image are set to 1, and the pixel values of the background portion of the mask image are set to 0 to obtain the foreground mask image.
[0068] In step S612, the synthesized image and the foreground mask image are fused to generate an icon. Specifically, the foreground mask image is used as the transparency channel, and the transparency channel and the foreground mask image are combined to generate a four-channel icon corresponding to the prompt.
[0069] In the above embodiments, icon generation and image matting models are used to automatically generate icons without manual intervention. The generated icons have consistent and transparent backgrounds, achieving automated generation of high-quality icons. Furthermore, the use of AIGC and visual semantic segmentation algorithms to synthesize icons improves the accuracy of icon generation.
[0070] In the technical solution provided in this embodiment, an image is generated for the prompt based on an icon generation model to obtain a three-channel composite image. Then, the composite image is processed by image matting to obtain a foreground mask image. Finally, the composite image and the foreground mask image are fused to generate an icon corresponding to the prompt. On the one hand, the extraction of the composite image and the foreground mask image, as well as the generation of the icon, can be completed automatically without additional manual operation. On the other hand, by fusing the composite image and the foreground mask image to obtain an icon corresponding to the prompt, the generated icon has a consistent background and is a four-channel image, thus obtaining a high-quality icon and improving the icon generation effect.
[0071] This disclosure provides an icon generation device, with reference to... Figure 7 As shown, the icon generation device 700 may include: a composite image generation module 701, a mask image generation module 702, and an icon generation module 703.
[0072] The composite image generation module 701 can be used to obtain the prompt and generate an image of the prompt based on the icon generation model to obtain a three-channel composite image; the mask image generation module 702 can be used to perform image matting on the composite image to obtain a foreground mask image; and the icon generation module 703 can be used to fuse the composite image and the foreground mask image to generate an icon corresponding to the prompt.
[0073] In one exemplary embodiment of this disclosure, the icon generation apparatus further includes: a sample icon acquisition module for acquiring sample icons of at least one style; a sample data generation module for generating sample data of multiple styles based on the sample icons of at least one style and the corresponding keywords of the sample icons; and a model training module for training a low-rank adaptive model based on the sample data of multiple styles to obtain an icon generation model.
[0074] In one exemplary embodiment of this disclosure, the model training module includes: a model style training unit, used to train a low-rank adaptive model based on sample data of each style to obtain multiple models; and a model fusion unit, used to fuse all models according to the weight parameters corresponding to each model to obtain an icon generation model.
[0075] In an exemplary embodiment of this disclosure, the mask image generation module includes: a matting processing unit, used to perform matting processing on the synthesized image using a matting model to obtain a mask image; and a pixel value configuration unit, used to configure the pixel values of the foreground portion of the mask image to a first value and configure the pixel values of the background portion of the mask image to a second value to obtain a foreground mask image.
[0076] In one exemplary embodiment of this disclosure, the icon generation module is configured to perform channel fusion of the synthesized image and the foreground mask image to generate a four-channel icon corresponding to the prompt.
[0077] In one exemplary embodiment of this disclosure, channel fusion of the synthesized image and the foreground mask image is performed to generate a four-channel icon corresponding to the prompt, including: using the foreground mask image as the transparency channel, and performing channel fusion of the transparency channel and the foreground mask image to generate a four-channel icon corresponding to the prompt.
[0078] In one exemplary embodiment of this disclosure, the background of the icon is transparent.
[0079] It should be noted that the specific details of each part of the above-mentioned icon generation device have been described in detail in some embodiments of the corresponding method. For details that are not disclosed, please refer to the implementation content of the method section, and therefore will not be repeated here.
[0080] Exemplary embodiments of this disclosure also provide an electronic device. This electronic device may be the aforementioned mobile terminal device. Generally, the electronic device may include a processor and a memory, the memory being used to store executable instructions of the processor, and the processor being configured to execute the aforementioned icon generation method by executing the executable instructions.
[0081] The following is based on Figure 8 Taking a mobile terminal 800 as an example, the construction of this electronic device will be described by way of example. Those skilled in the art will understand that, apart from components specifically designed for mobile purposes, Figure 8 The structure can also be applied to fixed types of equipment.
[0082] like Figure 8 As shown, the mobile terminal 800 may specifically include: a processor 801, a memory 802, a bus 803, a mobile communication module 804, an antenna 1, a wireless communication module 805, an antenna 2, a display screen 806, a camera module 807, an audio module 808, a power module 809, and a sensor module 810.
[0083] Processor 801 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, an encoder, a decoder, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). The icon generation method in this exemplary embodiment can be executed by an AP, GPU, or DSP. When the method involves neural network-related processing, it can be executed by an NPU. For example, the NPU can load neural network parameters and execute neural network-related algorithm instructions.
[0084] An encoder encodes (compresses) images or videos to reduce data size for easier storage or transmission. A decoder decodes (decompresses) the encoded data to restore the original image or video data. The mobile terminal 800 can support one or more encoders and decoders, such as image formats like JPEG (Joint Photographic Experts Group), PNG (Portable Network Graphics), and BMP (Bitmap), and video formats like MPEG (Moving Picture Experts Group) 1, MPEG10, H.1083, H.1084, and HEVC (High Efficiency Video Coding).
[0085] The processor 801 can be connected to the memory 802 or other components via the bus 803.
[0086] The memory 802 can be used to store executable program code, which includes instructions. The processor 801 executes various functional applications and data processing of the mobile terminal 800 by running the instructions stored in the memory 802. The memory 802 can also store application data, such as images, videos, and other files.
[0087] The communication functions of the mobile terminal 800 can be implemented through a mobile communication module 804, antenna 1, a wireless communication module 805, antenna 2, a modem processor, and a baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. The mobile communication module 804 can provide 3G, 4G, and 5G mobile communication solutions for use on the mobile terminal 800. The wireless communication module 805 can provide wireless communication solutions such as wireless LAN, Bluetooth, and near-field communication for use on the mobile terminal 800.
[0088] The display screen 806 is used to implement display functions, such as displaying user interfaces, images, and videos. The camera module 807 is used to implement shooting functions, such as capturing images and videos, and may include a color temperature sensor array. The audio module 808 is used to implement audio functions, such as playing audio and capturing voice. The power module 809 is used to implement power management functions, such as charging the battery, supplying power to the device, and monitoring battery status. The sensor module 810 may include one or more sensors to implement corresponding sensing and detection functions. For example, the sensor module 810 may include an inertial sensor, which is used to detect the motion posture of the mobile terminal 800 and output inertial sensing data.
[0089] It should be noted that the present disclosure also provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiments; or it may exist alone and not assembled into the electronic device.
[0090] Computer-readable storage media can be, for example—but not limited to—electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having 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 devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0091] A computer-readable storage medium can be sent, propagated, or transmitted for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable storage medium can be transmitted using any suitable medium, including but not limited to: wireless, wireline, optical fiber, RF, etc., or any suitable combination thereof.
[0092] A computer-readable storage medium carries one or more programs that, when executed by an electronic device, cause the electronic device to perform the methods described in the following embodiments.
[0093] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0094] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of this disclosure and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0095] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0096] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.
[0097] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. An icon generation method, characterized in that, include: The prompt is obtained, and an image is generated from the prompt based on the icon generation model to obtain a three-channel composite image; The process of determining the icon generation model includes: taking sample icons of the same style and their corresponding keywords to form sample data, using the sample data to train a low-rank adaptive model, and obtaining the icon generation model. The synthesized image is then processed by image matting to obtain a foreground mask image; The synthesized image and the foreground mask image are fused to generate an icon corresponding to the prompt; The process of fusing the synthesized image and the foreground mask image to generate an icon corresponding to the prompt includes: The foreground mask image is used as the transparency channel, and the transparency channel and the composite image are combined to generate a four-channel icon corresponding to the prompt.
2. The icon generation method according to claim 1, characterized in that, The method further includes: Obtain sample icons of at least one style; Generate sample data in multiple styles based on at least one style of sample icon and the corresponding keywords of the sample icon; The low-rank adaptation model is trained based on the sample data of the various styles mentioned above to obtain the icon generation model.
3. The icon generation method according to claim 2, characterized in that, The low-rank adaptation model is trained based on the sample data of the various styles to obtain the icon generation model, including: The low-rank adaptive model is trained on sample data for each style to obtain multiple models; Based on the weight parameters corresponding to each model, all models are fused to obtain the icon generation model.
4. The icon generation method according to claim 1, characterized in that, The step of performing image matting on the synthesized image to obtain a foreground mask image includes: The synthesized image is processed using a matting model to obtain a mask image; The pixel values of the foreground portion of the mask image are configured to a first value, and the pixel values of the background portion of the mask image are configured to a second value, so as to obtain the foreground mask image.
5. The icon generation method according to claim 1, characterized in that, The background of the icon is transparent.
6. An icon generation device, characterized in that, include: The composite image generation module is used to obtain the prompt and generate an image of the prompt based on the icon generation model, resulting in a three-channel composite image; The process of determining the icon generation model includes: taking sample icons of the same style and their corresponding keywords to form sample data, using the sample data to train a low-rank adaptive model, and obtaining the icon generation model. A mask image generation module is used to perform image matting processing on the synthesized image to obtain a foreground mask image; An icon generation module is used to fuse the synthesized image and the foreground mask image to generate an icon corresponding to the prompt; The process of fusing the synthesized image and the foreground mask image to generate an icon corresponding to the prompt includes: The foreground mask image is used as the transparency channel, and the transparency channel and the composite image are combined to generate a four-channel icon corresponding to the prompt.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the icon generation method according to any one of claims 1-5.
8. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the icon generation method according to any one of claims 1-5 by executing the executable instructions.
Citation Information
Patent Citations
Image matting method and device, electronic equipment and storage medium
CN114187317A
Image segmentation model generation method, image segmentation method and computer equipment
CN114782460A