Image generation method and device, storage medium and electronic device

CN115346082BActive Publication Date: 2026-09-18QINGDAO HAIER TECH +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210912383.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-29
Publication Date
2026-09-18
Estimated Expiration
2042-07-29

AI Technical Summary

Technical Problem

[0004]本发明实施例提供了一种图像的生成方法、装置、存储介质及电子装置,以至少解决相关技术中现有技术中能采集到的训练样本较少,从而导致训练的识别算法识别准确度不高的问题

Benefits of technology

[0015] This invention obtains a training sample image set and a known sample label corresponding to each training sample image in the set. At least a portion of the training sample images in the set, along with their corresponding known sample labels, are used to train an image generation model to obtain a target image generation model. The target image generation model satisfies a target condition: the loss value between the generated image output by the target image generation model and the input training sample image is less than or equal to a preset threshold. The trained target image generation model can be used to expand the image dataset with limited samples. This increases the training samples for image recognition algorithms, addressing the problem in existing technologies where limited training samples lead to low accuracy in image recognition algorithms. This achieves the effect of expanding the training samples and improving the accuracy of image recognition algorithms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115346082B_ABST
    Figure CN115346082B_ABST
Patent Text Reader

Abstract

This application discloses an image generation method, apparatus, storage medium, and electronic device, relating to the field of smart home / intelligent home technology. The image generation method includes: acquiring a training sample image set and known sample labels corresponding to each training sample image in the training sample image set; training an image generation model to be trained using at least a portion of the training sample images in the training sample image set and the corresponding known sample labels to obtain a target image generation model; wherein the target image generation model satisfies a target condition, which is that the loss value between the generated image output by the target image generation model and the input training sample image is less than or equal to a preset threshold. This solves the problem in existing technologies where the number of available training samples is limited, leading to low recognition accuracy of the trained recognition algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of smart home / intelligent home technology, and more specifically, to an image generation method, apparatus, storage medium, and electronic device. Background Technology

[0002] With the increasing intelligence of homes, people's lives are becoming more and more convenient. For example, smart washing machines can identify care labels on clothes during washing. Using a care label detection and recognition algorithm, they can identify the type of care label in the image and select the washing mode based on the label type and washing requirements, eliminating the need for manual settings. However, because some types of care labels are relatively rare, it is difficult to collect a large number of samples for training the care label detection and recognition algorithm; only a small amount of corresponding sample data can be collected. The recognition algorithm trained with this limited sample data does not have high accuracy in recognizing care labels.

[0003] There is currently no effective solution to the problem that the limited number of training samples available in existing technologies leads to low accuracy in trained recognition algorithms. Summary of the Invention

[0004] This invention provides an image generation method, apparatus, storage medium, and electronic device to at least address the problem in the prior art where the number of training samples that can be collected is small, resulting in low recognition accuracy of the trained recognition algorithm.

[0005] According to an embodiment of the present invention, an image generation method is provided, comprising: acquiring a training sample image set and a known sample label corresponding to each training sample image in the training sample image set; training an image generation model to be trained using at least a portion of the training sample images in the training sample image set and the corresponding known sample labels to obtain a target image generation model; wherein the target image generation model satisfies a target condition, the target condition being that the loss value between the generated image output by the target image generation model and the input training sample image is less than or equal to a preset threshold.

[0006] In an exemplary embodiment, obtaining the training sample image set includes: obtaining an original image set and a label corresponding to each original image in the original image set, wherein the original image set includes original images of multiple categories, and original images of the same category have the same label; obtaining similar images of at least some of the original images in the original image set to obtain a similar image set, wherein the similarity between the original images and the corresponding similar images is greater than or equal to a preset similarity threshold; and determining the original image set and the similar image set as the training sample image set.

[0007] In an exemplary embodiment, training the image generation model to be trained using at least a portion of the training sample image sets and corresponding known sample labels to obtain a target image generation model includes: performing multiple rounds of iterative training on the image generation model to be trained using the training sample images in the training sample image set; during the training process, if the loss value between the generated image output by the image generation model to be trained and the input training sample image is less than or equal to the preset threshold, training is stopped to obtain the target image generation model; if the loss value between the generated image output by the image generation model to be trained and the input training sample image is greater than the preset threshold, the model parameters of the image generation model to be trained are adjusted and training continues.

[0008] In an exemplary embodiment, the image generation model to be trained is trained in the i-th round using the training sample images, where i is an integer greater than or equal to 2. This includes: inputting the training sample images used in the i-th round of training into the image generation model obtained in the (i-1)-th round of training to obtain the generated image determined in the i-th round; stopping training and determining the image generation model obtained in the (i-1)-th round of training as the target image generation model if the loss value between the training sample images used in the i-th round of training and the generated image determined in the i-th round is less than or equal to the preset threshold; and adjusting the model parameters of the image generation model obtained in the (i-1)-th round of training and continuing the (i+1)-th round of training if the loss value between the training sample images used in the i-th round of training and the generated image determined in the i-th round is greater than the preset threshold.

[0009] In one exemplary embodiment, the method further includes: inputting the training sample image used in the i-th round of training and the generated image determined in the i-th round into a loss function to obtain a loss value between the training sample image used in the i-th round of training and the generated image determined in the i-th round.

[0010] In an exemplary embodiment, after obtaining the target image generation model, the method further includes: acquiring the original image to be expanded; inputting the original image to be expanded into the target image generation model; and performing data expansion on the original image to be expanded through the target image generation model to generate a target generated image.

[0011] In one exemplary embodiment, after generating the target generated image, the method further includes: training the image recognition network model to be trained using the original image to be augmented and the target generated image to obtain a trained target image recognition network model; and performing image recognition on the image to be recognized using the target image recognition network model to obtain a predicted label for the image to be recognized.

[0012] According to another embodiment of the present invention, an image generation apparatus is provided, comprising: an acquisition module for acquiring a training sample image set and a known sample label corresponding to each training sample image in the training sample image set; and a training module for training an image generation model to be trained using at least a portion of the training sample images in the training sample image set and the corresponding known sample labels to obtain a target image generation model; wherein the target image generation model satisfies a target condition, the target condition being that the loss value between the generated image output by the target image generation model and the input training sample image is less than or equal to a preset threshold.

[0013] According to yet another embodiment of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.

[0014] According to yet another embodiment of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0015] This invention obtains a training sample image set and a known sample label corresponding to each training sample image in the set. At least a portion of the training sample images in the set, along with their corresponding known sample labels, are used to train an image generation model to obtain a target image generation model. The target image generation model satisfies a target condition: the loss value between the generated image output by the target image generation model and the input training sample image is less than or equal to a preset threshold. The trained target image generation model can be used to expand the image dataset with limited samples. This increases the training samples for image recognition algorithms, addressing the problem in existing technologies where limited training samples lead to low accuracy in image recognition algorithms. This achieves the effect of expanding the training samples and improving the accuracy of image recognition algorithms. Attached Figure Description

[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a schematic diagram of the hardware environment for an image generation method according to an embodiment of the present invention;

[0019] Figure 2 This is a flowchart of an image generation method according to an embodiment of the present invention;

[0020] Figure 3 This is a schematic diagram of a portion of the washable labels according to an embodiment of the present invention;

[0021] Figure 4 This is a schematic diagram of an optional image generation process according to an embodiment of the present invention;

[0022] Figure 5 This is a structural block diagram of an image generation apparatus according to an embodiment of the present invention. Detailed Implementation

[0023] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0025] According to one aspect of the embodiments of this application, an image generation method is provided. This image generation method is widely used in whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, and intelligence house ecosystems. Figure 1 This is a schematic diagram of the hardware environment for an image generation method according to an embodiment of the present invention. Optionally, in this embodiment, the image generation method described above can be applied to, for example... Figure 1 The hardware environment shown consists of terminal device 102 and server 104. For example... Figure 1 As shown, server 104 is connected to terminal device 102 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.

[0026] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. The terminal device 102 may not be limited to PC, mobile phone, tablet computer, smart washing machine, etc.

[0027] This embodiment provides a method for generating an image. Figure 2 This is a flowchart of an image generation method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:

[0028] Step S202: Obtain the training sample image set and the known sample label corresponding to each training sample image in the training sample image set;

[0029] Step S204: Use at least a portion of the training sample images in the training sample image set and the corresponding known sample labels to train the image generation model to obtain the target image generation model.

[0030] The target image generation model satisfies a target condition, which is that the loss value between the generated image output by the target image generation model and the input training sample image is less than or equal to a preset threshold.

[0031] In this embodiment, the image generation model can be a generative adversarial model (GAP), including Deep Convolutional Generative Adversarial Networks (DCGAN), Interpretable Generative Adversarial Networks (infoGAN), WGAN, WGAN-GP, and SNGAN. Each image in the training sample images is labeled, i.e., a sample label is added, so that during the training of the image generation model, the generated image corresponding to the desired sample label can be obtained based on the sample label. For example, the training sample image set includes 1 to 10 sample images, where the sample label for sample images 1 to 3 is type 1, and the sample label for sample images 4 to 10 is type 2. During training, given noise and label 1, the loss value between the image generated by the target image generation model and the training sample image corresponding to label 1 is less than or equal to a preset threshold.

[0032] Labeling the training images in the training image set involves training the generative adversarial model by incorporating conditional information from the conditional generative adversarial network model. Labeling the training images in the training image set ensures that the final generated augmented images are more similar to the sample images corresponding to the sample labels. This prevents the model from learning more features from sample images corresponding to other sample labels. The goal is to obtain a smaller number of generated images of a specific category, thus improving the performance of the generative adversarial network.

[0033] In an exemplary embodiment, obtaining the training sample image set includes: obtaining an original image set and a label corresponding to each original image in the original image set, wherein the original image set includes original images of multiple categories, and original images of the same category have the same label; obtaining similar images of at least some of the original images in the original image set to obtain a similar image set, wherein the similarity between the original images and the corresponding similar images is greater than or equal to a preset similarity threshold; and determining the original image set and the similar image set as the training sample image set.

[0034] In this embodiment, the original image is a water-wash label image obtained by taking a picture of the water-wash label on an item that can be washed by a smart washing machine. The items that can be washed by a smart washing machine include clothes, pants, towels, shoes and all other items that the washing machine supports washing. Different items have the same or different water-wash labels, and one item has one or more water-wash labels.

[0035] The washing label indicates the washing requirements for the corresponding item. Figure 3 This is a schematic diagram of a partial wash label according to an embodiment of the present invention, such as... Figure 3As shown, different labels correspond to different washing requirements. After recognizing the type of care label on the clothes, the washing machine finds the corresponding washing requirement in the preset care label table and selects the corresponding washing mode according to the washing requirement. Without manual setting, the washing machine can automatically select the most suitable washing mode for the clothes without damaging them. The preset care label table records all types of care labels and their corresponding washing requirements. Besides... Figure 3 Besides the care labels mentioned above, labels indicating the material of an item can also be considered care labels. For example, cotton, linen, and pure cotton / linen all have corresponding care labels.

[0036] It should be noted that some types of care labels are relatively common and easy to collect samples from, resulting in a large number of samples collected for these types of care labels; however, some types of care labels are not very common, such as silk garments which are relatively expensive and not very common, making it more difficult to collect training samples. Therefore, the number of samples collected for these types of care labels is not very large.

[0037] Optionally, acquiring the raw image specifically refers to acquiring the raw image of the wash label type from all the collected training samples, which is relatively small.

[0038] For a limited number of images of a certain category of washable labels that are difficult to collect, when training a generative adversarial neural network (GAN) model, similar washable label images of that category can be used as training samples. The GAN model is trained by using collected washable label images of that category and similar images as training samples. Figure 3 Taking the example of a water-wash label image prohibiting the use of chlorine-containing detergents, let's call it water-wash label A. The training sample images for the generative adversarial network model of water-wash label A consist of two parts: one part is the sample image captured by a camera, and the other part is similar images with a similarity greater than or equal to a preset similarity threshold. Among many water-wash labels, some water-wash label categories have similar label patterns. Sample images of water-wash label categories with similar patterns to water-wash label A are determined as similar images with a similarity greater than or equal to the preset similarity threshold. The aforementioned similarity threshold can be determined according to the actual situation, such as 0.5, 0.8, etc.

[0039] It should be noted that similar images can be sample images from other categories. In the setting of wash labels, when washing requirements are similar, the patterns corresponding to their wash labels are also very similar, with the only difference being one or two lines, or one or two dots. For example, if wash label A has similar washing requirements to wash labels B and C, then the sample images corresponding to wash labels B and C are similar to the sample image corresponding to wash label A. The similarity between the above sample images is greater than or equal to the preset similarity threshold. Therefore, a second category matching the wash label category can be determined based on the washing requirements of the sample images, and the sample images corresponding to the second category are determined as the similar images. The sample images corresponding to each category and the determined similar images are used to form the training sample image set of the target image generation model for iterative training.

[0040] In an exemplary embodiment, training the image generation model to be trained using at least a portion of the training sample image sets and corresponding known sample labels to obtain a target image generation model includes: performing multiple rounds of iterative training on the image generation model to be trained using the training sample images in the training sample image set; during the training process, if the loss value between the generated image output by the image generation model to be trained and the input training sample image is less than or equal to the preset threshold, training is stopped to obtain the target image generation model; if the loss value between the generated image output by the image generation model to be trained and the input training sample image is greater than the preset threshold, the model parameters of the image generation model to be trained are adjusted and training continues.

[0041] In this embodiment, the training process of the target image generation model includes: acquiring training samples, adjusting model parameters (i.e., iterative process), and determining model parameters. The training samples for the target image generation model contain training sample images of multiple water-washed label categories. The training samples for the image generation model can include water-washed label images that are difficult to collect, as well as water-washed label images that are easy to collect. By using water-washed label images to train the image generation model, a trained target image generation model is obtained. This trained target image generation model achieves the effect of data augmentation.

[0042] The architecture of the image generation model consists of two parts: a generator and a discriminator. During training, the generator captures the data distribution in the training sample images, learns the data distribution, and outputs generated images. The generated images and training sample images are input into the discriminator together. The discriminator judges the loss value between the generated image output by the image generation model to be trained and the input training sample images. If the loss value is less than or equal to the preset threshold, it means that the generated image output by the generator can confuse the discriminator, and the discriminator cannot identify it as a fake sample generated by the generator. At this time, the training of the image generation model is completed.

[0043] In an exemplary embodiment, the image generation model to be trained is trained in the i-th round using the training sample images, where i is an integer greater than or equal to 2. This includes: inputting the training sample images used in the i-th round of training into the image generation model obtained in the (i-1)-th round of training to obtain the generated image determined in the i-th round; stopping training and determining the image generation model obtained in the (i-1)-th round of training as the target image generation model if the loss value between the training sample images used in the i-th round of training and the generated image determined in the i-th round is less than or equal to the preset threshold; and adjusting the model parameters of the image generation model obtained in the (i-1)-th round of training and continuing the (i+1)-th round of training if the loss value between the training sample images used in the i-th round of training and the generated image determined in the i-th round is greater than the preset threshold.

[0044] In this embodiment, during the iterative training process, each iteration is the i-th training round. The training sample images are input into the image generation model adjusted in the previous iteration, and one or more generated images are output. When the generated sample augmented images meet the target conditions, it means that the image generation model used in this iteration (i.e., the image generation model trained in the previous iteration) has met the target conditions, and this model is determined as the final trained target image generation model. When the generated sample augmented images do not yet meet the target conditions, it means that the generative adversarial network model used in this iteration (i.e., the image generation model trained in the previous iteration) still needs to be adjusted, and the next iteration process is carried out based on the image generation model obtained after this adjustment of parameters.

[0045] It should be noted that the parameters of the image generation model are preset during the first iteration.

[0046] In one exemplary embodiment, the method further includes: inputting the training sample image used in the i-th round of training and the generated image determined in the i-th round into a loss function to obtain a loss value between the training sample image used in the i-th round of training and the generated image determined in the i-th round.

[0047] In an exemplary embodiment, after obtaining the target image generation model, the method further includes: acquiring the original image to be expanded; inputting the original image to be expanded into the target image generation model; and performing data expansion on the original image to be expanded through the target image generation model to generate a target generated image.

[0048] In this embodiment, after obtaining the target image generation model, the original image to be augmented is input into the trained target image generation model to generate one or more augmented images, i.e., target generated images. The target generated images are still washing label images and have the same type of washing label as the original image. The target generated images generated by the trained target image generation model increase the number of images corresponding to the washing label type of the original image to be augmented, thereby expanding the training samples of the trained image recognition network model.

[0049] In one exemplary embodiment, after generating the target generated image, the method further includes: training the image recognition network model to be trained using the original image to be augmented and the target generated image to obtain a trained target image recognition network model; and performing image recognition on the image to be recognized using the target image recognition network model to obtain a predicted label for the image to be recognized.

[0050] In this embodiment, the original image to be expanded and the target generated image are used together as training samples to train the image recognition network model. This increases the number of training samples by adding the expanded image to the original image, which originally had a small number of samples, thereby improving the recognition accuracy of the image recognition network model.

[0051] Before training the image recognition network, the original image is augmented using a generative adversarial network (GAN) model to obtain an augmented image. The augmented image, along with the original image, serves as training samples for the image recognition network model, increasing the number of training samples and thus improving the training performance of the model.

[0052] Obviously, the embodiments described above are only some embodiments of the present invention, and not all embodiments.

[0053] The present invention will be specifically described below with reference to embodiments:

[0054] Figure 4 This is a schematic diagram of an optional image generation process according to an embodiment of the present invention, such as... Figure 4As shown, the process includes: merging the acquired water wash label image that needs data augmentation with a large number of images similar to the water wash label that needs augmentation, using them as training samples for the generative adversarial network model; obtaining a trained generative adversarial network model through the training samples; and generating augmented images through the trained generative adversarial model.

[0055] The generated augmented image and the water label image that needs data augmentation are used together as training samples for the image recognition network model to obtain the trained image recognition network model.

[0056] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0057] This embodiment also provides an image generation apparatus. Figure 5 This is a structural block diagram of an image generation apparatus according to an embodiment of the present invention, such as... Figure 5 As shown, the device includes:

[0058] The acquisition module 502 is used to acquire a training sample image set and a known sample label corresponding to each training sample image in the training sample image set;

[0059] The training module 504 is used to train the image generation model to be trained using at least a portion of the training sample images in the training sample image set and the corresponding known sample labels, so as to obtain the target image generation model.

[0060] The target image generation model satisfies a target condition, which is that the loss value between the generated image output by the target image generation model and the input training sample image is less than or equal to a preset threshold.

[0061] In an exemplary embodiment, the acquisition module is further configured to acquire an original image set and a label corresponding to each original image in the original image set, wherein the original image set includes original images of multiple categories, and original images of the same category have the same label; acquire similar images of at least some of the original images in the original image set to obtain a similar image set, wherein the similarity between the original images and the corresponding similar images is greater than or equal to a preset similarity threshold; and determine the original image set and the similar image set as the training sample image set.

[0062] In an exemplary embodiment, the training module is further configured to perform multiple rounds of iterative training on the image generation model to be trained using training sample images from the training sample image set. During the training process, if the loss value between the generated image output by the image generation model to be trained and the input training sample image is less than or equal to the preset threshold, training is stopped to obtain the target image generation model. If the loss value between the generated image output by the image generation model to be trained and the input training sample image is greater than the preset threshold, the model parameters of the image generation model to be trained are adjusted and training continues.

[0063] In an exemplary embodiment, the above-described apparatus is further configured to perform an i-th round of training on the image generation model to be trained using the training sample images in the following manner, where i is an integer greater than or equal to 2: inputting the training sample images used in the i-th round of training into the image generation model obtained in the (i-1)-th round of training to obtain the generated image determined in the i-th round; if the loss value between the training sample images used in the i-th round of training and the generated image determined in the i-th round is less than or equal to the preset threshold, stopping the training and determining the image generation model obtained in the (i-1)-th round of training as the target image generation model; if the loss value between the training sample images used in the i-th round of training and the generated image determined in the i-th round is greater than the preset threshold, adjusting the model parameters of the image generation model obtained in the (i-1)-th round of training and continuing the (i+1)-th round of training.

[0064] In an exemplary embodiment, the apparatus is further configured to input the training sample image used in the i-th round of training and the generated image determined in the i-th round into a loss function to obtain a loss value between the training sample image used in the i-th round of training and the generated image determined in the i-th round.

[0065] In an exemplary embodiment, the apparatus is further configured to, after obtaining the target image generation model, acquire the original image to be expanded; input the original image to be expanded into the target image generation model, and perform data expansion on the original image to be expanded through the target image generation model to generate the target generated image.

[0066] In an exemplary embodiment, the above-described apparatus is further configured to, after generating the target generated image, use the original image to be expanded and the target generated image to train the image recognition network model to be trained, to obtain a trained target image recognition network model; and use the target image recognition network model to perform image recognition on the image to be recognized, to obtain the predicted label of the image to be recognized.

[0067] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0068] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.

[0069] In this embodiment, the computer-readable storage medium described above may be configured to store a computer program for performing the following steps:

[0070] S1, Obtain the training sample image set and the known sample label corresponding to each training sample image in the training sample image set;

[0071] S2, using at least a portion of the training sample images in the training sample image set and the corresponding known sample labels, train the image generation model to be trained to obtain the target image generation model;

[0072] The target image generation model satisfies a target condition, which is that the loss value between the generated image output by the target image generation model and the input training sample image is less than or equal to a preset threshold.

[0073] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0074] Embodiments of the present invention also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.

[0075] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0076] In one exemplary embodiment, the processor described above may be configured to perform the following steps via a computer program:

[0077] S1, Obtain the training sample image set and the known sample label corresponding to each training sample image in the training sample image set;

[0078] S2, using at least a portion of the training sample images in the training sample image set and the corresponding known sample labels, train the image generation model to be trained to obtain the target image generation model;

[0079] The target image generation model satisfies a target condition, which is that the loss value between the generated image output by the target image generation model and the input training sample image is less than or equal to a preset threshold.

[0080] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0081] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0082] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for generating an image, characterized in that, include: Obtain a training sample image set and a known sample label corresponding to each training sample image in the training sample image set. The training sample image set includes original images and similar images. The similar images are images whose similarity to the original image is greater than or equal to a preset similarity threshold, determined based on the washing requirements of the washing label category of the original image. The category of the similar images matches the category of the washing label. The similarity between the similar images and the original images is determined based on the similarity between the label pattern of the washing label in the similar images and the label image of the washing label in the original images. The image generation model to be trained is obtained by using at least a portion of the training sample images in the training sample image set and the corresponding known sample labels. The target image generation model satisfies a target condition, which is that the loss value between the generated image output by the target image generation model and the input training sample image is less than or equal to a preset threshold. The image generation model to be trained includes a generator and a discriminator. The generator is used to capture the data distribution in the input training sample image and learn the data distribution to output the generated image. The discriminator is used to calculate the loss value between the generated image and the input training sample image.

2. The method according to claim 1, characterized in that, The acquisition of the training sample image set includes: Obtain the original image set and the label corresponding to each original image in the original image set, wherein the original image set includes original images of multiple categories, and original images of the same category have the same label; Obtain similar images of at least a portion of the original images in the original image set to obtain a similar image set, wherein the similarity between the original images and the corresponding similar images is greater than or equal to the preset similarity threshold; The original image set and the similar image set are determined as the training sample image set.

3. The method according to claim 1, characterized in that, The step of training the image generation model to obtain the target image generation model by using at least a portion of the training sample image set and the corresponding known sample labels includes: The image generation model to be trained is trained in multiple rounds using training sample images from the training sample image set. During the training process, if the loss value between the generated image output by the image generation model to be trained and the input training sample image is less than or equal to the preset threshold, the training is stopped to obtain the target image generation model. If the loss value between the generated image output by the image generation model to be trained and the input training sample image is greater than the preset threshold, the model parameters of the image generation model to be trained are adjusted and training continues.

4. The method according to claim 3, characterized in that, The image generation model to be trained is trained in the i-th round using the training sample images, where i is an integer greater than or equal to 2, including: The training sample images used in the i-th round of training are input into the image generation model obtained in the (i-1)-th round of training to obtain the generated image determined in the i-th round; If the loss value between the training sample image used in the i-th round of training and the generated image determined in the i-th round is less than or equal to the preset threshold, training is stopped, and the image generation model obtained in the (i-1)-th round of training is determined as the target image generation model. If the loss value between the training sample image used in the i-th round of training and the generated image determined in the i-th round is greater than the preset threshold, the model parameters of the image generation model obtained in the (i-1)-th round of training are adjusted, and the training continues in the (i+1)-th round.

5. The method according to claim 4, characterized in that, The method further includes: The training sample image used in the i-th round of training and the generated image determined in the i-th round are input into the loss function to obtain the loss value between the training sample image used in the i-th round of training and the generated image determined in the i-th round.

6. The method according to any one of claims 1 to 5, characterized in that, After obtaining the target image generation model, the method further includes: Obtain the original image to be augmented; The original image to be expanded is input into the target image generation model, and the target image generation model is used to expand the data of the original image to be expanded to generate the target generated image.

7. The method according to claim 6, characterized in that, After generating the target image, the method further includes: The original image to be augmented and the target generated image are used to train the image recognition network model to be trained, and a trained target image recognition network model is obtained. The target image recognition network model is used to perform image recognition on the image to be recognized, and the predicted label of the image to be recognized is obtained.

8. An image generation apparatus, characterized in that, include: An acquisition module is used to acquire a training sample image set and a known sample label corresponding to each training sample image in the training sample image set. The training sample image set includes original images and similar images. The similar images are images whose similarity to the original image is greater than or equal to a preset similarity threshold, determined based on the washing requirements of the washing label category of the original image. The category of the similar images matches the category of the washing label. The similarity between the similar images and the original images is determined based on the similarity between the label pattern of the washing label in the similar images and the label image of the washing label in the original images. The training module is used to train the image generation model to be trained using at least a portion of the training sample images in the training sample image set and the corresponding known sample labels, so as to obtain the target image generation model. The target image generation model satisfies a target condition, which is that the loss value between the generated image output by the target image generation model and the input training sample image is less than or equal to a preset threshold. The image generation model to be trained includes a generator and a discriminator. The generator is used to capture the data distribution in the input training sample image and learn the data distribution to output the generated image. The discriminator is used to calculate the loss value between the generated image and the input training sample image.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of claims 1 to 7.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Vehicle model identification method and system based on automatic amplification sample

    CN111079640A

  • Biological feature image recognition method and device, electronic equipment and readable storage medium

    CN112396005A

  • Image classification method, computer terminal and storage medium

    CN113971757A